jt3d.es.js 5.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384873858738687387873888738987390873918739287393873948739587396873978739887399874008740187402874038740487405874068740787408874098741087411874128741387414874158741687417874188741987420874218742287423874248742587426874278742887429874308743187432874338743487435874368743787438874398744087441874428744387444874458744687447874488744987450874518745287453874548745587456874578745887459874608746187462874638746487465874668746787468874698747087471874728747387474874758747687477874788747987480874818748287483874848748587486874878748887489874908749187492874938749487495874968749787498874998750087501875028750387504875058750687507875088750987510875118751287513875148751587516875178751887519875208752187522875238752487525875268752787528875298753087531875328753387534875358753687537875388753987540875418754287543875448754587546875478754887549875508755187552875538755487555875568755787558875598756087561875628756387564875658756687567875688756987570875718757287573875748757587576875778757887579875808758187582875838758487585875868758787588875898759087591875928759387594875958759687597875988759987600876018760287603876048760587606876078760887609876108761187612876138761487615876168761787618876198762087621876228762387624876258762687627876288762987630876318763287633876348763587636876378763887639876408764187642876438764487645876468764787648876498765087651876528765387654876558765687657876588765987660876618766287663876648766587666876678766887669876708767187672876738767487675876768767787678876798768087681876828768387684876858768687687876888768987690876918769287693876948769587696876978769887699877008770187702877038770487705877068770787708877098771087711877128771387714877158771687717877188771987720877218772287723877248772587726877278772887729877308773187732877338773487735877368773787738877398774087741877428774387744877458774687747877488774987750877518775287753877548775587756877578775887759877608776187762877638776487765877668776787768877698777087771877728777387774877758777687777877788777987780877818778287783877848778587786877878778887789877908779187792877938779487795877968779787798877998780087801878028780387804878058780687807878088780987810878118781287813878148781587816878178781887819878208782187822878238782487825878268782787828878298783087831878328783387834878358783687837878388783987840878418784287843878448784587846878478784887849878508785187852878538785487855878568785787858878598786087861878628786387864878658786687867878688786987870878718787287873878748787587876878778787887879878808788187882878838788487885878868788787888878898789087891878928789387894878958789687897878988789987900879018790287903879048790587906879078790887909879108791187912879138791487915879168791787918879198792087921879228792387924879258792687927879288792987930879318793287933879348793587936879378793887939879408794187942879438794487945879468794787948879498795087951879528795387954879558795687957879588795987960879618796287963879648796587966879678796887969879708797187972879738797487975879768797787978879798798087981879828798387984879858798687987879888798987990879918799287993879948799587996879978799887999880008800188002880038800488005880068800788008880098801088011880128801388014880158801688017880188801988020880218802288023880248802588026880278802888029880308803188032880338803488035880368803788038880398804088041880428804388044880458804688047880488804988050880518805288053880548805588056880578805888059880608806188062880638806488065880668806788068880698807088071880728807388074880758807688077880788807988080880818808288083880848808588086880878808888089880908809188092880938809488095880968809788098880998810088101881028810388104881058810688107881088810988110881118811288113881148811588116881178811888119881208812188122881238812488125881268812788128881298813088131881328813388134881358813688137881388813988140881418814288143881448814588146881478814888149881508815188152881538815488155881568815788158881598816088161881628816388164881658816688167881688816988170881718817288173881748817588176881778817888179881808818188182881838818488185881868818788188881898819088191881928819388194881958819688197881988819988200882018820288203882048820588206882078820888209882108821188212882138821488215882168821788218882198822088221882228822388224882258822688227882288822988230882318823288233882348823588236882378823888239882408824188242882438824488245882468824788248882498825088251882528825388254882558825688257882588825988260882618826288263882648826588266882678826888269882708827188272882738827488275882768827788278882798828088281882828828388284882858828688287882888828988290882918829288293882948829588296882978829888299883008830188302883038830488305883068830788308883098831088311883128831388314883158831688317883188831988320883218832288323883248832588326883278832888329883308833188332883338833488335883368833788338883398834088341883428834388344883458834688347883488834988350883518835288353883548835588356883578835888359883608836188362883638836488365883668836788368883698837088371883728837388374883758837688377883788837988380883818838288383883848838588386883878838888389883908839188392883938839488395883968839788398883998840088401884028840388404884058840688407884088840988410884118841288413884148841588416884178841888419884208842188422884238842488425884268842788428884298843088431884328843388434884358843688437884388843988440884418844288443884448844588446884478844888449884508845188452884538845488455884568845788458884598846088461884628846388464884658846688467884688846988470884718847288473884748847588476884778847888479884808848188482884838848488485884868848788488884898849088491884928849388494884958849688497884988849988500885018850288503885048850588506885078850888509885108851188512885138851488515885168851788518885198852088521885228852388524885258852688527885288852988530885318853288533885348853588536885378853888539885408854188542885438854488545885468854788548885498855088551885528855388554885558855688557885588855988560885618856288563885648856588566885678856888569885708857188572885738857488575885768857788578885798858088581885828858388584885858858688587885888858988590885918859288593885948859588596885978859888599886008860188602886038860488605886068860788608886098861088611886128861388614886158861688617886188861988620886218862288623886248862588626886278862888629886308863188632886338863488635886368863788638886398864088641886428864388644886458864688647886488864988650886518865288653886548865588656886578865888659886608866188662886638866488665886668866788668886698867088671886728867388674886758867688677886788867988680886818868288683886848868588686886878868888689886908869188692886938869488695886968869788698886998870088701887028870388704887058870688707887088870988710887118871288713887148871588716887178871888719887208872188722887238872488725887268872788728887298873088731887328873388734887358873688737887388873988740887418874288743887448874588746887478874888749887508875188752887538875488755887568875788758887598876088761887628876388764887658876688767887688876988770887718877288773887748877588776887778877888779887808878188782887838878488785887868878788788887898879088791887928879388794887958879688797887988879988800888018880288803888048880588806888078880888809888108881188812888138881488815888168881788818888198882088821888228882388824888258882688827888288882988830888318883288833888348883588836888378883888839888408884188842888438884488845888468884788848888498885088851888528885388854888558885688857888588885988860888618886288863888648886588866888678886888869888708887188872888738887488875888768887788878888798888088881888828888388884888858888688887888888888988890888918889288893888948889588896888978889888899889008890188902889038890488905889068890788908889098891088911889128891388914889158891688917889188891988920889218892288923889248892588926889278892888929889308893188932889338893488935889368893788938889398894088941889428894388944889458894688947889488894988950889518895288953889548895588956889578895888959889608896188962889638896488965889668896788968889698897088971889728897388974889758897688977889788897988980889818898288983889848898588986889878898888989889908899188992889938899488995889968899788998889998900089001890028900389004890058900689007890088900989010890118901289013890148901589016890178901889019890208902189022890238902489025890268902789028890298903089031890328903389034890358903689037890388903989040890418904289043890448904589046890478904889049890508905189052890538905489055890568905789058890598906089061890628906389064890658906689067890688906989070890718907289073890748907589076890778907889079890808908189082890838908489085890868908789088890898909089091890928909389094890958909689097890988909989100891018910289103891048910589106891078910889109891108911189112891138911489115891168911789118891198912089121891228912389124891258912689127891288912989130891318913289133891348913589136891378913889139891408914189142891438914489145891468914789148891498915089151891528915389154891558915689157891588915989160891618916289163891648916589166891678916889169891708917189172891738917489175891768917789178891798918089181891828918389184891858918689187891888918989190891918919289193891948919589196891978919889199892008920189202892038920489205892068920789208892098921089211892128921389214892158921689217892188921989220892218922289223892248922589226892278922889229892308923189232892338923489235892368923789238892398924089241892428924389244892458924689247892488924989250892518925289253892548925589256892578925889259892608926189262892638926489265892668926789268892698927089271892728927389274892758927689277892788927989280892818928289283892848928589286892878928889289892908929189292892938929489295892968929789298892998930089301893028930389304893058930689307893088930989310893118931289313893148931589316893178931889319893208932189322893238932489325893268932789328893298933089331893328933389334893358933689337893388933989340893418934289343893448934589346893478934889349893508935189352893538935489355893568935789358893598936089361893628936389364893658936689367893688936989370893718937289373893748937589376893778937889379893808938189382893838938489385893868938789388893898939089391893928939389394893958939689397893988939989400894018940289403894048940589406894078940889409894108941189412894138941489415894168941789418894198942089421894228942389424894258942689427894288942989430894318943289433894348943589436894378943889439894408944189442894438944489445894468944789448894498945089451894528945389454894558945689457894588945989460894618946289463894648946589466894678946889469894708947189472894738947489475894768947789478894798948089481894828948389484894858948689487894888948989490894918949289493894948949589496894978949889499895008950189502895038950489505895068950789508895098951089511895128951389514895158951689517895188951989520895218952289523895248952589526895278952889529895308953189532895338953489535895368953789538895398954089541895428954389544895458954689547895488954989550895518955289553895548955589556895578955889559895608956189562895638956489565895668956789568895698957089571895728957389574895758957689577895788957989580895818958289583895848958589586895878958889589895908959189592895938959489595895968959789598895998960089601896028960389604896058960689607896088960989610896118961289613896148961589616896178961889619896208962189622896238962489625896268962789628896298963089631896328963389634896358963689637896388963989640896418964289643896448964589646896478964889649896508965189652896538965489655896568965789658896598966089661896628966389664896658966689667896688966989670896718967289673896748967589676896778967889679896808968189682896838968489685896868968789688896898969089691896928969389694896958969689697896988969989700897018970289703897048970589706897078970889709897108971189712897138971489715897168971789718897198972089721897228972389724897258972689727897288972989730897318973289733897348973589736897378973889739897408974189742897438974489745897468974789748897498975089751897528975389754897558975689757897588975989760897618976289763897648976589766897678976889769897708977189772897738977489775897768977789778897798978089781897828978389784897858978689787897888978989790897918979289793897948979589796897978979889799898008980189802898038980489805898068980789808898098981089811898128981389814898158981689817898188981989820898218982289823898248982589826898278982889829898308983189832898338983489835898368983789838898398984089841898428984389844898458984689847898488984989850898518985289853898548985589856898578985889859898608986189862898638986489865898668986789868898698987089871898728987389874898758987689877898788987989880898818988289883898848988589886898878988889889898908989189892898938989489895898968989789898898998990089901899028990389904899058990689907899088990989910899118991289913899148991589916899178991889919899208992189922899238992489925899268992789928899298993089931899328993389934899358993689937899388993989940899418994289943899448994589946899478994889949899508995189952899538995489955899568995789958899598996089961899628996389964899658996689967899688996989970899718997289973899748997589976899778997889979899808998189982899838998489985899868998789988899898999089991899928999389994899958999689997899988999990000900019000290003900049000590006900079000890009900109001190012900139001490015900169001790018900199002090021900229002390024900259002690027900289002990030900319003290033900349003590036900379003890039900409004190042900439004490045900469004790048900499005090051900529005390054900559005690057900589005990060900619006290063900649006590066900679006890069900709007190072900739007490075900769007790078900799008090081900829008390084900859008690087900889008990090900919009290093900949009590096900979009890099901009010190102901039010490105901069010790108901099011090111901129011390114901159011690117901189011990120901219012290123901249012590126901279012890129901309013190132901339013490135901369013790138901399014090141901429014390144901459014690147901489014990150901519015290153901549015590156901579015890159901609016190162901639016490165901669016790168901699017090171901729017390174901759017690177901789017990180901819018290183901849018590186901879018890189901909019190192901939019490195901969019790198901999020090201902029020390204902059020690207902089020990210902119021290213902149021590216902179021890219902209022190222902239022490225902269022790228902299023090231902329023390234902359023690237902389023990240902419024290243902449024590246902479024890249902509025190252902539025490255902569025790258902599026090261902629026390264902659026690267902689026990270902719027290273902749027590276902779027890279902809028190282902839028490285902869028790288902899029090291902929029390294902959029690297902989029990300903019030290303903049030590306903079030890309903109031190312903139031490315903169031790318903199032090321903229032390324903259032690327903289032990330903319033290333903349033590336903379033890339903409034190342903439034490345903469034790348903499035090351903529035390354903559035690357903589035990360903619036290363903649036590366903679036890369903709037190372903739037490375903769037790378903799038090381903829038390384903859038690387903889038990390903919039290393903949039590396903979039890399904009040190402904039040490405904069040790408904099041090411904129041390414904159041690417904189041990420904219042290423904249042590426904279042890429904309043190432904339043490435904369043790438904399044090441904429044390444904459044690447904489044990450904519045290453904549045590456904579045890459904609046190462904639046490465904669046790468904699047090471904729047390474904759047690477904789047990480904819048290483904849048590486904879048890489904909049190492904939049490495904969049790498904999050090501905029050390504905059050690507905089050990510905119051290513905149051590516905179051890519905209052190522905239052490525905269052790528905299053090531905329053390534905359053690537905389053990540905419054290543905449054590546905479054890549905509055190552905539055490555905569055790558905599056090561905629056390564905659056690567905689056990570905719057290573905749057590576905779057890579905809058190582905839058490585905869058790588905899059090591905929059390594905959059690597905989059990600906019060290603906049060590606906079060890609906109061190612906139061490615906169061790618906199062090621906229062390624906259062690627906289062990630906319063290633906349063590636906379063890639906409064190642906439064490645906469064790648906499065090651906529065390654906559065690657906589065990660906619066290663906649066590666906679066890669906709067190672906739067490675906769067790678906799068090681906829068390684906859068690687906889068990690906919069290693906949069590696906979069890699907009070190702907039070490705907069070790708907099071090711907129071390714907159071690717907189071990720907219072290723907249072590726907279072890729907309073190732907339073490735907369073790738907399074090741907429074390744907459074690747907489074990750907519075290753907549075590756907579075890759907609076190762907639076490765907669076790768907699077090771907729077390774907759077690777907789077990780907819078290783907849078590786907879078890789907909079190792907939079490795907969079790798907999080090801908029080390804908059080690807908089080990810908119081290813908149081590816908179081890819908209082190822908239082490825908269082790828908299083090831908329083390834908359083690837908389083990840908419084290843908449084590846908479084890849908509085190852908539085490855908569085790858908599086090861908629086390864908659086690867908689086990870908719087290873908749087590876908779087890879908809088190882908839088490885908869088790888908899089090891908929089390894908959089690897908989089990900909019090290903909049090590906909079090890909909109091190912909139091490915909169091790918909199092090921909229092390924909259092690927909289092990930909319093290933909349093590936909379093890939909409094190942909439094490945909469094790948909499095090951909529095390954909559095690957909589095990960909619096290963909649096590966909679096890969909709097190972909739097490975909769097790978909799098090981909829098390984909859098690987909889098990990909919099290993909949099590996909979099890999910009100191002910039100491005910069100791008910099101091011910129101391014910159101691017910189101991020910219102291023910249102591026910279102891029910309103191032910339103491035910369103791038910399104091041910429104391044910459104691047910489104991050910519105291053910549105591056910579105891059910609106191062910639106491065910669106791068910699107091071910729107391074910759107691077910789107991080910819108291083910849108591086910879108891089910909109191092910939109491095910969109791098910999110091101911029110391104911059110691107911089110991110911119111291113911149111591116911179111891119911209112191122911239112491125911269112791128911299113091131911329113391134911359113691137911389113991140911419114291143911449114591146911479114891149911509115191152911539115491155911569115791158911599116091161911629116391164911659116691167911689116991170911719117291173911749117591176911779117891179911809118191182911839118491185911869118791188911899119091191911929119391194911959119691197911989119991200912019120291203912049120591206912079120891209912109121191212912139121491215912169121791218912199122091221912229122391224912259122691227912289122991230912319123291233912349123591236912379123891239912409124191242912439124491245912469124791248912499125091251912529125391254912559125691257912589125991260912619126291263912649126591266912679126891269912709127191272912739127491275912769127791278912799128091281912829128391284912859128691287912889128991290912919129291293912949129591296912979129891299913009130191302913039130491305913069130791308913099131091311913129131391314913159131691317913189131991320913219132291323913249132591326913279132891329913309133191332913339133491335913369133791338913399134091341913429134391344913459134691347913489134991350913519135291353913549135591356913579135891359913609136191362913639136491365913669136791368913699137091371913729137391374913759137691377913789137991380913819138291383913849138591386913879138891389913909139191392913939139491395913969139791398913999140091401914029140391404914059140691407914089140991410914119141291413914149141591416914179141891419914209142191422914239142491425914269142791428914299143091431914329143391434914359143691437914389143991440914419144291443914449144591446914479144891449914509145191452914539145491455914569145791458914599146091461914629146391464914659146691467914689146991470914719147291473914749147591476914779147891479914809148191482914839148491485914869148791488914899149091491914929149391494914959149691497914989149991500915019150291503915049150591506915079150891509915109151191512915139151491515915169151791518915199152091521915229152391524915259152691527915289152991530915319153291533915349153591536915379153891539915409154191542915439154491545915469154791548915499155091551915529155391554915559155691557915589155991560915619156291563915649156591566915679156891569915709157191572915739157491575915769157791578915799158091581915829158391584915859158691587915889158991590915919159291593915949159591596915979159891599916009160191602916039160491605916069160791608916099161091611916129161391614916159161691617916189161991620916219162291623916249162591626916279162891629916309163191632916339163491635916369163791638916399164091641916429164391644916459164691647916489164991650916519165291653916549165591656916579165891659916609166191662916639166491665916669166791668916699167091671916729167391674916759167691677916789167991680916819168291683916849168591686916879168891689916909169191692916939169491695916969169791698916999170091701917029170391704917059170691707917089170991710917119171291713917149171591716917179171891719917209172191722917239172491725917269172791728917299173091731917329173391734917359173691737917389173991740917419174291743917449174591746917479174891749917509175191752917539175491755917569175791758917599176091761917629176391764917659176691767917689176991770917719177291773917749177591776917779177891779917809178191782917839178491785917869178791788917899179091791917929179391794917959179691797917989179991800918019180291803918049180591806918079180891809918109181191812918139181491815918169181791818918199182091821918229182391824918259182691827918289182991830918319183291833918349183591836918379183891839918409184191842918439184491845918469184791848918499185091851918529185391854918559185691857918589185991860918619186291863918649186591866918679186891869918709187191872918739187491875918769187791878918799188091881918829188391884918859188691887918889188991890918919189291893918949189591896918979189891899919009190191902919039190491905919069190791908919099191091911919129191391914919159191691917919189191991920919219192291923919249192591926919279192891929919309193191932919339193491935919369193791938919399194091941919429194391944919459194691947919489194991950919519195291953919549195591956919579195891959919609196191962919639196491965919669196791968919699197091971919729197391974919759197691977919789197991980919819198291983919849198591986919879198891989919909199191992919939199491995919969199791998919999200092001920029200392004920059200692007920089200992010920119201292013920149201592016920179201892019920209202192022920239202492025920269202792028920299203092031920329203392034920359203692037920389203992040920419204292043920449204592046920479204892049920509205192052920539205492055920569205792058920599206092061920629206392064920659206692067920689206992070920719207292073920749207592076920779207892079920809208192082920839208492085920869208792088920899209092091920929209392094920959209692097920989209992100921019210292103921049210592106921079210892109921109211192112921139211492115921169211792118921199212092121921229212392124921259212692127921289212992130921319213292133921349213592136921379213892139921409214192142921439214492145921469214792148921499215092151921529215392154921559215692157921589215992160921619216292163921649216592166921679216892169921709217192172921739217492175921769217792178921799218092181921829218392184921859218692187921889218992190921919219292193921949219592196921979219892199922009220192202922039220492205922069220792208922099221092211922129221392214922159221692217922189221992220922219222292223922249222592226922279222892229922309223192232922339223492235922369223792238922399224092241922429224392244922459224692247922489224992250922519225292253922549225592256922579225892259922609226192262922639226492265922669226792268922699227092271922729227392274922759227692277922789227992280922819228292283922849228592286922879228892289922909229192292922939229492295922969229792298922999230092301923029230392304923059230692307923089230992310923119231292313923149231592316923179231892319923209232192322923239232492325923269232792328923299233092331923329233392334923359233692337923389233992340923419234292343923449234592346923479234892349923509235192352923539235492355923569235792358923599236092361923629236392364923659236692367923689236992370923719237292373923749237592376923779237892379923809238192382923839238492385923869238792388923899239092391923929239392394923959239692397923989239992400924019240292403924049240592406924079240892409924109241192412924139241492415924169241792418924199242092421924229242392424924259242692427924289242992430924319243292433924349243592436924379243892439924409244192442924439244492445924469244792448924499245092451924529245392454924559245692457924589245992460924619246292463924649246592466924679246892469924709247192472924739247492475924769247792478924799248092481924829248392484924859248692487924889248992490924919249292493924949249592496924979249892499925009250192502925039250492505925069250792508925099251092511925129251392514925159251692517925189251992520925219252292523925249252592526925279252892529925309253192532925339253492535925369253792538925399254092541925429254392544925459254692547925489254992550925519255292553925549255592556925579255892559925609256192562925639256492565925669256792568925699257092571925729257392574925759257692577925789257992580925819258292583925849258592586925879258892589925909259192592925939259492595925969259792598925999260092601926029260392604926059260692607926089260992610926119261292613926149261592616926179261892619926209262192622926239262492625926269262792628926299263092631926329263392634926359263692637926389263992640926419264292643926449264592646926479264892649926509265192652926539265492655926569265792658926599266092661926629266392664926659266692667926689266992670926719267292673926749267592676926779267892679926809268192682926839268492685926869268792688926899269092691926929269392694926959269692697926989269992700927019270292703927049270592706927079270892709927109271192712927139271492715927169271792718927199272092721927229272392724927259272692727927289272992730927319273292733927349273592736927379273892739927409274192742927439274492745927469274792748927499275092751927529275392754927559275692757927589275992760927619276292763927649276592766927679276892769927709277192772927739277492775927769277792778927799278092781927829278392784927859278692787927889278992790927919279292793927949279592796927979279892799928009280192802928039280492805928069280792808928099281092811928129281392814928159281692817928189281992820928219282292823928249282592826928279282892829928309283192832928339283492835928369283792838928399284092841928429284392844928459284692847928489284992850928519285292853928549285592856928579285892859928609286192862928639286492865928669286792868928699287092871928729287392874928759287692877928789287992880928819288292883928849288592886928879288892889928909289192892928939289492895928969289792898928999290092901929029290392904929059290692907929089290992910929119291292913929149291592916929179291892919929209292192922929239292492925929269292792928929299293092931929329293392934929359293692937929389293992940929419294292943929449294592946929479294892949929509295192952929539295492955929569295792958929599296092961929629296392964929659296692967929689296992970929719297292973929749297592976929779297892979929809298192982929839298492985929869298792988929899299092991929929299392994929959299692997929989299993000930019300293003930049300593006930079300893009930109301193012930139301493015930169301793018930199302093021930229302393024930259302693027930289302993030930319303293033930349303593036930379303893039930409304193042930439304493045930469304793048930499305093051930529305393054930559305693057930589305993060930619306293063930649306593066930679306893069930709307193072930739307493075930769307793078930799308093081930829308393084930859308693087930889308993090930919309293093930949309593096930979309893099931009310193102931039310493105931069310793108931099311093111931129311393114931159311693117931189311993120931219312293123931249312593126931279312893129931309313193132931339313493135931369313793138931399314093141931429314393144931459314693147931489314993150931519315293153931549315593156931579315893159931609316193162931639316493165931669316793168931699317093171931729317393174931759317693177931789317993180931819318293183931849318593186931879318893189931909319193192931939319493195931969319793198931999320093201932029320393204932059320693207932089320993210932119321293213932149321593216932179321893219932209322193222932239322493225932269322793228932299323093231932329323393234932359323693237932389323993240932419324293243932449324593246932479324893249932509325193252932539325493255932569325793258932599326093261932629326393264932659326693267932689326993270932719327293273932749327593276932779327893279932809328193282932839328493285932869328793288932899329093291932929329393294932959329693297932989329993300933019330293303933049330593306933079330893309933109331193312933139331493315933169331793318933199332093321933229332393324933259332693327933289332993330933319333293333933349333593336933379333893339933409334193342933439334493345933469334793348933499335093351933529335393354933559335693357933589335993360933619336293363933649336593366933679336893369933709337193372933739337493375933769337793378933799338093381933829338393384933859338693387933889338993390933919339293393933949339593396933979339893399934009340193402934039340493405934069340793408934099341093411934129341393414934159341693417934189341993420934219342293423934249342593426934279342893429934309343193432934339343493435934369343793438934399344093441934429344393444934459344693447934489344993450934519345293453934549345593456934579345893459934609346193462934639346493465934669346793468934699347093471934729347393474934759347693477934789347993480934819348293483934849348593486934879348893489934909349193492934939349493495934969349793498934999350093501935029350393504935059350693507935089350993510935119351293513935149351593516935179351893519935209352193522935239352493525935269352793528935299353093531935329353393534935359353693537935389353993540935419354293543935449354593546935479354893549935509355193552935539355493555935569355793558935599356093561935629356393564935659356693567935689356993570935719357293573935749357593576935779357893579935809358193582935839358493585935869358793588935899359093591935929359393594935959359693597935989359993600936019360293603936049360593606936079360893609936109361193612936139361493615936169361793618936199362093621936229362393624936259362693627936289362993630936319363293633936349363593636936379363893639936409364193642936439364493645936469364793648936499365093651936529365393654936559365693657936589365993660936619366293663936649366593666936679366893669936709367193672936739367493675936769367793678936799368093681936829368393684936859368693687936889368993690936919369293693936949369593696936979369893699937009370193702937039370493705937069370793708937099371093711937129371393714937159371693717937189371993720937219372293723937249372593726937279372893729937309373193732937339373493735937369373793738937399374093741937429374393744937459374693747937489374993750937519375293753937549375593756937579375893759937609376193762937639376493765937669376793768937699377093771937729377393774937759377693777937789377993780937819378293783937849378593786937879378893789937909379193792937939379493795937969379793798937999380093801938029380393804938059380693807938089380993810938119381293813938149381593816938179381893819938209382193822938239382493825938269382793828938299383093831938329383393834938359383693837938389383993840938419384293843938449384593846938479384893849938509385193852938539385493855938569385793858938599386093861938629386393864938659386693867938689386993870938719387293873938749387593876938779387893879938809388193882938839388493885938869388793888938899389093891938929389393894938959389693897938989389993900939019390293903939049390593906939079390893909939109391193912939139391493915939169391793918939199392093921939229392393924939259392693927939289392993930939319393293933939349393593936939379393893939939409394193942939439394493945939469394793948939499395093951939529395393954939559395693957939589395993960939619396293963939649396593966939679396893969939709397193972939739397493975939769397793978939799398093981939829398393984939859398693987939889398993990939919399293993939949399593996939979399893999940009400194002940039400494005940069400794008940099401094011940129401394014940159401694017940189401994020940219402294023940249402594026940279402894029940309403194032940339403494035940369403794038940399404094041940429404394044940459404694047940489404994050940519405294053940549405594056940579405894059940609406194062940639406494065940669406794068940699407094071940729407394074940759407694077940789407994080940819408294083940849408594086940879408894089940909409194092940939409494095940969409794098940999410094101941029410394104941059410694107941089410994110941119411294113941149411594116941179411894119941209412194122941239412494125941269412794128941299413094131941329413394134941359413694137941389413994140941419414294143941449414594146941479414894149941509415194152941539415494155941569415794158941599416094161941629416394164941659416694167941689416994170941719417294173941749417594176941779417894179941809418194182941839418494185941869418794188941899419094191941929419394194941959419694197941989419994200942019420294203942049420594206942079420894209942109421194212942139421494215942169421794218942199422094221942229422394224942259422694227942289422994230942319423294233942349423594236942379423894239942409424194242942439424494245942469424794248942499425094251942529425394254942559425694257942589425994260942619426294263942649426594266942679426894269942709427194272942739427494275942769427794278942799428094281942829428394284942859428694287942889428994290942919429294293942949429594296942979429894299943009430194302943039430494305943069430794308943099431094311943129431394314943159431694317943189431994320943219432294323943249432594326943279432894329943309433194332943339433494335943369433794338943399434094341943429434394344943459434694347943489434994350943519435294353943549435594356943579435894359943609436194362943639436494365943669436794368943699437094371943729437394374943759437694377943789437994380943819438294383943849438594386943879438894389943909439194392943939439494395943969439794398943999440094401944029440394404944059440694407944089440994410944119441294413944149441594416944179441894419944209442194422944239442494425944269442794428944299443094431944329443394434944359443694437944389443994440944419444294443944449444594446944479444894449944509445194452944539445494455944569445794458944599446094461944629446394464944659446694467944689446994470944719447294473944749447594476944779447894479944809448194482944839448494485944869448794488944899449094491944929449394494944959449694497944989449994500945019450294503945049450594506945079450894509945109451194512945139451494515945169451794518945199452094521945229452394524945259452694527945289452994530945319453294533945349453594536945379453894539945409454194542945439454494545945469454794548945499455094551945529455394554945559455694557945589455994560945619456294563945649456594566945679456894569945709457194572945739457494575945769457794578945799458094581945829458394584945859458694587945889458994590945919459294593945949459594596945979459894599946009460194602946039460494605946069460794608946099461094611946129461394614946159461694617946189461994620946219462294623946249462594626946279462894629946309463194632946339463494635946369463794638946399464094641946429464394644946459464694647946489464994650946519465294653946549465594656946579465894659946609466194662946639466494665946669466794668946699467094671946729467394674946759467694677946789467994680946819468294683946849468594686946879468894689946909469194692946939469494695946969469794698946999470094701947029470394704947059470694707947089470994710947119471294713947149471594716947179471894719947209472194722947239472494725947269472794728947299473094731947329473394734947359473694737947389473994740947419474294743947449474594746947479474894749947509475194752947539475494755947569475794758947599476094761947629476394764947659476694767947689476994770947719477294773947749477594776947779477894779947809478194782947839478494785947869478794788947899479094791947929479394794947959479694797947989479994800948019480294803948049480594806948079480894809948109481194812948139481494815948169481794818948199482094821948229482394824948259482694827948289482994830948319483294833948349483594836948379483894839948409484194842948439484494845948469484794848948499485094851948529485394854948559485694857948589485994860948619486294863948649486594866948679486894869948709487194872948739487494875948769487794878948799488094881948829488394884948859488694887948889488994890948919489294893948949489594896948979489894899949009490194902949039490494905949069490794908949099491094911949129491394914949159491694917949189491994920949219492294923949249492594926949279492894929949309493194932949339493494935949369493794938949399494094941949429494394944949459494694947949489494994950949519495294953949549495594956949579495894959949609496194962949639496494965949669496794968949699497094971949729497394974949759497694977949789497994980949819498294983949849498594986949879498894989949909499194992949939499494995949969499794998949999500095001950029500395004950059500695007950089500995010950119501295013950149501595016950179501895019950209502195022950239502495025950269502795028950299503095031950329503395034950359503695037950389503995040950419504295043950449504595046950479504895049950509505195052950539505495055950569505795058950599506095061950629506395064950659506695067950689506995070950719507295073950749507595076950779507895079950809508195082950839508495085950869508795088950899509095091950929509395094950959509695097950989509995100951019510295103951049510595106951079510895109951109511195112951139511495115951169511795118951199512095121951229512395124951259512695127951289512995130951319513295133951349513595136951379513895139951409514195142951439514495145951469514795148951499515095151951529515395154951559515695157951589515995160951619516295163951649516595166951679516895169951709517195172951739517495175951769517795178951799518095181951829518395184951859518695187951889518995190951919519295193951949519595196951979519895199952009520195202952039520495205952069520795208952099521095211952129521395214952159521695217952189521995220952219522295223952249522595226952279522895229952309523195232952339523495235952369523795238952399524095241952429524395244952459524695247952489524995250952519525295253952549525595256952579525895259952609526195262952639526495265952669526795268952699527095271952729527395274952759527695277952789527995280952819528295283952849528595286952879528895289952909529195292952939529495295952969529795298952999530095301953029530395304953059530695307953089530995310953119531295313953149531595316953179531895319953209532195322953239532495325953269532795328953299533095331953329533395334953359533695337953389533995340953419534295343953449534595346953479534895349953509535195352953539535495355953569535795358953599536095361953629536395364953659536695367953689536995370953719537295373953749537595376953779537895379953809538195382953839538495385953869538795388953899539095391953929539395394953959539695397953989539995400954019540295403954049540595406954079540895409954109541195412954139541495415954169541795418954199542095421954229542395424954259542695427954289542995430954319543295433954349543595436954379543895439954409544195442954439544495445954469544795448954499545095451954529545395454954559545695457954589545995460954619546295463954649546595466954679546895469954709547195472954739547495475954769547795478954799548095481954829548395484954859548695487954889548995490954919549295493954949549595496954979549895499955009550195502955039550495505955069550795508955099551095511955129551395514955159551695517955189551995520955219552295523955249552595526955279552895529955309553195532955339553495535955369553795538955399554095541955429554395544955459554695547955489554995550955519555295553955549555595556955579555895559955609556195562955639556495565955669556795568955699557095571955729557395574955759557695577955789557995580955819558295583955849558595586955879558895589955909559195592955939559495595955969559795598955999560095601956029560395604956059560695607956089560995610956119561295613956149561595616956179561895619956209562195622956239562495625956269562795628956299563095631956329563395634956359563695637956389563995640956419564295643956449564595646956479564895649956509565195652956539565495655956569565795658956599566095661956629566395664956659566695667956689566995670956719567295673956749567595676956779567895679956809568195682956839568495685956869568795688956899569095691956929569395694956959569695697956989569995700957019570295703957049570595706957079570895709957109571195712957139571495715957169571795718957199572095721957229572395724957259572695727957289572995730957319573295733957349573595736957379573895739957409574195742957439574495745957469574795748957499575095751957529575395754957559575695757957589575995760957619576295763957649576595766957679576895769957709577195772957739577495775957769577795778957799578095781957829578395784957859578695787957889578995790957919579295793957949579595796957979579895799958009580195802958039580495805958069580795808958099581095811958129581395814958159581695817958189581995820958219582295823958249582595826958279582895829958309583195832958339583495835958369583795838958399584095841958429584395844958459584695847958489584995850958519585295853958549585595856958579585895859958609586195862958639586495865958669586795868958699587095871958729587395874958759587695877958789587995880958819588295883958849588595886958879588895889958909589195892958939589495895958969589795898958999590095901959029590395904959059590695907959089590995910959119591295913959149591595916959179591895919959209592195922959239592495925959269592795928959299593095931959329593395934959359593695937959389593995940959419594295943959449594595946959479594895949959509595195952959539595495955959569595795958959599596095961959629596395964959659596695967959689596995970959719597295973959749597595976959779597895979959809598195982959839598495985959869598795988959899599095991959929599395994959959599695997959989599996000960019600296003960049600596006960079600896009960109601196012960139601496015960169601796018960199602096021960229602396024960259602696027960289602996030960319603296033960349603596036960379603896039960409604196042960439604496045960469604796048960499605096051960529605396054960559605696057960589605996060960619606296063960649606596066960679606896069960709607196072960739607496075960769607796078960799608096081960829608396084960859608696087960889608996090960919609296093960949609596096960979609896099961009610196102961039610496105961069610796108961099611096111961129611396114961159611696117961189611996120961219612296123961249612596126961279612896129961309613196132961339613496135961369613796138961399614096141961429614396144961459614696147961489614996150961519615296153961549615596156961579615896159961609616196162961639616496165961669616796168961699617096171961729617396174961759617696177961789617996180961819618296183961849618596186961879618896189961909619196192961939619496195961969619796198961999620096201962029620396204962059620696207962089620996210962119621296213962149621596216962179621896219962209622196222962239622496225962269622796228962299623096231962329623396234962359623696237962389623996240962419624296243962449624596246962479624896249962509625196252962539625496255962569625796258962599626096261962629626396264962659626696267962689626996270962719627296273962749627596276962779627896279962809628196282962839628496285962869628796288962899629096291962929629396294962959629696297962989629996300963019630296303963049630596306963079630896309963109631196312963139631496315963169631796318963199632096321963229632396324963259632696327963289632996330963319633296333963349633596336963379633896339963409634196342963439634496345963469634796348963499635096351963529635396354963559635696357963589635996360963619636296363963649636596366963679636896369963709637196372963739637496375963769637796378963799638096381963829638396384963859638696387963889638996390963919639296393963949639596396963979639896399964009640196402964039640496405964069640796408964099641096411964129641396414964159641696417964189641996420964219642296423964249642596426964279642896429964309643196432964339643496435964369643796438964399644096441964429644396444964459644696447964489644996450964519645296453964549645596456964579645896459964609646196462964639646496465964669646796468964699647096471964729647396474964759647696477964789647996480964819648296483964849648596486964879648896489964909649196492964939649496495964969649796498964999650096501965029650396504965059650696507965089650996510965119651296513965149651596516965179651896519965209652196522965239652496525965269652796528965299653096531965329653396534965359653696537965389653996540965419654296543965449654596546965479654896549965509655196552965539655496555965569655796558965599656096561965629656396564965659656696567965689656996570965719657296573965749657596576965779657896579965809658196582965839658496585965869658796588965899659096591965929659396594965959659696597965989659996600966019660296603966049660596606966079660896609966109661196612966139661496615966169661796618966199662096621966229662396624966259662696627966289662996630966319663296633966349663596636966379663896639966409664196642966439664496645966469664796648966499665096651966529665396654966559665696657966589665996660966619666296663966649666596666966679666896669966709667196672966739667496675966769667796678966799668096681966829668396684966859668696687966889668996690966919669296693966949669596696966979669896699967009670196702967039670496705967069670796708967099671096711967129671396714967159671696717967189671996720967219672296723967249672596726967279672896729967309673196732967339673496735967369673796738967399674096741967429674396744967459674696747967489674996750967519675296753967549675596756967579675896759967609676196762967639676496765967669676796768967699677096771967729677396774967759677696777967789677996780967819678296783967849678596786967879678896789967909679196792967939679496795967969679796798967999680096801968029680396804968059680696807968089680996810968119681296813968149681596816968179681896819968209682196822968239682496825968269682796828968299683096831968329683396834968359683696837968389683996840968419684296843968449684596846968479684896849968509685196852968539685496855968569685796858968599686096861968629686396864968659686696867968689686996870968719687296873968749687596876968779687896879968809688196882968839688496885968869688796888968899689096891968929689396894968959689696897968989689996900969019690296903969049690596906969079690896909969109691196912969139691496915969169691796918969199692096921969229692396924969259692696927969289692996930969319693296933969349693596936969379693896939969409694196942969439694496945969469694796948969499695096951969529695396954969559695696957969589695996960969619696296963969649696596966969679696896969969709697196972969739697496975969769697796978969799698096981969829698396984969859698696987969889698996990969919699296993969949699596996969979699896999970009700197002970039700497005970069700797008970099701097011970129701397014970159701697017970189701997020970219702297023970249702597026970279702897029970309703197032970339703497035970369703797038970399704097041970429704397044970459704697047970489704997050970519705297053970549705597056970579705897059970609706197062970639706497065970669706797068970699707097071970729707397074970759707697077970789707997080970819708297083970849708597086970879708897089970909709197092970939709497095970969709797098970999710097101971029710397104971059710697107971089710997110971119711297113971149711597116971179711897119971209712197122971239712497125971269712797128971299713097131971329713397134971359713697137971389713997140971419714297143971449714597146971479714897149971509715197152971539715497155971569715797158971599716097161971629716397164971659716697167971689716997170971719717297173971749717597176971779717897179971809718197182971839718497185971869718797188971899719097191971929719397194971959719697197971989719997200972019720297203972049720597206972079720897209972109721197212972139721497215972169721797218972199722097221972229722397224972259722697227972289722997230972319723297233972349723597236972379723897239972409724197242972439724497245972469724797248972499725097251972529725397254972559725697257972589725997260972619726297263972649726597266972679726897269972709727197272972739727497275972769727797278972799728097281972829728397284972859728697287972889728997290972919729297293972949729597296972979729897299973009730197302973039730497305973069730797308973099731097311973129731397314973159731697317973189731997320973219732297323973249732597326973279732897329973309733197332973339733497335973369733797338973399734097341973429734397344973459734697347973489734997350973519735297353973549735597356973579735897359973609736197362973639736497365973669736797368973699737097371973729737397374973759737697377973789737997380973819738297383973849738597386973879738897389973909739197392973939739497395973969739797398973999740097401974029740397404974059740697407974089740997410974119741297413974149741597416974179741897419974209742197422974239742497425974269742797428974299743097431974329743397434974359743697437974389743997440974419744297443974449744597446974479744897449974509745197452974539745497455974569745797458974599746097461974629746397464974659746697467974689746997470974719747297473974749747597476974779747897479974809748197482974839748497485974869748797488974899749097491974929749397494974959749697497974989749997500975019750297503975049750597506975079750897509975109751197512975139751497515975169751797518975199752097521975229752397524975259752697527975289752997530975319753297533975349753597536975379753897539975409754197542975439754497545975469754797548975499755097551975529755397554975559755697557975589755997560975619756297563975649756597566975679756897569975709757197572975739757497575975769757797578975799758097581975829758397584975859758697587975889758997590975919759297593975949759597596975979759897599976009760197602976039760497605976069760797608976099761097611976129761397614976159761697617976189761997620976219762297623976249762597626976279762897629976309763197632976339763497635976369763797638976399764097641976429764397644976459764697647976489764997650976519765297653976549765597656976579765897659976609766197662976639766497665976669766797668976699767097671976729767397674976759767697677976789767997680976819768297683976849768597686976879768897689976909769197692976939769497695976969769797698976999770097701977029770397704977059770697707977089770997710977119771297713977149771597716977179771897719977209772197722977239772497725977269772797728977299773097731977329773397734977359773697737977389773997740977419774297743977449774597746977479774897749977509775197752977539775497755977569775797758977599776097761977629776397764977659776697767977689776997770977719777297773977749777597776977779777897779977809778197782977839778497785977869778797788977899779097791977929779397794977959779697797977989779997800978019780297803978049780597806978079780897809978109781197812978139781497815978169781797818978199782097821978229782397824978259782697827978289782997830978319783297833978349783597836978379783897839978409784197842978439784497845978469784797848978499785097851978529785397854978559785697857978589785997860978619786297863978649786597866978679786897869978709787197872978739787497875978769787797878978799788097881978829788397884978859788697887978889788997890978919789297893978949789597896978979789897899979009790197902979039790497905979069790797908979099791097911979129791397914979159791697917979189791997920979219792297923979249792597926979279792897929979309793197932979339793497935979369793797938979399794097941979429794397944979459794697947979489794997950979519795297953979549795597956979579795897959979609796197962979639796497965979669796797968979699797097971979729797397974979759797697977979789797997980979819798297983979849798597986979879798897989979909799197992979939799497995979969799797998979999800098001980029800398004980059800698007980089800998010980119801298013980149801598016980179801898019980209802198022980239802498025980269802798028980299803098031980329803398034980359803698037980389803998040980419804298043980449804598046980479804898049980509805198052980539805498055980569805798058980599806098061980629806398064980659806698067980689806998070980719807298073980749807598076980779807898079980809808198082980839808498085980869808798088980899809098091980929809398094980959809698097980989809998100981019810298103981049810598106981079810898109981109811198112981139811498115981169811798118981199812098121981229812398124981259812698127981289812998130981319813298133981349813598136981379813898139981409814198142981439814498145981469814798148981499815098151981529815398154981559815698157981589815998160981619816298163981649816598166981679816898169981709817198172981739817498175981769817798178981799818098181981829818398184981859818698187981889818998190981919819298193981949819598196981979819898199982009820198202982039820498205982069820798208982099821098211982129821398214982159821698217982189821998220982219822298223982249822598226982279822898229982309823198232982339823498235982369823798238982399824098241982429824398244982459824698247982489824998250982519825298253982549825598256982579825898259982609826198262982639826498265982669826798268982699827098271982729827398274982759827698277982789827998280982819828298283982849828598286982879828898289982909829198292982939829498295982969829798298982999830098301983029830398304983059830698307983089830998310983119831298313983149831598316983179831898319983209832198322983239832498325983269832798328983299833098331983329833398334983359833698337983389833998340983419834298343983449834598346983479834898349983509835198352983539835498355983569835798358983599836098361983629836398364983659836698367983689836998370983719837298373983749837598376983779837898379983809838198382983839838498385983869838798388983899839098391983929839398394983959839698397983989839998400984019840298403984049840598406984079840898409984109841198412984139841498415984169841798418984199842098421984229842398424984259842698427984289842998430984319843298433984349843598436984379843898439984409844198442984439844498445984469844798448984499845098451984529845398454984559845698457984589845998460984619846298463984649846598466984679846898469984709847198472984739847498475984769847798478984799848098481984829848398484984859848698487984889848998490984919849298493984949849598496984979849898499985009850198502985039850498505985069850798508985099851098511985129851398514985159851698517985189851998520985219852298523985249852598526985279852898529985309853198532985339853498535985369853798538985399854098541985429854398544985459854698547985489854998550985519855298553985549855598556985579855898559985609856198562985639856498565985669856798568985699857098571985729857398574985759857698577985789857998580985819858298583985849858598586985879858898589985909859198592985939859498595985969859798598985999860098601986029860398604986059860698607986089860998610986119861298613986149861598616986179861898619986209862198622986239862498625986269862798628986299863098631986329863398634986359863698637986389863998640986419864298643986449864598646986479864898649986509865198652986539865498655986569865798658986599866098661986629866398664986659866698667986689866998670986719867298673986749867598676986779867898679986809868198682986839868498685986869868798688986899869098691986929869398694986959869698697986989869998700987019870298703987049870598706987079870898709987109871198712987139871498715987169871798718987199872098721987229872398724987259872698727987289872998730987319873298733987349873598736987379873898739987409874198742987439874498745987469874798748987499875098751987529875398754987559875698757987589875998760987619876298763987649876598766987679876898769987709877198772987739877498775987769877798778987799878098781987829878398784987859878698787987889878998790987919879298793987949879598796987979879898799988009880198802988039880498805988069880798808988099881098811988129881398814988159881698817988189881998820988219882298823988249882598826988279882898829988309883198832988339883498835988369883798838988399884098841988429884398844988459884698847988489884998850988519885298853988549885598856988579885898859988609886198862988639886498865988669886798868988699887098871988729887398874988759887698877988789887998880988819888298883988849888598886988879888898889988909889198892988939889498895988969889798898988999890098901989029890398904989059890698907989089890998910989119891298913989149891598916989179891898919989209892198922989239892498925989269892798928989299893098931989329893398934989359893698937989389893998940989419894298943989449894598946989479894898949989509895198952989539895498955989569895798958989599896098961989629896398964989659896698967989689896998970989719897298973989749897598976989779897898979989809898198982989839898498985989869898798988989899899098991989929899398994989959899698997989989899999000990019900299003990049900599006990079900899009990109901199012990139901499015990169901799018990199902099021990229902399024990259902699027990289902999030990319903299033990349903599036990379903899039990409904199042990439904499045990469904799048990499905099051990529905399054990559905699057990589905999060990619906299063990649906599066990679906899069990709907199072990739907499075990769907799078990799908099081990829908399084990859908699087990889908999090990919909299093990949909599096990979909899099991009910199102991039910499105991069910799108991099911099111991129911399114991159911699117991189911999120991219912299123991249912599126991279912899129991309913199132991339913499135991369913799138991399914099141991429914399144991459914699147991489914999150991519915299153991549915599156991579915899159991609916199162991639916499165991669916799168991699917099171991729917399174991759917699177991789917999180991819918299183991849918599186991879918899189991909919199192991939919499195991969919799198991999920099201992029920399204992059920699207992089920999210992119921299213992149921599216992179921899219992209922199222992239922499225992269922799228992299923099231992329923399234992359923699237992389923999240992419924299243992449924599246992479924899249992509925199252992539925499255992569925799258992599926099261992629926399264992659926699267992689926999270992719927299273992749927599276992779927899279992809928199282992839928499285992869928799288992899929099291992929929399294992959929699297992989929999300993019930299303993049930599306993079930899309993109931199312993139931499315993169931799318993199932099321993229932399324993259932699327993289932999330993319933299333993349933599336993379933899339993409934199342993439934499345993469934799348993499935099351993529935399354993559935699357993589935999360993619936299363993649936599366993679936899369993709937199372993739937499375993769937799378993799938099381993829938399384993859938699387993889938999390993919939299393993949939599396993979939899399994009940199402994039940499405994069940799408994099941099411994129941399414994159941699417994189941999420994219942299423994249942599426994279942899429994309943199432994339943499435994369943799438994399944099441994429944399444994459944699447994489944999450994519945299453994549945599456994579945899459994609946199462994639946499465994669946799468994699947099471994729947399474994759947699477994789947999480994819948299483994849948599486994879948899489994909949199492994939949499495994969949799498994999950099501995029950399504995059950699507995089950999510995119951299513995149951599516995179951899519995209952199522995239952499525995269952799528995299953099531995329953399534995359953699537995389953999540995419954299543995449954599546995479954899549995509955199552995539955499555995569955799558995599956099561995629956399564995659956699567995689956999570995719957299573995749957599576995779957899579995809958199582995839958499585995869958799588995899959099591995929959399594995959959699597995989959999600996019960299603996049960599606996079960899609996109961199612996139961499615996169961799618996199962099621996229962399624996259962699627996289962999630996319963299633996349963599636996379963899639996409964199642996439964499645996469964799648996499965099651996529965399654996559965699657996589965999660996619966299663996649966599666996679966899669996709967199672996739967499675996769967799678996799968099681996829968399684996859968699687996889968999690996919969299693996949969599696996979969899699997009970199702997039970499705997069970799708997099971099711997129971399714997159971699717997189971999720997219972299723997249972599726997279972899729997309973199732997339973499735997369973799738997399974099741997429974399744997459974699747997489974999750997519975299753997549975599756997579975899759997609976199762997639976499765997669976799768997699977099771997729977399774997759977699777997789977999780997819978299783997849978599786997879978899789997909979199792997939979499795997969979799798997999980099801998029980399804998059980699807998089980999810998119981299813998149981599816998179981899819998209982199822998239982499825998269982799828998299983099831998329983399834998359983699837998389983999840998419984299843998449984599846998479984899849998509985199852998539985499855998569985799858998599986099861998629986399864998659986699867998689986999870998719987299873998749987599876998779987899879998809988199882998839988499885998869988799888998899989099891998929989399894998959989699897998989989999900999019990299903999049990599906999079990899909999109991199912999139991499915999169991799918999199992099921999229992399924999259992699927999289992999930999319993299933999349993599936999379993899939999409994199942999439994499945999469994799948999499995099951999529995399954999559995699957999589995999960999619996299963999649996599966999679996899969999709997199972999739997499975999769997799978999799998099981999829998399984999859998699987999889998999990999919999299993999949999599996999979999899999100000100001100002100003100004100005100006100007100008100009100010100011100012100013100014100015100016100017100018100019100020100021100022100023100024100025100026100027100028100029100030100031100032100033100034100035100036100037100038100039100040100041100042100043100044100045100046100047100048100049100050100051100052100053100054100055100056100057100058100059100060100061100062100063100064100065100066100067100068100069100070100071100072100073100074100075100076100077100078100079100080100081100082100083100084100085100086100087100088100089100090100091100092100093100094100095100096100097100098100099100100100101100102100103100104100105100106100107100108100109100110100111100112100113100114100115100116100117100118100119100120100121100122100123100124100125100126100127100128100129100130100131100132100133100134100135100136100137100138100139100140100141100142100143100144100145100146100147100148100149100150100151100152100153100154100155100156100157100158100159100160100161100162100163100164100165100166100167100168100169100170100171100172100173100174100175100176100177100178100179100180100181100182100183100184100185100186100187100188100189100190100191100192100193100194100195100196100197100198100199100200100201100202100203100204100205100206100207100208100209100210100211100212100213100214100215100216100217100218100219100220100221100222100223100224100225100226100227100228100229100230100231100232100233100234100235100236100237100238100239100240100241100242100243100244100245100246100247100248100249100250100251100252100253100254100255100256100257100258100259100260100261100262100263100264100265100266100267100268100269100270100271100272100273100274100275100276100277100278100279100280100281100282100283100284100285100286100287100288100289100290100291100292100293100294100295100296100297100298100299100300100301100302100303100304100305100306100307100308100309100310100311100312100313100314100315100316100317100318100319100320100321100322100323100324100325100326100327100328100329100330100331100332100333100334100335100336100337100338100339100340100341100342100343100344100345100346100347100348100349100350100351100352100353100354100355100356100357100358100359100360100361100362100363100364100365100366100367100368100369100370100371100372100373100374100375100376100377100378100379100380100381100382100383100384100385100386100387100388100389100390100391100392100393100394100395100396100397100398100399100400100401100402100403100404100405100406100407100408100409100410100411100412100413100414100415100416100417100418100419100420100421100422100423100424100425100426100427100428100429100430100431100432100433100434100435100436100437100438100439100440100441100442100443100444100445100446100447100448100449100450100451100452100453100454100455100456100457100458100459100460100461100462100463100464100465100466100467100468100469100470100471100472100473100474100475100476100477100478100479100480100481100482100483100484100485100486100487100488100489100490100491100492100493100494100495100496100497100498100499100500100501100502100503100504100505100506100507100508100509100510100511100512100513100514100515100516100517100518100519100520100521100522100523100524100525100526100527100528100529100530100531100532100533100534100535100536100537100538100539100540100541100542100543100544100545100546100547100548100549100550100551100552100553100554100555100556100557100558100559100560100561100562100563100564100565100566100567100568100569100570100571100572100573100574100575100576100577100578100579100580100581100582100583100584100585100586100587100588100589100590100591100592100593100594100595100596100597100598100599100600100601100602100603100604100605100606100607100608100609100610100611100612100613100614100615100616100617100618100619100620100621100622100623100624100625100626100627100628100629100630100631100632100633100634100635100636100637100638100639100640100641100642100643100644100645100646100647100648100649100650100651100652100653100654100655100656100657100658100659100660100661100662100663100664100665100666100667100668100669100670100671100672100673100674100675100676100677100678100679100680100681100682100683100684100685100686100687100688100689100690100691100692100693100694100695100696100697100698100699100700100701100702100703100704100705100706100707100708100709100710100711100712100713100714100715100716100717100718100719100720100721100722100723100724100725100726100727100728100729100730100731100732100733100734100735100736100737100738100739100740100741100742100743100744100745100746100747100748100749100750100751100752100753100754100755100756100757100758100759100760100761100762100763100764100765100766100767100768100769100770100771100772100773100774100775100776100777100778100779100780100781100782100783100784100785100786100787100788100789100790100791100792100793100794100795100796100797100798100799100800100801100802100803100804100805100806100807100808100809100810100811100812100813100814100815100816100817100818100819100820100821100822100823100824100825100826100827100828100829100830100831100832100833100834100835100836100837100838100839100840100841100842100843100844100845100846100847100848100849100850100851100852100853100854100855100856100857100858100859100860100861100862100863100864100865100866100867100868100869100870100871100872100873100874100875100876100877100878100879100880100881100882100883100884100885100886100887100888100889100890100891100892100893100894100895100896100897100898100899100900100901100902100903100904100905100906100907100908100909100910100911100912100913100914100915100916100917100918100919100920100921100922100923100924100925100926100927100928100929100930100931100932100933100934100935100936100937100938100939100940100941100942100943100944100945100946100947100948100949100950100951100952100953100954100955100956100957100958100959100960100961100962100963100964100965100966100967100968100969100970100971100972100973100974100975100976100977100978100979100980100981100982100983100984100985100986100987100988100989100990100991100992100993100994100995100996100997100998100999101000101001101002101003101004101005101006101007101008101009101010101011101012101013101014101015101016101017101018101019101020101021101022101023101024101025101026101027101028101029101030101031101032101033101034101035101036101037101038101039101040101041101042101043101044101045101046101047101048101049101050101051101052101053101054101055101056101057101058101059101060101061101062101063101064101065101066101067101068101069101070101071101072101073101074101075101076101077101078101079101080101081101082101083101084101085101086101087101088101089101090101091101092101093101094101095101096101097101098101099101100101101101102101103101104101105101106101107101108101109101110101111101112101113101114101115101116101117101118101119101120101121101122101123101124101125101126101127101128101129101130101131101132101133101134101135101136101137101138101139101140101141101142101143101144101145101146101147101148101149101150101151101152101153101154101155101156101157101158101159101160101161101162101163101164101165101166101167101168101169101170101171101172101173101174101175101176101177101178101179101180101181101182101183101184101185101186101187101188101189101190101191101192101193101194101195101196101197101198101199101200101201101202101203101204101205101206101207101208101209101210101211101212101213101214101215101216101217101218101219101220101221101222101223101224101225101226101227101228101229101230101231101232101233101234101235101236101237101238101239101240101241101242101243101244101245101246101247101248101249101250101251101252101253101254101255101256101257101258101259101260101261101262101263101264101265101266101267101268101269101270101271101272101273101274101275101276101277101278101279101280101281101282101283101284101285101286101287101288101289101290101291101292101293101294101295101296101297101298101299101300101301101302101303101304101305101306101307101308101309101310101311101312101313101314101315101316101317101318101319101320101321101322101323101324101325101326101327101328101329101330101331101332101333101334101335101336101337101338101339101340101341101342101343101344101345101346101347101348101349101350101351101352101353101354101355101356101357101358101359101360101361101362101363101364101365101366101367101368101369101370101371101372101373101374101375101376101377101378101379101380101381101382101383101384101385101386101387101388101389101390101391101392101393101394101395101396101397101398101399101400101401101402101403101404101405101406101407101408101409101410101411101412101413101414101415101416101417101418101419101420101421101422101423101424101425101426101427101428101429101430101431101432101433101434101435101436101437101438101439101440101441101442101443101444101445101446101447101448101449101450101451101452101453101454101455101456101457101458101459101460101461101462101463101464101465101466101467101468101469101470101471101472101473101474101475101476101477101478101479101480101481101482101483101484101485101486101487101488101489101490101491101492101493101494101495101496101497101498101499101500101501101502101503101504101505101506101507101508101509101510101511101512101513101514101515101516101517101518101519101520101521101522101523101524101525101526101527101528101529101530101531101532101533101534101535101536101537101538101539101540101541101542101543101544101545101546101547101548101549101550101551101552101553101554101555101556101557101558101559101560101561101562101563101564101565101566101567101568101569101570101571101572101573101574101575101576101577101578101579101580101581101582101583101584101585101586101587101588101589101590101591101592101593101594101595101596101597101598101599101600101601101602101603101604101605101606101607101608101609101610101611101612101613101614101615101616101617101618101619101620101621101622101623101624101625101626101627101628101629101630101631101632101633101634101635101636101637101638101639101640101641101642101643101644101645101646101647101648101649101650101651101652101653101654101655101656101657101658101659101660101661101662101663101664101665101666101667101668101669101670101671101672101673101674101675101676101677101678101679101680101681101682101683101684101685101686101687101688101689101690101691101692101693101694101695101696101697101698101699101700101701101702101703101704101705101706101707101708101709101710101711101712101713101714101715101716101717101718101719101720101721101722101723101724101725101726101727101728101729101730101731101732101733101734101735101736101737101738101739101740101741101742101743101744101745101746101747101748101749101750101751101752101753101754101755101756101757101758101759101760101761101762101763101764101765101766101767101768101769101770101771101772101773101774101775101776101777101778101779101780101781101782101783101784101785101786101787101788101789101790101791101792101793101794101795101796101797101798101799101800101801101802101803101804101805101806101807101808101809101810101811101812101813101814101815101816101817101818101819101820101821101822101823101824101825101826101827101828101829101830101831101832101833101834101835101836101837101838101839101840101841101842101843101844101845101846101847101848101849101850101851101852101853101854101855101856101857101858101859101860101861101862101863101864101865101866101867101868101869101870101871101872101873101874101875101876101877101878101879101880101881101882101883101884101885101886101887101888101889101890101891101892101893101894101895101896101897101898101899101900101901101902101903101904101905101906101907101908101909101910101911101912101913101914101915101916101917101918101919101920101921101922101923101924101925101926101927101928101929101930101931101932101933101934101935101936101937101938101939101940101941101942101943101944101945101946101947101948101949101950101951101952101953101954101955101956101957101958101959101960101961101962101963101964101965101966101967101968101969101970101971101972101973101974101975101976101977101978101979101980101981101982101983101984101985101986101987101988101989101990101991101992101993101994101995101996101997101998101999102000102001102002102003102004102005102006102007102008102009102010102011102012102013102014102015102016102017102018102019102020102021102022102023102024102025102026102027102028102029102030102031102032102033102034102035102036102037102038102039102040102041102042102043102044102045102046102047102048102049102050102051102052102053102054102055102056102057102058102059102060102061102062102063102064102065102066102067102068102069102070102071102072102073102074102075102076102077102078102079102080102081102082102083102084102085102086102087102088102089102090102091102092102093102094102095102096102097102098102099102100102101102102102103102104102105102106102107102108102109102110102111102112102113102114102115102116102117102118102119102120102121102122102123102124102125102126102127102128102129102130102131102132102133102134102135102136102137102138102139102140102141102142102143102144102145102146102147102148102149102150102151102152102153102154102155102156102157102158102159102160102161102162102163102164102165102166102167102168102169102170102171102172102173102174102175102176102177102178102179102180102181102182102183102184102185102186102187102188102189102190102191102192102193102194102195102196102197102198102199102200102201102202102203102204102205102206102207102208102209102210102211102212102213102214102215102216102217102218102219102220102221102222102223102224102225102226102227102228102229102230102231102232102233102234102235102236102237102238102239102240102241102242102243102244102245102246102247102248102249102250102251102252102253102254102255102256102257102258102259102260102261102262102263102264102265102266102267102268102269102270102271102272102273102274102275102276102277102278102279102280102281102282102283102284102285102286102287102288102289102290102291102292102293102294102295102296102297102298102299102300102301102302102303102304102305102306102307102308102309102310102311102312102313102314102315102316102317102318102319102320102321102322102323102324102325102326102327102328102329102330102331102332102333102334102335102336102337102338102339102340102341102342102343102344102345102346102347102348102349102350102351102352102353102354102355102356102357102358102359102360102361102362102363102364102365102366102367102368102369102370102371102372102373102374102375102376102377102378102379102380102381102382102383102384102385102386102387102388102389102390102391102392102393102394102395102396102397102398102399102400102401102402102403102404102405102406102407102408102409102410102411102412102413102414102415102416102417102418102419102420102421102422102423102424102425102426102427102428102429102430102431102432102433102434102435102436102437102438102439102440102441102442102443102444102445102446102447102448102449102450102451102452102453102454102455102456102457102458102459102460102461102462102463102464102465102466102467102468102469102470102471102472102473102474102475102476102477102478102479102480102481102482102483102484102485102486102487102488102489102490102491102492102493102494102495102496102497102498102499102500102501102502102503102504102505102506102507102508102509102510102511102512102513102514102515102516102517102518102519102520102521102522102523102524102525102526102527102528102529102530102531102532102533102534102535102536102537102538102539102540102541102542102543102544102545102546102547102548102549102550102551102552102553102554102555102556102557102558102559102560102561102562102563102564102565102566102567102568102569102570102571102572102573102574102575102576102577102578102579102580102581102582102583102584102585102586102587102588102589102590102591102592102593102594102595102596102597102598102599102600102601102602102603102604102605102606102607102608102609102610102611102612102613102614102615102616102617102618102619102620102621102622102623102624102625102626102627102628102629102630102631102632102633102634102635102636102637102638102639102640102641102642102643102644102645102646102647102648102649102650102651102652102653102654102655102656102657102658102659102660102661102662102663102664102665102666102667102668102669102670102671102672102673102674102675102676102677102678102679102680102681102682102683102684102685102686102687102688102689102690102691102692102693102694102695102696102697102698102699102700102701102702102703102704102705102706102707102708102709102710102711102712102713102714102715102716102717102718102719102720102721102722102723102724102725102726102727102728102729102730102731102732102733102734102735102736102737102738102739102740102741102742102743102744102745102746102747102748102749102750102751102752102753102754102755102756102757102758102759102760102761102762102763102764102765102766102767102768102769102770102771102772102773102774102775102776102777102778102779102780102781102782102783102784102785102786102787102788102789102790102791102792102793102794102795102796102797102798102799102800102801102802102803102804102805102806102807102808102809102810102811102812102813102814102815102816102817102818102819102820102821102822102823102824102825102826102827102828102829102830102831102832102833102834102835102836102837102838102839102840102841102842102843102844102845102846102847102848102849102850102851102852102853102854102855102856102857102858102859102860102861102862102863102864102865102866102867102868102869102870102871102872102873102874102875102876102877102878102879102880102881102882102883102884102885102886102887102888102889102890102891102892102893102894102895102896102897102898102899102900102901102902102903102904102905102906102907102908102909102910102911102912102913102914102915102916102917102918102919102920102921102922102923102924102925102926102927102928102929102930102931102932102933102934102935102936102937102938102939102940102941102942102943102944102945102946102947102948102949102950102951102952102953102954102955102956102957102958102959102960102961102962102963102964102965102966102967102968102969102970102971102972102973102974102975102976102977102978102979102980102981102982102983102984102985102986102987102988102989102990102991102992102993102994102995102996102997102998102999103000103001103002103003103004103005103006103007103008103009103010103011103012103013103014103015103016103017103018103019103020103021103022103023103024103025103026103027103028103029103030103031103032103033103034103035103036103037103038103039103040103041103042103043103044103045103046103047103048103049103050103051103052103053103054103055103056103057103058103059103060103061103062103063103064103065103066103067103068103069103070103071103072103073103074103075103076103077103078103079103080103081103082103083103084103085103086103087103088103089103090103091103092103093103094103095103096103097103098103099103100103101103102103103103104103105103106103107103108103109103110103111103112103113103114103115103116103117103118103119103120103121103122103123103124103125103126103127103128103129103130103131103132103133103134103135103136103137103138103139103140103141103142103143103144103145103146103147103148103149103150103151103152103153103154103155103156103157103158103159103160103161103162103163103164103165103166103167103168103169103170103171103172103173103174103175103176103177103178103179103180103181103182103183103184103185103186103187103188103189103190103191103192103193103194103195103196103197103198103199103200103201103202103203103204103205103206103207103208103209103210103211103212103213103214103215103216103217103218103219103220103221103222103223103224103225103226103227103228103229103230103231103232103233103234103235103236103237103238103239103240103241103242103243103244103245103246103247103248103249103250103251103252103253103254103255103256103257103258103259103260103261103262103263103264103265103266103267103268103269103270103271103272103273103274103275103276103277103278103279103280103281103282103283103284103285103286103287103288103289103290103291103292103293103294103295103296103297103298103299103300103301103302103303103304103305103306103307103308103309103310103311103312103313103314103315103316103317103318103319103320103321103322103323103324103325103326103327103328103329103330103331103332103333103334103335103336103337103338103339103340103341103342103343103344103345103346103347103348103349103350103351103352103353103354103355103356103357103358103359103360103361103362103363103364103365103366103367103368103369103370103371103372103373103374103375103376103377103378103379103380103381103382103383103384103385103386103387103388103389103390103391103392103393103394103395103396103397103398103399103400103401103402103403103404103405103406103407103408103409103410103411103412103413103414103415103416103417103418103419103420103421103422103423103424103425103426103427103428103429103430103431103432103433103434103435103436103437103438103439103440103441103442103443103444103445103446103447103448103449103450103451103452103453103454103455103456103457103458103459103460103461103462103463103464103465103466103467103468103469103470103471103472103473103474103475103476103477103478103479103480103481103482103483103484103485103486103487103488103489103490103491103492103493103494103495103496103497103498103499103500103501103502103503103504103505103506103507103508103509103510103511103512103513103514103515103516103517103518103519103520103521103522103523103524103525103526103527103528103529103530103531103532103533103534103535103536103537103538103539103540103541103542103543103544103545103546103547103548103549103550103551103552103553103554103555103556103557103558103559103560103561103562103563103564103565103566103567103568103569103570103571103572103573103574103575103576103577103578103579103580103581103582103583103584103585103586103587103588103589103590103591103592103593103594103595103596103597103598103599103600103601103602103603103604103605103606103607103608103609103610103611103612103613103614103615103616103617103618103619103620103621103622103623103624103625103626103627103628103629103630103631103632103633103634103635103636103637103638103639103640103641103642103643103644103645103646103647103648103649103650103651103652103653103654103655103656103657103658103659103660103661103662103663103664103665103666103667103668103669103670103671103672103673103674103675103676103677103678103679103680103681103682103683103684103685103686103687103688103689103690103691103692103693103694103695103696103697103698103699103700103701103702103703103704103705103706103707103708103709103710103711103712103713103714103715103716103717103718103719103720103721103722103723103724103725103726103727103728103729103730103731103732103733103734103735103736103737103738103739103740103741103742103743103744103745103746103747103748103749103750103751103752103753103754103755103756103757103758103759103760103761103762103763103764103765103766103767103768103769103770103771103772103773103774103775103776103777103778103779103780103781103782103783103784103785103786103787103788103789103790103791103792103793103794103795103796103797103798103799103800103801103802103803103804103805103806103807103808103809103810103811103812103813103814103815103816103817103818103819103820103821103822103823103824103825103826103827103828103829103830103831103832103833103834103835103836103837103838103839103840103841103842103843103844103845103846103847103848103849103850103851103852103853103854103855103856103857103858103859103860103861103862103863103864103865103866103867103868103869103870103871103872103873103874103875103876103877103878103879103880103881103882103883103884103885103886103887103888103889103890103891103892103893103894103895103896103897103898103899103900103901103902103903103904103905103906103907103908103909103910103911103912103913103914103915103916103917103918103919103920103921103922103923103924103925103926103927103928103929103930103931103932103933103934103935103936103937103938103939103940103941103942103943103944103945103946103947103948103949103950103951103952103953103954103955103956103957103958103959103960103961103962103963103964103965103966103967103968103969103970103971103972103973103974103975103976103977103978103979103980103981103982103983103984103985103986103987103988103989103990103991103992103993103994103995103996103997103998103999104000104001104002104003104004104005104006104007104008104009104010104011104012104013104014104015104016104017104018104019104020104021104022104023104024104025104026104027104028104029104030104031104032104033104034104035104036104037104038104039104040104041104042104043104044104045104046104047104048104049104050104051104052104053104054104055104056104057104058104059104060104061104062104063104064104065104066104067104068104069104070104071104072104073104074104075104076104077104078104079104080104081104082104083104084104085104086104087104088104089104090104091104092104093104094104095104096104097104098104099104100104101104102104103104104104105104106104107104108104109104110104111104112104113104114104115104116104117104118104119104120104121104122104123104124104125104126104127104128104129104130104131104132104133104134104135104136104137104138104139104140104141104142104143104144104145104146104147104148104149104150104151104152104153104154104155104156104157104158104159104160104161104162104163104164104165104166104167104168104169104170104171104172104173104174104175104176104177104178104179104180104181104182104183104184104185104186104187104188104189104190104191104192104193104194104195104196104197104198104199104200104201104202104203104204104205104206104207104208104209104210104211104212104213104214104215104216104217104218104219104220104221104222104223104224104225104226104227104228104229104230104231104232104233104234104235104236104237104238104239104240104241104242104243104244104245104246104247104248104249104250104251104252104253104254104255104256104257104258104259104260104261104262104263104264104265104266104267104268104269104270104271104272104273104274104275104276104277104278104279104280104281104282104283104284104285104286104287104288104289104290104291104292104293104294104295104296104297104298104299104300104301104302104303104304104305104306104307104308104309104310104311104312104313104314104315104316104317104318104319104320104321104322104323104324104325104326104327104328104329104330104331104332104333104334104335104336104337104338104339104340104341104342104343104344104345104346104347104348104349104350104351104352104353104354104355104356104357104358104359104360104361104362104363104364104365104366104367104368104369104370104371104372104373104374104375104376104377104378104379104380104381104382104383104384104385104386104387104388104389104390104391104392104393104394104395104396104397104398104399104400104401104402104403104404104405104406104407104408104409104410104411104412104413104414104415104416104417104418104419104420104421104422104423104424104425104426104427104428104429104430104431104432104433104434104435104436104437104438104439104440104441104442104443104444104445104446104447104448104449104450104451104452104453104454104455104456104457104458104459104460104461104462104463104464104465104466104467104468104469104470104471104472104473104474104475104476104477104478104479104480104481104482104483104484104485104486104487104488104489104490104491104492104493104494104495104496104497104498104499104500104501104502104503104504104505104506104507104508104509104510104511104512104513104514104515104516104517104518104519104520104521104522104523104524104525104526104527104528104529104530104531104532104533104534104535104536104537104538104539104540104541104542104543104544104545104546104547104548104549104550104551104552104553104554104555104556104557104558104559104560104561104562104563104564104565104566104567104568104569104570104571104572104573104574104575104576104577104578104579104580104581104582104583104584104585104586104587104588104589104590104591104592104593104594104595104596104597104598104599104600104601104602104603104604104605104606104607104608104609104610104611104612104613104614104615104616104617104618104619104620104621104622104623104624104625104626104627104628104629104630104631104632104633104634104635104636104637104638104639104640104641104642104643104644104645104646104647104648104649104650104651104652104653104654104655104656104657104658104659104660104661104662104663104664104665104666104667104668104669104670104671104672104673104674104675104676104677104678104679104680104681104682104683104684104685104686104687104688104689104690104691104692104693104694104695104696104697104698104699104700104701104702104703104704104705104706104707104708104709104710104711104712104713104714104715104716104717104718104719104720104721104722104723104724104725104726104727104728104729104730104731104732104733104734104735104736104737104738104739104740104741104742104743104744104745104746104747104748104749104750104751104752104753104754104755104756104757104758104759104760104761104762104763104764104765104766104767104768104769104770104771104772104773104774104775104776104777104778104779104780104781104782104783104784104785104786104787104788104789104790104791104792104793104794104795104796104797104798104799104800104801104802104803104804104805104806104807104808104809104810104811104812104813104814104815104816104817104818104819104820104821104822104823104824104825104826104827104828104829104830104831104832104833104834104835104836104837104838104839104840104841104842104843104844104845104846104847104848104849104850104851104852104853104854104855104856104857104858104859104860104861104862104863104864104865104866104867104868104869104870104871104872104873104874104875104876104877104878104879104880104881104882104883104884104885104886104887104888104889104890104891104892104893104894104895104896104897104898104899104900104901104902104903104904104905104906104907104908104909104910104911104912104913104914104915104916104917104918104919104920104921104922104923104924104925104926104927104928104929104930104931104932104933104934104935104936104937104938104939104940104941104942104943104944104945104946104947104948104949104950104951104952104953104954104955104956104957104958104959104960104961104962104963104964104965104966104967104968104969104970104971104972104973104974104975104976104977104978104979104980104981104982104983104984104985104986104987104988104989104990104991104992104993104994104995104996104997104998104999105000105001105002105003105004105005105006105007105008105009105010105011105012105013105014105015105016105017105018105019105020105021105022105023105024105025105026105027105028105029105030105031105032105033105034105035105036105037105038105039105040105041105042105043105044105045105046105047105048105049105050105051105052105053105054105055105056105057105058105059105060105061105062105063105064105065105066105067105068105069105070105071105072105073105074105075105076105077105078105079105080105081105082105083105084105085105086105087105088105089105090105091105092105093105094105095105096105097105098105099105100105101105102105103105104105105105106105107105108105109105110105111105112105113105114105115105116105117105118105119105120105121105122105123105124105125105126105127105128105129105130105131105132105133105134105135105136105137105138105139105140105141105142105143105144105145105146105147105148105149105150105151105152105153105154105155105156105157105158105159105160105161105162105163105164105165105166105167105168105169105170105171105172105173105174105175105176105177105178105179105180105181105182105183105184105185105186105187105188105189105190105191105192105193105194105195105196105197105198105199105200105201105202105203105204105205105206105207105208105209105210105211105212105213105214105215105216105217105218105219105220105221105222105223105224105225105226105227105228105229105230105231105232105233105234105235105236105237105238105239105240105241105242105243105244105245105246105247105248105249105250105251105252105253105254105255105256105257105258105259105260105261105262105263105264105265105266105267105268105269105270105271105272105273105274105275105276105277105278105279105280105281105282105283105284105285105286105287105288105289105290105291105292105293105294105295105296105297105298105299105300105301105302105303105304105305105306105307105308105309105310105311105312105313105314105315105316105317105318105319105320105321105322105323105324105325105326105327105328105329105330105331105332105333105334105335105336105337105338105339105340105341105342105343105344105345105346105347105348105349105350105351105352105353105354105355105356105357105358105359105360105361105362105363105364105365105366105367105368105369105370105371105372105373105374105375105376105377105378105379105380105381105382105383105384105385105386105387105388105389105390105391105392105393105394105395105396105397105398105399105400105401105402105403105404105405105406105407105408105409105410105411105412105413105414105415105416105417105418105419105420105421105422105423105424105425105426105427105428105429105430105431105432105433105434105435105436105437105438105439105440105441105442105443105444105445105446105447105448105449105450105451105452105453105454105455105456105457105458105459105460105461105462105463105464105465105466105467105468105469105470105471105472105473105474105475105476105477105478105479105480105481105482105483105484105485105486105487105488105489105490105491105492105493105494105495105496105497105498105499105500105501105502105503105504105505105506105507105508105509105510105511105512105513105514105515105516105517105518105519105520105521105522105523105524105525105526105527105528105529105530105531105532105533105534105535105536105537105538105539105540105541105542105543105544105545105546105547105548105549105550105551105552105553105554105555105556105557105558105559105560105561105562105563105564105565105566105567105568105569105570105571105572105573105574105575105576105577105578105579105580105581105582105583105584105585105586105587105588105589105590105591105592105593105594105595105596105597105598105599105600105601105602105603105604105605105606105607105608105609105610105611105612105613105614105615105616105617105618105619105620105621105622105623105624105625105626105627105628105629105630105631105632105633105634105635105636105637105638105639105640105641105642105643105644105645105646105647105648105649105650105651105652105653105654105655105656105657105658105659105660105661105662105663105664105665105666105667105668105669105670105671105672105673105674105675105676105677105678105679105680105681105682105683105684105685105686105687105688105689105690105691105692105693105694105695105696105697105698105699105700105701105702105703105704105705105706105707105708105709105710105711105712105713105714105715105716105717105718105719105720105721105722105723105724105725105726105727105728105729105730105731105732105733105734105735105736105737105738105739105740105741105742105743105744105745105746105747105748105749105750105751105752105753105754105755105756105757105758105759105760105761105762105763105764105765105766105767105768105769105770105771105772105773105774105775105776105777105778105779105780105781105782105783105784105785105786105787105788105789105790105791105792105793105794105795105796105797105798105799105800105801105802105803105804105805105806105807105808105809105810105811105812105813105814105815105816105817105818105819105820105821105822105823105824105825105826105827105828105829105830105831105832105833105834105835105836105837105838105839105840105841105842105843105844105845105846105847105848105849105850105851105852105853105854105855105856105857105858105859105860105861105862105863105864105865105866105867105868105869105870105871105872105873105874105875105876105877105878105879105880105881105882105883105884105885105886105887105888105889105890105891105892105893105894105895105896105897105898105899105900105901105902105903105904105905105906105907105908105909105910105911105912105913105914105915105916105917105918105919105920105921105922105923105924105925105926105927105928105929105930105931105932105933105934105935105936105937105938105939105940105941105942105943105944105945105946105947105948105949105950105951105952105953105954105955105956105957105958105959105960105961105962105963105964105965105966105967105968105969105970105971105972105973105974105975105976105977105978105979105980105981105982105983105984105985105986105987105988105989105990105991105992105993105994105995105996105997105998105999106000106001106002106003106004106005106006106007106008106009106010106011106012106013106014106015106016106017106018106019106020106021106022106023106024106025106026106027106028106029106030106031106032106033106034106035106036106037106038106039106040106041106042106043106044106045106046106047106048106049106050106051106052106053106054106055106056106057106058106059106060106061106062106063106064106065106066106067106068106069106070106071106072106073106074106075106076106077106078106079106080106081106082106083106084106085106086106087106088106089106090106091106092106093106094106095106096106097106098106099106100106101106102106103106104106105106106106107106108106109106110106111106112106113106114106115106116106117106118106119106120106121106122106123106124106125106126106127106128106129106130106131106132106133106134106135106136106137106138106139106140106141106142106143106144106145106146106147106148106149106150106151106152106153106154106155106156106157106158106159106160106161106162106163106164106165106166106167106168106169106170106171106172106173106174106175106176106177106178106179106180106181106182106183106184106185106186106187106188106189106190106191106192106193106194106195106196106197106198106199106200106201106202106203106204106205106206106207106208106209106210106211106212106213106214106215106216106217106218106219106220106221106222106223106224106225106226106227106228106229106230106231106232106233106234106235106236106237106238106239106240106241106242106243106244106245106246106247106248106249106250106251106252106253106254106255106256106257106258106259106260106261106262106263106264106265106266106267106268106269106270106271106272106273106274106275106276106277106278106279106280106281106282106283106284106285106286106287106288106289106290106291106292106293106294106295106296106297106298106299106300106301106302106303106304106305106306106307106308106309106310106311106312106313106314106315106316106317106318106319106320106321106322106323106324106325106326106327106328106329106330106331106332106333106334106335106336106337106338106339106340106341106342106343106344106345106346106347106348106349106350106351106352106353106354106355106356106357106358106359106360106361106362106363106364106365106366106367106368106369106370106371106372106373106374106375106376106377106378106379106380106381106382106383106384106385106386106387106388106389106390106391106392106393106394106395106396106397106398106399106400106401106402106403106404106405106406106407106408106409106410106411106412106413106414106415106416106417106418106419106420106421106422106423106424106425106426106427106428106429106430106431106432106433106434106435106436106437106438106439106440106441106442106443106444106445106446106447106448106449106450106451106452106453106454106455106456106457106458106459106460106461106462106463106464106465106466106467106468106469106470106471106472106473106474106475106476106477106478106479106480106481106482106483106484106485106486106487106488106489106490106491106492106493106494106495106496106497106498106499106500106501106502106503106504106505106506106507106508106509106510106511106512106513106514106515106516106517106518106519106520106521106522106523106524106525106526106527106528106529106530106531106532106533106534106535106536106537106538106539106540106541106542106543106544106545106546106547106548106549106550106551106552106553106554106555106556106557106558106559106560106561106562106563106564106565106566106567106568106569106570106571106572106573106574106575106576106577106578106579106580106581106582106583106584106585106586106587106588106589106590106591106592106593106594106595106596106597106598106599106600106601106602106603106604106605106606106607106608106609106610106611106612106613106614106615106616106617106618106619106620106621106622106623106624106625106626106627106628106629106630106631106632106633106634106635106636106637106638106639106640106641106642106643106644106645106646106647106648106649106650106651106652106653106654106655106656106657106658106659106660106661106662106663106664106665106666106667106668106669106670106671106672106673106674106675106676106677106678106679106680106681106682106683106684106685106686106687106688106689106690106691106692106693106694106695106696106697106698106699106700106701106702106703106704106705106706106707106708106709106710106711106712106713106714106715106716106717106718106719106720106721106722106723106724106725106726106727106728106729106730106731106732106733106734106735106736106737106738106739106740106741106742106743106744106745106746106747106748106749106750106751106752106753106754106755106756106757106758106759106760106761106762106763106764106765106766106767106768106769106770106771106772106773106774106775106776106777106778106779106780106781106782106783106784106785106786106787106788106789106790106791106792106793106794106795106796106797106798106799106800106801106802106803106804106805106806106807106808106809106810106811106812106813106814106815106816106817106818106819106820106821106822106823106824106825106826106827106828106829106830106831106832106833106834106835106836106837106838106839106840106841106842106843106844106845106846106847106848106849106850106851106852106853106854106855106856106857106858106859106860106861106862106863106864106865106866106867106868106869106870106871106872106873106874106875106876106877106878106879106880106881106882106883106884106885106886106887106888106889106890106891106892106893106894106895106896106897106898106899106900106901106902106903106904106905106906106907106908106909106910106911106912106913106914106915106916106917106918106919106920106921106922106923106924106925106926106927106928106929106930106931106932106933106934106935106936106937106938106939106940106941106942106943106944106945106946106947106948106949106950106951106952106953106954106955106956106957106958106959106960106961106962106963106964106965106966106967106968106969106970106971106972106973106974106975106976106977106978106979106980106981106982106983106984106985106986106987106988106989106990106991106992106993106994106995106996106997106998106999107000107001107002107003107004107005107006107007107008107009107010107011107012107013107014107015107016107017107018107019107020107021107022107023107024107025107026107027107028107029107030107031107032107033107034107035107036107037107038107039107040107041107042107043107044107045107046107047107048107049107050107051107052107053107054107055107056107057107058107059107060107061107062107063107064107065107066107067107068107069107070107071107072107073107074107075107076107077107078107079107080107081107082107083107084107085107086107087107088107089107090107091107092107093107094107095107096107097107098107099107100107101107102107103107104107105107106107107107108107109107110107111107112107113107114107115107116107117107118107119107120107121107122107123107124107125107126107127107128107129107130107131107132107133107134107135107136107137107138107139107140107141107142107143107144107145107146107147107148107149107150107151107152107153107154107155107156107157107158107159107160107161107162107163107164107165107166107167107168107169107170107171107172107173107174107175107176107177107178107179107180107181107182107183107184107185107186107187107188107189107190107191107192107193107194107195107196107197107198107199107200107201107202107203107204107205107206107207107208107209107210107211107212107213107214107215107216107217107218107219107220107221107222107223107224107225107226107227107228107229107230107231107232107233107234107235107236107237107238107239107240107241107242107243107244107245107246107247107248107249107250107251107252107253107254107255107256107257107258107259107260107261107262107263107264107265107266107267107268107269107270107271107272107273107274107275107276107277107278107279107280107281107282107283107284107285107286107287107288107289107290107291107292107293107294107295107296107297107298107299107300107301107302107303107304107305107306107307107308107309107310107311107312107313107314107315107316107317107318107319107320107321107322107323107324107325107326107327107328107329107330107331107332107333107334107335107336107337107338107339107340107341107342107343107344107345107346107347107348107349107350107351107352107353107354107355107356107357107358107359107360107361107362107363107364107365107366107367107368107369107370107371107372107373107374107375107376107377107378107379107380107381107382107383107384107385107386107387107388107389107390107391107392107393107394107395107396107397107398107399107400107401107402107403107404107405107406107407107408107409107410107411107412107413107414107415107416107417107418107419107420107421107422107423107424107425107426107427107428107429107430107431107432107433107434107435107436107437107438107439107440107441107442107443107444107445107446107447107448107449107450107451107452107453107454107455107456107457107458107459107460107461107462107463107464107465107466107467107468107469107470107471107472107473107474107475107476107477107478107479107480107481107482107483107484107485107486107487107488107489107490107491107492107493107494107495107496107497107498107499107500107501107502107503107504107505107506107507107508107509107510107511107512107513107514107515107516107517107518107519107520107521107522107523107524107525107526107527107528107529107530107531107532107533107534107535107536107537107538107539107540107541107542107543107544107545107546107547107548107549107550107551107552107553107554107555107556107557107558107559107560107561107562107563107564107565107566107567107568107569107570107571107572107573107574107575107576107577107578107579107580107581107582107583107584107585107586107587107588107589107590107591107592107593107594107595107596107597107598107599107600107601107602107603107604107605107606107607107608107609107610107611107612107613107614107615107616107617107618107619107620107621107622107623107624107625107626107627107628107629107630107631107632107633107634107635107636107637107638107639107640107641107642107643107644107645107646107647107648107649107650107651107652107653107654107655107656107657107658107659107660107661107662107663107664107665107666107667107668107669107670107671107672107673107674107675107676107677107678107679107680107681107682107683107684107685107686107687107688107689107690107691107692107693107694107695107696107697107698107699107700107701107702107703107704107705107706107707107708107709107710107711107712107713107714107715107716107717107718107719107720107721107722107723107724107725107726107727107728107729107730107731107732107733107734107735107736107737107738107739107740107741107742107743107744107745107746107747107748107749107750107751107752107753107754107755107756107757107758107759107760107761107762107763107764107765107766107767107768107769107770107771107772107773107774107775107776107777107778107779107780107781107782107783107784107785107786107787107788107789107790107791107792107793107794107795107796107797107798107799107800107801107802107803107804107805107806107807107808107809107810107811107812107813107814107815107816107817107818107819107820107821107822107823107824107825107826107827107828107829107830107831107832107833107834107835107836107837107838107839107840107841107842107843107844107845107846107847107848107849107850107851107852107853107854107855107856107857107858107859107860107861107862107863107864107865107866107867107868107869107870107871107872107873107874107875107876107877107878107879107880107881107882107883107884107885107886107887107888107889107890107891107892107893107894107895107896107897107898107899107900107901107902107903107904107905107906107907107908107909107910107911107912107913107914107915107916107917107918107919107920107921107922107923107924107925107926107927107928107929107930107931107932107933107934107935107936107937107938107939107940107941107942107943107944107945107946107947107948107949107950107951107952107953107954107955107956107957107958107959107960107961107962107963107964107965107966107967107968107969107970107971107972107973107974107975107976107977107978107979107980107981107982107983107984107985107986107987107988107989107990107991107992107993107994107995107996107997107998107999108000108001108002108003108004108005108006108007108008108009108010108011108012108013108014108015108016108017108018108019108020108021108022108023108024108025108026108027108028108029108030108031108032108033108034108035108036108037108038108039108040108041108042108043108044108045108046108047108048108049108050108051108052108053108054108055108056108057108058108059108060108061108062108063108064108065108066108067108068108069108070108071108072108073108074108075108076108077108078108079108080108081108082108083108084108085108086108087108088108089108090108091108092108093108094108095108096108097108098108099108100108101108102108103108104108105108106108107108108108109108110108111108112108113108114108115108116108117108118108119108120108121108122108123108124108125108126108127108128108129108130108131108132108133108134108135108136108137108138108139108140108141108142108143108144108145108146108147108148108149108150108151108152108153108154108155108156108157108158108159108160108161108162108163108164108165108166108167108168108169108170108171108172108173108174108175108176108177108178108179108180108181108182108183108184108185108186108187108188108189108190108191108192108193108194108195108196108197108198108199108200108201108202108203108204108205108206108207108208108209108210108211108212108213108214108215108216108217108218108219108220108221108222108223108224108225108226108227108228108229108230108231108232108233108234108235108236108237108238108239108240108241108242108243108244108245108246108247108248108249108250108251108252108253108254108255108256108257108258108259108260108261108262108263108264108265108266108267108268108269108270108271108272108273108274108275108276108277108278108279108280108281108282108283108284108285108286108287108288108289108290108291108292108293108294108295108296108297108298108299108300108301108302108303108304108305108306108307108308108309108310108311108312108313108314108315108316108317108318108319108320108321108322108323108324108325108326108327108328108329108330108331108332108333108334108335108336108337108338108339108340108341108342108343108344108345108346108347108348108349108350108351108352108353108354108355108356108357108358108359108360108361108362108363108364108365108366108367108368108369108370108371108372108373108374108375108376108377108378108379108380108381108382108383108384108385108386108387108388108389108390108391108392108393108394108395108396108397108398108399108400108401108402108403108404108405108406108407108408108409108410108411108412108413108414108415108416108417108418108419108420108421108422108423108424108425108426108427108428108429108430108431108432108433108434108435108436108437108438108439108440108441108442108443108444108445108446108447108448108449108450108451108452108453108454108455108456108457108458108459108460108461108462108463108464108465108466108467108468108469108470108471108472108473108474108475108476108477108478108479108480108481108482108483108484108485108486108487108488108489108490108491108492108493108494108495108496108497108498108499108500108501108502108503108504108505108506108507108508108509108510108511108512108513108514108515108516108517108518108519108520108521108522108523108524108525108526108527108528108529108530108531108532108533108534108535108536108537108538108539108540108541108542108543108544108545108546108547108548108549108550108551108552108553108554108555108556108557108558108559108560108561108562108563108564108565108566108567108568108569108570108571108572108573108574108575108576108577108578108579108580108581108582108583108584108585108586108587108588108589108590108591108592108593108594108595108596108597108598108599108600108601108602108603108604108605108606108607108608108609108610108611108612108613108614108615108616108617108618108619108620108621108622108623108624108625108626108627108628108629108630108631108632108633108634108635108636108637108638108639108640108641108642108643108644108645108646108647108648108649108650108651108652108653108654108655108656108657108658108659108660108661108662108663108664108665108666108667108668108669108670108671108672108673108674108675108676108677108678108679108680108681108682108683108684108685108686108687108688108689108690108691108692108693108694108695108696108697108698108699108700108701108702108703108704108705108706108707108708108709108710108711108712108713108714108715108716108717108718108719108720108721108722108723108724108725108726108727108728108729108730108731108732108733108734108735108736108737108738108739108740108741108742108743108744108745108746108747108748108749108750108751108752108753108754108755108756108757108758108759108760108761108762108763108764108765108766108767108768108769108770108771108772108773108774108775108776108777108778108779108780108781108782108783108784108785108786108787108788108789108790108791108792108793108794108795108796108797108798108799108800108801108802108803108804108805108806108807108808108809108810108811108812108813108814108815108816108817108818108819108820108821108822108823108824108825108826108827108828108829108830108831108832108833108834108835108836108837108838108839108840108841108842108843108844108845108846108847108848108849108850108851108852108853108854108855108856108857108858108859108860108861108862108863108864108865108866108867108868108869108870108871108872108873108874108875108876108877108878108879108880108881108882108883108884108885108886108887108888108889108890108891108892108893108894108895108896108897108898108899108900108901108902108903108904108905108906108907108908108909108910108911108912108913108914108915108916108917108918108919108920108921108922108923108924108925108926108927108928108929108930108931108932108933108934108935108936108937108938108939108940108941108942108943108944108945108946108947108948108949108950108951108952108953108954108955108956108957108958108959108960108961108962108963108964108965108966108967108968108969108970108971108972108973108974108975108976108977108978108979108980108981108982108983108984108985108986108987108988108989108990108991108992108993108994108995108996108997108998108999109000109001109002109003109004109005109006109007109008109009109010109011109012109013109014109015109016109017109018109019109020109021109022109023109024109025109026109027109028109029109030109031109032109033109034109035109036109037109038109039109040109041109042109043109044109045109046109047109048109049109050109051109052109053109054109055109056109057109058109059109060109061109062109063109064109065109066109067109068109069109070109071109072109073109074109075109076109077109078109079109080109081109082109083109084109085109086109087109088109089109090109091109092109093109094109095109096109097109098109099109100109101109102109103109104109105109106109107109108109109109110109111109112109113109114109115109116109117109118109119109120109121109122109123109124109125109126109127109128109129109130109131109132109133109134109135109136109137109138109139109140109141109142109143109144109145109146109147109148109149109150109151109152109153109154109155109156109157109158109159109160109161109162109163109164109165109166109167109168109169109170109171109172109173109174109175109176109177109178109179109180109181109182109183109184109185109186109187109188109189109190109191109192109193109194109195109196109197109198109199109200109201109202109203109204109205109206109207109208109209109210109211109212109213109214109215109216109217109218109219109220109221109222109223109224109225109226109227109228109229109230109231109232109233109234109235109236109237109238109239109240109241109242109243109244109245109246109247109248109249109250109251109252109253109254109255109256109257109258109259109260109261109262109263109264109265109266109267109268109269109270109271109272109273109274109275109276109277109278109279109280109281109282109283109284109285109286109287109288109289109290109291109292109293109294109295109296109297109298109299109300109301109302109303109304109305109306109307109308109309109310109311109312109313109314109315109316109317109318109319109320109321109322109323109324109325109326109327109328109329109330109331109332109333109334109335109336109337109338109339109340109341109342109343109344109345109346109347109348109349109350109351109352109353109354109355109356109357109358109359109360109361109362109363109364109365109366109367109368109369109370109371109372109373109374109375109376109377109378109379109380109381109382109383109384109385109386109387109388109389109390109391109392109393109394109395109396109397109398109399109400109401109402109403109404109405109406109407109408109409109410109411109412109413109414109415109416109417109418109419109420109421109422109423109424109425109426109427109428109429109430109431109432109433109434109435109436109437109438109439109440109441109442109443109444109445109446109447109448109449109450109451109452109453109454109455109456109457109458109459109460109461109462109463109464109465109466109467109468109469109470109471109472109473109474109475109476109477109478109479109480109481109482109483109484109485109486109487109488109489109490109491109492109493109494109495109496109497109498109499109500109501109502109503109504109505109506109507109508109509109510109511109512109513109514109515109516109517109518109519109520109521109522109523109524109525109526109527109528109529109530109531109532109533109534109535109536109537109538109539109540109541109542109543109544109545109546109547109548109549109550109551109552109553109554109555109556109557109558109559109560109561109562109563109564109565109566109567109568109569109570109571109572109573109574109575109576109577109578109579109580109581109582109583109584109585109586109587109588109589109590109591109592109593109594109595109596109597109598109599109600109601109602109603109604109605109606109607109608109609109610109611109612109613109614109615109616109617109618109619109620109621109622109623109624109625109626109627109628109629109630109631109632109633109634109635109636109637109638109639109640109641109642109643109644109645109646109647109648109649109650109651109652109653109654109655109656109657109658109659109660109661109662109663109664109665109666109667109668109669109670109671109672109673109674109675109676109677109678109679109680109681109682109683109684109685109686109687109688109689109690109691109692109693109694109695109696109697109698109699109700109701109702109703109704109705109706109707109708109709109710109711109712109713109714109715109716109717109718109719109720109721109722109723109724109725109726109727109728109729109730109731109732109733109734109735109736109737109738109739109740109741109742109743109744109745109746109747109748109749109750109751109752109753109754109755109756109757109758109759109760109761109762109763109764109765109766109767109768109769109770109771109772109773109774109775109776109777109778109779109780109781109782109783109784109785109786109787109788109789109790109791109792109793109794109795109796109797109798109799109800109801109802109803109804109805109806109807109808109809109810109811109812109813109814109815109816109817109818109819109820109821109822109823109824109825109826109827109828109829109830109831109832109833109834109835109836109837109838109839109840109841109842109843109844109845109846109847109848109849109850109851109852109853109854109855109856109857109858109859109860109861109862109863109864109865109866109867109868109869109870109871109872109873109874109875109876109877109878109879109880109881109882109883109884109885109886109887109888109889109890109891109892109893109894109895109896109897109898109899109900109901109902109903109904109905109906109907109908109909109910109911109912109913109914109915109916109917109918109919109920109921109922109923109924109925109926109927109928109929109930109931109932109933109934109935109936109937109938109939109940109941109942109943109944109945109946109947109948109949109950109951109952109953109954109955109956109957109958109959109960109961109962109963109964109965109966109967109968109969109970109971109972109973109974109975109976109977109978109979109980109981109982109983109984109985109986109987109988109989109990109991109992109993109994109995109996109997109998109999110000110001110002110003110004110005110006110007110008110009110010110011110012110013110014110015110016110017110018110019110020110021110022110023110024110025110026110027110028110029110030110031110032110033110034110035110036110037110038110039110040110041110042110043110044110045110046110047110048110049110050110051110052110053110054110055110056110057110058110059110060110061110062110063110064110065110066110067110068110069110070110071110072110073110074110075110076110077110078110079110080110081110082110083110084110085110086110087110088110089110090110091110092110093110094110095110096110097110098110099110100110101110102110103110104110105110106110107110108110109110110110111110112110113110114110115110116110117110118110119110120110121110122110123110124110125110126110127110128110129110130110131110132110133110134110135110136110137110138110139110140110141110142110143110144110145110146110147110148110149110150110151110152110153110154110155110156110157110158110159110160110161110162110163110164110165110166110167110168110169110170110171110172110173110174110175110176110177110178110179110180110181110182110183110184110185110186110187110188110189110190110191110192110193110194110195110196110197110198110199110200110201110202110203110204110205110206110207110208110209110210110211110212110213110214110215110216110217110218110219110220110221110222110223110224110225110226110227110228110229110230110231110232110233110234110235110236110237110238110239110240110241110242110243110244110245110246110247110248110249110250110251110252110253110254110255110256110257110258110259110260110261110262110263110264110265110266110267110268110269110270110271110272110273110274110275110276110277110278110279110280110281110282110283110284110285110286110287110288110289110290110291110292110293110294110295110296110297110298110299110300110301110302110303110304110305110306110307110308110309110310110311110312110313110314110315110316110317110318110319110320110321110322110323110324110325110326110327110328110329110330110331110332110333110334110335110336110337110338110339110340110341110342110343110344110345110346110347110348110349110350110351110352110353110354110355110356110357110358110359110360110361110362110363110364110365110366110367110368110369110370110371110372110373110374110375110376110377110378110379110380110381110382110383110384110385110386110387110388110389110390110391110392110393110394110395110396110397110398110399110400110401110402110403110404110405110406110407110408110409110410110411110412110413110414110415110416110417110418110419110420110421110422110423110424110425110426110427110428110429110430110431110432110433110434110435110436110437110438110439110440110441110442110443110444110445110446110447110448110449110450110451110452110453110454110455110456110457110458110459110460110461110462110463110464110465110466110467110468110469110470110471110472110473110474110475110476110477110478110479110480110481110482110483110484110485110486110487110488110489110490110491110492110493110494110495110496110497110498110499110500110501110502110503110504110505110506110507110508110509110510110511110512110513110514110515110516110517110518110519110520110521110522110523110524110525110526110527110528110529110530110531110532110533110534110535110536110537110538110539110540110541110542110543110544110545110546110547110548110549110550110551110552110553110554110555110556110557110558110559110560110561110562110563110564110565110566110567110568110569110570110571110572110573110574110575110576110577110578110579110580110581110582110583110584110585110586110587110588110589110590110591110592110593110594110595110596110597110598110599110600110601110602110603110604110605110606110607110608110609110610110611110612110613110614110615110616110617110618110619110620110621110622110623110624110625110626110627110628110629110630110631110632110633110634110635110636110637110638110639110640110641110642110643110644110645110646110647110648110649110650110651110652110653110654110655110656110657110658110659110660110661110662110663110664110665110666110667110668110669110670110671110672110673110674110675110676110677110678110679110680110681110682110683110684110685110686110687110688110689110690110691110692110693110694110695110696110697110698110699110700110701110702110703110704110705110706110707110708110709110710110711110712110713110714110715110716110717110718110719110720110721110722110723110724110725110726110727110728110729110730110731110732110733110734110735110736110737110738110739110740110741110742110743110744110745110746110747110748110749110750110751110752110753110754110755110756110757110758110759110760110761110762110763110764110765110766110767110768110769110770110771110772110773110774110775110776110777110778110779110780110781110782110783110784110785110786110787110788110789110790110791110792110793110794110795110796110797110798110799110800110801110802110803110804110805110806110807110808110809110810110811110812110813110814110815110816110817110818110819110820110821110822110823110824110825110826110827110828110829110830110831110832110833110834110835110836110837110838110839110840110841110842110843110844110845110846110847110848110849110850110851110852110853110854110855110856110857110858110859110860110861110862110863110864110865110866110867110868110869110870110871110872110873110874110875110876110877110878110879110880110881110882110883110884110885110886110887110888110889110890110891110892110893110894110895110896110897110898110899110900110901110902110903110904110905110906110907110908110909110910110911110912110913110914110915110916110917110918110919110920110921110922110923110924110925110926110927110928110929110930110931110932110933110934110935110936110937110938110939110940110941110942110943110944110945110946110947110948110949110950110951110952110953110954110955110956110957110958110959110960110961110962110963110964110965110966110967110968110969110970110971110972110973110974110975110976110977110978110979110980110981110982110983110984110985110986110987110988110989110990110991110992110993110994110995110996110997110998110999111000111001111002111003111004111005111006111007111008111009111010111011111012111013111014111015111016111017111018111019111020111021111022111023111024111025111026111027111028111029111030111031111032111033111034111035111036111037111038111039111040111041111042111043111044111045111046111047111048111049111050111051111052111053111054111055111056111057111058111059111060111061111062111063111064111065111066111067111068111069111070111071111072111073111074111075111076111077111078111079111080111081111082111083111084111085111086111087111088111089111090111091111092111093111094111095111096111097111098111099111100111101111102111103111104111105111106111107111108111109111110111111111112111113111114111115111116111117111118111119111120111121111122111123111124111125111126111127111128111129111130111131111132111133111134111135111136111137111138111139111140111141111142111143111144111145111146111147111148111149111150111151111152111153111154111155111156111157111158111159111160111161111162111163111164111165111166111167111168111169111170111171111172111173111174111175111176111177111178111179111180111181111182111183111184111185111186111187111188111189111190111191111192111193111194111195111196111197111198111199111200111201111202111203111204111205111206111207111208111209111210111211111212111213111214111215111216111217111218111219111220111221111222111223111224111225111226111227111228111229111230111231111232111233111234111235111236111237111238111239111240111241111242111243111244111245111246111247111248111249111250111251111252111253111254111255111256111257111258111259111260111261111262111263111264111265111266111267111268111269111270111271111272111273111274111275111276111277111278111279111280111281111282111283111284111285111286111287111288111289111290111291111292111293111294111295111296111297111298111299111300111301111302111303111304111305111306111307111308111309111310111311111312111313111314111315111316111317111318111319111320111321111322111323111324111325111326111327111328111329111330111331111332111333111334111335111336111337111338111339111340111341111342111343111344111345111346111347111348111349111350111351111352111353111354111355111356111357111358111359111360111361111362111363111364111365111366111367111368111369111370111371111372111373111374111375111376111377111378111379111380111381111382111383111384111385111386111387111388111389111390111391111392111393111394111395111396111397111398111399111400111401111402111403111404111405111406111407111408111409111410111411111412111413111414111415111416111417111418111419111420111421111422111423111424111425111426111427111428111429111430111431111432111433111434111435111436111437111438111439111440111441111442111443111444111445111446111447111448111449111450111451111452111453111454111455111456111457111458111459111460111461111462111463111464111465111466111467111468111469111470111471111472111473111474111475111476111477111478111479111480111481111482111483111484111485111486111487111488111489111490111491111492111493111494111495111496111497111498111499111500111501111502111503111504111505111506111507111508111509111510111511111512111513111514111515111516111517111518111519111520111521111522111523111524111525111526111527111528111529111530111531111532111533111534111535111536111537111538111539111540111541111542111543111544111545111546111547111548111549111550111551111552111553111554111555111556111557111558111559111560111561111562111563111564111565111566111567111568111569111570111571111572111573111574111575111576111577111578111579111580111581111582111583111584111585111586111587111588111589111590111591111592111593111594111595111596111597111598111599111600111601111602111603111604111605111606111607111608111609111610111611111612111613111614111615111616111617111618111619111620111621111622111623111624111625111626111627111628111629111630111631111632111633111634111635111636111637111638111639111640111641111642111643111644111645111646111647111648111649111650111651111652111653111654111655111656111657111658111659111660111661111662111663111664111665111666111667111668111669111670111671111672111673111674111675111676111677111678111679111680111681111682111683111684111685111686111687111688111689111690111691111692111693111694111695111696111697111698111699111700111701111702111703111704111705111706111707111708111709111710111711111712111713111714111715111716111717111718111719111720111721111722111723111724111725111726111727111728111729111730111731111732111733111734111735111736111737111738111739111740111741111742111743111744111745111746111747111748111749111750111751111752111753111754111755111756111757111758111759111760111761111762111763111764111765111766111767111768111769111770111771111772111773111774111775111776111777111778111779111780111781111782111783111784111785111786111787111788111789111790111791111792111793111794111795111796111797111798111799111800111801111802111803111804111805111806111807111808111809111810111811111812111813111814111815111816111817111818111819111820111821111822111823111824111825111826111827111828111829111830111831111832111833111834111835111836111837111838111839111840111841111842111843111844111845111846111847111848111849111850111851111852111853111854111855111856111857111858111859111860111861111862111863111864111865111866111867111868111869111870111871111872111873111874111875111876111877111878111879111880111881111882111883111884111885111886111887111888111889111890111891111892111893111894111895111896111897111898111899111900111901111902111903111904111905111906111907111908111909111910111911111912111913111914111915111916111917111918111919111920111921111922111923111924111925111926111927111928111929111930111931111932111933111934111935111936111937111938111939111940111941111942111943111944111945111946111947111948111949111950111951111952111953111954111955111956111957111958111959111960111961111962111963111964111965111966111967111968111969111970111971111972111973111974111975111976111977111978111979111980111981111982111983111984111985111986111987111988111989111990111991111992111993111994111995111996111997111998111999112000112001112002112003112004112005112006112007112008112009112010112011112012112013112014112015112016112017112018112019112020112021112022112023112024112025112026112027112028112029112030112031112032112033112034112035112036112037112038112039112040112041112042112043112044112045112046112047112048112049112050112051112052112053112054112055112056112057112058112059112060112061112062112063112064112065112066112067112068112069112070112071112072112073112074112075112076112077112078112079112080112081112082112083112084112085112086112087112088112089112090112091112092112093112094112095112096112097112098112099112100112101112102112103112104112105112106112107112108112109112110112111112112112113112114112115112116112117112118112119112120112121112122112123112124112125112126112127112128112129112130112131112132112133112134112135112136112137112138112139112140112141112142112143112144112145112146112147112148112149112150112151112152112153112154112155112156112157112158112159112160112161112162112163112164112165112166112167112168112169112170112171112172112173112174112175112176112177112178112179112180112181112182112183112184112185112186112187112188112189112190112191112192112193112194112195112196112197112198112199112200112201112202112203112204112205112206112207112208112209112210112211112212112213112214112215112216112217112218112219112220112221112222112223112224112225112226112227112228112229112230112231112232112233112234112235112236112237112238112239112240112241112242112243112244112245112246112247112248112249112250112251112252112253112254112255112256112257112258112259112260112261112262112263112264112265112266112267112268112269112270112271112272112273112274112275112276112277112278112279112280112281112282112283112284112285112286112287112288112289112290112291112292112293112294112295112296112297112298112299112300112301112302112303112304112305112306112307112308112309112310112311112312112313112314112315112316112317112318112319112320112321112322112323112324112325112326112327112328112329112330112331112332112333112334112335112336112337112338112339112340112341112342112343112344112345112346112347112348112349112350112351112352112353112354112355112356112357112358112359112360112361112362112363112364112365112366112367112368112369112370112371112372112373112374112375112376112377112378112379112380112381112382112383112384112385112386112387112388112389112390112391112392112393112394112395112396112397112398112399112400112401112402112403112404112405112406112407112408112409112410112411112412112413112414112415112416112417112418112419112420112421112422112423112424112425112426112427112428112429112430112431112432112433112434112435112436112437112438112439112440112441112442112443112444112445112446112447112448112449112450112451112452112453112454112455112456112457112458112459112460112461112462112463112464112465112466112467112468112469112470112471112472112473112474112475112476112477112478112479112480112481112482112483112484112485112486112487112488112489112490112491112492112493112494112495112496112497112498112499112500112501112502112503112504112505112506112507112508112509112510112511112512112513112514112515112516112517112518112519112520112521112522112523112524112525112526112527112528112529112530112531112532112533112534112535112536112537112538112539112540112541112542112543112544112545112546112547112548112549112550112551112552112553112554112555112556112557112558112559112560112561112562112563112564112565112566112567112568112569112570112571112572112573112574112575112576112577112578112579112580112581112582112583112584112585112586112587112588112589112590112591112592112593112594112595112596112597112598112599112600112601112602112603112604112605112606112607112608112609112610112611112612112613112614112615112616112617112618112619112620112621112622112623112624112625112626112627112628112629112630112631112632112633112634112635112636112637112638112639112640112641112642112643112644112645112646112647112648112649112650112651112652112653112654112655112656112657112658112659112660112661112662112663112664112665112666112667112668112669112670112671112672112673112674112675112676112677112678112679112680112681112682112683112684112685112686112687112688112689112690112691112692112693112694112695112696112697112698112699112700112701112702112703112704112705112706112707112708112709112710112711112712112713112714112715112716112717112718112719112720112721112722112723112724112725112726112727112728112729112730112731112732112733112734112735112736112737112738112739112740112741112742112743112744112745112746112747112748112749112750112751112752112753112754112755112756112757112758112759112760112761112762112763112764112765112766112767112768112769112770112771112772112773112774112775112776112777112778112779112780112781112782112783112784112785112786112787112788112789112790112791112792112793112794112795112796112797112798112799112800112801112802112803112804112805112806112807112808112809112810112811112812112813112814112815112816112817112818112819112820112821112822112823112824112825112826112827112828112829112830112831112832112833112834112835112836112837112838112839112840112841112842112843112844112845112846112847112848112849112850112851112852112853112854112855112856112857112858112859112860112861112862112863112864112865112866112867112868112869112870112871112872112873112874112875112876112877112878112879112880112881112882112883112884112885112886112887112888112889112890112891112892112893112894112895112896112897112898112899112900112901112902112903112904112905112906112907112908112909112910112911112912112913112914112915112916112917112918112919112920112921112922112923112924112925112926112927112928112929112930112931112932112933112934112935112936112937112938112939112940112941112942112943112944112945112946112947112948112949112950112951112952112953112954112955112956112957112958112959112960112961112962112963112964112965112966112967112968112969112970112971112972112973112974112975112976112977112978112979112980112981112982112983112984112985112986112987112988112989112990112991112992112993112994112995112996112997112998112999113000113001113002113003113004113005113006113007113008113009113010113011113012113013113014113015113016113017113018113019113020113021113022113023113024113025113026113027113028113029113030113031113032113033113034113035113036113037113038113039113040113041113042113043113044113045113046113047113048113049113050113051113052113053113054113055113056113057113058113059113060113061113062113063113064113065113066113067113068113069113070113071113072113073113074113075113076113077113078113079113080113081113082113083113084113085113086113087113088113089113090113091113092113093113094113095113096113097113098113099113100113101113102113103113104113105113106113107113108113109113110113111113112113113113114113115113116113117113118113119113120113121113122113123113124113125113126113127113128113129113130113131113132113133113134113135113136113137113138113139113140113141113142113143113144113145113146113147113148113149113150113151113152113153113154113155113156113157113158113159113160113161113162113163113164113165113166113167113168113169113170113171113172113173113174113175113176113177113178113179113180113181113182113183113184113185113186113187113188113189113190113191113192113193113194113195113196113197113198113199113200113201113202113203113204113205113206113207113208113209113210113211113212113213113214113215113216113217113218113219113220113221113222113223113224113225113226113227113228113229113230113231113232113233113234113235113236113237113238113239113240113241113242113243113244113245113246113247113248113249113250113251113252113253113254113255113256113257113258113259113260113261113262113263113264113265113266113267113268113269113270113271113272113273113274113275113276113277113278113279113280113281113282113283113284113285113286113287113288113289113290113291113292113293113294113295113296113297113298113299113300113301113302113303113304113305113306113307113308113309113310113311113312113313113314113315113316113317113318113319113320113321113322113323113324113325113326113327113328113329113330113331113332113333113334113335113336113337113338113339113340113341113342113343113344113345113346113347113348113349113350113351113352113353113354113355113356113357113358113359113360113361113362113363113364113365113366113367113368113369113370113371113372113373113374113375113376113377113378113379113380113381113382113383113384113385113386113387113388113389113390113391113392113393113394113395113396113397113398113399113400113401113402113403113404113405113406113407113408113409113410113411113412113413113414113415113416113417113418113419113420113421113422113423113424113425113426113427113428113429113430113431113432113433113434113435113436113437113438113439113440113441113442113443113444113445113446113447113448113449113450113451113452113453113454113455113456113457113458113459113460113461113462113463113464113465113466113467113468113469113470113471113472113473113474113475113476113477113478113479113480113481113482113483113484113485113486113487113488113489113490113491113492113493113494113495113496113497113498113499113500113501113502113503113504113505113506113507113508113509113510113511113512113513113514113515113516113517113518113519113520113521113522113523113524113525113526113527113528113529113530113531113532113533113534113535113536113537113538113539113540113541113542113543113544113545113546113547113548113549113550113551113552113553113554113555113556113557113558113559113560113561113562113563113564113565113566113567113568113569113570113571113572113573113574113575113576113577113578113579113580113581113582113583113584113585113586113587113588113589113590113591113592113593113594113595113596113597113598113599113600113601113602113603113604113605113606113607113608113609113610113611113612113613113614113615113616113617113618113619113620113621113622113623113624113625113626113627113628113629113630113631113632113633113634113635113636113637113638113639113640113641113642113643113644113645113646113647113648113649113650113651113652113653113654113655113656113657113658113659113660113661113662113663113664113665113666113667113668113669113670113671113672113673113674113675113676113677113678113679113680113681113682113683113684113685113686113687113688113689113690113691113692113693113694113695113696113697113698113699113700113701113702113703113704113705113706113707113708113709113710113711113712113713113714113715113716113717113718113719113720113721113722113723113724113725113726113727113728113729113730113731113732113733113734113735113736113737113738113739113740113741113742113743113744113745113746113747113748113749113750113751113752113753113754113755113756113757113758113759113760113761113762113763113764113765113766113767113768113769113770113771113772113773113774113775113776113777113778113779113780113781113782113783113784113785113786113787113788113789113790113791113792113793113794113795113796113797113798113799113800113801113802113803113804113805113806113807113808113809113810113811113812113813113814113815113816113817113818113819113820113821113822113823113824113825113826113827113828113829113830113831113832113833113834113835113836113837113838113839113840113841113842113843113844113845113846113847113848113849113850113851113852113853113854113855113856113857113858113859113860113861113862113863113864113865113866113867113868113869113870113871113872113873113874113875113876113877113878113879113880113881113882113883113884113885113886113887113888113889113890113891113892113893113894113895113896113897113898113899113900113901113902113903113904113905113906113907113908113909113910113911113912113913113914113915113916113917113918113919113920113921113922113923113924113925113926113927113928113929113930113931113932113933113934113935113936113937113938113939113940113941113942113943113944113945113946113947113948113949113950113951113952113953113954113955113956113957113958113959113960113961113962113963113964113965113966113967113968113969113970113971113972113973113974113975113976113977113978113979113980113981113982113983113984113985113986113987113988113989113990113991113992113993113994113995113996113997113998113999114000114001114002114003114004114005114006114007114008114009114010114011114012114013114014114015114016114017114018114019114020114021114022114023114024114025114026114027114028114029114030114031114032114033114034114035114036114037114038114039114040114041114042114043114044114045114046114047114048114049114050114051114052114053114054114055114056114057114058114059114060114061114062114063114064114065114066114067114068114069114070114071114072114073114074114075114076114077114078114079114080114081114082114083114084114085114086114087114088114089114090114091114092114093114094114095114096114097114098114099114100114101114102114103114104114105114106114107114108114109114110114111114112114113114114114115114116114117114118114119114120114121114122114123114124114125114126114127114128114129114130114131114132114133114134114135114136114137114138114139114140114141114142114143114144114145114146114147114148114149114150114151114152114153114154114155114156114157114158114159114160114161114162114163114164114165114166114167114168114169114170114171114172114173114174114175114176114177114178114179114180114181114182114183114184114185114186114187114188114189114190114191114192114193114194114195114196114197114198114199114200114201114202114203114204114205114206114207114208114209114210114211114212114213114214114215114216114217114218114219114220114221114222114223114224114225114226114227114228114229114230114231114232114233114234114235114236114237114238114239114240114241114242114243114244114245114246114247114248114249114250114251114252114253114254114255114256114257114258114259114260114261114262114263114264114265114266114267114268114269114270114271114272114273114274114275114276114277114278114279114280114281114282114283114284114285114286114287114288114289114290114291114292114293114294114295114296114297114298114299114300114301114302114303114304114305114306114307114308114309114310114311114312114313114314114315114316114317114318114319114320114321114322114323114324114325114326114327114328114329114330114331114332114333114334114335114336114337114338114339114340114341114342114343114344114345114346114347114348114349114350114351114352114353114354114355114356114357114358114359114360114361114362114363114364114365114366114367114368114369114370114371114372114373114374114375114376114377114378114379114380114381114382114383114384114385114386114387114388114389114390114391114392114393114394114395114396114397114398114399114400114401114402114403114404114405114406114407114408114409114410114411114412114413114414114415114416114417114418114419114420114421114422114423114424114425114426114427114428114429114430114431114432114433114434114435114436114437114438114439114440114441114442114443114444114445114446114447114448114449114450114451114452114453114454114455114456114457114458114459114460114461114462114463114464114465114466114467114468114469114470114471114472114473114474114475114476114477114478114479114480114481114482114483114484114485114486114487114488114489114490114491114492114493114494114495114496114497114498114499114500114501114502114503114504114505114506114507114508114509114510114511114512114513114514114515114516114517114518114519114520114521114522114523114524114525114526114527114528114529114530114531114532114533114534114535114536114537114538114539114540114541114542114543114544114545114546114547114548114549114550114551114552114553114554114555114556114557114558114559114560114561114562114563114564114565114566114567114568114569114570114571114572114573114574114575114576114577114578114579114580114581114582114583114584114585114586114587114588114589114590114591114592114593114594114595114596114597114598114599114600114601114602114603114604114605114606114607114608114609114610114611114612114613114614114615114616114617114618114619114620114621114622114623114624114625114626114627114628114629114630114631114632114633114634114635114636114637114638114639114640114641114642114643114644114645114646114647114648114649114650114651114652114653114654114655114656114657114658114659114660114661114662114663114664114665114666114667114668114669114670114671114672114673114674114675114676114677114678114679114680114681114682114683114684114685114686114687114688114689114690114691114692114693114694114695114696114697114698114699114700114701114702114703114704114705114706114707114708114709114710114711114712114713114714114715114716114717114718114719114720114721114722114723114724114725114726114727114728114729114730114731114732114733114734114735114736114737114738114739114740114741114742114743114744114745114746114747114748114749114750114751114752114753114754114755114756114757114758114759114760114761114762114763114764114765114766114767114768114769114770114771114772114773114774114775114776114777114778114779114780114781114782114783114784114785114786114787114788114789114790114791114792114793114794114795114796114797114798114799114800114801114802114803114804114805114806114807114808114809114810114811114812114813114814114815114816114817114818114819114820114821114822114823114824114825114826114827114828114829114830114831114832114833114834114835114836114837114838114839114840114841114842114843114844114845114846114847114848114849114850114851114852114853114854114855114856114857114858114859114860114861114862114863114864114865114866114867114868114869114870114871114872114873114874114875114876114877114878114879114880114881114882114883114884114885114886114887114888114889114890114891114892114893114894114895114896114897114898114899114900114901114902114903114904114905114906114907114908114909114910114911114912114913114914114915114916114917114918114919114920114921114922114923114924114925114926114927114928114929114930114931114932114933114934114935114936114937114938114939114940114941114942114943114944114945114946114947114948114949114950114951114952114953114954114955114956114957114958114959114960114961114962114963114964114965114966114967114968114969114970114971114972114973114974114975114976114977114978114979114980114981114982114983114984114985114986114987114988114989114990114991114992114993114994114995114996114997114998114999115000115001115002115003115004115005115006115007115008115009115010115011115012115013115014115015115016115017115018115019115020115021115022115023115024115025115026115027115028115029115030115031115032115033115034115035115036115037115038115039115040115041115042115043115044115045115046115047115048115049115050115051115052115053115054115055115056115057115058115059115060115061115062115063115064115065115066115067115068115069115070115071115072115073115074115075115076115077115078115079115080115081115082115083115084115085115086115087115088115089115090115091115092115093115094115095115096115097115098115099115100115101115102115103115104115105115106115107115108115109115110115111115112115113115114115115115116115117115118115119115120115121115122115123115124115125115126115127115128115129115130115131115132115133115134115135115136115137115138115139115140115141115142115143115144115145115146115147115148115149115150115151115152115153115154115155115156115157115158115159115160115161115162115163115164115165115166115167115168115169115170115171115172115173115174115175115176115177115178115179115180115181115182115183115184115185115186115187115188115189115190115191115192115193115194115195115196115197115198115199115200115201115202115203115204115205115206115207115208115209115210115211115212115213115214115215115216115217115218115219115220115221115222115223115224115225115226115227115228115229115230115231115232115233115234115235115236115237115238115239115240115241115242115243115244115245115246115247115248115249115250115251115252115253115254115255115256115257115258115259115260115261115262115263115264115265115266115267115268115269115270115271115272115273115274115275115276115277115278115279115280115281115282115283115284115285115286115287115288115289115290115291115292115293115294115295115296115297115298115299115300115301115302115303115304115305115306115307115308115309115310115311115312115313115314115315115316115317115318115319115320115321115322115323115324115325115326115327115328115329115330115331115332115333115334115335115336115337115338115339115340115341115342115343115344115345115346115347115348115349115350115351115352115353115354115355115356115357115358115359115360115361115362115363115364115365115366115367115368115369115370115371115372115373115374115375115376115377115378115379115380115381115382115383115384115385115386115387115388115389115390115391115392115393115394115395115396115397115398115399115400115401115402115403115404115405115406115407115408115409115410115411115412115413115414115415115416115417115418115419115420115421115422115423115424115425115426115427115428115429115430115431115432115433115434115435115436115437115438115439115440115441115442115443115444115445115446115447115448115449115450115451115452115453115454115455115456115457115458115459115460115461115462115463115464115465115466115467115468115469115470115471115472115473115474115475115476115477115478115479115480115481115482115483115484115485115486115487115488115489115490115491115492115493115494115495115496115497115498115499115500115501115502115503115504115505115506115507115508115509115510115511115512115513115514115515115516115517115518115519115520115521115522115523115524115525115526115527115528115529115530115531115532115533115534115535115536115537115538115539115540115541115542115543115544115545115546115547115548115549115550115551115552115553115554115555115556115557115558115559115560115561115562115563115564115565115566115567115568115569115570115571115572115573115574115575115576115577115578115579115580115581115582115583115584115585115586115587115588115589115590115591115592115593115594115595115596115597115598115599115600115601115602115603115604115605115606115607115608115609115610115611115612115613115614115615115616115617115618115619115620115621115622115623115624115625115626115627115628115629115630115631115632115633115634115635115636115637115638115639115640115641115642115643115644115645115646115647115648115649115650115651115652115653115654115655115656115657115658115659115660115661115662115663115664115665115666115667115668115669115670115671115672115673115674115675115676115677115678115679115680115681115682115683115684115685115686115687115688115689115690115691115692115693115694115695115696115697115698115699115700115701115702115703115704115705115706115707115708115709115710115711115712115713115714115715115716115717115718115719115720115721115722115723115724115725115726115727115728115729115730115731115732115733115734115735115736115737115738115739115740115741115742115743115744115745115746115747115748115749115750115751115752115753115754115755115756115757115758115759115760115761115762115763115764115765115766115767115768115769115770115771115772115773115774115775115776115777115778115779115780115781115782115783115784115785115786115787115788115789115790115791115792115793115794115795115796115797115798115799115800115801115802115803115804115805115806115807115808115809115810115811115812115813115814115815115816115817115818115819115820115821115822115823115824115825115826115827115828115829115830115831115832115833115834115835115836115837115838115839115840115841115842115843115844115845115846115847115848115849115850115851115852115853115854115855115856115857115858115859115860115861115862115863115864115865115866115867115868115869115870115871115872115873115874115875115876115877115878115879115880115881115882115883115884115885115886115887115888115889115890115891115892115893115894115895115896115897115898115899115900115901115902115903115904115905115906115907115908115909115910115911115912115913115914115915115916115917115918115919115920115921115922115923115924115925115926115927115928115929115930115931115932115933115934115935115936115937115938115939115940115941115942115943115944115945115946115947115948115949115950115951115952115953115954115955115956115957115958115959115960115961115962115963115964115965115966115967115968115969115970115971115972115973115974115975115976115977115978115979115980115981115982115983115984115985115986115987115988115989115990115991115992115993115994115995115996115997115998115999116000116001116002116003116004116005116006116007116008116009116010116011116012116013116014116015116016116017116018116019116020116021116022116023116024116025116026116027116028116029116030116031116032116033116034116035116036116037116038116039116040116041116042116043116044116045116046116047116048116049116050116051116052116053116054116055116056116057116058116059116060116061116062116063116064116065116066116067116068116069116070116071116072116073116074116075116076116077116078116079116080116081116082116083116084116085116086116087116088116089116090116091116092116093116094116095116096116097116098116099116100116101116102116103116104116105116106116107116108116109116110116111116112116113116114116115116116116117116118116119116120116121116122116123116124116125116126116127116128116129116130116131116132116133116134116135116136116137116138116139116140116141116142116143116144116145116146116147116148116149116150116151116152116153116154116155116156116157116158116159116160116161116162116163116164116165116166116167116168116169116170116171116172116173116174116175116176116177116178116179116180116181116182116183116184116185116186116187116188116189116190116191116192116193116194116195116196116197116198116199116200116201116202116203116204116205116206116207116208116209116210116211116212116213116214116215116216116217116218116219116220116221116222116223116224116225116226116227116228116229116230116231116232116233116234116235116236116237116238116239116240116241116242116243116244116245116246116247116248116249116250116251116252116253116254116255116256116257116258116259116260116261116262116263116264116265116266116267116268116269116270116271116272116273116274116275116276116277116278116279116280116281116282116283116284116285116286116287116288116289116290116291116292116293116294116295116296116297116298116299116300116301116302116303116304116305116306116307116308116309116310116311116312116313116314116315116316116317116318116319116320116321116322116323116324116325116326116327116328116329116330116331116332116333116334116335116336116337116338116339116340116341116342116343116344116345116346116347116348116349116350116351116352116353116354116355116356116357116358116359116360116361116362116363116364116365116366116367116368116369116370116371116372116373116374116375116376116377116378116379116380116381116382116383116384116385116386116387116388116389116390116391116392116393116394116395116396116397116398116399116400116401116402116403116404116405116406116407116408116409116410116411116412116413116414116415116416116417116418116419116420116421116422116423116424116425116426116427116428116429116430116431116432116433116434116435116436116437116438116439116440116441116442116443116444116445116446116447116448116449116450116451116452116453116454116455116456116457116458116459116460116461116462116463116464116465116466116467116468116469116470116471116472116473116474116475116476116477116478116479116480116481116482116483116484116485116486116487116488116489116490116491116492116493116494116495116496116497116498116499116500116501116502116503116504116505116506116507116508116509116510116511116512116513116514116515116516116517116518116519116520116521116522116523116524116525116526116527116528116529116530116531116532116533116534116535116536116537116538116539116540116541116542116543116544116545116546116547116548116549116550116551116552116553116554116555116556116557116558116559116560116561116562116563116564116565116566116567116568116569116570116571116572116573116574116575116576116577116578116579116580116581116582116583116584116585116586116587116588116589116590116591116592116593116594116595116596116597116598116599116600116601116602116603116604116605116606116607116608116609116610116611116612116613116614116615116616116617116618116619116620116621116622116623116624116625116626116627116628116629116630116631116632116633116634116635116636116637116638116639116640116641116642116643116644116645116646116647116648116649116650116651116652116653116654116655116656116657116658116659116660116661116662116663116664116665116666116667116668116669116670116671116672116673116674116675116676116677116678116679116680116681116682116683116684116685116686116687116688116689116690116691116692116693116694116695116696116697116698116699116700116701116702116703116704116705116706116707116708116709116710116711116712116713116714116715116716116717116718116719116720116721116722116723116724116725116726116727116728116729116730116731116732116733116734116735116736116737116738116739116740116741116742116743116744116745116746116747116748116749116750116751116752116753116754116755116756116757116758116759116760116761116762116763116764116765116766116767116768116769116770116771116772116773116774116775116776116777116778116779116780116781116782116783116784116785116786116787116788116789116790116791116792116793116794116795116796116797116798116799116800116801116802116803116804116805116806116807116808116809116810116811116812116813116814116815116816116817116818116819116820116821116822116823116824116825116826116827116828116829116830116831116832116833116834116835116836116837116838116839116840116841116842116843116844116845116846116847116848116849116850116851116852116853116854116855116856116857116858116859116860116861116862116863116864116865116866116867116868116869116870116871116872116873116874116875116876116877116878116879116880116881116882116883116884116885116886116887116888116889116890116891116892116893116894116895116896116897116898116899116900116901116902116903116904116905116906116907116908116909116910116911116912116913116914116915116916116917116918116919116920116921116922116923116924116925116926116927116928116929116930116931116932116933116934116935116936116937116938116939116940116941116942116943116944116945116946116947116948116949116950116951116952116953116954116955116956116957116958116959116960116961116962116963116964116965116966116967116968116969116970116971116972116973116974116975116976116977116978116979116980116981116982116983116984116985116986116987116988116989116990116991116992116993116994116995116996116997116998116999117000117001117002117003117004117005117006117007117008117009117010117011117012117013117014117015117016117017117018117019117020117021117022117023117024117025117026117027117028117029117030117031117032117033117034117035117036117037117038117039117040117041117042117043117044117045117046117047117048117049117050117051117052117053117054117055117056117057117058117059117060117061117062117063117064117065117066117067117068117069117070117071117072117073117074117075117076117077117078117079117080117081117082117083117084117085117086117087117088117089117090117091117092117093117094117095117096117097117098117099117100117101117102117103117104117105117106117107117108117109117110117111117112117113117114117115117116117117117118117119117120117121117122117123117124117125117126117127117128117129117130117131117132117133117134117135117136117137117138117139117140117141117142117143117144117145117146117147117148117149117150117151117152117153117154117155117156117157117158117159117160117161117162117163117164117165117166117167117168117169117170117171117172117173117174117175117176117177117178117179117180117181117182117183117184117185117186117187117188117189117190117191117192117193117194117195117196117197117198117199117200117201117202117203117204117205117206117207117208117209117210117211117212117213117214117215117216117217117218117219117220117221117222117223117224117225117226117227117228117229117230117231117232117233117234117235117236117237117238117239117240117241117242117243117244117245117246117247117248117249117250117251117252117253117254117255117256117257117258117259117260117261117262117263117264117265117266117267117268117269117270117271117272117273117274117275117276117277117278117279117280117281117282117283117284117285117286117287117288117289117290117291117292117293117294117295117296117297117298117299117300117301117302117303117304117305117306117307117308117309117310117311117312117313117314117315117316117317117318117319117320117321117322117323117324117325117326117327117328117329117330117331117332117333117334117335117336117337117338117339117340117341117342117343117344117345117346117347117348117349117350117351117352117353117354117355117356117357117358117359117360117361117362117363117364117365117366117367117368117369117370117371117372117373117374117375117376117377117378117379117380117381117382117383117384117385117386117387117388117389117390117391117392117393117394117395117396117397117398117399117400117401117402117403117404117405117406117407117408117409117410117411117412117413117414117415117416117417117418117419117420117421117422117423117424117425117426117427117428117429117430117431117432117433117434117435117436117437117438117439117440117441117442117443117444117445117446117447117448117449117450117451117452117453117454117455117456117457117458117459117460117461117462117463117464117465117466117467117468117469117470117471117472117473117474117475117476117477117478117479117480117481117482117483117484117485117486117487117488117489117490117491117492117493117494117495117496117497117498117499117500117501117502117503117504117505117506117507117508117509117510117511117512117513117514117515117516117517117518117519117520117521117522117523117524117525117526117527117528117529117530117531117532117533117534117535117536117537117538117539117540117541117542117543117544117545117546117547117548117549117550117551117552117553117554117555117556117557117558117559117560117561117562117563117564117565117566117567117568117569117570117571117572117573117574117575117576117577117578117579117580117581117582117583117584117585117586117587117588117589117590117591117592117593117594117595117596117597117598117599117600117601117602117603117604117605117606117607117608117609117610117611117612117613117614117615117616117617117618117619117620117621117622117623117624117625117626117627117628117629117630117631117632117633117634117635117636117637117638117639117640117641117642117643117644117645117646117647117648117649117650117651117652117653117654117655117656117657117658117659117660117661117662117663117664117665117666117667117668117669117670117671117672117673117674117675117676117677117678117679117680117681117682117683117684117685117686117687117688117689117690117691117692117693117694117695117696117697117698117699117700117701117702117703117704117705117706117707117708117709117710117711117712117713117714117715117716117717117718117719117720117721117722117723117724117725117726117727117728117729117730117731117732117733117734117735117736117737117738117739117740117741117742117743117744117745117746117747117748117749117750117751117752117753117754117755117756117757117758117759117760117761117762117763117764117765117766117767117768117769117770117771117772117773117774117775117776117777117778117779117780117781117782117783117784117785117786117787117788117789117790117791117792117793117794117795117796117797117798117799117800117801117802117803117804117805117806117807117808117809117810117811117812117813117814117815117816117817117818117819117820117821117822117823117824117825117826117827117828117829117830117831117832117833117834117835117836117837117838117839117840117841117842117843117844117845117846117847117848117849117850117851117852117853117854117855117856117857117858117859117860117861117862117863117864117865117866117867117868117869117870117871117872117873117874117875117876117877117878117879117880117881117882117883117884117885117886117887117888117889117890117891117892117893117894117895117896117897117898117899117900117901117902117903117904117905117906117907117908117909117910117911117912117913117914117915117916117917117918117919117920117921117922117923117924117925117926117927117928117929117930117931117932117933117934117935117936117937117938117939117940117941117942117943117944117945117946117947117948117949117950117951117952117953117954117955117956117957117958117959117960117961117962117963117964117965117966117967117968117969117970117971117972117973117974117975117976117977117978117979117980117981117982117983117984117985117986117987117988117989117990117991117992117993117994117995117996117997117998117999118000118001118002118003118004118005118006118007118008118009118010118011118012118013118014118015118016118017118018118019118020118021118022118023118024118025118026118027118028118029118030118031118032118033118034118035118036118037118038118039118040118041118042118043118044118045118046118047118048118049118050118051118052118053118054118055118056118057118058118059118060118061118062118063118064118065118066118067118068118069118070118071118072118073118074118075118076118077118078118079118080118081118082118083118084118085118086118087118088118089118090118091118092118093118094118095118096118097118098118099118100118101118102118103118104118105118106118107118108118109118110118111118112118113118114118115118116118117118118118119118120118121118122118123118124118125118126118127118128118129118130118131118132118133118134118135118136118137118138118139118140118141118142118143118144118145118146118147118148118149118150118151118152118153118154118155118156118157118158118159118160118161118162118163118164118165118166118167118168118169118170118171118172118173118174118175118176118177118178118179118180118181118182118183118184118185118186118187118188118189118190118191118192118193118194118195118196118197118198118199118200118201118202118203118204118205118206118207118208118209118210118211118212118213118214118215118216118217118218118219118220118221118222118223118224118225118226118227118228118229118230118231118232118233118234118235118236118237118238118239118240118241118242118243118244118245118246118247118248118249118250118251118252118253118254118255118256118257118258118259118260118261118262118263118264118265118266118267118268118269118270118271118272118273118274118275118276118277118278118279118280118281118282118283118284118285118286118287118288118289118290118291118292118293118294118295118296118297118298118299118300118301118302118303118304118305118306118307118308118309118310118311118312118313118314118315118316118317118318118319118320118321118322118323118324118325118326118327118328118329118330118331118332118333118334118335118336118337118338118339118340118341118342118343118344118345118346118347118348118349118350118351118352118353118354118355118356118357118358118359118360118361118362118363118364118365118366118367118368118369118370118371118372118373118374118375118376118377118378118379118380118381118382118383118384118385118386118387118388118389118390118391118392118393118394118395118396118397118398118399118400118401118402118403118404118405118406118407118408118409118410118411118412118413118414118415118416118417118418118419118420118421118422118423118424118425118426118427118428118429118430118431118432118433118434118435118436118437118438118439118440118441118442118443118444118445118446118447118448118449118450118451118452118453118454118455118456118457118458118459118460118461118462118463118464118465118466118467118468118469118470118471118472118473118474118475118476118477118478118479118480118481118482118483118484118485118486118487118488118489118490118491118492118493118494118495118496118497118498118499118500118501118502118503118504118505118506118507118508118509118510118511118512118513118514118515118516118517118518118519118520118521118522118523118524118525118526118527118528118529118530118531118532118533118534118535118536118537118538118539118540118541118542118543118544118545118546118547118548118549118550118551118552118553118554118555118556118557118558118559118560118561118562118563118564118565118566118567118568118569118570118571118572118573118574118575118576118577118578118579118580118581118582118583118584118585118586118587118588118589118590118591118592118593118594118595118596118597118598118599118600118601118602118603118604118605118606118607118608118609118610118611118612118613118614118615118616118617118618118619118620118621118622118623118624118625118626118627118628118629118630118631118632118633118634118635118636118637118638118639118640118641118642118643118644118645118646118647118648118649118650118651118652118653118654118655118656118657118658118659118660118661118662118663118664118665118666118667118668118669118670118671118672118673118674118675118676118677118678118679118680118681118682118683118684118685118686118687118688118689118690118691118692118693118694118695118696118697118698118699118700118701118702118703118704118705118706118707118708118709118710118711118712118713118714118715118716118717118718118719118720118721118722118723118724118725118726118727118728118729118730118731118732118733118734118735118736118737118738118739118740118741118742118743118744118745118746118747118748118749118750118751118752118753118754118755118756118757118758118759118760118761118762118763118764118765118766118767118768118769118770118771118772118773118774118775118776118777118778118779118780118781118782118783118784118785118786118787118788118789118790118791118792118793118794118795118796118797118798118799118800118801118802118803118804118805118806118807118808118809118810118811118812118813118814118815118816118817118818118819118820118821118822118823118824118825118826118827118828118829118830118831118832118833118834118835118836118837118838118839118840118841118842118843118844118845118846118847118848118849118850118851118852118853118854118855118856118857118858118859118860118861118862118863118864118865118866118867118868118869118870118871118872118873118874118875118876118877118878118879118880118881118882118883118884118885118886118887118888118889118890118891118892118893118894118895118896118897118898118899118900118901118902118903118904118905118906118907118908118909118910118911118912118913118914118915118916118917118918118919118920118921118922118923118924118925118926118927118928118929118930118931118932118933118934118935118936118937118938118939118940118941118942118943118944118945118946118947118948118949118950118951118952118953118954118955118956118957118958118959118960118961118962118963118964118965118966118967118968118969118970118971118972118973118974118975118976118977118978118979118980118981118982118983118984118985118986118987118988118989118990118991118992118993118994118995118996118997118998118999119000119001119002119003119004119005119006119007119008119009119010119011119012119013119014119015119016119017119018119019119020119021119022119023119024119025119026119027119028119029119030119031119032119033119034119035119036119037119038119039119040119041119042119043119044119045119046119047119048119049119050119051119052119053119054119055119056119057119058119059119060119061119062119063119064119065119066119067119068119069119070119071119072119073119074119075119076119077119078119079119080119081119082119083119084119085119086119087119088119089119090119091119092119093119094119095119096119097119098119099119100119101119102119103119104119105119106119107119108119109119110119111119112119113119114119115119116119117119118119119119120119121119122119123119124119125119126119127119128119129119130119131119132119133119134119135119136119137119138119139119140119141119142119143119144119145119146119147119148119149119150119151119152119153119154119155119156119157119158119159119160119161119162119163119164119165119166119167119168119169119170119171119172119173119174119175119176119177119178119179119180119181119182119183119184119185119186119187119188119189119190119191119192119193119194119195119196119197119198119199119200119201119202119203119204119205119206119207119208119209119210119211119212119213119214119215119216119217119218119219119220119221119222119223119224119225119226119227119228119229119230119231119232119233119234119235119236119237119238119239119240119241119242119243119244119245119246119247119248119249119250119251119252119253119254119255119256119257119258119259119260119261119262119263119264119265119266119267119268119269119270119271119272119273119274119275119276119277119278119279119280119281119282119283119284119285119286119287119288119289119290119291119292119293119294119295119296119297119298119299119300119301119302119303119304119305119306119307119308119309119310119311119312119313119314119315119316119317119318119319119320119321119322119323119324119325119326119327119328119329119330119331119332119333119334119335119336119337119338119339119340119341119342119343119344119345119346119347119348119349119350119351119352119353119354119355119356119357119358119359119360119361119362119363119364119365119366119367119368119369119370119371119372119373119374119375119376119377119378119379119380119381119382119383119384119385119386119387119388119389119390119391119392119393119394119395119396119397119398119399119400119401119402119403119404119405119406119407119408119409119410119411119412119413119414119415119416119417119418119419119420119421119422119423119424119425119426119427119428119429119430119431119432119433119434119435119436119437119438119439119440119441119442119443119444119445119446119447119448119449119450119451119452119453119454119455119456119457119458119459119460119461119462119463119464119465119466119467119468119469119470119471119472119473119474119475119476119477119478119479119480119481119482119483119484119485119486119487119488119489119490119491119492119493119494119495119496119497119498119499119500119501119502119503119504119505119506119507119508119509119510119511119512119513119514119515119516119517119518119519119520119521119522119523119524119525119526119527119528119529119530119531119532119533119534119535119536119537119538119539119540119541119542119543119544119545119546119547119548119549119550119551119552119553119554119555119556119557119558119559119560119561119562119563119564119565119566119567119568119569119570119571119572119573119574119575119576119577119578119579119580119581119582119583119584119585119586119587119588119589119590119591119592119593119594119595119596119597119598119599119600119601119602119603119604119605119606119607119608119609119610119611119612119613119614119615119616119617119618119619119620119621119622119623119624119625119626119627119628119629119630119631119632119633119634119635119636119637119638119639119640119641119642119643119644119645119646119647119648119649119650119651119652119653119654119655119656119657119658119659119660119661119662119663119664119665119666119667119668119669119670119671119672119673119674119675119676119677119678119679119680119681119682119683119684119685119686119687119688119689119690119691119692119693119694119695119696119697119698119699119700119701119702119703119704119705119706119707119708119709119710119711119712119713119714119715119716119717119718119719119720119721119722119723119724119725119726119727119728119729119730119731119732119733119734119735119736119737119738119739119740119741119742119743119744119745119746119747119748119749119750119751119752119753119754119755119756119757119758119759119760119761119762119763119764119765119766119767119768119769119770119771119772119773119774119775119776119777119778119779119780119781119782119783119784119785119786119787119788119789119790119791119792119793119794119795119796119797119798119799119800119801119802119803119804119805119806119807119808119809119810119811119812119813119814119815119816119817119818119819119820119821119822119823119824119825119826119827119828119829119830119831119832119833119834119835119836119837119838119839119840119841119842119843119844119845119846119847119848119849119850119851119852119853119854119855119856119857119858119859119860119861119862119863119864119865119866119867119868119869119870119871119872119873119874119875119876119877119878119879119880119881119882119883119884119885119886119887119888119889119890119891119892119893119894119895119896119897119898119899119900119901119902119903119904119905119906119907119908119909119910119911119912119913119914119915119916119917119918119919119920119921119922119923119924119925119926119927119928119929119930119931119932119933119934119935119936119937119938119939119940119941119942119943119944119945119946119947119948119949119950119951119952119953119954119955119956119957119958119959119960119961119962119963119964119965119966119967119968119969119970119971119972119973119974119975119976119977119978119979119980119981119982119983119984119985119986119987119988119989119990119991119992119993119994119995119996119997119998119999120000120001120002120003120004120005120006120007120008120009120010120011120012120013120014120015120016120017120018120019120020120021120022120023120024120025120026120027120028120029120030120031120032120033120034120035120036120037120038120039120040120041120042120043120044120045120046120047120048120049120050120051120052120053120054120055120056120057120058120059120060120061120062120063120064120065120066120067120068120069120070120071120072120073120074120075120076120077120078120079120080120081120082120083120084120085120086120087120088120089120090120091120092120093120094120095120096120097120098120099120100120101120102120103120104120105120106120107120108120109120110120111120112120113120114120115120116120117120118120119120120120121120122120123120124120125120126120127120128120129120130120131120132120133120134120135120136120137120138120139120140120141120142120143120144120145120146120147120148120149120150120151120152120153120154120155120156120157120158120159120160120161120162120163120164120165120166120167120168120169120170120171120172120173120174120175120176120177120178120179120180120181120182120183120184120185120186120187120188120189120190120191120192120193120194120195120196120197120198120199120200120201120202120203120204120205120206120207120208120209120210120211120212120213120214120215120216120217120218120219120220120221120222120223120224120225120226120227120228120229120230120231120232120233120234120235120236120237120238120239120240120241120242120243120244120245120246120247120248120249120250120251120252120253120254120255120256120257120258120259120260120261120262120263120264120265120266120267120268120269120270120271120272120273120274120275120276120277120278120279120280120281120282120283120284120285120286120287120288120289120290120291120292120293120294120295120296120297120298120299120300120301120302120303120304120305120306120307120308120309120310120311120312120313120314120315120316120317120318120319120320120321120322120323120324120325120326120327120328120329120330120331120332120333120334120335120336120337120338120339120340120341120342120343120344120345120346120347120348120349120350120351120352120353120354120355120356120357120358120359120360120361120362120363120364120365120366120367120368120369120370120371120372120373120374120375120376120377120378120379120380120381120382120383120384120385120386120387120388120389120390120391120392120393120394120395120396120397120398120399120400120401120402120403120404120405120406120407120408120409120410120411120412120413120414120415120416120417120418120419120420120421120422120423120424120425120426120427120428120429120430120431120432120433120434120435120436120437120438120439120440120441120442120443120444120445120446120447120448120449120450120451120452120453120454120455120456120457120458120459120460120461120462120463120464120465120466120467120468120469120470120471120472120473120474120475120476120477120478120479120480120481120482120483120484120485120486120487120488120489120490120491120492120493120494120495120496120497120498120499120500120501120502120503120504120505120506120507120508120509120510120511120512120513120514120515120516120517120518120519120520120521120522120523120524120525120526120527120528120529120530120531120532120533120534120535120536120537120538120539120540120541120542120543120544120545120546120547120548120549120550120551120552120553120554120555120556120557120558120559120560120561120562120563120564120565120566120567120568120569120570120571120572120573120574120575120576120577120578120579120580120581120582120583120584120585120586120587120588120589120590120591120592120593120594120595120596120597120598120599120600120601120602120603120604120605120606120607120608120609120610120611120612120613120614120615120616120617120618120619120620120621120622120623120624120625120626120627120628120629120630120631120632120633120634120635120636120637120638120639120640120641120642120643120644120645120646120647120648120649120650120651120652120653120654120655120656120657120658120659120660120661120662120663120664120665120666120667120668120669120670120671120672120673120674120675120676120677120678120679120680120681120682120683120684120685120686120687120688120689120690120691120692120693120694120695120696120697120698120699120700120701120702120703120704120705120706120707120708120709120710120711120712120713120714120715120716120717120718120719120720120721120722120723120724120725120726120727120728120729120730120731120732120733120734120735120736120737120738120739120740120741120742120743120744120745120746120747120748120749120750120751120752120753120754120755120756120757120758120759120760120761120762120763120764120765120766120767120768120769120770120771120772120773120774120775120776120777120778120779120780120781120782120783120784120785120786120787120788120789120790120791120792120793120794120795120796120797120798120799120800120801120802120803120804120805120806120807120808120809120810120811120812120813120814120815120816120817120818120819120820120821120822120823120824120825120826120827120828120829120830120831120832120833120834120835120836120837120838120839120840120841120842120843120844120845120846120847120848120849120850120851120852120853120854120855120856120857120858120859120860120861120862120863120864120865120866120867120868120869120870120871120872120873120874120875120876120877120878120879120880120881120882120883120884120885120886120887120888120889120890120891120892120893120894120895120896120897120898120899120900120901120902120903120904120905120906120907120908120909120910120911120912120913120914120915120916120917120918120919120920120921120922120923120924120925120926120927120928120929120930120931120932120933120934120935120936120937120938120939120940120941120942120943120944120945120946120947120948120949120950120951120952120953120954120955120956120957120958120959120960120961120962120963120964120965120966120967120968120969120970120971120972120973120974120975120976120977120978120979120980120981120982120983120984120985120986120987120988120989120990120991120992120993120994120995120996120997120998120999121000121001121002121003121004121005121006121007121008121009121010121011121012121013121014121015121016121017121018121019121020121021121022121023121024121025121026121027121028121029121030121031121032121033121034121035121036121037121038121039121040121041121042121043121044121045121046121047121048121049121050121051121052121053121054121055121056121057121058121059121060121061121062121063121064121065121066121067121068121069121070121071121072121073121074121075121076121077121078121079121080121081121082121083121084121085121086121087121088121089121090121091121092121093121094121095121096121097121098121099121100121101121102121103121104121105121106121107121108121109121110121111121112121113121114121115121116121117121118121119121120121121121122121123121124121125121126121127121128121129121130121131121132121133121134121135121136121137121138121139121140121141121142121143121144121145121146121147121148121149121150121151121152121153121154121155121156121157121158121159121160121161121162121163121164121165121166121167121168121169121170121171121172121173121174121175121176121177121178121179121180121181121182121183121184121185121186121187121188121189121190121191121192121193121194121195121196121197121198121199121200121201121202121203121204121205121206121207121208121209121210121211121212121213121214121215121216121217121218121219121220121221121222121223121224121225121226121227121228121229121230121231121232121233121234121235121236121237121238121239121240121241121242121243121244121245121246121247121248121249121250121251121252121253121254121255121256121257121258121259121260121261121262121263121264121265121266121267121268121269121270121271121272121273121274121275121276121277121278121279121280121281121282121283121284121285121286121287121288121289121290121291121292121293121294121295121296121297121298121299121300121301121302121303121304121305121306121307121308121309121310121311121312121313121314121315121316121317121318121319121320121321121322121323121324121325121326121327121328121329121330121331121332121333121334121335121336121337121338121339121340121341121342121343121344121345121346121347121348121349121350121351121352121353121354121355121356121357121358121359121360121361121362121363121364121365121366121367121368121369121370121371121372121373121374121375121376121377121378121379121380121381121382121383121384121385121386121387121388121389121390121391121392121393121394121395121396121397121398121399121400121401121402121403121404121405121406121407121408121409121410121411121412121413121414121415121416121417121418121419121420121421121422121423121424121425121426121427121428121429121430121431121432121433121434121435121436121437121438121439121440121441121442121443121444121445121446121447121448121449121450121451121452121453121454121455121456121457121458121459121460121461121462121463121464121465121466121467121468121469121470121471121472121473121474121475121476121477121478121479121480121481121482121483121484121485121486121487121488121489121490121491121492121493121494121495121496121497121498121499121500121501121502121503121504121505121506121507121508121509121510121511121512121513121514121515121516121517121518121519121520121521121522121523121524121525121526121527121528121529121530121531121532121533121534121535121536121537121538121539121540121541121542121543121544121545121546121547121548121549121550121551121552121553121554121555121556121557121558121559121560121561121562121563121564121565121566121567121568121569121570121571121572121573121574121575121576121577121578121579121580121581121582121583121584121585121586121587121588121589121590121591121592121593121594121595121596121597121598121599121600121601121602121603121604121605121606121607121608121609121610121611121612121613121614121615121616121617121618121619121620121621121622121623121624121625121626121627121628121629121630121631121632121633121634121635121636121637121638121639121640121641121642121643121644121645121646121647121648121649121650121651121652121653121654121655121656121657121658121659121660121661121662121663121664121665121666121667121668121669121670121671121672121673121674121675121676121677121678121679121680121681121682121683121684121685121686121687121688121689121690121691121692121693121694121695121696121697121698121699121700121701121702121703121704121705121706121707121708121709121710121711121712121713121714121715121716121717121718121719121720121721121722121723121724121725121726121727121728121729121730121731121732121733121734121735121736121737121738121739121740121741121742121743121744121745121746121747121748121749121750121751121752121753121754121755121756121757121758121759121760121761121762121763121764121765121766121767121768121769121770121771121772121773121774121775121776121777121778121779121780121781121782121783121784121785121786121787121788121789121790121791121792121793121794121795121796121797121798121799121800121801121802121803121804121805121806121807121808121809121810121811121812121813121814121815121816121817121818121819121820121821121822121823121824121825121826121827121828121829121830121831121832121833121834121835121836121837121838121839121840121841121842121843121844121845121846121847121848121849121850121851121852121853121854121855121856121857121858121859121860121861121862121863121864121865121866121867121868121869121870121871121872121873121874121875121876121877121878121879121880121881121882121883121884121885121886121887121888121889121890121891121892121893121894121895121896121897121898121899121900121901121902121903121904121905121906121907121908121909121910121911121912121913121914121915121916121917
  1. var __defProp = Object.defineProperty;
  2. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  3. var __publicField = (obj, key, value) => {
  4. __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
  5. return value;
  6. };
  7. import { getCurrentScope, onScopeDispose, unref, getCurrentInstance, onMounted, nextTick, ref, readonly, watch, openBlock, createElementBlock, createElementVNode, warn, computed as computed$1, watchEffect, onBeforeUnmount, inject, isRef, shallowRef, onBeforeMount, provide, defineComponent, renderSlot, mergeProps, toRef, onUnmounted, useAttrs as useAttrs$1, useSlots, withDirectives, createCommentVNode, Fragment, normalizeClass, createBlock, withCtx, resolveDynamicComponent, withModifiers, createVNode, toDisplayString, normalizeStyle, vShow, Transition, reactive, onUpdated, cloneVNode, Text as Text$1, Comment as Comment$1, Teleport, onDeactivated, vModelRadio, createTextVNode, toRefs, toHandlers, withKeys, renderList, h, createSlots, toRaw as toRaw$1, triggerRef, resolveComponent, resolveDirective, vModelText, defineCustomElement } from "vue";
  8. const CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");
  9. class Util {
  10. static uuid(prefix = "D") {
  11. let uuid = [];
  12. uuid[8] = uuid[13] = uuid[18] = uuid[23] = "-";
  13. uuid[14] = "4";
  14. let r2;
  15. for (let i2 = 0; i2 < 36; i2++) {
  16. if (!uuid[i2]) {
  17. r2 = 0 | Math.random() * 16;
  18. uuid[i2] = CHARS[i2 == 19 ? r2 & 3 | 8 : r2];
  19. }
  20. }
  21. return prefix + "-" + uuid.join("");
  22. }
  23. static merge(dest, ...sources) {
  24. let i2, j, len, src;
  25. for (j = 0, len = sources.length; j < len; j++) {
  26. src = sources[j];
  27. for (i2 in src) {
  28. dest[i2] = src[i2];
  29. }
  30. }
  31. return dest;
  32. }
  33. static trim(str) {
  34. return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, "");
  35. }
  36. static splitWords(str) {
  37. return this.trim(str).split(/\s+/);
  38. }
  39. static setOptions(obj, options2) {
  40. if (!obj.hasOwnProperty("options")) {
  41. obj.options = obj.options ? create(obj.options) : {};
  42. }
  43. for (var i2 in options2) {
  44. obj.options[i2] = options2[i2];
  45. }
  46. return obj.options;
  47. }
  48. static checkPosition(position2) {
  49. return position2 && position2.hasOwnProperty("_lng") && position2.hasOwnProperty("_lat") && position2.hasOwnProperty("_alt");
  50. }
  51. static checkPositions(positions) {
  52. return positions && (typeof positions === "string" || Array.isArray(positions));
  53. }
  54. static checkViewer(viewer2) {
  55. return viewer2 && viewer2.delegate && viewer2.canvas;
  56. }
  57. }
  58. class DomUtil {
  59. static get(id) {
  60. return typeof id === "string" ? document.getElementById(id) : id;
  61. }
  62. static getStyle(el, style) {
  63. var value = el.style[style] || el.currentStyle && el.currentStyle[style];
  64. if ((!value || value === "auto") && document.defaultView) {
  65. var css = document.defaultView.getComputedStyle(el, null);
  66. value = css ? css[style] : null;
  67. }
  68. return value === "auto" ? null : value;
  69. }
  70. static create(tagName, className, container) {
  71. var el = document.createElement(tagName);
  72. el.className = className || "";
  73. if (container) {
  74. container.appendChild(el);
  75. }
  76. return el;
  77. }
  78. static remove(el) {
  79. var parent = el.parentNode;
  80. if (parent) {
  81. parent.removeChild(el);
  82. }
  83. }
  84. static empty(el) {
  85. while (el.firstChild) {
  86. el.removeChild(el.firstChild);
  87. }
  88. }
  89. hasClass(el, name) {
  90. if (el.classList !== void 0) {
  91. return el.classList.contains(name);
  92. }
  93. var className = getClass(el);
  94. return className.length > 0 && new RegExp("(^|\\s)" + name + "(\\s|$)").test(className);
  95. }
  96. static addClass(el, name) {
  97. if (el.classList !== void 0) {
  98. let classes = Util.splitWords(name);
  99. for (let i2 = 0, len = classes.length; i2 < len; i2++) {
  100. el.classList.add(classes[i2]);
  101. }
  102. } else if (!this.hasClass(el, name)) {
  103. let className = this.getClass(el);
  104. this.setClass(el, (className ? className + " " : "") + name);
  105. }
  106. }
  107. static removeClass(el, name) {
  108. if (el.classList !== void 0) {
  109. el.classList.remove(name);
  110. } else {
  111. this.setClass(
  112. el,
  113. Util.trim(
  114. (" " + this.getClass(el) + " ").replace(" " + name + " ", " ")
  115. )
  116. );
  117. }
  118. }
  119. static setClass(el, name) {
  120. if (el.className.baseVal === void 0) {
  121. el.className = name;
  122. } else {
  123. el.className.baseVal = name;
  124. }
  125. }
  126. static getClass(el) {
  127. if (el.correspondingElement) {
  128. el = el.correspondingElement;
  129. }
  130. return el.className.baseVal === void 0 ? el.className : el.className.baseVal;
  131. }
  132. static createSvg(width2, height2, path, container) {
  133. let svg = document.createElementNS("http://www.w3.org/2000/svg", "svg:svg");
  134. svg.setAttribute("class", "svg-path");
  135. svg.setAttribute("width", width2);
  136. svg.setAttribute("height", height2);
  137. svg.setAttribute("viewBox", `0 0 ${width2} ${height2}`);
  138. let pathEl = document.createElementNS("http://www.w3.org/2000/svg", "path");
  139. pathEl.setAttribute("d", path);
  140. svg.appendChild(pathEl);
  141. if (container) {
  142. container.appendChild(svg);
  143. }
  144. return svg;
  145. }
  146. }
  147. var StatusBar$1 = "";
  148. class StatusBar {
  149. constructor(viewer2) {
  150. if (!viewer2)
  151. throw new Error("viewer is required!");
  152. this._viewer = viewer2;
  153. this._show = false;
  154. this._handler;
  155. this._posX;
  156. this._posY;
  157. this._posZ;
  158. this._cameraHeight;
  159. this._pitch;
  160. this._heading;
  161. this._scale;
  162. this.initListener();
  163. }
  164. get params() {
  165. return {
  166. posX: this._posX,
  167. posY: this._posY,
  168. posZ: this._posZ,
  169. cameraHeight: this._cameraHeight,
  170. pitch: this._pitch,
  171. heading: this._heading,
  172. scale: this._scale
  173. };
  174. }
  175. get statusDom() {
  176. let innerHtml = `
  177. <span class="status-scale">
  178. \u6BD4\u4F8B\u5C3A\uFF1A
  179. <span class="scale-border">
  180. ${this._scale}
  181. </span>
  182. </span>
  183. <span class="status-position">
  184. <span id="status_spaceInfo">\u7A7A\u95F4\u4FE1\u606F</span>
  185. \u5237\u5E27\u7387\uFF1A<span id="status_ms"></span>|<span id="status_fps"></span>
  186. </span>
  187. `;
  188. return innerHtml;
  189. }
  190. get show() {
  191. return this._show;
  192. }
  193. set show(bool) {
  194. bool ? this.createStatusBar() : this.removeStatusBar();
  195. this._show = bool;
  196. }
  197. initListener() {
  198. const $this = this;
  199. const scene = this._viewer.scene;
  200. this._scaleListener = function() {
  201. let width2 = scene.canvas.clientWidth;
  202. let height2 = scene.canvas.clientHeight;
  203. let left = scene.camera.getPickRay(
  204. new Cesium.Cartesian2(width2 / 2 | 0, height2 - 1)
  205. );
  206. let right = scene.camera.getPickRay(
  207. new Cesium.Cartesian2(1 + width2 / 2 | 0, height2 - 1)
  208. );
  209. let globe = scene.globe;
  210. let leftPosition = globe.pick(left, scene);
  211. let rightPosition = globe.pick(right, scene);
  212. if (leftPosition && rightPosition) {
  213. let geodesic = new Cesium.EllipsoidGeodesic();
  214. let leftCartographic = globe.ellipsoid.cartesianToCartographic(leftPosition);
  215. let rightCartographic = globe.ellipsoid.cartesianToCartographic(rightPosition);
  216. geodesic.setEndPoints(leftCartographic, rightCartographic);
  217. let distance2 = geodesic.surfaceDistance;
  218. let curScaleNum = $this.closest(distance2 / 10);
  219. if (curScaleNum < 1) {
  220. $this._scale = curScaleNum * 1e3 + "m";
  221. } else {
  222. $this._scale = curScaleNum + "km";
  223. }
  224. }
  225. document.getElementsByClassName("scale-border")[0].innerText = $this._scale;
  226. if (document.getElementsByClassName("cesium-performanceDisplay-ms").length > 0) {
  227. document.getElementById("status_ms").innerText = document.getElementsByClassName("cesium-performanceDisplay-ms")[0].innerText;
  228. }
  229. if (document.getElementsByClassName("cesium-performanceDisplay-fps").length > 0) {
  230. document.getElementById("status_fps").innerText = document.getElementsByClassName("cesium-performanceDisplay-fps")[0].innerText;
  231. }
  232. };
  233. }
  234. createStatusBar() {
  235. const _delegate = this._viewer;
  236. this.initHandler(_delegate);
  237. this.initScale(_delegate, true);
  238. this._domContainer = DomUtil.create(
  239. "div",
  240. "lk-status-bar",
  241. document.getElementById(this._viewer._container.id)
  242. );
  243. this._domContainer.innerHTML = this.statusDom;
  244. }
  245. removeStatusBar() {
  246. this.initScale(this._viewer, false);
  247. if (this._handler) {
  248. this._handler.destroy();
  249. }
  250. if (this._domContainer) {
  251. DomUtil.remove(this._domContainer);
  252. }
  253. }
  254. initHandler(viewer2) {
  255. const $this = this;
  256. this._handler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  257. const mouseOverHandler = function(movement) {
  258. let loc2 = $this._getScreenClickPositionAndHeight(movement.endPosition);
  259. if (!Cesium.defined(loc2))
  260. return;
  261. if (!loc2.lng)
  262. return;
  263. $this._posX = loc2.lng.toFixed(8);
  264. $this._posY = loc2.lat.toFixed(8);
  265. $this._posZ = loc2.height.toFixed(2);
  266. document.getElementById("status_spaceInfo").innerHTML = `
  267. <span>\u7ECF\u5EA6\uFF1A${$this._posX}</span>
  268. <span>\u7EAC\u5EA6\uFF1A${$this._posY}</span>
  269. <span>\u9AD8\u5EA6\uFF1A${$this._posZ}</span>
  270. `;
  271. };
  272. this._handler.setInputAction(
  273. mouseOverHandler,
  274. Cesium.ScreenSpaceEventType.MOUSE_MOVE
  275. );
  276. }
  277. initScale(viewer2, bool) {
  278. const scene = viewer2.scene;
  279. bool ? scene.postRender.addEventListener(this._scaleListener) : scene.postRender.removeEventListener(this._scaleListener);
  280. }
  281. closest(num) {
  282. const scaleList = [
  283. 1e-3,
  284. 2e-3,
  285. 3e-3,
  286. 5e-3,
  287. 0.01,
  288. 0.015,
  289. 0.02,
  290. 0.025,
  291. 0.03,
  292. 0.035,
  293. 0.04,
  294. 0.045,
  295. 0.05,
  296. 0.06,
  297. 0.07,
  298. 0.08,
  299. 0.09,
  300. 0.1,
  301. 0.12,
  302. 0.15,
  303. 0.2,
  304. 0.25,
  305. 0.3,
  306. 0.5,
  307. 1,
  308. 2,
  309. 3,
  310. 5,
  311. 10,
  312. 15,
  313. 20,
  314. 25,
  315. 30,
  316. 35,
  317. 40,
  318. 45,
  319. 50,
  320. 60,
  321. 70,
  322. 80,
  323. 90,
  324. 100,
  325. 120,
  326. 150,
  327. 200,
  328. 250,
  329. 300,
  330. 500,
  331. 1e3,
  332. 2e3,
  333. 5e3,
  334. 1e4,
  335. 1e5,
  336. 5e5,
  337. 1e6
  338. ];
  339. let ret = scaleList[0];
  340. let distance2 = Math.abs(ret - num);
  341. for (let i2 = 1; i2 < scaleList.length; i2++) {
  342. let newDistance = Math.abs(scaleList[i2] - num);
  343. if (newDistance < distance2) {
  344. distance2 = newDistance;
  345. ret = scaleList[i2];
  346. }
  347. }
  348. return ret;
  349. }
  350. _getScreenClickPositionAndHeight(screenPoint) {
  351. var lng = void 0, lat = void 0, height2 = void 0;
  352. var ray = this._viewer.scene.camera.getPickRay(screenPoint);
  353. var position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
  354. if (position2) {
  355. var cartographic = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  356. cartographic = Cesium.Cartographic.fromCartesian(position2);
  357. var feature2 = this._viewer.scene.pick(screenPoint);
  358. if (feature2 === void 0 && Cesium.defined(cartographic)) {
  359. lng = this._arcToDegree(cartographic.longitude);
  360. lat = this._arcToDegree(cartographic.latitude);
  361. height2 = cartographic.height;
  362. } else {
  363. var cartesian = this._viewer.scene.pickPosition(screenPoint);
  364. if (Cesium.defined(cartesian)) {
  365. var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  366. if (Cesium.defined(cartographic)) {
  367. lng = this._arcToDegree(cartographic.longitude);
  368. lat = this._arcToDegree(cartographic.latitude);
  369. height2 = cartographic.height;
  370. }
  371. }
  372. }
  373. }
  374. return {
  375. lng,
  376. lat,
  377. height: height2
  378. };
  379. }
  380. _arcToDegree(arc) {
  381. return arc / Math.PI * 180;
  382. }
  383. }
  384. var base = "";
  385. class jtMap3d {
  386. constructor(options2) {
  387. if (!Cesium.defined(options2) || !Cesium.defined(options2.container)) {
  388. throw new Cesium.DeveloperError("options.container is required.");
  389. }
  390. Cesium.Ion.defaultAccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIxNzM5YjQ3MC03YmMxLTRmMjAtOTk4Yi0yNDMyMDZlOTQzYTYiLCJpZCI6NTU5MjAsImlhdCI6MTYyNDI0NTM5NX0.diydVWFzw5C5rQlHaFYkdDJoSorcdex81KpWcntyICo";
  391. this._viewer = this._initMap(options2);
  392. this._imageryLayers = this._viewer.imageryLayers;
  393. this._primitives = this._viewer.scene.primitives;
  394. this._entities = this._viewer.entities;
  395. this._dataSources = this._viewer.dataSources;
  396. this._defaultSkyBox = this._viewer.scene.skyBox;
  397. this.statusBar = new StatusBar(this._viewer);
  398. console.log(Cesium.buildModuleUrl.getCesiumBaseUrl());
  399. }
  400. _initMap(options2) {
  401. let viewer2 = new Cesium.Viewer(options2.container, {
  402. animation: true,
  403. timeline: true,
  404. shadows: false,
  405. shouldAnimate: true,
  406. baseLayerPicker: false,
  407. navigationHelpButton: false,
  408. homeButton: false,
  409. fullscreenButton: false,
  410. sceneModePicker: false,
  411. scene3DOnly: true,
  412. infoBox: false,
  413. clampToGround: true,
  414. geocoder: false,
  415. selectionIndicator: false,
  416. contextOptions: {
  417. webgl: {
  418. alpha: true,
  419. depth: true,
  420. stencil: true,
  421. antialias: true,
  422. premultipliedAlpha: true,
  423. preserveDrawingBuffer: true,
  424. failIfMajorPerformanceCaveat: true
  425. }
  426. }
  427. });
  428. viewer2._cesiumWidget._creditContainer.style.display = "none";
  429. viewer2.scene.globe.show = true;
  430. viewer2.scene.globe.depthTestAgainstTerrain = true;
  431. viewer2.scene.globe.enableLighting = false;
  432. viewer2.scene.requestRenderMode = false;
  433. viewer2.scene.debugShowFramesPerSecond = true;
  434. viewer2.scene.skyAtmosphere.show = false;
  435. viewer2.scene.skyBox.show = true;
  436. viewer2.scene.sun.show = true;
  437. viewer2.scene.moon.show = false;
  438. viewer2.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  439. viewer2.animation.viewModel.dateFormatter = localeDateTimeFormatter;
  440. viewer2.animation.viewModel.timeFormatter = localeTimeFormatter;
  441. viewer2.timeline.makeLabel = localeDateTimeFormatter;
  442. function localeDateTimeFormatter(datetime, viewModel, ignoredate) {
  443. var julianDT = new Cesium.JulianDate();
  444. Cesium.JulianDate.addHours(datetime, 8, julianDT);
  445. var gregorianDT = Cesium.JulianDate.toGregorianDate(julianDT);
  446. var objDT;
  447. if (ignoredate) {
  448. objDT = "";
  449. } else {
  450. objDT = new Date(gregorianDT.year, gregorianDT.month - 1, gregorianDT.day);
  451. objDT = gregorianDT.year + "-" + objDT.toLocaleString("zh-cn", {
  452. month: "short"
  453. }).split("\u6708").join("-") + gregorianDT.day + " ";
  454. if (viewModel || gregorianDT.hour + gregorianDT.minute === 0) {
  455. return objDT;
  456. }
  457. }
  458. let hour, minute, second;
  459. if (gregorianDT.hour < 10) {
  460. hour = `0${gregorianDT.hour}`;
  461. } else {
  462. hour = gregorianDT.hour;
  463. }
  464. if (gregorianDT.minute < 10) {
  465. minute = `0${gregorianDT.minute}`;
  466. } else {
  467. minute = gregorianDT.minute;
  468. }
  469. if (gregorianDT.second < 10) {
  470. second = `0${gregorianDT.second}`;
  471. } else {
  472. second = gregorianDT.second;
  473. }
  474. return objDT + hour + ":" + minute + ":" + second;
  475. }
  476. function localeTimeFormatter(time, viewModel) {
  477. return localeDateTimeFormatter(time, viewModel, true);
  478. }
  479. return viewer2;
  480. }
  481. _setView(options2) {
  482. if (!Cesium.defined(options2.longitude) && !Cesium.defined(options2.latitude)) {
  483. throw new Cesium.DeveloperError("longitude and latitude are required.");
  484. }
  485. Cesium.Check.typeOf.number("longitude", options2.longitude);
  486. Cesium.Check.typeOf.number("latitude", options2.latitude);
  487. this._viewer.camera.setView({
  488. destination: Cesium.Cartesian3.fromDegrees(
  489. options2.longitude,
  490. options2.latitude,
  491. options2.height
  492. ),
  493. orientation: {
  494. heading: Cesium.Math.toRadians(Cesium.defaultValue(options2.heading, 0)),
  495. pitch: Cesium.Math.toRadians(Cesium.defaultValue(options2.pitch, -90)),
  496. roll: options2.roll
  497. }
  498. });
  499. }
  500. _getChinaPostion() {
  501. return Cesium.Cartesian3.fromDegrees(116.435314, 40.960521, 1e7);
  502. }
  503. }
  504. Object.assign(jtMap3d.prototype, {
  505. flytoChina() {
  506. this._viewer.camera.flyTo({
  507. destination: this._getChinaPostion(),
  508. duration: 3
  509. });
  510. },
  511. setViewChina: function() {
  512. this._setView({
  513. longitude: 103.84,
  514. latitude: 31.15,
  515. height: 24e6,
  516. heading: 0,
  517. pitch: -90,
  518. roll: 0
  519. });
  520. },
  521. fullMap: function(options2) {
  522. return new Promise((resolve2, reject2) => {
  523. let _self = this;
  524. this._entities.removeById("fullMapRectangle");
  525. options2.isRemove = Cesium.defaultValue(options2.isRemove, true);
  526. options2.duration = Cesium.defaultValue(options2.duration, 3);
  527. options2.heading = Cesium.defaultValue(options2.heading, 0);
  528. options2.pitch = Cesium.defaultValue(options2.pitch, -90);
  529. options2.range = Cesium.defaultValue(options2.range, 0);
  530. var rectangle = Cesium.Rectangle.fromDegrees(
  531. options2.west,
  532. options2.south,
  533. options2.east,
  534. options2.north
  535. );
  536. var fullMapEntity = this._entities.add({
  537. id: "fullMapRectangle",
  538. name: "fullMapRectangle",
  539. rectangle: {
  540. coordinates: rectangle,
  541. material: Cesium.Color.GREEN.withAlpha(0),
  542. height: 10,
  543. outline: false
  544. }
  545. });
  546. var flyPromise = this._viewer.flyTo(fullMapEntity, {
  547. duration: options2.duration,
  548. offset: {
  549. heading: Cesium.Math.toRadians(options2.heading),
  550. pitch: Cesium.Math.toRadians(options2.pitch),
  551. range: options2.range
  552. }
  553. });
  554. flyPromise.then(function(flyPromise2) {
  555. if (flyPromise2) {
  556. if (options2.isRemove) {
  557. fullMapEntity && (_self._entities.remove(fullMapEntity), fullMapEntity = null);
  558. }
  559. resolve2(true);
  560. }
  561. }).catch(function(error) {
  562. console.log(error);
  563. });
  564. });
  565. },
  566. setMapNorth() {
  567. let viewer2 = this._viewer;
  568. let pitch = Cesium.Math.toDegrees(viewer2.camera.pitch).toFixed(0);
  569. var center2 = viewer2.camera.pickEllipsoid(new Cesium.Cartesian2(viewer2.canvas.clientWidth / 2, viewer2.canvas.clientHeight / 2));
  570. var curPosition = Cesium.Ellipsoid.WGS84.cartesianToCartographic(center2);
  571. let centerX = curPosition.longitude * 180 / Math.PI;
  572. let centerY = curPosition.latitude * 180 / Math.PI;
  573. let cameraPointX = viewer2.camera.positionCartographic.longitude * 180 / Math.PI;
  574. let cameraPointY = viewer2.camera.positionCartographic.latitude * 180 / Math.PI;
  575. let cameraPointZ = viewer2.camera.positionCartographic.height.toFixed(0);
  576. var satrt = Cesium.Cartographic.fromDegrees(cameraPointX, cameraPointY, cameraPointZ);
  577. var end = Cesium.Cartographic.fromDegrees(centerX, centerY, 0);
  578. var geodesic = new Cesium.EllipsoidGeodesic();
  579. geodesic.setEndPoints(satrt, end);
  580. var distance2 = geodesic.surfaceDistance;
  581. let range3 = Math.sqrt(Math.pow(distance2, 2) + Math.pow(cameraPointZ - 0, 2));
  582. if (this.centerEntity) {
  583. viewer2.entities.remove(this.centerEntity);
  584. }
  585. this.centerEntity = viewer2.entities.add({
  586. position: Cesium.Cartesian3.fromDegrees(centerX, centerY, 0),
  587. point: {
  588. color: Cesium.Color.RED,
  589. pixelSize: 1
  590. }
  591. });
  592. let offset = new Cesium.HeadingPitchRange(Cesium.Math.toRadians(0), Cesium.Math.toRadians(pitch), range3);
  593. viewer2.zoomTo(this.centerEntity, offset);
  594. },
  595. setMapSpinByPoint(points2, options2) {
  596. let viewer2 = this._viewer;
  597. if (!Cesium.defined(points2)) {
  598. throw new Cesium.DeveloperError("points is required.");
  599. }
  600. options2 = options2 || {};
  601. options2.speed = Cesium.defaultValue(options2.speed, 30);
  602. var position2 = points2;
  603. if (points2 instanceof Cesium.Cartesian3) {
  604. position2 = points2;
  605. } else {
  606. position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], points2[2] || 0);
  607. }
  608. var entity = viewer2.entities.add(
  609. new Cesium.Entity({
  610. point: new Cesium.PointGraphics({
  611. color: new Cesium.Color(1, 1, 0),
  612. pixelSize: 6,
  613. outlineColor: new Cesium.Color(0, 1, 1)
  614. }),
  615. position: position2
  616. })
  617. );
  618. var angle = 360 / options2.speed;
  619. var initialHeading = viewer2.camera.heading;
  620. var pitch = viewer2.camera.pitch;
  621. if (options2.pitch) {
  622. pitch = Cesium.Math.toRadians(options2.pitch);
  623. }
  624. var distance2 = viewer2.camera.positionCartographic.height;
  625. if (options2.height) {
  626. distance2 = options2.height;
  627. }
  628. var startTime = Cesium.JulianDate.fromDate(new Date());
  629. viewer2.clock.startTime = startTime.clone();
  630. viewer2.clock.currentTime = startTime.clone();
  631. viewer2.clock.clockRange = Cesium.ClockRange.CLAMPED;
  632. viewer2.clock.clockStep = Cesium.ClockStep.SYSTEM_CLOCK;
  633. var Exection = function TimeExecution() {
  634. var delTime = Cesium.JulianDate.secondsDifference(viewer2.clock.currentTime, viewer2.clock.startTime);
  635. var heading = Cesium.Math.toRadians(delTime * angle) + initialHeading;
  636. viewer2.scene.camera.setView({
  637. destination: position2,
  638. orientation: {
  639. heading,
  640. pitch
  641. }
  642. });
  643. viewer2.scene.camera.moveBackward(distance2);
  644. if (Cesium.JulianDate.compare(viewer2.clock.currentTime, viewer2.clock.stopTime) >= 0) {
  645. viewer2.clock.onTick.removeEventListener(Exection);
  646. }
  647. var handler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  648. handler.setInputAction(function(click) {
  649. viewer2.clock.onTick.removeEventListener(Exection);
  650. viewer2.entities.remove(entity);
  651. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  652. };
  653. viewer2.clock.onTick.addEventListener(Exection);
  654. }
  655. });
  656. const BD_FACTOR = 3.141592653589793 * 3e3 / 180;
  657. const PI = 3.141592653589793;
  658. const RADIUS = 6378245;
  659. const EE = 0.006693421622965943;
  660. class CoordTransform {
  661. static BD09ToGCJ02(lng, lat) {
  662. let x = +lng - 65e-4;
  663. let y = +lat - 6e-3;
  664. let z = Math.sqrt(x * x + y * y) - 2e-5 * Math.sin(y * BD_FACTOR);
  665. let theta = Math.atan2(y, x) - 3e-6 * Math.cos(x * BD_FACTOR);
  666. let gg_lng = z * Math.cos(theta);
  667. let gg_lat = z * Math.sin(theta);
  668. return [gg_lng, gg_lat];
  669. }
  670. static GCJ02ToBD09(lng, lat) {
  671. lat = +lat;
  672. lng = +lng;
  673. let z = Math.sqrt(lng * lng + lat * lat) + 2e-5 * Math.sin(lat * BD_FACTOR);
  674. let theta = Math.atan2(lat, lng) + 3e-6 * Math.cos(lng * BD_FACTOR);
  675. let bd_lng = z * Math.cos(theta) + 65e-4;
  676. let bd_lat = z * Math.sin(theta) + 6e-3;
  677. return [bd_lng, bd_lat];
  678. }
  679. static WGS84ToGCJ02(lng, lat) {
  680. lat = +lat;
  681. lng = +lng;
  682. if (this.out_of_china(lng, lat)) {
  683. return [lng, lat];
  684. } else {
  685. let d2 = this.delta(lng, lat);
  686. return [lng + d2[0], lat + d2[1]];
  687. }
  688. }
  689. static GCJ02ToWGS84(lng, lat) {
  690. lat = +lat;
  691. lng = +lng;
  692. if (this.out_of_china(lng, lat)) {
  693. return [lng, lat];
  694. } else {
  695. let d2 = this.delta(lng, lat);
  696. let mgLng = lng + d2[0];
  697. let mgLat = lat + d2[1];
  698. return [lng * 2 - mgLng, lat * 2 - mgLat];
  699. }
  700. }
  701. static delta(lng, lat) {
  702. let dLng = this.transformLng(lng - 105, lat - 35);
  703. let dLat = this.transformLat(lng - 105, lat - 35);
  704. const radLat = lat / 180 * PI;
  705. let magic = Math.sin(radLat);
  706. magic = 1 - EE * magic * magic;
  707. const sqrtMagic = Math.sqrt(magic);
  708. dLng = dLng * 180 / (RADIUS / sqrtMagic * Math.cos(radLat) * PI);
  709. dLat = dLat * 180 / (RADIUS * (1 - EE) / (magic * sqrtMagic) * PI);
  710. return [dLng, dLat];
  711. }
  712. static transformLng(lng, lat) {
  713. lat = +lat;
  714. lng = +lng;
  715. let ret = 300 + lng + 2 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng));
  716. ret += (20 * Math.sin(6 * lng * PI) + 20 * Math.sin(2 * lng * PI)) * 2 / 3;
  717. ret += (20 * Math.sin(lng * PI) + 40 * Math.sin(lng / 3 * PI)) * 2 / 3;
  718. ret += (150 * Math.sin(lng / 12 * PI) + 300 * Math.sin(lng / 30 * PI)) * 2 / 3;
  719. return ret;
  720. }
  721. static transformLat(lng, lat) {
  722. lat = +lat;
  723. lng = +lng;
  724. let ret = -100 + 2 * lng + 3 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
  725. ret += (20 * Math.sin(6 * lng * PI) + 20 * Math.sin(2 * lng * PI)) * 2 / 3;
  726. ret += (20 * Math.sin(lat * PI) + 40 * Math.sin(lat / 3 * PI)) * 2 / 3;
  727. ret += (160 * Math.sin(lat / 12 * PI) + 320 * Math.sin(lat * PI / 30)) * 2 / 3;
  728. return ret;
  729. }
  730. static out_of_china(lng, lat) {
  731. lat = +lat;
  732. lng = +lng;
  733. return !(lng > 73.66 && lng < 135.05 && lat > 3.86 && lat < 53.55);
  734. }
  735. static getCatesian3FromPX(viewer2, px) {
  736. let picks = viewer2.scene.drillPick(px);
  737. let cartesian = null;
  738. let isOn3dtiles = false, isOnTerrain = false;
  739. for (let i2 in picks) {
  740. let pick = picks[i2];
  741. if (pick && pick.primitive instanceof Cesium.Cesium3DTileFeature || pick && pick.primitive instanceof Cesium.Cesium3DTileset || pick && pick.primitive instanceof Cesium.Model) {
  742. isOn3dtiles = true;
  743. }
  744. if (isOn3dtiles) {
  745. viewer2.scene.pick(px);
  746. cartesian = viewer2.scene.pickPosition(px);
  747. if (cartesian) {
  748. let cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  749. if (cartographic.height < 0)
  750. cartographic.height = 0;
  751. let lon = Cesium.Math.toDegrees(cartographic.longitude), lat = Cesium.Math.toDegrees(cartographic.latitude), height2 = cartographic.height;
  752. cartesian = this.transformWGS84ToCartesian({
  753. lng: lon,
  754. lat,
  755. alt: height2
  756. });
  757. }
  758. }
  759. }
  760. let boolTerrain = viewer2.terrainProvider instanceof Cesium.EllipsoidTerrainProvider;
  761. if (!isOn3dtiles && !boolTerrain) {
  762. let ray = viewer2.scene.camera.getPickRay(px);
  763. if (!ray)
  764. return null;
  765. cartesian = viewer2.scene.globe.pick(ray, viewer2.scene);
  766. isOnTerrain = true;
  767. }
  768. if (!isOn3dtiles && !isOnTerrain && boolTerrain) {
  769. cartesian = viewer2.scene.camera.pickEllipsoid(
  770. px,
  771. viewer2.scene.globe.ellipsoid
  772. );
  773. }
  774. if (cartesian) {
  775. let position2 = this.transformCartesianToWGS84(cartesian);
  776. if (position2.alt < 0) {
  777. cartesian = this.transformWGS84ToCartesian(position2, 0.1);
  778. }
  779. return cartesian;
  780. }
  781. return false;
  782. }
  783. static transformWGS84ToCartesian(position2, alt) {
  784. return position2 ? Cesium.Cartesian3.fromDegrees(
  785. position2.lng || position2.lon,
  786. position2.lat,
  787. position2.alt = alt || position2.alt,
  788. Cesium.Ellipsoid.WGS84
  789. ) : Cesium.Cartesian3.ZERO;
  790. }
  791. static transformCartesianToWGS84(cartesian) {
  792. let ellipsoid = Cesium.Ellipsoid.WGS84;
  793. let cartographic = ellipsoid.cartesianToCartographic(cartesian);
  794. return {
  795. lng: Cesium.Math.toDegrees(cartographic.longitude),
  796. lat: Cesium.Math.toDegrees(cartographic.latitude),
  797. alt: cartographic.height
  798. };
  799. }
  800. static Cartesian3ListToWGS84(cartesianList) {
  801. let ellipsoid = Cesium.Ellipsoid.WGS84;
  802. let result = [];
  803. for (let index2 = 0; index2 < cartesianList.length; index2++) {
  804. const cartesian = cartesianList[index2];
  805. let cartographic = ellipsoid.cartesianToCartographic(cartesian);
  806. result.push({
  807. lng: Cesium.Math.toDegrees(cartographic.longitude),
  808. lat: Cesium.Math.toDegrees(cartographic.latitude),
  809. alt: cartographic.height
  810. });
  811. }
  812. return result;
  813. }
  814. static Degrees2DMS(value) {
  815. let degrees = Math.floor(value);
  816. let rem = (value - degrees) * 60;
  817. let minutes = Math.floor(rem);
  818. let _second = (rem - minutes) * 60;
  819. let seconds = Math.round(_second);
  820. var _radians = Cesium.Math.toRadians(value);
  821. var _degrees = Cesium.Math.toDegrees(value);
  822. console.log(_radians);
  823. console.log(_degrees);
  824. let DMS = {
  825. degrees,
  826. minutes,
  827. seconds
  828. };
  829. return DMS;
  830. }
  831. static DMS2Degrees(DMS) {
  832. let _double = parseFloat(DMS.degrees) + parseFloat(DMS.minutes) / 60 + parseFloat(DMS.seconds) / 3600;
  833. return parseFloat(_double).toFixed(6);
  834. }
  835. static _cartesian3ToGeo(position2) {
  836. let g = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  837. return {
  838. longitude: Cesium.Math.toDegrees(g.longitude),
  839. latitude: Cesium.Math.toDegrees(g.latitude),
  840. height: g.height
  841. };
  842. }
  843. static _arcToDegree(arc) {
  844. return arc / Math.PI * 180;
  845. }
  846. static _getScreenClickPositionAndHeight(viewer2, screenPoint) {
  847. this._viewer = viewer2;
  848. var lng = void 0, lat = void 0, height2 = void 0;
  849. var ray = this._viewer.scene.camera.getPickRay(screenPoint);
  850. var position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
  851. var cartographic = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  852. var feature2 = this._viewer.scene.pick(screenPoint);
  853. if (feature2 == void 0) {
  854. lng = this._arcToDegree(cartographic.longitude);
  855. lat = this._arcToDegree(cartographic.latitude);
  856. height2 = cartographic.height;
  857. } else {
  858. var cartesian = this._viewer.scene.pickPosition(screenPoint);
  859. if (Cesium.defined(cartesian)) {
  860. var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  861. lng = this._arcToDegree(cartographic.longitude);
  862. lat = this._arcToDegree(cartographic.latitude);
  863. height2 = cartographic.height;
  864. }
  865. }
  866. return {
  867. lng,
  868. lat,
  869. height: height2
  870. };
  871. }
  872. static _transfromFromScreenPoint(viewer2, screenPosition) {
  873. let location = this._getScreenClickPositionAndHeight(viewer2, screenPosition);
  874. var cartesian = Cesium.Cartesian3.fromDegrees(location.lng, location.lat, location.height);
  875. return {
  876. gLocation: location,
  877. sLocation: cartesian
  878. };
  879. }
  880. }
  881. class PolylineDirectionMaterialProperty {
  882. constructor(options2) {
  883. this.defaultColor = new Cesium.Color(255 / 255, 0, 0, 0);
  884. options2 = options2 || {};
  885. options2.isImageAlpha = Cesium.defaultValue(options2.isImageAlpha, true);
  886. options2.imgUrl = Cesium.defaultValue(options2.imgUrl, "jt3dSDK/imgs/polylinematerial/spriteline1.png");
  887. options2.duration = Cesium.defaultValue(options2.duration, 3e3);
  888. options2.count = Cesium.defaultValue(options2.count, 1);
  889. options2.direction = Cesium.defaultValue(options2.direction, "horizontal");
  890. options2.order = Cesium.defaultValue(options2.order, "-");
  891. if (options2.isImageAlpha) {
  892. options2.color = this.defaultColor;
  893. } else {
  894. if (options2.color instanceof Array) {
  895. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  896. } else if (typeof options2.color === "string") {
  897. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  898. } else {
  899. options2.color = this.defaultColor;
  900. }
  901. }
  902. this._definitionChanged = new Cesium.Event();
  903. this._color = void 0;
  904. this._image = void 0;
  905. this.color = options2.color;
  906. this.image = options2.imgUrl;
  907. this._isImageAlpha = options2.isImageAlpha;
  908. this._duration = options2.duration;
  909. this._count = options2.count;
  910. this._direction = options2.direction;
  911. this._order = options2.order;
  912. this._time = performance.now();
  913. this.addMaterial();
  914. }
  915. addMaterial() {
  916. Cesium.Material.PolylineTrailType = "PolylineTrail";
  917. Cesium.Material.Polylineimage = "images/colors.png";
  918. if (this._direction === "vertical") {
  919. if (this._isImageAlpha) {
  920. Cesium.Material.PolylineTrailSource = "czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = repeat * materialInput.st;\n vec4 colorImage = texture2D(image, vec2(fract(st.t " + this._order + " time), st.s));\n material.alpha = colorImage.a;\n material.diffuse = colorImage.rgb* 1.5 ;\n return material;\n }";
  921. } else {
  922. Cesium.Material.PolylineTrailSource = "czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = repeat * materialInput.st;\n vec4 colorImage = texture2D(image, vec2(fract(st.t " + this._order + " time), st.s));\n material.alpha = colorImage.a * color.a;\n material.diffuse = max(color.rgb * material.alpha * 3.0, color.rgb);\n return material;\n }";
  923. }
  924. } else if (this._direction === "horizontal") {
  925. if (this._isImageAlpha) {
  926. Cesium.Material.PolylineTrailSource = "czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = repeat * materialInput.st;\n vec4 colorImage = texture2D(image, vec2(fract(st.s " + this._order + " time), st.t));\n material.alpha = colorImage.a;\n material.diffuse = colorImage.rgb * 1.5 ;\n return material;\n }";
  927. } else {
  928. Cesium.Material.PolylineTrailSource = "czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = repeat * materialInput.st;\n vec4 colorImage = texture2D(image, vec2(fract(st.s " + this._order + " time), st.t));\n material.alpha = colorImage.a * color.a;\n material.diffuse = max(color.rgb * material.alpha * 3.0, color.rgb);\n return material;\n }";
  929. }
  930. }
  931. Cesium.Material._materialCache.addMaterial(Cesium.Material.PolylineTrailType, {
  932. fabric: {
  933. type: Cesium.Material.PolylineTrailType,
  934. uniforms: {
  935. color: new Cesium.Color(1, 0, 0, 0.5),
  936. image: Cesium.Material.Polylineimage,
  937. time: 0,
  938. repeat: new Cesium.Cartesian2(5, 1),
  939. order: "-"
  940. },
  941. source: Cesium.Material.PolylineTrailSource
  942. },
  943. translucent: function(material) {
  944. return true;
  945. }
  946. });
  947. }
  948. }
  949. PolylineDirectionMaterialProperty.prototype.getType = function(time) {
  950. return "PolylineTrail";
  951. };
  952. PolylineDirectionMaterialProperty.prototype.getValue = function(time, result) {
  953. if (!Cesium.defined(result)) {
  954. result = {};
  955. }
  956. result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, this.defaultColor, result.color);
  957. result.image = Cesium.Property.getValueOrUndefined(this._image, time);
  958. result.time = (performance.now() - this._time) % this._duration / this._duration;
  959. result.repeat = new Cesium.Cartesian2(this._count, 1);
  960. result.order = this._order;
  961. return result;
  962. };
  963. PolylineDirectionMaterialProperty.prototype.equals = function(other) {
  964. return this === other || other instanceof PolylineDirectionMaterialProperty && Cesium.Property.equals(this._color, other._color);
  965. };
  966. Object.defineProperties(PolylineDirectionMaterialProperty.prototype, {
  967. isConstant: {
  968. get: function() {
  969. return false;
  970. }
  971. },
  972. definitionChanged: {
  973. get: function() {
  974. return this._definitionChanged;
  975. }
  976. },
  977. color: Cesium.createPropertyDescriptor("color"),
  978. image: Cesium.createPropertyDescriptor("image")
  979. });
  980. class WallMaterialProperty$1 {
  981. constructor(viewer2, options2) {
  982. this._viewer = viewer2;
  983. options2 = options2 || {};
  984. this._definitionChanged = new Cesium.Event();
  985. this._color = void 0;
  986. this.color = options2.color || Cesium.Color.BLUE;
  987. this.duration = options2.duration || 1e3;
  988. this.count = options2.duration || 1;
  989. this.direction = options2.duration || "vertical";
  990. this.order = options2.duration || "-";
  991. this.trailImage = Cesium.defaultValue(options2.trailImage, "jt3dSDK/imgs/wallmaterial/wl.png");
  992. this._time = new Date().getTime();
  993. this._materialTypeName = "WallMaterial" + this._guid();
  994. this._param = {
  995. color: this.color._value.toCssColorString(),
  996. image: this.trailImage,
  997. duration: this.duration,
  998. count: this.count,
  999. direction: this.direction,
  1000. order: this.order
  1001. };
  1002. Cesium.Material._materialCache.addMaterial(this._materialTypeName, {
  1003. fabric: {
  1004. type: this._materialTypeName,
  1005. uniforms: {
  1006. time: -20,
  1007. color: new Cesium.Color(1, 0, 0, 0.5),
  1008. image: options2.trailImage
  1009. },
  1010. source: this._getDirectionWallShader(options2.param)
  1011. },
  1012. translucent: function(material) {
  1013. return true;
  1014. }
  1015. });
  1016. }
  1017. _guid() {
  1018. function S4() {
  1019. return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
  1020. }
  1021. return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
  1022. }
  1023. getType(time) {
  1024. return this._materialTypeName;
  1025. }
  1026. getValue(time, result) {
  1027. if (!Cesium.defined(result)) {
  1028. result = {};
  1029. }
  1030. result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.BLUE, result.color);
  1031. result.image = this.trailImage;
  1032. if (this.duration) {
  1033. result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
  1034. }
  1035. this._viewer.scene.requestRender();
  1036. return result;
  1037. }
  1038. equals(other) {
  1039. return this === other || other instanceof WallMaterialProperty$1 && Cesium.Property.equals(this._color, other._color) && other._param.order === this._param.order && other._param.count === this._param.count && other._param.direction === this._param.direction && other.duration === this.duration;
  1040. }
  1041. _getDirectionWallShader(options2) {
  1042. let op = Cesium.defaultValue(options2, {});
  1043. let count = op.count !== void 0 && typeof op.count === "number" && op.count > 0 ? op.count : 1;
  1044. let direction = op.direction === "horizontal" ? "horizontal" : "vertical";
  1045. let order = op.order === "+" ? "+" : "-";
  1046. this._param.count = count;
  1047. this._param.direction = direction;
  1048. this._param.order = order;
  1049. let materail = "";
  1050. materail += "czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n";
  1051. if (direction === "vertical") {
  1052. materail += " vec4 colorImage = texture2D(image,vec2(st.s,fract(float(" + count + ")*st.t " + order + " time)));\n";
  1053. } else if (direction === "horizontal") {
  1054. materail += " vec4 colorImage = texture2D(image, vec2(fract(float(" + count + ")*st.s " + order + " time), st.t));\n";
  1055. }
  1056. materail += " vec4 fragColor;\n fragColor.rgb = color.rgb / 1.0;\n fragColor = czm_gammaCorrect(fragColor);\n material.alpha = colorImage.a * color.a;\n material.diffuse = color.rgb;\n material.emission = fragColor.rgb;\n return material;\n}";
  1057. return materail;
  1058. }
  1059. }
  1060. Object.defineProperties(WallMaterialProperty$1.prototype, {
  1061. isConstant: {
  1062. get: function() {
  1063. return false;
  1064. }
  1065. },
  1066. definitionChanged: {
  1067. get: function() {
  1068. return this._definitionChanged;
  1069. }
  1070. },
  1071. color: Cesium.createPropertyDescriptor("color")
  1072. });
  1073. var tooltip = "";
  1074. function setSessionid$1(num) {
  1075. let len = num || 32;
  1076. let chars = "ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678";
  1077. let maxPos = chars.length;
  1078. let pwd = "";
  1079. for (let i2 = 0; i2 < len; i2++) {
  1080. pwd += chars.charAt(Math.floor(Math.random() * maxPos));
  1081. }
  1082. return pwd;
  1083. }
  1084. function guid() {
  1085. function S4() {
  1086. return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
  1087. }
  1088. return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
  1089. }
  1090. function getGuid(removeMinus) {
  1091. let d2 = new Date().getTime();
  1092. let uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
  1093. const r2 = (d2 + Math.random() * 16) % 16 | 0;
  1094. d2 = Math.floor(d2 / 16);
  1095. return (c === "x" ? r2 : r2 & 3 | 8).toString(16);
  1096. });
  1097. if (removeMinus) {
  1098. uuid = uuid.replace(/-/g, "");
  1099. }
  1100. return uuid;
  1101. }
  1102. function getHeigthByLngLat(viewer2, options2) {
  1103. if (!viewer2)
  1104. throw new Cesium.DeveloperError("no viewer object!");
  1105. if (!Cesium.defined(options2.longitude) && !Cesium.defined(options2.latitude)) {
  1106. throw new Cesium.DeveloperError("longitude and latitude are required.");
  1107. }
  1108. options2.level = Cesium.defaultValue(options2.level, 11);
  1109. let positions = Cesium.Cartographic.fromDegrees(options2.longitude, options2.latitude);
  1110. let terrainProvider = viewer2.terrainProvider;
  1111. return new Promise((resolve2, reject2) => {
  1112. new Cesium.sampleTerrain(terrainProvider, options2.level, [positions]).then(function(updatedPositions) {
  1113. if (updatedPositions) {
  1114. resolve2(updatedPositions[0].height);
  1115. }
  1116. });
  1117. });
  1118. }
  1119. function getHeigthByPoints(viewer2, options2) {
  1120. if (!viewer2)
  1121. throw new Cesium.DeveloperError("no viewer object!");
  1122. if (!Cesium.defined(options2)) {
  1123. throw new Cesium.DeveloperError("options is required.");
  1124. }
  1125. options2.level = Cesium.defaultValue(options2.level, 11);
  1126. let positions = [];
  1127. let points2 = options2.points;
  1128. for (let i2 = 0; i2 < points2.length; i2++) {
  1129. let pointX = points2[i2][0];
  1130. let pointY = points2[i2][1];
  1131. positions.push(
  1132. Cesium.Cartographic.fromDegrees(pointX, pointY)
  1133. );
  1134. }
  1135. let terrainProvider = viewer2.terrainProvider;
  1136. return new Promise((resolve2, reject2) => {
  1137. new Cesium.sampleTerrain(terrainProvider, options2.level, positions).then(function(updatedPositions) {
  1138. if (updatedPositions) {
  1139. resolve2(updatedPositions);
  1140. }
  1141. });
  1142. });
  1143. }
  1144. function getHeigthByPointsMostDetailed(viewer2, points2) {
  1145. if (!viewer2)
  1146. throw new Cesium.DeveloperError("no viewer object!");
  1147. if (!Cesium.defined(points2)) {
  1148. throw new Cesium.DeveloperError("points is required.");
  1149. }
  1150. let positions = [];
  1151. for (let i2 = 0; i2 < points2.length; i2++) {
  1152. let pointX = points2[i2][0];
  1153. let pointY = points2[i2][1];
  1154. positions.push(Cesium.Cartographic.fromDegrees(pointX, pointY));
  1155. }
  1156. let terrainProvider = viewer2.terrainProvider;
  1157. return new Promise((resolve2, reject2) => {
  1158. let promise = new Cesium.sampleTerrainMostDetailed(terrainProvider, positions);
  1159. promise.then(function(updatedPositions) {
  1160. resolve2(updatedPositions);
  1161. });
  1162. });
  1163. }
  1164. function getHeigthByPointMostDetailed(viewer2, points2) {
  1165. if (!viewer2)
  1166. throw new Cesium.DeveloperError("no viewer object!");
  1167. if (!Cesium.defined(points2)) {
  1168. throw new Cesium.DeveloperError("points is required.");
  1169. }
  1170. let positions = Cesium.Cartographic.fromDegrees(points2[0], points2[1]);
  1171. let terrainProvider = viewer2.terrainProvider;
  1172. return new Promise((resolve2, reject2) => {
  1173. let promise = new Cesium.sampleTerrainMostDetailed(terrainProvider, positions);
  1174. promise.then(function(updatedPositions) {
  1175. resolve2(updatedPositions);
  1176. });
  1177. });
  1178. }
  1179. function createTooltip(frameDiv) {
  1180. var tooltip2 = function(frameDiv2) {
  1181. var div = document.createElement("DIV");
  1182. div.className = "twipsy right";
  1183. var arrow = document.createElement("DIV");
  1184. arrow.className = "twipsy-arrow";
  1185. div.appendChild(arrow);
  1186. var title = document.createElement("DIV");
  1187. title.className = "twipsy-inner";
  1188. div.appendChild(title);
  1189. this._div = div;
  1190. this._title = title;
  1191. frameDiv2.appendChild(div);
  1192. };
  1193. tooltip2.prototype.setVisible = function(visible) {
  1194. this._div.style.display = visible ? "block" : "none";
  1195. };
  1196. tooltip2.prototype.showAt = function(position2, message) {
  1197. if (position2 && message) {
  1198. this.setVisible(true);
  1199. this._title.innerHTML = message;
  1200. this._div.style.left = position2.x + 10 + "px";
  1201. this._div.style.top = position2.y - this._div.clientHeight / 2 + "px";
  1202. }
  1203. };
  1204. return new tooltip2(frameDiv);
  1205. }
  1206. var common = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  1207. __proto__: null,
  1208. setSessionid: setSessionid$1,
  1209. guid,
  1210. getGuid,
  1211. getHeigthByLngLat,
  1212. getHeigthByPoints,
  1213. getHeigthByPointsMostDetailed,
  1214. getHeigthByPointMostDetailed,
  1215. createTooltip
  1216. }, Symbol.toStringTag, { value: "Module" }));
  1217. class PointObject {
  1218. constructor(viewer2) {
  1219. if (!viewer2)
  1220. throw new Cesium.DeveloperError("no viewer object!");
  1221. this._viewer = viewer2;
  1222. }
  1223. }
  1224. Object.assign(PointObject.prototype, {
  1225. addLabel(points2, options2) {
  1226. return new Promise((resolve2, reject2) => {
  1227. if (!Cesium.defined(points2)) {
  1228. throw new Cesium.DeveloperError("points is required.");
  1229. }
  1230. let position2;
  1231. if (points2 instanceof Cesium.Cartesian3) {
  1232. position2 = points2;
  1233. } else {
  1234. position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], points2[2] || 0);
  1235. }
  1236. options2 = options2 || {};
  1237. options2.id = options2.id || setSessionid$1();
  1238. let label2 = options2.label || {};
  1239. label2.text = Cesium.defaultValue(label2.text, "\u91D1\u7530CIM\u4E09\u7EF4\u57FA\u7840\u5E73\u53F0");
  1240. label2.font = Cesium.defaultValue(label2.font, "24px Helvetica");
  1241. if (label2.fillColor instanceof Cesium.Color) {
  1242. label2.fillColor = label2.fillColor;
  1243. } else if (label2.fillColor instanceof Array) {
  1244. label2.fillColor = new Cesium.Color(label2.fillColor[0] / 255, label2.fillColor[1] / 255, label2.fillColor[2] / 255, label2.fillColor[3]);
  1245. } else if (typeof label2.fillColor === "string") {
  1246. label2.fillColor = new Cesium.Color.fromCssColorString(label2.fillColor);
  1247. } else {
  1248. label2.fillColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1249. }
  1250. if (label2.outlineColor instanceof Cesium.Color) {
  1251. label2.outlineColor = label2.outlineColor;
  1252. } else if (label2.outlineColor instanceof Array) {
  1253. label2.outlineColor = new Cesium.Color(label2.outlineColor[0] / 255, label2.outlineColor[1] / 255, label2.outlineColor[2] / 255, label2.outlineColor[3]);
  1254. } else if (typeof label2.outlineColor === "string") {
  1255. label2.outlineColor = new Cesium.Color.fromCssColorString(label2.outlineColor);
  1256. } else {
  1257. label2.outlineColor = new Cesium.Color.fromCssColorString("#FFF");
  1258. }
  1259. label2.outlineWidth = Cesium.defaultValue(label2.outlineWidth, 1);
  1260. label2.showBackground = Cesium.defaultValue(label2.showBackground, false);
  1261. if (label2.backgroundColor instanceof Cesium.Color) {
  1262. label2.backgroundColor = label2.backgroundColor;
  1263. } else if (label2.backgroundColor instanceof Array) {
  1264. label2.backgroundColor = new Cesium.Color(label2.backgroundColor[0] / 255, label2.backgroundColor[1] / 255, label2.backgroundColor[2] / 255, label2.backgroundColor[3]);
  1265. } else if (typeof label2.backgroundColor === "string") {
  1266. label2.backgroundColor = new Cesium.Color.fromCssColorString(label2.backgroundColor);
  1267. } else {
  1268. label2.backgroundColor = new Cesium.Color.fromCssColorString("#FFF");
  1269. }
  1270. if (label2.backgroundPadding) {
  1271. label2.backgroundPadding = new Cesium.Cartesian2(label2.backgroundPadding, label2.backgroundPadding);
  1272. }
  1273. let entity = new Cesium.Entity({
  1274. position: position2,
  1275. label: {
  1276. text: label2.text,
  1277. font: label2.font,
  1278. fillColor: label2.fillColor,
  1279. outlineColor: label2.outlineColor,
  1280. outlineWidth: label2.outlineWidth,
  1281. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  1282. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  1283. showBackground: label2.showBackground,
  1284. backgroundColor: label2.backgroundColor,
  1285. backgroundPadding: label2.backgroundPadding,
  1286. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  1287. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
  1288. clampToGround: true
  1289. }
  1290. });
  1291. if (label2.pixelOffset) {
  1292. label2.pixelOffset.x = Cesium.defaultValue(label2.pixelOffset.x, 0);
  1293. label2.pixelOffset.y = Cesium.defaultValue(label2.pixelOffset.y, 0);
  1294. entity.label.pixelOffset = new Cesium.Cartesian2(label2.pixelOffset.x, label2.pixelOffset.y);
  1295. }
  1296. if (label2.scaleByDistance) {
  1297. label2.scaleByDistance.near = Cesium.defaultValue(label2.scaleByDistance.near, 0);
  1298. label2.scaleByDistance.nearValue = Cesium.defaultValue(label2.scaleByDistance.nearValue, 0);
  1299. label2.scaleByDistance.far = Cesium.defaultValue(label2.scaleByDistance.far, 1);
  1300. label2.scaleByDistance.farValue = Cesium.defaultValue(label2.scaleByDistance.farValue, 0);
  1301. entity.label.scaleByDistance = new Cesium.NearFarScalar(label2.scaleByDistance.near, label2.scaleByDistance.nearValue, label2.scaleByDistance.far, label2.scaleByDistance.farValue);
  1302. }
  1303. resolve2(entity);
  1304. });
  1305. },
  1306. addPoint(points2, options2) {
  1307. return new Promise((resolve2, reject2) => {
  1308. if (!Cesium.defined(points2)) {
  1309. throw new Cesium.DeveloperError("points is required.");
  1310. }
  1311. let position2;
  1312. if (points2 instanceof Cesium.Cartesian3) {
  1313. position2 = points2;
  1314. } else {
  1315. position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], points2[2] || 0);
  1316. }
  1317. options2 = options2 || {};
  1318. options2.id = options2.id || setSessionid$1();
  1319. let point2 = options2.point || {};
  1320. point2.pixelSize = Cesium.defaultValue(point2.pixelSize, 10);
  1321. if (point2.color instanceof Cesium.Color) {
  1322. point2.color = point2.color;
  1323. } else if (point2.color instanceof Array) {
  1324. point2.color = new Cesium.Color(point2.color[0] / 255, point2.color[1] / 255, point2.color[2] / 255, point2.color[3]);
  1325. } else if (typeof point2.color === "string") {
  1326. point2.color = new Cesium.Color.fromCssColorString(point2.color);
  1327. } else {
  1328. point2.color = new Cesium.Color.fromCssColorString("#FFF");
  1329. }
  1330. if (point2.outlineColor instanceof Cesium.Color) {
  1331. point2.outlineColor = point2.outlineColor;
  1332. } else if (point2.outlineColor instanceof Array) {
  1333. point2.outlineColor = new Cesium.Color(point2.outlineColor[0] / 255, point2.outlineColor[1] / 255, point2.outlineColor[2] / 255, point2.outlineColor[3]);
  1334. } else if (typeof point2.outlineColor === "string") {
  1335. point2.outlineColor = new Cesium.Color.fromCssColorString(point2.outlineColor);
  1336. } else {
  1337. point2.outlineColor = new Cesium.Color.fromCssColorString("#FFF");
  1338. }
  1339. point2.outlineWidth = Cesium.defaultValue(point2.outlineWidth, 1);
  1340. let entity = new Cesium.Entity({
  1341. position: position2,
  1342. point: {
  1343. pixelSize: point2.pixelSize,
  1344. color: point2.color,
  1345. outlineColor: point2.outlineColor,
  1346. outlineWidth: point2.outlineWidth,
  1347. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
  1348. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  1349. clampToGround: true
  1350. }
  1351. });
  1352. if (options2.label) {
  1353. let label2 = options2.label || {};
  1354. label2.text = Cesium.defaultValue(label2.text, "");
  1355. label2.font = Cesium.defaultValue(label2.font, "24px Helvetica");
  1356. if (label2.fillColor instanceof Cesium.Color) {
  1357. label2.fillColor = label2.outlineColor;
  1358. } else if (label2.fillColor instanceof Array) {
  1359. label2.fillColor = new Cesium.Color(label2.fillColor[0] / 255, label2.fillColor[1] / 255, label2.fillColor[2] / 255, label2.fillColor[3]);
  1360. } else if (typeof label2.fillColor === "string") {
  1361. label2.fillColor = new Cesium.Color.fromCssColorString(label2.fillColor);
  1362. } else {
  1363. label2.fillColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1364. }
  1365. if (label2.outlineColor instanceof Cesium.Color) {
  1366. label2.outlineColor = label2.outlineColor;
  1367. } else if (label2.outlineColor instanceof Array) {
  1368. label2.outlineColor = new Cesium.Color(label2.outlineColor[0] / 255, label2.outlineColor[1] / 255, label2.outlineColor[2] / 255, label2.outlineColor[3]);
  1369. } else if (typeof label2.outlineColor === "string") {
  1370. label2.outlineColor = new Cesium.Color.fromCssColorString(label2.outlineColor);
  1371. } else {
  1372. label2.outlineColor = new Cesium.Color.fromCssColorString("#FFF");
  1373. }
  1374. label2.outlineWidth = Cesium.defaultValue(label2.outlineWidth, 1);
  1375. label2.showBackground = Cesium.defaultValue(label2.showBackground, false);
  1376. if (label2.backgroundColor instanceof Cesium.Color) {
  1377. label2.backgroundColor = label2.backgroundColor;
  1378. } else if (label2.backgroundColor instanceof Array) {
  1379. label2.backgroundColor = new Cesium.Color(label2.backgroundColor[0] / 255, label2.backgroundColor[1] / 255, label2.backgroundColor[2] / 255, label2.backgroundColor[3]);
  1380. } else if (typeof label2.backgroundColor === "string") {
  1381. label2.backgroundColor = new Cesium.Color.fromCssColorString(label2.backgroundColor);
  1382. } else {
  1383. label2.backgroundColor = new Cesium.Color.fromCssColorString("#FFF");
  1384. }
  1385. if (label2.backgroundPadding) {
  1386. label2.backgroundPadding = new Cesium.Cartesian2(label2.backgroundPadding, label2.backgroundPadding);
  1387. }
  1388. entity.label = {
  1389. text: label2.text,
  1390. font: label2.font,
  1391. fillColor: label2.fillColor,
  1392. outlineColor: label2.outlineColor,
  1393. outlineWidth: label2.outlineWidth,
  1394. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  1395. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  1396. showBackground: label2.showBackground,
  1397. backgroundColor: label2.backgroundColor,
  1398. backgroundPadding: new Cesium.Cartesian2(6, 6),
  1399. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  1400. clampToGround: true
  1401. };
  1402. if (label2.pixelOffset) {
  1403. label2.pixelOffset.x = Cesium.defaultValue(label2.pixelOffset.x, 0);
  1404. label2.pixelOffset.y = Cesium.defaultValue(label2.pixelOffset.y, 0);
  1405. entity.label.pixelOffset = new Cesium.Cartesian2(label2.pixelOffset.x, label2.pixelOffset.y);
  1406. }
  1407. if (label2.scaleByDistance) {
  1408. label2.scaleByDistance.near = Cesium.defaultValue(label2.scaleByDistance.near, 0);
  1409. label2.scaleByDistance.nearValue = Cesium.defaultValue(label2.scaleByDistance.nearValue, 0);
  1410. label2.scaleByDistance.far = Cesium.defaultValue(label2.scaleByDistance.far, 1);
  1411. label2.scaleByDistance.farValue = Cesium.defaultValue(label2.scaleByDistance.farValue, 0);
  1412. entity.label.scaleByDistance = new Cesium.NearFarScalar(label2.scaleByDistance.near, label2.scaleByDistance.nearValue, label2.scaleByDistance.far, label2.scaleByDistance.farValue);
  1413. }
  1414. }
  1415. resolve2(entity);
  1416. });
  1417. },
  1418. addBillboard(points2, options2) {
  1419. return new Promise((resolve2, reject2) => {
  1420. if (!Cesium.defined(points2)) {
  1421. throw new Cesium.DeveloperError("points is required.");
  1422. }
  1423. let position2;
  1424. if (points2 instanceof Cesium.Cartesian3) {
  1425. position2 = points2;
  1426. } else {
  1427. position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], points2[2] || 0);
  1428. }
  1429. options2 = options2 || {};
  1430. options2.id = options2.id || setSessionid$1();
  1431. let billboard = options2.billboard || {};
  1432. billboard.image = billboard.imgUrl || "jt3dSDK/imgs/point/point3.png";
  1433. billboard.scale = Cesium.defaultValue(billboard.scale, 1);
  1434. let entity = new Cesium.Entity({
  1435. name: "add billboard",
  1436. position: position2,
  1437. billboard: {
  1438. image: billboard.image,
  1439. horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
  1440. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  1441. scale: billboard.scale,
  1442. disableDepthTestDistance: Number.POSITIVE_INFINITY
  1443. }
  1444. });
  1445. if (options2.properties) {
  1446. entity.properties = options2.properties;
  1447. }
  1448. if (billboard.pixelOffset) {
  1449. billboard.pixelOffset.x = Cesium.defaultValue(billboard.pixelOffset.x, 0);
  1450. billboard.pixelOffset.y = Cesium.defaultValue(billboard.pixelOffset.y, 0);
  1451. entity.billboard.pixelOffset = new Cesium.Cartesian2(billboard.pixelOffset.x, billboard.pixelOffset.y);
  1452. }
  1453. if (billboard.scaleByDistance) {
  1454. billboard.scaleByDistance.near = Cesium.defaultValue(billboard.scaleByDistance.near, 0);
  1455. billboard.scaleByDistance.nearValue = Cesium.defaultValue(billboard.scaleByDistance.nearValue, 0);
  1456. billboard.scaleByDistance.far = Cesium.defaultValue(billboard.scaleByDistance.far, 1);
  1457. billboard.scaleByDistance.farValue = Cesium.defaultValue(billboard.scaleByDistance.farValue, 0);
  1458. entity.billboard.scaleByDistance = new Cesium.NearFarScalar(billboard.scaleByDistance.near, billboard.scaleByDistance.nearValue, billboard.scaleByDistance.far, billboard.scaleByDistance.farValue);
  1459. }
  1460. if (options2.label) {
  1461. let label2 = options2.label || {};
  1462. label2.text = Cesium.defaultValue(label2.text, "");
  1463. label2.font = Cesium.defaultValue(label2.font, "24px Helvetica");
  1464. if (label2.fillColor instanceof Cesium.Color) {
  1465. label2.fillColor = label2.fillColor;
  1466. } else if (label2.fillColor instanceof Array) {
  1467. label2.fillColor = new Cesium.Color(label2.fillColor[0] / 255, label2.fillColor[1] / 255, label2.fillColor[2] / 255, label2.fillColor[3]);
  1468. } else if (typeof label2.fillColor === "string") {
  1469. label2.fillColor = new Cesium.Color.fromCssColorString(label2.fillColor);
  1470. } else {
  1471. label2.fillColor = new Cesium.Color.fromCssColorString("#ff0000");
  1472. }
  1473. if (label2.outlineColor instanceof Cesium.Color) {
  1474. label2.outlineColor = label2.outlineColor;
  1475. } else if (label2.outlineColor instanceof Array) {
  1476. label2.outlineColor = new Cesium.Color(label2.outlineColor[0] / 255, label2.outlineColor[1] / 255, label2.outlineColor[2] / 255, label2.outlineColor[3]);
  1477. } else if (typeof label2.outlineColor === "string") {
  1478. label2.outlineColor = new Cesium.Color.fromCssColorString(label2.outlineColor);
  1479. } else {
  1480. label2.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1481. }
  1482. label2.outlineWidth = Cesium.defaultValue(label2.outlineWidth, 1);
  1483. label2.showBackground = Cesium.defaultValue(label2.showBackground, false);
  1484. if (label2.backgroundColor instanceof Cesium.Color) {
  1485. label2.backgroundColor = label2.backgroundColor;
  1486. } else if (label2.backgroundColor instanceof Array) {
  1487. label2.backgroundColor = new Cesium.Color(label2.backgroundColor[0] / 255, label2.backgroundColor[1] / 255, label2.backgroundColor[2] / 255, label2.backgroundColor[3]);
  1488. } else if (typeof label2.backgroundColor === "string") {
  1489. label2.backgroundColor = new Cesium.Color.fromCssColorString(label2.backgroundColor);
  1490. } else {
  1491. label2.backgroundColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1492. }
  1493. if (label2.backgroundPadding) {
  1494. label2.backgroundPadding = new Cesium.Cartesian2(label2.backgroundPadding, label2.backgroundPadding);
  1495. }
  1496. entity.label = {
  1497. text: label2.text,
  1498. font: label2.font,
  1499. fillColor: label2.fillColor,
  1500. outlineColor: label2.outlineColor,
  1501. outlineWidth: label2.outlineWidth,
  1502. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  1503. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  1504. showBackground: label2.showBackground,
  1505. backgroundColor: label2.backgroundColor,
  1506. backgroundPadding: label2.backgroundPadding,
  1507. disableDepthTestDistance: Number.POSITIVE_INFINITY
  1508. };
  1509. if (label2.pixelOffset) {
  1510. label2.pixelOffset.x = Cesium.defaultValue(label2.pixelOffset.x, 0);
  1511. label2.pixelOffset.y = Cesium.defaultValue(label2.pixelOffset.y, 0);
  1512. entity.label.pixelOffset = new Cesium.Cartesian2(label2.pixelOffset.x, label2.pixelOffset.y);
  1513. }
  1514. if (label2.scaleByDistance) {
  1515. label2.scaleByDistance.near = Cesium.defaultValue(label2.scaleByDistance.near, 0);
  1516. label2.scaleByDistance.nearValue = Cesium.defaultValue(label2.scaleByDistance.nearValue, 0);
  1517. label2.scaleByDistance.far = Cesium.defaultValue(label2.scaleByDistance.far, 1);
  1518. label2.scaleByDistance.farValue = Cesium.defaultValue(label2.scaleByDistance.farValue, 0);
  1519. entity.label.scaleByDistance = new Cesium.NearFarScalar(label2.scaleByDistance.near, label2.scaleByDistance.nearValue, label2.scaleByDistance.far, label2.scaleByDistance.farValue);
  1520. }
  1521. }
  1522. resolve2(entity);
  1523. });
  1524. },
  1525. addModel: function(points2, options2) {
  1526. this._viewer;
  1527. return new Promise((resolve2, reject2) => {
  1528. if (!Cesium.defined(points2)) {
  1529. throw new Cesium.DeveloperError("points is required.");
  1530. }
  1531. let position2;
  1532. if (points2 instanceof Cesium.Cartesian3) {
  1533. position2 = points2;
  1534. } else {
  1535. position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], points2[2] || 0);
  1536. }
  1537. options2 = options2 || {};
  1538. options2.id = options2.id || setSessionid$1();
  1539. let model = options2.model || {};
  1540. model.alpha = Cesium.defaultValue(model.alpha, 1);
  1541. model.heading = Cesium.defaultValue(model.heading, 0);
  1542. model.pitch = Cesium.defaultValue(model.pitch, 0);
  1543. model.roll = Cesium.defaultValue(model.roll, 0);
  1544. var heading = Cesium.Math.toRadians(model.heading);
  1545. var pitch = model.pitch;
  1546. var roll = model.roll;
  1547. new Cesium.HeadingPitchRoll(heading, pitch, roll);
  1548. let entity = new Cesium.Entity({
  1549. position: position2,
  1550. model: {
  1551. uri: model.url,
  1552. incrementallyLoadTextures: true,
  1553. colorBlendMode: Cesium.ColorBlendMode["HIGHLIGHT"],
  1554. colorBlendAmount: 0.1,
  1555. color: Cesium.Color.WHITE.withAlpha(model.alpha),
  1556. imageBasedLightingFactor: new Cesium.Cartesian2(12, 13),
  1557. runAnimations: true,
  1558. show: true,
  1559. debugWireframe: false,
  1560. debugShowBoundingVolume: false,
  1561. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
  1562. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  1563. clampToGround: true
  1564. }
  1565. });
  1566. if (model.minimumPixelSize) {
  1567. entity.model.minimumPixelSize = model.minimumPixelSize;
  1568. }
  1569. if (model.maximumScale) {
  1570. entity.model.maximumScale = model.maximumScale;
  1571. }
  1572. if (options2.silhouetteColor) {
  1573. if (model.silhouetteColor instanceof Cesium.Color) {
  1574. model.silhouetteColor = model.silhouetteColor;
  1575. } else if (model.silhouetteColor instanceof Array) {
  1576. model.silhouetteColor = new Cesium.Color(model.silhouetteColor[0] / 255, model.silhouetteColor[1] / 255, model.silhouetteColor[2] / 255, model.silhouetteColor[3]);
  1577. } else if (typeof model.silhouetteColor === "string") {
  1578. model.silhouetteColor = new Cesium.Color.fromCssColorString(model.silhouetteColor);
  1579. } else {
  1580. model.silhouetteColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1581. }
  1582. }
  1583. model.silhouetteSize = Cesium.defaultValue(model.silhouetteSize, 1);
  1584. resolve2(entity);
  1585. });
  1586. },
  1587. generatePoint(points2, options2) {
  1588. return new Promise((resolve2, reject2) => {
  1589. let _self = this;
  1590. if (!Cesium.defined(points2)) {
  1591. throw new Cesium.DeveloperError("points is required.");
  1592. }
  1593. options2 = options2 || {};
  1594. options2.id = options2.id || setSessionid$1();
  1595. let point2 = options2.point || {};
  1596. point2.pixelSize = Cesium.defaultValue(point2.pixelSize, 10);
  1597. if (point2.color instanceof Cesium.Color) {
  1598. point2.color = point2.color;
  1599. } else if (point2.color instanceof Array) {
  1600. point2.color = new Cesium.Color(point2.color[0] / 255, point2.color[1] / 255, point2.color[2] / 255, point2.color[3]);
  1601. } else if (typeof point2.color === "string") {
  1602. point2.color = new Cesium.Color.fromCssColorString(point2.color);
  1603. } else {
  1604. point2.color = new Cesium.Color.fromCssColorString("#FFF");
  1605. }
  1606. if (point2.outlineColor instanceof Cesium.Color) {
  1607. point2.outlineColor = point2.outlineColor;
  1608. } else if (point2.outlineColor instanceof Array) {
  1609. point2.outlineColor = new Cesium.Color(point2.outlineColor[0] / 255, point2.outlineColor[1] / 255, point2.outlineColor[2] / 255, point2.outlineColor[3]);
  1610. } else if (typeof point2.outlineColor === "string") {
  1611. point2.outlineColor = new Cesium.Color.fromCssColorString(point2.outlineColor);
  1612. } else {
  1613. point2.outlineColor = new Cesium.Color.fromCssColorString("#FFF");
  1614. }
  1615. point2.outlineWidth = Cesium.defaultValue(point2.outlineWidth, 1);
  1616. let terrainAltitude = getHeigthByPointsMostDetailed(_self._viewer, [points2]);
  1617. terrainAltitude.then(function(updatedPositions) {
  1618. let position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], updatedPositions[0].height);
  1619. let entity = new Cesium.Entity({
  1620. id: options2.id,
  1621. position: position2,
  1622. point: {
  1623. pixelSize: point2.pixelSize,
  1624. color: point2.color,
  1625. outlineColor: point2.outlineColor,
  1626. outlineWidth: point2.outlineWidth,
  1627. heightReference: Cesium.HeightReference.NONE,
  1628. disableDepthTestDistance: updatedPositions[0].height,
  1629. clampToGround: true
  1630. }
  1631. });
  1632. if (options2.label) {
  1633. let label2 = options2.label || {};
  1634. label2.text = Cesium.defaultValue(label2.text, "");
  1635. label2.font = Cesium.defaultValue(label2.font, "24px Helvetica");
  1636. if (label2.fillColor instanceof Cesium.Color) {
  1637. label2.fillColor = label2.fillColor;
  1638. } else if (label2.fillColor instanceof Array) {
  1639. label2.fillColor = new Cesium.Color(label2.fillColor[0] / 255, label2.fillColor[1] / 255, label2.fillColor[2] / 255, label2.fillColor[3]);
  1640. } else if (typeof label2.fillColor === "string") {
  1641. label2.fillColor = new Cesium.Color.fromCssColorString(label2.fillColor);
  1642. } else {
  1643. label2.fillColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1644. }
  1645. if (label2.outlineColor instanceof Cesium.Color) {
  1646. label2.outlineColor = label2.outlineColor;
  1647. } else if (label2.outlineColor instanceof Array) {
  1648. label2.outlineColor = new Cesium.Color(label2.outlineColor[0] / 255, label2.outlineColor[1] / 255, label2.outlineColor[2] / 255, label2.outlineColor[3]);
  1649. } else if (typeof label2.outlineColor === "string") {
  1650. label2.outlineColor = new Cesium.Color.fromCssColorString(label2.outlineColor);
  1651. } else {
  1652. label2.outlineColor = new Cesium.Color.fromCssColorString("#FFF");
  1653. }
  1654. label2.outlineWidth = Cesium.defaultValue(label2.outlineWidth, 1);
  1655. label2.showBackground = Cesium.defaultValue(label2.showBackground, false);
  1656. if (label2.backgroundColor instanceof Cesium.Color) {
  1657. label2.backgroundColor = label2.backgroundColor;
  1658. } else if (label2.backgroundColor instanceof Array) {
  1659. label2.backgroundColor = new Cesium.Color(label2.backgroundColor[0] / 255, label2.backgroundColor[1] / 255, label2.backgroundColor[2] / 255, label2.backgroundColor[3]);
  1660. } else if (typeof label2.backgroundColor === "string") {
  1661. label2.backgroundColor = new Cesium.Color.fromCssColorString(label2.backgroundColor);
  1662. } else {
  1663. label2.backgroundColor = new Cesium.Color.fromCssColorString("#FFF");
  1664. }
  1665. label2.scale = Cesium.defaultValue(label2.scale, 1);
  1666. entity.label = {
  1667. text: label2.text,
  1668. font: label2.font,
  1669. fillColor: label2.fillColor,
  1670. outlineColor: label2.outlineColor,
  1671. outlineWidth: label2.outlineWidth,
  1672. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  1673. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  1674. showBackground: label2.showBackground,
  1675. backgroundColor: label2.backgroundColor,
  1676. backgroundPadding: new Cesium.Cartesian2(6, 6),
  1677. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  1678. scale: label2.scale,
  1679. clampToGround: true
  1680. };
  1681. if (label2.pixelOffset) {
  1682. label2.pixelOffset.x = Cesium.defaultValue(label2.pixelOffset.x, 0);
  1683. label2.pixelOffset.y = Cesium.defaultValue(label2.pixelOffset.y, 0);
  1684. entity.label.pixelOffset = new Cesium.Cartesian2(label2.pixelOffset.x, label2.pixelOffset.y);
  1685. }
  1686. if (label2.scaleByDistance) {
  1687. label2.scaleByDistance.near = Cesium.defaultValue(label2.scaleByDistance.near, 0);
  1688. label2.scaleByDistance.nearValue = Cesium.defaultValue(label2.scaleByDistance.nearValue, 0);
  1689. label2.scaleByDistance.far = Cesium.defaultValue(label2.scaleByDistance.far, 1);
  1690. label2.scaleByDistance.farValue = Cesium.defaultValue(label2.scaleByDistance.farValue, 0);
  1691. entity.label.scaleByDistance = new Cesium.NearFarScalar(label2.scaleByDistance.near, label2.scaleByDistance.nearValue, label2.scaleByDistance.far, label2.scaleByDistance.farValue);
  1692. }
  1693. }
  1694. resolve2(entity);
  1695. });
  1696. });
  1697. },
  1698. addBillboardByGeoJson: function(geoJsonUrl, options2) {
  1699. return new Promise((resolve2, reject2) => {
  1700. let viewer2 = this._viewer;
  1701. if (!Cesium.defined(geoJsonUrl)) {
  1702. throw new Cesium.DeveloperError("geoJsonUrl is required.");
  1703. }
  1704. options2 = options2 || {};
  1705. options2.id = options2.id || setSessionid$1();
  1706. let billboard = options2.billboard || {};
  1707. billboard.imgUrl = Cesium.defaultValue(billboard.imgUrl, "jt3dSDK/imgs/point/point3.png");
  1708. billboard.scale = Cesium.defaultValue(billboard.scale, 1);
  1709. let label2 = options2.label || {};
  1710. label2.text = Cesium.defaultValue(label2.text, "");
  1711. label2.textField = Cesium.defaultValue(label2.textField, "");
  1712. label2.font = Cesium.defaultValue(label2.font, "24px Helvetica");
  1713. if (label2.fillColor instanceof Cesium.Color) {
  1714. label2.fillColor = label2.fillColor;
  1715. } else if (label2.fillColor instanceof Array) {
  1716. label2.fillColor = new Cesium.Color(label2.fillColor[0] / 255, label2.fillColor[1] / 255, label2.fillColor[2] / 255, label2.fillColor[3]);
  1717. } else if (typeof label2.fillColor === "string") {
  1718. label2.fillColor = new Cesium.Color.fromCssColorString(label2.fillColor);
  1719. } else {
  1720. label2.fillColor = new Cesium.Color.fromCssColorString("#ff0000");
  1721. }
  1722. if (label2.outlineColor instanceof Cesium.Color) {
  1723. label2.outlineColor = label2.outlineColor;
  1724. } else if (label2.outlineColor instanceof Array) {
  1725. label2.outlineColor = new Cesium.Color(label2.outlineColor[0] / 255, label2.outlineColor[1] / 255, label2.outlineColor[2] / 255, label2.outlineColor[3]);
  1726. } else if (typeof label2.outlineColor === "string") {
  1727. label2.outlineColor = new Cesium.Color.fromCssColorString(label2.outlineColor);
  1728. } else {
  1729. label2.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1730. }
  1731. label2.outlineWidth = Cesium.defaultValue(label2.outlineWidth, 1);
  1732. label2.showBackground = Cesium.defaultValue(label2.showBackground, false);
  1733. if (label2.backgroundColor instanceof Cesium.Color) {
  1734. label2.backgroundColor = label2.backgroundColor;
  1735. } else if (label2.backgroundColor instanceof Array) {
  1736. label2.backgroundColor = new Cesium.Color(label2.backgroundColor[0] / 255, label2.backgroundColor[1] / 255, label2.backgroundColor[2] / 255, label2.backgroundColor[3]);
  1737. } else if (typeof label2.backgroundColor === "string") {
  1738. label2.backgroundColor = new Cesium.Color.fromCssColorString(label2.backgroundColor);
  1739. } else {
  1740. label2.backgroundColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1741. }
  1742. label2.scale = Cesium.defaultValue(label2.scale, 1);
  1743. const dataSource = new Cesium.GeoJsonDataSource(options2.id);
  1744. dataSource.load(geoJsonUrl, {
  1745. clampToGround: true
  1746. }).then(function(data) {
  1747. viewer2.dataSources.add(data);
  1748. const entities2 = data.entities.values;
  1749. entities2.forEach((entity) => {
  1750. entity.billboard = {
  1751. image: billboard.imgUrl,
  1752. horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
  1753. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  1754. scale: billboard.scale,
  1755. disableDepthTestDistance: Number.POSITIVE_INFINITY
  1756. };
  1757. let labelText = label2.text;
  1758. if (entity.properties[label2.textField]) {
  1759. labelText = entity.properties[label2.textField]._value;
  1760. }
  1761. if (labelText === "") {
  1762. labelText = (i + 1).toString();
  1763. }
  1764. entity.label = {
  1765. text: labelText.toString(),
  1766. font: label2.font,
  1767. fillColor: label2.fillColor,
  1768. outlineColor: label2.outlineColor,
  1769. outlineWidth: label2.outlineWidth,
  1770. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  1771. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  1772. showBackground: label2.showBackground,
  1773. backgroundColor: label2.backgroundColor,
  1774. backgroundPadding: new Cesium.Cartesian2(6, 6),
  1775. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  1776. scale: label2.scale
  1777. };
  1778. if (label2.scaleByDistance) {
  1779. label2.scaleByDistance.near = Cesium.defaultValue(label2.scaleByDistance.near, 0);
  1780. label2.scaleByDistance.nearValue = Cesium.defaultValue(label2.scaleByDistance.nearValue, 0);
  1781. label2.scaleByDistance.far = Cesium.defaultValue(label2.scaleByDistance.far, 1);
  1782. label2.scaleByDistance.farValue = Cesium.defaultValue(label2.scaleByDistance.farValue, 0);
  1783. entity.label.scaleByDistance = new Cesium.NearFarScalar(label2.scaleByDistance.near, label2.scaleByDistance.nearValue, label2.scaleByDistance.far, label2.scaleByDistance.farValue);
  1784. }
  1785. });
  1786. });
  1787. });
  1788. },
  1789. addGltf: function(options2) {
  1790. let viewer2 = this._viewer;
  1791. return new Promise((resolve2, reject2) => {
  1792. if (!Cesium.defined(options2.points)) {
  1793. resolve2("options.points is required.");
  1794. throw new Cesium.DeveloperError("options.points is required.");
  1795. }
  1796. if (!Cesium.defined(options2.url)) {
  1797. resolve2("options.url is required.");
  1798. throw new Cesium.DeveloperError("options.url is required.");
  1799. }
  1800. options2.id = options2.id || setSessionid$1();
  1801. options2.heading = Cesium.defaultValue(options2.heading, 0);
  1802. options2.pitch = Cesium.defaultValue(options2.pitch, 0);
  1803. options2.roll = Cesium.defaultValue(options2.roll, 0);
  1804. options2.alpha = Cesium.defaultValue(options2.alpha, 1);
  1805. let position2 = void 0;
  1806. if (options2.points instanceof Cesium.Cartesian3) {
  1807. position2 = options2.points;
  1808. } else {
  1809. position2 = Cesium.Cartesian3.fromDegrees(options2.points[0], options2.points[1], options2.points[2] || 0);
  1810. }
  1811. var heading = Cesium.Math.toRadians(options2.heading);
  1812. var pitch = options2.pitch;
  1813. var roll = options2.roll;
  1814. var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
  1815. var modelGltf = viewer2.entities.add({
  1816. id: options2.id,
  1817. position: position2,
  1818. orientation: Cesium.Transforms.headingPitchRollQuaternion(position2, hpr),
  1819. model: {
  1820. uri: options2.url,
  1821. incrementallyLoadTextures: true,
  1822. colorBlendMode: Cesium.ColorBlendMode["HIGHLIGHT"],
  1823. colorBlendAmount: 0.1,
  1824. color: Cesium.Color.WHITE.withAlpha(options2.alpha),
  1825. imageBasedLightingFactor: new Cesium.Cartesian2(12, 13),
  1826. runAnimations: true,
  1827. show: true,
  1828. debugWireframe: false,
  1829. debugShowBoundingVolume: false
  1830. }
  1831. });
  1832. if (options2.minimumPixelSize) {
  1833. modelGltf.model.minimumPixelSize = options2.minimumPixelSize;
  1834. }
  1835. if (options2.maximumScale) {
  1836. modelGltf.model.maximumScale = options2.maximumScale;
  1837. }
  1838. if (options2.silhouetteColor) {
  1839. if (options2.silhouetteColor instanceof Cesium.Color) {
  1840. options2.silhouetteColor = label.silhouetteColor;
  1841. } else if (options2.silhouetteColor instanceof Array) {
  1842. options2.silhouetteColor = new Cesium.Color(options2.silhouetteColor[0] / 255, options2.silhouetteColor[1] / 255, options2.silhouetteColor[2] / 255, options2.silhouetteColor[3]);
  1843. } else if (typeof options2.silhouetteColor === "string") {
  1844. options2.silhouetteColor = new Cesium.Color.fromCssColorString(options2.silhouetteColor);
  1845. } else {
  1846. options2.silhouetteColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1847. }
  1848. }
  1849. window[options2.id] = modelGltf;
  1850. resolve2(options2.id);
  1851. });
  1852. },
  1853. addModelFromGltf(points2, options2) {
  1854. let viewer2 = this._viewer;
  1855. return new Promise((resolve2, reject2) => {
  1856. if (!Cesium.defined(options2.points)) {
  1857. resolve2("options.points is required.");
  1858. throw new Cesium.DeveloperError("options.points is required.");
  1859. }
  1860. if (!Cesium.defined(options2.url)) {
  1861. resolve2("options.url is required.");
  1862. throw new Cesium.DeveloperError("options.url is required.");
  1863. }
  1864. options2.id = options2.id || setSessionid$1();
  1865. options2.scale = Cesium.defaultValue(options2.scale, 1);
  1866. let position2 = void 0;
  1867. if (options2.points instanceof Cesium.Cartesian3) {
  1868. position2 = options2.points;
  1869. } else {
  1870. position2 = Cesium.Cartesian3.fromDegrees(options2.points[0], options2.points[1], options2.points[2] || 0);
  1871. }
  1872. const modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(position2);
  1873. let model = viewer2.scene.primitives.add(
  1874. Cesium.Model.fromGltf({
  1875. show: true,
  1876. url: options2.url,
  1877. modelMatrix,
  1878. lightColor: new Cesium.Cartesian3(10, 10, 10),
  1879. debugWireframe: false,
  1880. debugShowBoundingVolume: false
  1881. })
  1882. );
  1883. model.readyPromise.then(function() {
  1884. var rotationX = Cesium.Matrix4.fromRotationTranslation(Cesium.Matrix3.fromRotationZ(Cesium.Math.toRadians(0)));
  1885. Cesium.Matrix4.multiply(model.modelMatrix, rotationX, model.modelMatrix);
  1886. });
  1887. window[options2.id] = model;
  1888. resolve2(options2.id);
  1889. });
  1890. }
  1891. });
  1892. class PolylineObject {
  1893. constructor(viewer2) {
  1894. if (!viewer2)
  1895. throw new Cesium.DeveloperError("no viewer object!");
  1896. this._viewer = viewer2;
  1897. }
  1898. }
  1899. Object.assign(PolylineObject.prototype, {
  1900. addPolyline: function(points2, options2) {
  1901. this._viewer;
  1902. return new Promise((resolve2, reject2) => {
  1903. if (!Cesium.defined(points2)) {
  1904. throw new Cesium.DeveloperError("points is required.");
  1905. }
  1906. if (points2.length < 2) {
  1907. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  1908. }
  1909. let positions;
  1910. if (points2[0] instanceof Cesium.Cartesian3) {
  1911. positions = points2;
  1912. } else {
  1913. positions = points2.map((point2) => {
  1914. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  1915. });
  1916. }
  1917. options2 = options2 || {};
  1918. options2 = options2 || {};
  1919. options2.id = options2.id || setSessionid$1();
  1920. options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
  1921. options2.width = Cesium.defaultValue(options2.width, 3);
  1922. options2.minHeigh = Cesium.defaultValue(options2.minHeigh, 0);
  1923. options2.maxHeigh = Cesium.defaultValue(options2.maxHeigh, 2e8);
  1924. let distanceDisplayCondition = new Cesium.DistanceDisplayCondition(options2.minHeigh, options2.maxHeigh);
  1925. let material = new PolylineDirectionMaterialProperty(options2);
  1926. let entity = new Cesium.Entity({
  1927. name: "line",
  1928. polyline: {
  1929. positions,
  1930. width: options2.width,
  1931. material,
  1932. distanceDisplayCondition
  1933. }
  1934. });
  1935. if (options2.clampToGround) {
  1936. entity.polyline.clampToGround = true;
  1937. }
  1938. resolve2(entity);
  1939. });
  1940. },
  1941. drawPolylineByGeoJson: function(geoJsonUrl, options2) {
  1942. return new Promise((resolve2, reject2) => {
  1943. let viewer2 = this._viewer;
  1944. if (!Cesium.defined(geoJsonUrl)) {
  1945. throw new Cesium.DeveloperError("geoJsonUrl is required.");
  1946. }
  1947. options2 = options2 || {};
  1948. options2.id = options2.id || setSessionid$1();
  1949. options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
  1950. options2.width = Cesium.defaultValue(options2.width, 3);
  1951. options2.minHeigh = Cesium.defaultValue(options2.minHeigh, 0);
  1952. options2.maxHeigh = Cesium.defaultValue(options2.maxHeigh, 2e8);
  1953. let promise = Cesium.GeoJsonDataSource.load(geoJsonUrl, {
  1954. clampToGround: options2.clampToGround
  1955. });
  1956. promise.then((dataSource) => {
  1957. viewer2.dataSources.add(dataSource);
  1958. dataSource.name = options2.id;
  1959. let entities2 = dataSource.entities.values;
  1960. let distanceDisplayCondition = new Cesium.DistanceDisplayCondition(options2.minHeigh, options2.maxHeigh);
  1961. let material = new PolylineDirectionMaterialProperty(options2);
  1962. for (var i2 = 0; i2 < entities2.length; i2++) {
  1963. var entity = entities2[i2];
  1964. entity.polyline.distanceDisplayCondition = distanceDisplayCondition;
  1965. entity.polyline.material = material;
  1966. entity.polyline.width = options2.width;
  1967. if (options2.clampToGround) {
  1968. entity.polyline.clampToGround = true;
  1969. }
  1970. }
  1971. resolve2(entities2);
  1972. });
  1973. });
  1974. },
  1975. PolylineLinkPulseMaterialProperty: function(points2, options2) {
  1976. return new Promise((resolve2, reject2) => {
  1977. if (!Cesium.defined(points2)) {
  1978. throw new Cesium.DeveloperError("points is required.");
  1979. }
  1980. if (points2.length < 2) {
  1981. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  1982. }
  1983. let positions = points2.map((point2) => {
  1984. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  1985. });
  1986. options2 = options2 || {};
  1987. options2.id = options2.id || setSessionid$1();
  1988. options2.width = options2.width || 5;
  1989. let material = new PolylineDirectionMaterialProperty(options2);
  1990. let entity = this._viewer.entities.add({
  1991. id: options2.id,
  1992. name: "Pulse line",
  1993. polyline: {
  1994. positions,
  1995. width: options2.width,
  1996. material,
  1997. clampToGround: true
  1998. }
  1999. });
  2000. resolve2(entity);
  2001. });
  2002. },
  2003. PolylineArrowMaterialProperty: function(points2, options2) {
  2004. return new Promise((resolve2, reject2) => {
  2005. if (!Cesium.defined(points2)) {
  2006. throw new Cesium.DeveloperError("points is required.");
  2007. }
  2008. if (points2.length < 2) {
  2009. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  2010. }
  2011. let positions = points2.map((point2) => {
  2012. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2013. });
  2014. options2 = options2 || {};
  2015. options2.id = options2.id || setSessionid$1();
  2016. options2.width = options2.width || 5;
  2017. let material = new PolylineDirectionMaterialProperty(options2);
  2018. let entity = this._viewer.entities.add({
  2019. id: options2.id,
  2020. name: "Pulse line",
  2021. polyline: {
  2022. positions,
  2023. width: options2.width,
  2024. material,
  2025. clampToGround: true
  2026. }
  2027. });
  2028. resolve2(entity);
  2029. });
  2030. },
  2031. drawGlowingLine(points2, options2) {
  2032. return new Promise((resolve2, reject2) => {
  2033. if (!Cesium.defined(points2)) {
  2034. throw new Cesium.DeveloperError("points is required.");
  2035. }
  2036. if (points2.length < 2) {
  2037. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  2038. }
  2039. let positions = points2.map((point2) => {
  2040. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2041. });
  2042. options2 = options2 || {};
  2043. options2.id = options2.id || setSessionid$1();
  2044. if (options2.color) {
  2045. if (options2.color instanceof Array) {
  2046. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  2047. } else if (typeof options2.color === "string") {
  2048. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  2049. } else {
  2050. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  2051. }
  2052. }
  2053. options2.width = options2.width || 5;
  2054. options2.glowPower = options2.glowPower || 0.25;
  2055. options2.taperPower = options2.taperPower || 1;
  2056. let entity = this._viewer.entities.add({
  2057. id: options2.id,
  2058. name: "Glowing blue line on the surface",
  2059. polyline: {
  2060. clampToGround: true,
  2061. positions,
  2062. width: options2.width,
  2063. followSurface: true,
  2064. material: new Cesium.PolylineGlowMaterialProperty({
  2065. color: options2.color,
  2066. glowPower: options2.glowPower,
  2067. taperPower: options2.taperPower
  2068. })
  2069. }
  2070. });
  2071. resolve2(entity);
  2072. });
  2073. },
  2074. drawSpecifyColorLine(points2, options2) {
  2075. return new Promise((resolve2, reject2) => {
  2076. if (!Cesium.defined(points2)) {
  2077. reject2("points is required.");
  2078. }
  2079. if (points2.length < 2) {
  2080. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  2081. }
  2082. let positions = points2.map((point2) => {
  2083. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2084. });
  2085. options2 = options2 || {};
  2086. options2.id = options2.id || setSessionid$1();
  2087. if (options2.color) {
  2088. if (options2.color instanceof Array) {
  2089. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  2090. } else if (typeof options2.color === "string") {
  2091. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  2092. } else {
  2093. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  2094. }
  2095. }
  2096. options2.width = options2.width || 5;
  2097. let entity = this._viewer.entities.add({
  2098. id: options2.id,
  2099. name: "Red line on the surface",
  2100. polyline: {
  2101. clampToGround: true,
  2102. positions,
  2103. width: options2.width,
  2104. material: options2.color
  2105. }
  2106. });
  2107. resolve2(entity);
  2108. });
  2109. },
  2110. drawSpecifyColorAndOutlineColorLine(points2, options2) {
  2111. return new Promise((resolve2, reject2) => {
  2112. if (!Cesium.defined(points2)) {
  2113. throw new Cesium.DeveloperError("points is required.");
  2114. }
  2115. if (points2.length < 2) {
  2116. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  2117. }
  2118. let positions = points2.map((point2) => {
  2119. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2120. });
  2121. options2 = options2 || {};
  2122. options2.id = options2.id || setSessionid$1();
  2123. if (options2.color) {
  2124. if (options2.color instanceof Array) {
  2125. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  2126. } else if (typeof options2.color === "string") {
  2127. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  2128. } else {
  2129. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  2130. }
  2131. }
  2132. options2.width = options2.width || 5;
  2133. if (options2.outlineColor) {
  2134. if (options2.outlineColor instanceof Array) {
  2135. options2.outlineColor = new Cesium.Color(options2.outlineColor[0] / 255, options2.outlineColor[1] / 255, options2.outlineColor[2] / 255, options2.outlineColor[3]);
  2136. } else if (typeof options2.outlineColor === "string") {
  2137. options2.outlineColor = new Cesium.Color.fromCssColorString(options2.outlineColor);
  2138. } else {
  2139. options2.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  2140. }
  2141. }
  2142. options2.outlineWidth = Cesium.defaultValue(options2.outlineWidth, 1);
  2143. let entity = this._viewer.entities.add({
  2144. id: options2.id,
  2145. name: "Orange line with black outline at height and following the surface",
  2146. polyline: {
  2147. clampToGround: true,
  2148. positions,
  2149. width: options2.width,
  2150. material: new Cesium.PolylineOutlineMaterialProperty({
  2151. color: options2.color,
  2152. outlineWidth: options2.outlineWidth,
  2153. outlineColor: options2.outlineColor
  2154. })
  2155. }
  2156. });
  2157. resolve2(entity);
  2158. });
  2159. },
  2160. drawSpecifyColorArrowStaticStateLine(points2, options2) {
  2161. return new Promise((resolve2, reject2) => {
  2162. if (!Cesium.defined(points2)) {
  2163. throw new Cesium.DeveloperError("points is required.");
  2164. }
  2165. if (points2.length < 2) {
  2166. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  2167. }
  2168. let positions = points2.map((point2) => {
  2169. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2170. });
  2171. options2 = options2 || {};
  2172. options2.id = options2.id || setSessionid$1();
  2173. if (options2.color) {
  2174. if (options2.color instanceof Array) {
  2175. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  2176. } else if (typeof options2.color === "string") {
  2177. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  2178. } else {
  2179. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  2180. }
  2181. }
  2182. options2.width = options2.width || 5;
  2183. let entity = this._viewer.entities.add({
  2184. id: options2.id,
  2185. name: "Purple straight arrow at height",
  2186. polyline: {
  2187. clampToGround: true,
  2188. positions,
  2189. width: options2.width,
  2190. followSurface: false,
  2191. material: new Cesium.PolylineArrowMaterialProperty(options2.color)
  2192. }
  2193. });
  2194. resolve2(entity);
  2195. });
  2196. },
  2197. drawDashedLine(points2, options2) {
  2198. return new Promise((resolve2, reject2) => {
  2199. if (!Cesium.defined(points2)) {
  2200. throw new Cesium.DeveloperError("points is required.");
  2201. }
  2202. if (points2.length < 2) {
  2203. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  2204. }
  2205. let positions = points2.map((point2) => {
  2206. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2207. });
  2208. options2 = options2 || {};
  2209. options2.id = options2.id || setSessionid$1();
  2210. if (options2.color) {
  2211. if (options2.color instanceof Array) {
  2212. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  2213. } else if (typeof options2.color === "string") {
  2214. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  2215. } else {
  2216. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  2217. }
  2218. }
  2219. options2.width = options2.width || 5;
  2220. if (options2.gapColor) {
  2221. if (options2.gapColor instanceof Array) {
  2222. options2.gapColor = new Cesium.Color(options2.gapColor[0] / 255, options2.gapColor[1] / 255, options2.gapColor[2] / 255, options2.gapColor[3]);
  2223. } else if (typeof options2.gapColor === "string") {
  2224. options2.gapColor = new Cesium.Color.fromCssColorString(options2.gapColor);
  2225. } else {
  2226. options2.gapColor = new Cesium.Color.fromCssColorString("#FFFF00");
  2227. }
  2228. }
  2229. options2.dashLength = options2.dashLength || 16;
  2230. options2.dashPattern = options2.dashPattern || 255;
  2231. let entity = this._viewer.entities.add({
  2232. id: options2.id,
  2233. name: "CYAN dashed line",
  2234. polyline: {
  2235. clampToGround: true,
  2236. positions,
  2237. width: options2.width,
  2238. material: new Cesium.PolylineDashMaterialProperty({
  2239. color: options2.color,
  2240. gapColor: options2.gapColor,
  2241. dashLength: options2.dashLength,
  2242. dashPattern: options2.dashPattern
  2243. })
  2244. }
  2245. });
  2246. resolve2(entity);
  2247. });
  2248. }
  2249. });
  2250. function DynamicWallMaterialProperty(options2) {
  2251. this._definitionChanged = new Cesium.Event();
  2252. this._color = void 0;
  2253. this._colorSubscription = void 0;
  2254. this.color = options2.color || Color.BLUE;
  2255. this.duration = options2.duration || 1e3;
  2256. this.trailImage = options2.trailImage;
  2257. this._time = new Date().getTime();
  2258. }
  2259. function _getDirectionWallShader(options2) {
  2260. if (options2 && options2.get) {
  2261. var materail = "czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;";
  2262. if (options2.direction == "vertical") {
  2263. materail += "vec4 colorImage = texture2D(image, vec2(fract(st.s), fract(float(" + options2.count + ")*st.t" + options2.order + " time)));\n ";
  2264. } else {
  2265. materail += "vec4 colorImage = texture2D(image, vec2(fract(float(" + options2.count + ")*st.s " + options2.order + " time), fract(st.t)));\n ";
  2266. }
  2267. materail += "vec4 fragColor;\n fragColor.rgb = (colorImage.rgb+color.rgb) / 1.0;\n fragColor = czm_gammaCorrect(fragColor);\n material.diffuse = colorImage.rgb;\n material.alpha = colorImage.a;\n material.emission = fragColor.rgb;\n return material;\n }";
  2268. return materail;
  2269. }
  2270. }
  2271. Object.defineProperties(DynamicWallMaterialProperty.prototype, {
  2272. isConstant: {
  2273. get: function() {
  2274. return false;
  2275. }
  2276. },
  2277. definitionChanged: {
  2278. get: function() {
  2279. return this._definitionChanged;
  2280. }
  2281. },
  2282. color: Cesium.createPropertyDescriptor("color")
  2283. });
  2284. var MaterialType = "wallType" + parseInt(Math.random() * 1e3);
  2285. DynamicWallMaterialProperty.prototype.getType = function(time) {
  2286. return MaterialType;
  2287. };
  2288. DynamicWallMaterialProperty.prototype.getValue = function(time, result) {
  2289. if (!Cesium.defined(result)) {
  2290. result = {};
  2291. }
  2292. result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.WHITE, result.color);
  2293. result.image = this.trailImage;
  2294. if (this.duration) {
  2295. result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
  2296. }
  2297. viewer.scene.requestRender();
  2298. return result;
  2299. };
  2300. DynamicWallMaterialProperty.prototype.equals = function(other) {
  2301. return this === other || other instanceof DynamicWallMaterialProperty && Cesium.Property.equals(this._color, other._color);
  2302. };
  2303. Cesium.Material._materialCache.addMaterial(MaterialType, {
  2304. fabric: {
  2305. type: MaterialType,
  2306. uniforms: {
  2307. color: new Cesium.Color(1, 0, 0, 0.5),
  2308. image: Cesium.Material.DefaultImageId,
  2309. time: -20
  2310. },
  2311. source: _getDirectionWallShader({
  2312. get: true,
  2313. count: 3,
  2314. direction: "vertical",
  2315. order: "-"
  2316. })
  2317. },
  2318. translucent: function(material) {
  2319. return true;
  2320. }
  2321. });
  2322. Cesium.DynamicWallMaterialProperty = DynamicWallMaterialProperty;
  2323. class WallDiffuseMaterialProperty {
  2324. constructor(options2) {
  2325. this._definitionChanged = new Cesium.Event();
  2326. this._color = void 0;
  2327. this.color = options2.color;
  2328. }
  2329. get isConstant() {
  2330. return false;
  2331. }
  2332. get definitionChanged() {
  2333. return this._definitionChanged;
  2334. }
  2335. getType(time) {
  2336. return Cesium.Material.WallDiffuseMaterialType;
  2337. }
  2338. getValue(time, result) {
  2339. if (!Cesium.defined(result)) {
  2340. result = {};
  2341. }
  2342. result.color = Cesium.Property.getValueOrDefault(this._color, time, Cesium.Color.RED, result.color);
  2343. return result;
  2344. }
  2345. equals(other) {
  2346. return this === other || other instanceof WallDiffuseMaterialProperty && Cesium.Property.equals(this._color, other._color);
  2347. }
  2348. }
  2349. Object.defineProperties(WallDiffuseMaterialProperty.prototype, {
  2350. color: Cesium.createPropertyDescriptor("color")
  2351. });
  2352. Cesium.WallDiffuseMaterialProperty = WallDiffuseMaterialProperty;
  2353. Cesium.Material.WallDiffuseMaterialProperty = "WallDiffuseMaterialProperty";
  2354. Cesium.Material.WallDiffuseMaterialType = "WallDiffuseMaterialType";
  2355. Cesium.Material.WallDiffuseMaterialSource = `
  2356. uniform vec4 color;
  2357. czm_material czm_getMaterial(czm_materialInput materialInput){
  2358. czm_material material = czm_getDefaultMaterial(materialInput);
  2359. vec2 st = materialInput.st;
  2360. material.diffuse = color.rgb * 2.0;
  2361. material.alpha = color.a * (1.0 - fract(st.t)) * 0.8;
  2362. return material;
  2363. }
  2364. `;
  2365. Cesium.Material._materialCache.addMaterial(Cesium.Material.WallDiffuseMaterialType, {
  2366. fabric: {
  2367. type: Cesium.Material.WallDiffuseMaterialType,
  2368. uniforms: {
  2369. color: new Cesium.Color(1, 0, 0, 1)
  2370. },
  2371. source: Cesium.Material.WallDiffuseMaterialSource
  2372. },
  2373. translucent: function(material) {
  2374. return true;
  2375. }
  2376. });
  2377. class WallObject {
  2378. constructor(viewer2) {
  2379. if (!viewer2)
  2380. throw new Cesium.DeveloperError("no viewer object!");
  2381. this._viewer = viewer2;
  2382. }
  2383. }
  2384. Object.assign(WallObject.prototype, {
  2385. drawWallByGeoJson: function(geoJsonUrl, options2) {
  2386. return new Promise((resolve2, reject2) => {
  2387. let _self = this;
  2388. let viewer2 = this._viewer;
  2389. if (!Cesium.defined(geoJsonUrl)) {
  2390. throw new Cesium.DeveloperError("geoJsonUrl is required.");
  2391. }
  2392. options2 = options2 || {};
  2393. options2.id = options2.id || setSessionid$1();
  2394. fetch(geoJsonUrl).then((res) => {
  2395. return res.json();
  2396. }).then((res) => {
  2397. let wall = new Cesium.CustomDataSource(options2.id);
  2398. viewer2.dataSources.add(wall);
  2399. for (var i2 = 0; i2 < res.features.length; i2++) {
  2400. if (res.features[i2].geometry) {
  2401. if (res.features[i2].geometry.type === "MultiLineString") {
  2402. let coordinatesList = res.features[i2].geometry.coordinates;
  2403. for (var j = 0; j < coordinatesList.length; j++) {
  2404. let coordinates = coordinatesList[j];
  2405. let positions = coordinates.map((point2) => {
  2406. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2407. });
  2408. _self.addWall(positions, options2).then((entity) => {
  2409. wall.entities.add(entity);
  2410. });
  2411. }
  2412. } else {
  2413. let coordinates = res.features[i2].geometry.coordinates;
  2414. let positions = coordinates.map((point2) => {
  2415. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2416. });
  2417. _self.addWall(positions, options2).then((entity) => {
  2418. wall.entities.add(entity);
  2419. });
  2420. }
  2421. }
  2422. }
  2423. resolve2(options2.id);
  2424. });
  2425. });
  2426. },
  2427. addWall(points2, options2) {
  2428. return new Promise((resolve2, reject2) => {
  2429. if (!Cesium.defined(points2)) {
  2430. throw new Cesium.DeveloperError("points is required.");
  2431. }
  2432. if (points2.length < 2) {
  2433. reject2("\u5899\u4F53\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  2434. }
  2435. let positions;
  2436. if (points2[0] instanceof Cesium.Cartesian3) {
  2437. positions = points2;
  2438. } else {
  2439. positions = points2.map((point2) => {
  2440. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2441. });
  2442. }
  2443. options2 = options2 || {};
  2444. options2.id = options2.id || setSessionid$1();
  2445. options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
  2446. options2.minimunHeights = options2.minimunHeights !== void 0 && typeof options2.minimunHeights === "number" ? options2.minimunHeights : 0;
  2447. options2.maximumHeights = options2.maximumHeights !== void 0 && typeof options2.maximumHeights === "number" ? options2.maximumHeights : 1e3;
  2448. if (options2.color) {
  2449. if (options2.color instanceof Cesium.Color) {
  2450. options2.color = options2.color;
  2451. } else if (options2.color instanceof Array) {
  2452. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  2453. } else if (typeof options2.color === "string") {
  2454. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  2455. } else {
  2456. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  2457. }
  2458. }
  2459. options2.trailImage = Cesium.defaultValue(options2.trailImage, "jt3dSDK/imgs/wallmaterial/wl.png");
  2460. options2.duration = Cesium.defaultValue(options2.duration, 3e3);
  2461. options2.count = Cesium.defaultValue(options2.count, 1);
  2462. options2.direction = Cesium.defaultValue(options2.direction, "vertical");
  2463. options2.order = Cesium.defaultValue(options2.order, "-");
  2464. let entity = new Cesium.Entity({
  2465. name: "\u7ACB\u4F53\u5899\u6548\u679C",
  2466. wall: {
  2467. positions,
  2468. maximumHeights: new Array(positions.length).fill(options2.maximumHeights),
  2469. minimunHeights: new Array(positions.length).fill(options2.minimunHeights),
  2470. material: new WallMaterialProperty$1(viewer, {
  2471. trailImage: options2.trailImage,
  2472. color: options2.color,
  2473. duration: options2.duration,
  2474. param: {
  2475. count: options2.count,
  2476. direction: options2.direction,
  2477. order: options2.order
  2478. }
  2479. })
  2480. }
  2481. });
  2482. resolve2(entity);
  2483. });
  2484. }
  2485. });
  2486. class LoadMapData {
  2487. constructor(viewer2) {
  2488. if (!viewer2)
  2489. throw new Cesium.DeveloperError("no viewer object!");
  2490. this._viewer = viewer2;
  2491. this._pointObject = new PointObject(viewer2);
  2492. this._polylineObject = new PolylineObject(viewer2);
  2493. this._wallObject = new WallObject(viewer2);
  2494. }
  2495. _addImageryProvider(id, provider) {
  2496. window[id] = this._viewer.imageryLayers.addImageryProvider(provider);
  2497. }
  2498. _removeImageryProvider(serviceId) {
  2499. this._viewer.imageryLayers.remove(window[serviceId]);
  2500. window[serviceId] = null;
  2501. }
  2502. _addTerrainProvider(provider) {
  2503. this._viewer.terrainProvider = provider;
  2504. }
  2505. _setEllipsoidTerrain() {
  2506. this._viewer.terrainProvider = new Cesium.EllipsoidTerrainProvider({});
  2507. }
  2508. _addScenePrimitives(scenePrimitives) {
  2509. this._viewer.scene.primitives.add(scenePrimitives);
  2510. }
  2511. _removeScenePrimitives(serviceId) {
  2512. this._viewer.scene.primitives.remove(window[serviceId]);
  2513. window[serviceId] = null;
  2514. }
  2515. _guid() {
  2516. function S4() {
  2517. return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
  2518. }
  2519. return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
  2520. }
  2521. _transformProjection(provider) {
  2522. let webMercatorTilingScheme = provider.tilingScheme;
  2523. let projection = webMercatorTilingScheme._projection;
  2524. projection.x_project = projection.project;
  2525. projection.project = function(cartographic) {
  2526. let point2;
  2527. return point2 = CoordTransform.WGS84ToGCJ02(
  2528. Cesium.Math.toDegrees(cartographic.longitude),
  2529. Cesium.Math.toDegrees(cartographic.latitude)
  2530. ), projection.x_project(
  2531. new Cesium.Cartographic(
  2532. Cesium.Math.toRadians(point2[0]),
  2533. Cesium.Math.toRadians(point2[1])
  2534. )
  2535. );
  2536. };
  2537. projection.x_unproject = projection.unproject;
  2538. projection.unproject = function(cartesian) {
  2539. let point2, cartographic = projection.x_unproject(cartesian);
  2540. return point2 = CoordTransform.GCJ02ToWGS84(
  2541. Cesium.Math.toDegrees(cartographic.longitude),
  2542. Cesium.Math.toDegrees(cartographic.latitude)
  2543. ), new Cesium.Cartographic(
  2544. Cesium.Math.toRadians(point2[0]),
  2545. Cesium.Math.toRadians(point2[1])
  2546. );
  2547. };
  2548. return provider;
  2549. }
  2550. }
  2551. Object.assign(LoadMapData.prototype, {
  2552. addTerrain(options2) {
  2553. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  2554. throw new Cesium.DeveloperError("options.url is required.");
  2555. }
  2556. let _ConstructorOptions = {
  2557. url: options2.url
  2558. };
  2559. if (options2.requestVertexNormals) {
  2560. _ConstructorOptions.requestVertexNormals = options2.requestVertexNormals;
  2561. } else {
  2562. _ConstructorOptions.requestVertexNormals = false;
  2563. }
  2564. if (options2.requestWaterMask) {
  2565. _ConstructorOptions.requestWaterMask = options2.requestWaterMask;
  2566. } else {
  2567. _ConstructorOptions.requestWaterMask = false;
  2568. }
  2569. var terrainProvider = new Cesium.CesiumTerrainProvider(_ConstructorOptions);
  2570. this._addTerrainProvider(terrainProvider);
  2571. this.setTerrainExaggeration(options2);
  2572. },
  2573. addMapboxLayer(options2, callSuccess) {
  2574. if (!Cesium.defined(options2) || !Cesium.defined(options2.styleId)) {
  2575. throw new Cesium.DeveloperError("options.styleId is required.");
  2576. }
  2577. if (!Cesium.defined(options2.accessToken)) {
  2578. throw new Cesium.DeveloperError("options.accessToken is required.");
  2579. }
  2580. options2.id = options2.id || this._guid();
  2581. var imageryProvider = new Cesium.MapboxStyleImageryProvider({
  2582. url: options2.url,
  2583. username: options2.username,
  2584. styleId: options2.styleId,
  2585. accessToken: options2.accessToken,
  2586. scaleFactor: options2.scaleFactor
  2587. });
  2588. this._addImageryProvider(options2.id, imageryProvider);
  2589. this.setLayersStyle({
  2590. serviceId: options2.id,
  2591. alpha: options2.alpha
  2592. });
  2593. if (callSuccess)
  2594. callSuccess(options2.id);
  2595. },
  2596. addUrlTemplateImagery: function(options2, callSuccess) {
  2597. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  2598. throw new Cesium.DeveloperError("options.url is required.");
  2599. }
  2600. options2.id = options2.id || this._guid();
  2601. options2.CRS = options2.CRS || "";
  2602. let _ConstructorOptions = {
  2603. url: options2.url
  2604. };
  2605. if (options2.minimumLevel) {
  2606. _ConstructorOptions.minimumLevel = options2.minimumLevel;
  2607. }
  2608. if (options2.maximumLevel) {
  2609. _ConstructorOptions.maximumLevel = options2.maximumLevel;
  2610. } else {
  2611. _ConstructorOptions.maximumLevel = 18;
  2612. }
  2613. var imageryProvider = new Cesium.UrlTemplateImageryProvider(_ConstructorOptions);
  2614. if (options2.CRS.toUpperCase() === "WGS84") {
  2615. imageryProvider.readyPromise.then(() => {
  2616. this._transformProjection(imageryProvider);
  2617. });
  2618. }
  2619. this._addImageryProvider(options2.id, imageryProvider);
  2620. this.setLayersStyle({
  2621. serviceId: options2.id,
  2622. alpha: options2.alpha
  2623. });
  2624. if (callSuccess)
  2625. callSuccess(options2.id);
  2626. },
  2627. addTileMapServiceImagery: function(options2, callSuccess) {
  2628. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  2629. throw new Cesium.DeveloperError("options.url is required.");
  2630. }
  2631. options2.id = options2.id || this._guid();
  2632. let _ConstructorOptions = {
  2633. url: options2.url
  2634. };
  2635. if (options2.minimumLevel) {
  2636. _ConstructorOptions.minimumLevel = options2.minimumLevel;
  2637. }
  2638. if (options2.maximumLevel) {
  2639. _ConstructorOptions.maximumLevel = options2.maximumLevel;
  2640. } else {
  2641. _ConstructorOptions.maximumLevel = 18;
  2642. }
  2643. var imageryProvider = new Cesium.TileMapServiceImageryProvider(_ConstructorOptions);
  2644. this._addImageryProvider(options2.id, imageryProvider);
  2645. this.setLayersStyle({
  2646. serviceId: options2.id,
  2647. alpha: options2.alpha
  2648. });
  2649. if (callSuccess)
  2650. callSuccess(options2.id);
  2651. },
  2652. addWebMapTileService: function(options2, callSuccess) {
  2653. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  2654. throw new Cesium.DeveloperError("options.url is required.");
  2655. }
  2656. if (!Cesium.defined(options2.layers)) {
  2657. throw new Cesium.DeveloperError("options.layers is required.");
  2658. }
  2659. if (!Cesium.defined(options2.style)) {
  2660. throw new Cesium.DeveloperError("options.style is required.");
  2661. }
  2662. if (!Cesium.defined(options2.tileMatrixSetID)) {
  2663. throw new Cesium.DeveloperError("options.tileMatrixSetID is required.");
  2664. }
  2665. options2.id = options2.id || this._guid();
  2666. let _ConstructorOptions = {
  2667. url: options2.url,
  2668. layer: options2.layers,
  2669. style: options2.style,
  2670. tileMatrixSetID: options2.tileMatrixSetID,
  2671. format: Cesium.defaultValue(options2.format, "image/png")
  2672. };
  2673. if (options2.tileMatrixLabels) {
  2674. _ConstructorOptions.tileMatrixLabels = options2.tileMatrixLabels;
  2675. }
  2676. if (options2.minimumLevel) {
  2677. _ConstructorOptions.minimumLevel = options2.minimumLevel;
  2678. }
  2679. if (options2.maximumLevel) {
  2680. _ConstructorOptions.maximumLevel = options2.maximumLevel;
  2681. } else {
  2682. _ConstructorOptions.maximumLevel = 18;
  2683. }
  2684. let imageryProvider = new Cesium.WebMapTileServiceImageryProvider(_ConstructorOptions);
  2685. this._addImageryProvider(options2.id, imageryProvider);
  2686. this.setLayersStyle({
  2687. serviceId: options2.id,
  2688. alpha: options2.alpha
  2689. });
  2690. if (callSuccess)
  2691. callSuccess(options2.id);
  2692. },
  2693. addWebMapService: function(options2, callSuccess) {
  2694. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  2695. throw new Cesium.DeveloperError("options.url is required.");
  2696. }
  2697. if (!Cesium.defined(options2.layers)) {
  2698. throw new Cesium.DeveloperError("options.layers is required.");
  2699. }
  2700. options2.id = options2.id || this._guid();
  2701. let _ConstructorOptions = {
  2702. url: options2.url,
  2703. layers: options2.layers
  2704. };
  2705. if (options2.parameters) {
  2706. _ConstructorOptions.parameters = options2.parameters;
  2707. } else {
  2708. _ConstructorOptions.parameters = {
  2709. service: "WMS",
  2710. transparent: true,
  2711. request: "GetMap",
  2712. format: "image/png"
  2713. };
  2714. }
  2715. if (options2.minimumLevel) {
  2716. _ConstructorOptions.minimumLevel = options2.minimumLevel;
  2717. }
  2718. if (options2.maximumLevel) {
  2719. _ConstructorOptions.maximumLevel = options2.maximumLevel;
  2720. } else {
  2721. _ConstructorOptions.maximumLevel = 18;
  2722. }
  2723. let imageryProvider = new Cesium.WebMapServiceImageryProvider(_ConstructorOptions);
  2724. this._addImageryProvider(options2.id, imageryProvider);
  2725. this.setLayersStyle({
  2726. serviceId: options2.id,
  2727. alpha: options2.alpha
  2728. });
  2729. if (callSuccess)
  2730. callSuccess(options2.id);
  2731. },
  2732. addArcGisMapServer: function(options2, callSuccess) {
  2733. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  2734. throw new Cesium.DeveloperError("options.url is required.");
  2735. }
  2736. options2.id = options2.id || this._guid();
  2737. let _ConstructorOptions = {
  2738. url: options2.url
  2739. };
  2740. if (options2.layers) {
  2741. _ConstructorOptions.layers = options2.layers;
  2742. }
  2743. let imageryProvider = new Cesium.ArcGisMapServerImageryProvider(_ConstructorOptions);
  2744. this._addImageryProvider(options2.id, imageryProvider);
  2745. this.setLayersStyle({
  2746. serviceId: options2.id,
  2747. alpha: options2.alpha
  2748. });
  2749. if (callSuccess)
  2750. callSuccess(options2.id);
  2751. },
  2752. addCesium3DTileset: function(options2, callSuccess) {
  2753. let _self = this;
  2754. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  2755. throw new Cesium.DeveloperError("options.url is required.");
  2756. }
  2757. options2.id = options2.id || this._guid();
  2758. let _ConstructorOptions = {
  2759. url: options2.url,
  2760. skipLevelOfDetail: true
  2761. };
  2762. let tileSetModel = new Cesium.Cesium3DTileset(_ConstructorOptions);
  2763. tileSetModel.readyPromise.then((tileset) => {
  2764. console.log("\u52A0\u8F7D\u5B8C\u6210");
  2765. window[options2.id] = tileset;
  2766. _self._addScenePrimitives(tileset);
  2767. _self.set3DTilePosition({
  2768. serviceId: options2.id,
  2769. height: options2.height
  2770. });
  2771. _self.set3DTileStyle({
  2772. serviceId: options2.id,
  2773. alpha: options2.alpha
  2774. });
  2775. if (callSuccess)
  2776. callSuccess(options2.id);
  2777. }).catch(function(error) {
  2778. console.log(error);
  2779. });
  2780. },
  2781. addCesium3DTilesetBm: function(options2, callSuccess) {
  2782. let _self = this;
  2783. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  2784. throw new Cesium.DeveloperError("options.url is required.");
  2785. }
  2786. options2.id = options2.id || this._guid();
  2787. let _ConstructorOptions = {
  2788. url: options2.url,
  2789. skipLevelOfDetail: true
  2790. };
  2791. let tileSetModel = new Cesium.Cesium3DTileset(_ConstructorOptions);
  2792. tileSetModel.readyPromise.then((tileset) => {
  2793. console.log("\u52A0\u8F7D\u5B8C\u6210");
  2794. window[options2.id] = tileset;
  2795. _self._addScenePrimitives(tileset);
  2796. _self.set3DTileBMStyle({
  2797. serviceId: options2.id,
  2798. color: options2.color
  2799. });
  2800. if (callSuccess)
  2801. callSuccess(options2.id);
  2802. }).catch(function(error) {
  2803. console.log(error);
  2804. });
  2805. },
  2806. addPolygonImageMaterial: function(options2, callSuccess) {
  2807. if (!Cesium.defined(options2.points)) {
  2808. throw new Cesium.DeveloperError("options.points is required.");
  2809. }
  2810. if (options2.points.length < 3) {
  2811. reject("\u9762\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C113\u4E2A");
  2812. }
  2813. let positions = [];
  2814. if (options2.points instanceof Cesium.Cartesian3) {
  2815. positions = options2.points;
  2816. } else {
  2817. positions = options2.points.map((point2) => {
  2818. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2819. });
  2820. }
  2821. options2.id = options2.id || this._guid();
  2822. options2.alpha = options2.alpha || 1;
  2823. this.classificationType = Cesium.ClassificationType.BOTH;
  2824. if (options2.classificationType === "Terrain") {
  2825. this.classificationType = Cesium.ClassificationType.TERRAIN;
  2826. } else if (options2.classificationType === "3DTiles") {
  2827. this.classificationType = Cesium.ClassificationType.CESIUM_3D_TILE;
  2828. }
  2829. if (options2.url) {
  2830. if (!Cesium.Entity.supportsMaterialsforEntitiesOnTerrain(this._viewer.scene)) {
  2831. window.alert("Terrain Entity materials are not supported on this platform");
  2832. }
  2833. this.material = new Cesium.ImageMaterialProperty({
  2834. image: options2.url,
  2835. repeat: Cesium.Cartesian2(1, 1),
  2836. transparent: true,
  2837. color: Cesium.Color.WHITE.withAlpha(options2.alpha)
  2838. });
  2839. } else {
  2840. this.material = Cesium.Color.RED.withAlpha(options2.alpha);
  2841. }
  2842. window[options2.id] = this._viewer.entities.add({
  2843. id: options2.id,
  2844. polygon: {
  2845. hierarchy: positions,
  2846. material: this.material,
  2847. classificationType: this.classificationType
  2848. }
  2849. });
  2850. if (callSuccess)
  2851. callSuccess(options2.id);
  2852. },
  2853. addEntitiesGltf: function(options2, callSuccess) {
  2854. let viewer2 = this._viewer;
  2855. if (!Cesium.defined(options2.points)) {
  2856. resolve("options.points is required.");
  2857. throw new Cesium.DeveloperError("options.points is required.");
  2858. }
  2859. if (!Cesium.defined(options2.url)) {
  2860. resolve("options.url is required.");
  2861. throw new Cesium.DeveloperError("options.url is required.");
  2862. }
  2863. options2.id = options2.id || this._guid();
  2864. options2.heading = Cesium.defaultValue(options2.heading, 0);
  2865. options2.pitch = Cesium.defaultValue(options2.pitch, 0);
  2866. options2.roll = Cesium.defaultValue(options2.roll, 0);
  2867. options2.alpha = Cesium.defaultValue(options2.alpha, 1);
  2868. let position2 = void 0;
  2869. if (options2.points instanceof Cesium.Cartesian3) {
  2870. position2 = options2.points;
  2871. } else {
  2872. position2 = Cesium.Cartesian3.fromDegrees(options2.points[0], options2.points[1], options2.points[2] || 0);
  2873. }
  2874. var heading = Cesium.Math.toRadians(options2.heading);
  2875. var pitch = options2.pitch;
  2876. var roll = options2.roll;
  2877. var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
  2878. var modelGltf = viewer2.entities.add({
  2879. id: options2.id,
  2880. position: position2,
  2881. orientation: Cesium.Transforms.headingPitchRollQuaternion(position2, hpr),
  2882. model: {
  2883. uri: options2.url,
  2884. incrementallyLoadTextures: true,
  2885. colorBlendMode: Cesium.ColorBlendMode["HIGHLIGHT"],
  2886. colorBlendAmount: 0.1,
  2887. color: Cesium.Color.WHITE.withAlpha(options2.alpha),
  2888. imageBasedLightingFactor: new Cesium.Cartesian2(12, 13),
  2889. runAnimations: true,
  2890. show: true,
  2891. debugWireframe: false,
  2892. debugShowBoundingVolume: false
  2893. }
  2894. });
  2895. if (options2.minimumPixelSize) {
  2896. modelGltf.model.minimumPixelSize = options2.minimumPixelSize;
  2897. }
  2898. if (options2.maximumScale) {
  2899. modelGltf.model.maximumScale = options2.maximumScale;
  2900. }
  2901. if (options2.silhouetteColor) {
  2902. modelGltf.model.silhouetteColor = new Cesium.Color(options2.silhouetteColor[0] / 255, options2.silhouetteColor[1] / 255, options2.silhouetteColor[2] / 255, options2.silhouetteColor[3]);
  2903. }
  2904. window[options2.id] = modelGltf;
  2905. if (callSuccess)
  2906. callSuccess(options2.id);
  2907. },
  2908. addScenePrimitivesGltf(options2, callSuccess) {
  2909. let viewer2 = this._viewer;
  2910. if (!Cesium.defined(options2.points)) {
  2911. resolve("options.points is required.");
  2912. throw new Cesium.DeveloperError("options.points is required.");
  2913. }
  2914. if (!Cesium.defined(options2.url)) {
  2915. resolve("options.url is required.");
  2916. throw new Cesium.DeveloperError("options.url is required.");
  2917. }
  2918. options2.id = options2.id || this._guid();
  2919. options2.scale = Cesium.defaultValue(options2.scale, 1);
  2920. let position2 = void 0;
  2921. if (options2.points instanceof Cesium.Cartesian3) {
  2922. position2 = options2.points;
  2923. } else {
  2924. position2 = Cesium.Cartesian3.fromDegrees(options2.points[0], options2.points[1], options2.points[2] || 0);
  2925. }
  2926. const modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(position2);
  2927. let model = viewer2.scene.primitives.add(
  2928. Cesium.Model.fromGltf({
  2929. show: true,
  2930. url: options2.url,
  2931. modelMatrix,
  2932. lightColor: new Cesium.Cartesian3(10, 10, 10),
  2933. scale: options2.scale,
  2934. debugWireframe: false,
  2935. debugShowBoundingVolume: false
  2936. })
  2937. );
  2938. model.readyPromise.then(function() {
  2939. var rotationX = Cesium.Matrix4.fromRotationTranslation(Cesium.Matrix3.fromRotationZ(Cesium.Math.toRadians(0)));
  2940. Cesium.Matrix4.multiply(model.modelMatrix, rotationX, model.modelMatrix);
  2941. });
  2942. window[options2.id] = model;
  2943. if (callSuccess)
  2944. callSuccess(options2.id);
  2945. },
  2946. addPolylineByGeoJson(options2, callSuccess) {
  2947. let _self = this;
  2948. this._viewer;
  2949. if (!Cesium.defined(options2.url)) {
  2950. resolve("options.url is required.");
  2951. throw new Cesium.DeveloperError("options.url is required.");
  2952. }
  2953. options2 = options2 || {};
  2954. options2.id = options2.id || this._guid();
  2955. let promise = Cesium.GeoJsonDataSource.load(options2.url, {
  2956. clampToGround: options2.clampToGround
  2957. });
  2958. promise.then((dataSource) => {
  2959. _self._viewer.dataSources.add(dataSource);
  2960. dataSource.name = options2.id;
  2961. let entities2 = dataSource.entities.values;
  2962. let material = new PolylineDirectionMaterialProperty(options2);
  2963. for (var i2 = 0; i2 < entities2.length; i2++) {
  2964. var entity = entities2[i2];
  2965. entity.polyline.material = material;
  2966. entity.polyline.width = options2.width;
  2967. if (options2.clampToGround) {
  2968. entity.polyline.clampToGround = true;
  2969. }
  2970. }
  2971. if (callSuccess)
  2972. callSuccess(options2.id);
  2973. });
  2974. },
  2975. addPolylineByJson(options2, callSuccess) {
  2976. let _self = this;
  2977. let viewer2 = this._viewer;
  2978. if (!Cesium.defined(options2.url)) {
  2979. resolve("options.url is required.");
  2980. throw new Cesium.DeveloperError("options.url is required.");
  2981. }
  2982. options2 = options2 || {};
  2983. options2.id = options2.id || this._guid();
  2984. fetch(options2.url).then((res) => {
  2985. return res.json();
  2986. }).then((res) => {
  2987. let dataSource = new Cesium.CustomDataSource(options2.id);
  2988. viewer2.dataSources.add(dataSource);
  2989. for (var i2 = 0; i2 < res.features.length; i2++) {
  2990. if (res.features[i2].geometry) {
  2991. if (res.features[i2].geometry.type === "MultiLineString") {
  2992. let coordinatesList = res.features[i2].geometry.coordinates;
  2993. for (var j = 0; j < coordinatesList.length; j++) {
  2994. let coordinates = coordinatesList[j];
  2995. let positions = coordinates.map((point2) => {
  2996. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2997. });
  2998. _self._polylineObject.addPolyline(positions, options2).then((entity) => {
  2999. dataSource.entities.add(entity);
  3000. });
  3001. }
  3002. } else {
  3003. let coordinates = res.features[i2].geometry.coordinates;
  3004. let positions = coordinates.map((point2) => {
  3005. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  3006. });
  3007. _self._polylineObject.addPolyline(positions, options2).then((entity) => {
  3008. dataSource.entities.add(entity);
  3009. });
  3010. }
  3011. }
  3012. }
  3013. if (callSuccess)
  3014. callSuccess(options2.id);
  3015. });
  3016. },
  3017. addBillboardByGeoJson(options2, callSuccess) {
  3018. let viewer2 = this._viewer;
  3019. if (!Cesium.defined(options2.url)) {
  3020. resolve("options.url is required.");
  3021. throw new Cesium.DeveloperError("options.url is required.");
  3022. }
  3023. options2 = options2 || {};
  3024. options2.id = options2.id || this._guid();
  3025. let billboard = options2.billboard || {};
  3026. billboard.imgUrl = Cesium.defaultValue(billboard.imgUrl, "jt3dSDK/imgs/point/point3.png");
  3027. billboard.scale = Cesium.defaultValue(billboard.scale, 1);
  3028. billboard.pixelOffset = Cesium.defaultValue(billboard.pixelOffset, 0);
  3029. const dataSource = new Cesium.GeoJsonDataSource(options2.id);
  3030. dataSource.load(options2.url, {
  3031. clampToGround: true
  3032. }).then(function(data) {
  3033. viewer2.dataSources.add(data);
  3034. const entities2 = data.entities.values;
  3035. entities2.forEach((entity) => {
  3036. entity.billboard = {
  3037. image: billboard.imgUrl,
  3038. horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
  3039. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  3040. scale: billboard.scale,
  3041. pixelOffset: new Cesium.Cartesian2(0, billboard.pixelOffset),
  3042. disableDepthTestDistance: Number.POSITIVE_INFINITY
  3043. };
  3044. if (billboard.scaleByDistance) {
  3045. billboard.scaleByDistance.near = Cesium.defaultValue(billboard.scaleByDistance.near, 0);
  3046. billboard.scaleByDistance.nearValue = Cesium.defaultValue(billboard.scaleByDistance.nearValue, 0);
  3047. billboard.scaleByDistance.far = Cesium.defaultValue(billboard.scaleByDistance.far, 1);
  3048. billboard.scaleByDistance.farValue = Cesium.defaultValue(billboard.scaleByDistance.farValue, 0);
  3049. entity.billboard.scaleByDistance = new Cesium.NearFarScalar(billboard.scaleByDistance.near, billboard.scaleByDistance.nearValue, billboard.scaleByDistance.far, billboard.scaleByDistance.farValue);
  3050. }
  3051. if (options2.label) {
  3052. let label2 = options2.label || {};
  3053. label2.text = Cesium.defaultValue(label2.text, "");
  3054. label2.textField = Cesium.defaultValue(label2.textField, "");
  3055. label2.font = Cesium.defaultValue(label2.font, "24px Helvetica");
  3056. if (label2.fillColor instanceof Array) {
  3057. label2.fillColor = new Cesium.Color(label2.fillColor[0] / 255, label2.fillColor[1] / 255, label2.fillColor[2] / 255, label2.fillColor[3]);
  3058. } else if (typeof options2.color === "string") {
  3059. label2.fillColor = new Cesium.Color.fromCssColorString(label2.fillColor);
  3060. } else {
  3061. label2.fillColor = new Cesium.Color.fromCssColorString("#ff0000");
  3062. }
  3063. if (label2.outlineColor instanceof Array) {
  3064. label2.outlineColor = new Cesium.Color(label2.outlineColor[0] / 255, label2.outlineColor[1] / 255, label2.outlineColor[2] / 255, label2.outlineColor[3]);
  3065. } else if (label2.outlineColor instanceof String) {
  3066. label2.outlineColor = new Cesium.Color.fromCssColorString(label2.outlineColor);
  3067. } else {
  3068. label2.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  3069. }
  3070. label2.outlineWidth = Cesium.defaultValue(label2.outlineWidth, 1);
  3071. label2.showBackground = Cesium.defaultValue(label2.showBackground, false);
  3072. if (label2.backgroundColor instanceof Array) {
  3073. label2.backgroundColor = new Cesium.Color(label2.backgroundColor[0] / 255, label2.backgroundColor[1] / 255, label2.backgroundColor[2] / 255, label2.backgroundColor[3]);
  3074. } else if (label2.backgroundColor instanceof String) {
  3075. label2.backgroundColor = new Cesium.Color.fromCssColorString(label2.backgroundColor);
  3076. } else {
  3077. label2.backgroundColor = new Cesium.Color.fromCssColorString("#FFFF00");
  3078. }
  3079. label2.pixelOffset = Cesium.defaultValue(label2.pixelOffset, 0);
  3080. label2.scale = Cesium.defaultValue(label2.scale, 1);
  3081. label2.near = Cesium.defaultValue(label2.near, 150);
  3082. label2.nearValue = Cesium.defaultValue(label2.nearValue, 1);
  3083. label2.far = Cesium.defaultValue(label2.far, 2400);
  3084. label2.farValue = Cesium.defaultValue(label2.farValue, 0);
  3085. let labelText = label2.text;
  3086. if (entity.properties[label2.textField]) {
  3087. labelText = entity.properties[label2.textField]._value;
  3088. }
  3089. if (labelText === "") {
  3090. labelText = (i + 1).toString();
  3091. }
  3092. entity.label = {
  3093. text: labelText.toString(),
  3094. font: label2.font,
  3095. fillColor: label2.fillColor,
  3096. outlineColor: label2.outlineColor,
  3097. outlineWidth: label2.outlineWidth,
  3098. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  3099. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  3100. showBackground: label2.showBackground,
  3101. backgroundColor: label2.backgroundColor,
  3102. backgroundPadding: new Cesium.Cartesian2(6, 6),
  3103. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  3104. pixelOffset: new Cesium.Cartesian2(0, label2.pixelOffset),
  3105. scale: label2.scale
  3106. };
  3107. if (label2.scaleByDistance) {
  3108. label2.scaleByDistance.near = Cesium.defaultValue(label2.scaleByDistance.near, 0);
  3109. label2.scaleByDistance.nearValue = Cesium.defaultValue(label2.scaleByDistance.nearValue, 0);
  3110. label2.scaleByDistance.far = Cesium.defaultValue(label2.scaleByDistance.far, 1);
  3111. label2.scaleByDistance.farValue = Cesium.defaultValue(label2.scaleByDistance.farValue, 0);
  3112. entity.label.scaleByDistance = new Cesium.NearFarScalar(label2.scaleByDistance.near, label2.scaleByDistance.nearValue, label2.scaleByDistance.far, label2.scaleByDistance.farValue);
  3113. }
  3114. }
  3115. });
  3116. if (callSuccess)
  3117. callSuccess(options2.id);
  3118. });
  3119. },
  3120. addBillboardByJson(options2, callSuccess) {
  3121. let _self = this;
  3122. let viewer2 = this._viewer;
  3123. if (!Cesium.defined(options2.url)) {
  3124. resolve("options.url is required.");
  3125. throw new Cesium.DeveloperError("options.url is required.");
  3126. }
  3127. options2 = options2 || {};
  3128. let id = options2.id || this._guid();
  3129. viewer2.terrainProvider;
  3130. fetch(options2.url).then((res) => {
  3131. return res.json();
  3132. }).then((res) => {
  3133. let dataSource = new Cesium.CustomDataSource(options2.id);
  3134. viewer2.dataSources.add(dataSource);
  3135. let promiseList = [];
  3136. for (var i2 = 0; i2 < res.features.length; i2++) {
  3137. let geometry2 = res.features[i2].geometry;
  3138. let properties = res.features[i2].properties;
  3139. if (geometry2) {
  3140. if (properties) {
  3141. options2.properties = properties;
  3142. if (options2.label) {
  3143. let label2 = options2.label || {};
  3144. if (properties[label2.textField]) {
  3145. options2.label.text = properties[label2.textField];
  3146. }
  3147. }
  3148. }
  3149. if (geometry2.type === "MultiPoint") {
  3150. let coordinatesList = geometry2.coordinates;
  3151. for (var j = 0; j < coordinatesList.length; j++) {
  3152. let coordinates = coordinatesList[j];
  3153. let position2 = Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], coordinates[2] || 0);
  3154. _self._pointObject.addBillboard(position2, options2).then((entity) => {
  3155. dataSource.entities.add(entity);
  3156. });
  3157. }
  3158. } else {
  3159. let coordinates = geometry2.coordinates;
  3160. let position2 = Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], coordinates[2] || 0);
  3161. let result = _self._pointObject.addBillboard(position2, options2);
  3162. promiseList.push(result);
  3163. }
  3164. }
  3165. }
  3166. Promise.all(promiseList).then((itemList) => {
  3167. console.log("itemList", itemList);
  3168. itemList.forEach((item, index2) => {
  3169. dataSource.entities.add(item);
  3170. });
  3171. if (callSuccess)
  3172. callSuccess(id);
  3173. });
  3174. });
  3175. },
  3176. addWallByJson(options2, callSuccess) {
  3177. let _self = this;
  3178. let viewer2 = this._viewer;
  3179. if (!Cesium.defined(options2.url)) {
  3180. resolve("options.url is required.");
  3181. throw new Cesium.DeveloperError("options.url is required.");
  3182. }
  3183. options2 = options2 || {};
  3184. options2.id = options2.id || setSessionid();
  3185. fetch(options2.url).then((res) => {
  3186. return res.json();
  3187. }).then((res) => {
  3188. let dataSource = new Cesium.CustomDataSource(options2.id);
  3189. viewer2.dataSources.add(dataSource);
  3190. for (var i2 = 0; i2 < res.features.length; i2++) {
  3191. if (res.features[i2].geometry) {
  3192. if (res.features[i2].geometry.type === "MultiLineString") {
  3193. let coordinatesList = res.features[i2].geometry.coordinates;
  3194. for (var j = 0; j < coordinatesList.length; j++) {
  3195. let coordinates = coordinatesList[j];
  3196. let positions = coordinates.map((point2) => {
  3197. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  3198. });
  3199. _self._wallObject.addWall(positions, options2).then((entity) => {
  3200. dataSource.entities.add(entity);
  3201. });
  3202. }
  3203. } else {
  3204. let coordinates = res.features[i2].geometry.coordinates;
  3205. let positions = coordinates.map((point2) => {
  3206. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  3207. });
  3208. _self._wallObject.addWall(positions, options2).then((entity) => {
  3209. dataSource.entities.add(entity);
  3210. });
  3211. }
  3212. }
  3213. }
  3214. if (callSuccess)
  3215. callSuccess(options2.id);
  3216. });
  3217. }
  3218. });
  3219. Object.assign(LoadMapData.prototype, {
  3220. set3DTileStyle(options2) {
  3221. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  3222. throw new Cesium.DeveloperError("options.serviceId is required.");
  3223. }
  3224. if (Cesium.defined(options2.alpha)) {
  3225. Cesium.Check.typeOf.number("alpha", options2.alpha);
  3226. }
  3227. options2.alpha = Cesium.defaultValue(options2.alpha, 1);
  3228. let tileset = window[options2.serviceId];
  3229. tileset.style = new Cesium.Cesium3DTileStyle({
  3230. color: "color('rgba(255,255,255," + options2.alpha + ")')"
  3231. });
  3232. },
  3233. set3DTileBMStyle: function(options2) {
  3234. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  3235. throw new Cesium.DeveloperError("options.serviceId is required.");
  3236. }
  3237. options2.color = options2.color ? "vec4(" + options2.color[0] + "/255, " + options2.color[1] + "/255, " + options2.color[2] + "/255, " + options2.color[3] + ")" : "vec4(0.0, 0.58, 0.86, 1.0)";
  3238. let tileset = window[options2.serviceId];
  3239. tileset.readyPromise.then((tileset2) => {
  3240. tileset2.boundingSphere.radius;
  3241. if (tileset2.boundingSphere.radius > 1e4) {
  3242. tileset2.boundingSphere.radius / 10;
  3243. }
  3244. tileset2.style = new Cesium.Cesium3DTileStyle({
  3245. color: options2.color
  3246. });
  3247. tileset2.tileVisible.addEventListener((tile) => {
  3248. let content = tile.content;
  3249. let featuresLength = content.featuresLength;
  3250. for (let i2 = 0; i2 < featuresLength; i2 += 2) {
  3251. const feature2 = content.getFeature(i2);
  3252. const model = feature2.content._model;
  3253. if (model && model._sourcePrograms && model._rendererResources) {
  3254. Object.keys(model._sourcePrograms).forEach((key) => {
  3255. const program = model._sourcePrograms[key];
  3256. const fragmentShader = model._rendererResources.sourceShaders[program.fragmentShader];
  3257. let vPosition = "";
  3258. if (fragmentShader.indexOf(" v_positionEC;") !== -1) {
  3259. vPosition = "v_positionEC";
  3260. } else if (fragmentShader.indexOf(" v_pos;") !== -1) {
  3261. vPosition = "v_pos";
  3262. }
  3263. const color2 = `vec4(${feature2.color.toString()})`;
  3264. model._rendererResources.sourceShaders[program.fragmentShader] = `
  3265. varying vec3 ${vPosition};
  3266. void main(void){
  3267. vec4 v_helsing_position = czm_inverseModelView * vec4(${vPosition},1);
  3268. float _baseHeight = -30.0;
  3269. float vtxf_height = v_helsing_position.z - _baseHeight;
  3270. float stc_pl = fract(czm_frameNumber / 120.0) * 3.14159265 * 2.0;
  3271. float stc_sd = vtxf_height / 30.0 + sin(stc_pl) * 0.1;
  3272. gl_FragColor = ${color2};
  3273. gl_FragColor *= vec4(stc_sd, stc_sd, stc_sd, 1.0);
  3274. /* \u626B\u63CF\u7EBF */
  3275. float glowRange = 80.0;
  3276. float stc_a13 = fract(czm_frameNumber / 460.0);
  3277. float stc_h = clamp(v_helsing_position.z / glowRange, 0.0, 1.0);
  3278. stc_a13 = abs(stc_a13 - 0.5) * 1.0;
  3279. float stc_diff = step(0.003, abs(stc_h - stc_a13));
  3280. gl_FragColor.rgb += gl_FragColor.rgb * (1.0 - stc_diff);
  3281. }
  3282. `;
  3283. });
  3284. model._shouldRegenerateShaders = true;
  3285. }
  3286. }
  3287. });
  3288. });
  3289. this._viewer.scene.requestRender();
  3290. },
  3291. set3DTilePosition: function(options2) {
  3292. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  3293. throw new Cesium.DeveloperError("options.serviceId is required.");
  3294. }
  3295. options2.height = Cesium.defaultValue(options2.height, 0);
  3296. let boundingSphere = window[options2.serviceId].boundingSphere;
  3297. let cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);
  3298. let left = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, options2.height);
  3299. let right = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0);
  3300. let translation = Cesium.Cartesian3.subtract(left, right, new Cesium.Cartesian3());
  3301. window[options2.serviceId].modelMatrix = Cesium.Matrix4.fromTranslation(translation);
  3302. this._viewer.scene.requestRender();
  3303. },
  3304. setLayersStyle(options2) {
  3305. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  3306. throw new Cesium.DeveloperError("options.serviceId is required.");
  3307. }
  3308. let layer = window[options2.serviceId];
  3309. if (Cesium.defined(options2.alpha)) {
  3310. Cesium.Check.typeOf.number("alpha", options2.alpha);
  3311. }
  3312. options2.alpha = Cesium.defaultValue(options2.alpha, 1);
  3313. layer.alpha = options2.alpha;
  3314. if (Cesium.defined(options2.brightness)) {
  3315. Cesium.Check.typeOf.number("brightness", options2.brightness);
  3316. }
  3317. options2.brightness = Cesium.defaultValue(options2.brightness, 1);
  3318. layer.brightness = options2.brightness;
  3319. if (Cesium.defined(options2.contrast)) {
  3320. Cesium.Check.typeOf.number("contrast", options2.contrast);
  3321. }
  3322. options2.contrast = Cesium.defaultValue(options2.contrast, 1);
  3323. layer.contrast = options2.contrast;
  3324. if (Cesium.defined(options2.gamma)) {
  3325. Cesium.Check.typeOf.number("gamma", options2.gamma);
  3326. }
  3327. options2.gamma = Cesium.defaultValue(options2.gamma, 1);
  3328. layer.gamma = options2.gamma;
  3329. if (Cesium.defined(options2.hue)) {
  3330. Cesium.Check.typeOf.number("hue", options2.hue);
  3331. }
  3332. options2.hue = Cesium.defaultValue(options2.hue, 0);
  3333. layer.hue = options2.hue;
  3334. if (Cesium.defined(options2.saturation)) {
  3335. Cesium.Check.typeOf.number("saturation", options2.saturation);
  3336. }
  3337. options2.saturation = Cesium.defaultValue(options2.saturation, 1);
  3338. layer.saturation = options2.saturation;
  3339. },
  3340. setPolygonImageMaterial(options2) {
  3341. if (Cesium.defined(options2.alpha)) {
  3342. Cesium.Check.typeOf.number("alpha", options2.alpha);
  3343. }
  3344. options2.alpha = Cesium.defaultValue(options2.alpha, 1);
  3345. let entity = window[options2.serviceId];
  3346. entity.polygon.material.color._value.alpha = options2.alpha;
  3347. },
  3348. setModelStyle(options2) {
  3349. if (Cesium.defined(options2.alpha)) {
  3350. Cesium.Check.typeOf.number("alpha", options2.alpha);
  3351. }
  3352. options2.alpha = Cesium.defaultValue(options2.alpha, 1);
  3353. let entity = window[options2.serviceId];
  3354. if (entity.model) {
  3355. entity.model.color._value.alpha = options2.alpha;
  3356. } else {
  3357. entity.color._value.alpha = options2.alpha;
  3358. }
  3359. },
  3360. setTerrainExaggeration(options2) {
  3361. if (Cesium.defined(options2.terrainExaggeration)) {
  3362. Cesium.Check.typeOf.number("terrainExaggeration", options2.terrainExaggeration);
  3363. }
  3364. options2.terrainExaggeration = Cesium.defaultValue(options2.terrainExaggeration, 1);
  3365. this._viewer.scene.globe.terrainExaggeration = options2.terrainExaggeration;
  3366. }
  3367. });
  3368. Object.assign(LoadMapData.prototype, {
  3369. removeImageryProvider(options2) {
  3370. return new Promise((resolve2, reject2) => {
  3371. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  3372. throw new Cesium.DeveloperError("options.serviceId is required.");
  3373. }
  3374. this._removeImageryProvider(options2.serviceId);
  3375. resolve2(true);
  3376. });
  3377. },
  3378. removeTerrain() {
  3379. return new Promise((resolve2, reject2) => {
  3380. this._setEllipsoidTerrain();
  3381. resolve2(true);
  3382. });
  3383. },
  3384. removeScenePrimitives(options2) {
  3385. return new Promise((resolve2, reject2) => {
  3386. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  3387. throw new Cesium.DeveloperError("options.serviceId is required.");
  3388. }
  3389. this._removeScenePrimitives(options2.serviceId);
  3390. resolve2(true);
  3391. });
  3392. },
  3393. removeEntity(options2) {
  3394. return new Promise((resolve2, reject2) => {
  3395. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  3396. throw new Cesium.DeveloperError("options.serviceId is required.");
  3397. }
  3398. this._viewer.entities.remove(window[options2.serviceId]);
  3399. window[options2.serviceId] = null;
  3400. resolve2(true);
  3401. });
  3402. },
  3403. removeDataSources(options2) {
  3404. let viewer2 = this._viewer;
  3405. return new Promise((resolve2, reject2) => {
  3406. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  3407. throw new Cesium.DeveloperError("options.serviceId is required.");
  3408. }
  3409. let list = viewer2.dataSources.getByName(options2.serviceId);
  3410. list.forEach((res, index2) => {
  3411. viewer2.dataSources.remove(res);
  3412. if (index2 === list.length - 1) {
  3413. resolve2(true);
  3414. }
  3415. });
  3416. });
  3417. }
  3418. });
  3419. Date.prototype.Format = function(fmt) {
  3420. var o = {
  3421. "M+": this.getMonth() + 1,
  3422. "d+": this.getDate(),
  3423. "h+": this.getHours(),
  3424. "m+": this.getMinutes(),
  3425. "s+": this.getSeconds(),
  3426. "q+": Math.floor((this.getMonth() + 3) / 3),
  3427. "S": this.getMilliseconds()
  3428. };
  3429. if (/(y+)/.test(fmt))
  3430. fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  3431. for (var k in o)
  3432. if (new RegExp("(" + k + ")").test(fmt))
  3433. fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
  3434. return fmt;
  3435. };
  3436. class CrImageServerLayer {
  3437. constructor({
  3438. viewer: viewer2,
  3439. url,
  3440. opacity = 0.75,
  3441. show = true
  3442. } = {}) {
  3443. this._viewer = viewer2;
  3444. this._url = url;
  3445. this._opacity = opacity;
  3446. this._renderName = this._guid();
  3447. let dataSource = new Cesium.CustomDataSource(this._renderName);
  3448. this._viewer.dataSources.add(dataSource);
  3449. this._entities = dataSource.entities;
  3450. this._renderEntities = /* @__PURE__ */ new Map();
  3451. this._isUpdateTile = show;
  3452. this._isDebug = false;
  3453. this._init();
  3454. }
  3455. _init() {
  3456. let _self = this;
  3457. this._provider = new Cesium.ArcGisMapServerImageryProvider({
  3458. url: _self._url
  3459. });
  3460. this._provider.readyPromise.then(function(result) {
  3461. _self._rectangle = _self._provider.rectangle;
  3462. if (_self._isDebug)
  3463. _self._printDebug();
  3464. _self._viewer.scene.postRender.addEventListener(() => {
  3465. if (_self._isUpdateTile) {
  3466. _self._isUpdateTile = false;
  3467. _self._renderTiles();
  3468. }
  3469. });
  3470. });
  3471. }
  3472. _guid() {
  3473. function S4() {
  3474. return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
  3475. }
  3476. return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
  3477. }
  3478. _printDebug() {
  3479. this._provider.tilingScheme;
  3480. let tiling84 = new Cesium.GeographicTilingScheme();
  3481. this._drawDebugRectangle(this._rectangle, Cesium.Color.GREEN);
  3482. tiling84.tileXYToRectangle(1696, 312, 10);
  3483. }
  3484. _drawDebugRectangle(rectangle, color2) {
  3485. let positions = this._calculateRectangleOutlineCoordinates(rectangle);
  3486. let rectEntity = new Cesium.Entity({
  3487. name: this._renderName,
  3488. polyline: {
  3489. positions,
  3490. material: color2,
  3491. width: 10,
  3492. clampToGround: true
  3493. }
  3494. });
  3495. this._entities.add(rectEntity);
  3496. }
  3497. _console(...rest) {
  3498. if (this._isDebug)
  3499. console.log("===" + new Date().Format("yyyy-MM-dd HH:mm:ss") + ">>>", rest);
  3500. }
  3501. _renderTiles() {
  3502. let _self = this;
  3503. let tilesToRender = this._viewer.scene.globe._surface._tilesToRender;
  3504. if (tilesToRender === void 0 || tilesToRender.length === 0) {
  3505. this._isUpdateTile = true;
  3506. return;
  3507. } else {
  3508. new Promise((resolve2, reject2) => {
  3509. tilesToRender.sort(function(obj1, obj2) {
  3510. let level1 = parseInt(obj1.level);
  3511. let level2 = parseInt(obj2.level);
  3512. return level1 - level2;
  3513. });
  3514. resolve2(tilesToRender);
  3515. }).then((tiles) => {
  3516. _self._asyncProjectionTiles(tiles);
  3517. });
  3518. }
  3519. }
  3520. _createKey(x, y, level) {
  3521. let key = `${this._renderName}_${x}_${y}_${level}`;
  3522. return key;
  3523. }
  3524. _asyncProjectionTiles(tiles) {
  3525. let renderTiles = [];
  3526. for (let tile of tiles) {
  3527. let proTiles = this._projectionTile(tile);
  3528. for (let proTile of proTiles) {
  3529. let key = this._createKey(proTile.x, proTile.y, proTile.level);
  3530. let subTile = renderTiles.find((obj) => {
  3531. return obj.x === proTile.x && obj.y === proTile.y;
  3532. });
  3533. if (subTile === void 0) {
  3534. let isExists = false;
  3535. for (let eTile of renderTiles) {
  3536. if (Cesium.Rectangle.intersection(eTile.rectangle, proTile.rectangle)) {
  3537. eTile.childTiles.push(key);
  3538. isExists = true;
  3539. break;
  3540. }
  3541. }
  3542. if (!isExists) {
  3543. renderTiles.push({
  3544. key,
  3545. x: proTile.x,
  3546. y: proTile.y,
  3547. level: proTile.level,
  3548. rectangle: proTile.rectangle,
  3549. childTiles: []
  3550. });
  3551. }
  3552. }
  3553. }
  3554. }
  3555. let i2 = renderTiles.length;
  3556. let appendTiles = [];
  3557. while (i2--) {
  3558. let findTile = renderTiles[i2];
  3559. if (findTile.childTiles.length >= 1) {
  3560. let tiles2 = this._createFourTiles(findTile);
  3561. for (let tile of tiles2) {
  3562. appendTiles.push(tile);
  3563. }
  3564. renderTiles.splice(i2, 1);
  3565. }
  3566. }
  3567. for (let appendTile of appendTiles) {
  3568. renderTiles.push(appendTile);
  3569. }
  3570. renderTiles.sort(function(obj1, obj2) {
  3571. let level1 = parseInt(obj1.level);
  3572. let level2 = parseInt(obj2.level);
  3573. return level1 - level2;
  3574. });
  3575. this._renderTilesToViewer(renderTiles);
  3576. }
  3577. _createTileByRectangleAndLevel(rectangle, level) {
  3578. let center2 = Cesium.Rectangle.center(rectangle);
  3579. let nLevel = parseInt(level) + 1;
  3580. let query = this._provider.tilingScheme.positionToTileXY(center2, nLevel);
  3581. if (query === void 0)
  3582. return void 0;
  3583. return {
  3584. key: this._createKey(query.x, query.y, nLevel),
  3585. x: query.x,
  3586. y: query.y,
  3587. level: nLevel,
  3588. rectangle,
  3589. childTiles: []
  3590. };
  3591. }
  3592. _createFourTiles(tile) {
  3593. let rects = [];
  3594. let results = [];
  3595. let rectangle = tile.rectangle;
  3596. rects.push(Cesium.Rectangle.subsection(rectangle, 0, 0, 0.5, 0.5));
  3597. rects.push(Cesium.Rectangle.subsection(rectangle, 0.5, 0, 1, 0.5));
  3598. rects.push(Cesium.Rectangle.subsection(rectangle, 0, 0.5, 0.5, 1));
  3599. rects.push(Cesium.Rectangle.subsection(rectangle, 0.5, 0.5, 1, 1));
  3600. for (let rect of rects) {
  3601. if (Cesium.Rectangle.intersection(rect, this._rectangle)) {
  3602. let newTile = this._createTileByRectangleAndLevel(rect, tile.level);
  3603. if (newTile !== void 0)
  3604. results.push(newTile);
  3605. }
  3606. }
  3607. return results;
  3608. }
  3609. _renderTilesToViewer(tiles) {
  3610. let _self = this;
  3611. let deleteKeys = [];
  3612. for (let [key, tile] of this._renderEntities) {
  3613. let findTile = tiles.find((obj) => {
  3614. return obj.key === key;
  3615. });
  3616. if (findTile === void 0) {
  3617. deleteKeys.push(key);
  3618. }
  3619. }
  3620. for (let key of deleteKeys) {
  3621. this._renderEntities.delete(key);
  3622. this._entities.removeById(key);
  3623. }
  3624. for (let tile of tiles) {
  3625. if (!this._renderEntities.has(tile.key)) {
  3626. let entity = this._renderSimpleTileToViewer(tile);
  3627. this._renderEntities.set(tile.key, entity);
  3628. let workBlob = new Blob([`(${downloadWorker.toString()})()`]);
  3629. let worker = new Worker(URL.createObjectURL(workBlob));
  3630. worker.postMessage({
  3631. key: tile.key,
  3632. url: this._url,
  3633. x: tile.x,
  3634. y: tile.y,
  3635. level: tile.level
  3636. });
  3637. worker.onmessage = function(event2) {
  3638. _self._console(`render x:${event2.data.x} y:${event2.data.y} level:${event2.data.level}`);
  3639. let renderEntity = _self._entities.getById(event2.data.key);
  3640. if (renderEntity !== void 0) {
  3641. event2.data.key;
  3642. const canvas = _self._createCanvas(event2.data, event2.data.image, _self._isDebug);
  3643. renderEntity.rectangle.material = canvas;
  3644. }
  3645. worker.terminate();
  3646. };
  3647. }
  3648. }
  3649. this._isUpdateTile = true;
  3650. }
  3651. _renderSimpleTileToViewer(tile) {
  3652. const canvas = this._createCanvas(tile, void 0, this._isDebug);
  3653. let bjPositions = this._calculateRectangleOutlineCoordinates(tile.rectangle);
  3654. let tileEntity = new Cesium.Entity({
  3655. name: this._renderName,
  3656. id: tile.key,
  3657. rectangle: {
  3658. coordinates: tile.rectangle,
  3659. material: canvas
  3660. },
  3661. polyline: {
  3662. positions: bjPositions,
  3663. material: Cesium.Color.YELLOW.withAlpha(this._isDebug ? 1 : 0),
  3664. width: 1,
  3665. clampToGround: true
  3666. }
  3667. });
  3668. return this._entities.add(tileEntity);
  3669. }
  3670. _createCanvas(tile, image, islabel) {
  3671. let provider = this._provider;
  3672. const canvas = document.createElement("canvas");
  3673. canvas.width = provider.tileWidth;
  3674. canvas.height = provider.tileHeight;
  3675. const context = canvas.getContext("2d");
  3676. if (image !== void 0) {
  3677. context.globalAlpha = this._opacity;
  3678. context.drawImage(event.data.image, 0, 0, canvas.width, canvas.height);
  3679. }
  3680. if (islabel !== void 0 && islabel === true) {
  3681. context.globalAlpha = 1;
  3682. context.font = "20px Arial";
  3683. context.textAlign = "center";
  3684. context.fillStyle = "rgba(255,255,0)";
  3685. context.strokeStyle = "rgba(255,255,255,1)";
  3686. context.lineWidth = 2;
  3687. context.strokeText(`L: ${tile.level}`, 126, 86);
  3688. context.fillText(`L: ${tile.level}`, 126, 86);
  3689. context.strokeText(`X: ${tile.x}`, 126, 136);
  3690. context.fillText(`X: ${tile.x}`, 126, 136);
  3691. context.strokeText(`Y: ${tile.y}`, 126, 186);
  3692. context.fillText(`Y: ${tile.y}`, 126, 186);
  3693. }
  3694. return canvas;
  3695. }
  3696. _projectionTile(tile) {
  3697. let rectangle = tile._rectangle;
  3698. let imageryLevel = parseInt(tile.level);
  3699. let mercatorTilingScheme = this._provider.tilingScheme;
  3700. let res = [];
  3701. let interRectangle = Cesium.Rectangle.intersection(rectangle, this._rectangle);
  3702. if (interRectangle === void 0)
  3703. return res;
  3704. let northwestTileCoordinates = mercatorTilingScheme.positionToTileXY(
  3705. Cesium.Rectangle.northwest(rectangle),
  3706. imageryLevel
  3707. );
  3708. let southeastTileCoordinates = mercatorTilingScheme.positionToTileXY(
  3709. Cesium.Rectangle.southeast(rectangle),
  3710. imageryLevel
  3711. );
  3712. if (northwestTileCoordinates !== void 0 && southeastTileCoordinates !== void 0) {
  3713. for (let i2 = northwestTileCoordinates.x; i2 <= southeastTileCoordinates.x; i2++) {
  3714. for (let j = northwestTileCoordinates.y; j <= southeastTileCoordinates.y; j++) {
  3715. let _webRectangle = mercatorTilingScheme.tileXYToRectangle(i2, j, imageryLevel);
  3716. if (Cesium.Rectangle.intersection(_webRectangle, this._rectangle)) {
  3717. res.push({
  3718. x: i2,
  3719. y: j,
  3720. level: imageryLevel,
  3721. rectangle: _webRectangle
  3722. });
  3723. }
  3724. }
  3725. }
  3726. } else if (northwestTileCoordinates !== void 0) {
  3727. let _webRectangle = mercatorTilingScheme.tileXYToRectangle(
  3728. northwestTileCoordinates.x,
  3729. northwestTileCoordinates.y,
  3730. imageryLevel
  3731. );
  3732. if (Cesium.Rectangle.intersection(_webRectangle, this._rectangle)) {
  3733. res.push({
  3734. x: northwestTileCoordinates.x,
  3735. y: northwestTileCoordinates.y,
  3736. level: imageryLevel,
  3737. rectangle: _webRectangle
  3738. });
  3739. }
  3740. } else if (southeastTileCoordinates !== void 0) {
  3741. let _webRectangle = mercatorTilingScheme.tileXYToRectangle(
  3742. southeastTileCoordinates.x,
  3743. southeastTileCoordinates.y,
  3744. imageryLevel
  3745. );
  3746. if (Cesium.Rectangle.intersection(_webRectangle, this._rectangle)) {
  3747. res.push({
  3748. x: southeastTileCoordinates.x,
  3749. y: southeastTileCoordinates.y,
  3750. level: imageryLevel,
  3751. rectangle: _webRectangle
  3752. });
  3753. }
  3754. }
  3755. return res;
  3756. }
  3757. _calculateRectangleOutlineCoordinates(rectangle) {
  3758. let south_east = Cesium.Rectangle.southeast(rectangle);
  3759. let se2 = Cesium.Cartographic.toCartesian(south_east);
  3760. let south_west = Cesium.Rectangle.southwest(rectangle);
  3761. let sw = Cesium.Cartographic.toCartesian(south_west);
  3762. let north_east = Cesium.Rectangle.northeast(rectangle);
  3763. let ne2 = Cesium.Cartographic.toCartesian(north_east);
  3764. let north_west = Cesium.Rectangle.northwest(rectangle);
  3765. let nw = Cesium.Cartographic.toCartesian(north_west);
  3766. return [sw, se2, ne2, nw, sw];
  3767. }
  3768. _removeEntityByName(entityName) {
  3769. var entities2 = this._entities;
  3770. if (!entities2 || !entities2.values)
  3771. return;
  3772. var delEntitys = [];
  3773. for (var i2 = 0; i2 < entities2.values.length; i2++) {
  3774. if (entities2.values[i2].name == entityName) {
  3775. delEntitys.push(entities2.values[i2]);
  3776. }
  3777. }
  3778. for (var i2 = 0; i2 < delEntitys.length; i2++) {
  3779. entities2.remove(delEntitys[i2]);
  3780. }
  3781. }
  3782. }
  3783. Object.assign(CrImageServerLayer.prototype, {
  3784. hide: function() {
  3785. this._console("\u9690\u85CF");
  3786. this._isUpdateTile = false;
  3787. this._removeEntityByName(this._renderName);
  3788. this._renderEntities.clear();
  3789. },
  3790. show: function() {
  3791. this._console("\u663E\u793A");
  3792. this._isUpdateTile = true;
  3793. },
  3794. setOpacity: function(opacity) {
  3795. if (opacity === void 0 || typeof opacity !== "number")
  3796. return;
  3797. if (opacity >= 1)
  3798. this._opacity = 1;
  3799. if (opacity <= 0)
  3800. this._opacity = 0;
  3801. this._opacity = parseFloat(opacity);
  3802. }
  3803. });
  3804. function downloadWorker() {
  3805. onmessage = function(event2) {
  3806. let data = event2.data;
  3807. let url = data.url + "/tile/" + data.level + "/" + data.y + "/" + data.x;
  3808. let xhr = new XMLHttpRequest();
  3809. xhr.open("get", url, true);
  3810. xhr.responseType = "blob";
  3811. xhr.onload = function() {
  3812. if (this.status === 200) {
  3813. var blob = this.response;
  3814. var bmpPromise = createImageBitmap(blob, {
  3815. imageOrientation: "none",
  3816. premultiplyAlpha: "none",
  3817. colorSpaceConversion: "default"
  3818. });
  3819. bmpPromise.then(function(image) {
  3820. let outObj = {
  3821. key: data.key,
  3822. x: data.x,
  3823. y: data.y,
  3824. level: data.level,
  3825. image
  3826. };
  3827. postMessage(outObj);
  3828. });
  3829. } else {
  3830. console.log("===>>>", url + " Not found");
  3831. }
  3832. };
  3833. xhr.send();
  3834. };
  3835. }
  3836. class LocateUtil {
  3837. constructor(viewer2) {
  3838. if (!viewer2)
  3839. throw new Cesium.DeveloperError("no viewer object!");
  3840. this._viewer = viewer2;
  3841. this._locationEntity = null;
  3842. }
  3843. }
  3844. Object.assign(LocateUtil.prototype, {
  3845. flyToPoint: function(options2) {
  3846. return new Promise((resolve2, reject2) => {
  3847. if (!Cesium.defined(options2) || !Cesium.defined(options2.longitude) || !Cesium.defined(options2.latitude)) {
  3848. throw new Cesium.DeveloperError("options.longitude and options.latitude are required.");
  3849. }
  3850. options2.height = Cesium.defaultValue(options2.height, 0);
  3851. options2.heading = Cesium.defaultValue(options2.heading, 0);
  3852. options2.pitch = Cesium.defaultValue(options2.pitch, -90);
  3853. options2.range = Cesium.defaultValue(options2.range, 0);
  3854. options2.duration = Cesium.defaultValue(options2.duration, 3);
  3855. var boundingSphere = new Cesium.BoundingSphere(Cesium.Cartesian3.fromDegrees(options2.longitude, options2.latitude, options2.height), 0);
  3856. this._viewer.camera.flyToBoundingSphere(boundingSphere, {
  3857. duration: options2.duration,
  3858. complete: function() {
  3859. resolve2(true);
  3860. },
  3861. offset: {
  3862. heading: Cesium.Math.toRadians(options2.heading),
  3863. pitch: Cesium.Math.toRadians(options2.pitch),
  3864. range: options2.range
  3865. }
  3866. });
  3867. });
  3868. },
  3869. flyToEntityByPoints: function(points2, type2, options2) {
  3870. return new Promise((resolve2, reject2) => {
  3871. let _self = this;
  3872. options2 = options2 || {};
  3873. if (points2 === void 0 || points2.length === void 0) {
  3874. reject2("\u8F93\u5165\u7684\u5750\u6807\u96C6\u5408\u5F02\u5E38\uFF01");
  3875. return;
  3876. }
  3877. let pointsArray = points2.map((point2) => {
  3878. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  3879. });
  3880. if (_self._locationEntity) {
  3881. _self._viewer.entities.remove(_self._locationEntity);
  3882. }
  3883. switch (type2) {
  3884. case "point":
  3885. _self._locationEntity = _self._viewer.entities.add({
  3886. position: pointsArray[0],
  3887. point: {
  3888. pixelSize: 1
  3889. }
  3890. });
  3891. break;
  3892. case "polyline":
  3893. if (pointsArray.length < 2) {
  3894. reject2("\u7EBF\u5BF9\u8C61\u5B9A\u4F4D\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  3895. } else {
  3896. _self._locationEntity = _self._viewer.entities.add({
  3897. polyline: {
  3898. positions: pointsArray,
  3899. clampToGround: true,
  3900. material: new Cesium.Color(255, 0, 0, 0.5),
  3901. width: 1
  3902. }
  3903. });
  3904. }
  3905. break;
  3906. case "polygon":
  3907. if (pointsArray.length < 3) {
  3908. reject2("\u9762\u5BF9\u8C61\u5B9A\u4F4D\uFF0C\u70B9\u6570\u81F3\u5C113\u4E2A");
  3909. } else {
  3910. _self._locationEntity = _self._viewer.entities.add({
  3911. polygon: {
  3912. hierarchy: {
  3913. positions: pointsArray
  3914. },
  3915. material: new Cesium.Color(255, 0, 0, 0.5),
  3916. outline: true
  3917. }
  3918. });
  3919. }
  3920. break;
  3921. default:
  3922. reject2("\u5750\u6807\u5F02\u5E38\uFF01");
  3923. break;
  3924. }
  3925. options2.duration = Cesium.defaultValue(options2.duration, 3);
  3926. options2.heading = Cesium.defaultValue(options2.heading, 0);
  3927. options2.pitch = Cesium.defaultValue(options2.pitch, -90);
  3928. options2.range = Cesium.defaultValue(options2.range, 0);
  3929. let flyPromise = _self._viewer.flyTo(_self._locationEntity, {
  3930. duration: options2.duration,
  3931. offset: {
  3932. heading: Cesium.Math.toRadians(options2.heading),
  3933. pitch: Cesium.Math.toRadians(options2.pitch),
  3934. range: options2.range
  3935. }
  3936. });
  3937. flyPromise.then(function(flag) {
  3938. if (flag) {
  3939. resolve2(_self._locationEntity);
  3940. }
  3941. });
  3942. });
  3943. },
  3944. flyToEntity: function(entity, options2) {
  3945. return new Promise((resolve2, reject2) => {
  3946. let _self = this;
  3947. options2 = options2 || {};
  3948. if (_self._locationEntity) {
  3949. _self._viewer.entities.remove(_self._locationEntity);
  3950. }
  3951. _self._locationEntity = entity;
  3952. options2.duration = Cesium.defaultValue(options2.duration, 3);
  3953. options2.heading = Cesium.defaultValue(options2.heading, 0);
  3954. options2.pitch = Cesium.defaultValue(options2.pitch, -90);
  3955. options2.range = Cesium.defaultValue(options2.range, 0);
  3956. let flyPromise = _self._viewer.flyTo(_self._locationEntity, {
  3957. duration: options2.duration,
  3958. offset: {
  3959. heading: Cesium.Math.toRadians(options2.heading),
  3960. pitch: Cesium.Math.toRadians(options2.pitch),
  3961. range: options2.range
  3962. }
  3963. });
  3964. flyPromise.then(function(flag) {
  3965. if (flag) {
  3966. resolve2(_self._locationEntity);
  3967. }
  3968. });
  3969. });
  3970. },
  3971. zoomToTilesets(tileset, options2) {
  3972. return new Promise((resolve2, reject2) => {
  3973. let _self = this;
  3974. if (!Cesium.defined(tileset)) {
  3975. throw new Cesium.DeveloperError("tileset is required.");
  3976. }
  3977. options2 = options2 || {};
  3978. options2.heading = Cesium.defaultValue(options2.heading, 120);
  3979. options2.pitch = Cesium.defaultValue(options2.pitch, -10);
  3980. options2.range = Cesium.defaultValue(options2.range, 450);
  3981. options2.duration = Cesium.defaultValue(options2.duration, 3);
  3982. let boundingSphere = tileset.boundingSphere;
  3983. _self._viewer.camera.flyToBoundingSphere(boundingSphere, {
  3984. duration: options2.duration,
  3985. complete: function() {
  3986. resolve2(true);
  3987. },
  3988. offset: {
  3989. heading: Cesium.Math.toRadians(options2.heading),
  3990. pitch: Cesium.Math.toRadians(options2.pitch),
  3991. range: options2.range
  3992. }
  3993. });
  3994. });
  3995. },
  3996. flyToTileset(tileset, options2) {
  3997. return new Promise((resolve2, reject2) => {
  3998. let _self = this;
  3999. if (!Cesium.defined(tileset)) {
  4000. throw new Cesium.DeveloperError("tileset is required.");
  4001. }
  4002. options2 = options2 || {};
  4003. options2.heading = Cesium.defaultValue(options2.heading, 120);
  4004. options2.pitch = Cesium.defaultValue(options2.pitch, -10);
  4005. options2.range = Cesium.defaultValue(options2.range, 450);
  4006. options2.duration = Cesium.defaultValue(options2.duration, 3);
  4007. let flyPromise = _self._viewer.flyTo(tileset, {
  4008. duration: options2.duration,
  4009. offset: {
  4010. heading: Cesium.Math.toRadians(options2.heading),
  4011. pitch: Cesium.Math.toRadians(options2.pitch),
  4012. range: options2.range
  4013. }
  4014. });
  4015. flyPromise.then(function(flag) {
  4016. if (flag) {
  4017. resolve2(true);
  4018. }
  4019. });
  4020. });
  4021. }
  4022. });
  4023. const CreateRemindertip = function(arr, position2, show) {
  4024. let tooltip2 = document.getElementById("toolTip");
  4025. let style, _x, _y, _color;
  4026. if (arr && typeof arr === "object") {
  4027. style = arr;
  4028. }
  4029. if (style && style.origin) {
  4030. style.origin === "center" && (_x = 15, _y = -12);
  4031. style.origin === "top" && (_x = 15, _y = -44);
  4032. style.origin === "bottom" && (_x = 15, _y = 20);
  4033. } else {
  4034. _x = 15, _y = 20;
  4035. }
  4036. if (style && style.color) {
  4037. style.color === "white" && (_color = "background: rgba(255, 255, 255, 0.8);color: black;");
  4038. style.color === "black" && (_color = "background: rgba(0, 0, 0, 0.65);color: white;");
  4039. style.color === "yellow" && (_color = "color: black;background-color: #ffcc33;border: 1px solid white;");
  4040. } else {
  4041. _color = "background: rgba(0, 0, 0, 0.65);color: white;";
  4042. }
  4043. if (!tooltip2) {
  4044. const viewerDom = document.getElementsByClassName("cesium-viewer")[0];
  4045. let elementbottom = document.createElement("div");
  4046. viewerDom.append(elementbottom);
  4047. let html = '<div id="toolTip" style="display: none;pointer-events: none;position: absolute;z-index: 1000;opacity: 0.8;border-radius: 4px;padding: 4px 8px;white-space: nowrap;font-family:\u9ED1\u4F53;color:white;font-weight: bolder;font-size: 14px;' + _color + '"></div>';
  4048. viewerDom.insertAdjacentHTML("beforeend", html);
  4049. tooltip2 = document.getElementById("toolTip");
  4050. }
  4051. if (show) {
  4052. tooltip2.innerHTML = arr;
  4053. tooltip2.style.left = position2.x + _x + "px";
  4054. tooltip2.style.top = position2.y + _y + "px";
  4055. tooltip2.style.display = "block";
  4056. } else {
  4057. tooltip2.style.display = "none";
  4058. }
  4059. return {
  4060. tooltip: tooltip2,
  4061. style,
  4062. showAt: function(position3, text) {
  4063. this.tooltip.innerHTML = text;
  4064. if (this.style && this.style.origin) {
  4065. this.style.origin === "center" && (_x = 15, _y = -this.tooltip.offsetHeight / 2);
  4066. this.style.origin === "top" && (_x = 15, _y = -this.tooltip.offsetHeight - 20);
  4067. this.style.origin === "bottom" && (_x = 15, _y = 20);
  4068. } else {
  4069. _x = 15, _y = -this.tooltip.offsetHeight / 2;
  4070. }
  4071. this.tooltip.style.left = position3.x + _x + "px";
  4072. this.tooltip.style.top = position3.y + _y + "px";
  4073. this.tooltip.style.display = "block";
  4074. },
  4075. show: function(show2) {
  4076. if (show2) {
  4077. this.tooltip.style.display = "block";
  4078. } else {
  4079. this.tooltip.style.display = "none";
  4080. }
  4081. }
  4082. };
  4083. };
  4084. class SightLine {
  4085. constructor(viewer2) {
  4086. if (!viewer2)
  4087. throw new Cesium.DeveloperError("no viewer object!");
  4088. this._viewer = viewer2;
  4089. this._resultObject = {
  4090. viewPoint: void 0,
  4091. targetPoints: [],
  4092. targetPoint: void 0,
  4093. objectExclude: [],
  4094. entities: []
  4095. };
  4096. }
  4097. _distance(point1, point2) {
  4098. let point1cartographic = Cesium.Cartographic.fromCartesian(point1);
  4099. let point2cartographic = Cesium.Cartographic.fromCartesian(point2);
  4100. let geodesic = new Cesium.EllipsoidGeodesic();
  4101. geodesic.setEndPoints(point1cartographic, point2cartographic);
  4102. let s = geodesic.surfaceDistance;
  4103. s = Math.sqrt(
  4104. Math.pow(s, 2) + Math.pow(point2cartographic.height - point1cartographic.height, 2)
  4105. );
  4106. return s;
  4107. }
  4108. _checkAppOrWeb() {
  4109. if (window.navigator.userAgent.match(
  4110. /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
  4111. )) {
  4112. return SightLine.RuntimeEnvironment.App;
  4113. } else {
  4114. return SightLine.RuntimeEnvironment.Web;
  4115. }
  4116. }
  4117. _isRuntimeApp() {
  4118. if (this._checkAppOrWeb() === SightLine.RuntimeEnvironment.App) {
  4119. return true;
  4120. }
  4121. return false;
  4122. }
  4123. _isRuntimeWeb() {
  4124. if (this._checkAppOrWeb() === SightLine.RuntimeEnvironment.Web) {
  4125. return true;
  4126. }
  4127. return false;
  4128. }
  4129. _createOperationMainDom() {
  4130. let buttonDiv = document.createElement("div");
  4131. buttonDiv.id = "drawButtonDiv";
  4132. buttonDiv.style.width = "80px";
  4133. buttonDiv.style.backgroundColor = "rgba(5, 45, 155, 0.7)";
  4134. buttonDiv.style.borderRadius = "5px";
  4135. buttonDiv.style.display = "flex";
  4136. buttonDiv.style.flexDirection = "column";
  4137. buttonDiv.style.padding = "8px";
  4138. buttonDiv.style.justifyContent = "center";
  4139. buttonDiv.style.position = "absolute";
  4140. buttonDiv.style.bottom = "150px";
  4141. buttonDiv.style.right = "10px";
  4142. let btnCompletion = document.createElement("button");
  4143. btnCompletion.id = "btnDrawComplete";
  4144. btnCompletion.style.height = "30px";
  4145. btnCompletion.style.backgroundColor = "rgba(88, 185, 45, 1.0)";
  4146. btnCompletion.style.color = "rgb(255, 255, 255)";
  4147. btnCompletion.style.border = "0px solid red";
  4148. btnCompletion.style.borderRadius = "5px";
  4149. btnCompletion.innerHTML = "\u5B8C\u6210";
  4150. btnCompletion.style.fontSize = "13px";
  4151. btnCompletion.style.cursor = "pointer";
  4152. buttonDiv.appendChild(btnCompletion);
  4153. document.body.appendChild(buttonDiv);
  4154. }
  4155. _showTooltipMessage(message) {
  4156. let msgMainDom = document.getElementById("messageMainDom");
  4157. if (msgMainDom !== null && msgMainDom !== void 0) {
  4158. document.body.removeChild(msgMainDom);
  4159. }
  4160. msgMainDom = document.createElement("div");
  4161. msgMainDom.style.width = "30%";
  4162. msgMainDom.style.backgroundColor = "rgba(237, 248, 230, 1.0)";
  4163. msgMainDom.style.height = "45px";
  4164. msgMainDom.style.border = "solid 2px rgb(219, 241, 208)";
  4165. msgMainDom.style.borderRadius = "8px";
  4166. msgMainDom.style.display = "flex";
  4167. msgMainDom.style.alignItems = "center";
  4168. msgMainDom.style.paddingLeft = "10px";
  4169. msgMainDom.style.color = "rgb(91, 188, 48)";
  4170. msgMainDom.style.fontSize = "14px";
  4171. msgMainDom.style.fontWeight = "600";
  4172. msgMainDom.style.position = "absolute";
  4173. msgMainDom.style.left = "35%";
  4174. msgMainDom.style.transition = "transform 1s";
  4175. msgMainDom.style.transform = "translateY(-90px)";
  4176. msgMainDom.style.top = "0px";
  4177. msgMainDom.style.zIndex = 1e3;
  4178. document.body.appendChild(msgMainDom);
  4179. let strHtml = "";
  4180. strHtml += "<div style='";
  4181. strHtml += "background-color: rgb(88, 185, 45);";
  4182. strHtml += "color: rgb(255, 255, 255);";
  4183. strHtml += "height: 24px;";
  4184. strHtml += "width: 24px;";
  4185. strHtml += "border-radius: 20px;";
  4186. strHtml += "display: flex;";
  4187. strHtml += "justify-content: center;";
  4188. strHtml += "align-items: center;";
  4189. strHtml += "font-size: 14px;";
  4190. strHtml += "margin-right: 18px;";
  4191. strHtml += "'>&#10003</div>";
  4192. strHtml += "<div>" + message + "</div>";
  4193. msgMainDom.innerHTML = strHtml;
  4194. msgMainDom.addEventListener("transitionend", function() {
  4195. setTimeout(function() {
  4196. document.body.removeChild(msgMainDom);
  4197. }, 1e3);
  4198. }, false);
  4199. setTimeout(function() {
  4200. msgMainDom.style.transform = "translateY(50px)";
  4201. }, 100);
  4202. }
  4203. }
  4204. Object.assign(SightLine.prototype, {
  4205. startSightLine() {
  4206. let _self = this;
  4207. _self.clearAll();
  4208. let toolTip = "\u5DE6\u952E\u5355\u51FB\u521B\u5EFA\u89C6\u89D2\u8D77\u70B9";
  4209. if (this._isRuntimeApp()) {
  4210. toolTip = "\u5355\u51FB\u521B\u5EFA\u89C6\u89D2\u8D77\u70B9";
  4211. _self._showTooltipMessage(toolTip);
  4212. }
  4213. _self.handler = new Cesium.ScreenSpaceEventHandler(_self._viewer.canvas);
  4214. _self.handler.setInputAction((event2) => {
  4215. let loc2 = CoordTransform._transfromFromScreenPoint(_self._viewer, event2.position);
  4216. toolTip = "\u5DE6\u952E\u521B\u5EFA\u89C6\u89D2\u7EC8\u70B9\uFF0C\u53F3\u952E\u7ED3\u675F\u901A\u89C6\u5206\u6790";
  4217. if (this._isRuntimeApp()) {
  4218. toolTip = "\u518D\u6B21\u5355\u51FB\u521B\u5EFA\u89C6\u89D2\u7EC8\u70B9";
  4219. _self._showTooltipMessage(toolTip);
  4220. }
  4221. if (!Cesium.defined(loc2.sLocation))
  4222. return;
  4223. let cartesian = loc2.sLocation;
  4224. if (!_self._resultObject.viewPoint) {
  4225. _self._resultObject.viewPoint = cartesian;
  4226. let pointEntity = _self._viewer.entities.add({
  4227. position: cartesian,
  4228. point: {
  4229. color: Cesium.Color.YELLOW,
  4230. pixelSize: 5
  4231. },
  4232. label: {
  4233. text: "\u89C2\u5BDF\u4F4D\u7F6E",
  4234. font: "12px sans-serif",
  4235. fillColor: new Cesium.Color(255 / 255, 255 / 255, 255 / 255, 1),
  4236. outlineColor: new Cesium.Color(0, 154 / 255, 94 / 255, 1),
  4237. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  4238. outlineWidth: 1,
  4239. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  4240. pixelOffset: new Cesium.Cartesian2(0, -28),
  4241. showBackground: true,
  4242. backgroundColor: new Cesium.Color(0, 0, 0, 0.6),
  4243. disableDepthTestDistance: Number.POSITIVE_INFINITY
  4244. }
  4245. });
  4246. _self._resultObject.objectExclude.push(pointEntity);
  4247. _self._resultObject.entities.push(pointEntity);
  4248. } else {
  4249. _self._resultObject.targetPoint = cartesian;
  4250. let pointEntity = _self._viewer.entities.add({
  4251. position: cartesian,
  4252. point: {
  4253. color: Cesium.Color.YELLOW,
  4254. pixelSize: 5
  4255. },
  4256. label: {
  4257. text: "\u76EE\u6807\u4F4D\u7F6E",
  4258. font: "12px sans-serif",
  4259. fillColor: new Cesium.Color(255 / 255, 255 / 255, 255 / 255, 1),
  4260. outlineColor: new Cesium.Color(0, 154 / 255, 94 / 255, 1),
  4261. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  4262. outlineWidth: 1,
  4263. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  4264. pixelOffset: new Cesium.Cartesian2(0, -28),
  4265. showBackground: true,
  4266. backgroundColor: new Cesium.Color(0, 0, 0, 0.6),
  4267. disableDepthTestDistance: Number.POSITIVE_INFINITY
  4268. }
  4269. });
  4270. _self._resultObject.objectExclude.push(pointEntity);
  4271. _self._resultObject.entities.push(pointEntity);
  4272. let direction = Cesium.Cartesian3.normalize(
  4273. Cesium.Cartesian3.subtract(
  4274. _self._resultObject.targetPoint,
  4275. _self._resultObject.viewPoint,
  4276. new Cesium.Cartesian3()
  4277. ),
  4278. new Cesium.Cartesian3()
  4279. );
  4280. let ray = new Cesium.Ray(_self._resultObject.viewPoint, direction);
  4281. let result = _self._viewer.scene.pickFromRay(ray, _self._resultObject.objectExclude);
  4282. if (result) {
  4283. let dis0 = _self._distance(
  4284. _self._resultObject.viewPoint,
  4285. _self._resultObject.targetPoint
  4286. );
  4287. let dis1 = _self._distance(
  4288. _self._resultObject.viewPoint,
  4289. result.position
  4290. );
  4291. let dis2 = _self._distance(
  4292. result.position,
  4293. _self._resultObject.targetPoint
  4294. );
  4295. console.log(dis0, dis1, dis2);
  4296. if (dis0 > dis1) {
  4297. let _poly0 = _self._viewer.entities.add({
  4298. polyline: {
  4299. positions: [_self._resultObject.viewPoint, result.position],
  4300. material: Cesium.Color.GREEN,
  4301. width: 3
  4302. }
  4303. });
  4304. _self._resultObject.entities.push(_poly0);
  4305. let _poly1 = _self._viewer.entities.add({
  4306. polyline: {
  4307. positions: [result.position, _self._resultObject.targetPoint],
  4308. material: Cesium.Color.RED,
  4309. width: 3
  4310. }
  4311. });
  4312. _self._resultObject.entities.push(_poly1);
  4313. _self._resultObject.targetPoints.push({
  4314. targetPoint: cartesian,
  4315. visual: false,
  4316. distance: [dis0, dis1, dis2]
  4317. });
  4318. } else {
  4319. let _poly2 = _self._viewer.entities.add({
  4320. polyline: {
  4321. positions: [
  4322. _self._resultObject.viewPoint,
  4323. _self._resultObject.targetPoint
  4324. ],
  4325. material: Cesium.Color.GREEN,
  4326. width: 3
  4327. }
  4328. });
  4329. _self._resultObject.entities.push(_poly2);
  4330. _self._resultObject.targetPoints.push({
  4331. targetPoint: cartesian,
  4332. visual: true,
  4333. distance: [dis0, dis1, dis2]
  4334. });
  4335. }
  4336. }
  4337. }
  4338. if (_self._resultObject.objectExclude.length === 2) {
  4339. if (this._isRuntimeApp()) {
  4340. _self._createOperationMainDom();
  4341. document.getElementById("btnDrawComplete").onclick = () => {
  4342. CreateRemindertip(toolTip, event2.endPosition, false);
  4343. _self.handler.destroy();
  4344. let buttonDiv = document.getElementById("drawButtonDiv");
  4345. if (buttonDiv) {
  4346. document.body.removeChild(buttonDiv);
  4347. }
  4348. };
  4349. }
  4350. }
  4351. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  4352. _self.handler.setInputAction(function(move) {
  4353. if (_self._isRuntimeApp())
  4354. return;
  4355. CreateRemindertip(toolTip, move.endPosition, true);
  4356. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  4357. _self.handler.setInputAction((event2) => {
  4358. CreateRemindertip(toolTip, event2.endPosition, false);
  4359. _self.handler.destroy();
  4360. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  4361. },
  4362. clearAll() {
  4363. this._resultObject.entities.forEach((element) => {
  4364. this._viewer.entities.remove(element);
  4365. });
  4366. this._resultObject = {
  4367. viewPoint: void 0,
  4368. targetPoints: [],
  4369. targetPoint: void 0,
  4370. objectExclude: [],
  4371. entities: []
  4372. };
  4373. if (this.handler) {
  4374. this.handler.destroy();
  4375. }
  4376. let buttonDiv = document.getElementById("drawButtonDiv");
  4377. if (buttonDiv) {
  4378. document.body.removeChild(buttonDiv);
  4379. }
  4380. }
  4381. });
  4382. SightLine.RuntimeEnvironment = Object.freeze({
  4383. App: "app",
  4384. Web: "web"
  4385. });
  4386. /*!
  4387. * author: [object Object]
  4388. * @sakitam-gis/kriging v0.1.0
  4389. * build-time: 2019-7-6 20:41
  4390. * LICENSE: MIT
  4391. * (c) 2019-2019 https://github.com/sakitam-gis/kriging.js
  4392. */
  4393. function max(source) {
  4394. return Math.max.apply(null, source);
  4395. }
  4396. function min(source) {
  4397. return Math.min.apply(null, source);
  4398. }
  4399. function rep(source, n) {
  4400. var array = [];
  4401. for (var i2 = 0; i2 < n; i2++) {
  4402. array.push(source);
  4403. }
  4404. return array;
  4405. }
  4406. function pip(source, x, y) {
  4407. var i2 = 0;
  4408. var j = source.length - 1;
  4409. var c = false;
  4410. var length = source.length;
  4411. for (; i2 < length; j = i2++) {
  4412. if (source[i2][1] > y !== source[j][1] > y && x < (source[j][0] - source[i2][0]) * (y - source[i2][1]) / (source[j][1] - source[i2][1]) + source[i2][0]) {
  4413. c = !c;
  4414. }
  4415. }
  4416. return c;
  4417. }
  4418. function matrixDiag(c, n) {
  4419. var i2 = 0;
  4420. var Z2 = rep(0, n * n);
  4421. for (; i2 < n; i2++) {
  4422. Z2[i2 * n + i2] = c;
  4423. }
  4424. return Z2;
  4425. }
  4426. function matrixTranspose(X2, n, m) {
  4427. var i2 = 0;
  4428. var j;
  4429. var Z2 = Array(m * n);
  4430. for (; i2 < n; i2++) {
  4431. j = 0;
  4432. for (; j < m; j++) {
  4433. Z2[j * n + i2] = X2[i2 * m + j];
  4434. }
  4435. }
  4436. return Z2;
  4437. }
  4438. function matrixAdd(X2, Y, n, m) {
  4439. var i2 = 0;
  4440. var j;
  4441. var Z2 = Array(n * m);
  4442. for (; i2 < n; i2++) {
  4443. j = 0;
  4444. for (; j < m; j++) {
  4445. Z2[i2 * m + j] = X2[i2 * m + j] + Y[i2 * m + j];
  4446. }
  4447. }
  4448. return Z2;
  4449. }
  4450. function matrixMultiply(X2, Y, n, m, p) {
  4451. var i2 = 0;
  4452. var j;
  4453. var k;
  4454. var Z2 = Array(n * p);
  4455. for (; i2 < n; i2++) {
  4456. j = 0;
  4457. for (; j < p; j++) {
  4458. Z2[i2 * p + j] = 0;
  4459. k = 0;
  4460. for (; k < m; k++) {
  4461. Z2[i2 * p + j] += X2[i2 * m + k] * Y[k * p + j];
  4462. }
  4463. }
  4464. }
  4465. return Z2;
  4466. }
  4467. function matrixChol(X2, n) {
  4468. var i2;
  4469. var j;
  4470. var k;
  4471. var p = Array(n);
  4472. for (i2 = 0; i2 < n; i2++)
  4473. p[i2] = X2[i2 * n + i2];
  4474. for (i2 = 0; i2 < n; i2++) {
  4475. for (j = 0; j < i2; j++)
  4476. p[i2] -= X2[i2 * n + j] * X2[i2 * n + j];
  4477. if (p[i2] <= 0)
  4478. return false;
  4479. p[i2] = Math.sqrt(p[i2]);
  4480. for (j = i2 + 1; j < n; j++) {
  4481. for (k = 0; k < i2; k++)
  4482. X2[j * n + i2] -= X2[j * n + k] * X2[i2 * n + k];
  4483. X2[j * n + i2] /= p[i2];
  4484. }
  4485. }
  4486. for (i2 = 0; i2 < n; i2++)
  4487. X2[i2 * n + i2] = p[i2];
  4488. return true;
  4489. }
  4490. function matrixChol2inv(X2, n) {
  4491. var i2;
  4492. var j;
  4493. var k;
  4494. var sum;
  4495. for (i2 = 0; i2 < n; i2++) {
  4496. X2[i2 * n + i2] = 1 / X2[i2 * n + i2];
  4497. for (j = i2 + 1; j < n; j++) {
  4498. sum = 0;
  4499. for (k = i2; k < j; k++)
  4500. sum -= X2[j * n + k] * X2[k * n + i2];
  4501. X2[j * n + i2] = sum / X2[j * n + j];
  4502. }
  4503. }
  4504. for (i2 = 0; i2 < n; i2++)
  4505. for (j = i2 + 1; j < n; j++)
  4506. X2[i2 * n + j] = 0;
  4507. for (i2 = 0; i2 < n; i2++) {
  4508. X2[i2 * n + i2] *= X2[i2 * n + i2];
  4509. for (k = i2 + 1; k < n; k++)
  4510. X2[i2 * n + i2] += X2[k * n + i2] * X2[k * n + i2];
  4511. for (j = i2 + 1; j < n; j++)
  4512. for (k = j; k < n; k++)
  4513. X2[i2 * n + j] += X2[k * n + i2] * X2[k * n + j];
  4514. }
  4515. for (i2 = 0; i2 < n; i2++)
  4516. for (j = 0; j < i2; j++)
  4517. X2[i2 * n + j] = X2[j * n + i2];
  4518. }
  4519. function matrixSolve(X2, n) {
  4520. var m = n;
  4521. var b = Array(n * n);
  4522. var indxc = Array(n);
  4523. var indxr = Array(n);
  4524. var ipiv = Array(n);
  4525. var i2;
  4526. var icol = 0;
  4527. var irow = 0;
  4528. var j;
  4529. var k;
  4530. var l;
  4531. var ll;
  4532. var big;
  4533. var dum;
  4534. var pivinv;
  4535. var temp;
  4536. for (i2 = 0; i2 < n; i2++) {
  4537. for (j = 0; j < n; j++) {
  4538. if (i2 === j)
  4539. b[i2 * n + j] = 1;
  4540. else
  4541. b[i2 * n + j] = 0;
  4542. }
  4543. }
  4544. for (j = 0; j < n; j++)
  4545. ipiv[j] = 0;
  4546. for (i2 = 0; i2 < n; i2++) {
  4547. big = 0;
  4548. for (j = 0; j < n; j++) {
  4549. if (ipiv[j] !== 1) {
  4550. for (k = 0; k < n; k++) {
  4551. if (ipiv[k] === 0) {
  4552. if (Math.abs(X2[j * n + k]) >= big) {
  4553. big = Math.abs(X2[j * n + k]);
  4554. irow = j;
  4555. icol = k;
  4556. }
  4557. }
  4558. }
  4559. }
  4560. }
  4561. ++ipiv[icol];
  4562. if (irow !== icol) {
  4563. for (l = 0; l < n; l++) {
  4564. temp = X2[irow * n + l];
  4565. X2[irow * n + l] = X2[icol * n + l];
  4566. X2[icol * n + l] = temp;
  4567. }
  4568. for (l = 0; l < m; l++) {
  4569. temp = b[irow * n + l];
  4570. b[irow * n + l] = b[icol * n + l];
  4571. b[icol * n + l] = temp;
  4572. }
  4573. }
  4574. indxr[i2] = irow;
  4575. indxc[i2] = icol;
  4576. if (X2[icol * n + icol] === 0)
  4577. return false;
  4578. pivinv = 1 / X2[icol * n + icol];
  4579. X2[icol * n + icol] = 1;
  4580. for (l = 0; l < n; l++)
  4581. X2[icol * n + l] *= pivinv;
  4582. for (l = 0; l < m; l++)
  4583. b[icol * n + l] *= pivinv;
  4584. for (ll = 0; ll < n; ll++) {
  4585. if (ll !== icol) {
  4586. dum = X2[ll * n + icol];
  4587. X2[ll * n + icol] = 0;
  4588. for (l = 0; l < n; l++)
  4589. X2[ll * n + l] -= X2[icol * n + l] * dum;
  4590. for (l = 0; l < m; l++)
  4591. b[ll * n + l] -= b[icol * n + l] * dum;
  4592. }
  4593. }
  4594. }
  4595. for (l = n - 1; l >= 0; l--) {
  4596. if (indxr[l] !== indxc[l]) {
  4597. for (k = 0; k < n; k++) {
  4598. temp = X2[k * n + indxr[l]];
  4599. X2[k * n + indxr[l]] = X2[k * n + indxc[l]];
  4600. X2[k * n + indxc[l]] = temp;
  4601. }
  4602. }
  4603. }
  4604. return true;
  4605. }
  4606. function variogramGaussian(h2, nugget, range3, sill, A) {
  4607. return nugget + (sill - nugget) / range3 * (1 - Math.exp(-(1 / A) * Math.pow(h2 / range3, 2)));
  4608. }
  4609. function variogramExponential(h2, nugget, range3, sill, A) {
  4610. return nugget + (sill - nugget) / range3 * (1 - Math.exp(-(1 / A) * (h2 / range3)));
  4611. }
  4612. function variogramSpherical(h2, nugget, range3, sill) {
  4613. if (h2 > range3)
  4614. return nugget + (sill - nugget) / range3;
  4615. return nugget + (sill - nugget) / range3 * (1.5 * (h2 / range3) - 0.5 * Math.pow(h2 / range3, 3));
  4616. }
  4617. function train(t2, x, y, model, sigma2, alpha) {
  4618. var variogram = {
  4619. t: t2,
  4620. x,
  4621. y,
  4622. nugget: 0,
  4623. range: 0,
  4624. sill: 0,
  4625. A: 1 / 3,
  4626. n: 0,
  4627. model: variogramExponential,
  4628. K: [],
  4629. M: []
  4630. };
  4631. switch (model) {
  4632. case "gaussian":
  4633. variogram.model = variogramGaussian;
  4634. break;
  4635. case "exponential":
  4636. variogram.model = variogramExponential;
  4637. break;
  4638. case "spherical":
  4639. variogram.model = variogramSpherical;
  4640. break;
  4641. default:
  4642. variogram.model = variogramExponential;
  4643. }
  4644. var i2;
  4645. var j;
  4646. var k;
  4647. var l;
  4648. var n = t2.length;
  4649. var distance2 = Array((n * n - n) / 2);
  4650. for (i2 = 0, k = 0; i2 < n; i2++) {
  4651. for (j = 0; j < i2; j++, k++) {
  4652. distance2[k] = Array(2);
  4653. distance2[k][0] = Math.pow(Math.pow(x[i2] - x[j], 2) + Math.pow(y[i2] - y[j], 2), 0.5);
  4654. distance2[k][1] = Math.abs(t2[i2] - t2[j]);
  4655. }
  4656. }
  4657. distance2.sort(function(a, b) {
  4658. return a[0] - b[0];
  4659. });
  4660. variogram.range = distance2[(n * n - n) / 2 - 1][0];
  4661. var lags = (n * n - n) / 2 > 30 ? 30 : (n * n - n) / 2;
  4662. var tolerance = variogram.range / lags;
  4663. var lag = rep(0, lags);
  4664. var semi = rep(0, lags);
  4665. if (lags < 30) {
  4666. for (l = 0; l < lags; l++) {
  4667. lag[l] = distance2[l][0];
  4668. semi[l] = distance2[l][1];
  4669. }
  4670. } else {
  4671. for (i2 = 0, j = 0, k = 0, l = 0; i2 < lags && j < (n * n - n) / 2; i2++, k = 0) {
  4672. while (distance2[j][0] <= (i2 + 1) * tolerance) {
  4673. lag[l] += distance2[j][0];
  4674. semi[l] += distance2[j][1];
  4675. j++;
  4676. k++;
  4677. if (j >= (n * n - n) / 2)
  4678. break;
  4679. }
  4680. if (k > 0) {
  4681. lag[l] /= k;
  4682. semi[l] /= k;
  4683. l++;
  4684. }
  4685. }
  4686. if (l < 2)
  4687. return variogram;
  4688. }
  4689. n = l;
  4690. variogram.range = lag[n - 1] - lag[0];
  4691. var X2 = rep(1, 2 * n);
  4692. var Y = Array(n);
  4693. var A = variogram.A;
  4694. for (i2 = 0; i2 < n; i2++) {
  4695. switch (model) {
  4696. case "gaussian":
  4697. X2[i2 * 2 + 1] = 1 - Math.exp(-(1 / A) * Math.pow(lag[i2] / variogram.range, 2));
  4698. break;
  4699. case "exponential":
  4700. X2[i2 * 2 + 1] = 1 - Math.exp(-(1 / A) * lag[i2] / variogram.range);
  4701. break;
  4702. case "spherical":
  4703. X2[i2 * 2 + 1] = 1.5 * (lag[i2] / variogram.range) - 0.5 * Math.pow(lag[i2] / variogram.range, 3);
  4704. break;
  4705. }
  4706. Y[i2] = semi[i2];
  4707. }
  4708. var Xt2 = matrixTranspose(X2, n, 2);
  4709. var Z2 = matrixMultiply(Xt2, X2, 2, n, 2);
  4710. Z2 = matrixAdd(Z2, matrixDiag(1 / alpha, 2), 2, 2);
  4711. var cloneZ = Z2.slice(0);
  4712. if (matrixChol(Z2, 2)) {
  4713. matrixChol2inv(Z2, 2);
  4714. } else {
  4715. matrixSolve(cloneZ, 2);
  4716. Z2 = cloneZ;
  4717. }
  4718. var W2 = matrixMultiply(matrixMultiply(Z2, Xt2, 2, 2, n), Y, 2, n, 1);
  4719. variogram.nugget = W2[0];
  4720. variogram.sill = W2[1] * variogram.range + variogram.nugget;
  4721. variogram.n = x.length;
  4722. n = x.length;
  4723. var K2 = Array(n * n);
  4724. for (i2 = 0; i2 < n; i2++) {
  4725. for (j = 0; j < i2; j++) {
  4726. K2[i2 * n + j] = variogram.model(Math.pow(Math.pow(x[i2] - x[j], 2) + Math.pow(y[i2] - y[j], 2), 0.5), variogram.nugget, variogram.range, variogram.sill, variogram.A);
  4727. K2[j * n + i2] = K2[i2 * n + j];
  4728. }
  4729. K2[i2 * n + i2] = variogram.model(0, variogram.nugget, variogram.range, variogram.sill, variogram.A);
  4730. }
  4731. var C2 = matrixAdd(K2, matrixDiag(sigma2, n), n, n);
  4732. var cloneC = C2.slice(0);
  4733. if (matrixChol(C2, n)) {
  4734. matrixChol2inv(C2, n);
  4735. } else {
  4736. matrixSolve(cloneC, n);
  4737. C2 = cloneC;
  4738. }
  4739. var K1 = C2.slice(0);
  4740. var M = matrixMultiply(C2, t2, n, n, 1);
  4741. variogram.K = K1;
  4742. variogram.M = M;
  4743. return variogram;
  4744. }
  4745. function predict(x, y, variogram) {
  4746. var i2;
  4747. var k = Array(variogram.n);
  4748. for (i2 = 0; i2 < variogram.n; i2++) {
  4749. k[i2] = variogram.model(Math.pow(Math.pow(x - variogram.x[i2], 2) + Math.pow(y - variogram.y[i2], 2), 0.5), variogram.nugget, variogram.range, variogram.sill, variogram.A);
  4750. }
  4751. return matrixMultiply(k, variogram.M, 1, variogram.n, 1)[0];
  4752. }
  4753. function variance(x, y, variogram) {
  4754. var i2;
  4755. var k = Array(variogram.n);
  4756. for (i2 = 0; i2 < variogram.n; i2++) {
  4757. k[i2] = variogram.model(Math.pow(Math.pow(x - variogram.x[i2], 2) + Math.pow(y - variogram.y[i2], 2), 0.5), variogram.nugget, variogram.range, variogram.sill, variogram.A);
  4758. }
  4759. var val = matrixMultiply(matrixMultiply(k, variogram.K, 1, variogram.n, variogram.n), k, 1, variogram.n, 1)[0];
  4760. return variogram.model(0, variogram.nugget, variogram.range, variogram.sill, variogram.A) + val;
  4761. }
  4762. function grid(polygons2, variogram, width2) {
  4763. var i2;
  4764. var j;
  4765. var k;
  4766. var n = polygons2.length;
  4767. if (n === 0)
  4768. return;
  4769. var xlim = [polygons2[0][0][0], polygons2[0][0][0]];
  4770. var ylim = [polygons2[0][0][1], polygons2[0][0][1]];
  4771. for (i2 = 0; i2 < n; i2++) {
  4772. for (j = 0; j < polygons2[i2].length; j++) {
  4773. if (polygons2[i2][j][0] < xlim[0])
  4774. xlim[0] = polygons2[i2][j][0];
  4775. if (polygons2[i2][j][0] > xlim[1])
  4776. xlim[1] = polygons2[i2][j][0];
  4777. if (polygons2[i2][j][1] < ylim[0])
  4778. ylim[0] = polygons2[i2][j][1];
  4779. if (polygons2[i2][j][1] > ylim[1])
  4780. ylim[1] = polygons2[i2][j][1];
  4781. }
  4782. }
  4783. var xtarget;
  4784. var ytarget;
  4785. var a = Array(2);
  4786. var b = Array(2);
  4787. var lxlim = Array(2);
  4788. var lylim = Array(2);
  4789. var x = Math.ceil((xlim[1] - xlim[0]) / width2);
  4790. var y = Math.ceil((ylim[1] - ylim[0]) / width2);
  4791. var A = Array(x + 1);
  4792. for (i2 = 0; i2 <= x; i2++)
  4793. A[i2] = Array(y + 1);
  4794. for (i2 = 0; i2 < n; i2++) {
  4795. lxlim[0] = polygons2[i2][0][0];
  4796. lxlim[1] = lxlim[0];
  4797. lylim[0] = polygons2[i2][0][1];
  4798. lylim[1] = lylim[0];
  4799. for (j = 1; j < polygons2[i2].length; j++) {
  4800. if (polygons2[i2][j][0] < lxlim[0])
  4801. lxlim[0] = polygons2[i2][j][0];
  4802. if (polygons2[i2][j][0] > lxlim[1])
  4803. lxlim[1] = polygons2[i2][j][0];
  4804. if (polygons2[i2][j][1] < lylim[0])
  4805. lylim[0] = polygons2[i2][j][1];
  4806. if (polygons2[i2][j][1] > lylim[1])
  4807. lylim[1] = polygons2[i2][j][1];
  4808. }
  4809. a[0] = Math.floor((lxlim[0] - (lxlim[0] - xlim[0]) % width2 - xlim[0]) / width2);
  4810. a[1] = Math.ceil((lxlim[1] - (lxlim[1] - xlim[1]) % width2 - xlim[0]) / width2);
  4811. b[0] = Math.floor((lylim[0] - (lylim[0] - ylim[0]) % width2 - ylim[0]) / width2);
  4812. b[1] = Math.ceil((lylim[1] - (lylim[1] - ylim[1]) % width2 - ylim[0]) / width2);
  4813. for (j = a[0]; j <= a[1]; j++) {
  4814. for (k = b[0]; k <= b[1]; k++) {
  4815. xtarget = xlim[0] + j * width2;
  4816. ytarget = ylim[0] + k * width2;
  4817. if (pip(polygons2[i2], xtarget, ytarget)) {
  4818. A[j][k] = predict(xtarget, ytarget, variogram);
  4819. }
  4820. }
  4821. }
  4822. }
  4823. return {
  4824. xlim,
  4825. ylim,
  4826. width: width2,
  4827. data: A,
  4828. zlim: [min(variogram.t), max(variogram.t)]
  4829. };
  4830. }
  4831. function plot(canvas, grid2, xlim, ylim, colors) {
  4832. var ctx = canvas.getContext("2d");
  4833. var data = grid2.data, zlim = grid2.zlim, width2 = grid2.width;
  4834. if (ctx) {
  4835. ctx.clearRect(0, 0, canvas.width, canvas.height);
  4836. var range3 = [xlim[1] - xlim[0], ylim[1] - ylim[0], zlim[1] - zlim[0]];
  4837. var i2 = void 0;
  4838. var j = void 0;
  4839. var x = void 0;
  4840. var y = void 0;
  4841. var z = void 0;
  4842. var n = data.length;
  4843. var m = data[0].length;
  4844. var wx = Math.ceil(width2 * canvas.width / (xlim[1] - xlim[0]));
  4845. var wy = Math.ceil(width2 * canvas.height / (ylim[1] - ylim[0]));
  4846. for (i2 = 0; i2 < n; i2++) {
  4847. for (j = 0; j < m; j++) {
  4848. if (data[i2][j] === void 0)
  4849. continue;
  4850. x = canvas.width * (i2 * width2 + grid2.xlim[0] - xlim[0]) / range3[0];
  4851. y = canvas.height * (1 - (j * width2 + grid2.ylim[0] - ylim[0]) / range3[1]);
  4852. z = (data[i2][j] - zlim[0]) / range3[2];
  4853. if (z < 0)
  4854. z = 0;
  4855. if (z > 1)
  4856. z = 1;
  4857. ctx.fillStyle = colors[Math.floor((colors.length - 1) * z)];
  4858. ctx.fillRect(Math.round(x - wx / 2), Math.round(y - wy / 2), wx, wy);
  4859. }
  4860. }
  4861. }
  4862. }
  4863. var index = {
  4864. train,
  4865. predict,
  4866. variance,
  4867. grid,
  4868. plot,
  4869. max,
  4870. min,
  4871. pip,
  4872. rep,
  4873. matrixDiag,
  4874. matrixTranspose,
  4875. matrixAdd,
  4876. matrixMultiply,
  4877. matrixChol,
  4878. matrixChol2inv,
  4879. matrixSolve,
  4880. variogramGaussian,
  4881. variogramExponential,
  4882. variogramSpherical
  4883. };
  4884. var earthRadius = 63710088e-1;
  4885. var factors = {
  4886. centimeters: earthRadius * 100,
  4887. centimetres: earthRadius * 100,
  4888. degrees: earthRadius / 111325,
  4889. feet: earthRadius * 3.28084,
  4890. inches: earthRadius * 39.37,
  4891. kilometers: earthRadius / 1e3,
  4892. kilometres: earthRadius / 1e3,
  4893. meters: earthRadius,
  4894. metres: earthRadius,
  4895. miles: earthRadius / 1609.344,
  4896. millimeters: earthRadius * 1e3,
  4897. millimetres: earthRadius * 1e3,
  4898. nauticalmiles: earthRadius / 1852,
  4899. radians: 1,
  4900. yards: earthRadius * 1.0936
  4901. };
  4902. var unitsFactors = {
  4903. centimeters: 100,
  4904. centimetres: 100,
  4905. degrees: 1 / 111325,
  4906. feet: 3.28084,
  4907. inches: 39.37,
  4908. kilometers: 1 / 1e3,
  4909. kilometres: 1 / 1e3,
  4910. meters: 1,
  4911. metres: 1,
  4912. miles: 1 / 1609.344,
  4913. millimeters: 1e3,
  4914. millimetres: 1e3,
  4915. nauticalmiles: 1 / 1852,
  4916. radians: 1 / earthRadius,
  4917. yards: 1.0936133
  4918. };
  4919. var areaFactors = {
  4920. acres: 247105e-9,
  4921. centimeters: 1e4,
  4922. centimetres: 1e4,
  4923. feet: 10.763910417,
  4924. hectares: 1e-4,
  4925. inches: 1550.003100006,
  4926. kilometers: 1e-6,
  4927. kilometres: 1e-6,
  4928. meters: 1,
  4929. metres: 1,
  4930. miles: 386e-9,
  4931. millimeters: 1e6,
  4932. millimetres: 1e6,
  4933. yards: 1.195990046
  4934. };
  4935. function feature(geom, properties, options2) {
  4936. if (options2 === void 0) {
  4937. options2 = {};
  4938. }
  4939. var feat = { type: "Feature" };
  4940. if (options2.id === 0 || options2.id) {
  4941. feat.id = options2.id;
  4942. }
  4943. if (options2.bbox) {
  4944. feat.bbox = options2.bbox;
  4945. }
  4946. feat.properties = properties || {};
  4947. feat.geometry = geom;
  4948. return feat;
  4949. }
  4950. function geometry(type2, coordinates, _options) {
  4951. switch (type2) {
  4952. case "Point":
  4953. return point(coordinates).geometry;
  4954. case "LineString":
  4955. return lineString(coordinates).geometry;
  4956. case "Polygon":
  4957. return polygon(coordinates).geometry;
  4958. case "MultiPoint":
  4959. return multiPoint(coordinates).geometry;
  4960. case "MultiLineString":
  4961. return multiLineString(coordinates).geometry;
  4962. case "MultiPolygon":
  4963. return multiPolygon(coordinates).geometry;
  4964. default:
  4965. throw new Error(type2 + " is invalid");
  4966. }
  4967. }
  4968. function point(coordinates, properties, options2) {
  4969. if (options2 === void 0) {
  4970. options2 = {};
  4971. }
  4972. if (!coordinates) {
  4973. throw new Error("coordinates is required");
  4974. }
  4975. if (!Array.isArray(coordinates)) {
  4976. throw new Error("coordinates must be an Array");
  4977. }
  4978. if (coordinates.length < 2) {
  4979. throw new Error("coordinates must be at least 2 numbers long");
  4980. }
  4981. if (!isNumber$1(coordinates[0]) || !isNumber$1(coordinates[1])) {
  4982. throw new Error("coordinates must contain numbers");
  4983. }
  4984. var geom = {
  4985. type: "Point",
  4986. coordinates
  4987. };
  4988. return feature(geom, properties, options2);
  4989. }
  4990. function points(coordinates, properties, options2) {
  4991. if (options2 === void 0) {
  4992. options2 = {};
  4993. }
  4994. return featureCollection$1(coordinates.map(function(coords) {
  4995. return point(coords, properties);
  4996. }), options2);
  4997. }
  4998. function polygon(coordinates, properties, options2) {
  4999. if (options2 === void 0) {
  5000. options2 = {};
  5001. }
  5002. for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {
  5003. var ring = coordinates_1[_i];
  5004. if (ring.length < 4) {
  5005. throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
  5006. }
  5007. for (var j = 0; j < ring[ring.length - 1].length; j++) {
  5008. if (ring[ring.length - 1][j] !== ring[0][j]) {
  5009. throw new Error("First and last Position are not equivalent.");
  5010. }
  5011. }
  5012. }
  5013. var geom = {
  5014. type: "Polygon",
  5015. coordinates
  5016. };
  5017. return feature(geom, properties, options2);
  5018. }
  5019. function polygons(coordinates, properties, options2) {
  5020. if (options2 === void 0) {
  5021. options2 = {};
  5022. }
  5023. return featureCollection$1(coordinates.map(function(coords) {
  5024. return polygon(coords, properties);
  5025. }), options2);
  5026. }
  5027. function lineString(coordinates, properties, options2) {
  5028. if (options2 === void 0) {
  5029. options2 = {};
  5030. }
  5031. if (coordinates.length < 2) {
  5032. throw new Error("coordinates must be an array of two or more positions");
  5033. }
  5034. var geom = {
  5035. type: "LineString",
  5036. coordinates
  5037. };
  5038. return feature(geom, properties, options2);
  5039. }
  5040. function lineStrings(coordinates, properties, options2) {
  5041. if (options2 === void 0) {
  5042. options2 = {};
  5043. }
  5044. return featureCollection$1(coordinates.map(function(coords) {
  5045. return lineString(coords, properties);
  5046. }), options2);
  5047. }
  5048. function featureCollection$1(features, options2) {
  5049. if (options2 === void 0) {
  5050. options2 = {};
  5051. }
  5052. var fc = { type: "FeatureCollection" };
  5053. if (options2.id) {
  5054. fc.id = options2.id;
  5055. }
  5056. if (options2.bbox) {
  5057. fc.bbox = options2.bbox;
  5058. }
  5059. fc.features = features;
  5060. return fc;
  5061. }
  5062. function multiLineString(coordinates, properties, options2) {
  5063. if (options2 === void 0) {
  5064. options2 = {};
  5065. }
  5066. var geom = {
  5067. type: "MultiLineString",
  5068. coordinates
  5069. };
  5070. return feature(geom, properties, options2);
  5071. }
  5072. function multiPoint(coordinates, properties, options2) {
  5073. if (options2 === void 0) {
  5074. options2 = {};
  5075. }
  5076. var geom = {
  5077. type: "MultiPoint",
  5078. coordinates
  5079. };
  5080. return feature(geom, properties, options2);
  5081. }
  5082. function multiPolygon(coordinates, properties, options2) {
  5083. if (options2 === void 0) {
  5084. options2 = {};
  5085. }
  5086. var geom = {
  5087. type: "MultiPolygon",
  5088. coordinates
  5089. };
  5090. return feature(geom, properties, options2);
  5091. }
  5092. function geometryCollection(geometries, properties, options2) {
  5093. if (options2 === void 0) {
  5094. options2 = {};
  5095. }
  5096. var geom = {
  5097. type: "GeometryCollection",
  5098. geometries
  5099. };
  5100. return feature(geom, properties, options2);
  5101. }
  5102. function round(num, precision) {
  5103. if (precision === void 0) {
  5104. precision = 0;
  5105. }
  5106. if (precision && !(precision >= 0)) {
  5107. throw new Error("precision must be a positive number");
  5108. }
  5109. var multiplier = Math.pow(10, precision || 0);
  5110. return Math.round(num * multiplier) / multiplier;
  5111. }
  5112. function radiansToLength(radians, units) {
  5113. if (units === void 0) {
  5114. units = "kilometers";
  5115. }
  5116. var factor = factors[units];
  5117. if (!factor) {
  5118. throw new Error(units + " units is invalid");
  5119. }
  5120. return radians * factor;
  5121. }
  5122. function lengthToRadians(distance2, units) {
  5123. if (units === void 0) {
  5124. units = "kilometers";
  5125. }
  5126. var factor = factors[units];
  5127. if (!factor) {
  5128. throw new Error(units + " units is invalid");
  5129. }
  5130. return distance2 / factor;
  5131. }
  5132. function lengthToDegrees(distance2, units) {
  5133. return radiansToDegrees(lengthToRadians(distance2, units));
  5134. }
  5135. function bearingToAzimuth(bearing2) {
  5136. var angle = bearing2 % 360;
  5137. if (angle < 0) {
  5138. angle += 360;
  5139. }
  5140. return angle;
  5141. }
  5142. function radiansToDegrees(radians) {
  5143. var degrees = radians % (2 * Math.PI);
  5144. return degrees * 180 / Math.PI;
  5145. }
  5146. function degreesToRadians(degrees) {
  5147. var radians = degrees % 360;
  5148. return radians * Math.PI / 180;
  5149. }
  5150. function convertLength(length, originalUnit, finalUnit) {
  5151. if (originalUnit === void 0) {
  5152. originalUnit = "kilometers";
  5153. }
  5154. if (finalUnit === void 0) {
  5155. finalUnit = "kilometers";
  5156. }
  5157. if (!(length >= 0)) {
  5158. throw new Error("length must be a positive number");
  5159. }
  5160. return radiansToLength(lengthToRadians(length, originalUnit), finalUnit);
  5161. }
  5162. function convertArea(area, originalUnit, finalUnit) {
  5163. if (originalUnit === void 0) {
  5164. originalUnit = "meters";
  5165. }
  5166. if (finalUnit === void 0) {
  5167. finalUnit = "kilometers";
  5168. }
  5169. if (!(area >= 0)) {
  5170. throw new Error("area must be a positive number");
  5171. }
  5172. var startFactor = areaFactors[originalUnit];
  5173. if (!startFactor) {
  5174. throw new Error("invalid original units");
  5175. }
  5176. var finalFactor = areaFactors[finalUnit];
  5177. if (!finalFactor) {
  5178. throw new Error("invalid final units");
  5179. }
  5180. return area / startFactor * finalFactor;
  5181. }
  5182. function isNumber$1(num) {
  5183. return !isNaN(num) && num !== null && !Array.isArray(num);
  5184. }
  5185. function isObject$6(input) {
  5186. return !!input && input.constructor === Object;
  5187. }
  5188. function validateBBox(bbox2) {
  5189. if (!bbox2) {
  5190. throw new Error("bbox is required");
  5191. }
  5192. if (!Array.isArray(bbox2)) {
  5193. throw new Error("bbox must be an Array");
  5194. }
  5195. if (bbox2.length !== 4 && bbox2.length !== 6) {
  5196. throw new Error("bbox must be an Array of 4 or 6 numbers");
  5197. }
  5198. bbox2.forEach(function(num) {
  5199. if (!isNumber$1(num)) {
  5200. throw new Error("bbox must only contain numbers");
  5201. }
  5202. });
  5203. }
  5204. function validateId(id) {
  5205. if (!id) {
  5206. throw new Error("id is required");
  5207. }
  5208. if (["string", "number"].indexOf(typeof id) === -1) {
  5209. throw new Error("id must be a number or a string");
  5210. }
  5211. }
  5212. var es$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  5213. __proto__: null,
  5214. earthRadius,
  5215. factors,
  5216. unitsFactors,
  5217. areaFactors,
  5218. feature,
  5219. geometry,
  5220. point,
  5221. points,
  5222. polygon,
  5223. polygons,
  5224. lineString,
  5225. lineStrings,
  5226. featureCollection: featureCollection$1,
  5227. multiLineString,
  5228. multiPoint,
  5229. multiPolygon,
  5230. geometryCollection,
  5231. round,
  5232. radiansToLength,
  5233. lengthToRadians,
  5234. lengthToDegrees,
  5235. bearingToAzimuth,
  5236. radiansToDegrees,
  5237. degreesToRadians,
  5238. convertLength,
  5239. convertArea,
  5240. isNumber: isNumber$1,
  5241. isObject: isObject$6,
  5242. validateBBox,
  5243. validateId
  5244. }, Symbol.toStringTag, { value: "Module" }));
  5245. function coordEach(geojson, callback2, excludeWrapCoord) {
  5246. if (geojson === null)
  5247. return;
  5248. var j, k, l, geometry2, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type2 = geojson.type, isFeatureCollection = type2 === "FeatureCollection", isFeature = type2 === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
  5249. for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
  5250. geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
  5251. isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
  5252. stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
  5253. for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
  5254. var multiFeatureIndex = 0;
  5255. var geometryIndex = 0;
  5256. geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
  5257. if (geometry2 === null)
  5258. continue;
  5259. coords = geometry2.coordinates;
  5260. var geomType = geometry2.type;
  5261. wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
  5262. switch (geomType) {
  5263. case null:
  5264. break;
  5265. case "Point":
  5266. if (callback2(
  5267. coords,
  5268. coordIndex,
  5269. featureIndex,
  5270. multiFeatureIndex,
  5271. geometryIndex
  5272. ) === false)
  5273. return false;
  5274. coordIndex++;
  5275. multiFeatureIndex++;
  5276. break;
  5277. case "LineString":
  5278. case "MultiPoint":
  5279. for (j = 0; j < coords.length; j++) {
  5280. if (callback2(
  5281. coords[j],
  5282. coordIndex,
  5283. featureIndex,
  5284. multiFeatureIndex,
  5285. geometryIndex
  5286. ) === false)
  5287. return false;
  5288. coordIndex++;
  5289. if (geomType === "MultiPoint")
  5290. multiFeatureIndex++;
  5291. }
  5292. if (geomType === "LineString")
  5293. multiFeatureIndex++;
  5294. break;
  5295. case "Polygon":
  5296. case "MultiLineString":
  5297. for (j = 0; j < coords.length; j++) {
  5298. for (k = 0; k < coords[j].length - wrapShrink; k++) {
  5299. if (callback2(
  5300. coords[j][k],
  5301. coordIndex,
  5302. featureIndex,
  5303. multiFeatureIndex,
  5304. geometryIndex
  5305. ) === false)
  5306. return false;
  5307. coordIndex++;
  5308. }
  5309. if (geomType === "MultiLineString")
  5310. multiFeatureIndex++;
  5311. if (geomType === "Polygon")
  5312. geometryIndex++;
  5313. }
  5314. if (geomType === "Polygon")
  5315. multiFeatureIndex++;
  5316. break;
  5317. case "MultiPolygon":
  5318. for (j = 0; j < coords.length; j++) {
  5319. geometryIndex = 0;
  5320. for (k = 0; k < coords[j].length; k++) {
  5321. for (l = 0; l < coords[j][k].length - wrapShrink; l++) {
  5322. if (callback2(
  5323. coords[j][k][l],
  5324. coordIndex,
  5325. featureIndex,
  5326. multiFeatureIndex,
  5327. geometryIndex
  5328. ) === false)
  5329. return false;
  5330. coordIndex++;
  5331. }
  5332. geometryIndex++;
  5333. }
  5334. multiFeatureIndex++;
  5335. }
  5336. break;
  5337. case "GeometryCollection":
  5338. for (j = 0; j < geometry2.geometries.length; j++)
  5339. if (coordEach(geometry2.geometries[j], callback2, excludeWrapCoord) === false)
  5340. return false;
  5341. break;
  5342. default:
  5343. throw new Error("Unknown Geometry Type");
  5344. }
  5345. }
  5346. }
  5347. }
  5348. function coordReduce(geojson, callback2, initialValue, excludeWrapCoord) {
  5349. var previousValue = initialValue;
  5350. coordEach(
  5351. geojson,
  5352. function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {
  5353. if (coordIndex === 0 && initialValue === void 0)
  5354. previousValue = currentCoord;
  5355. else
  5356. previousValue = callback2(
  5357. previousValue,
  5358. currentCoord,
  5359. coordIndex,
  5360. featureIndex,
  5361. multiFeatureIndex,
  5362. geometryIndex
  5363. );
  5364. },
  5365. excludeWrapCoord
  5366. );
  5367. return previousValue;
  5368. }
  5369. function propEach(geojson, callback2) {
  5370. var i2;
  5371. switch (geojson.type) {
  5372. case "FeatureCollection":
  5373. for (i2 = 0; i2 < geojson.features.length; i2++) {
  5374. if (callback2(geojson.features[i2].properties, i2) === false)
  5375. break;
  5376. }
  5377. break;
  5378. case "Feature":
  5379. callback2(geojson.properties, 0);
  5380. break;
  5381. }
  5382. }
  5383. function propReduce(geojson, callback2, initialValue) {
  5384. var previousValue = initialValue;
  5385. propEach(geojson, function(currentProperties, featureIndex) {
  5386. if (featureIndex === 0 && initialValue === void 0)
  5387. previousValue = currentProperties;
  5388. else
  5389. previousValue = callback2(previousValue, currentProperties, featureIndex);
  5390. });
  5391. return previousValue;
  5392. }
  5393. function featureEach$1(geojson, callback2) {
  5394. if (geojson.type === "Feature") {
  5395. callback2(geojson, 0);
  5396. } else if (geojson.type === "FeatureCollection") {
  5397. for (var i2 = 0; i2 < geojson.features.length; i2++) {
  5398. if (callback2(geojson.features[i2], i2) === false)
  5399. break;
  5400. }
  5401. }
  5402. }
  5403. function featureReduce(geojson, callback2, initialValue) {
  5404. var previousValue = initialValue;
  5405. featureEach$1(geojson, function(currentFeature, featureIndex) {
  5406. if (featureIndex === 0 && initialValue === void 0)
  5407. previousValue = currentFeature;
  5408. else
  5409. previousValue = callback2(previousValue, currentFeature, featureIndex);
  5410. });
  5411. return previousValue;
  5412. }
  5413. function coordAll(geojson) {
  5414. var coords = [];
  5415. coordEach(geojson, function(coord) {
  5416. coords.push(coord);
  5417. });
  5418. return coords;
  5419. }
  5420. function geomEach(geojson, callback2) {
  5421. var i2, j, g, geometry2, stopG, geometryMaybeCollection, isGeometryCollection, featureProperties, featureBBox, featureId, featureIndex = 0, isFeatureCollection = geojson.type === "FeatureCollection", isFeature = geojson.type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
  5422. for (i2 = 0; i2 < stop; i2++) {
  5423. geometryMaybeCollection = isFeatureCollection ? geojson.features[i2].geometry : isFeature ? geojson.geometry : geojson;
  5424. featureProperties = isFeatureCollection ? geojson.features[i2].properties : isFeature ? geojson.properties : {};
  5425. featureBBox = isFeatureCollection ? geojson.features[i2].bbox : isFeature ? geojson.bbox : void 0;
  5426. featureId = isFeatureCollection ? geojson.features[i2].id : isFeature ? geojson.id : void 0;
  5427. isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
  5428. stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
  5429. for (g = 0; g < stopG; g++) {
  5430. geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[g] : geometryMaybeCollection;
  5431. if (geometry2 === null) {
  5432. if (callback2(
  5433. null,
  5434. featureIndex,
  5435. featureProperties,
  5436. featureBBox,
  5437. featureId
  5438. ) === false)
  5439. return false;
  5440. continue;
  5441. }
  5442. switch (geometry2.type) {
  5443. case "Point":
  5444. case "LineString":
  5445. case "MultiPoint":
  5446. case "Polygon":
  5447. case "MultiLineString":
  5448. case "MultiPolygon": {
  5449. if (callback2(
  5450. geometry2,
  5451. featureIndex,
  5452. featureProperties,
  5453. featureBBox,
  5454. featureId
  5455. ) === false)
  5456. return false;
  5457. break;
  5458. }
  5459. case "GeometryCollection": {
  5460. for (j = 0; j < geometry2.geometries.length; j++) {
  5461. if (callback2(
  5462. geometry2.geometries[j],
  5463. featureIndex,
  5464. featureProperties,
  5465. featureBBox,
  5466. featureId
  5467. ) === false)
  5468. return false;
  5469. }
  5470. break;
  5471. }
  5472. default:
  5473. throw new Error("Unknown Geometry Type");
  5474. }
  5475. }
  5476. featureIndex++;
  5477. }
  5478. }
  5479. function geomReduce(geojson, callback2, initialValue) {
  5480. var previousValue = initialValue;
  5481. geomEach(
  5482. geojson,
  5483. function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId) {
  5484. if (featureIndex === 0 && initialValue === void 0)
  5485. previousValue = currentGeometry;
  5486. else
  5487. previousValue = callback2(
  5488. previousValue,
  5489. currentGeometry,
  5490. featureIndex,
  5491. featureProperties,
  5492. featureBBox,
  5493. featureId
  5494. );
  5495. }
  5496. );
  5497. return previousValue;
  5498. }
  5499. function flattenEach(geojson, callback2) {
  5500. geomEach(geojson, function(geometry2, featureIndex, properties, bbox2, id) {
  5501. var type2 = geometry2 === null ? null : geometry2.type;
  5502. switch (type2) {
  5503. case null:
  5504. case "Point":
  5505. case "LineString":
  5506. case "Polygon":
  5507. if (callback2(
  5508. feature(geometry2, properties, { bbox: bbox2, id }),
  5509. featureIndex,
  5510. 0
  5511. ) === false)
  5512. return false;
  5513. return;
  5514. }
  5515. var geomType;
  5516. switch (type2) {
  5517. case "MultiPoint":
  5518. geomType = "Point";
  5519. break;
  5520. case "MultiLineString":
  5521. geomType = "LineString";
  5522. break;
  5523. case "MultiPolygon":
  5524. geomType = "Polygon";
  5525. break;
  5526. }
  5527. for (var multiFeatureIndex = 0; multiFeatureIndex < geometry2.coordinates.length; multiFeatureIndex++) {
  5528. var coordinate = geometry2.coordinates[multiFeatureIndex];
  5529. var geom = {
  5530. type: geomType,
  5531. coordinates: coordinate
  5532. };
  5533. if (callback2(feature(geom, properties), featureIndex, multiFeatureIndex) === false)
  5534. return false;
  5535. }
  5536. });
  5537. }
  5538. function flattenReduce(geojson, callback2, initialValue) {
  5539. var previousValue = initialValue;
  5540. flattenEach(
  5541. geojson,
  5542. function(currentFeature, featureIndex, multiFeatureIndex) {
  5543. if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === void 0)
  5544. previousValue = currentFeature;
  5545. else
  5546. previousValue = callback2(
  5547. previousValue,
  5548. currentFeature,
  5549. featureIndex,
  5550. multiFeatureIndex
  5551. );
  5552. }
  5553. );
  5554. return previousValue;
  5555. }
  5556. function segmentEach(geojson, callback2) {
  5557. flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {
  5558. var segmentIndex = 0;
  5559. if (!feature2.geometry)
  5560. return;
  5561. var type2 = feature2.geometry.type;
  5562. if (type2 === "Point" || type2 === "MultiPoint")
  5563. return;
  5564. var previousCoords;
  5565. var previousFeatureIndex = 0;
  5566. var previousMultiIndex = 0;
  5567. var prevGeomIndex = 0;
  5568. if (coordEach(
  5569. feature2,
  5570. function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
  5571. if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
  5572. previousCoords = currentCoord;
  5573. previousFeatureIndex = featureIndex;
  5574. previousMultiIndex = multiPartIndexCoord;
  5575. prevGeomIndex = geometryIndex;
  5576. segmentIndex = 0;
  5577. return;
  5578. }
  5579. var currentSegment = lineString(
  5580. [previousCoords, currentCoord],
  5581. feature2.properties
  5582. );
  5583. if (callback2(
  5584. currentSegment,
  5585. featureIndex,
  5586. multiFeatureIndex,
  5587. geometryIndex,
  5588. segmentIndex
  5589. ) === false)
  5590. return false;
  5591. segmentIndex++;
  5592. previousCoords = currentCoord;
  5593. }
  5594. ) === false)
  5595. return false;
  5596. });
  5597. }
  5598. function segmentReduce(geojson, callback2, initialValue) {
  5599. var previousValue = initialValue;
  5600. var started = false;
  5601. segmentEach(
  5602. geojson,
  5603. function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {
  5604. if (started === false && initialValue === void 0)
  5605. previousValue = currentSegment;
  5606. else
  5607. previousValue = callback2(
  5608. previousValue,
  5609. currentSegment,
  5610. featureIndex,
  5611. multiFeatureIndex,
  5612. geometryIndex,
  5613. segmentIndex
  5614. );
  5615. started = true;
  5616. }
  5617. );
  5618. return previousValue;
  5619. }
  5620. function lineEach(geojson, callback2) {
  5621. if (!geojson)
  5622. throw new Error("geojson is required");
  5623. flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {
  5624. if (feature2.geometry === null)
  5625. return;
  5626. var type2 = feature2.geometry.type;
  5627. var coords = feature2.geometry.coordinates;
  5628. switch (type2) {
  5629. case "LineString":
  5630. if (callback2(feature2, featureIndex, multiFeatureIndex, 0, 0) === false)
  5631. return false;
  5632. break;
  5633. case "Polygon":
  5634. for (var geometryIndex = 0; geometryIndex < coords.length; geometryIndex++) {
  5635. if (callback2(
  5636. lineString(coords[geometryIndex], feature2.properties),
  5637. featureIndex,
  5638. multiFeatureIndex,
  5639. geometryIndex
  5640. ) === false)
  5641. return false;
  5642. }
  5643. break;
  5644. }
  5645. });
  5646. }
  5647. function lineReduce(geojson, callback2, initialValue) {
  5648. var previousValue = initialValue;
  5649. lineEach(
  5650. geojson,
  5651. function(currentLine, featureIndex, multiFeatureIndex, geometryIndex) {
  5652. if (featureIndex === 0 && initialValue === void 0)
  5653. previousValue = currentLine;
  5654. else
  5655. previousValue = callback2(
  5656. previousValue,
  5657. currentLine,
  5658. featureIndex,
  5659. multiFeatureIndex,
  5660. geometryIndex
  5661. );
  5662. }
  5663. );
  5664. return previousValue;
  5665. }
  5666. function findSegment(geojson, options2) {
  5667. options2 = options2 || {};
  5668. if (!isObject$6(options2))
  5669. throw new Error("options is invalid");
  5670. var featureIndex = options2.featureIndex || 0;
  5671. var multiFeatureIndex = options2.multiFeatureIndex || 0;
  5672. var geometryIndex = options2.geometryIndex || 0;
  5673. var segmentIndex = options2.segmentIndex || 0;
  5674. var properties = options2.properties;
  5675. var geometry2;
  5676. switch (geojson.type) {
  5677. case "FeatureCollection":
  5678. if (featureIndex < 0)
  5679. featureIndex = geojson.features.length + featureIndex;
  5680. properties = properties || geojson.features[featureIndex].properties;
  5681. geometry2 = geojson.features[featureIndex].geometry;
  5682. break;
  5683. case "Feature":
  5684. properties = properties || geojson.properties;
  5685. geometry2 = geojson.geometry;
  5686. break;
  5687. case "Point":
  5688. case "MultiPoint":
  5689. return null;
  5690. case "LineString":
  5691. case "Polygon":
  5692. case "MultiLineString":
  5693. case "MultiPolygon":
  5694. geometry2 = geojson;
  5695. break;
  5696. default:
  5697. throw new Error("geojson is invalid");
  5698. }
  5699. if (geometry2 === null)
  5700. return null;
  5701. var coords = geometry2.coordinates;
  5702. switch (geometry2.type) {
  5703. case "Point":
  5704. case "MultiPoint":
  5705. return null;
  5706. case "LineString":
  5707. if (segmentIndex < 0)
  5708. segmentIndex = coords.length + segmentIndex - 1;
  5709. return lineString(
  5710. [coords[segmentIndex], coords[segmentIndex + 1]],
  5711. properties,
  5712. options2
  5713. );
  5714. case "Polygon":
  5715. if (geometryIndex < 0)
  5716. geometryIndex = coords.length + geometryIndex;
  5717. if (segmentIndex < 0)
  5718. segmentIndex = coords[geometryIndex].length + segmentIndex - 1;
  5719. return lineString(
  5720. [
  5721. coords[geometryIndex][segmentIndex],
  5722. coords[geometryIndex][segmentIndex + 1]
  5723. ],
  5724. properties,
  5725. options2
  5726. );
  5727. case "MultiLineString":
  5728. if (multiFeatureIndex < 0)
  5729. multiFeatureIndex = coords.length + multiFeatureIndex;
  5730. if (segmentIndex < 0)
  5731. segmentIndex = coords[multiFeatureIndex].length + segmentIndex - 1;
  5732. return lineString(
  5733. [
  5734. coords[multiFeatureIndex][segmentIndex],
  5735. coords[multiFeatureIndex][segmentIndex + 1]
  5736. ],
  5737. properties,
  5738. options2
  5739. );
  5740. case "MultiPolygon":
  5741. if (multiFeatureIndex < 0)
  5742. multiFeatureIndex = coords.length + multiFeatureIndex;
  5743. if (geometryIndex < 0)
  5744. geometryIndex = coords[multiFeatureIndex].length + geometryIndex;
  5745. if (segmentIndex < 0)
  5746. segmentIndex = coords[multiFeatureIndex][geometryIndex].length - segmentIndex - 1;
  5747. return lineString(
  5748. [
  5749. coords[multiFeatureIndex][geometryIndex][segmentIndex],
  5750. coords[multiFeatureIndex][geometryIndex][segmentIndex + 1]
  5751. ],
  5752. properties,
  5753. options2
  5754. );
  5755. }
  5756. throw new Error("geojson is invalid");
  5757. }
  5758. function findPoint(geojson, options2) {
  5759. options2 = options2 || {};
  5760. if (!isObject$6(options2))
  5761. throw new Error("options is invalid");
  5762. var featureIndex = options2.featureIndex || 0;
  5763. var multiFeatureIndex = options2.multiFeatureIndex || 0;
  5764. var geometryIndex = options2.geometryIndex || 0;
  5765. var coordIndex = options2.coordIndex || 0;
  5766. var properties = options2.properties;
  5767. var geometry2;
  5768. switch (geojson.type) {
  5769. case "FeatureCollection":
  5770. if (featureIndex < 0)
  5771. featureIndex = geojson.features.length + featureIndex;
  5772. properties = properties || geojson.features[featureIndex].properties;
  5773. geometry2 = geojson.features[featureIndex].geometry;
  5774. break;
  5775. case "Feature":
  5776. properties = properties || geojson.properties;
  5777. geometry2 = geojson.geometry;
  5778. break;
  5779. case "Point":
  5780. case "MultiPoint":
  5781. return null;
  5782. case "LineString":
  5783. case "Polygon":
  5784. case "MultiLineString":
  5785. case "MultiPolygon":
  5786. geometry2 = geojson;
  5787. break;
  5788. default:
  5789. throw new Error("geojson is invalid");
  5790. }
  5791. if (geometry2 === null)
  5792. return null;
  5793. var coords = geometry2.coordinates;
  5794. switch (geometry2.type) {
  5795. case "Point":
  5796. return point(coords, properties, options2);
  5797. case "MultiPoint":
  5798. if (multiFeatureIndex < 0)
  5799. multiFeatureIndex = coords.length + multiFeatureIndex;
  5800. return point(coords[multiFeatureIndex], properties, options2);
  5801. case "LineString":
  5802. if (coordIndex < 0)
  5803. coordIndex = coords.length + coordIndex;
  5804. return point(coords[coordIndex], properties, options2);
  5805. case "Polygon":
  5806. if (geometryIndex < 0)
  5807. geometryIndex = coords.length + geometryIndex;
  5808. if (coordIndex < 0)
  5809. coordIndex = coords[geometryIndex].length + coordIndex;
  5810. return point(coords[geometryIndex][coordIndex], properties, options2);
  5811. case "MultiLineString":
  5812. if (multiFeatureIndex < 0)
  5813. multiFeatureIndex = coords.length + multiFeatureIndex;
  5814. if (coordIndex < 0)
  5815. coordIndex = coords[multiFeatureIndex].length + coordIndex;
  5816. return point(coords[multiFeatureIndex][coordIndex], properties, options2);
  5817. case "MultiPolygon":
  5818. if (multiFeatureIndex < 0)
  5819. multiFeatureIndex = coords.length + multiFeatureIndex;
  5820. if (geometryIndex < 0)
  5821. geometryIndex = coords[multiFeatureIndex].length + geometryIndex;
  5822. if (coordIndex < 0)
  5823. coordIndex = coords[multiFeatureIndex][geometryIndex].length - coordIndex;
  5824. return point(
  5825. coords[multiFeatureIndex][geometryIndex][coordIndex],
  5826. properties,
  5827. options2
  5828. );
  5829. }
  5830. throw new Error("geojson is invalid");
  5831. }
  5832. var es$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  5833. __proto__: null,
  5834. coordAll,
  5835. coordEach,
  5836. coordReduce,
  5837. featureEach: featureEach$1,
  5838. featureReduce,
  5839. findPoint,
  5840. findSegment,
  5841. flattenEach,
  5842. flattenReduce,
  5843. geomEach,
  5844. geomReduce,
  5845. lineEach,
  5846. lineReduce,
  5847. propEach,
  5848. propReduce,
  5849. segmentEach,
  5850. segmentReduce
  5851. }, Symbol.toStringTag, { value: "Module" }));
  5852. function bbox$1(geojson) {
  5853. var result = [Infinity, Infinity, -Infinity, -Infinity];
  5854. coordEach(geojson, function(coord) {
  5855. if (result[0] > coord[0]) {
  5856. result[0] = coord[0];
  5857. }
  5858. if (result[1] > coord[1]) {
  5859. result[1] = coord[1];
  5860. }
  5861. if (result[2] < coord[0]) {
  5862. result[2] = coord[0];
  5863. }
  5864. if (result[3] < coord[1]) {
  5865. result[3] = coord[1];
  5866. }
  5867. });
  5868. return result;
  5869. }
  5870. bbox$1["default"] = bbox$1;
  5871. var es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  5872. __proto__: null,
  5873. "default": bbox$1
  5874. }, Symbol.toStringTag, { value: "Module" }));
  5875. function getCoord(coord) {
  5876. if (!coord) {
  5877. throw new Error("coord is required");
  5878. }
  5879. if (!Array.isArray(coord)) {
  5880. if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
  5881. return coord.geometry.coordinates;
  5882. }
  5883. if (coord.type === "Point") {
  5884. return coord.coordinates;
  5885. }
  5886. }
  5887. if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
  5888. return coord;
  5889. }
  5890. throw new Error("coord must be GeoJSON Point or an Array of numbers");
  5891. }
  5892. function getCoords(coords) {
  5893. if (Array.isArray(coords)) {
  5894. return coords;
  5895. }
  5896. if (coords.type === "Feature") {
  5897. if (coords.geometry !== null) {
  5898. return coords.geometry.coordinates;
  5899. }
  5900. } else {
  5901. if (coords.coordinates) {
  5902. return coords.coordinates;
  5903. }
  5904. }
  5905. throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array");
  5906. }
  5907. function getGeom(geojson) {
  5908. if (geojson.type === "Feature") {
  5909. return geojson.geometry;
  5910. }
  5911. return geojson;
  5912. }
  5913. function getType(geojson, _name) {
  5914. if (geojson.type === "FeatureCollection") {
  5915. return "FeatureCollection";
  5916. }
  5917. if (geojson.type === "GeometryCollection") {
  5918. return "GeometryCollection";
  5919. }
  5920. if (geojson.type === "Feature" && geojson.geometry !== null) {
  5921. return geojson.geometry.type;
  5922. }
  5923. return geojson.type;
  5924. }
  5925. var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  5926. function getDefaultExportFromCjs(x) {
  5927. return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
  5928. }
  5929. function getAugmentedNamespace(n) {
  5930. if (n.__esModule)
  5931. return n;
  5932. var a = Object.defineProperty({}, "__esModule", { value: true });
  5933. Object.keys(n).forEach(function(k) {
  5934. var d2 = Object.getOwnPropertyDescriptor(n, k);
  5935. Object.defineProperty(a, k, d2.get ? d2 : {
  5936. enumerable: true,
  5937. get: function() {
  5938. return n[k];
  5939. }
  5940. });
  5941. });
  5942. return a;
  5943. }
  5944. var concaveman$2 = { exports: {} };
  5945. var rbush_min$1 = { exports: {} };
  5946. (function(module2, exports2) {
  5947. !function(t2, i2) {
  5948. module2.exports = i2();
  5949. }(commonjsGlobal, function() {
  5950. function t2(t3, r3, e2, a2, h3) {
  5951. !function t4(n2, r4, e3, a3, h4) {
  5952. for (; a3 > e3; ) {
  5953. if (a3 - e3 > 600) {
  5954. var o2 = a3 - e3 + 1, s2 = r4 - e3 + 1, l2 = Math.log(o2), f2 = 0.5 * Math.exp(2 * l2 / 3), u2 = 0.5 * Math.sqrt(l2 * f2 * (o2 - f2) / o2) * (s2 - o2 / 2 < 0 ? -1 : 1), m2 = Math.max(e3, Math.floor(r4 - s2 * f2 / o2 + u2)), c2 = Math.min(a3, Math.floor(r4 + (o2 - s2) * f2 / o2 + u2));
  5955. t4(n2, r4, m2, c2, h4);
  5956. }
  5957. var p2 = n2[r4], d3 = e3, x = a3;
  5958. for (i2(n2, e3, r4), h4(n2[a3], p2) > 0 && i2(n2, e3, a3); d3 < x; ) {
  5959. for (i2(n2, d3, x), d3++, x--; h4(n2[d3], p2) < 0; )
  5960. d3++;
  5961. for (; h4(n2[x], p2) > 0; )
  5962. x--;
  5963. }
  5964. 0 === h4(n2[e3], p2) ? i2(n2, e3, x) : i2(n2, ++x, a3), x <= r4 && (e3 = x + 1), r4 <= x && (a3 = x - 1);
  5965. }
  5966. }(t3, r3, e2 || 0, a2 || t3.length - 1, h3 || n);
  5967. }
  5968. function i2(t3, i3, n2) {
  5969. var r3 = t3[i3];
  5970. t3[i3] = t3[n2], t3[n2] = r3;
  5971. }
  5972. function n(t3, i3) {
  5973. return t3 < i3 ? -1 : t3 > i3 ? 1 : 0;
  5974. }
  5975. var r2 = function(t3) {
  5976. void 0 === t3 && (t3 = 9), this._maxEntries = Math.max(4, t3), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
  5977. };
  5978. function e(t3, i3, n2) {
  5979. if (!n2)
  5980. return i3.indexOf(t3);
  5981. for (var r3 = 0; r3 < i3.length; r3++)
  5982. if (n2(t3, i3[r3]))
  5983. return r3;
  5984. return -1;
  5985. }
  5986. function a(t3, i3) {
  5987. h2(t3, 0, t3.children.length, i3, t3);
  5988. }
  5989. function h2(t3, i3, n2, r3, e2) {
  5990. e2 || (e2 = p(null)), e2.minX = 1 / 0, e2.minY = 1 / 0, e2.maxX = -1 / 0, e2.maxY = -1 / 0;
  5991. for (var a2 = i3; a2 < n2; a2++) {
  5992. var h3 = t3.children[a2];
  5993. o(e2, t3.leaf ? r3(h3) : h3);
  5994. }
  5995. return e2;
  5996. }
  5997. function o(t3, i3) {
  5998. return t3.minX = Math.min(t3.minX, i3.minX), t3.minY = Math.min(t3.minY, i3.minY), t3.maxX = Math.max(t3.maxX, i3.maxX), t3.maxY = Math.max(t3.maxY, i3.maxY), t3;
  5999. }
  6000. function s(t3, i3) {
  6001. return t3.minX - i3.minX;
  6002. }
  6003. function l(t3, i3) {
  6004. return t3.minY - i3.minY;
  6005. }
  6006. function f(t3) {
  6007. return (t3.maxX - t3.minX) * (t3.maxY - t3.minY);
  6008. }
  6009. function u(t3) {
  6010. return t3.maxX - t3.minX + (t3.maxY - t3.minY);
  6011. }
  6012. function m(t3, i3) {
  6013. return t3.minX <= i3.minX && t3.minY <= i3.minY && i3.maxX <= t3.maxX && i3.maxY <= t3.maxY;
  6014. }
  6015. function c(t3, i3) {
  6016. return i3.minX <= t3.maxX && i3.minY <= t3.maxY && i3.maxX >= t3.minX && i3.maxY >= t3.minY;
  6017. }
  6018. function p(t3) {
  6019. return { children: t3, height: 1, leaf: true, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
  6020. }
  6021. function d2(i3, n2, r3, e2, a2) {
  6022. for (var h3 = [n2, r3]; h3.length; )
  6023. if (!((r3 = h3.pop()) - (n2 = h3.pop()) <= e2)) {
  6024. var o2 = n2 + Math.ceil((r3 - n2) / e2 / 2) * e2;
  6025. t2(i3, o2, n2, r3, a2), h3.push(n2, o2, o2, r3);
  6026. }
  6027. }
  6028. return r2.prototype.all = function() {
  6029. return this._all(this.data, []);
  6030. }, r2.prototype.search = function(t3) {
  6031. var i3 = this.data, n2 = [];
  6032. if (!c(t3, i3))
  6033. return n2;
  6034. for (var r3 = this.toBBox, e2 = []; i3; ) {
  6035. for (var a2 = 0; a2 < i3.children.length; a2++) {
  6036. var h3 = i3.children[a2], o2 = i3.leaf ? r3(h3) : h3;
  6037. c(t3, o2) && (i3.leaf ? n2.push(h3) : m(t3, o2) ? this._all(h3, n2) : e2.push(h3));
  6038. }
  6039. i3 = e2.pop();
  6040. }
  6041. return n2;
  6042. }, r2.prototype.collides = function(t3) {
  6043. var i3 = this.data;
  6044. if (!c(t3, i3))
  6045. return false;
  6046. for (var n2 = []; i3; ) {
  6047. for (var r3 = 0; r3 < i3.children.length; r3++) {
  6048. var e2 = i3.children[r3], a2 = i3.leaf ? this.toBBox(e2) : e2;
  6049. if (c(t3, a2)) {
  6050. if (i3.leaf || m(t3, a2))
  6051. return true;
  6052. n2.push(e2);
  6053. }
  6054. }
  6055. i3 = n2.pop();
  6056. }
  6057. return false;
  6058. }, r2.prototype.load = function(t3) {
  6059. if (!t3 || !t3.length)
  6060. return this;
  6061. if (t3.length < this._minEntries) {
  6062. for (var i3 = 0; i3 < t3.length; i3++)
  6063. this.insert(t3[i3]);
  6064. return this;
  6065. }
  6066. var n2 = this._build(t3.slice(), 0, t3.length - 1, 0);
  6067. if (this.data.children.length)
  6068. if (this.data.height === n2.height)
  6069. this._splitRoot(this.data, n2);
  6070. else {
  6071. if (this.data.height < n2.height) {
  6072. var r3 = this.data;
  6073. this.data = n2, n2 = r3;
  6074. }
  6075. this._insert(n2, this.data.height - n2.height - 1, true);
  6076. }
  6077. else
  6078. this.data = n2;
  6079. return this;
  6080. }, r2.prototype.insert = function(t3) {
  6081. return t3 && this._insert(t3, this.data.height - 1), this;
  6082. }, r2.prototype.clear = function() {
  6083. return this.data = p([]), this;
  6084. }, r2.prototype.remove = function(t3, i3) {
  6085. if (!t3)
  6086. return this;
  6087. for (var n2, r3, a2, h3 = this.data, o2 = this.toBBox(t3), s2 = [], l2 = []; h3 || s2.length; ) {
  6088. if (h3 || (h3 = s2.pop(), r3 = s2[s2.length - 1], n2 = l2.pop(), a2 = true), h3.leaf) {
  6089. var f2 = e(t3, h3.children, i3);
  6090. if (-1 !== f2)
  6091. return h3.children.splice(f2, 1), s2.push(h3), this._condense(s2), this;
  6092. }
  6093. a2 || h3.leaf || !m(h3, o2) ? r3 ? (n2++, h3 = r3.children[n2], a2 = false) : h3 = null : (s2.push(h3), l2.push(n2), n2 = 0, r3 = h3, h3 = h3.children[0]);
  6094. }
  6095. return this;
  6096. }, r2.prototype.toBBox = function(t3) {
  6097. return t3;
  6098. }, r2.prototype.compareMinX = function(t3, i3) {
  6099. return t3.minX - i3.minX;
  6100. }, r2.prototype.compareMinY = function(t3, i3) {
  6101. return t3.minY - i3.minY;
  6102. }, r2.prototype.toJSON = function() {
  6103. return this.data;
  6104. }, r2.prototype.fromJSON = function(t3) {
  6105. return this.data = t3, this;
  6106. }, r2.prototype._all = function(t3, i3) {
  6107. for (var n2 = []; t3; )
  6108. t3.leaf ? i3.push.apply(i3, t3.children) : n2.push.apply(n2, t3.children), t3 = n2.pop();
  6109. return i3;
  6110. }, r2.prototype._build = function(t3, i3, n2, r3) {
  6111. var e2, h3 = n2 - i3 + 1, o2 = this._maxEntries;
  6112. if (h3 <= o2)
  6113. return a(e2 = p(t3.slice(i3, n2 + 1)), this.toBBox), e2;
  6114. r3 || (r3 = Math.ceil(Math.log(h3) / Math.log(o2)), o2 = Math.ceil(h3 / Math.pow(o2, r3 - 1))), (e2 = p([])).leaf = false, e2.height = r3;
  6115. var s2 = Math.ceil(h3 / o2), l2 = s2 * Math.ceil(Math.sqrt(o2));
  6116. d2(t3, i3, n2, l2, this.compareMinX);
  6117. for (var f2 = i3; f2 <= n2; f2 += l2) {
  6118. var u2 = Math.min(f2 + l2 - 1, n2);
  6119. d2(t3, f2, u2, s2, this.compareMinY);
  6120. for (var m2 = f2; m2 <= u2; m2 += s2) {
  6121. var c2 = Math.min(m2 + s2 - 1, u2);
  6122. e2.children.push(this._build(t3, m2, c2, r3 - 1));
  6123. }
  6124. }
  6125. return a(e2, this.toBBox), e2;
  6126. }, r2.prototype._chooseSubtree = function(t3, i3, n2, r3) {
  6127. for (; r3.push(i3), !i3.leaf && r3.length - 1 !== n2; ) {
  6128. for (var e2 = 1 / 0, a2 = 1 / 0, h3 = void 0, o2 = 0; o2 < i3.children.length; o2++) {
  6129. var s2 = i3.children[o2], l2 = f(s2), u2 = (m2 = t3, c2 = s2, (Math.max(c2.maxX, m2.maxX) - Math.min(c2.minX, m2.minX)) * (Math.max(c2.maxY, m2.maxY) - Math.min(c2.minY, m2.minY)) - l2);
  6130. u2 < a2 ? (a2 = u2, e2 = l2 < e2 ? l2 : e2, h3 = s2) : u2 === a2 && l2 < e2 && (e2 = l2, h3 = s2);
  6131. }
  6132. i3 = h3 || i3.children[0];
  6133. }
  6134. var m2, c2;
  6135. return i3;
  6136. }, r2.prototype._insert = function(t3, i3, n2) {
  6137. var r3 = n2 ? t3 : this.toBBox(t3), e2 = [], a2 = this._chooseSubtree(r3, this.data, i3, e2);
  6138. for (a2.children.push(t3), o(a2, r3); i3 >= 0 && e2[i3].children.length > this._maxEntries; )
  6139. this._split(e2, i3), i3--;
  6140. this._adjustParentBBoxes(r3, e2, i3);
  6141. }, r2.prototype._split = function(t3, i3) {
  6142. var n2 = t3[i3], r3 = n2.children.length, e2 = this._minEntries;
  6143. this._chooseSplitAxis(n2, e2, r3);
  6144. var h3 = this._chooseSplitIndex(n2, e2, r3), o2 = p(n2.children.splice(h3, n2.children.length - h3));
  6145. o2.height = n2.height, o2.leaf = n2.leaf, a(n2, this.toBBox), a(o2, this.toBBox), i3 ? t3[i3 - 1].children.push(o2) : this._splitRoot(n2, o2);
  6146. }, r2.prototype._splitRoot = function(t3, i3) {
  6147. this.data = p([t3, i3]), this.data.height = t3.height + 1, this.data.leaf = false, a(this.data, this.toBBox);
  6148. }, r2.prototype._chooseSplitIndex = function(t3, i3, n2) {
  6149. for (var r3, e2, a2, o2, s2, l2, u2, m2 = 1 / 0, c2 = 1 / 0, p2 = i3; p2 <= n2 - i3; p2++) {
  6150. var d3 = h2(t3, 0, p2, this.toBBox), x = h2(t3, p2, n2, this.toBBox), v = (e2 = d3, a2 = x, o2 = void 0, s2 = void 0, l2 = void 0, u2 = void 0, o2 = Math.max(e2.minX, a2.minX), s2 = Math.max(e2.minY, a2.minY), l2 = Math.min(e2.maxX, a2.maxX), u2 = Math.min(e2.maxY, a2.maxY), Math.max(0, l2 - o2) * Math.max(0, u2 - s2)), M = f(d3) + f(x);
  6151. v < m2 ? (m2 = v, r3 = p2, c2 = M < c2 ? M : c2) : v === m2 && M < c2 && (c2 = M, r3 = p2);
  6152. }
  6153. return r3 || n2 - i3;
  6154. }, r2.prototype._chooseSplitAxis = function(t3, i3, n2) {
  6155. var r3 = t3.leaf ? this.compareMinX : s, e2 = t3.leaf ? this.compareMinY : l;
  6156. this._allDistMargin(t3, i3, n2, r3) < this._allDistMargin(t3, i3, n2, e2) && t3.children.sort(r3);
  6157. }, r2.prototype._allDistMargin = function(t3, i3, n2, r3) {
  6158. t3.children.sort(r3);
  6159. for (var e2 = this.toBBox, a2 = h2(t3, 0, i3, e2), s2 = h2(t3, n2 - i3, n2, e2), l2 = u(a2) + u(s2), f2 = i3; f2 < n2 - i3; f2++) {
  6160. var m2 = t3.children[f2];
  6161. o(a2, t3.leaf ? e2(m2) : m2), l2 += u(a2);
  6162. }
  6163. for (var c2 = n2 - i3 - 1; c2 >= i3; c2--) {
  6164. var p2 = t3.children[c2];
  6165. o(s2, t3.leaf ? e2(p2) : p2), l2 += u(s2);
  6166. }
  6167. return l2;
  6168. }, r2.prototype._adjustParentBBoxes = function(t3, i3, n2) {
  6169. for (var r3 = n2; r3 >= 0; r3--)
  6170. o(i3[r3], t3);
  6171. }, r2.prototype._condense = function(t3) {
  6172. for (var i3 = t3.length - 1, n2 = void 0; i3 >= 0; i3--)
  6173. 0 === t3[i3].children.length ? i3 > 0 ? (n2 = t3[i3 - 1].children).splice(n2.indexOf(t3[i3]), 1) : this.clear() : a(t3[i3], this.toBBox);
  6174. }, r2;
  6175. });
  6176. })(rbush_min$1);
  6177. class TinyQueue {
  6178. constructor(data = [], compare = defaultCompare) {
  6179. this.data = data;
  6180. this.length = this.data.length;
  6181. this.compare = compare;
  6182. if (this.length > 0) {
  6183. for (let i2 = (this.length >> 1) - 1; i2 >= 0; i2--)
  6184. this._down(i2);
  6185. }
  6186. }
  6187. push(item) {
  6188. this.data.push(item);
  6189. this.length++;
  6190. this._up(this.length - 1);
  6191. }
  6192. pop() {
  6193. if (this.length === 0)
  6194. return void 0;
  6195. const top = this.data[0];
  6196. const bottom = this.data.pop();
  6197. this.length--;
  6198. if (this.length > 0) {
  6199. this.data[0] = bottom;
  6200. this._down(0);
  6201. }
  6202. return top;
  6203. }
  6204. peek() {
  6205. return this.data[0];
  6206. }
  6207. _up(pos) {
  6208. const { data, compare } = this;
  6209. const item = data[pos];
  6210. while (pos > 0) {
  6211. const parent = pos - 1 >> 1;
  6212. const current = data[parent];
  6213. if (compare(item, current) >= 0)
  6214. break;
  6215. data[pos] = current;
  6216. pos = parent;
  6217. }
  6218. data[pos] = item;
  6219. }
  6220. _down(pos) {
  6221. const { data, compare } = this;
  6222. const halfLength = this.length >> 1;
  6223. const item = data[pos];
  6224. while (pos < halfLength) {
  6225. let left = (pos << 1) + 1;
  6226. let best = data[left];
  6227. const right = left + 1;
  6228. if (right < this.length && compare(data[right], best) < 0) {
  6229. left = right;
  6230. best = data[right];
  6231. }
  6232. if (compare(best, item) >= 0)
  6233. break;
  6234. data[pos] = best;
  6235. pos = left;
  6236. }
  6237. data[pos] = item;
  6238. }
  6239. }
  6240. function defaultCompare(a, b) {
  6241. return a < b ? -1 : a > b ? 1 : 0;
  6242. }
  6243. var tinyqueue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  6244. __proto__: null,
  6245. "default": TinyQueue
  6246. }, Symbol.toStringTag, { value: "Module" }));
  6247. var require$$1$2 = /* @__PURE__ */ getAugmentedNamespace(tinyqueue);
  6248. var pointInPolygon$1 = { exports: {} };
  6249. var flat = function pointInPolygonFlat(point2, vs, start2, end) {
  6250. var x = point2[0], y = point2[1];
  6251. var inside2 = false;
  6252. if (start2 === void 0)
  6253. start2 = 0;
  6254. if (end === void 0)
  6255. end = vs.length;
  6256. var len = (end - start2) / 2;
  6257. for (var i2 = 0, j = len - 1; i2 < len; j = i2++) {
  6258. var xi = vs[start2 + i2 * 2 + 0], yi = vs[start2 + i2 * 2 + 1];
  6259. var xj = vs[start2 + j * 2 + 0], yj = vs[start2 + j * 2 + 1];
  6260. var intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
  6261. if (intersect)
  6262. inside2 = !inside2;
  6263. }
  6264. return inside2;
  6265. };
  6266. var nested = function pointInPolygonNested(point2, vs, start2, end) {
  6267. var x = point2[0], y = point2[1];
  6268. var inside2 = false;
  6269. if (start2 === void 0)
  6270. start2 = 0;
  6271. if (end === void 0)
  6272. end = vs.length;
  6273. var len = end - start2;
  6274. for (var i2 = 0, j = len - 1; i2 < len; j = i2++) {
  6275. var xi = vs[i2 + start2][0], yi = vs[i2 + start2][1];
  6276. var xj = vs[j + start2][0], yj = vs[j + start2][1];
  6277. var intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
  6278. if (intersect)
  6279. inside2 = !inside2;
  6280. }
  6281. return inside2;
  6282. };
  6283. var pointInPolygonFlat2 = flat;
  6284. var pointInPolygonNested2 = nested;
  6285. pointInPolygon$1.exports = function pointInPolygon(point2, vs, start2, end) {
  6286. if (vs.length > 0 && Array.isArray(vs[0])) {
  6287. return pointInPolygonNested2(point2, vs, start2, end);
  6288. } else {
  6289. return pointInPolygonFlat2(point2, vs, start2, end);
  6290. }
  6291. };
  6292. pointInPolygon$1.exports.nested = pointInPolygonNested2;
  6293. pointInPolygon$1.exports.flat = pointInPolygonFlat2;
  6294. var orient2d_min = { exports: {} };
  6295. (function(module2, exports2) {
  6296. !function(t2, e) {
  6297. e(exports2);
  6298. }(commonjsGlobal, function(t2) {
  6299. const e = 134217729, n = 33306690738754706e-32;
  6300. function r2(t3, e2, n2, r3, o2) {
  6301. let f2, i3, u2, c2, s2 = e2[0], a2 = r3[0], d3 = 0, l2 = 0;
  6302. a2 > s2 == a2 > -s2 ? (f2 = s2, s2 = e2[++d3]) : (f2 = a2, a2 = r3[++l2]);
  6303. let p = 0;
  6304. if (d3 < t3 && l2 < n2)
  6305. for (a2 > s2 == a2 > -s2 ? (u2 = f2 - ((i3 = s2 + f2) - s2), s2 = e2[++d3]) : (u2 = f2 - ((i3 = a2 + f2) - a2), a2 = r3[++l2]), f2 = i3, 0 !== u2 && (o2[p++] = u2); d3 < t3 && l2 < n2; )
  6306. a2 > s2 == a2 > -s2 ? (u2 = f2 - ((i3 = f2 + s2) - (c2 = i3 - f2)) + (s2 - c2), s2 = e2[++d3]) : (u2 = f2 - ((i3 = f2 + a2) - (c2 = i3 - f2)) + (a2 - c2), a2 = r3[++l2]), f2 = i3, 0 !== u2 && (o2[p++] = u2);
  6307. for (; d3 < t3; )
  6308. u2 = f2 - ((i3 = f2 + s2) - (c2 = i3 - f2)) + (s2 - c2), s2 = e2[++d3], f2 = i3, 0 !== u2 && (o2[p++] = u2);
  6309. for (; l2 < n2; )
  6310. u2 = f2 - ((i3 = f2 + a2) - (c2 = i3 - f2)) + (a2 - c2), a2 = r3[++l2], f2 = i3, 0 !== u2 && (o2[p++] = u2);
  6311. return 0 === f2 && 0 !== p || (o2[p++] = f2), p;
  6312. }
  6313. function o(t3) {
  6314. return new Float64Array(t3);
  6315. }
  6316. const f = 33306690738754716e-32, i2 = 22204460492503146e-32, u = 11093356479670487e-47, c = o(4), s = o(8), a = o(12), d2 = o(16), l = o(4);
  6317. t2.orient2d = function(t3, o2, p, b, y, h2) {
  6318. const M = (o2 - h2) * (p - y), x = (t3 - y) * (b - h2), j = M - x;
  6319. if (0 === M || 0 === x || M > 0 != x > 0)
  6320. return j;
  6321. const m = Math.abs(M + x);
  6322. return Math.abs(j) >= f * m ? j : -function(t4, o3, f2, p2, b2, y2, h3) {
  6323. let M2, x2, j2, m2, _, v, w, A, F, O, P2, g, k, q2, z, B2, C2, D;
  6324. const E2 = t4 - b2, G2 = f2 - b2, H2 = o3 - y2, I2 = p2 - y2;
  6325. _ = (z = (A = E2 - (w = (v = e * E2) - (v - E2))) * (O = I2 - (F = (v = e * I2) - (v - I2))) - ((q2 = E2 * I2) - w * F - A * F - w * O)) - (P2 = z - (C2 = (A = H2 - (w = (v = e * H2) - (v - H2))) * (O = G2 - (F = (v = e * G2) - (v - G2))) - ((B2 = H2 * G2) - w * F - A * F - w * O))), c[0] = z - (P2 + _) + (_ - C2), _ = (k = q2 - ((g = q2 + P2) - (_ = g - q2)) + (P2 - _)) - (P2 = k - B2), c[1] = k - (P2 + _) + (_ - B2), _ = (D = g + P2) - g, c[2] = g - (D - _) + (P2 - _), c[3] = D;
  6326. let J2 = function(t5, e2) {
  6327. let n2 = e2[0];
  6328. for (let r3 = 1; r3 < t5; r3++)
  6329. n2 += e2[r3];
  6330. return n2;
  6331. }(4, c), K2 = i2 * h3;
  6332. if (J2 >= K2 || -J2 >= K2)
  6333. return J2;
  6334. if (M2 = t4 - (E2 + (_ = t4 - E2)) + (_ - b2), j2 = f2 - (G2 + (_ = f2 - G2)) + (_ - b2), x2 = o3 - (H2 + (_ = o3 - H2)) + (_ - y2), m2 = p2 - (I2 + (_ = p2 - I2)) + (_ - y2), 0 === M2 && 0 === x2 && 0 === j2 && 0 === m2)
  6335. return J2;
  6336. if (K2 = u * h3 + n * Math.abs(J2), (J2 += E2 * m2 + I2 * M2 - (H2 * j2 + G2 * x2)) >= K2 || -J2 >= K2)
  6337. return J2;
  6338. _ = (z = (A = M2 - (w = (v = e * M2) - (v - M2))) * (O = I2 - (F = (v = e * I2) - (v - I2))) - ((q2 = M2 * I2) - w * F - A * F - w * O)) - (P2 = z - (C2 = (A = x2 - (w = (v = e * x2) - (v - x2))) * (O = G2 - (F = (v = e * G2) - (v - G2))) - ((B2 = x2 * G2) - w * F - A * F - w * O))), l[0] = z - (P2 + _) + (_ - C2), _ = (k = q2 - ((g = q2 + P2) - (_ = g - q2)) + (P2 - _)) - (P2 = k - B2), l[1] = k - (P2 + _) + (_ - B2), _ = (D = g + P2) - g, l[2] = g - (D - _) + (P2 - _), l[3] = D;
  6339. const L = r2(4, c, 4, l, s);
  6340. _ = (z = (A = E2 - (w = (v = e * E2) - (v - E2))) * (O = m2 - (F = (v = e * m2) - (v - m2))) - ((q2 = E2 * m2) - w * F - A * F - w * O)) - (P2 = z - (C2 = (A = H2 - (w = (v = e * H2) - (v - H2))) * (O = j2 - (F = (v = e * j2) - (v - j2))) - ((B2 = H2 * j2) - w * F - A * F - w * O))), l[0] = z - (P2 + _) + (_ - C2), _ = (k = q2 - ((g = q2 + P2) - (_ = g - q2)) + (P2 - _)) - (P2 = k - B2), l[1] = k - (P2 + _) + (_ - B2), _ = (D = g + P2) - g, l[2] = g - (D - _) + (P2 - _), l[3] = D;
  6341. const N2 = r2(L, s, 4, l, a);
  6342. _ = (z = (A = M2 - (w = (v = e * M2) - (v - M2))) * (O = m2 - (F = (v = e * m2) - (v - m2))) - ((q2 = M2 * m2) - w * F - A * F - w * O)) - (P2 = z - (C2 = (A = x2 - (w = (v = e * x2) - (v - x2))) * (O = j2 - (F = (v = e * j2) - (v - j2))) - ((B2 = x2 * j2) - w * F - A * F - w * O))), l[0] = z - (P2 + _) + (_ - C2), _ = (k = q2 - ((g = q2 + P2) - (_ = g - q2)) + (P2 - _)) - (P2 = k - B2), l[1] = k - (P2 + _) + (_ - B2), _ = (D = g + P2) - g, l[2] = g - (D - _) + (P2 - _), l[3] = D;
  6343. const Q2 = r2(N2, a, 4, l, d2);
  6344. return d2[Q2 - 1];
  6345. }(t3, o2, p, b, y, h2, m);
  6346. }, t2.orient2dfast = function(t3, e2, n2, r3, o2, f2) {
  6347. return (e2 - f2) * (n2 - o2) - (t3 - o2) * (r3 - f2);
  6348. }, Object.defineProperty(t2, "__esModule", { value: true });
  6349. });
  6350. })(orient2d_min, orient2d_min.exports);
  6351. var RBush = rbush_min$1.exports;
  6352. var Queue = require$$1$2;
  6353. var pointInPolygon2 = pointInPolygon$1.exports;
  6354. var orient = orient2d_min.exports.orient2d;
  6355. if (Queue.default) {
  6356. Queue = Queue.default;
  6357. }
  6358. concaveman$2.exports = concaveman;
  6359. concaveman$2.exports.default = concaveman;
  6360. function concaveman(points2, concavity, lengthThreshold) {
  6361. concavity = Math.max(0, concavity === void 0 ? 2 : concavity);
  6362. lengthThreshold = lengthThreshold || 0;
  6363. var hull = fastConvexHull(points2);
  6364. var tree = new RBush(16);
  6365. tree.toBBox = function(a2) {
  6366. return {
  6367. minX: a2[0],
  6368. minY: a2[1],
  6369. maxX: a2[0],
  6370. maxY: a2[1]
  6371. };
  6372. };
  6373. tree.compareMinX = function(a2, b2) {
  6374. return a2[0] - b2[0];
  6375. };
  6376. tree.compareMinY = function(a2, b2) {
  6377. return a2[1] - b2[1];
  6378. };
  6379. tree.load(points2);
  6380. var queue = [];
  6381. for (var i2 = 0, last; i2 < hull.length; i2++) {
  6382. var p = hull[i2];
  6383. tree.remove(p);
  6384. last = insertNode(p, last);
  6385. queue.push(last);
  6386. }
  6387. var segTree = new RBush(16);
  6388. for (i2 = 0; i2 < queue.length; i2++)
  6389. segTree.insert(updateBBox(queue[i2]));
  6390. var sqConcavity = concavity * concavity;
  6391. var sqLenThreshold = lengthThreshold * lengthThreshold;
  6392. while (queue.length) {
  6393. var node = queue.shift();
  6394. var a = node.p;
  6395. var b = node.next.p;
  6396. var sqLen = getSqDist(a, b);
  6397. if (sqLen < sqLenThreshold)
  6398. continue;
  6399. var maxSqLen = sqLen / sqConcavity;
  6400. p = findCandidate(tree, node.prev.p, a, b, node.next.next.p, maxSqLen, segTree);
  6401. if (p && Math.min(getSqDist(p, a), getSqDist(p, b)) <= maxSqLen) {
  6402. queue.push(node);
  6403. queue.push(insertNode(p, node));
  6404. tree.remove(p);
  6405. segTree.remove(node);
  6406. segTree.insert(updateBBox(node));
  6407. segTree.insert(updateBBox(node.next));
  6408. }
  6409. }
  6410. node = last;
  6411. var concave = [];
  6412. do {
  6413. concave.push(node.p);
  6414. node = node.next;
  6415. } while (node !== last);
  6416. concave.push(node.p);
  6417. return concave;
  6418. }
  6419. function findCandidate(tree, a, b, c, d2, maxDist, segTree) {
  6420. var queue = new Queue([], compareDist);
  6421. var node = tree.data;
  6422. while (node) {
  6423. for (var i2 = 0; i2 < node.children.length; i2++) {
  6424. var child = node.children[i2];
  6425. var dist = node.leaf ? sqSegDist(child, b, c) : sqSegBoxDist(b, c, child);
  6426. if (dist > maxDist)
  6427. continue;
  6428. queue.push({
  6429. node: child,
  6430. dist
  6431. });
  6432. }
  6433. while (queue.length && !queue.peek().node.children) {
  6434. var item = queue.pop();
  6435. var p = item.node;
  6436. var d0 = sqSegDist(p, a, b);
  6437. var d1 = sqSegDist(p, c, d2);
  6438. if (item.dist < d0 && item.dist < d1 && noIntersections(b, p, segTree) && noIntersections(c, p, segTree))
  6439. return p;
  6440. }
  6441. node = queue.pop();
  6442. if (node)
  6443. node = node.node;
  6444. }
  6445. return null;
  6446. }
  6447. function compareDist(a, b) {
  6448. return a.dist - b.dist;
  6449. }
  6450. function sqSegBoxDist(a, b, bbox2) {
  6451. if (inside(a, bbox2) || inside(b, bbox2))
  6452. return 0;
  6453. var d1 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox2.minX, bbox2.minY, bbox2.maxX, bbox2.minY);
  6454. if (d1 === 0)
  6455. return 0;
  6456. var d2 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox2.minX, bbox2.minY, bbox2.minX, bbox2.maxY);
  6457. if (d2 === 0)
  6458. return 0;
  6459. var d3 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox2.maxX, bbox2.minY, bbox2.maxX, bbox2.maxY);
  6460. if (d3 === 0)
  6461. return 0;
  6462. var d4 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox2.minX, bbox2.maxY, bbox2.maxX, bbox2.maxY);
  6463. if (d4 === 0)
  6464. return 0;
  6465. return Math.min(d1, d2, d3, d4);
  6466. }
  6467. function inside(a, bbox2) {
  6468. return a[0] >= bbox2.minX && a[0] <= bbox2.maxX && a[1] >= bbox2.minY && a[1] <= bbox2.maxY;
  6469. }
  6470. function noIntersections(a, b, segTree) {
  6471. var minX = Math.min(a[0], b[0]);
  6472. var minY = Math.min(a[1], b[1]);
  6473. var maxX = Math.max(a[0], b[0]);
  6474. var maxY = Math.max(a[1], b[1]);
  6475. var edges = segTree.search({ minX, minY, maxX, maxY });
  6476. for (var i2 = 0; i2 < edges.length; i2++) {
  6477. if (intersects$1(edges[i2].p, edges[i2].next.p, a, b))
  6478. return false;
  6479. }
  6480. return true;
  6481. }
  6482. function cross(p1, p2, p3) {
  6483. return orient(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]);
  6484. }
  6485. function intersects$1(p1, q1, p2, q2) {
  6486. return p1 !== q2 && q1 !== p2 && cross(p1, q1, p2) > 0 !== cross(p1, q1, q2) > 0 && cross(p2, q2, p1) > 0 !== cross(p2, q2, q1) > 0;
  6487. }
  6488. function updateBBox(node) {
  6489. var p1 = node.p;
  6490. var p2 = node.next.p;
  6491. node.minX = Math.min(p1[0], p2[0]);
  6492. node.minY = Math.min(p1[1], p2[1]);
  6493. node.maxX = Math.max(p1[0], p2[0]);
  6494. node.maxY = Math.max(p1[1], p2[1]);
  6495. return node;
  6496. }
  6497. function fastConvexHull(points2) {
  6498. var left = points2[0];
  6499. var top = points2[0];
  6500. var right = points2[0];
  6501. var bottom = points2[0];
  6502. for (var i2 = 0; i2 < points2.length; i2++) {
  6503. var p = points2[i2];
  6504. if (p[0] < left[0])
  6505. left = p;
  6506. if (p[0] > right[0])
  6507. right = p;
  6508. if (p[1] < top[1])
  6509. top = p;
  6510. if (p[1] > bottom[1])
  6511. bottom = p;
  6512. }
  6513. var cull = [left, top, right, bottom];
  6514. var filtered = cull.slice();
  6515. for (i2 = 0; i2 < points2.length; i2++) {
  6516. if (!pointInPolygon2(points2[i2], cull))
  6517. filtered.push(points2[i2]);
  6518. }
  6519. return convexHull(filtered);
  6520. }
  6521. function insertNode(p, prev) {
  6522. var node = {
  6523. p,
  6524. prev: null,
  6525. next: null,
  6526. minX: 0,
  6527. minY: 0,
  6528. maxX: 0,
  6529. maxY: 0
  6530. };
  6531. if (!prev) {
  6532. node.prev = node;
  6533. node.next = node;
  6534. } else {
  6535. node.next = prev.next;
  6536. node.prev = prev;
  6537. prev.next.prev = node;
  6538. prev.next = node;
  6539. }
  6540. return node;
  6541. }
  6542. function getSqDist(p1, p2) {
  6543. var dx = p1[0] - p2[0], dy = p1[1] - p2[1];
  6544. return dx * dx + dy * dy;
  6545. }
  6546. function sqSegDist(p, p1, p2) {
  6547. var x = p1[0], y = p1[1], dx = p2[0] - x, dy = p2[1] - y;
  6548. if (dx !== 0 || dy !== 0) {
  6549. var t2 = ((p[0] - x) * dx + (p[1] - y) * dy) / (dx * dx + dy * dy);
  6550. if (t2 > 1) {
  6551. x = p2[0];
  6552. y = p2[1];
  6553. } else if (t2 > 0) {
  6554. x += dx * t2;
  6555. y += dy * t2;
  6556. }
  6557. }
  6558. dx = p[0] - x;
  6559. dy = p[1] - y;
  6560. return dx * dx + dy * dy;
  6561. }
  6562. function sqSegSegDist(x0, y0, x1, y1, x2, y2, x3, y3) {
  6563. var ux = x1 - x0;
  6564. var uy = y1 - y0;
  6565. var vx = x3 - x2;
  6566. var vy = y3 - y2;
  6567. var wx = x0 - x2;
  6568. var wy = y0 - y2;
  6569. var a = ux * ux + uy * uy;
  6570. var b = ux * vx + uy * vy;
  6571. var c = vx * vx + vy * vy;
  6572. var d2 = ux * wx + uy * wy;
  6573. var e = vx * wx + vy * wy;
  6574. var D = a * c - b * b;
  6575. var sc, sN, tc, tN;
  6576. var sD = D;
  6577. var tD = D;
  6578. if (D === 0) {
  6579. sN = 0;
  6580. sD = 1;
  6581. tN = e;
  6582. tD = c;
  6583. } else {
  6584. sN = b * e - c * d2;
  6585. tN = a * e - b * d2;
  6586. if (sN < 0) {
  6587. sN = 0;
  6588. tN = e;
  6589. tD = c;
  6590. } else if (sN > sD) {
  6591. sN = sD;
  6592. tN = e + b;
  6593. tD = c;
  6594. }
  6595. }
  6596. if (tN < 0) {
  6597. tN = 0;
  6598. if (-d2 < 0)
  6599. sN = 0;
  6600. else if (-d2 > a)
  6601. sN = sD;
  6602. else {
  6603. sN = -d2;
  6604. sD = a;
  6605. }
  6606. } else if (tN > tD) {
  6607. tN = tD;
  6608. if (-d2 + b < 0)
  6609. sN = 0;
  6610. else if (-d2 + b > a)
  6611. sN = sD;
  6612. else {
  6613. sN = -d2 + b;
  6614. sD = a;
  6615. }
  6616. }
  6617. sc = sN === 0 ? 0 : sN / sD;
  6618. tc = tN === 0 ? 0 : tN / tD;
  6619. var cx = (1 - sc) * x0 + sc * x1;
  6620. var cy = (1 - sc) * y0 + sc * y1;
  6621. var cx2 = (1 - tc) * x2 + tc * x3;
  6622. var cy2 = (1 - tc) * y2 + tc * y3;
  6623. var dx = cx2 - cx;
  6624. var dy = cy2 - cy;
  6625. return dx * dx + dy * dy;
  6626. }
  6627. function compareByX(a, b) {
  6628. return a[0] === b[0] ? a[1] - b[1] : a[0] - b[0];
  6629. }
  6630. function convexHull(points2) {
  6631. points2.sort(compareByX);
  6632. var lower = [];
  6633. for (var i2 = 0; i2 < points2.length; i2++) {
  6634. while (lower.length >= 2 && cross(lower[lower.length - 2], lower[lower.length - 1], points2[i2]) <= 0) {
  6635. lower.pop();
  6636. }
  6637. lower.push(points2[i2]);
  6638. }
  6639. var upper = [];
  6640. for (var ii = points2.length - 1; ii >= 0; ii--) {
  6641. while (upper.length >= 2 && cross(upper[upper.length - 2], upper[upper.length - 1], points2[ii]) <= 0) {
  6642. upper.pop();
  6643. }
  6644. upper.push(points2[ii]);
  6645. }
  6646. upper.pop();
  6647. lower.pop();
  6648. return lower.concat(upper);
  6649. }
  6650. var concaveman$1 = concaveman$2.exports;
  6651. function convex(geojson, options2) {
  6652. if (options2 === void 0) {
  6653. options2 = {};
  6654. }
  6655. options2.concavity = options2.concavity || Infinity;
  6656. var points2 = [];
  6657. coordEach(geojson, function(coord) {
  6658. points2.push([coord[0], coord[1]]);
  6659. });
  6660. if (!points2.length) {
  6661. return null;
  6662. }
  6663. var convexHull2 = concaveman$1(points2, options2.concavity);
  6664. if (convexHull2.length > 3) {
  6665. return polygon([convexHull2]);
  6666. }
  6667. return null;
  6668. }
  6669. function booleanPointInPolygon(point2, polygon2, options2) {
  6670. if (options2 === void 0) {
  6671. options2 = {};
  6672. }
  6673. if (!point2) {
  6674. throw new Error("point is required");
  6675. }
  6676. if (!polygon2) {
  6677. throw new Error("polygon is required");
  6678. }
  6679. var pt2 = getCoord(point2);
  6680. var geom = getGeom(polygon2);
  6681. var type2 = geom.type;
  6682. var bbox2 = polygon2.bbox;
  6683. var polys = geom.coordinates;
  6684. if (bbox2 && inBBox(pt2, bbox2) === false) {
  6685. return false;
  6686. }
  6687. if (type2 === "Polygon") {
  6688. polys = [polys];
  6689. }
  6690. var insidePoly = false;
  6691. for (var i2 = 0; i2 < polys.length && !insidePoly; i2++) {
  6692. if (inRing(pt2, polys[i2][0], options2.ignoreBoundary)) {
  6693. var inHole = false;
  6694. var k = 1;
  6695. while (k < polys[i2].length && !inHole) {
  6696. if (inRing(pt2, polys[i2][k], !options2.ignoreBoundary)) {
  6697. inHole = true;
  6698. }
  6699. k++;
  6700. }
  6701. if (!inHole) {
  6702. insidePoly = true;
  6703. }
  6704. }
  6705. }
  6706. return insidePoly;
  6707. }
  6708. function inRing(pt2, ring, ignoreBoundary) {
  6709. var isInside = false;
  6710. if (ring[0][0] === ring[ring.length - 1][0] && ring[0][1] === ring[ring.length - 1][1]) {
  6711. ring = ring.slice(0, ring.length - 1);
  6712. }
  6713. for (var i2 = 0, j = ring.length - 1; i2 < ring.length; j = i2++) {
  6714. var xi = ring[i2][0];
  6715. var yi = ring[i2][1];
  6716. var xj = ring[j][0];
  6717. var yj = ring[j][1];
  6718. var onBoundary = pt2[1] * (xi - xj) + yi * (xj - pt2[0]) + yj * (pt2[0] - xi) === 0 && (xi - pt2[0]) * (xj - pt2[0]) <= 0 && (yi - pt2[1]) * (yj - pt2[1]) <= 0;
  6719. if (onBoundary) {
  6720. return !ignoreBoundary;
  6721. }
  6722. var intersect = yi > pt2[1] !== yj > pt2[1] && pt2[0] < (xj - xi) * (pt2[1] - yi) / (yj - yi) + xi;
  6723. if (intersect) {
  6724. isInside = !isInside;
  6725. }
  6726. }
  6727. return isInside;
  6728. }
  6729. function inBBox(pt2, bbox2) {
  6730. return bbox2[0] <= pt2[0] && bbox2[1] <= pt2[1] && bbox2[2] >= pt2[0] && bbox2[3] >= pt2[1];
  6731. }
  6732. function distance(from3, to, options2) {
  6733. if (options2 === void 0) {
  6734. options2 = {};
  6735. }
  6736. var coordinates1 = getCoord(from3);
  6737. var coordinates2 = getCoord(to);
  6738. var dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
  6739. var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
  6740. var lat1 = degreesToRadians(coordinates1[1]);
  6741. var lat2 = degreesToRadians(coordinates2[1]);
  6742. var a = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
  6743. return radiansToLength(2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)), options2.units);
  6744. }
  6745. function bboxPolygon(bbox2, options2) {
  6746. if (options2 === void 0) {
  6747. options2 = {};
  6748. }
  6749. var west = Number(bbox2[0]);
  6750. var south = Number(bbox2[1]);
  6751. var east = Number(bbox2[2]);
  6752. var north = Number(bbox2[3]);
  6753. if (bbox2.length === 6) {
  6754. throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");
  6755. }
  6756. var lowLeft = [west, south];
  6757. var topLeft = [west, north];
  6758. var topRight = [east, north];
  6759. var lowRight = [east, south];
  6760. return polygon([[lowLeft, lowRight, topRight, topLeft, lowLeft]], options2.properties, { bbox: bbox2, id: options2.id });
  6761. }
  6762. function destination(origin, distance2, bearing2, options2) {
  6763. if (options2 === void 0) {
  6764. options2 = {};
  6765. }
  6766. var coordinates1 = getCoord(origin);
  6767. var longitude1 = degreesToRadians(coordinates1[0]);
  6768. var latitude1 = degreesToRadians(coordinates1[1]);
  6769. var bearingRad = degreesToRadians(bearing2);
  6770. var radians = lengthToRadians(distance2, options2.units);
  6771. var latitude2 = Math.asin(Math.sin(latitude1) * Math.cos(radians) + Math.cos(latitude1) * Math.sin(radians) * Math.cos(bearingRad));
  6772. var longitude2 = longitude1 + Math.atan2(Math.sin(bearingRad) * Math.sin(radians) * Math.cos(latitude1), Math.cos(radians) - Math.sin(latitude1) * Math.sin(latitude2));
  6773. var lng = radiansToDegrees(longitude2);
  6774. var lat = radiansToDegrees(latitude2);
  6775. return point([lng, lat], options2.properties);
  6776. }
  6777. function bearing(start2, end, options2) {
  6778. if (options2 === void 0) {
  6779. options2 = {};
  6780. }
  6781. if (options2.final === true) {
  6782. return calculateFinalBearing(start2, end);
  6783. }
  6784. var coordinates1 = getCoord(start2);
  6785. var coordinates2 = getCoord(end);
  6786. var lon1 = degreesToRadians(coordinates1[0]);
  6787. var lon2 = degreesToRadians(coordinates2[0]);
  6788. var lat1 = degreesToRadians(coordinates1[1]);
  6789. var lat2 = degreesToRadians(coordinates2[1]);
  6790. var a = Math.sin(lon2 - lon1) * Math.cos(lat2);
  6791. var b = Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon2 - lon1);
  6792. return radiansToDegrees(Math.atan2(a, b));
  6793. }
  6794. function calculateFinalBearing(start2, end) {
  6795. var bear = bearing(end, start2);
  6796. bear = (bear + 180) % 360;
  6797. return bear;
  6798. }
  6799. function midpoint(point1, point2) {
  6800. var dist = distance(point1, point2);
  6801. var heading = bearing(point1, point2);
  6802. var midpoint2 = destination(point1, dist / 2, heading);
  6803. return midpoint2;
  6804. }
  6805. function center(geojson, options2) {
  6806. if (options2 === void 0) {
  6807. options2 = {};
  6808. }
  6809. var ext = bbox$1(geojson);
  6810. var x = (ext[0] + ext[2]) / 2;
  6811. var y = (ext[1] + ext[3]) / 2;
  6812. return point([x, y], options2.properties, options2);
  6813. }
  6814. function centroid(geojson, options2) {
  6815. if (options2 === void 0) {
  6816. options2 = {};
  6817. }
  6818. var xSum = 0;
  6819. var ySum = 0;
  6820. var len = 0;
  6821. coordEach(geojson, function(coord) {
  6822. xSum += coord[0];
  6823. ySum += coord[1];
  6824. len++;
  6825. }, true);
  6826. return point([xSum / len, ySum / len], options2.properties);
  6827. }
  6828. function centerOfMass(geojson, options2) {
  6829. if (options2 === void 0) {
  6830. options2 = {};
  6831. }
  6832. switch (getType(geojson)) {
  6833. case "Point":
  6834. return point(getCoord(geojson), options2.properties);
  6835. case "Polygon":
  6836. var coords = [];
  6837. coordEach(geojson, function(coord) {
  6838. coords.push(coord);
  6839. });
  6840. var centre = centroid(geojson, { properties: options2.properties });
  6841. var translation = centre.geometry.coordinates;
  6842. var sx = 0;
  6843. var sy = 0;
  6844. var sArea = 0;
  6845. var i2, pi, pj, xi, xj, yi, yj, a;
  6846. var neutralizedPoints = coords.map(function(point2) {
  6847. return [point2[0] - translation[0], point2[1] - translation[1]];
  6848. });
  6849. for (i2 = 0; i2 < coords.length - 1; i2++) {
  6850. pi = neutralizedPoints[i2];
  6851. xi = pi[0];
  6852. yi = pi[1];
  6853. pj = neutralizedPoints[i2 + 1];
  6854. xj = pj[0];
  6855. yj = pj[1];
  6856. a = xi * yj - xj * yi;
  6857. sArea += a;
  6858. sx += (xi + xj) * a;
  6859. sy += (yi + yj) * a;
  6860. }
  6861. if (sArea === 0) {
  6862. return centre;
  6863. } else {
  6864. var area = sArea * 0.5;
  6865. var areaFactor = 1 / (6 * area);
  6866. return point([translation[0] + areaFactor * sx, translation[1] + areaFactor * sy], options2.properties);
  6867. }
  6868. default:
  6869. var hull = convex(geojson);
  6870. if (hull)
  6871. return centerOfMass(hull, { properties: options2.properties });
  6872. else
  6873. return centroid(geojson, { properties: options2.properties });
  6874. }
  6875. }
  6876. function lineSegment(geojson) {
  6877. if (!geojson) {
  6878. throw new Error("geojson is required");
  6879. }
  6880. var results = [];
  6881. flattenEach(geojson, function(feature2) {
  6882. lineSegmentFeature(feature2, results);
  6883. });
  6884. return featureCollection$1(results);
  6885. }
  6886. function lineSegmentFeature(geojson, results) {
  6887. var coords = [];
  6888. var geometry2 = geojson.geometry;
  6889. if (geometry2 !== null) {
  6890. switch (geometry2.type) {
  6891. case "Polygon":
  6892. coords = getCoords(geometry2);
  6893. break;
  6894. case "LineString":
  6895. coords = [getCoords(geometry2)];
  6896. }
  6897. coords.forEach(function(coord) {
  6898. var segments = createSegments(coord, geojson.properties);
  6899. segments.forEach(function(segment) {
  6900. segment.id = results.length;
  6901. results.push(segment);
  6902. });
  6903. });
  6904. }
  6905. }
  6906. function createSegments(coords, properties) {
  6907. var segments = [];
  6908. coords.reduce(function(previousCoords, currentCoords) {
  6909. var segment = lineString([previousCoords, currentCoords], properties);
  6910. segment.bbox = bbox(previousCoords, currentCoords);
  6911. segments.push(segment);
  6912. return currentCoords;
  6913. });
  6914. return segments;
  6915. }
  6916. function bbox(coords1, coords2) {
  6917. var x1 = coords1[0];
  6918. var y1 = coords1[1];
  6919. var x2 = coords2[0];
  6920. var y2 = coords2[1];
  6921. var west = x1 < x2 ? x1 : x2;
  6922. var south = y1 < y2 ? y1 : y2;
  6923. var east = x1 > x2 ? x1 : x2;
  6924. var north = y1 > y2 ? y1 : y2;
  6925. return [west, south, east, north];
  6926. }
  6927. var geojsonRbush$1 = { exports: {} };
  6928. var rbush_min = { exports: {} };
  6929. (function(module2, exports2) {
  6930. !function(t2, i2) {
  6931. module2.exports = i2();
  6932. }(commonjsGlobal, function() {
  6933. function t2(t3, r3, e2, a2, h3) {
  6934. !function t4(n2, r4, e3, a3, h4) {
  6935. for (; a3 > e3; ) {
  6936. if (a3 - e3 > 600) {
  6937. var o2 = a3 - e3 + 1, s2 = r4 - e3 + 1, l2 = Math.log(o2), f2 = 0.5 * Math.exp(2 * l2 / 3), u2 = 0.5 * Math.sqrt(l2 * f2 * (o2 - f2) / o2) * (s2 - o2 / 2 < 0 ? -1 : 1), m2 = Math.max(e3, Math.floor(r4 - s2 * f2 / o2 + u2)), c2 = Math.min(a3, Math.floor(r4 + (o2 - s2) * f2 / o2 + u2));
  6938. t4(n2, r4, m2, c2, h4);
  6939. }
  6940. var p2 = n2[r4], d3 = e3, x = a3;
  6941. for (i2(n2, e3, r4), h4(n2[a3], p2) > 0 && i2(n2, e3, a3); d3 < x; ) {
  6942. for (i2(n2, d3, x), d3++, x--; h4(n2[d3], p2) < 0; )
  6943. d3++;
  6944. for (; h4(n2[x], p2) > 0; )
  6945. x--;
  6946. }
  6947. 0 === h4(n2[e3], p2) ? i2(n2, e3, x) : i2(n2, ++x, a3), x <= r4 && (e3 = x + 1), r4 <= x && (a3 = x - 1);
  6948. }
  6949. }(t3, r3, e2 || 0, a2 || t3.length - 1, h3 || n);
  6950. }
  6951. function i2(t3, i3, n2) {
  6952. var r3 = t3[i3];
  6953. t3[i3] = t3[n2], t3[n2] = r3;
  6954. }
  6955. function n(t3, i3) {
  6956. return t3 < i3 ? -1 : t3 > i3 ? 1 : 0;
  6957. }
  6958. var r2 = function(t3) {
  6959. void 0 === t3 && (t3 = 9), this._maxEntries = Math.max(4, t3), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
  6960. };
  6961. function e(t3, i3, n2) {
  6962. if (!n2)
  6963. return i3.indexOf(t3);
  6964. for (var r3 = 0; r3 < i3.length; r3++)
  6965. if (n2(t3, i3[r3]))
  6966. return r3;
  6967. return -1;
  6968. }
  6969. function a(t3, i3) {
  6970. h2(t3, 0, t3.children.length, i3, t3);
  6971. }
  6972. function h2(t3, i3, n2, r3, e2) {
  6973. e2 || (e2 = p(null)), e2.minX = 1 / 0, e2.minY = 1 / 0, e2.maxX = -1 / 0, e2.maxY = -1 / 0;
  6974. for (var a2 = i3; a2 < n2; a2++) {
  6975. var h3 = t3.children[a2];
  6976. o(e2, t3.leaf ? r3(h3) : h3);
  6977. }
  6978. return e2;
  6979. }
  6980. function o(t3, i3) {
  6981. return t3.minX = Math.min(t3.minX, i3.minX), t3.minY = Math.min(t3.minY, i3.minY), t3.maxX = Math.max(t3.maxX, i3.maxX), t3.maxY = Math.max(t3.maxY, i3.maxY), t3;
  6982. }
  6983. function s(t3, i3) {
  6984. return t3.minX - i3.minX;
  6985. }
  6986. function l(t3, i3) {
  6987. return t3.minY - i3.minY;
  6988. }
  6989. function f(t3) {
  6990. return (t3.maxX - t3.minX) * (t3.maxY - t3.minY);
  6991. }
  6992. function u(t3) {
  6993. return t3.maxX - t3.minX + (t3.maxY - t3.minY);
  6994. }
  6995. function m(t3, i3) {
  6996. return t3.minX <= i3.minX && t3.minY <= i3.minY && i3.maxX <= t3.maxX && i3.maxY <= t3.maxY;
  6997. }
  6998. function c(t3, i3) {
  6999. return i3.minX <= t3.maxX && i3.minY <= t3.maxY && i3.maxX >= t3.minX && i3.maxY >= t3.minY;
  7000. }
  7001. function p(t3) {
  7002. return { children: t3, height: 1, leaf: true, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
  7003. }
  7004. function d2(i3, n2, r3, e2, a2) {
  7005. for (var h3 = [n2, r3]; h3.length; )
  7006. if (!((r3 = h3.pop()) - (n2 = h3.pop()) <= e2)) {
  7007. var o2 = n2 + Math.ceil((r3 - n2) / e2 / 2) * e2;
  7008. t2(i3, o2, n2, r3, a2), h3.push(n2, o2, o2, r3);
  7009. }
  7010. }
  7011. return r2.prototype.all = function() {
  7012. return this._all(this.data, []);
  7013. }, r2.prototype.search = function(t3) {
  7014. var i3 = this.data, n2 = [];
  7015. if (!c(t3, i3))
  7016. return n2;
  7017. for (var r3 = this.toBBox, e2 = []; i3; ) {
  7018. for (var a2 = 0; a2 < i3.children.length; a2++) {
  7019. var h3 = i3.children[a2], o2 = i3.leaf ? r3(h3) : h3;
  7020. c(t3, o2) && (i3.leaf ? n2.push(h3) : m(t3, o2) ? this._all(h3, n2) : e2.push(h3));
  7021. }
  7022. i3 = e2.pop();
  7023. }
  7024. return n2;
  7025. }, r2.prototype.collides = function(t3) {
  7026. var i3 = this.data;
  7027. if (!c(t3, i3))
  7028. return false;
  7029. for (var n2 = []; i3; ) {
  7030. for (var r3 = 0; r3 < i3.children.length; r3++) {
  7031. var e2 = i3.children[r3], a2 = i3.leaf ? this.toBBox(e2) : e2;
  7032. if (c(t3, a2)) {
  7033. if (i3.leaf || m(t3, a2))
  7034. return true;
  7035. n2.push(e2);
  7036. }
  7037. }
  7038. i3 = n2.pop();
  7039. }
  7040. return false;
  7041. }, r2.prototype.load = function(t3) {
  7042. if (!t3 || !t3.length)
  7043. return this;
  7044. if (t3.length < this._minEntries) {
  7045. for (var i3 = 0; i3 < t3.length; i3++)
  7046. this.insert(t3[i3]);
  7047. return this;
  7048. }
  7049. var n2 = this._build(t3.slice(), 0, t3.length - 1, 0);
  7050. if (this.data.children.length)
  7051. if (this.data.height === n2.height)
  7052. this._splitRoot(this.data, n2);
  7053. else {
  7054. if (this.data.height < n2.height) {
  7055. var r3 = this.data;
  7056. this.data = n2, n2 = r3;
  7057. }
  7058. this._insert(n2, this.data.height - n2.height - 1, true);
  7059. }
  7060. else
  7061. this.data = n2;
  7062. return this;
  7063. }, r2.prototype.insert = function(t3) {
  7064. return t3 && this._insert(t3, this.data.height - 1), this;
  7065. }, r2.prototype.clear = function() {
  7066. return this.data = p([]), this;
  7067. }, r2.prototype.remove = function(t3, i3) {
  7068. if (!t3)
  7069. return this;
  7070. for (var n2, r3, a2, h3 = this.data, o2 = this.toBBox(t3), s2 = [], l2 = []; h3 || s2.length; ) {
  7071. if (h3 || (h3 = s2.pop(), r3 = s2[s2.length - 1], n2 = l2.pop(), a2 = true), h3.leaf) {
  7072. var f2 = e(t3, h3.children, i3);
  7073. if (-1 !== f2)
  7074. return h3.children.splice(f2, 1), s2.push(h3), this._condense(s2), this;
  7075. }
  7076. a2 || h3.leaf || !m(h3, o2) ? r3 ? (n2++, h3 = r3.children[n2], a2 = false) : h3 = null : (s2.push(h3), l2.push(n2), n2 = 0, r3 = h3, h3 = h3.children[0]);
  7077. }
  7078. return this;
  7079. }, r2.prototype.toBBox = function(t3) {
  7080. return t3;
  7081. }, r2.prototype.compareMinX = function(t3, i3) {
  7082. return t3.minX - i3.minX;
  7083. }, r2.prototype.compareMinY = function(t3, i3) {
  7084. return t3.minY - i3.minY;
  7085. }, r2.prototype.toJSON = function() {
  7086. return this.data;
  7087. }, r2.prototype.fromJSON = function(t3) {
  7088. return this.data = t3, this;
  7089. }, r2.prototype._all = function(t3, i3) {
  7090. for (var n2 = []; t3; )
  7091. t3.leaf ? i3.push.apply(i3, t3.children) : n2.push.apply(n2, t3.children), t3 = n2.pop();
  7092. return i3;
  7093. }, r2.prototype._build = function(t3, i3, n2, r3) {
  7094. var e2, h3 = n2 - i3 + 1, o2 = this._maxEntries;
  7095. if (h3 <= o2)
  7096. return a(e2 = p(t3.slice(i3, n2 + 1)), this.toBBox), e2;
  7097. r3 || (r3 = Math.ceil(Math.log(h3) / Math.log(o2)), o2 = Math.ceil(h3 / Math.pow(o2, r3 - 1))), (e2 = p([])).leaf = false, e2.height = r3;
  7098. var s2 = Math.ceil(h3 / o2), l2 = s2 * Math.ceil(Math.sqrt(o2));
  7099. d2(t3, i3, n2, l2, this.compareMinX);
  7100. for (var f2 = i3; f2 <= n2; f2 += l2) {
  7101. var u2 = Math.min(f2 + l2 - 1, n2);
  7102. d2(t3, f2, u2, s2, this.compareMinY);
  7103. for (var m2 = f2; m2 <= u2; m2 += s2) {
  7104. var c2 = Math.min(m2 + s2 - 1, u2);
  7105. e2.children.push(this._build(t3, m2, c2, r3 - 1));
  7106. }
  7107. }
  7108. return a(e2, this.toBBox), e2;
  7109. }, r2.prototype._chooseSubtree = function(t3, i3, n2, r3) {
  7110. for (; r3.push(i3), !i3.leaf && r3.length - 1 !== n2; ) {
  7111. for (var e2 = 1 / 0, a2 = 1 / 0, h3 = void 0, o2 = 0; o2 < i3.children.length; o2++) {
  7112. var s2 = i3.children[o2], l2 = f(s2), u2 = (m2 = t3, c2 = s2, (Math.max(c2.maxX, m2.maxX) - Math.min(c2.minX, m2.minX)) * (Math.max(c2.maxY, m2.maxY) - Math.min(c2.minY, m2.minY)) - l2);
  7113. u2 < a2 ? (a2 = u2, e2 = l2 < e2 ? l2 : e2, h3 = s2) : u2 === a2 && l2 < e2 && (e2 = l2, h3 = s2);
  7114. }
  7115. i3 = h3 || i3.children[0];
  7116. }
  7117. var m2, c2;
  7118. return i3;
  7119. }, r2.prototype._insert = function(t3, i3, n2) {
  7120. var r3 = n2 ? t3 : this.toBBox(t3), e2 = [], a2 = this._chooseSubtree(r3, this.data, i3, e2);
  7121. for (a2.children.push(t3), o(a2, r3); i3 >= 0 && e2[i3].children.length > this._maxEntries; )
  7122. this._split(e2, i3), i3--;
  7123. this._adjustParentBBoxes(r3, e2, i3);
  7124. }, r2.prototype._split = function(t3, i3) {
  7125. var n2 = t3[i3], r3 = n2.children.length, e2 = this._minEntries;
  7126. this._chooseSplitAxis(n2, e2, r3);
  7127. var h3 = this._chooseSplitIndex(n2, e2, r3), o2 = p(n2.children.splice(h3, n2.children.length - h3));
  7128. o2.height = n2.height, o2.leaf = n2.leaf, a(n2, this.toBBox), a(o2, this.toBBox), i3 ? t3[i3 - 1].children.push(o2) : this._splitRoot(n2, o2);
  7129. }, r2.prototype._splitRoot = function(t3, i3) {
  7130. this.data = p([t3, i3]), this.data.height = t3.height + 1, this.data.leaf = false, a(this.data, this.toBBox);
  7131. }, r2.prototype._chooseSplitIndex = function(t3, i3, n2) {
  7132. for (var r3, e2, a2, o2, s2, l2, u2, m2 = 1 / 0, c2 = 1 / 0, p2 = i3; p2 <= n2 - i3; p2++) {
  7133. var d3 = h2(t3, 0, p2, this.toBBox), x = h2(t3, p2, n2, this.toBBox), v = (e2 = d3, a2 = x, o2 = void 0, s2 = void 0, l2 = void 0, u2 = void 0, o2 = Math.max(e2.minX, a2.minX), s2 = Math.max(e2.minY, a2.minY), l2 = Math.min(e2.maxX, a2.maxX), u2 = Math.min(e2.maxY, a2.maxY), Math.max(0, l2 - o2) * Math.max(0, u2 - s2)), M = f(d3) + f(x);
  7134. v < m2 ? (m2 = v, r3 = p2, c2 = M < c2 ? M : c2) : v === m2 && M < c2 && (c2 = M, r3 = p2);
  7135. }
  7136. return r3 || n2 - i3;
  7137. }, r2.prototype._chooseSplitAxis = function(t3, i3, n2) {
  7138. var r3 = t3.leaf ? this.compareMinX : s, e2 = t3.leaf ? this.compareMinY : l;
  7139. this._allDistMargin(t3, i3, n2, r3) < this._allDistMargin(t3, i3, n2, e2) && t3.children.sort(r3);
  7140. }, r2.prototype._allDistMargin = function(t3, i3, n2, r3) {
  7141. t3.children.sort(r3);
  7142. for (var e2 = this.toBBox, a2 = h2(t3, 0, i3, e2), s2 = h2(t3, n2 - i3, n2, e2), l2 = u(a2) + u(s2), f2 = i3; f2 < n2 - i3; f2++) {
  7143. var m2 = t3.children[f2];
  7144. o(a2, t3.leaf ? e2(m2) : m2), l2 += u(a2);
  7145. }
  7146. for (var c2 = n2 - i3 - 1; c2 >= i3; c2--) {
  7147. var p2 = t3.children[c2];
  7148. o(s2, t3.leaf ? e2(p2) : p2), l2 += u(s2);
  7149. }
  7150. return l2;
  7151. }, r2.prototype._adjustParentBBoxes = function(t3, i3, n2) {
  7152. for (var r3 = n2; r3 >= 0; r3--)
  7153. o(i3[r3], t3);
  7154. }, r2.prototype._condense = function(t3) {
  7155. for (var i3 = t3.length - 1, n2 = void 0; i3 >= 0; i3--)
  7156. 0 === t3[i3].children.length ? i3 > 0 ? (n2 = t3[i3 - 1].children).splice(n2.indexOf(t3[i3]), 1) : this.clear() : a(t3[i3], this.toBBox);
  7157. }, r2;
  7158. });
  7159. })(rbush_min);
  7160. var require$$1$1 = /* @__PURE__ */ getAugmentedNamespace(es$2);
  7161. var require$$2 = /* @__PURE__ */ getAugmentedNamespace(es$1);
  7162. var require$$3 = /* @__PURE__ */ getAugmentedNamespace(es);
  7163. var rbush = rbush_min.exports;
  7164. var helpers = require$$1$1;
  7165. var meta = require$$2;
  7166. var turfBBox = require$$3.default;
  7167. var featureEach = meta.featureEach;
  7168. meta.coordEach;
  7169. helpers.polygon;
  7170. var featureCollection = helpers.featureCollection;
  7171. function geojsonRbush(maxEntries) {
  7172. var tree = new rbush(maxEntries);
  7173. tree.insert = function(feature2) {
  7174. if (feature2.type !== "Feature")
  7175. throw new Error("invalid feature");
  7176. feature2.bbox = feature2.bbox ? feature2.bbox : turfBBox(feature2);
  7177. return rbush.prototype.insert.call(this, feature2);
  7178. };
  7179. tree.load = function(features) {
  7180. var load = [];
  7181. if (Array.isArray(features)) {
  7182. features.forEach(function(feature2) {
  7183. if (feature2.type !== "Feature")
  7184. throw new Error("invalid features");
  7185. feature2.bbox = feature2.bbox ? feature2.bbox : turfBBox(feature2);
  7186. load.push(feature2);
  7187. });
  7188. } else {
  7189. featureEach(features, function(feature2) {
  7190. if (feature2.type !== "Feature")
  7191. throw new Error("invalid features");
  7192. feature2.bbox = feature2.bbox ? feature2.bbox : turfBBox(feature2);
  7193. load.push(feature2);
  7194. });
  7195. }
  7196. return rbush.prototype.load.call(this, load);
  7197. };
  7198. tree.remove = function(feature2, equals) {
  7199. if (feature2.type !== "Feature")
  7200. throw new Error("invalid feature");
  7201. feature2.bbox = feature2.bbox ? feature2.bbox : turfBBox(feature2);
  7202. return rbush.prototype.remove.call(this, feature2, equals);
  7203. };
  7204. tree.clear = function() {
  7205. return rbush.prototype.clear.call(this);
  7206. };
  7207. tree.search = function(geojson) {
  7208. var features = rbush.prototype.search.call(this, this.toBBox(geojson));
  7209. return featureCollection(features);
  7210. };
  7211. tree.collides = function(geojson) {
  7212. return rbush.prototype.collides.call(this, this.toBBox(geojson));
  7213. };
  7214. tree.all = function() {
  7215. var features = rbush.prototype.all.call(this);
  7216. return featureCollection(features);
  7217. };
  7218. tree.toJSON = function() {
  7219. return rbush.prototype.toJSON.call(this);
  7220. };
  7221. tree.fromJSON = function(json) {
  7222. return rbush.prototype.fromJSON.call(this, json);
  7223. };
  7224. tree.toBBox = function(geojson) {
  7225. var bbox2;
  7226. if (geojson.bbox)
  7227. bbox2 = geojson.bbox;
  7228. else if (Array.isArray(geojson) && geojson.length === 4)
  7229. bbox2 = geojson;
  7230. else if (Array.isArray(geojson) && geojson.length === 6)
  7231. bbox2 = [geojson[0], geojson[1], geojson[3], geojson[4]];
  7232. else if (geojson.type === "Feature")
  7233. bbox2 = turfBBox(geojson);
  7234. else if (geojson.type === "FeatureCollection")
  7235. bbox2 = turfBBox(geojson);
  7236. else
  7237. throw new Error("invalid geojson");
  7238. return {
  7239. minX: bbox2[0],
  7240. minY: bbox2[1],
  7241. maxX: bbox2[2],
  7242. maxY: bbox2[3]
  7243. };
  7244. };
  7245. return tree;
  7246. }
  7247. geojsonRbush$1.exports = geojsonRbush;
  7248. geojsonRbush$1.exports.default = geojsonRbush;
  7249. var rbush$1 = geojsonRbush$1.exports;
  7250. function lineIntersect(line1, line2) {
  7251. var unique = {};
  7252. var results = [];
  7253. if (line1.type === "LineString") {
  7254. line1 = feature(line1);
  7255. }
  7256. if (line2.type === "LineString") {
  7257. line2 = feature(line2);
  7258. }
  7259. if (line1.type === "Feature" && line2.type === "Feature" && line1.geometry !== null && line2.geometry !== null && line1.geometry.type === "LineString" && line2.geometry.type === "LineString" && line1.geometry.coordinates.length === 2 && line2.geometry.coordinates.length === 2) {
  7260. var intersect = intersects(line1, line2);
  7261. if (intersect) {
  7262. results.push(intersect);
  7263. }
  7264. return featureCollection$1(results);
  7265. }
  7266. var tree = rbush$1();
  7267. tree.load(lineSegment(line2));
  7268. featureEach$1(lineSegment(line1), function(segment) {
  7269. featureEach$1(tree.search(segment), function(match) {
  7270. var intersect2 = intersects(segment, match);
  7271. if (intersect2) {
  7272. var key = getCoords(intersect2).join(",");
  7273. if (!unique[key]) {
  7274. unique[key] = true;
  7275. results.push(intersect2);
  7276. }
  7277. }
  7278. });
  7279. });
  7280. return featureCollection$1(results);
  7281. }
  7282. function intersects(line1, line2) {
  7283. var coords1 = getCoords(line1);
  7284. var coords2 = getCoords(line2);
  7285. if (coords1.length !== 2) {
  7286. throw new Error("<intersects> line1 must only contain 2 coordinates");
  7287. }
  7288. if (coords2.length !== 2) {
  7289. throw new Error("<intersects> line2 must only contain 2 coordinates");
  7290. }
  7291. var x1 = coords1[0][0];
  7292. var y1 = coords1[0][1];
  7293. var x2 = coords1[1][0];
  7294. var y2 = coords1[1][1];
  7295. var x3 = coords2[0][0];
  7296. var y3 = coords2[0][1];
  7297. var x4 = coords2[1][0];
  7298. var y4 = coords2[1][1];
  7299. var denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
  7300. var numeA = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3);
  7301. var numeB = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3);
  7302. if (denom === 0) {
  7303. if (numeA === 0 && numeB === 0) {
  7304. return null;
  7305. }
  7306. return null;
  7307. }
  7308. var uA = numeA / denom;
  7309. var uB = numeB / denom;
  7310. if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) {
  7311. var x = x1 + uA * (x2 - x1);
  7312. var y = y1 + uA * (y2 - y1);
  7313. return point([x, y]);
  7314. }
  7315. return null;
  7316. }
  7317. function booleanPointOnLine(pt2, line, options2) {
  7318. if (options2 === void 0) {
  7319. options2 = {};
  7320. }
  7321. var ptCoords = getCoord(pt2);
  7322. var lineCoords = getCoords(line);
  7323. for (var i2 = 0; i2 < lineCoords.length - 1; i2++) {
  7324. var ignoreBoundary = false;
  7325. if (options2.ignoreEndVertices) {
  7326. if (i2 === 0) {
  7327. ignoreBoundary = "start";
  7328. }
  7329. if (i2 === lineCoords.length - 2) {
  7330. ignoreBoundary = "end";
  7331. }
  7332. if (i2 === 0 && i2 + 1 === lineCoords.length - 1) {
  7333. ignoreBoundary = "both";
  7334. }
  7335. }
  7336. if (isPointOnLineSegment$1(lineCoords[i2], lineCoords[i2 + 1], ptCoords, ignoreBoundary, typeof options2.epsilon === "undefined" ? null : options2.epsilon)) {
  7337. return true;
  7338. }
  7339. }
  7340. return false;
  7341. }
  7342. function isPointOnLineSegment$1(lineSegmentStart, lineSegmentEnd, pt2, excludeBoundary, epsilon) {
  7343. var x = pt2[0];
  7344. var y = pt2[1];
  7345. var x1 = lineSegmentStart[0];
  7346. var y1 = lineSegmentStart[1];
  7347. var x2 = lineSegmentEnd[0];
  7348. var y2 = lineSegmentEnd[1];
  7349. var dxc = pt2[0] - x1;
  7350. var dyc = pt2[1] - y1;
  7351. var dxl = x2 - x1;
  7352. var dyl = y2 - y1;
  7353. var cross2 = dxc * dyl - dyc * dxl;
  7354. if (epsilon !== null) {
  7355. if (Math.abs(cross2) > epsilon) {
  7356. return false;
  7357. }
  7358. } else if (cross2 !== 0) {
  7359. return false;
  7360. }
  7361. if (!excludeBoundary) {
  7362. if (Math.abs(dxl) >= Math.abs(dyl)) {
  7363. return dxl > 0 ? x1 <= x && x <= x2 : x2 <= x && x <= x1;
  7364. }
  7365. return dyl > 0 ? y1 <= y && y <= y2 : y2 <= y && y <= y1;
  7366. } else if (excludeBoundary === "start") {
  7367. if (Math.abs(dxl) >= Math.abs(dyl)) {
  7368. return dxl > 0 ? x1 < x && x <= x2 : x2 <= x && x < x1;
  7369. }
  7370. return dyl > 0 ? y1 < y && y <= y2 : y2 <= y && y < y1;
  7371. } else if (excludeBoundary === "end") {
  7372. if (Math.abs(dxl) >= Math.abs(dyl)) {
  7373. return dxl > 0 ? x1 <= x && x < x2 : x2 < x && x <= x1;
  7374. }
  7375. return dyl > 0 ? y1 <= y && y < y2 : y2 < y && y <= y1;
  7376. } else if (excludeBoundary === "both") {
  7377. if (Math.abs(dxl) >= Math.abs(dyl)) {
  7378. return dxl > 0 ? x1 < x && x < x2 : x2 < x && x < x1;
  7379. }
  7380. return dyl > 0 ? y1 < y && y < y2 : y2 < y && y < y1;
  7381. }
  7382. return false;
  7383. }
  7384. function booleanWithin(feature1, feature2) {
  7385. var geom1 = getGeom(feature1);
  7386. var geom2 = getGeom(feature2);
  7387. var type1 = geom1.type;
  7388. var type2 = geom2.type;
  7389. switch (type1) {
  7390. case "Point":
  7391. switch (type2) {
  7392. case "MultiPoint":
  7393. return isPointInMultiPoint(geom1, geom2);
  7394. case "LineString":
  7395. return booleanPointOnLine(geom1, geom2, { ignoreEndVertices: true });
  7396. case "Polygon":
  7397. case "MultiPolygon":
  7398. return booleanPointInPolygon(geom1, geom2, { ignoreBoundary: true });
  7399. default:
  7400. throw new Error("feature2 " + type2 + " geometry not supported");
  7401. }
  7402. case "MultiPoint":
  7403. switch (type2) {
  7404. case "MultiPoint":
  7405. return isMultiPointInMultiPoint(geom1, geom2);
  7406. case "LineString":
  7407. return isMultiPointOnLine(geom1, geom2);
  7408. case "Polygon":
  7409. case "MultiPolygon":
  7410. return isMultiPointInPoly(geom1, geom2);
  7411. default:
  7412. throw new Error("feature2 " + type2 + " geometry not supported");
  7413. }
  7414. case "LineString":
  7415. switch (type2) {
  7416. case "LineString":
  7417. return isLineOnLine$1(geom1, geom2);
  7418. case "Polygon":
  7419. case "MultiPolygon":
  7420. return isLineInPoly$1(geom1, geom2);
  7421. default:
  7422. throw new Error("feature2 " + type2 + " geometry not supported");
  7423. }
  7424. case "Polygon":
  7425. switch (type2) {
  7426. case "Polygon":
  7427. case "MultiPolygon":
  7428. return isPolyInPoly$1(geom1, geom2);
  7429. default:
  7430. throw new Error("feature2 " + type2 + " geometry not supported");
  7431. }
  7432. default:
  7433. throw new Error("feature1 " + type1 + " geometry not supported");
  7434. }
  7435. }
  7436. function isPointInMultiPoint(point2, multiPoint2) {
  7437. var i2;
  7438. var output = false;
  7439. for (i2 = 0; i2 < multiPoint2.coordinates.length; i2++) {
  7440. if (compareCoords$1(multiPoint2.coordinates[i2], point2.coordinates)) {
  7441. output = true;
  7442. break;
  7443. }
  7444. }
  7445. return output;
  7446. }
  7447. function isMultiPointInMultiPoint(multiPoint1, multiPoint2) {
  7448. for (var i2 = 0; i2 < multiPoint1.coordinates.length; i2++) {
  7449. var anyMatch = false;
  7450. for (var i22 = 0; i22 < multiPoint2.coordinates.length; i22++) {
  7451. if (compareCoords$1(multiPoint1.coordinates[i2], multiPoint2.coordinates[i22])) {
  7452. anyMatch = true;
  7453. }
  7454. }
  7455. if (!anyMatch) {
  7456. return false;
  7457. }
  7458. }
  7459. return true;
  7460. }
  7461. function isMultiPointOnLine(multiPoint2, lineString2) {
  7462. var foundInsidePoint = false;
  7463. for (var i2 = 0; i2 < multiPoint2.coordinates.length; i2++) {
  7464. if (!booleanPointOnLine(multiPoint2.coordinates[i2], lineString2)) {
  7465. return false;
  7466. }
  7467. if (!foundInsidePoint) {
  7468. foundInsidePoint = booleanPointOnLine(multiPoint2.coordinates[i2], lineString2, { ignoreEndVertices: true });
  7469. }
  7470. }
  7471. return foundInsidePoint;
  7472. }
  7473. function isMultiPointInPoly(multiPoint2, polygon2) {
  7474. var output = true;
  7475. var isInside = false;
  7476. for (var i2 = 0; i2 < multiPoint2.coordinates.length; i2++) {
  7477. isInside = booleanPointInPolygon(multiPoint2.coordinates[1], polygon2);
  7478. if (!isInside) {
  7479. output = false;
  7480. break;
  7481. }
  7482. {
  7483. isInside = booleanPointInPolygon(multiPoint2.coordinates[1], polygon2, {
  7484. ignoreBoundary: true
  7485. });
  7486. }
  7487. }
  7488. return output && isInside;
  7489. }
  7490. function isLineOnLine$1(lineString1, lineString2) {
  7491. for (var i2 = 0; i2 < lineString1.coordinates.length; i2++) {
  7492. if (!booleanPointOnLine(lineString1.coordinates[i2], lineString2)) {
  7493. return false;
  7494. }
  7495. }
  7496. return true;
  7497. }
  7498. function isLineInPoly$1(linestring, polygon2) {
  7499. var polyBbox = bbox$1(polygon2);
  7500. var lineBbox = bbox$1(linestring);
  7501. if (!doBBoxOverlap(polyBbox, lineBbox)) {
  7502. return false;
  7503. }
  7504. var foundInsidePoint = false;
  7505. for (var i2 = 0; i2 < linestring.coordinates.length - 1; i2++) {
  7506. if (!booleanPointInPolygon(linestring.coordinates[i2], polygon2)) {
  7507. return false;
  7508. }
  7509. if (!foundInsidePoint) {
  7510. foundInsidePoint = booleanPointInPolygon(linestring.coordinates[i2], polygon2, { ignoreBoundary: true });
  7511. }
  7512. if (!foundInsidePoint) {
  7513. var midpoint2 = getMidpoint(linestring.coordinates[i2], linestring.coordinates[i2 + 1]);
  7514. foundInsidePoint = booleanPointInPolygon(midpoint2, polygon2, {
  7515. ignoreBoundary: true
  7516. });
  7517. }
  7518. }
  7519. return foundInsidePoint;
  7520. }
  7521. function isPolyInPoly$1(geometry1, geometry2) {
  7522. var poly1Bbox = bbox$1(geometry1);
  7523. var poly2Bbox = bbox$1(geometry2);
  7524. if (!doBBoxOverlap(poly2Bbox, poly1Bbox)) {
  7525. return false;
  7526. }
  7527. for (var i2 = 0; i2 < geometry1.coordinates[0].length; i2++) {
  7528. if (!booleanPointInPolygon(geometry1.coordinates[0][i2], geometry2)) {
  7529. return false;
  7530. }
  7531. }
  7532. return true;
  7533. }
  7534. function doBBoxOverlap(bbox1, bbox2) {
  7535. if (bbox1[0] > bbox2[0])
  7536. return false;
  7537. if (bbox1[2] < bbox2[2])
  7538. return false;
  7539. if (bbox1[1] > bbox2[1])
  7540. return false;
  7541. if (bbox1[3] < bbox2[3])
  7542. return false;
  7543. return true;
  7544. }
  7545. function compareCoords$1(pair1, pair2) {
  7546. return pair1[0] === pair2[0] && pair1[1] === pair2[1];
  7547. }
  7548. function getMidpoint(pair1, pair2) {
  7549. return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];
  7550. }
  7551. function pointGrid(bbox2, cellSide, options2) {
  7552. if (options2 === void 0) {
  7553. options2 = {};
  7554. }
  7555. if (options2.mask && !options2.units)
  7556. options2.units = "kilometers";
  7557. var results = [];
  7558. var west = bbox2[0];
  7559. var south = bbox2[1];
  7560. var east = bbox2[2];
  7561. var north = bbox2[3];
  7562. var xFraction = cellSide / distance([west, south], [east, south], options2);
  7563. var cellWidth = xFraction * (east - west);
  7564. var yFraction = cellSide / distance([west, south], [west, north], options2);
  7565. var cellHeight = yFraction * (north - south);
  7566. var bboxWidth = east - west;
  7567. var bboxHeight = north - south;
  7568. var columns = Math.floor(bboxWidth / cellWidth);
  7569. var rows = Math.floor(bboxHeight / cellHeight);
  7570. var deltaX = (bboxWidth - columns * cellWidth) / 2;
  7571. var deltaY = (bboxHeight - rows * cellHeight) / 2;
  7572. var currentX = west + deltaX;
  7573. while (currentX <= east) {
  7574. var currentY = south + deltaY;
  7575. while (currentY <= north) {
  7576. var cellPt = point([currentX, currentY], options2.properties);
  7577. if (options2.mask) {
  7578. if (booleanWithin(cellPt, options2.mask))
  7579. results.push(cellPt);
  7580. } else {
  7581. results.push(cellPt);
  7582. }
  7583. currentY += cellHeight;
  7584. }
  7585. currentX += cellWidth;
  7586. }
  7587. return featureCollection$1(results);
  7588. }
  7589. function polygonToLine(poly, options2) {
  7590. if (options2 === void 0) {
  7591. options2 = {};
  7592. }
  7593. var geom = getGeom(poly);
  7594. if (!options2.properties && poly.type === "Feature") {
  7595. options2.properties = poly.properties;
  7596. }
  7597. switch (geom.type) {
  7598. case "Polygon":
  7599. return polygonToLine$1(geom, options2);
  7600. case "MultiPolygon":
  7601. return multiPolygonToLine(geom, options2);
  7602. default:
  7603. throw new Error("invalid poly");
  7604. }
  7605. }
  7606. function polygonToLine$1(poly, options2) {
  7607. if (options2 === void 0) {
  7608. options2 = {};
  7609. }
  7610. var geom = getGeom(poly);
  7611. var coords = geom.coordinates;
  7612. var properties = options2.properties ? options2.properties : poly.type === "Feature" ? poly.properties : {};
  7613. return coordsToLine(coords, properties);
  7614. }
  7615. function multiPolygonToLine(multiPoly, options2) {
  7616. if (options2 === void 0) {
  7617. options2 = {};
  7618. }
  7619. var geom = getGeom(multiPoly);
  7620. var coords = geom.coordinates;
  7621. var properties = options2.properties ? options2.properties : multiPoly.type === "Feature" ? multiPoly.properties : {};
  7622. var lines = [];
  7623. coords.forEach(function(coord) {
  7624. lines.push(coordsToLine(coord, properties));
  7625. });
  7626. return featureCollection$1(lines);
  7627. }
  7628. function coordsToLine(coords, properties) {
  7629. if (coords.length > 1) {
  7630. return multiLineString(coords, properties);
  7631. }
  7632. return lineString(coords[0], properties);
  7633. }
  7634. function booleanClockwise(line) {
  7635. var ring = getCoords(line);
  7636. var sum = 0;
  7637. var i2 = 1;
  7638. var prev;
  7639. var cur;
  7640. while (i2 < ring.length) {
  7641. prev = cur || ring[0];
  7642. cur = ring[i2];
  7643. sum += (cur[0] - prev[0]) * (cur[1] + prev[1]);
  7644. i2++;
  7645. }
  7646. return sum > 0;
  7647. }
  7648. function booleanDisjoint(feature1, feature2) {
  7649. var bool = true;
  7650. flattenEach(feature1, function(flatten1) {
  7651. flattenEach(feature2, function(flatten22) {
  7652. if (bool === false) {
  7653. return false;
  7654. }
  7655. bool = disjoint(flatten1.geometry, flatten22.geometry);
  7656. });
  7657. });
  7658. return bool;
  7659. }
  7660. function disjoint(geom1, geom2) {
  7661. switch (geom1.type) {
  7662. case "Point":
  7663. switch (geom2.type) {
  7664. case "Point":
  7665. return !compareCoords(geom1.coordinates, geom2.coordinates);
  7666. case "LineString":
  7667. return !isPointOnLine(geom2, geom1);
  7668. case "Polygon":
  7669. return !booleanPointInPolygon(geom1, geom2);
  7670. }
  7671. break;
  7672. case "LineString":
  7673. switch (geom2.type) {
  7674. case "Point":
  7675. return !isPointOnLine(geom1, geom2);
  7676. case "LineString":
  7677. return !isLineOnLine(geom1, geom2);
  7678. case "Polygon":
  7679. return !isLineInPoly(geom2, geom1);
  7680. }
  7681. break;
  7682. case "Polygon":
  7683. switch (geom2.type) {
  7684. case "Point":
  7685. return !booleanPointInPolygon(geom2, geom1);
  7686. case "LineString":
  7687. return !isLineInPoly(geom1, geom2);
  7688. case "Polygon":
  7689. return !isPolyInPoly(geom2, geom1);
  7690. }
  7691. }
  7692. return false;
  7693. }
  7694. function isPointOnLine(lineString2, pt2) {
  7695. for (var i2 = 0; i2 < lineString2.coordinates.length - 1; i2++) {
  7696. if (isPointOnLineSegment(lineString2.coordinates[i2], lineString2.coordinates[i2 + 1], pt2.coordinates)) {
  7697. return true;
  7698. }
  7699. }
  7700. return false;
  7701. }
  7702. function isLineOnLine(lineString1, lineString2) {
  7703. var doLinesIntersect = lineIntersect(lineString1, lineString2);
  7704. if (doLinesIntersect.features.length > 0) {
  7705. return true;
  7706. }
  7707. return false;
  7708. }
  7709. function isLineInPoly(polygon2, lineString2) {
  7710. for (var _i = 0, _a2 = lineString2.coordinates; _i < _a2.length; _i++) {
  7711. var coord = _a2[_i];
  7712. if (booleanPointInPolygon(coord, polygon2)) {
  7713. return true;
  7714. }
  7715. }
  7716. var doLinesIntersect = lineIntersect(lineString2, polygonToLine(polygon2));
  7717. if (doLinesIntersect.features.length > 0) {
  7718. return true;
  7719. }
  7720. return false;
  7721. }
  7722. function isPolyInPoly(feature1, feature2) {
  7723. for (var _i = 0, _a2 = feature1.coordinates[0]; _i < _a2.length; _i++) {
  7724. var coord1 = _a2[_i];
  7725. if (booleanPointInPolygon(coord1, feature2)) {
  7726. return true;
  7727. }
  7728. }
  7729. for (var _b = 0, _c = feature2.coordinates[0]; _b < _c.length; _b++) {
  7730. var coord2 = _c[_b];
  7731. if (booleanPointInPolygon(coord2, feature1)) {
  7732. return true;
  7733. }
  7734. }
  7735. var doLinesIntersect = lineIntersect(polygonToLine(feature1), polygonToLine(feature2));
  7736. if (doLinesIntersect.features.length > 0) {
  7737. return true;
  7738. }
  7739. return false;
  7740. }
  7741. function isPointOnLineSegment(lineSegmentStart, lineSegmentEnd, pt2) {
  7742. var dxc = pt2[0] - lineSegmentStart[0];
  7743. var dyc = pt2[1] - lineSegmentStart[1];
  7744. var dxl = lineSegmentEnd[0] - lineSegmentStart[0];
  7745. var dyl = lineSegmentEnd[1] - lineSegmentStart[1];
  7746. var cross2 = dxc * dyl - dyc * dxl;
  7747. if (cross2 !== 0) {
  7748. return false;
  7749. }
  7750. if (Math.abs(dxl) >= Math.abs(dyl)) {
  7751. if (dxl > 0) {
  7752. return lineSegmentStart[0] <= pt2[0] && pt2[0] <= lineSegmentEnd[0];
  7753. } else {
  7754. return lineSegmentEnd[0] <= pt2[0] && pt2[0] <= lineSegmentStart[0];
  7755. }
  7756. } else if (dyl > 0) {
  7757. return lineSegmentStart[1] <= pt2[1] && pt2[1] <= lineSegmentEnd[1];
  7758. } else {
  7759. return lineSegmentEnd[1] <= pt2[1] && pt2[1] <= lineSegmentStart[1];
  7760. }
  7761. }
  7762. function compareCoords(pair1, pair2) {
  7763. return pair1[0] === pair2[0] && pair1[1] === pair2[1];
  7764. }
  7765. function booleanIntersects(feature1, feature2) {
  7766. var bool = false;
  7767. flattenEach(feature1, function(flatten1) {
  7768. flattenEach(feature2, function(flatten22) {
  7769. if (bool === true) {
  7770. return true;
  7771. }
  7772. bool = !booleanDisjoint(flatten1.geometry, flatten22.geometry);
  7773. });
  7774. });
  7775. return bool;
  7776. }
  7777. function rectangleGrid(bbox2, cellWidth, cellHeight, options2) {
  7778. if (options2 === void 0) {
  7779. options2 = {};
  7780. }
  7781. var results = [];
  7782. var west = bbox2[0];
  7783. var south = bbox2[1];
  7784. var east = bbox2[2];
  7785. var north = bbox2[3];
  7786. var xFraction = cellWidth / distance([west, south], [east, south], options2);
  7787. var cellWidthDeg = xFraction * (east - west);
  7788. var yFraction = cellHeight / distance([west, south], [west, north], options2);
  7789. var cellHeightDeg = yFraction * (north - south);
  7790. var bboxWidth = east - west;
  7791. var bboxHeight = north - south;
  7792. var columns = Math.floor(bboxWidth / cellWidthDeg);
  7793. var rows = Math.floor(bboxHeight / cellHeightDeg);
  7794. var deltaX = (bboxWidth - columns * cellWidthDeg) / 2;
  7795. var deltaY = (bboxHeight - rows * cellHeightDeg) / 2;
  7796. var currentX = west + deltaX;
  7797. for (var column = 0; column < columns; column++) {
  7798. var currentY = south + deltaY;
  7799. for (var row = 0; row < rows; row++) {
  7800. var cellPoly = polygon([
  7801. [
  7802. [currentX, currentY],
  7803. [currentX, currentY + cellHeightDeg],
  7804. [currentX + cellWidthDeg, currentY + cellHeightDeg],
  7805. [currentX + cellWidthDeg, currentY],
  7806. [currentX, currentY]
  7807. ]
  7808. ], options2.properties);
  7809. if (options2.mask) {
  7810. if (booleanIntersects(options2.mask, cellPoly)) {
  7811. results.push(cellPoly);
  7812. }
  7813. } else {
  7814. results.push(cellPoly);
  7815. }
  7816. currentY += cellHeightDeg;
  7817. }
  7818. currentX += cellWidthDeg;
  7819. }
  7820. return featureCollection$1(results);
  7821. }
  7822. function squareGrid(bbox2, cellSide, options2) {
  7823. if (options2 === void 0) {
  7824. options2 = {};
  7825. }
  7826. return rectangleGrid(bbox2, cellSide, cellSide, options2);
  7827. }
  7828. class ViewShed {
  7829. constructor(viewer2) {
  7830. if (!viewer2)
  7831. throw new Cesium.DeveloperError("no viewer object!");
  7832. this.viewer = viewer2;
  7833. this.handler = void 0;
  7834. this.lightCamera;
  7835. this.pyramid;
  7836. this.frustumPrimitive;
  7837. this.viewershedPolygon;
  7838. }
  7839. initHandler() {
  7840. if (this.handler) {
  7841. this.handler.destroy();
  7842. this.handler = void 0;
  7843. }
  7844. let canvas = document.getElementById("canvasMap");
  7845. if (canvas == null) {
  7846. canvas = document.createElement("canvas");
  7847. canvas.id = "canvasMap";
  7848. canvas.style.display = "none";
  7849. canvas.style.top = "0px";
  7850. canvas.style.position = "absolute";
  7851. document.body.append(canvas);
  7852. }
  7853. this.canvasEle = canvas;
  7854. }
  7855. ReturnDistance(pos0, pos1) {
  7856. let point1cartographic = Cesium.Cartographic.fromCartesian(pos0);
  7857. let point2cartographic = Cesium.Cartographic.fromCartesian(pos1);
  7858. let geodesic = new Cesium.EllipsoidGeodesic();
  7859. geodesic.setEndPoints(point1cartographic, point2cartographic);
  7860. let s = geodesic.surfaceDistance;
  7861. return s;
  7862. }
  7863. getHeight(x, y, objectsToExclude) {
  7864. let endCartographic = Cesium.Cartographic.fromDegrees(x, y);
  7865. let endHeight = this.viewer.scene.sampleHeight(
  7866. endCartographic,
  7867. objectsToExclude
  7868. );
  7869. return endHeight;
  7870. }
  7871. cartesian3ToDegree(Cartesian32) {
  7872. let _ellipsoid = this.viewer.scene.globe.ellipsoid;
  7873. let _cartographic = _ellipsoid.cartesianToCartographic(Cartesian32);
  7874. let _lat = Cesium.Math.toDegrees(_cartographic.latitude);
  7875. let _lng = Cesium.Math.toDegrees(_cartographic.longitude);
  7876. let _alt = _cartographic.height;
  7877. return [_lng, _lat, _alt];
  7878. }
  7879. getAngle(lng1, lat1, lng2, lat2) {
  7880. let dRotateAngle = Math.atan2(Math.abs(lng1 - lng2), Math.abs(lat1 - lat2));
  7881. if (lng2 >= lng1) {
  7882. dRotateAngle = lat2 < lat1 ? Math.PI - dRotateAngle : dRotateAngle;
  7883. } else {
  7884. dRotateAngle = lat2 >= lat1 ? 2 * Math.PI - dRotateAngle : Math.PI + dRotateAngle;
  7885. }
  7886. dRotateAngle = dRotateAngle * 180 / Math.PI;
  7887. return dRotateAngle;
  7888. }
  7889. getPitch(pointA, pointB) {
  7890. let transfrom = Cesium.Transforms.eastNorthUpToFixedFrame(pointA);
  7891. const vector = Cesium.Cartesian3.subtract(
  7892. pointB,
  7893. pointA,
  7894. new Cesium.Cartesian3()
  7895. );
  7896. let direction = Cesium.Matrix4.multiplyByPointAsVector(
  7897. Cesium.Matrix4.inverse(transfrom, transfrom),
  7898. vector,
  7899. vector
  7900. );
  7901. Cesium.Cartesian3.normalize(direction, direction);
  7902. return Cesium.Math.PI_OVER_TWO - Cesium.Math.acosClamped(direction.z);
  7903. }
  7904. updateViewShed() {
  7905. this.clear();
  7906. this.setLightCamera();
  7907. this.addVisualPyramid();
  7908. this.createFrustum();
  7909. }
  7910. clear() {
  7911. if (this.pyramid) {
  7912. this.viewer.entities.removeById(this.pyramid.id);
  7913. this.pyramid = void 0;
  7914. }
  7915. if (this.frustumPrimitive) {
  7916. this.viewer.scene.primitives.remove(this.frustumPrimitive);
  7917. this.frustumPrimitive = void 0;
  7918. }
  7919. if (this.debugModelMatrixPrimitive) {
  7920. this.viewer.scene.primitives.remove(this.debugModelMatrixPrimitive);
  7921. this.debugModelMatrixPrimitive = void 0;
  7922. }
  7923. }
  7924. addVisualPyramid() {
  7925. let options2 = this.ViewShedOptions;
  7926. let position2 = options2.viewPosition;
  7927. let visualRange = Number(options2.visualRange);
  7928. let transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(position2);
  7929. this.debugModelMatrixPrimitive = this.viewer.scene.primitives.add(
  7930. new Cesium.DebugModelMatrixPrimitive({
  7931. modelMatrix: transform3,
  7932. length: 5
  7933. })
  7934. );
  7935. const halfClock = options2.horizontalViewAngle / 2;
  7936. const halfCone = options2.verticalViewAngle / 2;
  7937. const pitch = Cesium.Math.toDegrees(options2.pitch);
  7938. const ellipsoid = new Cesium.EllipsoidGraphics({
  7939. radii: new Cesium.Cartesian3(visualRange, visualRange, visualRange),
  7940. minimumClock: Cesium.Math.toRadians(90 - options2.direction - halfClock),
  7941. maximumClock: Cesium.Math.toRadians(90 - options2.direction + halfClock),
  7942. minimumCone: Cesium.Math.toRadians(90 - pitch - halfCone),
  7943. maximumCone: Cesium.Math.toRadians(90 - pitch + halfCone),
  7944. fill: false,
  7945. outline: true,
  7946. subdivisions: 256,
  7947. stackPartitions: 64,
  7948. slicePartitions: 64,
  7949. outlineColor: Cesium.Color.YELLOWGREEN.withAlpha(0.5)
  7950. });
  7951. const pyramidEntity = new Cesium.Entity({
  7952. position: position2,
  7953. ellipsoid
  7954. });
  7955. this.pyramid = this.viewer.entities.add(pyramidEntity);
  7956. }
  7957. setLightCamera() {
  7958. if (!this.lightCamera) {
  7959. this.lightCamera = new Cesium.Camera(this.viewer.scene);
  7960. }
  7961. let options2 = this.ViewShedOptions;
  7962. let visualRange = Number(options2.visualRange);
  7963. this.lightCamera.position = options2.viewPosition;
  7964. this.lightCamera.frustum.near = 0.1;
  7965. this.lightCamera.frustum.far = visualRange;
  7966. const hr = Cesium.Math.toRadians(options2.horizontalViewAngle);
  7967. const vr = Cesium.Math.toRadians(options2.verticalViewAngle);
  7968. this.lightCamera.frustum.aspectRatio = visualRange * Math.tan(hr / 2) * 2 / (visualRange * Math.tan(vr / 2) * 2);
  7969. this.lightCamera.frustum.fov = hr > vr ? hr : vr;
  7970. this.lightCamera.setView({
  7971. destination: options2.viewPosition,
  7972. orientation: {
  7973. heading: Cesium.Math.toRadians(options2.direction || 0),
  7974. pitch: options2.pitch || 0,
  7975. roll: 0
  7976. }
  7977. });
  7978. }
  7979. createFrustum() {
  7980. const scratchRight = new Cesium.Cartesian3();
  7981. const scratchRotation = new Cesium.Matrix3();
  7982. const scratchOrientation = new Cesium.Quaternion();
  7983. const direction = this.lightCamera.directionWC;
  7984. const up = this.lightCamera.upWC;
  7985. let right = this.lightCamera.rightWC;
  7986. right = Cesium.Cartesian3.negate(right, scratchRight);
  7987. let rotation = scratchRotation;
  7988. Cesium.Matrix3.setColumn(rotation, 0, right, rotation);
  7989. Cesium.Matrix3.setColumn(rotation, 1, up, rotation);
  7990. Cesium.Matrix3.setColumn(rotation, 2, direction, rotation);
  7991. let orientation = Cesium.Quaternion.fromRotationMatrix(
  7992. rotation,
  7993. scratchOrientation
  7994. );
  7995. let instanceOutline = new Cesium.GeometryInstance({
  7996. geometry: new Cesium.FrustumOutlineGeometry({
  7997. frustum: this.lightCamera.frustum,
  7998. origin: this.ViewShedOptions.viewPosition,
  7999. orientation
  8000. }),
  8001. id: "\u89C6\u690E\u4F53\u8F6E\u5ED3\u7EBF" + Math.random().toString(36).substr(2),
  8002. attributes: {
  8003. color: Cesium.ColorGeometryInstanceAttribute.fromColor(
  8004. new Cesium.Color(0, 1, 0, 1)
  8005. ),
  8006. show: new Cesium.ShowGeometryInstanceAttribute(true)
  8007. }
  8008. });
  8009. this.frustumPrimitive = this.viewer.scene.primitives.add(
  8010. new Cesium.Primitive({
  8011. geometryInstances: instanceOutline,
  8012. appearance: new Cesium.PerInstanceColorAppearance({
  8013. flat: true,
  8014. translucent: false,
  8015. closed: true
  8016. })
  8017. })
  8018. );
  8019. }
  8020. addViewershedPolygon(positionArr) {
  8021. let polygon2 = new Cesium.PolygonGeometry({
  8022. polygonHierarchy: new Cesium.PolygonHierarchy(
  8023. Cesium.Cartesian3.fromDegreesArray(positionArr)
  8024. ),
  8025. height: 0,
  8026. extrudedHeight: 0,
  8027. vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT,
  8028. stRotation: 0,
  8029. ellipsoid: Cesium.Ellipsoid.WGS84,
  8030. granularity: Cesium.Math.RADIANS_PER_DEGREE,
  8031. perPositionHeight: false,
  8032. closeTop: true,
  8033. closeBottom: true,
  8034. arcType: Cesium.ArcType.GEODESIC
  8035. });
  8036. let polygonInstance = new Cesium.GeometryInstance({
  8037. geometry: polygon2,
  8038. name: "ViewershedPolygon",
  8039. attributes: {
  8040. color: Cesium.ColorGeometryInstanceAttribute.fromColor(
  8041. Cesium.Color.BLUE.withAlpha(0.6)
  8042. ),
  8043. show: new Cesium.ShowGeometryInstanceAttribute(true)
  8044. }
  8045. });
  8046. this.viewershedPolygon = this.viewer.scene.primitives.add(
  8047. new Cesium.GroundPrimitive({
  8048. geometryInstances: polygonInstance,
  8049. appearance: new Cesium.EllipsoidSurfaceAppearance({
  8050. aboveGround: true,
  8051. material: new Cesium.Material({
  8052. fabric: {
  8053. type: "Image",
  8054. uniforms: {
  8055. image: this.returnImgae()
  8056. }
  8057. }
  8058. })
  8059. })
  8060. })
  8061. );
  8062. }
  8063. drawViewershed(precision) {
  8064. const pos = this.cartesian3ToDegree(this.ViewShedOptions.viewPosition);
  8065. const radius = this.ViewShedOptions.visualRange;
  8066. const direction = this.ViewShedOptions.direction;
  8067. let boundary = this.computeBoundaryOptions(pos, radius, direction);
  8068. const bbox2 = boundary.bbox;
  8069. let mask = polygon([boundary.boundaryPoints]);
  8070. const dis = this.ViewShedOptions.visualRange / (precision * 1e3);
  8071. let gridPoints = pointGrid(bbox2, dis, {
  8072. mask
  8073. });
  8074. console.log(this.ViewShedOptions.visualRange, precision, dis);
  8075. let pointsResult = this.createTargetPoints(gridPoints, dis, pos);
  8076. let variogram = index.train(
  8077. pointsResult.values,
  8078. pointsResult.lngs,
  8079. pointsResult.lats,
  8080. "exponential",
  8081. 0,
  8082. 100
  8083. );
  8084. let grid2 = index.grid([boundary.boundaryPoints], variogram, dis / 1e3);
  8085. const colors = [
  8086. "#ff000080",
  8087. "#ff000080",
  8088. "#ff000080",
  8089. "#ff000080",
  8090. "#ff000080",
  8091. "#ff000080",
  8092. "#00ff0080",
  8093. "#00ff0080",
  8094. "#00ff0080",
  8095. "#00ff0080",
  8096. "#00ff0080",
  8097. "#00ff0080"
  8098. ];
  8099. this.canvasEle.width = 3840;
  8100. this.canvasEle.height = 2160;
  8101. index.plot(
  8102. this.canvasEle,
  8103. grid2,
  8104. [bbox2[0], bbox2[2]],
  8105. [bbox2[1], bbox2[3]],
  8106. colors
  8107. );
  8108. this.addViewershedPolygon(boundary.positionArr);
  8109. }
  8110. computeBoundaryOptions(pos, radius, angle) {
  8111. let Ea = 6378137;
  8112. let Eb = 6356725;
  8113. const lng = pos[0], lat = pos[1];
  8114. const bbox2 = [lng, lat, lng, lat];
  8115. let positionArr = [];
  8116. let boundaryPoints = [];
  8117. positionArr.push(lng, lat);
  8118. boundaryPoints.push([lng, lat]);
  8119. let start2 = angle + 45 > 360 ? angle - 45 - 360 : angle - 45;
  8120. let end = start2 + 90;
  8121. for (let i2 = start2; i2 <= end; i2++) {
  8122. let dx = radius * Math.sin(i2 * Math.PI / 180);
  8123. let dy = radius * Math.cos(i2 * Math.PI / 180);
  8124. let ec = Eb + (Ea - Eb) * (90 - lat) / 90;
  8125. let ed = ec * Math.cos(lat * Math.PI / 180);
  8126. let BJD = lng + dx / ed * 180 / Math.PI;
  8127. let BWD = lat + dy / ec * 180 / Math.PI;
  8128. positionArr.push(BJD, BWD);
  8129. boundaryPoints.push([BJD, BWD]);
  8130. this.refreshBBox(bbox2, BJD, BWD);
  8131. }
  8132. boundaryPoints.push([lng, lat]);
  8133. return {
  8134. positionArr,
  8135. boundaryPoints,
  8136. bbox: bbox2
  8137. };
  8138. }
  8139. refreshBBox(result, x, y) {
  8140. result[0] = x < result[0] ? x : result[0];
  8141. result[1] = y < result[1] ? y : result[1];
  8142. result[2] = x > result[2] ? x : result[2];
  8143. result[3] = y > result[3] ? y : result[3];
  8144. }
  8145. createTargetPoints(gridPoints, step, sourcePos) {
  8146. let positionArr = [];
  8147. let objectsToExclude = [
  8148. this.frustumPrimitive,
  8149. this.pyramid,
  8150. this.debugModelMatrixPrimitive
  8151. ];
  8152. let values3 = [], lngs = [], lats = [];
  8153. let height2 = this.getHeight(sourcePos[0], sourcePos[1], objectsToExclude);
  8154. positionArr.push({
  8155. x: sourcePos[0],
  8156. y: sourcePos[1],
  8157. z: height2
  8158. });
  8159. let viewPoint = this.ViewShedOptions.viewPosition;
  8160. for (let index2 = 0; index2 < gridPoints.features.length; index2++) {
  8161. const feature2 = gridPoints.features[index2];
  8162. const coords = feature2.geometry.coordinates;
  8163. const x = coords[0], y = coords[1];
  8164. let h2 = this.getHeight(x, y, objectsToExclude);
  8165. let endPoint = Cesium.Cartesian3.fromDegrees(x, y, h2);
  8166. let direction = Cesium.Cartesian3.normalize(
  8167. Cesium.Cartesian3.subtract(
  8168. endPoint,
  8169. viewPoint,
  8170. new Cesium.Cartesian3()
  8171. ),
  8172. new Cesium.Cartesian3()
  8173. );
  8174. let ray = new Cesium.Ray(viewPoint, direction);
  8175. let result = this.viewer.scene.pickFromRay(ray, objectsToExclude);
  8176. if (result) {
  8177. let buffer = this.ReturnDistance(endPoint, result.position);
  8178. if (buffer > step) {
  8179. values3.push(0);
  8180. } else {
  8181. values3.push(1);
  8182. }
  8183. lngs.push(x);
  8184. lats.push(y);
  8185. }
  8186. }
  8187. return {
  8188. values: values3,
  8189. lngs,
  8190. lats
  8191. };
  8192. }
  8193. returnImgae() {
  8194. return this.canvasEle.toDataURL("image/png");
  8195. }
  8196. }
  8197. Object.assign(ViewShed.prototype, {
  8198. createViewshed: function(precision) {
  8199. let _self = this;
  8200. let scene = _self.viewer.scene;
  8201. _self.initHandler();
  8202. _self.clearAll();
  8203. let count = 0;
  8204. let toolTip = "\u5DE6\u952E\u70B9\u51FB\u521B\u5EFA\u8D77\u70B9";
  8205. _self.handler = new Cesium.ScreenSpaceEventHandler(_self.viewer.canvas);
  8206. _self.handler.setInputAction((event2) => {
  8207. count++;
  8208. if (count === 1) {
  8209. toolTip = "\u5DE6\u952E\u70B9\u51FB\u521B\u5EFA\u7EC8\u70B9";
  8210. let earthPosition = scene.pickPosition(event2.position);
  8211. let pos = _self.cartesian3ToDegree(earthPosition);
  8212. _self.handler.setInputAction(function(move) {
  8213. CreateRemindertip(toolTip, move.endPosition, true);
  8214. let newPosition = scene.pickPosition(move.endPosition);
  8215. if (Cesium.defined(newPosition)) {
  8216. let pos1 = _self.cartesian3ToDegree(newPosition);
  8217. let distance2 = Cesium.Cartesian3.distance(newPosition, earthPosition);
  8218. let angle = _self.getAngle(pos[0], pos[1], pos1[0], pos1[1]);
  8219. let pitch = _self.getPitch(earthPosition, newPosition);
  8220. _self.ViewShedOptions = {
  8221. viewPosition: earthPosition,
  8222. endPosition: newPosition,
  8223. direction: angle,
  8224. pitch,
  8225. horizontalViewAngle: 90,
  8226. verticalViewAngle: 60,
  8227. visibleAreaColor: Cesium.Color.GREEN,
  8228. invisibleAreaColor: Cesium.Color.RED,
  8229. visualRange: distance2
  8230. };
  8231. _self.updateViewShed();
  8232. }
  8233. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  8234. }
  8235. if (count === 2) {
  8236. _self.initHandler();
  8237. _self.drawViewershed(precision);
  8238. CreateRemindertip(toolTip, event2.endPosition, false);
  8239. }
  8240. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  8241. _self.handler.setInputAction(function(move) {
  8242. CreateRemindertip(toolTip, move.endPosition, true);
  8243. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  8244. },
  8245. clearAll: function() {
  8246. this.clear();
  8247. if (this.viewershedPolygon) {
  8248. this.viewer.scene.primitives.remove(this.viewershedPolygon);
  8249. this.viewershedPolygon = void 0;
  8250. }
  8251. }
  8252. });
  8253. class SunshineShadow {
  8254. constructor(viewer2) {
  8255. if (!viewer2)
  8256. throw new Cesium.DeveloperError("no viewer object!");
  8257. this._viewer = viewer2;
  8258. this._stopTime = null;
  8259. }
  8260. }
  8261. Object.assign(SunshineShadow.prototype, {
  8262. startSunShine(options2) {
  8263. options2 = options2 || {};
  8264. if (!Cesium.defined(options2.startTime)) {
  8265. options2.startTime = new Date().getTime();
  8266. }
  8267. if (!Cesium.defined(options2.stopTime)) {
  8268. options2.stopTime = new Date().getTime() + 1e3;
  8269. }
  8270. if (!Cesium.defined(options2.speed)) {
  8271. options2.speed = 1600;
  8272. }
  8273. if (this._stopTime) {
  8274. this._viewer.clock.shouldAnimate = true;
  8275. this._viewer.clock.currentTime = this._stopTime;
  8276. } else {
  8277. this._viewer.scene.globe.enableLighting = true;
  8278. this._viewer.shadows = true;
  8279. this._viewer.clock.startTime = Cesium.JulianDate.fromDate(new Date(options2.startTime));
  8280. this._viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date(options2.startTime));
  8281. this._viewer.clock.stopTime = Cesium.JulianDate.fromDate(new Date(options2.stopTime));
  8282. console.log(this._viewer.clock.currentTime);
  8283. this._viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP;
  8284. this._viewer.clock.clockStep = Cesium.ClockStep.SYSTEM_CLOCK_MULTIPLIER;
  8285. this._viewer.clock.multiplier = options2.speed;
  8286. this._viewer.clock.canAnimate = true;
  8287. this._viewer.clock.shouldAnimate = true;
  8288. }
  8289. },
  8290. stopSunShine() {
  8291. this._stopTime = this._viewer.clock.currentTime;
  8292. console.log(this._viewer.clock.currentTime);
  8293. this._viewer.clock.shouldAnimate = false;
  8294. },
  8295. removeSunShine() {
  8296. if (this._stopTime) {
  8297. this._viewer.clock.shouldAnimate = true;
  8298. this._viewer.clock.currentTime = this._stopTime;
  8299. console.log(this._viewer.clock.currentTime);
  8300. }
  8301. this._viewer.scene.globe.enableLighting = false;
  8302. this._viewer.shadows = false;
  8303. this._stopTime = null;
  8304. }
  8305. });
  8306. Object.assign(SunshineShadow.prototype, {
  8307. start(options2) {
  8308. if (document.getElementsByClassName("cesium-viewer-animationContainer").length > 0) {
  8309. document.getElementsByClassName("cesium-viewer-animationContainer")[0].style.display = "block";
  8310. }
  8311. if (document.getElementsByClassName("cesium-viewer-timelineContainer").length > 0) {
  8312. document.getElementsByClassName("cesium-viewer-timelineContainer")[0].style.display = "block";
  8313. }
  8314. this._viewer.shadows = true;
  8315. options2 = options2 || {};
  8316. if (!Cesium.defined(options2.startTime)) {
  8317. options2.startTime = new Date(new Date().toLocaleDateString()).getTime();
  8318. console.log("\u5F53\u5929\u51CC\u66680\u70B9", new Date(new Date().toLocaleDateString()));
  8319. }
  8320. if (!Cesium.defined(options2.stopTime)) {
  8321. options2.stopTime = new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1e3 - 1;
  8322. console.log("\u5F53\u592923\u70B959\u520659\u79D2", new Date(new Date(new Date().toLocaleDateString()).getTime() + 4 * 60 * 60 * 1e3));
  8323. }
  8324. if (!Cesium.defined(options2.speed)) {
  8325. options2.speed = 1600;
  8326. }
  8327. let start2 = Cesium.JulianDate.fromDate(new Date(options2.startTime));
  8328. let stop = Cesium.JulianDate.fromDate(new Date(options2.stopTime));
  8329. viewer.timeline.zoomTo(start2, stop);
  8330. let clock2 = viewer.clock;
  8331. clock2.shouldAnimate = false;
  8332. clock2.startTime = start2;
  8333. clock2.stopTime = stop;
  8334. clock2.currentTime = start2;
  8335. clock2.clockRange = Cesium.ClockRange.UNBOUNDED;
  8336. clock2.multiplier = options2.speed;
  8337. },
  8338. remove() {
  8339. if (document.getElementsByClassName("cesium-viewer-animationContainer").length > 0) {
  8340. document.getElementsByClassName("cesium-viewer-animationContainer")[0].style.display = "none";
  8341. }
  8342. if (document.getElementsByClassName("cesium-viewer-timelineContainer").length > 0) {
  8343. document.getElementsByClassName("cesium-viewer-timelineContainer")[0].style.display = "none";
  8344. }
  8345. this._viewer.shadows = false;
  8346. this._viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date(new Date().getTime()));
  8347. this._viewer.clock.shouldAnimate = false;
  8348. }
  8349. });
  8350. class Profile {
  8351. constructor(viewer2) {
  8352. if (!viewer2)
  8353. throw new Cesium.DeveloperError("no viewer object!");
  8354. this._viewer = viewer2;
  8355. this._profileEntities = [];
  8356. }
  8357. _interPoints(positions, objectsToExclude) {
  8358. let positionsCartographic = [];
  8359. let terrainSamplePositions = [];
  8360. for (let index2 = 0; index2 < positions.length; index2++) {
  8361. const element = positions[index2];
  8362. let ellipsoid = this._viewer.scene.globe.ellipsoid;
  8363. let cartographic = ellipsoid.cartesianToCartographic(element);
  8364. positionsCartographic.push(cartographic);
  8365. }
  8366. for (let i2 = 0; i2 < positionsCartographic.length; i2++) {
  8367. const m_Cartographic0 = positionsCartographic[i2];
  8368. const m_Cartographic1 = positionsCartographic[i2 + 1];
  8369. if (m_Cartographic1) {
  8370. let a = Math.abs(m_Cartographic0.longitude - m_Cartographic1.longitude) * 1e7;
  8371. let b = Math.abs(m_Cartographic0.latitude - m_Cartographic1.latitude) * 1e7;
  8372. if (a > b)
  8373. b = a;
  8374. let length = parseInt(b / 2);
  8375. if (length > 1e3)
  8376. length = 1e3;
  8377. if (length < 2)
  8378. length = 2;
  8379. for (let j = 0; j < length; j++) {
  8380. terrainSamplePositions.push(
  8381. new Cesium.Cartographic(
  8382. Cesium.Math.lerp(
  8383. m_Cartographic0.longitude,
  8384. m_Cartographic1.longitude,
  8385. j / (length - 1)
  8386. ),
  8387. Cesium.Math.lerp(
  8388. m_Cartographic0.latitude,
  8389. m_Cartographic1.latitude,
  8390. j / (length - 1)
  8391. )
  8392. )
  8393. );
  8394. }
  8395. terrainSamplePositions.pop();
  8396. } else {
  8397. terrainSamplePositions.push(m_Cartographic0);
  8398. }
  8399. }
  8400. let positions_Inter = [];
  8401. let distance2 = 0;
  8402. for (let n = 0; n < terrainSamplePositions.length; n++) {
  8403. let curCartographic = terrainSamplePositions[n];
  8404. let height2 = this._viewer.scene.sampleHeight(curCartographic, objectsToExclude);
  8405. const lon = curCartographic.longitude / Math.PI * 180;
  8406. const lat = curCartographic.latitude / Math.PI * 180;
  8407. let point2 = Cesium.Cartesian3.fromDegrees(lon, lat, height2);
  8408. let preCartographic = terrainSamplePositions[n - 1];
  8409. if (preCartographic) {
  8410. const lon1 = preCartographic.longitude / Math.PI * 180;
  8411. const lat1 = preCartographic.latitude / Math.PI * 180;
  8412. let point1 = Cesium.Cartesian3.fromDegrees(lon1, lat1, height2);
  8413. let curDis = Cesium.Cartesian3.distance(point1, point2);
  8414. distance2 += curDis;
  8415. }
  8416. positions_Inter.push({
  8417. position: {
  8418. lon,
  8419. lat,
  8420. height: height2
  8421. },
  8422. distance: distance2
  8423. });
  8424. }
  8425. return positions_Inter;
  8426. }
  8427. }
  8428. Object.assign(Profile.prototype, {
  8429. startProfileAnalysis(points2, entity) {
  8430. return new Promise((resolve2, reject2) => {
  8431. let _self = this;
  8432. let positions = points2.map((point2) => {
  8433. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  8434. });
  8435. _self.removeProfileAnalysis();
  8436. entity.clampToGround = true;
  8437. console.log(positions);
  8438. let pointsList = _self._interPoints(positions, [entity]);
  8439. console.log(pointsList);
  8440. resolve2(pointsList);
  8441. });
  8442. },
  8443. removeProfileAnalysis() {
  8444. let _self = this;
  8445. if (_self._profileEntities && _self._profileEntities.length > 0) {
  8446. _self._profileEntities.forEach((element) => {
  8447. _self._viewer.entities.remove(element);
  8448. });
  8449. }
  8450. _self._profileEntities = [];
  8451. }
  8452. });
  8453. class CutFill {
  8454. constructor(viewer2) {
  8455. if (!viewer2)
  8456. throw new Cesium.DeveloperError("no viewer object!");
  8457. this._viewer = viewer2;
  8458. this.delEntitys = [];
  8459. this.maxHeigh = -1e6;
  8460. }
  8461. _VolumeAnalysis(options2) {
  8462. let _self = this;
  8463. let cutArea = 0, cutVolume = 0, fillArea = 0, fillVolume = 0;
  8464. const indices = options2.geom.indices;
  8465. const positions = options2.geom.attributes.position.values;
  8466. for (let index2 = 0; index2 < indices.length; index2 += 3) {
  8467. const pos0 = _self._returnPosition(positions, indices[index2]);
  8468. const pos1 = _self._returnPosition(positions, indices[index2 + 1]);
  8469. const pos2 = _self._returnPosition(positions, indices[index2 + 2]);
  8470. let _entities = _self._viewer.entities.add({
  8471. name: "\u4E09\u89D2\u9762",
  8472. polygon: {
  8473. hierarchy: [pos0.heightPos, pos1.heightPos, pos2.heightPos],
  8474. perPositionHeight: true,
  8475. material: Cesium.Color.fromRandom(),
  8476. extrudedHeight: options2.height,
  8477. outline: true,
  8478. outlineColor: Cesium.Color.BLACK
  8479. }
  8480. });
  8481. _self.delEntitys.push(_entities);
  8482. const area = _self._computeArea4Triangle(
  8483. pos0.noHeightPos,
  8484. pos1.noHeightPos,
  8485. pos2.noHeightPos
  8486. );
  8487. const height2 = (pos0.height + pos1.height + pos2.height) / 3;
  8488. if (height2 < options2.height) {
  8489. fillArea += area;
  8490. const volume = area * (options2.height - height2);
  8491. fillVolume += volume;
  8492. } else {
  8493. cutArea += area;
  8494. const volume = area * (height2 - options2.height);
  8495. cutVolume += volume;
  8496. }
  8497. }
  8498. let allArea = cutArea + fillArea;
  8499. allArea = allArea.toFixed(2);
  8500. cutArea = cutArea.toFixed(2);
  8501. cutVolume = cutVolume.toFixed(2);
  8502. fillArea = fillArea.toFixed(2);
  8503. fillVolume = fillVolume.toFixed(2);
  8504. let result = {
  8505. allArea,
  8506. cutArea,
  8507. cutVolume,
  8508. fillArea,
  8509. fillVolume
  8510. };
  8511. return result;
  8512. }
  8513. _computeArea4Triangle(pos1, pos2, pos3) {
  8514. let a = Cesium.Cartesian3.distance(pos1, pos2);
  8515. let b = Cesium.Cartesian3.distance(pos2, pos3);
  8516. let c = Cesium.Cartesian3.distance(pos3, pos1);
  8517. let S = (a + b + c) / 2;
  8518. return Math.sqrt(S * (S - a) * (S - b) * (S - c));
  8519. }
  8520. _returnPosition(positions, index2) {
  8521. let cartesian = new Cesium.Cartesian3(
  8522. positions[index2 * 3],
  8523. positions[index2 * 3 + 1],
  8524. positions[index2 * 3 + 2]
  8525. );
  8526. let cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  8527. let height2 = this._viewer.scene.sampleHeightSupported ? this._viewer.scene.sampleHeight(cartographic) : this._viewer.scene.globe.getHeight(cartographic);
  8528. if (height2 > this.maxHeigh) {
  8529. this.maxHeigh = height2;
  8530. }
  8531. return {
  8532. heightPos: Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, height2),
  8533. noHeightPos: Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0),
  8534. height: height2
  8535. };
  8536. }
  8537. }
  8538. Object.assign(CutFill.prototype, {
  8539. createPolygonGeo(points2, options2) {
  8540. return new Promise((resolve2, reject2) => {
  8541. let _self = this;
  8542. options2 = options2 || {};
  8543. options2.precision = Cesium.defaultValue(options2.precision, 256);
  8544. options2.height = Cesium.defaultValue(options2.height, 10);
  8545. _self.remove();
  8546. let positions = [];
  8547. for (let i2 = 0; i2 < points2.length; i2++) {
  8548. if (points2[i2] instanceof Cesium.Cartesian3) {
  8549. positions.push(points2[i2]);
  8550. } else {
  8551. positions.push(Cesium.Cartesian3.fromDegrees(points2[i2][0], points2[i2][1], points2[i2][1] || 0));
  8552. }
  8553. }
  8554. let granularity = Math.PI / Math.pow(2, 11);
  8555. granularity = granularity / options2.precision;
  8556. let polygonGeometry = new Cesium.PolygonGeometry.fromPositions({
  8557. positions,
  8558. vertexFormat: Cesium.PerInstanceColorAppearance.FLAT_VERTEX_FORMAT,
  8559. granularity
  8560. });
  8561. options2.geom = new Cesium.PolygonGeometry.createGeometry(polygonGeometry);
  8562. let result = _self._VolumeAnalysis(options2);
  8563. _self._viewer.scene.globe.baseColor = new Cesium.Color(1, 1, 1, 0.9);
  8564. _self._viewer.scene.screenSpaceCameraController.enableCollisionDetection = false;
  8565. _self._viewer.scene.globe.translucency.enabled = true;
  8566. resolve2(result);
  8567. });
  8568. },
  8569. remove() {
  8570. for (var i2 = 0; i2 < this.delEntitys.length; i2++) {
  8571. this._viewer.entities.remove(this.delEntitys[i2]);
  8572. }
  8573. this._viewer.scene.screenSpaceCameraController.enableCollisionDetection = true;
  8574. this._viewer.scene.globe.translucency.enabled = false;
  8575. }
  8576. });
  8577. class HeightLimit {
  8578. constructor(viewer2) {
  8579. if (!viewer2)
  8580. throw new Cesium.DeveloperError("no viewer object!");
  8581. this._viewer = viewer2;
  8582. this.targetY = 0;
  8583. }
  8584. _setPolygon(options2) {
  8585. let _self = this;
  8586. _self.HiePolygon = _self._viewer.entities.add({
  8587. polygon: {
  8588. hierarchy: new Cesium.PolygonHierarchy(_self.data),
  8589. material: _self._handleColor("#FFF8DC", options2.alpha),
  8590. height: new Cesium.CallbackProperty(_self._createPolygonUpdateFunction(), false),
  8591. perPositionHeight: false,
  8592. outline: true,
  8593. outlineColor: _self._handleColor("red", options2.alpha),
  8594. outlineWidth: 1
  8595. }
  8596. });
  8597. }
  8598. _createPolygonUpdateFunction() {
  8599. let _self = this;
  8600. return function() {
  8601. return _self.targetY;
  8602. };
  8603. }
  8604. _handleColor(color2, alpha) {
  8605. return Cesium.Color.fromCssColorString(color2).withAlpha(alpha || 1);
  8606. }
  8607. _getMinHeight(points2) {
  8608. let height2 = 0;
  8609. points2.map((point2) => {
  8610. let _height = point2[2] || 0;
  8611. height2 = _height;
  8612. if (_height < height2) {
  8613. height2 = _height;
  8614. }
  8615. });
  8616. return height2;
  8617. }
  8618. }
  8619. Object.assign(HeightLimit.prototype, {
  8620. addPrimitive(points2, options2) {
  8621. this.removePrimitive();
  8622. options2 = options2 || {};
  8623. options2.height = Cesium.defaultValue(options2.height, 50);
  8624. options2.baseHeight = Cesium.defaultValue(options2.baseHeight, 50);
  8625. options2.color = Cesium.defaultValue(options2.color, "red");
  8626. options2.alpha = Cesium.defaultValue(options2.alpha, 0.6);
  8627. let positions = points2.map((point2) => {
  8628. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  8629. });
  8630. let _self = this;
  8631. _self.data = positions;
  8632. _self.baseHeight = options2.baseHeight;
  8633. _self.targetY = options2.baseHeight + options2.height;
  8634. let polygonInstance = new Cesium.GeometryInstance({
  8635. geometry: new Cesium.PolygonGeometry({
  8636. polygonHierarchy: new Cesium.PolygonHierarchy(_self.data),
  8637. height: _self.baseHeight,
  8638. extrudedHeight: _self.baseHeight + 3e3
  8639. }),
  8640. attributes: {
  8641. color: Cesium.ColorGeometryInstanceAttribute.fromColor(
  8642. Cesium.Color.fromCssColorString(options2.color).withAlpha(options2.alpha)
  8643. ),
  8644. show: new Cesium.ShowGeometryInstanceAttribute(true)
  8645. }
  8646. });
  8647. _self.limitHeightPrimitive = _self._viewer.scene.primitives.add(
  8648. new Cesium.ClassificationPrimitive({
  8649. geometryInstances: polygonInstance,
  8650. releaseGeometryInstances: false,
  8651. classificationType: Cesium.ClassificationType.CESIUM_3D_TILE
  8652. })
  8653. );
  8654. _self._setPolygon(options2);
  8655. },
  8656. removePrimitive() {
  8657. if (this.HiePolygon) {
  8658. this._viewer.entities.remove(this.HiePolygon);
  8659. }
  8660. if (this.limitHeightPrimitive) {
  8661. this._viewer.scene.primitives.remove(this.limitHeightPrimitive);
  8662. }
  8663. },
  8664. changeHeight(height2) {
  8665. if (!this.limitHeightPrimitive)
  8666. return;
  8667. this.targetY = this.baseHeight + height2;
  8668. let cartographic = Cesium.Cartographic.fromCartesian(this.limitHeightPrimitive._primitive._boundingSpheres[0].center);
  8669. let surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, this.baseHeight);
  8670. let offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, this.baseHeight + height2);
  8671. let translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
  8672. this.limitHeightPrimitive._primitive.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
  8673. }
  8674. });
  8675. class Cutting {
  8676. constructor(viewer2) {
  8677. if (!viewer2)
  8678. throw new Cesium.DeveloperError("no viewer object!");
  8679. this._viewer = viewer2;
  8680. this._camera = this._viewer.camera;
  8681. this._scene = this._viewer.scene;
  8682. this.targetY = 0;
  8683. this._mouseHandler();
  8684. }
  8685. _mouseHandler() {
  8686. let _self = this;
  8687. let viewer2 = _self._viewer;
  8688. let scene = _self._scene;
  8689. let selectedPlane;
  8690. let downHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  8691. downHandler.setInputAction(function(movement) {
  8692. let pickedObject = scene.pick(movement.position);
  8693. if (Cesium.defined(pickedObject) && Cesium.defined(pickedObject.id) && Cesium.defined(pickedObject.id.plane)) {
  8694. selectedPlane = pickedObject.id.plane;
  8695. selectedPlane.material = Cesium.Color.RED.withAlpha(0.05);
  8696. selectedPlane.outlineColor = Cesium.Color.RED;
  8697. scene.screenSpaceCameraController.enableInputs = false;
  8698. }
  8699. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  8700. let upHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  8701. upHandler.setInputAction(function() {
  8702. if (Cesium.defined(selectedPlane)) {
  8703. selectedPlane.material = Cesium.Color.RED.withAlpha(0.1);
  8704. selectedPlane.outlineColor = Cesium.Color.RED;
  8705. selectedPlane = void 0;
  8706. }
  8707. scene.screenSpaceCameraController.enableInputs = true;
  8708. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  8709. let moveHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  8710. moveHandler.setInputAction(function(movement) {
  8711. if (Cesium.defined(selectedPlane)) {
  8712. let deltaY = movement.startPosition.y - movement.endPosition.y;
  8713. _self.targetY += deltaY;
  8714. }
  8715. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  8716. }
  8717. _createPlaneUpdateFunction(plane) {
  8718. let _self = this;
  8719. return function() {
  8720. plane.distance = _self.targetY;
  8721. return plane;
  8722. };
  8723. }
  8724. _createPlane(p1, p2, inverseTransform) {
  8725. let _self = this;
  8726. let p1C3 = _self._getOriginCoordinateSystemPoint(p1, inverseTransform);
  8727. let p2C3 = _self._getOriginCoordinateSystemPoint(p2, inverseTransform);
  8728. let up = new Cesium.Cartesian3(0, 0, 10);
  8729. let right = Cesium.Cartesian3.subtract(p2C3, p1C3, new Cesium.Cartesian3());
  8730. let normal = Cesium.Cartesian3.cross(right, up, new Cesium.Cartesian3());
  8731. normal = Cesium.Cartesian3.normalize(normal, normal);
  8732. let planeTmp = Cesium.Plane.fromPointNormal(p1C3, normal);
  8733. return Cesium.ClippingPlane.fromPlane(planeTmp);
  8734. }
  8735. _getOriginCoordinateSystemPoint(point2, inverseTransform) {
  8736. let val = Cesium.Cartesian3.fromDegrees(point2[0], point2[1]);
  8737. return Cesium.Matrix4.multiplyByPoint(
  8738. inverseTransform,
  8739. val,
  8740. new Cesium.Cartesian3(0, 0, 0)
  8741. );
  8742. }
  8743. _getInverseTransform(tileSet) {
  8744. let transform3;
  8745. const tmp = tileSet.root.transform;
  8746. if (tmp && tmp.equals(Cesium.Matrix4.IDENTITY) || !tmp) {
  8747. transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(tileSet.boundingSphere.center);
  8748. } else {
  8749. transform3 = Cesium.Matrix4.fromArray(tileSet.root.transform);
  8750. }
  8751. return Cesium.Matrix4.inverseTransformation(transform3, new Cesium.Matrix4());
  8752. }
  8753. _isDirRes(polygon2, isClockwise) {
  8754. var lineStringList = [];
  8755. polygon2.forEach((p) => {
  8756. lineStringList.push([p.lng, p.lat]);
  8757. });
  8758. var clockwiseRing = lineString(lineStringList);
  8759. let isR = booleanClockwise(clockwiseRing);
  8760. var points2 = [];
  8761. if (isClockwise) {
  8762. if (!isR) {
  8763. points2 = polygon2;
  8764. } else {
  8765. var count = 0;
  8766. for (var ii = polygon2.length - 1; ii >= 0; ii--) {
  8767. points2[count] = polygon2[ii];
  8768. count++;
  8769. }
  8770. }
  8771. } else {
  8772. if (isR) {
  8773. points2 = polygon2;
  8774. } else {
  8775. var count = 0;
  8776. for (var ii = polygon2.length - 1; ii >= 0; ii--) {
  8777. points2[count] = polygon2[ii];
  8778. count++;
  8779. }
  8780. }
  8781. }
  8782. return points2;
  8783. }
  8784. }
  8785. Object.assign(Cutting.prototype, {
  8786. activate(tileset) {
  8787. let _self = this;
  8788. let viewer2 = _self._viewer;
  8789. let inverseTransform = _self._getInverseTransform(tileset);
  8790. const clippingPlanes1 = [];
  8791. clippingPlanes1.push(_self._createPlane([121.55814450142213, 37.39658788787028], [121.65814450142213, 37.49658788787028], inverseTransform));
  8792. let clippingPlanes = new Cesium.ClippingPlaneCollection({
  8793. planes: [
  8794. new Cesium.ClippingPlane(
  8795. new Cesium.Cartesian3(0, 1, 0),
  8796. -10
  8797. )
  8798. ],
  8799. edgeWidth: 1
  8800. });
  8801. _self.tileset = tileset;
  8802. tileset.clippingPlanes = clippingPlanes;
  8803. tileset.debugShowBoundingVolume = false;
  8804. return tileset.readyPromise.then(function() {
  8805. let boundingSphere = tileset.boundingSphere;
  8806. let radius = boundingSphere.radius;
  8807. viewer2.zoomTo(
  8808. tileset,
  8809. new Cesium.HeadingPitchRange(0.5, -0.2, radius / 5)
  8810. );
  8811. if (!Cesium.Matrix4.equals(
  8812. tileset.root.transform,
  8813. Cesium.Matrix4.IDENTITY
  8814. )) {
  8815. const transformCenter = Cesium.Matrix4.getTranslation(tileset.root.transform, new Cesium.Cartesian3());
  8816. const transformCartographic = Cesium.Cartographic.fromCartesian(transformCenter);
  8817. const boundingSphereCartographic = Cesium.Cartographic.fromCartesian(tileset.boundingSphere.center);
  8818. const height2 = boundingSphereCartographic.height - transformCartographic.height;
  8819. clippingPlanes.modelMatrix = Cesium.Matrix4.fromTranslation(new Cesium.Cartesian3(0, 0, height2));
  8820. }
  8821. for (let i2 = 0; i2 < clippingPlanes.length; ++i2) {
  8822. const plane = clippingPlanes.get(i2);
  8823. viewer2.entities.add({
  8824. position: boundingSphere.center,
  8825. plane: {
  8826. dimensions: new Cesium.Cartesian2(
  8827. radius / 10,
  8828. radius / 10
  8829. ),
  8830. material: Cesium.Color.WHITE.withAlpha(0.1),
  8831. plane: new Cesium.CallbackProperty(
  8832. _self._createPlaneUpdateFunction(plane),
  8833. false
  8834. ),
  8835. outline: true,
  8836. outlineColor: Cesium.Color.WHITE
  8837. }
  8838. });
  8839. }
  8840. return tileset;
  8841. });
  8842. },
  8843. addTiles(my3dtiles, pointsArray) {
  8844. let _self = this;
  8845. let viewer2 = _self._viewer;
  8846. let tileset = my3dtiles;
  8847. _self.polygon = pointsArray;
  8848. _self.tileset = tileset;
  8849. return tileset.readyPromise.then(function() {
  8850. let inverseTransform = _self._getInverseTransform(tileset);
  8851. _self.polygon = _self._isDirRes(_self.polygon, false);
  8852. const clippingPlanes1 = [];
  8853. for (let i2 = 0; i2 < _self.polygon.length; i2++) {
  8854. if (i2 === _self.polygon.length - 1) {
  8855. clippingPlanes1.push(_self._createPlane(_self.polygon[i2], _self.polygon[0], inverseTransform));
  8856. } else {
  8857. clippingPlanes1.push(_self._createPlane(_self.polygon[i2], _self.polygon[i2 + 1], inverseTransform));
  8858. }
  8859. }
  8860. let clippingPlanes = new Cesium.ClippingPlaneCollection({
  8861. planes: clippingPlanes1,
  8862. edgeWidth: 1,
  8863. edgeColor: Cesium.Color.RED,
  8864. unionClippingRegions: false
  8865. });
  8866. _self.clippingPlanes = clippingPlanes;
  8867. tileset.clippingPlanes = clippingPlanes;
  8868. tileset.debugShowBoundingVolume = false;
  8869. let boundingSphere = tileset.boundingSphere;
  8870. let radius = boundingSphere.radius;
  8871. for (let i2 = 0; i2 < clippingPlanes.length; ++i2) {
  8872. let plane = clippingPlanes.get(i2);
  8873. viewer2.entities.add({
  8874. position: boundingSphere.center,
  8875. plane: {
  8876. dimensions: new Cesium.Cartesian2(
  8877. radius / 10,
  8878. radius / 10
  8879. ),
  8880. material: Cesium.Color.RED.withAlpha(0.1),
  8881. plane: new Cesium.CallbackProperty(
  8882. _self._createPlaneUpdateFunction(plane),
  8883. false
  8884. ),
  8885. outline: true,
  8886. outlineColor: Cesium.Color.RED
  8887. }
  8888. });
  8889. }
  8890. return tileset;
  8891. });
  8892. },
  8893. addTiles2(my3dtiles, pointsArray) {
  8894. let _self = this;
  8895. _self._viewer;
  8896. let tileset = my3dtiles;
  8897. _self.polygon = pointsArray;
  8898. _self.tileset = tileset;
  8899. Cesium.Matrix4.fromArray(
  8900. [
  8901. 1,
  8902. 5551115123125783e-31,
  8903. 5898416033378595e-24,
  8904. 0,
  8905. -6106226635438361e-31,
  8906. 1,
  8907. -11355608731111744e-24,
  8908. 0,
  8909. -5898416061134171e-24,
  8910. 11355608731111744e-24,
  8911. 0.9999999999999999,
  8912. 0,
  8913. 9.912469893228263,
  8914. -19.08345020748675,
  8915. -14.613607150502503,
  8916. 1
  8917. ]
  8918. );
  8919. let transform3 = Cesium.Matrix4.fromArray(
  8920. [
  8921. -0.8874246461620654,
  8922. -0.46095281470464317,
  8923. 0,
  8924. 0,
  8925. 0.2602796082288922,
  8926. -0.5010893346724129,
  8927. 0.8253266045740758,
  8928. 0,
  8929. -0.3804366214290463,
  8930. 0.7324151700322881,
  8931. 0.5646556435405804,
  8932. 0,
  8933. -2429070591483741e-9,
  8934. 467643767731705e-8,
  8935. 3581165448379543e-9,
  8936. 1
  8937. ]
  8938. );
  8939. let inverseTransform = Cesium.Matrix4.inverseTransformation(transform3, new Cesium.Matrix4());
  8940. let clippingPlanes1 = [];
  8941. for (let i2 = 0; i2 < _self.polygon.length - 1; i2++) {
  8942. let plane = _self.createPlane(_self.polygon[i2], _self.polygon[i2 + 1], inverseTransform);
  8943. clippingPlanes1.push(plane);
  8944. }
  8945. let clippingPlanes = new Cesium.ClippingPlaneCollection({
  8946. planes: clippingPlanes1,
  8947. edgeWidth: 1,
  8948. edgeColor: Cesium.Color.RED,
  8949. unionClippingRegions: false
  8950. });
  8951. _self.clippingPlanes = clippingPlanes;
  8952. return tileset.readyPromise.then(function() {
  8953. tileset.clippingPlanes = clippingPlanes;
  8954. tileset.debugShowBoundingVolume = false;
  8955. let boundingSphere = tileset.boundingSphere;
  8956. boundingSphere.radius;
  8957. return tileset;
  8958. });
  8959. },
  8960. toggleClipping() {
  8961. let _self = this;
  8962. _self.tileset = null;
  8963. }
  8964. });
  8965. class GeologyClipPlan {
  8966. constructor(viewer2) {
  8967. if (!viewer2)
  8968. throw new Cesium.DeveloperError("no viewer object!");
  8969. this._viewer = viewer2;
  8970. this._camera = this._viewer.camera;
  8971. this._scene = this._viewer.scene;
  8972. this.tileset = void 0;
  8973. this.targetY = 0;
  8974. this.planeEntities = [];
  8975. this._mouseHandler();
  8976. }
  8977. _mouseHandler() {
  8978. let _self = this;
  8979. let viewer2 = _self._viewer;
  8980. let scene = _self._scene;
  8981. let selectedPlane;
  8982. let downHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  8983. downHandler.setInputAction(function(movement) {
  8984. let pickedObject = scene.pick(movement.position);
  8985. if (Cesium.defined(pickedObject) && Cesium.defined(pickedObject.id) && Cesium.defined(pickedObject.id.plane)) {
  8986. selectedPlane = pickedObject.id.plane;
  8987. selectedPlane.material = Cesium.Color.RED.withAlpha(0.05);
  8988. selectedPlane.outlineColor = Cesium.Color.RED;
  8989. scene.screenSpaceCameraController.enableInputs = false;
  8990. }
  8991. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  8992. let upHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  8993. upHandler.setInputAction(function() {
  8994. if (Cesium.defined(selectedPlane)) {
  8995. selectedPlane.material = Cesium.Color.RED.withAlpha(0.1);
  8996. selectedPlane.outlineColor = Cesium.Color.RED;
  8997. selectedPlane = void 0;
  8998. }
  8999. scene.screenSpaceCameraController.enableInputs = true;
  9000. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  9001. let moveHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  9002. moveHandler.setInputAction(function(movement) {
  9003. if (Cesium.defined(selectedPlane)) {
  9004. let deltaY = movement.startPosition.y - movement.endPosition.y;
  9005. _self.targetY += deltaY;
  9006. }
  9007. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  9008. }
  9009. _createPlaneUpdateFunction(plane) {
  9010. let _self = this;
  9011. return function() {
  9012. plane.distance = _self.targetY;
  9013. return plane;
  9014. };
  9015. }
  9016. }
  9017. Object.assign(GeologyClipPlan.prototype, {
  9018. activate(tileset, options2) {
  9019. let _self = this;
  9020. let viewer2 = _self._viewer;
  9021. let distance2 = 1e5;
  9022. let clippingPlanes = new Cesium.ClippingPlaneCollection({
  9023. planes: [
  9024. new Cesium.ClippingPlane(
  9025. new Cesium.Cartesian3(0, 0, -1),
  9026. distance2
  9027. )
  9028. ],
  9029. edgeWidth: 1
  9030. });
  9031. _self.tileset = tileset;
  9032. tileset.clippingPlanes = clippingPlanes;
  9033. tileset.debugShowBoundingVolume = false;
  9034. return tileset.readyPromise.then(function() {
  9035. let boundingSphere = tileset.boundingSphere;
  9036. let radius = boundingSphere.radius;
  9037. if (!Cesium.Matrix4.equals(
  9038. tileset.root.transform,
  9039. Cesium.Matrix4.IDENTITY
  9040. )) {
  9041. const transformCenter = Cesium.Matrix4.getTranslation(
  9042. tileset.root.transform,
  9043. new Cesium.Cartesian3()
  9044. );
  9045. const transformCartographic = Cesium.Cartographic.fromCartesian(
  9046. transformCenter
  9047. );
  9048. const boundingSphereCartographic = Cesium.Cartographic.fromCartesian(
  9049. tileset.boundingSphere.center
  9050. );
  9051. const height2 = boundingSphereCartographic.height - transformCartographic.height;
  9052. clippingPlanes.modelMatrix = Cesium.Matrix4.fromTranslation(new Cesium.Cartesian3(0, 0, height2));
  9053. }
  9054. viewer2.zoomTo(
  9055. tileset,
  9056. new Cesium.HeadingPitchRange(0.5, -0.2, radius / 10)
  9057. );
  9058. let cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);
  9059. let lng = Cesium.Math.toDegrees(cartographic.longitude);
  9060. let lat = Cesium.Math.toDegrees(cartographic.latitude);
  9061. cartographic.height;
  9062. var Cartesian33 = Cesium.Cartesian3.fromDegrees(lng, lat, 105);
  9063. for (let i2 = 0; i2 < clippingPlanes.length; ++i2) {
  9064. let plane = clippingPlanes.get(i2);
  9065. let planeEntity = viewer2.entities.add({
  9066. position: Cartesian33,
  9067. plane: {
  9068. dimensions: new Cesium.Cartesian2(
  9069. radius / 10,
  9070. radius / 20
  9071. ),
  9072. material: Cesium.Color.RED.withAlpha(0.1),
  9073. plane: new Cesium.CallbackProperty(
  9074. _self._createPlaneUpdateFunction(plane),
  9075. false
  9076. ),
  9077. outline: true,
  9078. outlineColor: Cesium.Color.RED
  9079. }
  9080. });
  9081. _self.planeEntities.push(planeEntity);
  9082. }
  9083. return tileset;
  9084. });
  9085. },
  9086. toggleClipping() {
  9087. let _self = this;
  9088. for (let i2 = 0; i2 < _self.planeEntities.length; i2++) {
  9089. _self._viewer.entities.remove(_self.planeEntities[i2]);
  9090. }
  9091. _self.planeEntities = [];
  9092. _self.targetY = 0;
  9093. let boundingSphere = _self.tileset.boundingSphere;
  9094. _self._camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(Cesium.Math.toRadians(120), Cesium.Math.toRadians(-10), boundingSphere.radius * 2.5));
  9095. _self._camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
  9096. },
  9097. reset() {
  9098. this.planeEntities = [];
  9099. this.targetY = 0;
  9100. }
  9101. });
  9102. let SpatialAnalysis = {
  9103. SightLine,
  9104. ViewShed,
  9105. SunshineShadow,
  9106. Profile,
  9107. CutFill,
  9108. HeightLimit,
  9109. Cutting,
  9110. GeologyClipPlan
  9111. };
  9112. class TerrainExcavation {
  9113. constructor(viewer2) {
  9114. if (!viewer2)
  9115. throw new Error("no viewer object!");
  9116. this.viewer = viewer2;
  9117. }
  9118. prepareWell(activePoints) {
  9119. let pointLength = activePoints.length;
  9120. let heightDiff = this.excavateMinHeight - this.height;
  9121. let no_height_top = [], bottom_pos = [], lerp_pos = [];
  9122. for (let l = 0; l < pointLength; l++) {
  9123. let u = l == pointLength - 1 ? 0 : l + 1;
  9124. let point0 = [
  9125. Cesium.Cartographic.fromCartesian(activePoints[l]).longitude,
  9126. Cesium.Cartographic.fromCartesian(activePoints[l]).latitude
  9127. ];
  9128. let point1 = [
  9129. Cesium.Cartographic.fromCartesian(activePoints[u]).longitude,
  9130. Cesium.Cartographic.fromCartesian(activePoints[u]).latitude
  9131. ];
  9132. if (0 == l) {
  9133. lerp_pos.push(new Cesium.Cartographic(point0[0], point0[1]));
  9134. bottom_pos.push(
  9135. Cesium.Cartesian3.fromRadians(point0[0], point0[1], heightDiff)
  9136. );
  9137. no_height_top.push(
  9138. Cesium.Cartesian3.fromRadians(point0[0], point0[1], 0)
  9139. );
  9140. }
  9141. for (let p = 1; p <= this.splitNum; p++) {
  9142. let m = Cesium.Math.lerp(point0[0], point1[0], p / this.splitNum);
  9143. let g = Cesium.Math.lerp(point0[1], point1[1], p / this.splitNum);
  9144. l == pointLength - 1 && p == this.splitNum || (lerp_pos.push(new Cesium.Cartographic(m, g)), bottom_pos.push(Cesium.Cartesian3.fromRadians(m, g, heightDiff)), no_height_top.push(Cesium.Cartesian3.fromRadians(m, g, 0)));
  9145. }
  9146. }
  9147. this.wellData = {
  9148. lerp_pos,
  9149. bottom_pos,
  9150. no_height_top
  9151. };
  9152. }
  9153. createWell(wallData) {
  9154. let $this = this;
  9155. if (this.viewer.terrainProvider._layers) {
  9156. this.createBottomSurface(wallData.bottom_pos);
  9157. let positions = Cesium.sampleTerrainMostDetailed(
  9158. this.viewer.terrainProvider,
  9159. wallData.lerp_pos
  9160. );
  9161. positions.then(function(pos) {
  9162. let positionList = [];
  9163. for (let index2 = 0; index2 < pos.length; index2++) {
  9164. const element = pos[index2];
  9165. let curPos = Cesium.Cartesian3.fromRadians(
  9166. element.longitude,
  9167. element.latitude,
  9168. element.height
  9169. );
  9170. positionList.push(curPos);
  9171. }
  9172. $this.createWellWall(wallData.bottom_pos, positionList);
  9173. });
  9174. } else {
  9175. this.createBottomSurface(wallData.bottom_pos);
  9176. this.createWellWall(wallData.bottom_pos, wallData.no_height_top);
  9177. }
  9178. }
  9179. ellipsoidToDegree(pos) {
  9180. let cartesian3 = new Cesium.Cartesian3(pos.x, pos.y, pos.z);
  9181. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian3);
  9182. return {
  9183. longitude: Cesium.Math.toDegrees(cartographic.longitude),
  9184. latitude: Cesium.Math.toDegrees(cartographic.latitude),
  9185. altitude: cartographic.height
  9186. };
  9187. }
  9188. createBottomSurface(points2) {
  9189. if (points2.length) {
  9190. let minHeight = this.getMinHeight(points2);
  9191. let positions = [];
  9192. for (let i2 = 0; i2 < points2.length; i2++) {
  9193. let curPoint = this.ellipsoidToDegree(points2[i2]);
  9194. positions.push(curPoint.longitude, curPoint.latitude, minHeight);
  9195. }
  9196. let polygon2 = new Cesium.PolygonGeometry({
  9197. polygonHierarchy: new Cesium.PolygonHierarchy(
  9198. Cesium.Cartesian3.fromDegreesArrayHeights(positions)
  9199. ),
  9200. perPositionHeight: true
  9201. });
  9202. let material = new Cesium.Material({
  9203. fabric: {
  9204. type: "Image",
  9205. uniforms: {
  9206. image: this.bottomImg
  9207. }
  9208. }
  9209. });
  9210. let appearance = new Cesium.MaterialAppearance({
  9211. translucent: false,
  9212. flat: true,
  9213. material
  9214. });
  9215. this.bottomSurface = new Cesium.Primitive({
  9216. geometryInstances: new Cesium.GeometryInstance({
  9217. geometry: Cesium.PolygonGeometry.createGeometry(polygon2)
  9218. }),
  9219. appearance,
  9220. asynchronous: false
  9221. });
  9222. this.viewer.scene.primitives.add(this.bottomSurface);
  9223. }
  9224. }
  9225. createWellWall(bottomPos, positionList) {
  9226. let minHeight = this.getMinHeight(bottomPos);
  9227. let maxHeights = [], minHeights = [];
  9228. for (let i2 = 0; i2 < positionList.length; i2++) {
  9229. maxHeights.push(this.ellipsoidToDegree(positionList[i2]).altitude);
  9230. minHeights.push(minHeight);
  9231. }
  9232. let wall = new Cesium.WallGeometry({
  9233. positions: positionList,
  9234. maximumHeights: maxHeights,
  9235. minimumHeights: minHeights
  9236. });
  9237. let geometry2 = Cesium.WallGeometry.createGeometry(wall);
  9238. let material = new Cesium.Material({
  9239. fabric: {
  9240. type: "Image",
  9241. uniforms: {
  9242. image: this.wallImg
  9243. }
  9244. }
  9245. });
  9246. let appearance = new Cesium.MaterialAppearance({
  9247. translucent: false,
  9248. flat: true,
  9249. material
  9250. });
  9251. this.wellWall = new Cesium.Primitive({
  9252. geometryInstances: new Cesium.GeometryInstance({
  9253. geometry: geometry2,
  9254. attributes: {
  9255. color: Cesium.ColorGeometryInstanceAttribute.fromColor(
  9256. Cesium.Color.GREY
  9257. )
  9258. },
  9259. id: "PitWall"
  9260. }),
  9261. appearance,
  9262. asynchronous: false
  9263. });
  9264. this.viewer.scene.primitives.add(this.wellWall);
  9265. }
  9266. getMinHeight(points2) {
  9267. let minHeight = 5e6;
  9268. let minPoint = null;
  9269. for (let i2 = 0; i2 < points2.length; i2++) {
  9270. let height2 = points2[i2]["z"];
  9271. if (height2 < minHeight) {
  9272. minHeight = height2;
  9273. minPoint = this.ellipsoidToDegree(points2[i2]);
  9274. }
  9275. }
  9276. return minPoint.altitude;
  9277. }
  9278. switchExcavate(show) {
  9279. if (show) {
  9280. this.viewer.scene.globe.material = null;
  9281. this.wellWall.show = true;
  9282. this.bottomSurface.show = true;
  9283. } else {
  9284. this.viewer.scene.globe.material = null;
  9285. this.wellWall.show = false;
  9286. this.bottomSurface.show = false;
  9287. }
  9288. }
  9289. updateExcavateDepth(height2) {
  9290. this.viewer.scene.primitives.remove(this.bottomSurface);
  9291. this.viewer.scene.primitives.remove(this.wellWall);
  9292. console.log(this.wellData, this.excavateMinHeight);
  9293. let lerp_pos = this.wellData.lerp_pos;
  9294. let posList = [];
  9295. for (let n = 0; n < lerp_pos.length; n++) {
  9296. posList.push(
  9297. Cesium.Cartesian3.fromRadians(
  9298. lerp_pos[n].longitude,
  9299. lerp_pos[n].latitude,
  9300. this.excavateMinHeight - height2
  9301. )
  9302. );
  9303. }
  9304. this.wellData.bottom_pos = posList;
  9305. this.createWell(this.wellData);
  9306. }
  9307. }
  9308. Object.defineProperties(TerrainExcavation.prototype, {
  9309. show: {
  9310. get: function() {
  9311. return this._show;
  9312. },
  9313. set: function(e) {
  9314. this._show = e;
  9315. this.switchExcavate(e);
  9316. }
  9317. },
  9318. height: {
  9319. get: function() {
  9320. return this._height;
  9321. },
  9322. set: function(e) {
  9323. this._height = e;
  9324. this.updateExcavateDepth(e);
  9325. }
  9326. }
  9327. });
  9328. Object.assign(TerrainExcavation.prototype, {
  9329. add(activePoints, options2) {
  9330. options2 = options2 || {};
  9331. this._height = options2.excavateDepth || 10;
  9332. this.bottomImg = options2.bottomImg || "jt3dSDK/imgs/polygon/ground.png";
  9333. this.wallImg = options2.wallImg || "jt3dSDK/imgs/polygon/ground.png";
  9334. this.splitNum = Cesium.defaultValue(options2.splitNum, 50);
  9335. activePoints = activePoints.map((point2) => {
  9336. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  9337. });
  9338. let viewer2 = this.viewer;
  9339. this.clear();
  9340. let clippingPlanesList = [];
  9341. let car3Difference = Cesium.Cartesian3.subtract(
  9342. activePoints[0],
  9343. activePoints[1],
  9344. new Cesium.Cartesian3()
  9345. );
  9346. let boolDiff = car3Difference.x > 0;
  9347. this.excavateMinHeight = 999999999;
  9348. for (let index2 = 0; index2 < activePoints.length; ++index2) {
  9349. let s = (index2 + 1) % activePoints.length;
  9350. let curMidPoint = Cesium.Cartesian3.midpoint(
  9351. activePoints[index2],
  9352. activePoints[s],
  9353. new Cesium.Cartesian3()
  9354. );
  9355. let cartographic = Cesium.Cartographic.fromCartesian(activePoints[index2]);
  9356. let curHeight = viewer2.scene.globe.getHeight(cartographic) || cartographic.height;
  9357. console.log(curHeight);
  9358. if (curHeight < this.excavateMinHeight) {
  9359. this.excavateMinHeight = curHeight;
  9360. }
  9361. let curMidPointNormal = Cesium.Cartesian3.normalize(
  9362. curMidPoint,
  9363. new Cesium.Cartesian3()
  9364. );
  9365. let curMidPointDifference = boolDiff ? Cesium.Cartesian3.subtract(
  9366. activePoints[index2],
  9367. curMidPoint,
  9368. new Cesium.Cartesian3()
  9369. ) : Cesium.Cartesian3.subtract(
  9370. activePoints[s],
  9371. curMidPoint,
  9372. new Cesium.Cartesian3()
  9373. );
  9374. curMidPointDifference = Cesium.Cartesian3.normalize(
  9375. curMidPointDifference,
  9376. curMidPointDifference
  9377. );
  9378. let curMidPointCross = Cesium.Cartesian3.cross(
  9379. curMidPointDifference,
  9380. curMidPointNormal,
  9381. new Cesium.Cartesian3()
  9382. );
  9383. curMidPointCross = Cesium.Cartesian3.normalize(
  9384. curMidPointCross,
  9385. curMidPointCross
  9386. );
  9387. let plane = new Cesium.Plane(curMidPointCross, 0);
  9388. let distance2 = Cesium.Plane.getPointDistance(plane, curMidPoint);
  9389. clippingPlanesList.push(
  9390. new Cesium.ClippingPlane(curMidPointCross, distance2)
  9391. );
  9392. }
  9393. this.viewer.scene.globe.clippingPlanes = new Cesium.ClippingPlaneCollection({
  9394. planes: clippingPlanesList,
  9395. edgeWidth: 1,
  9396. edgeColor: Cesium.Color.WHITE,
  9397. enabled: true
  9398. });
  9399. this.prepareWell(activePoints);
  9400. this.createWell(this.wellData);
  9401. },
  9402. clear() {
  9403. if (this.viewer.scene.globe.clippingPlanes) {
  9404. this.viewer.scene.globe.clippingPlanes.removeAll();
  9405. this.viewer.scene.primitives.remove(this.bottomSurface);
  9406. this.viewer.scene.primitives.remove(this.wellWall);
  9407. this.viewer.scene.render();
  9408. }
  9409. }
  9410. });
  9411. class SlopeAspect {
  9412. constructor(viewer2) {
  9413. if (!viewer2)
  9414. throw new Cesium.DeveloperError("no viewer object!");
  9415. this._viewer = viewer2;
  9416. this.result = [];
  9417. this.handler = void 0;
  9418. this.toolTip = "";
  9419. }
  9420. _openTip() {
  9421. let _self = this;
  9422. this.handler = new Cesium.ScreenSpaceEventHandler(_self._viewer.canvas);
  9423. this.handler.setInputAction(function(movement) {
  9424. let endPos = movement.endPosition;
  9425. var pick = _self._viewer.scene.pick(endPos);
  9426. if (pick && pick.id && pick.id.type === "SlopeAspect") {
  9427. _self.toolTip = pick.id.value.toFixed(2);
  9428. CreateRemindertip(_self.toolTip, endPos, true);
  9429. } else {
  9430. _self.toolTip = "";
  9431. CreateRemindertip(_self.toolTip, endPos, false);
  9432. }
  9433. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  9434. }
  9435. _createEllipse(gridSquare) {
  9436. let _self = this;
  9437. let boxResults = [];
  9438. for (let index2 = 0; index2 < gridSquare.features.length; index2++) {
  9439. const feature2 = gridSquare.features[index2];
  9440. const coordinates = feature2.geometry.coordinates[0];
  9441. const centerdegree = [
  9442. (coordinates[0][0] + coordinates[2][0]) / 2,
  9443. (coordinates[0][1] + coordinates[2][1]) / 2
  9444. ];
  9445. let centerCartographic = Cesium.Cartographic.fromDegrees(
  9446. centerdegree[0],
  9447. centerdegree[1]
  9448. );
  9449. boxResults.push(centerCartographic);
  9450. for (let i2 = 0; i2 < coordinates.length; i2++) {
  9451. const coord = coordinates[i2];
  9452. let cartographic = Cesium.Cartographic.fromDegrees(coord[0], coord[1]);
  9453. boxResults.push(cartographic);
  9454. const coord1 = coordinates[i2 + 1];
  9455. if (coord1) {
  9456. let newCoord = [(coord[0] + coord1[0]) / 2, (coord[1] + coord1[1]) / 2];
  9457. let newCartographic = Cesium.Cartographic.fromDegrees(newCoord[0], newCoord[1]);
  9458. boxResults.push(newCartographic);
  9459. }
  9460. }
  9461. }
  9462. Cesium.sampleTerrainMostDetailed(
  9463. _self._viewer.scene.terrainProvider,
  9464. boxResults
  9465. ).then((updatePositions) => {
  9466. let arrr = [];
  9467. let ellipseResults = updatePositions.reduce(function(pre, item, index2, updatePositions2) {
  9468. var begin = index2 * 10;
  9469. var end = begin + 10;
  9470. var res = updatePositions2.slice(begin, end);
  9471. if (res.length != 0) {
  9472. arrr[index2] = res;
  9473. }
  9474. return arrr;
  9475. }, []);
  9476. _self._calculateSlope(ellipseResults);
  9477. _self._openTip();
  9478. });
  9479. }
  9480. _createPolygonInsrance(points2, color2) {
  9481. let positions = [];
  9482. for (let index2 = 1; index2 < points2.length - 1; index2++) {
  9483. const element = points2[index2];
  9484. positions.push(Cesium.Cartographic.toCartesian(element));
  9485. }
  9486. let polygon2 = new Cesium.PolygonGeometry({
  9487. polygonHierarchy: new Cesium.PolygonHierarchy(positions)
  9488. });
  9489. let polygonInstance = new Cesium.GeometryInstance({
  9490. geometry: polygon2,
  9491. attributes: {
  9492. color: Cesium.ColorGeometryInstanceAttribute.fromColor(
  9493. Cesium.Color.fromCssColorString(color2)
  9494. ),
  9495. show: new Cesium.ShowGeometryInstanceAttribute(true)
  9496. }
  9497. });
  9498. return polygonInstance;
  9499. }
  9500. _createArrowInstance(targetPoint, center2, diagonalPoint, heightDifference, curSlope) {
  9501. let cartographic_0 = new Cesium.Cartographic(
  9502. (targetPoint.longitude + center2.longitude) / 2,
  9503. (targetPoint.latitude + center2.latitude) / 2,
  9504. (targetPoint.height + center2.height) / 2
  9505. );
  9506. let cartographic_1 = new Cesium.Cartographic(
  9507. (diagonalPoint.longitude + center2.longitude) / 2,
  9508. (diagonalPoint.latitude + center2.latitude) / 2,
  9509. (diagonalPoint.height + center2.height) / 2
  9510. );
  9511. let positions1 = heightDifference > 0 ? [
  9512. Cesium.Cartographic.toCartesian(cartographic_0),
  9513. Cesium.Cartographic.toCartesian(cartographic_1)
  9514. ] : [
  9515. Cesium.Cartographic.toCartesian(cartographic_1),
  9516. Cesium.Cartographic.toCartesian(cartographic_0)
  9517. ];
  9518. const instance = new Cesium.GeometryInstance({
  9519. id: {
  9520. type: "SlopeAspect",
  9521. value: curSlope
  9522. },
  9523. geometry: new Cesium.GroundPolylineGeometry({
  9524. positions: positions1,
  9525. width: this.arrowWidth
  9526. }),
  9527. attributes: {
  9528. color: Cesium.ColorGeometryInstanceAttribute.fromColor(
  9529. Cesium.Color.BLUE.withAlpha(0.6)
  9530. ),
  9531. show: new Cesium.ShowGeometryInstanceAttribute(true)
  9532. }
  9533. });
  9534. return instance;
  9535. }
  9536. _calculateSlope(ellipseResults) {
  9537. let _self = this;
  9538. let instances = [];
  9539. let polygonInstance = [];
  9540. for (let index2 = 0; index2 < ellipseResults.length; index2++) {
  9541. const ellipse = ellipseResults[index2];
  9542. const center2 = ellipse[0];
  9543. let heightDifference = 0;
  9544. let maxIndex = 0;
  9545. for (let i2 = 1; i2 < ellipse.length - 1; i2++) {
  9546. const point2 = ellipse[i2];
  9547. let curHD = point2.height - center2.height;
  9548. if (Math.abs(curHD) > heightDifference) {
  9549. heightDifference = curHD;
  9550. maxIndex = i2;
  9551. }
  9552. }
  9553. let pos0 = new Cesium.Cartographic(center2.longitude, center2.latitude, 0);
  9554. let pos1 = new Cesium.Cartographic(
  9555. ellipse[maxIndex].longitude,
  9556. ellipse[maxIndex].latitude,
  9557. 0
  9558. );
  9559. let distance2 = Cesium.Cartesian3.distance(
  9560. Cesium.Cartographic.toCartesian(pos0),
  9561. Cesium.Cartographic.toCartesian(pos1)
  9562. );
  9563. let curSlope = Math.abs(heightDifference / distance2);
  9564. let curColor = _self._calculateSlopeColor(curSlope, 0.4);
  9565. const curPolygonInstance = _self._createPolygonInsrance(ellipse, curColor);
  9566. polygonInstance.push(curPolygonInstance);
  9567. let diagonalPoint = maxIndex > 4 ? ellipse[maxIndex - 4] : ellipse[maxIndex + 4];
  9568. let targetPoint = ellipse[maxIndex];
  9569. const arrowInstance = _self._createArrowInstance(targetPoint, center2, diagonalPoint, heightDifference, curSlope);
  9570. instances.push(arrowInstance);
  9571. }
  9572. const mapPrimitive = _self._viewer.scene.primitives.add(
  9573. new Cesium.GroundPrimitive({
  9574. geometryInstances: polygonInstance,
  9575. appearance: new Cesium.PerInstanceColorAppearance({
  9576. translucent: true,
  9577. closed: false
  9578. })
  9579. })
  9580. );
  9581. const arrowPrimitive = _self._viewer.scene.primitives.add(
  9582. new Cesium.GroundPolylinePrimitive({
  9583. geometryInstances: instances,
  9584. appearance: new Cesium.PolylineMaterialAppearance({
  9585. material: new Cesium.Material({
  9586. fabric: {
  9587. type: "PolylineArrow",
  9588. uniforms: {
  9589. color: new Cesium.Color(1, 1, 0, 0.8)
  9590. }
  9591. }
  9592. })
  9593. })
  9594. })
  9595. );
  9596. _self.result.push(arrowPrimitive, mapPrimitive);
  9597. }
  9598. _calculateSlopeColor(value, alpha) {
  9599. if (value < 0.00872686779075879) {
  9600. return "rgba(85,182,43," + alpha + ")";
  9601. } else if (value < 0.03492076949174773) {
  9602. return "rgba(135,211,43," + alpha + ")";
  9603. } else if (value < 0.08748866352592401) {
  9604. return "rgba(204,244,44," + alpha + ")";
  9605. } else if (value < 0.2679491924311227) {
  9606. return "rgba(245,233,44," + alpha + ")";
  9607. } else if (value < 0.7002075382097097) {
  9608. return "rgba(255,138,43," + alpha + ")";
  9609. } else if (value < 1.4281480067421144) {
  9610. return "rgba(255,84,43," + alpha + ")";
  9611. } else {
  9612. return "rgba(255,32,43," + alpha + ")";
  9613. }
  9614. }
  9615. }
  9616. Object.assign(SlopeAspect.prototype, {
  9617. createNew4Distance(points2, polygon$1, options2) {
  9618. let _self = this;
  9619. options2 = options2 || {};
  9620. options2.distance = options2.distance || 0.1;
  9621. let width2 = options2.distance * 200 > 35 ? 35 : options2.distance * 200;
  9622. _self.arrowWidth = width2 < 15 ? 15 : width2;
  9623. let positions = points2.map((point2) => {
  9624. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  9625. });
  9626. _self.clearAll();
  9627. let degrees = CoordTransform.Cartesian3ListToWGS84(positions);
  9628. let boundary = [];
  9629. let minX = 1e4, minY = 1e4, maxX = -1e4, maxY = -1e3;
  9630. for (let index2 = 0; index2 < degrees.length; index2++) {
  9631. const element = degrees[index2];
  9632. const x = element.lng;
  9633. const y = element.lat;
  9634. boundary.push([x, y]);
  9635. minX = x < minX ? x : minX;
  9636. minY = y < minY ? y : minY;
  9637. maxX = x > maxX ? x : maxX;
  9638. maxY = y > maxY ? y : maxY;
  9639. }
  9640. boundary.push(boundary[0]);
  9641. let bbox2 = [minX, minY, maxX, maxY];
  9642. polygon([boundary]);
  9643. let gridSquare = squareGrid(bbox2, options2.distance, {});
  9644. _self._createEllipse(gridSquare);
  9645. },
  9646. createNew4Num(points2, polygon$1, options2) {
  9647. let _self = this;
  9648. options2 = options2 || {};
  9649. options2.num = Cesium.defaultValue(options2.num, 10);
  9650. let positions = points2.map((point2) => {
  9651. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  9652. });
  9653. _self.clearAll();
  9654. let degrees = CoordTransform.Cartesian3ListToWGS84(positions);
  9655. let boundary = [];
  9656. let minX = 1e4, minY = 1e4, maxX = -1e4, maxY = -1e3;
  9657. for (let index2 = 0; index2 < degrees.length; index2++) {
  9658. const element = degrees[index2];
  9659. const x = element.lng;
  9660. const y = element.lat;
  9661. boundary.push([x, y]);
  9662. minX = x < minX ? x : minX;
  9663. minY = y < minY ? y : minY;
  9664. maxX = x > maxX ? x : maxX;
  9665. maxY = y > maxY ? y : maxY;
  9666. }
  9667. boundary.push(boundary[0]);
  9668. let bbox2 = [minX, minY, maxX, maxY];
  9669. let a = maxX - minX;
  9670. let b = maxY - minY;
  9671. b = b > a ? b : a;
  9672. const step = b / options2.num;
  9673. let width2 = step * 2e3 > 35 ? 35 : step * 2e3;
  9674. _self.arrowWidth = width2 < 15 ? 15 : width2;
  9675. polygon([boundary]);
  9676. let gridSquare = squareGrid(bbox2, step, {
  9677. units: "degrees"
  9678. });
  9679. _self._createEllipse(gridSquare);
  9680. },
  9681. clearAll() {
  9682. this.result.forEach((element) => {
  9683. this._viewer.scene.primitives.remove(element);
  9684. });
  9685. this.result = [];
  9686. if (this.handler) {
  9687. this.handler.destroy();
  9688. this.handler = void 0;
  9689. }
  9690. }
  9691. });
  9692. let TerrainAnalysis = {
  9693. TerrainExcavation,
  9694. SlopeAspect
  9695. };
  9696. class Weather {
  9697. constructor(viewer2) {
  9698. if (!viewer2)
  9699. throw new Cesium.DeveloperError("no viewer object!");
  9700. this._viewer = viewer2;
  9701. }
  9702. _initRain() {
  9703. this.rainStage = new Cesium.PostProcessStage({
  9704. name: "jt_rain",
  9705. fragmentShader: this._rain(),
  9706. uniforms: {
  9707. tiltAngle: () => {
  9708. return this.tiltAngle;
  9709. },
  9710. rainSize: () => {
  9711. return this.rainSize;
  9712. },
  9713. rainSpeed: () => {
  9714. return this.rainSpeed;
  9715. }
  9716. }
  9717. });
  9718. this._viewer.scene.postProcessStages.add(this.rainStage);
  9719. }
  9720. _initSnow() {
  9721. this.snowStage = new Cesium.PostProcessStage({
  9722. name: "jt_snow",
  9723. fragmentShader: this._snow(),
  9724. uniforms: {
  9725. snowSize: () => {
  9726. return this.snowSize;
  9727. },
  9728. snowSpeed: () => {
  9729. return this.snowSpeed;
  9730. }
  9731. }
  9732. });
  9733. this._viewer.scene.postProcessStages.add(this.snowStage);
  9734. }
  9735. _initFog() {
  9736. this.fogStage = new Cesium.PostProcessStage({
  9737. name: "jt_fog",
  9738. fragmentShader: this._fog(),
  9739. uniforms: {
  9740. visibility: () => {
  9741. return this.visibility;
  9742. },
  9743. fogColor: () => {
  9744. return this.color;
  9745. }
  9746. }
  9747. });
  9748. this._viewer.scene.postProcessStages.add(this.fogStage);
  9749. }
  9750. _rain() {
  9751. return "uniform sampler2D colorTexture;\n varying vec2 v_textureCoordinates;\n uniform float tiltAngle;\n uniform float rainSize;\n uniform float rainSpeed;\n float hash(float x) {\n return fract(sin(x * 133.3) * 13.13);\n }\n void main(void) {\n float time = czm_frameNumber / rainSpeed;\n vec2 resolution = czm_viewport.zw;\n vec2 uv = (gl_FragCoord.xy * 2. - resolution.xy) / min(resolution.x, resolution.y);\n vec3 c = vec3(.6, .7, .8);\n float a = tiltAngle;\n float si = sin(a), co = cos(a);\n uv *= mat2(co, -si, si, co);\n uv *= length(uv + vec2(0, 4.9)) * rainSize + 1.;\n float v = 1. - sin(hash(floor(uv.x * 100.)) * 2.);\n float b = clamp(abs(sin(20. * time * v + uv.y * (5. / (2. + v)))) - .95, 0., 1.) * 20.;\n c *= v * b;\n gl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), vec4(c, 1), .5);\n }\n ";
  9752. }
  9753. _snow() {
  9754. return "uniform sampler2D colorTexture;\n varying vec2 v_textureCoordinates;\n uniform float snowSpeed;\n uniform float snowSize;\n float snow(vec2 uv,float scale)\n {\n float time=czm_frameNumber/snowSpeed;\n float w=smoothstep(1.,0.,-uv.y*(scale/10.));if(w<.1)return 0.;\n uv+=time/scale;uv.y+=time*2./scale;uv.x+=sin(uv.y+time*.5)/scale;\n uv*=scale;vec2 s=floor(uv),f=fract(uv),p;float k=3.,d;\n p=.5+.35*sin(11.*fract(sin((s+p+scale)*mat2(7,3,6,5))*5.))-f;d=length(p);k=min(d,k);\n k=smoothstep(0.,k,sin(f.x+f.y)*snowSize);\n return k*w;\n }\n void main(void){\n vec2 resolution=czm_viewport.zw;\n vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);\n vec3 finalColor=vec3(0);\n //float c=smoothstep(1.,0.3,clamp(uv.y*.3+.8,0.,.75));\n float c=0.;\n c+=snow(uv,30.)*.0;\n c+=snow(uv,20.)*.0;\n c+=snow(uv,15.)*.0;\n c+=snow(uv,10.);\n c+=snow(uv,8.);\n c+=snow(uv,6.);\n c+=snow(uv,5.);\n finalColor=(vec3(c));\n gl_FragColor=mix(texture2D(colorTexture,v_textureCoordinates),vec4(finalColor,1),.5);\n }\n ";
  9755. }
  9756. _fog() {
  9757. return "uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n uniform float visibility;\n uniform vec4 fogColor;\n varying vec2 v_textureCoordinates; \n void main(void) \n { \n vec4 origcolor = texture2D(colorTexture, v_textureCoordinates); \n float depth = czm_readDepth(depthTexture, v_textureCoordinates); \n vec4 depthcolor = texture2D(depthTexture, v_textureCoordinates); \n float f = visibility * (depthcolor.r - 0.3) / 0.2; \n if (f < 0.0) f = 0.0; \n else if (f > 1.0) f = 1.0; \n gl_FragColor = mix(origcolor, fogColor, f); \n }\n";
  9758. }
  9759. _removeSnow() {
  9760. if (!this._viewer || !this.snowStage)
  9761. return;
  9762. this._viewer.scene.postProcessStages.remove(this.snowStage);
  9763. delete this.snowSize;
  9764. delete this.snowSpeed;
  9765. }
  9766. _removeRain() {
  9767. if (!this._viewer || !this.rainStage)
  9768. return;
  9769. this._viewer.scene.postProcessStages.remove(this.rainStage);
  9770. delete this.tiltAngle;
  9771. delete this.rainSize;
  9772. delete this.rainSpeed;
  9773. }
  9774. _removeFog() {
  9775. if (!this._viewer || !this.fogStage)
  9776. return;
  9777. this._viewer.scene.postProcessStages.remove(this.fogStage);
  9778. delete this.visibility;
  9779. delete this.color;
  9780. }
  9781. }
  9782. Object.assign(Weather.prototype, {
  9783. addRainEffect(options2) {
  9784. options2 = options2 || {};
  9785. this.tiltAngle = Cesium.defaultValue(options2.tiltAngle, -0.6);
  9786. this.rainSize = Cesium.defaultValue(options2.rainSize, 0.3);
  9787. this.rainSpeed = Cesium.defaultValue(options2.rainSpeed, 60);
  9788. this._initRain();
  9789. },
  9790. addSnowEffect(options2) {
  9791. options2 = options2 || {};
  9792. this.snowSize = Cesium.defaultValue(options2.snowSize, 0.02);
  9793. this.snowSpeed = Cesium.defaultValue(options2.snowSpeed, 60);
  9794. this._initSnow();
  9795. },
  9796. addFogEffect(options2) {
  9797. options2 = options2 || {};
  9798. this.visibility = Cesium.defaultValue(options2.visibility, 0.1);
  9799. this.color = Cesium.defaultValue(options2.color, new Cesium.Color(0.8, 0.8, 0.8, 0.5));
  9800. this._show = Cesium.defaultValue(options2.show, true);
  9801. this._initFog();
  9802. },
  9803. removeEffect() {
  9804. if (this.snowStage) {
  9805. this._removeSnow();
  9806. }
  9807. if (this.rainStage) {
  9808. this._removeRain();
  9809. }
  9810. if (this.fogStage) {
  9811. this._removeFog();
  9812. }
  9813. }
  9814. });
  9815. const BoxGeometry = Cesium.BoxGeometry;
  9816. const Cartesian3 = Cesium.Cartesian3;
  9817. const defaultValue = Cesium.defaultValue;
  9818. const defined = Cesium.defined;
  9819. const destroyObject = Cesium.destroyObject;
  9820. const DeveloperError$1 = Cesium.DeveloperError;
  9821. const GeometryPipeline = Cesium.GeometryPipeline;
  9822. const Matrix3 = Cesium.Matrix3;
  9823. const Matrix4 = Cesium.Matrix4;
  9824. const Transforms = Cesium.Transforms;
  9825. const VertexFormat = Cesium.VertexFormat;
  9826. const BufferUsage = Cesium.BufferUsage;
  9827. const CubeMap = Cesium.CubeMap;
  9828. const DrawCommand = Cesium.DrawCommand;
  9829. const loadCubeMap = Cesium.loadCubeMap;
  9830. const RenderState = Cesium.RenderState;
  9831. const VertexArray = Cesium.VertexArray;
  9832. const BlendingState = Cesium.BlendingState;
  9833. const SceneMode = Cesium.SceneMode;
  9834. const ShaderProgram = Cesium.ShaderProgram;
  9835. const ShaderSource = Cesium.ShaderSource;
  9836. const SkyBoxFS = "uniform samplerCube u_cubeMap;\n varying vec3 v_texCoord;\n void main()\n {\n vec4 color = textureCube(u_cubeMap, normalize(v_texCoord));\n gl_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n }\n ";
  9837. const SkyBoxVS = "attribute vec3 position;\n varying vec3 v_texCoord;\n uniform mat3 u_rotateMatrix;\n void main()\n {\n vec3 p = czm_viewRotation * u_rotateMatrix * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));\n gl_Position = czm_projection * vec4(p, 1.0);\n v_texCoord = position.xyz;\n }\n ";
  9838. if (!Cesium.defined(Cesium.Matrix4.getRotation)) {
  9839. Cesium.Matrix4.getRotation = Cesium.Matrix4.getMatrix3;
  9840. }
  9841. class SkyBoxOnGround {
  9842. constructor(options2) {
  9843. this.sources = options2.sources;
  9844. this._sources = void 0;
  9845. this.show = defaultValue(options2.show, true);
  9846. this._command = new DrawCommand({
  9847. modelMatrix: Matrix4.clone(Matrix4.IDENTITY),
  9848. owner: this
  9849. });
  9850. this._cubeMap = void 0;
  9851. this._attributeLocations = void 0;
  9852. this._useHdr = void 0;
  9853. }
  9854. }
  9855. const skyboxMatrix3 = new Matrix3();
  9856. SkyBoxOnGround.prototype.update = function(frameState, useHdr) {
  9857. const that = this;
  9858. if (!this.show) {
  9859. return void 0;
  9860. }
  9861. if (frameState.mode !== SceneMode.SCENE3D && frameState.mode !== SceneMode.MORPHING) {
  9862. return void 0;
  9863. }
  9864. if (!frameState.passes.render) {
  9865. return void 0;
  9866. }
  9867. const context = frameState.context;
  9868. if (this._sources !== this.sources) {
  9869. this._sources = this.sources;
  9870. const sources = this.sources;
  9871. if (!defined(sources.positiveX) || !defined(sources.negativeX) || !defined(sources.positiveY) || !defined(sources.negativeY) || !defined(sources.positiveZ) || !defined(sources.negativeZ)) {
  9872. throw new DeveloperError$1(
  9873. "this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties."
  9874. );
  9875. }
  9876. if (typeof sources.positiveX !== typeof sources.negativeX || typeof sources.positiveX !== typeof sources.positiveY || typeof sources.positiveX !== typeof sources.negativeY || typeof sources.positiveX !== typeof sources.positiveZ || typeof sources.positiveX !== typeof sources.negativeZ) {
  9877. throw new DeveloperError$1(
  9878. "this.sources properties must all be the same type."
  9879. );
  9880. }
  9881. if (typeof sources.positiveX === "string") {
  9882. loadCubeMap(context, this._sources).then(function(cubeMap) {
  9883. that._cubeMap = that._cubeMap && that._cubeMap.destroy();
  9884. that._cubeMap = cubeMap;
  9885. });
  9886. } else {
  9887. this._cubeMap = this._cubeMap && this._cubeMap.destroy();
  9888. this._cubeMap = new CubeMap({
  9889. context,
  9890. source: sources
  9891. });
  9892. }
  9893. }
  9894. const command = this._command;
  9895. command.modelMatrix = Transforms.eastNorthUpToFixedFrame(
  9896. frameState.camera._positionWC
  9897. );
  9898. if (!defined(command.vertexArray)) {
  9899. command.uniformMap = {
  9900. u_cubeMap: function() {
  9901. return that._cubeMap;
  9902. },
  9903. u_rotateMatrix: function() {
  9904. return Matrix4.getRotation(command.modelMatrix, skyboxMatrix3);
  9905. }
  9906. };
  9907. const geometry2 = BoxGeometry.createGeometry(
  9908. BoxGeometry.fromDimensions({
  9909. dimensions: new Cartesian3(2, 2, 2),
  9910. vertexFormat: VertexFormat.POSITION_ONLY
  9911. })
  9912. );
  9913. const attributeLocations = this._attributeLocations = GeometryPipeline.createAttributeLocations(
  9914. geometry2
  9915. );
  9916. command.vertexArray = VertexArray.fromGeometry({
  9917. context,
  9918. geometry: geometry2,
  9919. attributeLocations,
  9920. bufferUsage: BufferUsage._DRAW
  9921. });
  9922. command.renderState = RenderState.fromCache({
  9923. blending: BlendingState.ALPHA_BLEND
  9924. });
  9925. }
  9926. if (!defined(command.shaderProgram) || this._useHdr !== useHdr) {
  9927. const fs = new ShaderSource({
  9928. defines: [useHdr ? "HDR" : ""],
  9929. sources: [SkyBoxFS]
  9930. });
  9931. command.shaderProgram = ShaderProgram.fromCache({
  9932. context,
  9933. vertexShaderSource: SkyBoxVS,
  9934. fragmentShaderSource: fs,
  9935. attributeLocations: this._attributeLocations
  9936. });
  9937. this._useHdr = useHdr;
  9938. }
  9939. if (!defined(this._cubeMap)) {
  9940. return void 0;
  9941. }
  9942. return command;
  9943. };
  9944. SkyBoxOnGround.prototype.isDestroyed = function() {
  9945. return false;
  9946. };
  9947. SkyBoxOnGround.prototype.destroy = function() {
  9948. const command = this._command;
  9949. command.vertexArray = command.vertexArray && command.vertexArray.destroy();
  9950. command.shaderProgram = command.shaderProgram && command.shaderProgram.destroy();
  9951. this._cubeMap = this._cubeMap && this._cubeMap.destroy();
  9952. return destroyObject(this);
  9953. };
  9954. class SkyBox {
  9955. constructor(viewer2) {
  9956. if (!viewer2)
  9957. throw new Cesium.DeveloperError("no viewer object!");
  9958. this._viewer = viewer2;
  9959. this._farSkyBox = viewer2.scene.skyBox;
  9960. }
  9961. }
  9962. Object.assign(SkyBox.prototype, {
  9963. setGroundSkyBox(options2) {
  9964. options2 = options2 || {};
  9965. options2.height = options2.height || 2e5;
  9966. options2.type = options2.type || "\u84DD\u5929";
  9967. if (!options2.sources) {
  9968. switch (options2.type) {
  9969. case "\u665A\u971E":
  9970. options2.sources = {
  9971. positiveX: "jt3dSDK/imgs/skybox/01/px.png",
  9972. negativeX: "jt3dSDK/imgs/skybox/01/nx.png",
  9973. positiveY: "jt3dSDK/imgs/skybox/01/py.png",
  9974. negativeY: "jt3dSDK/imgs/skybox/01/ny.png",
  9975. positiveZ: "jt3dSDK/imgs/skybox/01/pz.png",
  9976. negativeZ: "jt3dSDK/imgs/skybox/01/nz.png"
  9977. };
  9978. break;
  9979. case "\u9634\u5929":
  9980. options2.sources = {
  9981. positiveX: "jt3dSDK/imgs/skybox/02/px.jpg",
  9982. negativeX: "jt3dSDK/imgs/skybox/02/nx.jpg",
  9983. positiveY: "jt3dSDK/imgs/skybox/02/py.jpg",
  9984. negativeY: "jt3dSDK/imgs/skybox/02/ny.jpg",
  9985. positiveZ: "jt3dSDK/imgs/skybox/02/pz.jpg",
  9986. negativeZ: "jt3dSDK/imgs/skybox/02/nz.jpg"
  9987. };
  9988. break;
  9989. case "\u84DD\u5929":
  9990. options2.sources = {
  9991. positiveX: "jt3dSDK/imgs/skybox/03/px.jpg",
  9992. negativeX: "jt3dSDK/imgs/skybox/03/nx.jpg",
  9993. positiveY: "jt3dSDK/imgs/skybox/03/py.jpg",
  9994. negativeY: "jt3dSDK/imgs/skybox/03/ny.jpg",
  9995. positiveZ: "jt3dSDK/imgs/skybox/03/pz.jpg",
  9996. negativeZ: "jt3dSDK/imgs/skybox/03/nz.jpg"
  9997. };
  9998. break;
  9999. case "\u7D2B\u8272\u661F\u7A7A":
  10000. options2.sources = {
  10001. positiveX: "jt3dSDK/imgs/skybox/04/px.jpg",
  10002. negativeX: "jt3dSDK/imgs/skybox/04/nx.jpg",
  10003. positiveY: "jt3dSDK/imgs/skybox/04/py.jpg",
  10004. negativeY: "jt3dSDK/imgs/skybox/04/ny.jpg",
  10005. positiveZ: "jt3dSDK/imgs/skybox/04/pz.jpg",
  10006. negativeZ: "jt3dSDK/imgs/skybox/04/nz.jpg"
  10007. };
  10008. break;
  10009. case "\u84DD\u8272\u661F\u7A7A":
  10010. options2.sources = {
  10011. positiveX: "jt3dSDK/imgs/skybox/05/px.jpg",
  10012. negativeX: "jt3dSDK/imgs/skybox/05/nx.jpg",
  10013. positiveY: "jt3dSDK/imgs/skybox/05/py.jpg",
  10014. negativeY: "jt3dSDK/imgs/skybox/05/ny.jpg",
  10015. positiveZ: "jt3dSDK/imgs/skybox/05/pz.jpg",
  10016. negativeZ: "jt3dSDK/imgs/skybox/05/nz.jpg"
  10017. };
  10018. break;
  10019. }
  10020. } else if (!Cesium.defined(options2.sources.positiveX) || !Cesium.defined(options2.sources.negativeX) || !Cesium.defined(options2.sources.positiveY) || !Cesium.defined(options2.sources.negativeY) || !Cesium.defined(options2.sources.positiveZ) || !Cesium.defined(options2.sources.negativeZ)) {
  10021. throw new Cesium.DeveloperError(
  10022. "options.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties."
  10023. );
  10024. }
  10025. let _self = this;
  10026. let groundSkyBox = new SkyBoxOnGround({
  10027. sources: options2.sources,
  10028. show: true
  10029. });
  10030. _self._viewer.scene.postRender.addEventListener(() => {
  10031. var e = _self._viewer.camera.position;
  10032. if (Cesium.Cartographic.fromCartesian(e).height < options2.height) {
  10033. _self._viewer.scene.skyBox = groundSkyBox;
  10034. } else {
  10035. _self._viewer.scene.skyBox = _self._defaultSkyBox;
  10036. }
  10037. });
  10038. }
  10039. });
  10040. class ParticleSystem {
  10041. constructor(viewer2) {
  10042. if (!viewer2)
  10043. throw new DeveloperError("no viewer object!");
  10044. this.viewer = viewer2;
  10045. }
  10046. }
  10047. Object.assign(ParticleSystem.prototype, {
  10048. createParticleFire: function(coordinates) {
  10049. this.viewer.clock.shouldAnimate = true;
  10050. var position2 = Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], coordinates[2] || 0);
  10051. var entity = this.viewer.entities.add({
  10052. position: position2
  10053. });
  10054. function computeModelMatrix(entity2, time) {
  10055. var position3 = Cesium.Property.getValueOrUndefined(entity2.position);
  10056. var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(position3);
  10057. return modelMatrix;
  10058. }
  10059. var viewModel = {
  10060. startScale: 3,
  10061. endScale: 1.5,
  10062. minimumParticleLife: 1.5,
  10063. maximumParticleLife: 1.8,
  10064. minimumSpeed: 7,
  10065. maximumSpeed: 9,
  10066. particleSize: 2,
  10067. emissionRate: 200
  10068. };
  10069. var primitive = this.viewer.scene.primitives.add(
  10070. new Cesium.ParticleSystem({
  10071. image: "jt3dSDK/imgs/particlesystem/fire.png",
  10072. imageSize: new Cesium.Cartesian2(viewModel.particleSize, viewModel.particleSize),
  10073. startColor: new Cesium.Color(1, 1, 1, 1),
  10074. endColor: new Cesium.Color(0.5, 0, 0, 0),
  10075. startScale: viewModel.startScale,
  10076. endScale: viewModel.endScale,
  10077. minimumParticleLife: viewModel.minimumParticleLife,
  10078. maximumParticleLife: viewModel.maximumParticleLife,
  10079. minimumSpeed: viewModel.minimumSpeed,
  10080. maximumSpeed: viewModel.maximumSpeed,
  10081. emissionRate: viewModel.emissionRate,
  10082. lifetime: 16,
  10083. loop: true,
  10084. sizeInMeters: true,
  10085. emitter: new Cesium.ConeEmitter(Cesium.Math.toRadians(45)),
  10086. modelMatrix: computeModelMatrix(entity, Cesium.JulianDate.now())
  10087. })
  10088. );
  10089. entity.remove = function() {
  10090. viewer.entities.remove(entity);
  10091. viewer.scene.primitives.remove(primitive);
  10092. };
  10093. return entity;
  10094. },
  10095. createParticleWater: function(coordinates) {
  10096. let viewer2 = this.viewer;
  10097. this.viewer.clock.shouldAnimate = true;
  10098. var position2 = Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], coordinates[2] || 0);
  10099. var entity = this.viewer.entities.add({
  10100. position: position2
  10101. });
  10102. function computeModelMatrix(entity2, time) {
  10103. return entity2.computeModelMatrix(time, new Cesium.Matrix4());
  10104. }
  10105. function computeEmitterModelMatrix() {
  10106. let hpr = Cesium.HeadingPitchRoll.fromDegrees(viewModel.heading, viewModel.pitch, viewModel.roll);
  10107. let trs = new Cesium.TranslationRotationScale();
  10108. trs.translation = Cesium.Cartesian3.fromElements(0, 0, 1);
  10109. trs.rotation = Cesium.Quaternion.fromHeadingPitchRoll(hpr);
  10110. let Matrix42 = Cesium.Matrix4.fromTranslationRotationScale(trs);
  10111. return Matrix42;
  10112. }
  10113. function updateCallback(p, dt2) {
  10114. var gravityScratch = new Cesium.Cartesian3();
  10115. var position3 = p.position;
  10116. Cesium.Cartesian3.normalize(position3, gravityScratch);
  10117. Cesium.Cartesian3.multiplyByScalar(gravityScratch, viewModel.gravity * dt2, gravityScratch);
  10118. p.velocity = Cesium.Cartesian3.add(p.velocity, gravityScratch, p.velocity);
  10119. }
  10120. function update(scene, time) {
  10121. waterParticleSystem.modelMatrix = computeModelMatrix(entity, time);
  10122. waterParticleSystem.emitterModelMatrix = computeEmitterModelMatrix();
  10123. }
  10124. viewer2.scene.preUpdate.addEventListener(update);
  10125. var viewModel = {
  10126. startScale: 1,
  10127. endScale: 7,
  10128. minimumParticleLife: 6,
  10129. maximumParticleLife: 7,
  10130. minimumSpeed: 9,
  10131. maximumSpeed: 9.5,
  10132. particleSize: 1,
  10133. emissionRate: 60,
  10134. gravity: -4,
  10135. heading: 110,
  10136. pitch: 30,
  10137. roll: 0
  10138. };
  10139. var waterParticleSystem = new Cesium.ParticleSystem({
  10140. image: "jt3dSDK/imgs/particlesystem/water.png",
  10141. imageSize: new Cesium.Cartesian2(viewModel.particleSize, viewModel.particleSize),
  10142. startColor: new Cesium.Color(1, 1, 1, 0.6),
  10143. endColor: new Cesium.Color(0.8, 0.86, 1, 0.4),
  10144. startScale: viewModel.startScale,
  10145. endScale: viewModel.endScale,
  10146. minimumParticleLife: viewModel.minimumParticleLife,
  10147. maximumParticleLife: viewModel.maximumParticleLife,
  10148. minimumSpeed: viewModel.minimumSpeed,
  10149. maximumSpeed: viewModel.maximumSpeed,
  10150. emissionRate: viewModel.emissionRate,
  10151. sizeInMeters: true,
  10152. emitter: new Cesium.CircleEmitter(0.2),
  10153. modelMatrix: computeModelMatrix(entity),
  10154. emitterModelMatrix: computeEmitterModelMatrix(),
  10155. updateCallback
  10156. });
  10157. viewer2.scene.primitives.add(waterParticleSystem);
  10158. entity.remove = function() {
  10159. viewer2.entities.remove(entity);
  10160. viewer2.scene.primitives.remove(waterParticleSystem);
  10161. };
  10162. return entity;
  10163. }
  10164. });
  10165. let SceneEffects = {
  10166. Weather,
  10167. SkyBox,
  10168. ParticleSystem
  10169. };
  10170. class ImageLayerSplit {
  10171. constructor(viewer2) {
  10172. if (!viewer2)
  10173. throw new Cesium.DeveloperError("no viewer object!");
  10174. this._viewer = viewer2;
  10175. }
  10176. }
  10177. Object.assign(ImageLayerSplit.prototype, {
  10178. initSplit() {
  10179. let _self = this;
  10180. this.viewer = this._viewer;
  10181. let sliderDiv = document.getElementById("image_slider");
  10182. if (sliderDiv == null) {
  10183. sliderDiv = document.createElement("div");
  10184. sliderDiv.id = "image_slider";
  10185. sliderDiv.style.position = "absolute";
  10186. sliderDiv.style.left = "50%";
  10187. sliderDiv.style.top = "0px";
  10188. sliderDiv.style.backgroundColor = "#d3d3d3";
  10189. sliderDiv.style.width = "5px";
  10190. sliderDiv.style.height = "100%";
  10191. sliderDiv.style.zIndex = "9999";
  10192. sliderDiv.onmouseover = function() {
  10193. this.style.cursor = "ew-resize";
  10194. };
  10195. document.body.appendChild(sliderDiv);
  10196. }
  10197. this.slider = sliderDiv;
  10198. viewer.scene.splitPosition = this.slider.offsetLeft / this.slider.parentElement.offsetWidth;
  10199. if (this.handler) {
  10200. this.handler.destroy();
  10201. this.handler = null;
  10202. }
  10203. this.handler = new Cesium.ScreenSpaceEventHandler(this.slider);
  10204. var moveActive = false;
  10205. function move(movement) {
  10206. if (!moveActive) {
  10207. return;
  10208. }
  10209. var relativeOffset = movement.endPosition.x;
  10210. var splitPosition = (_self.slider.offsetLeft + relativeOffset) / _self.slider.parentElement.offsetWidth;
  10211. _self.slider.style.left = `${100 * splitPosition}%`;
  10212. viewer.scene.splitPosition = splitPosition;
  10213. }
  10214. this.handler.setInputAction(function() {
  10215. moveActive = true;
  10216. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  10217. this.handler.setInputAction(function() {
  10218. moveActive = true;
  10219. }, Cesium.ScreenSpaceEventType.PINCH_START);
  10220. this.handler.setInputAction(move, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  10221. this.handler.setInputAction(move, Cesium.ScreenSpaceEventType.PINCH_MOVE);
  10222. this.handler.setInputAction(function() {
  10223. moveActive = false;
  10224. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  10225. this.handler.setInputAction(function() {
  10226. moveActive = false;
  10227. }, Cesium.ScreenSpaceEventType.PINCH_END);
  10228. },
  10229. addSplitLayer(earthAtLeft, earthAtRight) {
  10230. if (this.earthAtLeft) {
  10231. this._viewer.imageryLayers.remove(this.earthAtLeft);
  10232. }
  10233. if (this.earthAtRight) {
  10234. this._viewer.imageryLayers.remove(this.earthAtRight);
  10235. }
  10236. this.earthAtLeft = earthAtLeft;
  10237. this.earthAtRight = earthAtRight;
  10238. this.earthAtLeft.splitDirection = Cesium.SplitDirection.LEFT;
  10239. this.earthAtRight.splitDirection = Cesium.SplitDirection.RIGHT;
  10240. },
  10241. removeSplitLayer() {
  10242. document.body.removeChild(this.slider);
  10243. if (this.earthAtLeft) {
  10244. this._viewer.imageryLayers.remove(this.earthAtLeft);
  10245. }
  10246. if (this.earthAtRight) {
  10247. this._viewer.imageryLayers.remove(this.earthAtRight);
  10248. }
  10249. }
  10250. });
  10251. class ViewerSplitScreen {
  10252. constructor() {
  10253. }
  10254. }
  10255. Object.assign(ViewerSplitScreen.prototype, {
  10256. initHandler(viewer1, viewer2) {
  10257. var _self = this;
  10258. if (_self.handler1 && _self.handler1.getInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE)) {
  10259. return;
  10260. }
  10261. _self.handler1 = new Cesium.ScreenSpaceEventHandler(viewer1.scene.canvas);
  10262. _self.handler2 = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  10263. _self.handler1.setInputAction(function(movement) {
  10264. var _camerca = viewer1.camera;
  10265. viewer2.camera.setView({
  10266. destination: _camerca.position,
  10267. orientation: {
  10268. direction: _camerca._direction,
  10269. up: _camerca.up,
  10270. heading: _camerca.heading,
  10271. pitch: _camerca.pitch,
  10272. roll: _camerca.roll
  10273. }
  10274. });
  10275. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  10276. _self.handler1.setInputAction(function(movement) {
  10277. var _camerca = viewer1.camera;
  10278. viewer2.camera.setView({
  10279. destination: _camerca.position,
  10280. orientation: {
  10281. direction: _camerca._direction,
  10282. up: _camerca.up,
  10283. heading: _camerca.heading,
  10284. pitch: _camerca.pitch,
  10285. roll: _camerca.roll
  10286. }
  10287. });
  10288. }, Cesium.ScreenSpaceEventType.WHEEL);
  10289. _self.handler2.setInputAction(function(movement) {
  10290. var _camerca = viewer2.camera;
  10291. viewer1.camera.setView({
  10292. destination: _camerca.position,
  10293. orientation: {
  10294. direction: _camerca._direction,
  10295. up: _camerca.up,
  10296. heading: _camerca.heading,
  10297. pitch: _camerca.pitch,
  10298. roll: _camerca.roll
  10299. }
  10300. });
  10301. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  10302. _self.handler2.setInputAction(function(movement) {
  10303. var _camerca = viewer2.camera;
  10304. viewer1.camera.setView({
  10305. destination: _camerca.position,
  10306. orientation: {
  10307. direction: _camerca._direction,
  10308. up: _camerca.up,
  10309. heading: _camerca.heading,
  10310. pitch: _camerca.pitch,
  10311. roll: _camerca.roll
  10312. }
  10313. });
  10314. }, Cesium.ScreenSpaceEventType.WHEEL);
  10315. },
  10316. clearHandler() {
  10317. var _self = this;
  10318. if (_self.handler1) {
  10319. _self.handler1.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  10320. _self.handler1.removeInputAction(Cesium.ScreenSpaceEventType.WHEEL);
  10321. }
  10322. if (_self.handler2) {
  10323. _self.handler2.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  10324. _self.handler2.removeInputAction(Cesium.ScreenSpaceEventType.WHEEL);
  10325. }
  10326. }
  10327. });
  10328. let SceneControl = {
  10329. ImageLayerSplit,
  10330. ViewerSplitScreen
  10331. };
  10332. class TrackRoam {
  10333. constructor(viewer2) {
  10334. if (!viewer2)
  10335. throw new Cesium.DeveloperError("no viewer object!");
  10336. this._viewer = viewer2;
  10337. this._draw3DObj = null;
  10338. }
  10339. _startFly(pathsData, options2) {
  10340. var _self = this;
  10341. options2 = options2 || {};
  10342. options2.time = Cesium.defaultValue(options2.time, 360);
  10343. options2.isPathShow = Cesium.defaultValue(options2.isPathShow, true);
  10344. options2.height = Cesium.defaultValue(options2.height, 5);
  10345. options2.role = Cesium.defaultValue(options2.role, 1);
  10346. this.url = options2.modelUrl;
  10347. this.time = options2.time;
  10348. this.isPathShow = options2.isPathShow;
  10349. this.height = options2.height;
  10350. this.role = options2.role;
  10351. _self.clearFlyPaths();
  10352. _self._viewer.camera.setView({
  10353. destination: pathsData.position,
  10354. orientation: pathsData.orientation
  10355. });
  10356. setTimeout(function() {
  10357. executeFly3D();
  10358. }, 200);
  10359. function executeFly3D() {
  10360. if (pathsData && pathsData.geometry) {
  10361. var positionA = pathsData.geometry.coordinates;
  10362. let positions = positionA.map((point2) => {
  10363. return Cesium.Cartesian3.fromDegrees(point2.lng, point2.lat, point2.height);
  10364. });
  10365. let distance2 = [];
  10366. for (let i2 = 0; i2 < positions.length - 1; i2++) {
  10367. let dis = Cesium.Cartesian3.distance(positions[i2], positions[i2 + 1]);
  10368. distance2.push(dis);
  10369. }
  10370. let times = [Cesium.JulianDate.fromDate(new Date())];
  10371. times.push(Cesium.JulianDate.addSeconds(times[0], _self.time, new Cesium.JulianDate()));
  10372. for (let i2 = 1; i2 < positions.length - 1; i2++) {
  10373. let s = Cesium.JulianDate.addSeconds(times[i2], _self.time * (distance2[i2] / distance2[0]), new Cesium.JulianDate());
  10374. times.push(s);
  10375. }
  10376. let oriSamples = new Cesium.SampledProperty(Cesium.Cartesian3);
  10377. oriSamples.addSamples(times, positions);
  10378. let startTime = times[0];
  10379. let stopTime = times[times.length - 1];
  10380. _self._viewer.clock.startTime = startTime.clone();
  10381. _self._viewer.clock.stopTime = stopTime.clone();
  10382. _self._viewer.clock.currentTime = startTime.clone();
  10383. _self._viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP;
  10384. _self._viewer.clock.multiplier = 10;
  10385. let timeOfResolution = 6;
  10386. let samplesNum = Math.floor(
  10387. Cesium.JulianDate.secondsDifference(stopTime, startTime) / timeOfResolution
  10388. );
  10389. let sampledPositions = [];
  10390. let sampledTimes = [];
  10391. for (let i2 = 0; i2 < samplesNum + 1; i2++) {
  10392. let sampleTime = Cesium.JulianDate.addSeconds(
  10393. startTime,
  10394. i2 * timeOfResolution,
  10395. new Cesium.JulianDate()
  10396. );
  10397. let tmpPos = oriSamples.getValue(sampleTime);
  10398. sampledPositions.push(Cesium.Cartographic.fromCartesian(tmpPos));
  10399. sampledTimes.push(sampleTime);
  10400. }
  10401. Cesium.sampleTerrainMostDetailed(
  10402. _self._viewer.terrainProvider,
  10403. sampledPositions
  10404. ).then(() => {
  10405. let carPositionProperty = new Cesium.SampledPositionProperty();
  10406. for (let i2 = 0; i2 < sampledPositions.length; i2++) {
  10407. sampledPositions[i2].height = sampledPositions[i2].height + _self.height;
  10408. }
  10409. for (let i2 = 0; i2 < samplesNum + 1; i2++) {
  10410. carPositionProperty.addSample(
  10411. sampledTimes[i2],
  10412. Cesium.Ellipsoid.WGS84.cartographicToCartesian(sampledPositions[i2])
  10413. );
  10414. }
  10415. var position2 = carPositionProperty;
  10416. _self.entityFly = _self._viewer.entities.add({
  10417. availability: new Cesium.TimeIntervalCollection([
  10418. new Cesium.TimeInterval({
  10419. start: startTime,
  10420. stop: stopTime
  10421. })
  10422. ]),
  10423. position: position2,
  10424. orientation: new Cesium.VelocityOrientationProperty(position2),
  10425. point: {
  10426. color: Cesium.Color.RED,
  10427. outlineColor: Cesium.Color.WHITE,
  10428. outlineWidth: 2,
  10429. pixelSize: 10
  10430. },
  10431. path: {
  10432. show: _self.isPathShow,
  10433. resolution: 1,
  10434. material: new Cesium.PolylineGlowMaterialProperty({
  10435. glowPower: 0.1,
  10436. color: Cesium.Color.YELLOW
  10437. }),
  10438. width: 10
  10439. }
  10440. });
  10441. if (_self.role == 0)
  10442. ;
  10443. else if (_self.role == 1) {
  10444. _self._viewer.trackedEntity = _self.entityFly;
  10445. } else if (_self.role == 2) {
  10446. _self._viewer.trackedEntity = _self.entityFly;
  10447. let exection = function TimeExecution() {
  10448. if (_self._viewer.clock.shouldAnimate === true) {
  10449. let center2 = _self.entity.position.getValue(
  10450. _self._viewer.clock.currentTime
  10451. );
  10452. let orientation = _self.entity.orientation.getValue(
  10453. _self._viewer.clock.currentTime
  10454. );
  10455. let transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(center2);
  10456. transform3 = Cesium.Matrix4.fromRotationTranslation(Cesium.Matrix3.fromQuaternion(orientation), center2);
  10457. _self._viewer.camera.lookAtTransform(transform3, new Cesium.Cartesian3(-50, 0, 250));
  10458. }
  10459. };
  10460. _self._viewer.clock.onTick.addEventListener(exection);
  10461. } else if (_self.role == 3) {
  10462. _self._viewer.trackedEntity = _self.entityFly;
  10463. let exection = function TimeExecution() {
  10464. if (_self._viewer.clock.shouldAnimate === true) {
  10465. let center2 = _self.entity.position.getValue(
  10466. _self._viewer.clock.currentTime
  10467. );
  10468. _self._viewer.camera.lookAt(center2, new Cesium.Cartesian3(0, 0, 1e3));
  10469. }
  10470. };
  10471. _self._viewer.clock.onTick.addEventListener(exection);
  10472. }
  10473. });
  10474. } else {
  10475. return;
  10476. }
  10477. }
  10478. }
  10479. }
  10480. Object.assign(TrackRoam.prototype, {
  10481. drawFlyPaths(coordinates, options2) {
  10482. return new Promise((resolve2, reject2) => {
  10483. let _self = this;
  10484. _self.clearFlyPaths();
  10485. let position2 = _self._viewer.camera.position;
  10486. let heading = _self._viewer.camera.heading;
  10487. let pitch = _self._viewer.camera.pitch;
  10488. let roll = _self._viewer.camera.roll;
  10489. var pathsData = {
  10490. "orientation": {
  10491. "heading": heading,
  10492. "pitch": pitch,
  10493. "roll": roll
  10494. },
  10495. "position": position2,
  10496. "clampToGround": true,
  10497. "geometry": {
  10498. "type": "LineString",
  10499. "coordinates": coordinates
  10500. }
  10501. };
  10502. _self._draw3DObj = pathsData;
  10503. resolve2(true);
  10504. });
  10505. },
  10506. clearFlyPaths() {
  10507. this._draw3DObj = null;
  10508. this._viewer.trackedEntity = void 0;
  10509. this._viewer.entities.remove(this.entityFly);
  10510. },
  10511. startFly(options2, callError) {
  10512. if (this._draw3DObj) {
  10513. this._startFly(this._draw3DObj, options2);
  10514. } else {
  10515. if (callError)
  10516. callError("\u6F2B\u6E38\u8DEF\u7EBF\u4E0D\u5B58\u5728");
  10517. }
  10518. },
  10519. pauseFly() {
  10520. var clockViewModel = this._viewer.clockViewModel;
  10521. if (clockViewModel.shouldAnimate) {
  10522. clockViewModel.shouldAnimate = false;
  10523. } else if (this._viewer.clockViewModel.canAnimate) {
  10524. clockViewModel.shouldAnimate = true;
  10525. }
  10526. },
  10527. forwardFly() {
  10528. var clockViewModel = this._viewer.clockViewModel;
  10529. var multiplier = clockViewModel.multiplier;
  10530. if (multiplier < 0) {
  10531. clockViewModel.multiplier = -multiplier;
  10532. }
  10533. clockViewModel.shouldAnimate = true;
  10534. },
  10535. backwardsFly() {
  10536. var clockViewModel = this._viewer.clockViewModel;
  10537. var multiplier = clockViewModel.multiplier;
  10538. if (multiplier > 0) {
  10539. clockViewModel.multiplier = -multiplier;
  10540. }
  10541. clockViewModel.shouldAnimate = true;
  10542. },
  10543. outFly() {
  10544. var start2 = Cesium.JulianDate.fromDate(new Date());
  10545. this._viewer.clock.startTime = start2.clone();
  10546. var stop = Cesium.JulianDate.addSeconds(start2, 3e8, new Cesium.JulianDate());
  10547. this._viewer.clock.stopTime = stop.clone();
  10548. this.clearFlyPaths();
  10549. }
  10550. });
  10551. class Roaming {
  10552. constructor(viewer2, positions, options2) {
  10553. if (!viewer2)
  10554. throw new Cesium.DeveloperError("no viewer object!");
  10555. if (!positions)
  10556. throw new Cesium.DeveloperError("no positions Array!");
  10557. this.viewer = viewer2;
  10558. this.entity = void 0;
  10559. options2 = options2 || {};
  10560. options2.time = Cesium.defaultValue(options2.time, 360);
  10561. options2.speed = Cesium.defaultValue(options2.speed, 10);
  10562. options2.isPathShow = Cesium.defaultValue(options2.isPathShow, true);
  10563. options2.height = Cesium.defaultValue(options2.height, 5);
  10564. options2.role = Cesium.defaultValue(options2.role, 1);
  10565. options2.followedX = Cesium.defaultValue(options2.followedX, 50);
  10566. options2.followedZ = Cesium.defaultValue(options2.followedZ, 10);
  10567. this.time = options2.time;
  10568. this.speed = options2.speed;
  10569. this.isPathShow = options2.isPathShow;
  10570. this.height = options2.height;
  10571. this.role = options2.role;
  10572. this.followedX = options2.followedX;
  10573. this.followedZ = options2.followedZ;
  10574. this.model = options2.model;
  10575. this.billboard = options2.billboard;
  10576. this.point = options2.point;
  10577. this.label = options2.label;
  10578. this.property = this.ComputeRoamingLineProperty(positions, this.time);
  10579. }
  10580. ComputeRoamingLineProperty(Lines, time) {
  10581. let positions = [];
  10582. if (Lines[0] instanceof Cesium.Cartesian3) {
  10583. positions = Lines;
  10584. } else {
  10585. positions = Lines.map((point2) => {
  10586. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  10587. });
  10588. }
  10589. let distance2 = [];
  10590. for (let i2 = 0; i2 < positions.length - 1; i2++) {
  10591. let dis = Cesium.Cartesian3.distance(positions[i2], positions[i2 + 1]);
  10592. distance2.push(dis);
  10593. }
  10594. let times = [Cesium.JulianDate.fromDate(new Date())];
  10595. times.push(Cesium.JulianDate.addSeconds(times[0], time, new Cesium.JulianDate()));
  10596. for (let i2 = 1; i2 < positions.length - 1; i2++) {
  10597. let s = Cesium.JulianDate.addSeconds(times[i2], time * (distance2[i2] / distance2[0]), new Cesium.JulianDate());
  10598. times.push(s);
  10599. }
  10600. let oriSamples = new Cesium.SampledProperty(Cesium.Cartesian3);
  10601. oriSamples.addSamples(times, positions);
  10602. let startTime = times[0];
  10603. let stopTime = times[times.length - 1];
  10604. this.viewer.clock.startTime = startTime.clone();
  10605. this.viewer.clock.stopTime = stopTime.clone();
  10606. this.viewer.clock.currentTime = startTime.clone();
  10607. this.viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP;
  10608. this.viewer.clock.multiplier = this.speed;
  10609. let timeOfResolution = 6;
  10610. let samplesNum = Math.floor(
  10611. Cesium.JulianDate.secondsDifference(stopTime, startTime) / timeOfResolution
  10612. );
  10613. let sampledPositions = [];
  10614. let sampledTimes = [];
  10615. for (let i2 = 0; i2 < samplesNum + 1; i2++) {
  10616. let sampleTime = Cesium.JulianDate.addSeconds(
  10617. startTime,
  10618. i2 * timeOfResolution,
  10619. new Cesium.JulianDate()
  10620. );
  10621. let tmpPos = oriSamples.getValue(sampleTime);
  10622. sampledPositions.push(Cesium.Cartographic.fromCartesian(tmpPos));
  10623. sampledTimes.push(sampleTime);
  10624. }
  10625. Cesium.sampleTerrainMostDetailed(
  10626. this.viewer.terrainProvider,
  10627. sampledPositions
  10628. ).then((updatedPositions) => {
  10629. let carPositionProperty = new Cesium.SampledPositionProperty();
  10630. for (let i2 = 0; i2 < sampledPositions.length; i2++) {
  10631. sampledPositions[i2].height = sampledPositions[i2].height + this.height;
  10632. }
  10633. for (let i2 = 0; i2 < samplesNum + 1; i2++) {
  10634. carPositionProperty.addSample(
  10635. sampledTimes[i2],
  10636. Cesium.Ellipsoid.WGS84.cartographicToCartesian(sampledPositions[i2])
  10637. );
  10638. }
  10639. var position2 = carPositionProperty;
  10640. this.InitRoaming(position2, startTime, stopTime, this.isPathShow);
  10641. });
  10642. }
  10643. InitRoaming(position2, start2, stop, isPathShow) {
  10644. this.entity = this.viewer.entities.add({
  10645. availability: new Cesium.TimeIntervalCollection([new Cesium.TimeInterval({
  10646. start: start2,
  10647. stop
  10648. })]),
  10649. position: position2,
  10650. orientation: new Cesium.VelocityOrientationProperty(position2),
  10651. path: {
  10652. resolution: 1,
  10653. material: new Cesium.PolylineGlowMaterialProperty({
  10654. glowPower: 0.1,
  10655. color: Cesium.Color.YELLOW
  10656. }),
  10657. width: 10,
  10658. show: isPathShow
  10659. }
  10660. });
  10661. if (this.model) {
  10662. let model = this.model;
  10663. this.entity.model = {
  10664. uri: model.url,
  10665. minimumPixelSize: 64,
  10666. maximumSize: 128,
  10667. maximumScale: 200,
  10668. show: true,
  10669. silhouetteColor: Cesium.Color.WHITE,
  10670. debugWireframe: false,
  10671. debugShowBoundingVolume: false,
  10672. scale: 20,
  10673. runAnimations: true
  10674. };
  10675. } else if (this.billboard) {
  10676. let billboard = this.billboard;
  10677. billboard.imgUrl = Cesium.defaultValue(billboard.imgUrl, "jt3dSDK/imgs/point/point3.png");
  10678. this.entity.billboard = {
  10679. image: billboard.imgUrl,
  10680. show: true,
  10681. width: 30,
  10682. scale: 1,
  10683. height: 30,
  10684. pixelOffset: new Cesium.Cartesian2(0, -14)
  10685. };
  10686. } else {
  10687. let point2 = {};
  10688. if (this.point) {
  10689. point2 = this.point;
  10690. }
  10691. point2.pixelSize = Cesium.defaultValue(point2.pixelSize, 10);
  10692. if (point2.color) {
  10693. if (point2.color instanceof Array) {
  10694. point2.color = new Cesium.Color(point2.color[0] / 255, point2.color[1] / 255, point2.color[2] / 255, point2.color[3]);
  10695. } else if (typeof point2.color === "string") {
  10696. point2.color = new Cesium.Color.fromCssColorString(point2.color);
  10697. } else {
  10698. point2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  10699. }
  10700. }
  10701. if (point2.outlineColor) {
  10702. if (point2.outlineColor instanceof Array) {
  10703. point2.outlineColor = new Cesium.Color(point2.outlineColor[0] / 255, point2.outlineColor[1] / 255, point2.outlineColor[2] / 255, point2.outlineColor[3]);
  10704. } else if (typeof point2.outlineColor === "string") {
  10705. point2.outlineColor = new Cesium.Color.fromCssColorString(point2.outlineColor);
  10706. } else {
  10707. point2.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  10708. }
  10709. }
  10710. point2.outlineWidth = Cesium.defaultValue(point2.outlineWidth, 2);
  10711. this.entity.point = point2;
  10712. }
  10713. if (this.label) {
  10714. let label2 = this.label;
  10715. label2.text = Cesium.defaultValue(label2.text, "");
  10716. label2.font = Cesium.defaultValue(label2.font, "24px Helvetica");
  10717. if (label2.fillColor) {
  10718. if (label2.fillColor instanceof Array) {
  10719. label2.fillColor = new Cesium.Color(label2.fillColor[0] / 255, label2.fillColor[1] / 255, label2.fillColor[2] / 255, label2.fillColor[3]);
  10720. } else if (typeof label2.fillColor === "string") {
  10721. label2.fillColor = new Cesium.Color.fromCssColorString(label2.fillColor);
  10722. } else {
  10723. label2.fillColor = new Cesium.Color.fromCssColorString("#FFFF00");
  10724. }
  10725. }
  10726. if (label2.outlineColor) {
  10727. if (label2.outlineColor instanceof Array) {
  10728. label2.outlineColor = new Cesium.Color(label2.outlineColor[0] / 255, label2.outlineColor[1] / 255, label2.outlineColor[2] / 255, label2.outlineColor[3]);
  10729. } else if (typeof label2.outlineColor === "string") {
  10730. label2.outlineColor = new Cesium.Color.fromCssColorString(label2.outlineColor);
  10731. } else {
  10732. label2.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  10733. }
  10734. }
  10735. label2.outlineWidth = Cesium.defaultValue(label2.outlineWidth, 1);
  10736. label2.showBackground = Cesium.defaultValue(label2.showBackground, false);
  10737. if (label2.backgroundColor) {
  10738. if (label2.backgroundColor instanceof Array) {
  10739. label2.backgroundColor = new Cesium.Color(label2.backgroundColor[0] / 255, label2.backgroundColor[1] / 255, label2.backgroundColor[2] / 255, label2.backgroundColor[3]);
  10740. } else if (typeof label2.backgroundColor === "string") {
  10741. label2.backgroundColor = new Cesium.Color.fromCssColorString(label2.backgroundColor);
  10742. } else {
  10743. label2.backgroundColor = new Cesium.Color.fromCssColorString("#FFFF00");
  10744. }
  10745. }
  10746. label2.pixelOffset = Cesium.defaultValue(label2.pixelOffset, 0);
  10747. label2.scale = Cesium.defaultValue(label2.scale, 1);
  10748. label2.near = Cesium.defaultValue(label2.near, 150);
  10749. label2.nearValue = Cesium.defaultValue(label2.nearValue, 1);
  10750. label2.far = Cesium.defaultValue(label2.far, 2400);
  10751. label2.farValue = Cesium.defaultValue(label2.farValue, 0);
  10752. this.entity.label = {
  10753. text: label2.text,
  10754. font: label2.font,
  10755. fillColor: label2.fillColor,
  10756. outlineColor: label2.outlineColor,
  10757. outlineWidth: label2.outlineWidth,
  10758. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  10759. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  10760. showBackground: label2.showBackground,
  10761. backgroundColor: label2.backgroundColor,
  10762. backgroundPadding: new Cesium.Cartesian2(6, 6),
  10763. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  10764. pixelOffset: new Cesium.Cartesian2(0, label2.pixelOffset),
  10765. scale: label2.scale
  10766. };
  10767. }
  10768. this.entity.position.setInterpolationOptions({
  10769. interpolationDegree: 5,
  10770. interpolationAlgorithm: Cesium.LagrangePolynomialApproximation
  10771. });
  10772. this.initRole(this.role);
  10773. }
  10774. initRole(role) {
  10775. let _self = this;
  10776. if (role == 0) {
  10777. this.viewer.trackedEntity = void 0;
  10778. let len = _self.viewer.clock.onTick.numberOfListeners;
  10779. for (let i2 = 0; i2 < len; i2++) {
  10780. _self.viewer.clock.onTick.removeEventListener(_self.viewer.clock.onTick._listeners[i2]);
  10781. }
  10782. } else if (role == 1) {
  10783. this.viewer.trackedEntity = this.entity;
  10784. let len = _self.viewer.clock.onTick.numberOfListeners;
  10785. for (let i2 = 0; i2 < len; i2++) {
  10786. _self.viewer.clock.onTick.removeEventListener(_self.viewer.clock.onTick._listeners[i2]);
  10787. }
  10788. } else if (role == 2) {
  10789. this.viewer.trackedEntity = this.entity;
  10790. let exection = function TimeExecution() {
  10791. if (_self.viewer.clock.shouldAnimate === true) {
  10792. let center2 = _self.entity.position.getValue(
  10793. _self.viewer.clock.currentTime
  10794. );
  10795. let orientation = _self.entity.orientation.getValue(
  10796. _self.viewer.clock.currentTime
  10797. );
  10798. let transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(center2);
  10799. transform3 = Cesium.Matrix4.fromRotationTranslation(Cesium.Matrix3.fromQuaternion(orientation), center2);
  10800. var transformX = _self.followedX || 50;
  10801. var transformZ = _self.followedZ || 10;
  10802. _self.viewer.camera.lookAtTransform(transform3, new Cesium.Cartesian3(transformX, 0, transformZ));
  10803. }
  10804. };
  10805. this.viewer.clock.onTick.addEventListener(exection);
  10806. } else if (role == 3) {
  10807. this.viewer.trackedEntity = this.entity;
  10808. let exection = function TimeExecution() {
  10809. if (_self.viewer.clock.shouldAnimate === true) {
  10810. let center2 = _self.entity.position.getValue(
  10811. _self.viewer.clock.currentTime
  10812. );
  10813. _self.viewer.camera.lookAt(center2, new Cesium.Cartesian3(0, 0, 1e3));
  10814. }
  10815. };
  10816. this.viewer.clock.onTick.addEventListener(exection);
  10817. }
  10818. }
  10819. PauseOrContinue(state) {
  10820. this.viewer.clock.shouldAnimate = state;
  10821. }
  10822. forwardFly() {
  10823. var multiplier = this.viewer.clock.multiplier;
  10824. if (multiplier < 0) {
  10825. this.viewer.clock.multiplier = -multiplier;
  10826. }
  10827. this.viewer.clock.shouldAnimate = true;
  10828. }
  10829. backwardsFly() {
  10830. var multiplier = this.viewer.clock.multiplier;
  10831. if (multiplier > 0) {
  10832. this.viewer.clock.multiplier = -multiplier;
  10833. }
  10834. this.viewer.clock.shouldAnimate = true;
  10835. }
  10836. ChangeRoamingSpeed(value) {
  10837. this.viewer.clock.multiplier = value;
  10838. }
  10839. EndRoaming() {
  10840. if (this.entity !== void 0) {
  10841. this.viewer.entities.remove(this.entity);
  10842. }
  10843. this.viewer.trackedEntity = void 0;
  10844. this.viewer.clock.shouldAnimate = false;
  10845. let len = this.viewer.clock.onTick.numberOfListeners;
  10846. for (let i2 = 0; i2 < len; i2++) {
  10847. this.viewer.clock.onTick.removeEventListener(this.viewer.clock.onTick._listeners[i2]);
  10848. }
  10849. }
  10850. }
  10851. class PolygonObject {
  10852. constructor(viewer2) {
  10853. if (!viewer2)
  10854. throw new Cesium.DeveloperError("no viewer object!");
  10855. this._viewer = viewer2;
  10856. this._drawEntities = [];
  10857. this._polygonEntity = null;
  10858. }
  10859. }
  10860. Object.assign(PolygonObject.prototype, {
  10861. drawPolygonByGeoJson(geoJsonUrl, options2) {
  10862. return new Promise((resolve2, reject2) => {
  10863. let _self = this;
  10864. if (!Cesium.defined(geoJsonUrl)) {
  10865. throw new Cesium.DeveloperError("geoJsonUrl is required.");
  10866. }
  10867. options2 = options2 || {};
  10868. options2.id = options2.id || setSessionid$1();
  10869. options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
  10870. options2.color = Cesium.defaultValue(options2.color, "#FF0000");
  10871. options2.outlineColor = Cesium.defaultValue(options2.outlineColor, "#FFFF00");
  10872. options2.outlineWidth = Cesium.defaultValue(options2.outlineWidth, 1);
  10873. options2.extrudedHeight = Cesium.defaultValue(options2.extrudedHeight, 0);
  10874. let promise = Cesium.GeoJsonDataSource.load(geoJsonUrl, {
  10875. clampToGround: true,
  10876. stroke: Cesium.Color.WHITE,
  10877. strokeWidth: 3,
  10878. fill: Cesium.Color.RED.withAlpha(0.5)
  10879. });
  10880. promise.then((dataSource) => {
  10881. _self._viewer.dataSources.add(dataSource);
  10882. dataSource.name = options2.id;
  10883. let entities2 = dataSource.entities.values;
  10884. for (let index2 = 0; index2 < entities2.length; index2++) {
  10885. let entity = entities2[index2];
  10886. entity.polygon.material = new Cesium.Color.fromCssColorString(color).withAlpha(0.1);
  10887. entity.polygon.extrudedHeight = options2.extrudedHeight;
  10888. entity.polygon.fill = false;
  10889. entity.polygon.outline = false;
  10890. entity.polygon.outlineWidth = options2.outlineWidth;
  10891. entity.polygon.outlineColor = options2.outlineColor;
  10892. entity.polyline = {
  10893. positions: entity.polygon.hierarchy._value.positions,
  10894. width: entity.polygon.outlineWidth,
  10895. material: new Cesium.Color.fromCssColorString(color).withAlpha(0.1)
  10896. };
  10897. if (options2.clampToGround) {
  10898. entity.polyline.clampToGround = true;
  10899. }
  10900. }
  10901. resolve2(entities2);
  10902. });
  10903. });
  10904. },
  10905. generatePolygonByPoints(points2, options2) {
  10906. return new Promise((resolve2, reject2) => {
  10907. let _self = this;
  10908. if (!Cesium.defined(points2)) {
  10909. throw new Cesium.DeveloperError("points is required.");
  10910. }
  10911. if (points2.length < 3) {
  10912. reject2("\u9762\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C113\u4E2A");
  10913. }
  10914. let positions = points2.map((point2) => {
  10915. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  10916. });
  10917. options2 = options2 || {};
  10918. options2.id = options2.id || setSessionid$1();
  10919. options2.fill = options2.fill || true;
  10920. if (options2.color) {
  10921. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  10922. } else {
  10923. options2.color = new Cesium.Color.fromCssColorString("#ff0000");
  10924. }
  10925. options2.outline = options2.outline || false;
  10926. if (options2.outlineColor) {
  10927. options2.outlineColor = new Cesium.Color(options2.outlineColor[0] / 255, options2.outlineColor[1] / 255, options2.outlineColor[2] / 255, options2.outlineColor[3]);
  10928. } else {
  10929. options2.outlineColor = new Cesium.Color.fromCssColorString("#000");
  10930. }
  10931. options2.outlineWidth = Cesium.defaultValue(options2.outlineWidth, 1);
  10932. let entity = new Cesium.Entity({
  10933. id: options2.id,
  10934. name: "Generate surfaces based on coordinate points",
  10935. polygon: {
  10936. hierarchy: positions,
  10937. material: options2.color,
  10938. fill: options2.fill,
  10939. outline: options2.outline,
  10940. outlineWidth: options2.outlineWidth,
  10941. outlineColor: options2.outlineColor
  10942. }
  10943. });
  10944. if (options2.outline) {
  10945. entity.polyline = {
  10946. positions: entity.polygon.hierarchy._value.positions,
  10947. width: options2.outlineWidth,
  10948. material: options2.outlineColor,
  10949. clampToGround: true
  10950. };
  10951. }
  10952. _self._viewer.entities.add(entity);
  10953. resolve2(entity);
  10954. });
  10955. }
  10956. });
  10957. class CircleMaterialProperty$1 {
  10958. constructor(options2) {
  10959. this._viewer = options2.viewer;
  10960. this._definitionChanged = new Cesium.Event();
  10961. this._color = void 0;
  10962. this.color = options2.color || Cesium.Color.BLUE;
  10963. this.count = options2.count || 1;
  10964. this.duration = options2.duration || 1e3;
  10965. this._time = new Date().getTime();
  10966. this._materialTypeName = "jtCircleMaterial";
  10967. this._param = {
  10968. color: this.color._value.toCssColorString(),
  10969. duration: this.duration,
  10970. count: this.count
  10971. };
  10972. Cesium.Material._materialCache.addMaterial(this._materialTypeName, {
  10973. fabric: {
  10974. type: this._materialTypeName,
  10975. uniforms: {
  10976. time: 0,
  10977. color: new Cesium.Color(1, 0, 0, 0.5),
  10978. count: 1
  10979. },
  10980. source: this._getCircleMaterial()
  10981. },
  10982. translucent: function(material) {
  10983. return true;
  10984. }
  10985. });
  10986. }
  10987. _getCircleMaterial() {
  10988. let circleMaterial = "czm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n material.diffuse = 1.5 * color.rgb;\n vec2 st = materialInput.st;\n vec3 str = materialInput.str;\n float dis = distance(st, vec2(0.5, 0.5));\n float per = fract(time);\n if (abs(str.z) > 0.001)\n {\n //\u7740\u8272\u5668\u6E32\u67D3\u505C\u6B62\uFF0C\u4E0D\u5728\u7ED8\u5236\u5185\u5BB9 \n discard;\n }\n if (dis > 0.5)\n {\n //\u8D85\u51FA\u534A\u5F84\u8303\u56F4\u65F6\uFF0C\u7740\u8272\u5668\u6E32\u67D3\u505C\u6B62 \n discard;\n } else {\n //\u628A\u534A\u5F84\u5206\u6210count\u4EFD\uFF0C\u6BCF\u4E24\u4EFD\u4E4B\u95F4\u7684\u95F4\u9694\u8DDD\u79BB \n float perDis = 0.5 / count;\n float disNum;\n float bl = 0.0;\n //\u5FAA\u73AF\uFF0C\u6700\u591A999\u4E2A\u73AF \n for (int i = 0; i <= 999; i++)\n {\n //\u5224\u65AD\u662F\u5426\u5C5E\u4E8E\u6570\u91CF\u5185\u7684\u73AF \n if (float(i) <= count)\n {\n disNum = perDis * float(i) - dis + per / count;\n if (disNum > 0.0)\n {\n if (disNum < perDis)\n {\n bl = 1.0 - disNum / perDis;\n } else if (disNum - perDis < perDis) {\n bl = 1.0 - abs(1.0 - disNum / perDis);\n }\n material.alpha = color.a * pow(bl, 3.0);\n }\n }\n }\n }\n return material;\n}\n";
  10989. return circleMaterial;
  10990. }
  10991. }
  10992. Object.assign(CircleMaterialProperty$1.prototype, {
  10993. getType: function(time) {
  10994. return this._materialTypeName;
  10995. },
  10996. getValue: function(time, result) {
  10997. if (!Cesium.defined(result)) {
  10998. result = {};
  10999. }
  11000. result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.BLUE, result.color);
  11001. result.count = this.count;
  11002. if (this.duration) {
  11003. result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
  11004. }
  11005. this._viewer.scene.requestRender();
  11006. return result;
  11007. },
  11008. equals: function(other) {
  11009. return this === other || other instanceof CircleMaterialProperty$1 && Cesium.Property.equals(this._color, other._color);
  11010. }
  11011. });
  11012. Object.defineProperties(CircleMaterialProperty$1.prototype, {
  11013. isConstant: {
  11014. get: function() {
  11015. return false;
  11016. }
  11017. },
  11018. definitionChanged: {
  11019. get: function() {
  11020. return this._definitionChanged;
  11021. }
  11022. },
  11023. color: Cesium.createPropertyDescriptor("color")
  11024. });
  11025. class CircleRippleMaterialProperty {
  11026. constructor(options2) {
  11027. this._definitionChanged = new Cesium.Event();
  11028. this._color = void 0;
  11029. this._speed = void 0;
  11030. this.color = options2.color;
  11031. this.speed = options2.speed;
  11032. this.count = options2.count;
  11033. this.gradient = options2.gradient;
  11034. }
  11035. get isConstant() {
  11036. return false;
  11037. }
  11038. get definitionChanged() {
  11039. return this._definitionChanged;
  11040. }
  11041. getType(time) {
  11042. return Cesium.Material.CircleRippleMaterialType;
  11043. }
  11044. getValue(time, result) {
  11045. if (!Cesium.defined(result)) {
  11046. result = {};
  11047. }
  11048. result.color = Cesium.Property.getValueOrDefault(this._color, time, Cesium.Color.RED, result.color);
  11049. result.speed = Cesium.Property.getValueOrDefault(this._speed, time, 10, result.speed);
  11050. result.count = this.count;
  11051. result.gradient = this.gradient;
  11052. return result;
  11053. }
  11054. equals(other) {
  11055. return this === other || other instanceof CircleRippleMaterialProperty && Cesium.Property.equals(this._color, other._color) && Cesium.Property.equals(this._speed, other._speed) && Cesium.Property.equals(this.count, other.count) && Cesium.Property.equals(this.gradient, other.gradient);
  11056. }
  11057. }
  11058. Object.defineProperties(CircleRippleMaterialProperty.prototype, {
  11059. color: Cesium.createPropertyDescriptor("color"),
  11060. speed: Cesium.createPropertyDescriptor("speed"),
  11061. count: Cesium.createPropertyDescriptor("count"),
  11062. gradient: Cesium.createPropertyDescriptor("gradient")
  11063. });
  11064. Cesium.CircleRippleMaterialProperty = CircleRippleMaterialProperty;
  11065. Cesium.Material.CircleRippleMaterialProperty = "CircleRippleMaterialProperty";
  11066. Cesium.Material.CircleRippleMaterialType = "CircleRippleMaterialType";
  11067. Cesium.Material.CircleRippleMaterialSource = `
  11068. uniform vec4 color;
  11069. uniform float speed;
  11070. uniform float count;
  11071. uniform float gradient;
  11072. czm_material czm_getMaterial(czm_materialInput materialInput)
  11073. {
  11074. czm_material material = czm_getDefaultMaterial(materialInput);
  11075. material.diffuse = 1.5 * color.rgb;
  11076. vec2 st = materialInput.st;
  11077. float dis = distance(st, vec2(0.5, 0.5));
  11078. float per = fract(czm_frameNumber * speed / 1000.0);
  11079. if(count == 1.0){
  11080. if(dis > per * 0.5){
  11081. discard;
  11082. }else {
  11083. material.alpha = color.a * dis / per / 2.0;
  11084. }
  11085. } else {
  11086. vec3 str = materialInput.str;
  11087. if(abs(str.z) > 0.001){
  11088. discard;
  11089. }
  11090. if(dis > 0.5){
  11091. discard;
  11092. } else {
  11093. float perDis = 0.5 / count;
  11094. float disNum;
  11095. float bl = 0.0;
  11096. for(int i = 0; i <= 999; i++){
  11097. if(float(i) <= count){
  11098. disNum = perDis * float(i) - dis + per / count;
  11099. if(disNum > 0.0){
  11100. if(disNum < perDis){
  11101. bl = 1.0 - disNum / perDis;
  11102. }
  11103. else if(disNum - perDis < perDis){
  11104. bl = 1.0 - abs(1.0 - disNum / perDis);
  11105. }
  11106. material.alpha = pow(bl,(1.0 + 10.0 * (1.0 - gradient)));
  11107. }
  11108. }
  11109. }
  11110. }
  11111. }
  11112. return material;
  11113. }
  11114. `;
  11115. Cesium.Material._materialCache.addMaterial(Cesium.Material.CircleRippleMaterialType, {
  11116. fabric: {
  11117. type: Cesium.Material.CircleRippleMaterialType,
  11118. uniforms: {
  11119. color: new Cesium.Color(1, 0, 0, 1),
  11120. speed: 3,
  11121. count: 4,
  11122. gradient: 0.2
  11123. },
  11124. source: Cesium.Material.CircleRippleMaterialSource
  11125. },
  11126. translucent: function(material) {
  11127. return true;
  11128. }
  11129. });
  11130. class CircleObject {
  11131. constructor(viewer2) {
  11132. if (!viewer2)
  11133. throw new Cesium.DeveloperError("no viewer object!");
  11134. this._viewer = viewer2;
  11135. }
  11136. }
  11137. Object.assign(CircleObject.prototype, {
  11138. drawCircle: function(centerPoint, radius, options2) {
  11139. return new Promise((resolve2, reject2) => {
  11140. let viewer2 = this._viewer;
  11141. if (!Cesium.defined(centerPoint)) {
  11142. throw new Cesium.DeveloperError("centerPoint is required.");
  11143. }
  11144. if (!Cesium.defined(radius)) {
  11145. throw new Cesium.DeveloperError("radius is required.");
  11146. }
  11147. let position2;
  11148. if (centerPoint instanceof Cesium.Cartesian3) {
  11149. position2 = centerPoint;
  11150. } else {
  11151. position2 = Cesium.Cartesian3.fromDegrees(centerPoint[0], centerPoint[1], centerPoint[2] || 0);
  11152. }
  11153. if (typeof radius === "number" && radius > 0) {
  11154. radius = radius;
  11155. } else {
  11156. radius = 100;
  11157. }
  11158. options2 = options2 || {};
  11159. options2.id = options2.id || setSessionid$1();
  11160. options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
  11161. options2.CircleType = Cesium.defaultValue(options2.CircleType, "ColorCircle");
  11162. options2.duration = Cesium.defaultValue(options2.duration, 3e3);
  11163. options2.count = Cesium.defaultValue(options2.count, 1);
  11164. if (options2.color) {
  11165. if (options2.color instanceof Array) {
  11166. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  11167. } else if (typeof options2.color === "string") {
  11168. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  11169. } else {
  11170. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  11171. }
  11172. }
  11173. if (options2.outlineColor) {
  11174. if (options2.outlineColor instanceof Array) {
  11175. options2.outlineColor = new Cesium.Color(options2.outlineColor[0] / 255, options2.outlineColor[1] / 255, options2.outlineColor[2] / 255, options2.outlineColor[3]);
  11176. } else if (typeof options2.outlineColor === "string") {
  11177. options2.outlineColor = new Cesium.Color.fromCssColorString(options2.outlineColor);
  11178. } else {
  11179. options2.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  11180. }
  11181. }
  11182. options2.outlineWidth = Cesium.defaultValue(options2.outlineWidth, 0);
  11183. let polygonMaterial = options2.color;
  11184. options2.outlineColor;
  11185. if (options2.CircleType === "DynamicCircle") {
  11186. polygonMaterial = new Cesium.CircleRippleMaterialProperty({
  11187. color: options2.color,
  11188. speed: options2.duration / 1e3,
  11189. count: options2.count,
  11190. gradient: 0.2
  11191. });
  11192. }
  11193. let entity = new Cesium.Entity({
  11194. id: options2.id,
  11195. position: position2,
  11196. ellipse: {
  11197. semiMinorAxis: radius,
  11198. semiMajorAxis: radius,
  11199. material: polygonMaterial,
  11200. outline: true,
  11201. outlineColor: options2.outlineColor,
  11202. outlineWidth: options2.outlineWidth
  11203. }
  11204. });
  11205. let flyEntity = viewer2.entities.add(entity);
  11206. resolve2(entity, flyEntity);
  11207. });
  11208. }
  11209. });
  11210. Cesium.Primitive.prototype.setUseGeometry = function(geometry2) {
  11211. this._useGeometry = geometry2;
  11212. };
  11213. Cesium.Primitive.prototype.getUseGeometry = function() {
  11214. return this._useGeometry;
  11215. };
  11216. class SketchViewModel {
  11217. constructor(viewer2, options2) {
  11218. this._viewer = viewer2;
  11219. this._init(options2);
  11220. }
  11221. _init(options2) {
  11222. this._viewer.scene.globe.depthTestAgainstTerrain = true;
  11223. this._viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  11224. this._entities = this._viewer.entities;
  11225. this._pointEntitys = [];
  11226. this._sketchPointImage = void 0;
  11227. this._iconNormal = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcEAYAAAAinQPXAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAB2FJREFUWMO9mHtQlNcZxn/nW65GxHtEqTEajUxVoLYRSIyipHG4qG0lajtxVIRFubgqXuOI28ZE7FAvCLKLSNKxg/FSIzdvqNE62kaRitqpYMxovBGigo4I4n6nfwjsCrsLrtjnn53vnPe87/Oc9/2+854VdBhCd6ZP6dMHlAXO/lOngrzMLz/8EEQ0ASNGANNY2aOHxYIdfHr3LuBCwPnzQIKcf/AgiJ8pQV99BfmvR4+orHxZVsLxpZFT0qd07gyP7zqrej3IInF47lwQkTLV3d1xv3KXWPT4MYhLzMzIgHpn10+Sk+Gw74w+jx79HwSGnzUYhg4FED4FBcBq/jtokOOC2oSb0FZUgHpKVoeHQ9GtGM/y8lcgMLxf5juDBwNDlOWnTgGvUdWz5wsQ7c179fUWzz9y0tX1BdZPILeqCpTtil9QEOT9c876K1faWqS07XeMzJFuboCXkpaX1w5hqxl14QJIKYRWCzLV5OXtDQXbon3c3c2/TeMoYvncucAgPrl40Y7fA0zv1QtMydKwb58FL7toRwbDYo3/0utB3OD8qlX2hIkLqalwO0b9+fLlUHJOG9vQ0P4EjfyFIdPZGfqsURampIBIlxsWLLBtL/NltF4PhUIrVq92QGDIeEOmpye4pYju164Bq6n29LTiopy8tDTIL48pSExsDq/Oj9is/eAD4CRbli1DMEFUBAYCewnUaJD8jr2lpQjpJ7M2bBBi0+L47Tt2mP2G5xhNaWnAHrLj461tKF1rasA0rW5b//6w/0rigQcPWhrZKVFXP8TkybaFyb3kXbkCbiO6fpyU1Dwq58vNG3U6BJvEiYMHEcwQW8aNA3pT7O4OaPmTiwuCnlwcNQrEDRGYmytloilj5vr1Zv+mNXVhSUnmOFYEVnt6gtM9t+8mTbKlwo5AoWdySIjteWUcIwwG2LX7o6lPnkiZULTlj/7+wEThm5oKbCBeCOANUisqkNRxLCEBSSzrYmOB3jw6c8Yi3kL5K51OyvkZGXUTJz7LSH09CIPwMBpt85CHhMf48Q4IJFPofHzsbMAAJfjIEQtXC9TZWi0wkEuKAmjEyspKpNN2pyVBQULZaIjbvXmzUDb6xF0zGJCqv+no6NGAK5fLyiz8JssVcXEWgQLUsZZxWmGbrLTN057Agfh7eNiefhpRb7h922LgOzFp2DDzxnJXrsvLE0rqOW3sTz+12h4lLfRZhuQybuXmWmQkgPzhwy0o1jlV37ljh+e3/L1LF0cEXqX04UPb0075rlovLwtBHuqZ5845T5Z37UqbEAPkzOfsUvlHXZ35saFnQ4++fe04eIfftv64tEfgdvkXeweprFIvBQaaebJH+f3x4xbPvsRPnixlQlHGtDFjWq2Wuqj0yz4+QKk4FxNjMVXD2998Y0FRKEsCAuzwzBKv2eZpR6DspxQcPWpnvrNYoNNBZOTOnRoN0ilJMzYjA3ibsKoqoIxezs6gLJbpxcVSTbyePurwYSkT76VPKSgAWQslJcAmenTrBszgP7W1wBlRmZICY2SydHIC8ZCvdTo7Ak+ri44dcySDNDTs2mVufluhThoGD4bHp6or4uOb3zWJnoqwMGAVLnfuACHscHJCiFRmhISA0BMcFob52PDC/8EDkLfkR5GRQmycN8/t8mXw8O73WVwctnvdJ3SqrQXNSJeY3bttaWhHJxMxzDh97VqQAwheutR2IC6pm/z8oOBm7LcVFVJNKNo0oUsXhBKmGR0VBfI0vkFBINzExxoNEKP+ePYsktefFmVnC2Vjvm5SZSVEpGUNefNNUH8ti8rKQCziaOfOVuL2563PP4eCjJhxK1a8hMCJJ7NTPDxAXWIaefEi0J2r/ftbMfyryDhxAkZ2u1EaHAx6oReq2rb/JiTLZKkoUHLf2//YMWCGnPf++1YM7zHw+nVQ1mlKhg2DvPeiltr+GLaj2W524Kd6zZ4NhGOQ0ophI6GSkr4Gq61VGyjx7vdZQoIdYY1xVZ06RKttS1gTHLkPLjVmGo3AJZToaCsGjSWrPFBKfH3bvta0uyR3ySlGIxS4a7trte1l244MtoRpT93XSUk0l0oruFDbqROYUtQ9X3xhLr2WaBpX4+WnOTl2hHkw9eZN0Li5dLP6Dehogc1dexslK/7MynffhbNDvZXnWq9GNJWyiKC69TlphvobtWbOHNgnZonq6hdl+xL/yTQhbKUxeOtWEP9melSUFYMWJSv/IAtNprZLUu4Rf9u6FQpdo49bfRXaBQcy2BL1p+XURYtAZrLwhx+sGDSWrDpc3ZeVBbJMPt22zY6wRj/1oep08zXMUXRABpsQFmqcHhICYiLlhw4BBWiFA/5FOXmhoc8u0Pv3vyyrDshgEwqLYnKLi4FO5OfkvPh66UdudnZHCXsFAptQ96XMW7jQTsm2xAF23roFlD6NXLy4o9m8AoHFR7SxNTWgjGOsVovtxqBxXAzEbc4cKCycN+/+/Y7n88oRvjarcNYsCDtprP/+ewjvZ1xz9SpERBp3zpz5qqP/D5zQE33tptaiAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTA0LTA5VDE2OjQyOjI5KzA4OjAwjRBbGwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0wNC0wOVQxNjo0MjoyOSswODowMPxN46cAAABKdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL2hvbWUvYWRtaW4vaWNvbi1mb250L3RtcC9pY29uXzJhcHo1b3VpcnV4L2Rpbmd3ZWkuc3ZncY9vkgAAAABJRU5ErkJggg==";
  11228. this._iconBlue = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MkEyMUE1MDg3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MkEyMUE1MDc3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv/grmkAAAhxSURBVHjazFoLUFVFGN49597LBdFUEpEQI0IpyxIfqU1ZkY/pNZg1RZlWY2lW4yMncxq18oHZ0+lhOaWZUo0zPjIr8W1NiubI+AxBIkRQQsQE7us8tv3P7qGL7gXOPRdzZ3bmcnf3+7/v/Lv/+f/lYkIIMpur2yBktQVO5yM7LRybIvsOFKFGCeHyQz/dFO2Ousflcg6UJSlVlqVEjHEMjNMH5tE0vVLT9ZJAQNnn9fm3d+9z3xEYioR9bNcjW9Z8Gtv35l7PUAFjnU5HLytrFUU9TgV9XXD4+PJhoyfV2/GIFO4TGD8my1lVuGXSHYNuPdyhfbv5VkVAgzWwFjAACzAvp0fwoV++uz6lxzXLolzOW1AEmz+gHCwtq3i2z52Pn2jtlgvXI1LpgQ0jeqYm74y0CGiACdjUxkir3KxMlsoKNj6WmNAlV5Kk9qiNGmBTG6vAlhV+rd1aUuGeNSNSeiSuolGo2X1cdDogbThQ79h21CMfP6NKtR4dw/edYiTSK8GhZ/aO0R7KiFV7dnPpzeFQXkppWeWY9MGj8+ifektbqzVC8KbVH6UNHdJvOw2nHUIB7vrDI89df861p0SRsUSjuiSzB4qxyYzx0TVEdBUNTnVqs7I6B4beEKOFwqThuu7X/IJ7hj/yYlGoM9NqIakpSVH7t67c3C4muq8IyKcQ9EpuddSK3xqcSHJR7g7WsSkCm8+YiSEgRuU9gMbd3k5578kufrcTC8U0eLwF/e99anhJ6Sm/HSHSid/Xv5CclJAjAjlXr+GHP6x07z9JZCSDCBfzBJapBomJabJfdKqFCiGa4RkQgrQA6p+MtbVTEn2dY2XhUz956szM6wdkLRFtsVZFrReeeaRTQte46aIxT4DgrA9ABJKRw42QTLsjimqATgUZwpxNO/0OGz3KmMvWuBFgABZgimwBB+ASbtSSp0zIHutyOuNEg9NW/e06UE49YRBi5LFB2NxaMoQg5iGJfza+Y+MwlwlmogALMIXpD+UAXIBTOEKi4rt0zg51sFft8TjN7YQbnzrbVpeeD8Q+w3fYFCQba9ha5kHABGyRTcrlCeBkVQjO/Wxeb3rA00WDb62rcbHzAARML0hBAloK+lyQ4TEHx2B4BragUS69vl06/6aLnk6LQuQ+vdMyRQMHT/ql/D9VGfEQi00PGFDYwqsP8/AsMQyJbTvABhuiFb3TU+8Otb1CCXFd1SF2gGhg/f56Bw4+B9iCJ0J5Bv93fgAbbIimd7yq/UDgZklITLQ7RTSwp9grs7MgBYXYMEQ0OTtBWBR7d5FX+NQ5J0tCHG63K0GYglSpkrklGkXY1GGKMbdo8d+qkBfn5LB0RpwOeDlc2mo9NNYHbyOMIuCRptvNsCGqXxgnS2dEoslhxMrgSDXOSbL0HlFVzSv6vlMMJigorWGpnJ2ymzRdTrENGxY4NSeE+PwBYQ3ds6tDN1IewvvFRMLQwTBMPB2lxTuEaTvnRKwI0S/U1ZeLBganRWtGwteYAOoR8EgQFsUe3DNamNpzTroVIWp1TW2xaCCrf6xKzDScaP89SRKGGBLkCSMjVo1aZRS1IZrOOalWhCgHjxTvEw3ckhylD7rOobF6ghZJphhk1TO80DK8Yab1KgJssCHMKhgnxYqQQM7i5bv9AaVONDh7VFzAqCWMekLhRZIFzzQWWLzIMjAY3qwsii2+YakDTsDNkkdoRVZbXHLyN9EglKdjh8QoUBSBcaIDEYU91cbtRi7yUFCF2OgBha9lBRZg3nWjuPQFLsDJqkfAtfWfr1jzDSHiR/zuk/GBjO5YQyqtQDU/5WYKCjo/Oicd/JmPw1xYA2sBA7AAM8RFBAEuwMnqYTei3Q95vx47U1VzTJj3uDBZNzXRl9EdUTE+SshnECJcFPOWwraNxj0GYo3OyLM1PgQYgAWYIlvAAbgAp3AKK6XyTPXZ56bOm0f3p/BFFEdr7LwZSd5xQ9wKUukUo/u4h8SdecCHzPmwdtOMJF9ciHodbE+cvmA+cAm1rVoSAsD1m3fmH127cfvSUJOiXRh98nS8/8dpXb0DknWNKB5qzsOIKlwYdIULpWMwB+ZunNrVC2tDeQIa2P552+4jfFsROxd0sbRfm5/31dyMPumZLQWkwsqA9EOTCzqCzdTGvKB7MCNWTU9s/oIOWsHh41tvGz5uNv34Fxdi64IOvNaxQ/t2aXvzVixKTUnqezkSRBqhCm4bMW7GhboGuJw7H+qQW7nEBoALFPCvOx8cP+toYUl+W4v4o6h0L9iiNkvBdnNXplYvsSEtOFddc75owLCxc6jLd7aVCMDulzlmDtgCm6FSEju38RAxztJUumTkoy+9faqyqjDSIgDzgezJi6gN+P9Is1HKjpBGz9T+U1cy+ulXZ9XU/lMRKRGABZjUEyeseCJcIY1i6BY4NmHagjlen/+CXREUow6wADMcEeEKQTxxq96wadfvCz9cvpBuBSVcEbCWYuQAFmCGSgrbSojx0qW9KmfxV5u/zP1+MTEqI6vlCNFhLWAAFsdEl1sIvIAgdTn98muL1mzZtXe1VYCtv+xbDWsBg2OR/0OIKaaB9ooHsqcsoXt8h4Uwu+P+xyfD/zwqOIatHw7YFQJvVthSUICVDxs9Kae0rOJwS2vKyk8fgbmwhq/V7fKwLYSLgWLoPLz9s59//c3mwjKMPTZ+5hswl6ceWiQ4REQIF2OE5QOHCo9NfCVndoPHW3vxHPgOxmAOzOVr0BUlhIuB0Hn2+5937p/77hcLgsMyfF7wwbKFMAZz+Fx0RQoJDsvvL8ndYYZlM8y+8/HKbXbDbKgW8ftd+qQJLQcglFZCaE3qFn81wogEh1mYE/F74bb64RnFAm/DDwy6mPdrkJLzKGfLpsj+vwIMACSZzfDJFmOPAAAAAElFTkSuQmCC";
  11229. this._iconGreen = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MjI1NDIwOUU3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MjI1NDIwOUQ3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgEE4igAAAgKSURBVHjazFoJbFRVFP3L/OlMoQXKImAFm0JbFtFKShEQI6UsggmkGKghIKTIIgZUohIDKEuLaFTQiIKyKKghqSyyF0pZbcHQsJVpoRkKbYFAW+iU2f78/313+qY+hvc78+dPkZfcMJ377rn3/Pve/fe9gVUUhfENY5eBjNbhvlnI6Bmh+KT5NzBhGigg9sb5vX3NpohhRqMwgOe4eJ7nurIsGwl69MDskiRXS7Jc7naLpx1OV/4z/V67CKpw+Gf1ZiQv9/vWyc8lTkMEpgiCIVGLrSh6ShGhX4ovlG5Mz5jToCcjXKhPIGvyOOG2JW/OywNfuBAd1WqFVhIwwAZsAQOwAPNxZoQ9f+yPHnHdn94QYRSeZ8I4XG7xnLWianq/oZOuBrvkQs0IZz27a2RCfLeCcJOAAZiAjXyM0hqblslcRfHuiV07d9zKcVwU00IDsJGPLeBLS3zBLi3O8nfuyLjuXbegKtTsOrY4Ldz22u2GPFue4bL7MlfrqWXh+xhDjNLL2EtOj0r3jI8Z70kyJcnN4aC4RGtF9eSklzIOoD/lQEsrGCLs/m3f9nxlUP98VE6j1QDz6/P5xZWLI06KJ3lGwIWdB2tfZEgkJB4oVwwzWBgsLY1d6hoWPUxSw0Tl2na8sHjYiAnvlKntmaD3SHxcrDG1f9/1aiScspOZYZ1hGm4dHnmSRyRglk+i/ITQwVywAVvAoA3kMyolufc6iEHv0uKuntkxu1ts5xyacY2nhh1TNsZcpBTxjBl2K4AQ2eD8MiITWXFDmULiYJhUNlXak7DH0d7QnvrUr1feWtgjZdxa2hILKiOzp01o1/mp9gtoOrtsZ0eXjjYXMYhEa/RFKyxmLCaCmBF/NhF633xkCxiABZg0XxADxBJq1eLnz8ycYhSE9jTl3Iq5EWeYM/wjwUPQvj1CEwHP8SMFWIBJbX9QDBALzrNmIhGdOsZkqm3sTfWbhKbgTcSSMhBLiiYcMc9I2CMswARsmk8Uy5s4r5qIsFt/WN6nVaQ5iaZcVLkoQjEpjbD++4IM+hFUQniCDMYBTMCm+USxJP6+bkVfFWRVIny/Pj3TaIpiezF3SjzFN619AaNwRLABSwzhnSOWGxLABh80sz5J8a+qLS81IsY20a1TaIrc2lzhoX3A+2Ui6FcxkRn+4f3j9UEZbdtEDcCUgycSaTbF0RQnGk7wTY79S2xIbSvGIDCPNxynPnUckyYiBpPJ2JmmKBVLuSYCXIA9EWxWWAIPYZeJZdS4cEwGTXtEMBhMNEWthHonVieB5gix2Aft/NIYk6Y9wqHmMGzH4HANHBOn6T3i8UgO2vcxfIzibTdI0Tv88Lw+NMTUHBHF6XJTz9CJQqLs7ZdkLHoIkbbyf71YgpBAbdtxTIoWInK9reEGTTGk9RCpqfGTCDJ6skE2kxL2QRk4JlkLEc+dmrorNEVGTIbo7VxFgowUQlYU4oxCnFMAe0LMBJFmgmPyaCEinrt45TRNkRyZLA8SBkleMj5CMvGclCBJMIQdJgAC2OCDZoZjErUQcees3njK5RZtNOWy2GUu1sk2nidcOAiPX2aUAHvC/1yCBDDh1Khyw2KDmLBF8Bkpt1bWXSm/fpKmhOPp9OjpIhyKGCcWHxkPpQj4b2oPQcJnj7AAMy06jbo/IBaISWtGwF3Dj5tzf1PIIyQx1nRf40phUiTmQWMQTaTI/ePx2wPEPvAF7xWEAViAqXIRoUAsEJPWze6tdn8dOF5y63ZNCbXv4SKVvYl7HSkKItPQGMwjpFx+4he8V5AtYAAWYNJ8QQwQC0bQfLASq2/duTvjveXL0fqkvog6GDooR3sdtWdFZomsjW18Xj5SdhXBwYOADdgW9CpwAJbK3nDMWpC9AmJRW1aBiABww8GCwkt/7s5fpzbJzJmZ9XHrnYfiDtkHSgMlph59CSXC9y8phA7m5sXl2cFWLRMwwPe+w6cuYvqKngs6uFp4tvDApmUv9ktKC1RZSxwl3I66HYaD9QcNFtHC+RpAaDuShCR5RPQIz7h24zy9zb3lQFjFF0oPpY6Yuhh9vIaJ6Lqgg6y1jY5q1bPowOZV8XGxyY+jQUQVqjh15NSP6m0P4HLuntom13KJDQD1CPDa0NezFl2ylBe2NInLZdYi8IV8WvGCDJi9YC+JoXDW3qm5V5aSPmUJSnlBS5EA7P5pk5eAL/Cp1pLouY2HinEXtdLlo96Y+3ll9W1LuEkA5tjMeauQD/h9pNkqpYdIU2bq7tvKM976cFFN3f2qcJEALMBEmbiqJROhEmkig5ZAycz3s5c4nK56vSQQhg2wADMUEqESYXCTcWfX/qNnVn6zcSVaCmKoJMAWYeQAFmCqNYUtRYTBTcftnNWbDv68dedqVMZlrQBgA7aAAVgYk3ncRBTcNd189+NVuXlHi7ZpBTh07PQ2sAUMjKX8H0R8ZKB7qhqbOX8tWuNHNJTZI2MmzYPfPKowhq5rDL1E4M0q4w7qRnrGnBxrRdWFQDYVN25ehLlgg21lvXHoJoLJwInjHrz9M9/+5LPmyjLoJmYt/BTm4tZDCkcMYSGCyXjL8tnzlpJZH+QsfmB31PnPge9AB3NgLrZhnigimAyUzrs79xX8s+zLn7LJsgyfs7/esBJ0MAfPZZ5IImRZ/mrt1iO+suwrs1989+thvWVWbYT9fhc9aQUdB6CUVkNpje3SqQPDMgpZZmFO2O+FW+o/niEsyDb8qt7Rd78GLTmucrp80vz/K8AAYAEv1AHM/GwAAAAASUVORK5CYII=";
  11230. this._iconViolet = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzFDREU3Mjk3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzFDREU3Mjg3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Ppb+WxIAAAhcSURBVHjazFoLcFTVGb6vvdnNY0lEEJOIxhCSKTEFKSC1osIgjqIyA62mZfAxWJU+tC3TVh2lHSGhtNOKOqK0ii+0QwcfFB+IAsKIITpJhUBDHhMiSSBCTMgm2d377PnungubnXOT3L0b6rlzmM2e83/n+87/n/+ecxbeNE3OLvLFV3Fui3KiivNSkhmTNb7EpagQQvzxg++VBvxpc2XZN1MUhEJRFHJ5nk9HO5mwAV03OnTDaFYUtTocie66pOymOjSlYnzeq0d2bn02c9oVxXcTAct8PqnYja2qakeJoFdqDx3dNH/xij4vHhGSnYHlSxf5Out3rrjmqqmHglkZa9yKQIENbIEBLGCeT4/wB/f+c1LBpXkvpsm+73IpLFFF/bKltf2esjl3NI005JL1iNBSs23B5MKJe1ItAgWYwCZj3OiWm5vOQmvt9ttzJ4zbLAhCFjdKBdhkjNcwlht+Iw0tof6zrQsKLs19jWShIeM40hASure3S727O0WloV/QehTeSo/ZsilPzjCC11+k5yzM0/yTs4yhcAgvtaW1Y2nJ7MU7yJ/GcKE1EiH8B1ueLrr2+9N3kXQadAIM7f1abK84LEcOnBFFXuREMpk8TyrHx4jhMQ1OJ5x0U+f8s8boeY9MUbLmjNedMEm6Du2rqp17w5KfNTitmRGvkcKCfHnW9NK/O4kwIjp37JdfpDUv+jSgVw+IASHAofpRef/gSttQ0Rc2sAUGq5Axs2ZM+85GcPAaWkLT528/MDF/QiXLWPtG4Rt/tM+v1vSLMi9zPl4iniCVeASeEPjB82QQj8Az8IjOaZxqapxiKpzvygy9aMs1EekCmTnrX7WdfHjSjEUbWCE2Io88cPeSnAkXjV3J9ERY5xuX7PNrNQOin0/j0kiVUQUI8llVSnjs79FHpjawBQawgMkaCxzAJdmsJT50X/ky2ecby5yllTWy+p9+MY2PkYonb60RUuER1udBoixBMgcsYDK3P4QDuIBTMkLSxo+7oNxpYfe80eaLhZPMSSSkUAU8vPWvFVr2QrdimD7xfWw7nzUZMgdMYLPGJFx+DE5uhfCbn1s9JSM9UMJqbF9TJ5O5tNZEooh48o4Lk66fwWJIJZjAZtkQLsVvbFxTapm7ECKWTSmax2oYONgjRKp7RSluYbsRwRITS9cxQcDGGCybKSWF1zuFl5MQeUwwcwaroXtbmyTRWLdFkJekKxGDwo3nz4nB+iEVY7D6Z4/JmgluroSkB/wFrIa+z7rE2DyeWwfJiEhcO2fXD3n69p9mzjrl5EqI5PfLE5hv0qZ+gach4TacRhJmwFaaB5i8KCfJ1RrxSZKfuW3oUflE8l49kvg3xmCeX2KcXK0RMut8yo7BqSqUk+DqPaJpepjpqmyfaSbs30wPx24WFsZww2koIWYkqjDP0PKkDAO7WOuheyevBRgGxQS2XJjO3LZTTqYbIUZvqO84qyFz9lidyohtzenjRYT92LiZsy9kbocpJ8ONEO1UV3cjqyHn1nxNw+6V1tgsJicmdkaJCbDxgJ1zW77G6k85aW6EqF/WNVYzc3lZtuGfGdQ1sgXHVtwW4zbM4sPJ3tYDE9gYg2VDOaluhCiV6zftjypqiNWY92iponKKdZ7QaHUjJl6EbQ8sYOY+Uqo43LCEwAncXHmkuaWtu7H5q09ZjTieZv/kEhWHIpXURDHx6ydxLcT3OSdCsQ5YwAxeyz76ggs4ufUIXNv3/MtbXzfjj5BxZeK6aYpvaoYetUhECRnVqhoNNyvkTIP5WbNOh7H+sAUGsIDpcBFhggs4uV3sVrb79459R052dh1hGgZEs+hfP4hIU9P1iEUmapFSDGWQqPjnLHlDoQKiHGyBASxgssYCB3ABp2QOVmrHyVOn7/3V6tUkPpkvImlsmln83nXh4NJcNWKGuYgRIxcTpcQIx1fynd2OvrCBbfG710WA5bA2wvevrFgDLk5hNZwQAPd9uKfq8Jvbd210BPCL3GVPfS9a+PbVYWF6QA8bEBSrYYgzI1a1Ptvfk4q+l791dRi2Tp5Awdjvf7y/joaV6eWCLpPUy6p2vPTElWUl84bLSOH6XqHn3Xapd9fXotLUJ+jdmrUBFHMkU56UaQTnkkRxc54WKAkaw2HVHjr60awb7nycfDxGhXi6oIPXsoNZGUUHdry8rrAgf9r52CCSDFU7a8Gdv+sN9eNyrsdpkbu5xAZALwE8NueW5Y8drm+uGm0R/21oOYCxyJgtGHuoK1O3l9jYFnxzqqunYcb8ZauIy/eMlghgT5+3dBXGwphOWxIvt/HIGKfJVrr5xh/+/E9tHZ31qRYBzIXlD64jY+D3kSGzlBchZz3TfSbUvPiu3z7W1X2mPVUigAVM4okmN55IVshZMSQEjtz364pV4Ui016sIghECFjCTEZGsEI5u3E5t++CTz9c+uWktCQU1WRGwJRiVwAKm06ZwtIRYL11SOyvXv/ThC5vfWW/iaOf2PEJsYAsMYFFM7nwLwQsIW5cTv/j9uq07PzmwxS3AR3urt8AWGBTL/H8IscX04zp4YflDG0iM73aRZnfffMeD+M2jnWJ4Ovx7FYI3K0IKB7Dj8xevqGxpbT80nE3r8RN16Asbamt45eFZCBWDw1AP3v7lP330j0OlZbTdvvzhP6Av3XroqeCQEiFUjJWWaw7WH7n/N5WP9w+EuxP74Du0oQ/6UhvuWyWEikHqPP3O+3u+eOIv/6iIT8v4XPG3F9eiDX1oX+5bKSQ+Lf91w+bddlq20+yfn3n1Y69p1qmk/H6XzLRJjgNIpR1IrfkXj7+Q4zkzPs2iT8rvhUfrP54RLHgbv82Ps+/XsCWnWc7TmKzx/yfAAHo1CtU9myPWAAAAAElFTkSuQmCC";
  11231. this._sketchEntityName = "sketchEntity";
  11232. this._sketchTempPoints = [];
  11233. this._sketchPoints = [];
  11234. this._sketchOutputPoints = [];
  11235. this._sketchTempPolyline = void 0;
  11236. this._sketchPolyline = void 0;
  11237. this._sketchTempPolygon = void 0;
  11238. this._sketchPolygon = void 0;
  11239. this._sketchTempAltituePolyline = void 0;
  11240. this._sketchAltitudePolyline = void 0;
  11241. this._sketchAltitudeInitHeight = 0;
  11242. this._sketchTempSpatialPolyline = void 0;
  11243. this._sketchSpatialPolyline = void 0;
  11244. this._sketchTempCircle = void 0;
  11245. this._sketchCircle = void 0;
  11246. this._sketchTempRectangle = void 0;
  11247. this._sketchRectangle = void 0;
  11248. this._sketchTempTriangleAltitudePolyline = void 0;
  11249. this._sketchTriangleAltituePolyline = void 0;
  11250. this._sketchTempSpatialTriangle = void 0;
  11251. this._sketchSpatialTriangle = void 0;
  11252. this._lineLabel = void 0;
  11253. this._polygonLabel = void 0;
  11254. options2 = options2 || {};
  11255. if (options2.isDrawPoint) {
  11256. this._isDrawPoint = options2.isDrawPoint;
  11257. } else {
  11258. this._isDrawPoint = false;
  11259. }
  11260. if (options2.isRetainDrawPoint) {
  11261. this._isRetainDrawPoint = options2.isRetainDrawPoint;
  11262. } else {
  11263. this._isRetainDrawPoint = false;
  11264. }
  11265. this._param = {
  11266. moveLineWidth: 2,
  11267. lineWidth: 2,
  11268. moveAltitudeLineWidth: 2,
  11269. altitudeLineWidth: 2,
  11270. spatialLineWidth: 2,
  11271. moveEllipseColor: [0, 255, 0, 0.5],
  11272. moveEllipseOutline: true,
  11273. moveEllipseOutlineColor: [255, 0, 0, 0.5],
  11274. moveEllipseOutlineWidth: 1,
  11275. spatialLineWidth: 2,
  11276. ellipseColor: [0, 0, 255, 0.5],
  11277. ellipseOutline: true,
  11278. ellipseOutlineColor: [255, 0, 0, 0.5],
  11279. ellipseOutlineWidth: 1
  11280. };
  11281. this._setMoveLineStyle(void 0);
  11282. this._setLineStyle(void 0);
  11283. this._setMovePolygonStyle(void 0);
  11284. this._setPolygonStyle(void 0);
  11285. this._setMoveAltitudeLineStyle(void 0);
  11286. this._setAltitudeLineStyle(void 0);
  11287. this._setMoveEllipseStyle(void 0);
  11288. this._setEllipseStyle(void 0);
  11289. this._setSpatialLineStyle(void 0);
  11290. if (options2 && options2.iconType) {
  11291. switch (options2.iconType) {
  11292. case SketchViewModel.SketchIconType.Normal:
  11293. this._sketchPointImage = this._iconNormal;
  11294. break;
  11295. case SketchViewModel.SketchIconType.Blue:
  11296. this._sketchPointImage = this._iconBlue;
  11297. break;
  11298. case SketchViewModel.SketchIconType.Green:
  11299. this._sketchPointImage = this._iconGreen;
  11300. break;
  11301. case SketchViewModel.SketchIconType.Violet:
  11302. this._sketchPointImage = this._iconViolet;
  11303. break;
  11304. default:
  11305. this._sketchPointImage = this._iconNormal;
  11306. break;
  11307. }
  11308. } else {
  11309. this._sketchPointImage = this._iconNormal;
  11310. }
  11311. }
  11312. _arcToDegree(arc) {
  11313. return arc / Math.PI * 180;
  11314. }
  11315. _toColor(red, green, blue, alpha) {
  11316. let normalColor = new Cesium.Color(0, 0, 0, 1);
  11317. if (typeof red != "number")
  11318. return normalColor;
  11319. if (typeof green != "number")
  11320. return normalColor;
  11321. if (typeof blue != "number")
  11322. return normalColor;
  11323. if (typeof alpha != "number")
  11324. return normalColor;
  11325. if (red < 0 || red > 255 || green < 0 || green > 255 || blue < 0 || blue > 255 || alpha < 0 || alpha > 1)
  11326. return normalColor;
  11327. return new Cesium.Color(red / 255, green / 255, blue / 255, alpha);
  11328. }
  11329. _toColorFromArray(array) {
  11330. if (!array || array.length === void 0 || array.length === 0)
  11331. return new Cesium.Color(255 / 255, 255 / 255, 255 / 255, 1);
  11332. let r2 = 255, g = 255, b = 255, a = 1;
  11333. if (array.length === 1) {
  11334. r2 = parseInt(array[0]);
  11335. } else if (array.length === 2) {
  11336. r2 = parseInt(array[0]);
  11337. g = parseInt(array[1]);
  11338. } else if (array.length === 3) {
  11339. r2 = parseInt(array[0]);
  11340. g = parseInt(array[1]);
  11341. b = parseInt(array[2]);
  11342. } else if (array.length >= 4) {
  11343. r2 = parseInt(array[0]);
  11344. g = parseInt(array[1]);
  11345. b = parseInt(array[2]);
  11346. a = parseFloat(array[3]);
  11347. }
  11348. return new Cesium.Color(r2 / 255, g / 255, b / 255, a);
  11349. }
  11350. _updateScene() {
  11351. this._viewer.scene.requestRender();
  11352. }
  11353. _getScreenClickPosition(screenPosition) {
  11354. let resCartesian = void 0;
  11355. let ray = this._viewer.scene.camera.getPickRay(screenPosition);
  11356. let position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
  11357. Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  11358. if (Cesium.defined(position2)) {
  11359. resCartesian = {
  11360. x: position2.x,
  11361. y: position2.y,
  11362. z: position2.z
  11363. };
  11364. }
  11365. return resCartesian;
  11366. }
  11367. _getScreenClickPositionAndHeight(screenPoint) {
  11368. var lng = void 0, lat = void 0, height2 = void 0;
  11369. var ray = this._viewer.scene.camera.getPickRay(screenPoint);
  11370. var position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
  11371. var cartographic = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  11372. var feature2 = this._viewer.scene.pick(screenPoint);
  11373. if (feature2 == void 0) {
  11374. lng = this._arcToDegree(cartographic.longitude);
  11375. lat = this._arcToDegree(cartographic.latitude);
  11376. height2 = cartographic.height;
  11377. } else {
  11378. var cartesian = this._viewer.scene.pickPosition(screenPoint);
  11379. if (Cesium.defined(cartesian)) {
  11380. var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  11381. lng = this._arcToDegree(cartographic.longitude);
  11382. lat = this._arcToDegree(cartographic.latitude);
  11383. height2 = cartographic.height;
  11384. }
  11385. }
  11386. return {
  11387. lng,
  11388. lat,
  11389. height: height2
  11390. };
  11391. }
  11392. _transfromFromScreenPoint(screenPosition) {
  11393. let location = this._getScreenClickPositionAndHeight(screenPosition);
  11394. var cartesian = Cesium.Cartesian3.fromDegrees(location.lng, location.lat, location.height);
  11395. return {
  11396. gLocation: location,
  11397. sLocation: cartesian
  11398. };
  11399. }
  11400. _removeEntityByName(entityName) {
  11401. var entities2 = this._entities;
  11402. if (!entities2 || !entities2.values)
  11403. return;
  11404. var delEntitys = [];
  11405. for (var i2 = 0; i2 < entities2.values.length; i2++) {
  11406. if (entities2.values[i2].name == entityName) {
  11407. delEntitys.push(entities2.values[i2]);
  11408. }
  11409. }
  11410. for (var i2 = 0; i2 < delEntitys.length; i2++) {
  11411. entities2.remove(delEntitys[i2]);
  11412. }
  11413. this._updateScene();
  11414. }
  11415. _removeEntityByObject(objEntity) {
  11416. if (!Cesium.defined(objEntity))
  11417. return;
  11418. this._entities.remove(objEntity);
  11419. }
  11420. _createPoint(coord, label2) {
  11421. let _self = this;
  11422. let entity = new Cesium.Entity({
  11423. name: _self._sketchEntityName + "_Point",
  11424. position: coord,
  11425. billboard: {
  11426. image: _self._sketchPointImage,
  11427. horizontalOrigin: Cesium.HorizontalOrigin.center,
  11428. verticalOrigin: Cesium.VerticalOrigin.bottom,
  11429. scale: 0.5,
  11430. pixelOffset: new Cesium.Cartesian2(0, -11),
  11431. disableDepthTestDistance: Number.POSITIVE_INFINITY
  11432. }
  11433. });
  11434. if (label2) {
  11435. entity.label = {
  11436. text: label2,
  11437. font: "12px sans-serif",
  11438. fillColor: this._toColor(255, 255, 255, 1),
  11439. outlineColor: this._toColor(0, 154, 94, 1),
  11440. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  11441. outlineWidth: 1,
  11442. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  11443. pixelOffset: new Cesium.Cartesian2(0, -28),
  11444. showBackground: true,
  11445. backgroundColor: this._toColor(0, 0, 0, 0.6),
  11446. disableDepthTestDistance: Number.POSITIVE_INFINITY
  11447. };
  11448. }
  11449. this._entities.add(entity);
  11450. this._pointEntitys.push(entity);
  11451. this._updateScene();
  11452. }
  11453. _removePointEntitys() {
  11454. this._removeEntityByName(this._sketchEntityName + "_Point");
  11455. this._pointEntitys = [];
  11456. }
  11457. _createTempPolyline() {
  11458. let _self = this;
  11459. if (!Cesium.defined(this._sketchTempPolyline)) {
  11460. this._sketchTempPolyline = new Cesium.Entity({
  11461. name: _self._sketchEntityName,
  11462. polyline: {
  11463. show: true,
  11464. positions: new Cesium.CallbackProperty(function() {
  11465. return _self._sketchTempPoints;
  11466. }, false),
  11467. material: _self._tempLineMaterial,
  11468. width: _self._param.moveLineWidth,
  11469. clampToGround: true
  11470. }
  11471. });
  11472. this._entities.add(this._sketchTempPolyline);
  11473. this._updateScene();
  11474. }
  11475. }
  11476. _createPolyline() {
  11477. let _self = this;
  11478. if (!Cesium.defined(this._sketchPolyline)) {
  11479. this._sketchPolyline = new Cesium.Entity({
  11480. name: _self._sketchEntityName,
  11481. polyline: {
  11482. show: true,
  11483. positions: _self._sketchPoints,
  11484. material: _self._lineMaterial,
  11485. width: _self._param.lineWidth,
  11486. clampToGround: true
  11487. }
  11488. });
  11489. this._entities.add(this._sketchPolyline);
  11490. this._updateScene();
  11491. }
  11492. }
  11493. _createTempSpatialPolyline() {
  11494. let _self = this;
  11495. if (!Cesium.defined(this._sketchTempSpatialPolyline)) {
  11496. this._sketchTempSpatialPolyline = new Cesium.Entity({
  11497. name: _self._sketchEntityName,
  11498. polyline: {
  11499. show: true,
  11500. positions: new Cesium.CallbackProperty(function() {
  11501. return _self._sketchTempPoints;
  11502. }, false),
  11503. material: _self._tempLineMaterial,
  11504. width: _self._param.moveLineWidth,
  11505. clampToGround: false
  11506. }
  11507. });
  11508. this._entities.add(this._sketchTempSpatialPolyline);
  11509. this._updateScene();
  11510. }
  11511. }
  11512. _createSpatialPolyline() {
  11513. let _self = this;
  11514. if (!Cesium.defined(this._sketchSpatialPolyline)) {
  11515. this._sketchSpatialPolyline = new Cesium.Entity({
  11516. name: _self._sketchEntityName,
  11517. polyline: {
  11518. show: true,
  11519. positions: _self._sketchPoints,
  11520. material: _self._spatialLineMaterial,
  11521. width: _self._param.spatialLineWidth,
  11522. clampToGround: false
  11523. }
  11524. });
  11525. this._entities.add(this._sketchSpatialPolyline);
  11526. this._updateScene();
  11527. }
  11528. }
  11529. _createTempPolygon() {
  11530. let _self = this;
  11531. if (!Cesium.defined(this._sketchTempPolygon)) {
  11532. this._sketchTempPolygon = new Cesium.Entity({
  11533. name: _self._sketchEntityName,
  11534. polygon: {
  11535. show: true,
  11536. hierarchy: new Cesium.CallbackProperty(function() {
  11537. return {
  11538. positions: _self._sketchTempPoints
  11539. };
  11540. }, false),
  11541. material: _self._tempPolygonMaterial,
  11542. classificationType: Cesium.ClassificationType.BOTH
  11543. }
  11544. });
  11545. this._entities.add(this._sketchTempPolygon);
  11546. this._updateScene();
  11547. }
  11548. }
  11549. _createPolygon() {
  11550. let _self = this;
  11551. if (!Cesium.defined(this._sketchPolygon)) {
  11552. this._sketchPoints.push(this._sketchPoints[0]);
  11553. this._sketchPolygon = new Cesium.Entity({
  11554. name: _self._sketchEntityName,
  11555. polygon: {
  11556. show: true,
  11557. hierarchy: {
  11558. positions: _self._sketchPoints
  11559. },
  11560. material: _self._polygonMaterial,
  11561. classificationType: Cesium.ClassificationType.BOTH
  11562. },
  11563. polyline: {
  11564. show: true,
  11565. positions: _self._sketchPoints,
  11566. material: _self._lineMaterial,
  11567. width: _self._param.lineWidth,
  11568. clampToGround: true
  11569. }
  11570. });
  11571. this._entities.add(this._sketchPolygon);
  11572. this._updateScene();
  11573. }
  11574. }
  11575. _createPolygonBody(options2) {
  11576. let _self = this;
  11577. let appendHeight = parseFloat(100);
  11578. if (options2 && options2.height && typeof options2.height === "number")
  11579. appendHeight = parseFloat(options2.height);
  11580. let wallColor = [255, 255, 0, 1];
  11581. let polygonColor = [0, 0, 255, 0.65];
  11582. if (options2 && options2.color && this._checkColorAndAlpha(options2.color))
  11583. polygonColor = this._checkColorAndAlpha(options2.color);
  11584. if (!Cesium.defined(this._sketchPolygon)) {
  11585. let shaderSource = "czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n vec3 str = materialInput.str;\n material.diffuse = color.rgb;\n material.alpha = color.a;\n return material;\n}";
  11586. let wallMaterial = new Cesium.Material({
  11587. fabric: {
  11588. type: "wallMaterial",
  11589. uniforms: {
  11590. color: _self._toColorFromArray(wallColor),
  11591. speed: 100
  11592. },
  11593. source: shaderSource
  11594. }
  11595. });
  11596. new Cesium.MaterialAppearance({
  11597. material: wallMaterial
  11598. });
  11599. let polygonAppearance = new Cesium.MaterialAppearance({
  11600. material: new Cesium.Material({
  11601. fabric: {
  11602. type: "Color",
  11603. uniforms: {
  11604. color: _self._toColorFromArray(polygonColor)
  11605. }
  11606. }
  11607. })
  11608. });
  11609. let wallMinimumHeights = [];
  11610. let wallMaximumHeights = [];
  11611. for (let i2 = 0; i2 < _self._sketchOutputPoints.length; i2++) {
  11612. let height3 = parseFloat(_self._sketchOutputPoints[i2].height);
  11613. wallMinimumHeights.push(height3);
  11614. wallMaximumHeights.push(height3 + appendHeight);
  11615. }
  11616. let height2 = parseFloat(_self._sketchOutputPoints[0].height);
  11617. wallMinimumHeights.push(height2);
  11618. wallMaximumHeights.push(height2 + appendHeight);
  11619. let tempPoints = [];
  11620. for (let i2 = 0; i2 < _self._sketchPoints.length; i2++) {
  11621. tempPoints.push(_self._sketchPoints[i2]);
  11622. }
  11623. tempPoints.push(_self._sketchPoints[0]);
  11624. new Cesium.WallGeometry({
  11625. positions: tempPoints,
  11626. maximumHeights: wallMaximumHeights,
  11627. minimumHeights: wallMinimumHeights
  11628. });
  11629. let polygonGeometry = new Cesium.PolygonGeometry({
  11630. polygonHierarchy: new Cesium.PolygonHierarchy(tempPoints),
  11631. perPositionHeight: true,
  11632. extrudedHeight: Math.max.apply(null, wallMaximumHeights)
  11633. });
  11634. let polygonPrimitive = new Cesium.Primitive({
  11635. geometryInstances: new Cesium.GeometryInstance({
  11636. geometry: polygonGeometry
  11637. }),
  11638. appearance: polygonAppearance,
  11639. releaseGeometryInstances: false
  11640. });
  11641. polygonPrimitive.setUseGeometry({
  11642. cPoints: _self._sketchPoints,
  11643. gPoints: _self._sketchOutputPoints,
  11644. height: appendHeight,
  11645. color: polygonColor
  11646. });
  11647. this._viewer.scene.primitives.add(polygonPrimitive);
  11648. }
  11649. }
  11650. _callUpdaeEllipseCenterPosition() {
  11651. let _self = this;
  11652. return function() {
  11653. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  11654. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11655. _self._sketchEllipseCenterPosition = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
  11656. return _self._sketchEllipseCenterPosition;
  11657. };
  11658. }
  11659. _callUpdateAltitudePolylinePositions() {
  11660. let _self = this;
  11661. return function() {
  11662. _self._sketchAltitudePolylinePostions = [];
  11663. _self._sketchAltitudePolylinePostions.push(_self._sketchTempPoints[0]);
  11664. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  11665. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11666. let point_temp = Cesium.Cartesian3.fromDegrees(
  11667. Cesium.Math.toDegrees(
  11668. point1cartographic.longitude
  11669. ),
  11670. Cesium.Math.toDegrees(point1cartographic.latitude),
  11671. point2cartographic.height
  11672. );
  11673. _self._sketchAltitudePolylinePostions.push(point_temp);
  11674. return _self._sketchAltitudePolylinePostions;
  11675. };
  11676. }
  11677. _callUpdateEllipseMinorAxis() {
  11678. let _self = this;
  11679. return function() {
  11680. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  11681. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11682. let geodesic = new Cesium.EllipsoidGeodesic();
  11683. geodesic.setEndPoints(point1cartographic, point2cartographic);
  11684. _self._sketchEllipseRadius = geodesic.surfaceDistance;
  11685. if (_self._sketchEllipseRadius <= 0)
  11686. _self._sketchEllipseRadius = 1;
  11687. return _self._sketchEllipseRadius;
  11688. };
  11689. }
  11690. _callUpdateEllipseHeight() {
  11691. let _self = this;
  11692. return function() {
  11693. let cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  11694. let cartographic1 = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11695. let height_temp = cartographic1.height - cartographic.height;
  11696. _self._sketchEllipseHeight = height_temp + _self._sketchAltitudeInitHeight;
  11697. return _self._sketchEllipseHeight;
  11698. };
  11699. }
  11700. _createTempAltitudePolyline() {
  11701. let _self = this;
  11702. if (!Cesium.defined(this._sketchTempAltituePolyline)) {
  11703. this._sketchTempAltituePolyline = new Cesium.Entity({
  11704. name: _self._sketchEntityName,
  11705. position: new Cesium.CallbackProperty(
  11706. _self._callUpdaeEllipseCenterPosition(),
  11707. false
  11708. ),
  11709. polyline: {
  11710. show: true,
  11711. positions: new Cesium.CallbackProperty(
  11712. _self._callUpdateAltitudePolylinePositions(),
  11713. false
  11714. ),
  11715. material: _self._tempAlititudeLineMaterial,
  11716. width: _self._param.moveAltitudeLineWidth,
  11717. clampToGround: false
  11718. },
  11719. ellipse: {
  11720. show: true,
  11721. semiMinorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(), false),
  11722. semiMajorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(), false),
  11723. height: new Cesium.CallbackProperty(_self._callUpdateEllipseHeight(), false),
  11724. material: _self._toColorFromArray(_self._param.moveEllipseColor),
  11725. outline: _self._param.moveEllipseOutline,
  11726. outlineWidth: _self._param.moveEllipseOutlineWidth,
  11727. outlineColor: _self._toColorFromArray(_self._param.moveEllipseOutlineColor)
  11728. }
  11729. });
  11730. _self._entities.add(_self._sketchTempAltituePolyline);
  11731. }
  11732. }
  11733. _createAltitudePolyline() {
  11734. let _self = this;
  11735. if (!Cesium.defined(this._sketchAltitudePolyline)) {
  11736. this._sketchAltitudePolyline = new Cesium.Entity({
  11737. name: _self._sketchEntityName,
  11738. position: _self._sketchEllipseCenterPosition,
  11739. polyline: {
  11740. show: true,
  11741. positions: _self._sketchAltitudePolylinePostions,
  11742. material: _self._altitudeLineMaterial,
  11743. width: _self._param.altitudeLineWidth,
  11744. clampToGround: false
  11745. },
  11746. ellipse: {
  11747. show: true,
  11748. semiMinorAxis: _self._sketchEllipseRadius,
  11749. semiMajorAxis: _self._sketchEllipseRadius,
  11750. height: _self._sketchEllipseHeight,
  11751. material: _self._toColorFromArray(_self._param.ellipseColor),
  11752. outline: _self._param.ellipseOutline,
  11753. outlineWidth: _self._param.ellipseOutlineWidth,
  11754. outlineColor: _self._toColorFromArray(_self._param.ellipseOutlineColor)
  11755. }
  11756. });
  11757. _self._entities.add(_self._sketchAltitudePolyline);
  11758. }
  11759. }
  11760. _callEllipseOutlineCoordinate() {
  11761. let _self = this;
  11762. return function() {
  11763. let positionCenter = _self._sketchEllipseCenterPosition;
  11764. let positionRotate = _self._sketchTempPoints[1];
  11765. _self._ellipseOutlineCoordinates = [];
  11766. for (let angle = 5; angle < 360; ) {
  11767. let newPosition = _self._rotatedPointByAngle(positionRotate, positionCenter, angle);
  11768. _self._ellipseOutlineCoordinates.push(newPosition);
  11769. angle = angle + 5;
  11770. }
  11771. _self._ellipseOutlineCoordinates.push(_self._ellipseOutlineCoordinates[0]);
  11772. return _self._ellipseOutlineCoordinates;
  11773. };
  11774. }
  11775. _createTempCircle(centerPosition) {
  11776. let _self = this;
  11777. if (!Cesium.defined(this._sketchTempCircle)) {
  11778. _self._sketchEllipseCenterPosition = centerPosition.clone();
  11779. this._sketchTempCircle = new Cesium.Entity({
  11780. name: _self._sketchEntityName,
  11781. position: centerPosition,
  11782. polyline: {
  11783. show: true,
  11784. positions: new Cesium.CallbackProperty(_self._callEllipseOutlineCoordinate(), false),
  11785. material: _self._tempLineMaterial,
  11786. width: _self._param.moveLineWidth,
  11787. clampToGround: true
  11788. },
  11789. ellipse: {
  11790. show: true,
  11791. semiMinorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(), false),
  11792. semiMajorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(), false),
  11793. material: _self._tempPolygonMaterial,
  11794. classificationType: Cesium.ClassificationType.BOTH
  11795. }
  11796. });
  11797. _self._entities.add(_self._sketchTempCircle);
  11798. }
  11799. }
  11800. _rotatedPointByAngle(position_A, position_B, angle) {
  11801. var localToWorld_Matrix = Cesium.Transforms.eastNorthUpToFixedFrame(position_B);
  11802. var worldToLocal_Matrix = Cesium.Matrix4.inverse(localToWorld_Matrix, new Cesium.Matrix4());
  11803. Cesium.Matrix4.multiplyByPoint(worldToLocal_Matrix, position_B, new Cesium.Cartesian3());
  11804. var localPosition_A = Cesium.Matrix4.multiplyByPoint(worldToLocal_Matrix, position_A, new Cesium.Cartesian3());
  11805. var new_x = localPosition_A.x * Math.cos(Cesium.Math.toRadians(angle)) + localPosition_A.y * Math.sin(Cesium.Math.toRadians(angle));
  11806. var new_y = localPosition_A.y * Math.cos(Cesium.Math.toRadians(angle)) - localPosition_A.x * Math.sin(Cesium.Math.toRadians(angle));
  11807. var new_z = localPosition_A.z;
  11808. return Cesium.Matrix4.multiplyByPoint(
  11809. localToWorld_Matrix,
  11810. new Cesium.Cartesian3(new_x, new_y, new_z),
  11811. new Cesium.Cartesian3()
  11812. );
  11813. }
  11814. _createCircle() {
  11815. let _self = this;
  11816. if (!Cesium.defined(this._sketchCircle)) {
  11817. this._sketchCircle = new Cesium.Entity({
  11818. name: _self._sketchEntityName,
  11819. position: _self._sketchEllipseCenterPosition,
  11820. polyline: {
  11821. show: true,
  11822. positions: _self._ellipseOutlineCoordinates,
  11823. material: _self._lineMaterial,
  11824. width: _self._param.lineWidth,
  11825. clampToGround: true
  11826. },
  11827. ellipse: {
  11828. show: true,
  11829. semiMinorAxis: _self._sketchEllipseRadius,
  11830. semiMajorAxis: _self._sketchEllipseRadius,
  11831. material: _self._polygonMaterial,
  11832. classificationType: Cesium.ClassificationType.BOTH
  11833. }
  11834. });
  11835. _self._entities.add(_self._sketchCircle);
  11836. }
  11837. }
  11838. _callUpdateRectangleCoordinates() {
  11839. let _self = this;
  11840. return function() {
  11841. let lng0 = parseFloat(_self._sketchTempPoints[0].lng);
  11842. let lat0 = parseFloat(_self._sketchTempPoints[0].lat);
  11843. let lng1 = parseFloat(_self._sketchTempPoints[1].lng);
  11844. let lat1 = parseFloat(_self._sketchTempPoints[1].lat);
  11845. _self._rectangleCoordinates = [0, 0, 1, 1];
  11846. if (lng0 < lng1) {
  11847. _self._rectangleCoordinates[0] = lng0;
  11848. _self._rectangleCoordinates[2] = lng1;
  11849. } else {
  11850. _self._rectangleCoordinates[0] = lng1;
  11851. _self._rectangleCoordinates[2] = lng0;
  11852. }
  11853. if (lat0 < lat1) {
  11854. _self._rectangleCoordinates[1] = lat0;
  11855. _self._rectangleCoordinates[3] = lat1;
  11856. } else {
  11857. _self._rectangleCoordinates[1] = lat1;
  11858. _self._rectangleCoordinates[3] = lat0;
  11859. }
  11860. let rectangle = Cesium.Rectangle.fromDegrees(
  11861. _self._rectangleCoordinates[0],
  11862. _self._rectangleCoordinates[1],
  11863. _self._rectangleCoordinates[2],
  11864. _self._rectangleCoordinates[3]
  11865. );
  11866. let res = _self._calculateRectangleOutlineCoordinates(rectangle);
  11867. _self._rectangleOutlineCoordinates = res.cPoints;
  11868. _self._sketchOutputPoints = res.gPoints;
  11869. return rectangle;
  11870. };
  11871. }
  11872. _calculateRectangleOutlineCoordinates(rectangle) {
  11873. let south_east = Cesium.Rectangle.southeast(rectangle);
  11874. let se2 = Cesium.Cartographic.toCartesian(south_east);
  11875. let south_west = Cesium.Rectangle.southwest(rectangle);
  11876. let sw = Cesium.Cartographic.toCartesian(south_west);
  11877. let north_east = Cesium.Rectangle.northeast(rectangle);
  11878. let ne2 = Cesium.Cartographic.toCartesian(north_east);
  11879. let north_west = Cesium.Rectangle.northwest(rectangle);
  11880. let nw = Cesium.Cartographic.toCartesian(north_west);
  11881. let gPoints = [];
  11882. gPoints.push({
  11883. lng: Cesium.Math.toDegrees(south_west.longitude),
  11884. lat: Cesium.Math.toDegrees(south_west.latitude),
  11885. height: south_west.height
  11886. });
  11887. gPoints.push({
  11888. lng: Cesium.Math.toDegrees(south_east.longitude),
  11889. lat: Cesium.Math.toDegrees(south_east.latitude),
  11890. height: south_east.height
  11891. });
  11892. gPoints.push({
  11893. lng: Cesium.Math.toDegrees(north_east.longitude),
  11894. lat: Cesium.Math.toDegrees(north_east.latitude),
  11895. height: north_east.height
  11896. });
  11897. gPoints.push({
  11898. lng: Cesium.Math.toDegrees(north_west.longitude),
  11899. lat: Cesium.Math.toDegrees(north_west.latitude),
  11900. height: north_west.height
  11901. });
  11902. gPoints.push({
  11903. lng: Cesium.Math.toDegrees(south_west.longitude),
  11904. lat: Cesium.Math.toDegrees(south_west.latitude),
  11905. height: south_west.height
  11906. });
  11907. return {
  11908. cPoints: [sw, se2, ne2, nw, sw],
  11909. gPoints
  11910. };
  11911. }
  11912. _callUpdateRectangleOutlineCoordinates() {
  11913. let _self = this;
  11914. return function() {
  11915. return _self._rectangleOutlineCoordinates;
  11916. };
  11917. }
  11918. _createTempRectangle() {
  11919. let _self = this;
  11920. if (!Cesium.defined(this._sketchTempRectangle)) {
  11921. this._sketchTempRectangle = new Cesium.Entity({
  11922. name: _self._sketchEntityName,
  11923. polyline: {
  11924. show: true,
  11925. positions: new Cesium.CallbackProperty(_self._callUpdateRectangleOutlineCoordinates(), false),
  11926. material: _self._tempLineMaterial,
  11927. width: _self._param.moveLineWidth,
  11928. clampToGround: true
  11929. },
  11930. rectangle: {
  11931. show: true,
  11932. coordinates: new Cesium.CallbackProperty(_self._callUpdateRectangleCoordinates(), false),
  11933. material: _self._tempPolygonMaterial,
  11934. classificationType: Cesium.ClassificationType.BOTH
  11935. }
  11936. });
  11937. _self._entities.add(_self._sketchTempRectangle);
  11938. }
  11939. }
  11940. _createRectangle() {
  11941. let _self = this;
  11942. if (!Cesium.defined(this._sketchRectangle)) {
  11943. this._sketchRectangle = new Cesium.Entity({
  11944. name: _self._sketchEntityName,
  11945. polyline: {
  11946. show: true,
  11947. positions: _self._rectangleOutlineCoordinates,
  11948. material: _self._lineMaterial,
  11949. width: _self._param.lineWidth,
  11950. clampToGround: true
  11951. },
  11952. rectangle: {
  11953. show: true,
  11954. coordinates: Cesium.Rectangle.fromDegrees(_self._rectangleCoordinates[0], _self._rectangleCoordinates[1], _self._rectangleCoordinates[2], _self._rectangleCoordinates[3]),
  11955. material: _self._polygonMaterial,
  11956. classificationType: Cesium.ClassificationType.BOTH
  11957. }
  11958. });
  11959. _self._entities.add(_self._sketchRectangle);
  11960. }
  11961. }
  11962. _callUpdaeTriangleEllipseCenterPosition() {
  11963. let _self = this;
  11964. return function() {
  11965. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11966. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[2]);
  11967. _self._sketchEllipseCenterPosition = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
  11968. return _self._sketchEllipseCenterPosition;
  11969. };
  11970. }
  11971. _callUpdateTriangleAltitudePolylinePositions() {
  11972. let _self = this;
  11973. return function() {
  11974. _self._sketchAltitudePolylinePostions = [];
  11975. _self._sketchAltitudePolylinePostions.push(_self._sketchTempPoints[1]);
  11976. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11977. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[2]);
  11978. let point_temp = Cesium.Cartesian3.fromDegrees(
  11979. Cesium.Math.toDegrees(
  11980. point1cartographic.longitude
  11981. ),
  11982. Cesium.Math.toDegrees(point1cartographic.latitude),
  11983. point2cartographic.height
  11984. );
  11985. _self._sketchAltitudePolylinePostions.push(point_temp);
  11986. return _self._sketchAltitudePolylinePostions;
  11987. };
  11988. }
  11989. _callUpdateTriangleEllipseMinorAxis() {
  11990. let _self = this;
  11991. return function() {
  11992. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11993. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[2]);
  11994. let geodesic = new Cesium.EllipsoidGeodesic();
  11995. geodesic.setEndPoints(point1cartographic, point2cartographic);
  11996. _self._sketchEllipseRadius = geodesic.surfaceDistance;
  11997. if (_self._sketchEllipseRadius <= 0)
  11998. _self._sketchEllipseRadius = 1;
  11999. return _self._sketchEllipseRadius;
  12000. };
  12001. }
  12002. _callUpdateTriangleEllipseHeight() {
  12003. let _self = this;
  12004. return function() {
  12005. let cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  12006. let cartographic1 = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[2]);
  12007. let height_temp = cartographic1.height - cartographic.height;
  12008. _self._sketchEllipseHeight = height_temp + _self._sketchAltitudeInitHeight;
  12009. return _self._sketchEllipseHeight;
  12010. };
  12011. }
  12012. _callUpdateTriangleSpatialPolylinePositions() {
  12013. let _self = this;
  12014. return function() {
  12015. _self._sketchTriangleSpatialPolylinePositions = [];
  12016. _self._sketchTriangleSpatialPolylinePositions.push(_self._sketchTempPoints[0]);
  12017. _self._sketchTriangleSpatialPolylinePositions.push(_self._sketchEllipseCenterPosition);
  12018. return _self._sketchTriangleSpatialPolylinePositions;
  12019. };
  12020. }
  12021. _createTriangleSpatialPolyline() {
  12022. let _self = this;
  12023. this._sketchSpatialPolyline = new Cesium.Entity({
  12024. name: _self._sketchEntityName,
  12025. polyline: {
  12026. show: true,
  12027. positions: _self._sketchTriangleSpatialPolylinePositions,
  12028. material: _self._spatialLineMaterial,
  12029. width: _self._param.spatialLineWidth,
  12030. clampToGround: false
  12031. }
  12032. });
  12033. this._entities.add(this._sketchSpatialPolyline);
  12034. }
  12035. _createTempTriangleAltitudePolylineAndSpatialPolyline() {
  12036. let _self = this;
  12037. if (!Cesium.defined(this._sketchTempTriangleAltitudePolyline) && !Cesium.defined(this._sketchTempSpatialPolyline)) {
  12038. this._sketchTempTriangleAltitudePolyline = new Cesium.Entity({
  12039. name: _self._sketchEntityName,
  12040. position: new Cesium.CallbackProperty(
  12041. _self._callUpdaeTriangleEllipseCenterPosition(),
  12042. false
  12043. ),
  12044. polyline: {
  12045. show: true,
  12046. positions: new Cesium.CallbackProperty(
  12047. _self._callUpdateTriangleAltitudePolylinePositions(),
  12048. false
  12049. ),
  12050. material: _self._tempAlititudeLineMaterial,
  12051. width: _self._param.moveAltitudeLineWidth,
  12052. clampToGround: false
  12053. },
  12054. ellipse: {
  12055. show: true,
  12056. semiMinorAxis: new Cesium.CallbackProperty(_self._callUpdateTriangleEllipseMinorAxis(), false),
  12057. semiMajorAxis: new Cesium.CallbackProperty(_self._callUpdateTriangleEllipseMinorAxis(), false),
  12058. height: new Cesium.CallbackProperty(_self._callUpdateTriangleEllipseHeight(), false),
  12059. material: _self._toColorFromArray(_self._param.moveEllipseColor),
  12060. outline: _self._param.moveEllipseOutline,
  12061. outlineWidth: _self._param.moveEllipseOutlineWidth,
  12062. outlineColor: _self._toColorFromArray(_self._param.moveEllipseOutlineColor)
  12063. }
  12064. });
  12065. _self._entities.add(_self._sketchTempTriangleAltitudePolyline);
  12066. _self._sketchTempSpatialPolyline = new Cesium.Entity({
  12067. name: _self._sketchEntityName,
  12068. polyline: {
  12069. show: true,
  12070. positions: new Cesium.CallbackProperty(_self._callUpdateTriangleSpatialPolylinePositions(), false),
  12071. material: _self._tempLineMaterial,
  12072. width: _self._param.moveLineWidth,
  12073. clampToGround: false
  12074. }
  12075. });
  12076. _self._entities.add(_self._sketchTempSpatialPolyline);
  12077. }
  12078. }
  12079. _createTempSpatialTriangle() {
  12080. let _self = this;
  12081. if (!Cesium.defined(this._sketchTempSpatialTriangle)) {
  12082. this._sketchTempSpatialTriangle = new Cesium.Entity({
  12083. name: _self._sketchEntityName,
  12084. polyline: {
  12085. show: true,
  12086. positions: new Cesium.CallbackProperty(function() {
  12087. _self._sketchSpatialTrianglePositions = [];
  12088. _self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[0].clone());
  12089. _self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[1].clone());
  12090. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  12091. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  12092. let point_temp = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
  12093. _self._sketchSpatialTrianglePositions.push(point_temp);
  12094. _self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[0].clone());
  12095. return _self._sketchSpatialTrianglePositions;
  12096. }, false),
  12097. material: _self._tempLineMaterial,
  12098. width: _self._param.moveLineWidth,
  12099. clampToGround: false
  12100. }
  12101. });
  12102. this._entities.add(this._sketchTempSpatialTriangle);
  12103. this._updateScene();
  12104. }
  12105. }
  12106. _createSpatialTriangle() {
  12107. let _self = this;
  12108. if (!Cesium.defined(this._sketchSpatialTriangle)) {
  12109. this._sketchSpatialTriangle = new Cesium.Entity({
  12110. name: _self._sketchEntityName,
  12111. polyline: {
  12112. show: true,
  12113. positions: _self._sketchSpatialTrianglePositions,
  12114. material: _self._lineMaterial,
  12115. width: _self._param.lineWidth,
  12116. clampToGround: false
  12117. }
  12118. });
  12119. this._entities.add(this._sketchSpatialTriangle);
  12120. this._updateScene();
  12121. }
  12122. }
  12123. _setMoveLineStyle(options2) {
  12124. let _self = this;
  12125. let color2 = [255, 255, 255, 1];
  12126. let lineWidth = 3;
  12127. let isOutline = false;
  12128. let power = 0.2;
  12129. let outlineColor = [255, 0, 0, 1];
  12130. let outlineWidth = 1;
  12131. if (options2 && options2.color && options2.color.length === 4)
  12132. color2 = options2.color;
  12133. if (options2 && options2.outline && typeof options2.outline === "boolean")
  12134. isOutline = options2.outline;
  12135. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12136. outlineColor = options2.outlineColor;
  12137. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12138. outlineWidth = options2.outlineWidth;
  12139. if (options2 && options2.lineWidth && typeof options2.lineWidth === "number")
  12140. lineWidth = options2.lineWidth;
  12141. if (options2 && options2.power)
  12142. power = options2.power;
  12143. if (isOutline) {
  12144. this._tempLineMaterial = new Cesium.PolylineOutlineMaterialProperty({
  12145. color: _self._toColorFromArray(color2),
  12146. outlineColor: _self._toColorFromArray(outlineColor),
  12147. outlineWidth
  12148. });
  12149. } else {
  12150. if (power === void 0) {
  12151. this._tempLineMaterial = new Cesium.PolylineDashMaterialProperty({
  12152. color: _self._toColorFromArray(color2)
  12153. });
  12154. } else {
  12155. this._tempLineMaterial = new Cesium.PolylineGlowMaterialProperty({
  12156. color: _self._toColorFromArray(color2),
  12157. glowPower: power
  12158. });
  12159. }
  12160. }
  12161. this._param.moveLineWidth = lineWidth;
  12162. }
  12163. _setLineStyle(options2) {
  12164. let _self = this;
  12165. let color2 = [255, 255, 255, 1];
  12166. let lineWidth = 2;
  12167. let outlineColor = [0, 255, 0, 0.6];
  12168. let outlineWidth = 1;
  12169. if (options2 && options2.color && options2.color.length === 4)
  12170. color2 = options2.color;
  12171. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12172. outlineColor = options2.outlineColor;
  12173. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12174. outlineWidth = options2.outlineWidth;
  12175. if (options2 && options2.lineWidth && typeof options2.lineWidth === "number")
  12176. lineWidth = options2.lineWidth;
  12177. this._lineMaterial = new Cesium.PolylineOutlineMaterialProperty({
  12178. color: _self._toColorFromArray(color2),
  12179. outlineColor: _self._toColorFromArray(outlineColor),
  12180. outlineWidth
  12181. });
  12182. this._param.lineWidth = lineWidth;
  12183. }
  12184. _setSpatialLineStyle(options2) {
  12185. let _self = this;
  12186. let color2 = [255, 255, 0, 1];
  12187. let lineWidth = 2;
  12188. let outlineColor = [255, 255, 255, 1];
  12189. let outlineWidth = 1;
  12190. if (options2 && options2.color && options2.color.length === 4)
  12191. color2 = options2.color;
  12192. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12193. outlineColor = options2.outlineColor;
  12194. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12195. outlineWidth = options2.outlineWidth;
  12196. if (options2 && options2.lineWidth && typeof options2.lineWidth === "number")
  12197. lineWidth = options2.lineWidth;
  12198. this._spatialLineMaterial = new Cesium.PolylineOutlineMaterialProperty({
  12199. color: _self._toColorFromArray(color2),
  12200. outlineColor: _self._toColorFromArray(outlineColor),
  12201. outlineWidth
  12202. });
  12203. this._param.spatialLineWidth = lineWidth;
  12204. }
  12205. _setMovePolygonStyle(options2) {
  12206. let polygonColor = [255, 0, 0, 0.3];
  12207. if (options2 && options2.color && options2.color.length === 4)
  12208. polygonColor = options2.color;
  12209. this._tempPolygonMaterial = new Cesium.ColorMaterialProperty(this._toColorFromArray(polygonColor));
  12210. }
  12211. _setPolygonStyle(options2) {
  12212. let polygonColor = [0, 0, 255, 0.3];
  12213. if (options2 && options2.color && options2.color.length === 4)
  12214. polygonColor = options2.color;
  12215. this._polygonMaterial = new Cesium.ColorMaterialProperty(this._toColorFromArray(polygonColor));
  12216. }
  12217. _setMoveAltitudeLineStyle(options2) {
  12218. let _self = this;
  12219. let color2 = [255, 255, 255, 1];
  12220. let lineWidth = 2;
  12221. let isOutline = true;
  12222. let outlineColor = [255, 255, 0, 1];
  12223. let outlineWidth = 1;
  12224. if (options2 && options2.color && options2.color.length === 4)
  12225. color2 = options2.color;
  12226. if (options2 && options2.outline && typeof options2.outline === "boolean")
  12227. isOutline = options2.outline;
  12228. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12229. outlineColor = options2.outlineColor;
  12230. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12231. outlineWidth = options2.outlineWidth;
  12232. if (options2 && options2.lineWidth && typeof options2.lineWidth === "number")
  12233. lineWidth = options2.lineWidth;
  12234. if (isOutline) {
  12235. this._tempAlititudeLineMaterial = new Cesium.PolylineOutlineMaterialProperty({
  12236. color: _self._toColorFromArray(color2),
  12237. outlineColor: _self._toColorFromArray(outlineColor),
  12238. outlineWidth
  12239. });
  12240. } else {
  12241. this._tempAlititudeLineMaterial = new Cesium.PolylineDashMaterialProperty({
  12242. color: _self._toColorFromArray(color2)
  12243. });
  12244. }
  12245. this._param.moveAltitudeLineWidth = lineWidth;
  12246. }
  12247. _setAltitudeLineStyle(options2) {
  12248. let _self = this;
  12249. let color2 = [255, 255, 255, 1];
  12250. let lineWidth = 2;
  12251. let outlineColor = [0, 0, 255, 1];
  12252. let outlineWidth = 1;
  12253. if (options2 && options2.color && options2.color.length === 4)
  12254. color2 = options2.color;
  12255. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12256. outlineColor = options2.outlineColor;
  12257. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12258. outlineWidth = options2.outlineWidth;
  12259. if (options2 && options2.lineWidth && typeof options2.lineWidth === "number")
  12260. lineWidth = options2.lineWidth;
  12261. this._altitudeLineMaterial = new Cesium.PolylineOutlineMaterialProperty({
  12262. color: _self._toColorFromArray(color2),
  12263. outlineColor: _self._toColorFromArray(outlineColor),
  12264. outlineWidth
  12265. });
  12266. this._param.altitudeLineWidth = lineWidth;
  12267. }
  12268. _setMoveEllipseStyle(options2) {
  12269. if (options2 && options2.color && options2.color.length === 4)
  12270. this._param.moveEllipseColor = options2.color;
  12271. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12272. this._param.moveEllipseOutlineWidth = options2.outlineWidth;
  12273. if (options2 && options2.outline && typeof options2.outline === "boolean")
  12274. this._param.moveEllipseOutline = options2.outline;
  12275. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12276. this._param.moveEllipseOutlineColor = options2.outlineColor;
  12277. }
  12278. _setEllipseStyle(options2) {
  12279. if (options2 && options2.color && options2.color.length === 4)
  12280. this._param.ellipseColor = options2.color;
  12281. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12282. this._param.ellipseOutlineWidth = options2.outlineWidth;
  12283. if (options2 && options2.outline && typeof options2.outline === "boolean")
  12284. this._param.ellipseOutline = options2.outline;
  12285. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12286. this._param.ellipseOutlineColor = options2.outlineColor;
  12287. }
  12288. _clear(isAll) {
  12289. if (isAll != void 0 && isAll === true) {
  12290. this._removeEntityByName(this._sketchEntityName);
  12291. this._removePointEntitys();
  12292. }
  12293. this._sketchTempPoints = [];
  12294. this._sketchPoints = [];
  12295. this._sketchOutputPoints = [];
  12296. this._sketchTempPolyline = void 0;
  12297. this._sketchPolyline = void 0;
  12298. this._sketchTempPolygon = void 0;
  12299. this._sketchPolygon = void 0;
  12300. this._sketchTempAltituePolyline = void 0;
  12301. this._sketchAltitudePolyline = void 0;
  12302. this._sketchTempSpatialPolyline = void 0;
  12303. this._sketchSpatialPolyline = void 0;
  12304. this._sketchTempCircle = void 0;
  12305. this._sketchCircle = void 0;
  12306. this._sketchTempRectangle = void 0;
  12307. this._sketchRectangle = void 0;
  12308. this._sketchTempTriangleAltitudePolyline = void 0;
  12309. this._sketchTriangleAltituePolyline = void 0;
  12310. this._sketchTempSpatialTriangle = void 0;
  12311. this._sketchSpatialTriangle = void 0;
  12312. }
  12313. _checkAppOrWeb() {
  12314. if (window.navigator.userAgent.match(
  12315. /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
  12316. )) {
  12317. return SketchViewModel.RuntimeEnvironment.App;
  12318. } else {
  12319. return SketchViewModel.RuntimeEnvironment.Web;
  12320. }
  12321. }
  12322. _isRuntimeApp() {
  12323. if (this._checkAppOrWeb() === SketchViewModel.RuntimeEnvironment.App) {
  12324. return true;
  12325. }
  12326. return false;
  12327. }
  12328. }
  12329. Object.assign(SketchViewModel.prototype, {
  12330. setMoveLineStyle: function(options2) {
  12331. this._setMoveLineStyle(options2);
  12332. },
  12333. setLineStyle: function(options2) {
  12334. this._setLineStyle(options2);
  12335. },
  12336. setSpatialLineStyle: function() {
  12337. this._setSpatialLineStyle(options);
  12338. },
  12339. setMovePolygonStyle: function(options2) {
  12340. this._setMovePolygonStyle(options2);
  12341. },
  12342. setPolygonStyle: function(options2) {
  12343. this._setPolygonStyle(options2);
  12344. },
  12345. setMoveAltitudeLineStyle: function(options2) {
  12346. this._setMoveAltitudeLineStyle(options2);
  12347. },
  12348. setAltitudeLineStyle: function(options2) {
  12349. this._setAltitudeLineStyle(options2);
  12350. },
  12351. setMoveEllipseStyle: function(options2) {
  12352. this._setMoveEllipseStyle(options2);
  12353. },
  12354. setEllipseStyle: function(options2) {
  12355. this._setEllipseStyle(options2);
  12356. },
  12357. setLabel: function(options2) {
  12358. if (!options2) {
  12359. options2 = {
  12360. lineLabel: void 0,
  12361. polygonLabel: void 0
  12362. };
  12363. }
  12364. if (options2.lineLabel)
  12365. this._lineLabel = options2.lineLabel;
  12366. if (options2.polygonLabel)
  12367. this._lineLabel = options2.polygonLabel;
  12368. }
  12369. });
  12370. Object.assign(SketchViewModel.prototype, {
  12371. _registerLeftClickEvent: function(handler, callChange) {
  12372. let _self = this;
  12373. if (!handler)
  12374. return;
  12375. handler.setInputAction(function(event2) {
  12376. _self._lock = true;
  12377. if (_self._timer != null)
  12378. clearTimeout(_self._timer);
  12379. _self._timer = setTimeout(function() {
  12380. if (callChange)
  12381. callChange(event2);
  12382. _self._lock = false;
  12383. }, 200);
  12384. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  12385. },
  12386. _registerLeftDoubleClickEvent: function(handler, callChange) {
  12387. let _self = this;
  12388. if (!handler)
  12389. return;
  12390. handler.setInputAction(function(event2) {
  12391. if (_self._timer != null)
  12392. clearTimeout(_self._timer);
  12393. _self._lock = false;
  12394. if (callChange)
  12395. callChange(event2);
  12396. }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  12397. },
  12398. _registerMouseMoveEvent: function(handler, callChange) {
  12399. let _self = this;
  12400. if (!handler)
  12401. return;
  12402. handler.setInputAction(function(event2) {
  12403. if (_self._lock === void 0 || _self._lock === false) {
  12404. if (callChange)
  12405. callChange(event2);
  12406. }
  12407. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  12408. },
  12409. _registerRightClickEvent: function(handler, callChange) {
  12410. if (!handler)
  12411. return;
  12412. handler.setInputAction(function(event2) {
  12413. if (callChange)
  12414. callChange(event2);
  12415. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  12416. },
  12417. _clearEvent: function(handler) {
  12418. if (!handler)
  12419. return;
  12420. handler.destroy();
  12421. handler = null;
  12422. }
  12423. });
  12424. Object.assign(SketchViewModel.prototype, {
  12425. _sketchDrawPoint(handler, options2) {
  12426. let _self = this;
  12427. this._registerLeftClickEvent(handler, function(event2) {
  12428. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12429. if (!Cesium.defined(loc2.sLocation))
  12430. return;
  12431. if (_self._isDrawPoint) {
  12432. _self._createPoint(loc2.sLocation, _self._lineLabel);
  12433. }
  12434. _self._clearEvent(handler);
  12435. if (options2.onComplete)
  12436. options2.onComplete(loc2.sLocation, loc2.gLocation);
  12437. });
  12438. },
  12439. _sketchDrawMultiplePoint(handler, options2) {
  12440. let _self = this;
  12441. this._registerLeftClickEvent(handler, function(event2) {
  12442. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12443. if (!Cesium.defined(loc2.sLocation))
  12444. return;
  12445. if (_self._isDrawPoint) {
  12446. _self._createPoint(loc2.sLocation, _self._lineLabel);
  12447. }
  12448. _self._sketchPoints.push(loc2.sLocation);
  12449. _self._sketchOutputPoints.push(loc2.gLocation);
  12450. if (options2.onAdded)
  12451. options2.onAdded(loc2.sLocation, loc2.gLocation);
  12452. });
  12453. this._registerRightClickEvent(handler, function(event2) {
  12454. if (_self._sketchPoints.length > 0) {
  12455. _self._sketchPoints.pop();
  12456. _self._sketchOutputPoints.pop();
  12457. if (options2.onUndo)
  12458. options2.onUndo();
  12459. }
  12460. });
  12461. this._registerLeftDoubleClickEvent(handler, function(event2) {
  12462. _self._clearEvent();
  12463. if (options2.onComplete)
  12464. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  12465. });
  12466. },
  12467. _sketchDrawPolyline(handler, options2) {
  12468. let _self = this;
  12469. this._registerLeftClickEvent(handler, function(event2) {
  12470. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12471. if (!Cesium.defined(loc2.sLocation))
  12472. return;
  12473. if (_self._isDrawPoint) {
  12474. _self._createPoint(loc2.sLocation, _self._lineLabel);
  12475. }
  12476. if (_self._sketchTempPoints.length === 0) {
  12477. _self._createTempPolyline();
  12478. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12479. }
  12480. _self._sketchTempPoints.push(loc2.sLocation);
  12481. _self._sketchPoints.push(loc2.sLocation.clone());
  12482. _self._sketchOutputPoints.push(loc2.gLocation);
  12483. if (options2.onAdded)
  12484. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  12485. });
  12486. this._registerMouseMoveEvent(handler, function(event2) {
  12487. if (_self._isRuntimeApp())
  12488. return;
  12489. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  12490. if (!Cesium.defined(loc2.sLocation))
  12491. return;
  12492. if (Cesium.defined(_self._sketchTempPolyline)) {
  12493. _self._sketchTempPoints.pop();
  12494. _self._sketchTempPoints.push(loc2.sLocation);
  12495. if (options2.onMoving)
  12496. options2.onMoving(loc2.sLocation);
  12497. }
  12498. });
  12499. this._registerRightClickEvent(handler, function(event2) {
  12500. if (_self._sketchTempPoints.length > 2) {
  12501. _self._sketchPoints.pop();
  12502. _self._sketchTempPoints.splice(_self._sketchTempPoints.length - 2, 1);
  12503. if (_self._isDrawPoint) {
  12504. let lastPointEntity = _self._pointEntitys[_self._pointEntitys.length - 1];
  12505. _self._entities.remove(lastPointEntity);
  12506. _self._pointEntitys.pop();
  12507. }
  12508. if (options2.onUndo)
  12509. options2.onUndo();
  12510. }
  12511. });
  12512. this._registerLeftDoubleClickEvent(handler, function(event2) {
  12513. if (_self._isRuntimeApp())
  12514. return;
  12515. if (_self._sketchPoints.length < 2) {
  12516. if (options2.onError)
  12517. options2.onError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  12518. return;
  12519. }
  12520. _self._removeEntityByObject(_self._sketchTempPolyline);
  12521. _self._createPolyline();
  12522. if (!_self._isRetainDrawPoint)
  12523. _self._removePointEntitys();
  12524. _self._clearEvent(handler);
  12525. if (options2.onComplete)
  12526. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  12527. });
  12528. },
  12529. _sketchDrawSpatialPolyline(handler, options2) {
  12530. let _self = this;
  12531. this._registerLeftClickEvent(handler, function(event2) {
  12532. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12533. if (!Cesium.defined(loc2.sLocation))
  12534. return;
  12535. if (_self._isDrawPoint) {
  12536. _self._createPoint(loc2.sLocation, _self._lineLabel);
  12537. }
  12538. if (_self._sketchTempPoints.length === 0) {
  12539. _self._createTempSpatialPolyline();
  12540. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12541. }
  12542. _self._sketchTempPoints.push(loc2.sLocation);
  12543. _self._sketchPoints.push(loc2.sLocation.clone());
  12544. _self._sketchOutputPoints.push(loc2.gLocation);
  12545. if (options2.onAdded)
  12546. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  12547. });
  12548. this._registerMouseMoveEvent(handler, function(event2) {
  12549. if (_self._isRuntimeApp())
  12550. return;
  12551. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  12552. if (!Cesium.defined(loc2.sLocation))
  12553. return;
  12554. if (Cesium.defined(_self._sketchTempSpatialPolyline)) {
  12555. _self._sketchTempPoints.pop();
  12556. _self._sketchTempPoints.push(loc2.sLocation);
  12557. if (options2.onMoving)
  12558. options2.onMoving(loc2.sLocation);
  12559. }
  12560. });
  12561. this._registerLeftDoubleClickEvent(handler, function(event2) {
  12562. if (_self._isRuntimeApp())
  12563. return;
  12564. if (_self._sketchPoints.length < 2) {
  12565. if (options2.onError)
  12566. options2.onError("\u7ED8\u5236\u70B9\u5C11\u4E8E2\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  12567. return;
  12568. }
  12569. _self._removeEntityByObject(_self._sketchTempSpatialPolyline);
  12570. _self._createSpatialPolyline();
  12571. _self._removePointEntitys();
  12572. _self._clearEvent(handler);
  12573. if (options2.onComplete)
  12574. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  12575. });
  12576. this._registerRightClickEvent(handler, function(event2) {
  12577. if (_self._sketchTempPoints.length > 2) {
  12578. _self._sketchPoints.pop();
  12579. _self._sketchTempPoints.splice(_self._sketchTempPoints.length - 2, 1);
  12580. if (options2.onUndo)
  12581. options2.onUndo();
  12582. }
  12583. });
  12584. },
  12585. _sketchDrawPolygon(handler, options2) {
  12586. let _self = this;
  12587. this._registerLeftClickEvent(handler, function(event2) {
  12588. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12589. if (!Cesium.defined(loc2.sLocation))
  12590. return;
  12591. if (_self._isDrawPoint) {
  12592. _self._createPoint(loc2.sLocation, _self._lineLabel);
  12593. }
  12594. if (_self._sketchTempPoints.length === 0) {
  12595. _self._createTempPolygon();
  12596. _self._createTempPolyline();
  12597. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12598. }
  12599. _self._sketchTempPoints.push(loc2.sLocation);
  12600. _self._sketchPoints.push(loc2.sLocation.clone());
  12601. _self._sketchOutputPoints.push(loc2.gLocation);
  12602. if (options2.onAdded)
  12603. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  12604. });
  12605. this._registerMouseMoveEvent(handler, function(event2) {
  12606. if (_self._isRuntimeApp())
  12607. return;
  12608. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  12609. if (!Cesium.defined(loc2.sLocation))
  12610. return;
  12611. if (Cesium.defined(_self._sketchTempPolygon)) {
  12612. _self._sketchTempPoints.pop();
  12613. _self._sketchTempPoints.push(loc2.sLocation);
  12614. if (options2.onMoving)
  12615. options2.onMoving(loc2.sLocation);
  12616. }
  12617. });
  12618. this._registerRightClickEvent(handler, function(event2) {
  12619. if (_self._sketchTempPoints.length > 2) {
  12620. _self._sketchPoints.pop();
  12621. _self._sketchTempPoints.splice(_self._sketchTempPoints.length - 2, 1);
  12622. if (_self._isDrawPoint) {
  12623. let lastPointEntity = _self._pointEntitys[_self._pointEntitys.length - 1];
  12624. _self._entities.remove(lastPointEntity);
  12625. _self._pointEntitys.pop();
  12626. }
  12627. if (options2.onUndo)
  12628. options2.onUndo();
  12629. }
  12630. });
  12631. this._registerLeftDoubleClickEvent(handler, function(event2) {
  12632. if (_self._isRuntimeApp())
  12633. return;
  12634. if (_self._sketchPoints.length < 3) {
  12635. if (options2.onError)
  12636. options2.onError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  12637. return;
  12638. }
  12639. _self._removeEntityByObject(_self._sketchTempPolygon);
  12640. _self._removeEntityByObject(_self._sketchTempPolyline);
  12641. _self._createPolygon();
  12642. if (!_self._isRetainDrawPoint)
  12643. _self._removePointEntitys();
  12644. _self._clearEvent(handler);
  12645. if (options2.onComplete)
  12646. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  12647. });
  12648. },
  12649. _sketchDrawCircle: function(handler, options2) {
  12650. let _self = this;
  12651. this._registerLeftClickEvent(handler, function(event2) {
  12652. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12653. if (!Cesium.defined(loc2.sLocation))
  12654. return;
  12655. if (_self._sketchTempPoints.length === 0) {
  12656. if (_self._isDrawPoint) {
  12657. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  12658. }
  12659. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12660. _self._sketchTempPoints.push(loc2.sLocation);
  12661. _self._sketchPoints.push(loc2.sLocation.clone());
  12662. _self._sketchOutputPoints.push(loc2.gLocation);
  12663. _self._createTempCircle(loc2.sLocation);
  12664. if (options2.onAdded)
  12665. options2.onAdded(loc2.sLocation);
  12666. } else {
  12667. if (_self._isRuntimeApp()) {
  12668. _self._sketchTempPoints.pop();
  12669. _self._sketchTempPoints.push(loc2.sLocation);
  12670. let positionCenter = _self._sketchEllipseCenterPosition;
  12671. let positionRotate = _self._sketchTempPoints[1];
  12672. _self._ellipseOutlineCoordinates = [];
  12673. for (let angle = 5; angle < 360; ) {
  12674. let newPosition = _self._rotatedPointByAngle(positionRotate, positionCenter, angle);
  12675. _self._ellipseOutlineCoordinates.push(newPosition);
  12676. angle = angle + 5;
  12677. }
  12678. _self._ellipseOutlineCoordinates.push(_self._ellipseOutlineCoordinates[0]);
  12679. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  12680. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  12681. let geodesic = new Cesium.EllipsoidGeodesic();
  12682. geodesic.setEndPoints(point1cartographic, point2cartographic);
  12683. _self._sketchEllipseRadius = geodesic.surfaceDistance;
  12684. if (_self._sketchEllipseRadius <= 0)
  12685. _self._sketchEllipseRadius = 1;
  12686. }
  12687. _self._removePointEntitys();
  12688. _self._removeEntityByObject(_self._sketchTempCircle);
  12689. _self._createCircle();
  12690. _self._clearEvent(handler);
  12691. if (options2.onComplete)
  12692. options2.onComplete(_self._sketchOutputPoints[0], _self._sketchEllipseRadius);
  12693. }
  12694. });
  12695. this._registerMouseMoveEvent(handler, function(event2) {
  12696. if (_self._isRuntimeApp())
  12697. return;
  12698. if (!Cesium.defined(_self._sketchTempCircle))
  12699. return;
  12700. var cartesian = _self._viewer.scene.pickPosition(event2.endPosition);
  12701. if (cartesian == void 0)
  12702. return;
  12703. _self._sketchTempPoints.pop();
  12704. _self._sketchTempPoints.push(cartesian);
  12705. });
  12706. },
  12707. _sketchDrawHeightPolyline: function(handler, options2) {
  12708. let _self = this;
  12709. this._registerLeftClickEvent(handler, function(event2) {
  12710. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12711. if (!Cesium.defined(loc2.sLocation))
  12712. return;
  12713. if (_self._sketchTempPoints.length === 0) {
  12714. if (_self._isDrawPoint) {
  12715. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  12716. }
  12717. _self._sketchAltitudeInitHeight = loc2.gLocation.height;
  12718. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12719. _self._sketchTempPoints.push(loc2.sLocation);
  12720. _self._sketchPoints.push(loc2.sLocation.clone());
  12721. if (options2.onAdded)
  12722. options2.onAdded(loc2.sLocation);
  12723. } else {
  12724. if (_self._isRuntimeApp()) {
  12725. _self._sketchTempPoints.pop();
  12726. _self._sketchTempPoints.push(loc2.sLocation);
  12727. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  12728. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  12729. _self._sketchEllipseCenterPosition = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
  12730. _self._sketchAltitudePolylinePostions = [];
  12731. _self._sketchAltitudePolylinePostions.push(_self._sketchTempPoints[0]);
  12732. let point_temp = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
  12733. _self._sketchAltitudePolylinePostions.push(point_temp);
  12734. let geodesic = new Cesium.EllipsoidGeodesic();
  12735. geodesic.setEndPoints(point1cartographic, point2cartographic);
  12736. _self._sketchEllipseRadius = geodesic.surfaceDistance;
  12737. if (_self._sketchEllipseRadius <= 0)
  12738. _self._sketchEllipseRadius = 1;
  12739. let height_temp = point2cartographic.height - point1cartographic.height;
  12740. _self._sketchEllipseHeight = height_temp + _self._sketchAltitudeInitHeight;
  12741. }
  12742. _self._removePointEntitys();
  12743. _self._removeEntityByObject(_self._sketchTempAltituePolyline);
  12744. _self._createAltitudePolyline();
  12745. _self._clearEvent(handler);
  12746. if (options2.onComplete) {
  12747. options2.onComplete(_self._sketchAltitudePolylinePostions, _self._sketchEllipseCenterPosition);
  12748. }
  12749. }
  12750. });
  12751. this._registerMouseMoveEvent(handler, function(event2) {
  12752. if (_self._isRuntimeApp())
  12753. return;
  12754. if (_self._sketchTempPoints == void 0 || _self._sketchTempPoints.length == 0)
  12755. return;
  12756. var cartesian = _self._viewer.scene.pickPosition(event2.endPosition);
  12757. if (cartesian == void 0)
  12758. return;
  12759. if (_self._sketchTempPoints.length >= 2) {
  12760. if (!Cesium.defined(_self._sketchTempAltituePolyline)) {
  12761. _self._createTempAltitudePolyline();
  12762. } else {
  12763. _self._sketchTempPoints.pop();
  12764. _self._sketchTempPoints.push(cartesian);
  12765. }
  12766. if (options2.onMoving) {
  12767. options2.onMoving(_self._sketchAltitudePolylinePostions, _self._sketchEllipseCenterPosition);
  12768. }
  12769. }
  12770. });
  12771. },
  12772. _sketchDrawRectangle: function(handler, options2) {
  12773. let _self = this;
  12774. this._registerLeftClickEvent(handler, function(event2) {
  12775. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12776. if (!Cesium.defined(loc2.sLocation))
  12777. return;
  12778. if (_self._sketchTempPoints.length === 0) {
  12779. if (_self._isDrawPoint) {
  12780. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  12781. }
  12782. _self._sketchTempPoints.push(loc2.gLocation);
  12783. _self._sketchTempPoints.push(loc2.gLocation);
  12784. _self._sketchPoints.push(loc2.gLocation);
  12785. _self._createTempRectangle();
  12786. if (options2.onAdded)
  12787. options2.onAdded(loc2.sLocation);
  12788. } else {
  12789. if (_self._isRuntimeApp()) {
  12790. _self._sketchTempPoints.pop();
  12791. _self._sketchTempPoints.push(loc2.gLocation);
  12792. let lng0 = parseFloat(_self._sketchTempPoints[0].lng);
  12793. let lat0 = parseFloat(_self._sketchTempPoints[0].lat);
  12794. let lng1 = parseFloat(_self._sketchTempPoints[1].lng);
  12795. let lat1 = parseFloat(_self._sketchTempPoints[1].lat);
  12796. _self._rectangleCoordinates = [0, 0, 1, 1];
  12797. if (lng0 < lng1) {
  12798. _self._rectangleCoordinates[0] = lng0;
  12799. _self._rectangleCoordinates[2] = lng1;
  12800. } else {
  12801. _self._rectangleCoordinates[0] = lng1;
  12802. _self._rectangleCoordinates[2] = lng0;
  12803. }
  12804. if (lat0 < lat1) {
  12805. _self._rectangleCoordinates[1] = lat0;
  12806. _self._rectangleCoordinates[3] = lat1;
  12807. } else {
  12808. _self._rectangleCoordinates[1] = lat1;
  12809. _self._rectangleCoordinates[3] = lat0;
  12810. }
  12811. let rectangle = Cesium.Rectangle.fromDegrees(_self._rectangleCoordinates[0], _self._rectangleCoordinates[1], _self._rectangleCoordinates[2], _self._rectangleCoordinates[3]);
  12812. let res = _self._calculateRectangleOutlineCoordinates(rectangle);
  12813. _self._rectangleOutlineCoordinates = res.cPoints;
  12814. _self._sketchOutputPoints = res.gPoints;
  12815. }
  12816. _self._removePointEntitys();
  12817. _self._removeEntityByObject(_self._sketchTempRectangle);
  12818. _self._createRectangle();
  12819. handler.destroy();
  12820. handler = null;
  12821. if (options2.onComplete)
  12822. options2.onComplete(_self._sketchOutputPoints);
  12823. }
  12824. });
  12825. this._registerMouseMoveEvent(handler, function(event2) {
  12826. if (_self._isRuntimeApp())
  12827. return;
  12828. if (!Cesium.defined(_self._sketchTempRectangle))
  12829. return;
  12830. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  12831. if (!Cesium.defined(loc2.sLocation))
  12832. return;
  12833. _self._sketchTempPoints.pop();
  12834. _self._sketchTempPoints.push(loc2.gLocation);
  12835. });
  12836. },
  12837. _sketchDrawTriangle: function(handler, options2) {
  12838. let _self = this;
  12839. handler.setInputAction(function(event2) {
  12840. if (Cesium.defined(_self._sketchTempAltituePolyline))
  12841. return;
  12842. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12843. if (!Cesium.defined(loc2.sLocation))
  12844. return;
  12845. if (_self._sketchPoints.length == 0) {
  12846. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  12847. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12848. _self._sketchTempPoints.push(loc2.sLocation);
  12849. _self._sketchPoints.push(loc2.sLocation);
  12850. _self._createTempPolyline();
  12851. } else if (_self._sketchPoints.length === 1) {
  12852. _self._createPoint(loc2.sLocation, "\u9AD8\u5EA6\u8D77\u70B9");
  12853. _self._entities.remove(_self._sketchTempPolyline);
  12854. _self._sketchPoints.push(loc2.sLocation);
  12855. _self._createPolyline();
  12856. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12857. _self._sketchPoints.push(loc2.sLocation);
  12858. _self._sketchAltitudeInitHeight = loc2.gLocation.height;
  12859. _self._createTempTriangleAltitudePolylineAndSpatialPolyline();
  12860. }
  12861. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  12862. handler.setInputAction(function(event2) {
  12863. if (_self._sketchPoints === void 0 || _self._sketchPoints.length === 0)
  12864. return;
  12865. var cartesian = _self._viewer.scene.pickPosition(event2.endPosition);
  12866. if (cartesian == void 0)
  12867. return;
  12868. _self._sketchTempPoints.pop();
  12869. _self._sketchTempPoints.push(cartesian);
  12870. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  12871. handler.setInputAction(function(event2) {
  12872. if (_self._sketchPoints.length < 2) {
  12873. if (options2.onError)
  12874. options2.onError("\u7ED8\u5236\u56FE\u5F62\u4E0D\u5B8C\u6574\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  12875. return;
  12876. }
  12877. _self._removePointEntitys();
  12878. _self._removeEntityByObject(_self._sketchTempTriangleAltitudePolyline);
  12879. _self._removeEntityByObject(_self._sketchTempSpatialPolyline);
  12880. _self._createAltitudePolyline();
  12881. _self._createTriangleSpatialPolyline();
  12882. handler.destroy();
  12883. handler = null;
  12884. options2.onComplete(
  12885. _self._sketchPoints,
  12886. _self._sketchTriangleSpatialPolylinePositions,
  12887. _self._sketchAltitudePolylinePostions,
  12888. _self._sketchEllipseCenterPosition
  12889. );
  12890. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  12891. },
  12892. _sketchDrawPolygonBody(handler, options2) {
  12893. let _self = this;
  12894. this._registerLeftClickEvent(handler, function(event2) {
  12895. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12896. if (!Cesium.defined(loc2.sLocation))
  12897. return;
  12898. if (_self._isDrawPoint) {
  12899. _self._createPoint(loc2.sLocation, _self._lineLabel);
  12900. }
  12901. if (_self._sketchTempPoints.length === 0) {
  12902. _self._createTempPolygon();
  12903. _self._createTempPolyline();
  12904. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12905. }
  12906. _self._sketchTempPoints.push(loc2.sLocation);
  12907. _self._sketchPoints.push(loc2.sLocation.clone());
  12908. _self._sketchOutputPoints.push(loc2.gLocation);
  12909. if (options2.onAdded)
  12910. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  12911. });
  12912. this._registerMouseMoveEvent(handler, function(event2) {
  12913. if (_self._isRuntimeApp())
  12914. return;
  12915. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  12916. if (!Cesium.defined(loc2.sLocation))
  12917. return;
  12918. if (Cesium.defined(_self._sketchTempPolygon)) {
  12919. _self._sketchTempPoints.pop();
  12920. _self._sketchTempPoints.push(loc2.sLocation);
  12921. if (options2.onMoving)
  12922. options2.onMoving(loc2.sLocation);
  12923. }
  12924. });
  12925. this._registerRightClickEvent(handler, function(event2) {
  12926. if (_self._sketchTempPoints.length > 2) {
  12927. _self._sketchPoints.pop();
  12928. _self._sketchOutputPoints.pop();
  12929. _self._sketchTempPoints.splice(_self._sketchTempPoints.length - 2, 1);
  12930. if (options2.onUndo)
  12931. options2.onUndo(_self._sketchPoints);
  12932. }
  12933. });
  12934. this._registerLeftDoubleClickEvent(handler, function(event2) {
  12935. if (_self._isRuntimeApp())
  12936. return;
  12937. if (_self._sketchPoints.length < 3) {
  12938. if (options2.onError)
  12939. options2.onError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  12940. return;
  12941. }
  12942. _self._removeEntityByObject(_self._sketchTempPolygon);
  12943. _self._removeEntityByObject(_self._sketchTempPolyline);
  12944. _self._createPolygonBody({
  12945. height: 30,
  12946. color: [255, 255, 0, 0.9]
  12947. });
  12948. _self._removePointEntitys();
  12949. _self._clearEvent(handler);
  12950. if (options2.onComplete)
  12951. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  12952. });
  12953. },
  12954. _sketchDrawTriangleA: function(handler, options2) {
  12955. let _self = this;
  12956. this._registerLeftClickEvent(handler, function(event2) {
  12957. if (Cesium.defined(_self._sketchTempAltituePolyline))
  12958. return;
  12959. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12960. if (!Cesium.defined(loc2.sLocation))
  12961. return;
  12962. if (_self._sketchPoints.length == 0) {
  12963. if (_self._isDrawPoint) {
  12964. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  12965. }
  12966. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12967. _self._sketchTempPoints.push(loc2.sLocation);
  12968. _self._sketchPoints.push(loc2.sLocation);
  12969. _self._createTempSpatialTriangle();
  12970. if (options2.onAdded)
  12971. options2.onAdded(loc2.sLocation);
  12972. } else if (_self._sketchPoints.length > 0) {
  12973. if (_self._isRuntimeApp()) {
  12974. _self._sketchTempPoints.pop();
  12975. _self._sketchTempPoints.push(loc2.sLocation);
  12976. _self._sketchSpatialTrianglePositions = [];
  12977. _self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[0].clone());
  12978. _self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[1].clone());
  12979. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  12980. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  12981. let point_temp = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
  12982. _self._sketchSpatialTrianglePositions.push(point_temp);
  12983. _self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[0].clone());
  12984. }
  12985. _self._removePointEntitys();
  12986. _self._removeEntityByObject(_self._sketchTempSpatialTriangle);
  12987. _self._createSpatialTriangle();
  12988. _self._clearEvent(handler);
  12989. if (options2.onComplete)
  12990. options2.onComplete(_self._sketchSpatialTrianglePositions);
  12991. }
  12992. });
  12993. this._registerMouseMoveEvent(handler, function(event2) {
  12994. if (_self._isRuntimeApp())
  12995. return;
  12996. if (_self._sketchPoints === void 0 || _self._sketchPoints.length === 0)
  12997. return;
  12998. var cartesian = _self._viewer.scene.pickPosition(event2.endPosition);
  12999. if (cartesian == void 0)
  13000. return;
  13001. _self._sketchTempPoints.pop();
  13002. _self._sketchTempPoints.push(cartesian);
  13003. if (options2.onMoving)
  13004. options2.onMoving(cartesian);
  13005. });
  13006. },
  13007. sketchTools: function(toolsType, options2) {
  13008. let _self = this;
  13009. this._clear();
  13010. _self._sketchEventHandler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  13011. switch (toolsType) {
  13012. case SketchViewModel.SketchType.Point:
  13013. _self._sketchDrawPoint(_self._sketchEventHandler, options2);
  13014. break;
  13015. case SketchViewModel.SketchType.Line:
  13016. _self._sketchDrawPolyline(_self._sketchEventHandler, options2);
  13017. break;
  13018. case SketchViewModel.SketchType.Polygon:
  13019. _self._sketchDrawPolygon(_self._sketchEventHandler, options2);
  13020. break;
  13021. case SketchViewModel.SketchType.Height:
  13022. _self._sketchDrawHeightPolyline(_self._sketchEventHandler, options2);
  13023. break;
  13024. case SketchViewModel.SketchType.Spatial:
  13025. _self._sketchDrawSpatialPolyline(_self._sketchEventHandler, options2);
  13026. break;
  13027. case SketchViewModel.SketchType.Circle:
  13028. _self._sketchDrawCircle(_self._sketchEventHandler, options2);
  13029. break;
  13030. case SketchViewModel.SketchType.Rectangle:
  13031. _self._sketchDrawRectangle(_self._sketchEventHandler, options2);
  13032. break;
  13033. case SketchViewModel.SketchType.Triangle:
  13034. _self._sketchDrawTriangleA(_self._sketchEventHandler, options2);
  13035. break;
  13036. case SketchViewModel.SketchType.PolygonBody:
  13037. _self._sketchDrawPolygonBody(_self._sketchEventHandler, options2);
  13038. break;
  13039. case SketchViewModel.SketchType.MultiplePoint:
  13040. _self._sketchDrawMultiplePoint(_self._sketchEventHandler, options2);
  13041. break;
  13042. }
  13043. },
  13044. sketchDrawFeacture: function(points2, type2, options2) {
  13045. let _self = this;
  13046. if (points2 === void 0 || points2.length === void 0 || points2.length < 2) {
  13047. if (options2 && options2.onError)
  13048. options2.onError("\u8F93\u5165\u7684\u5750\u6807\u96C6\u5408\u5F02\u5E38\uFF01");
  13049. return;
  13050. }
  13051. this._sketchPoints = [];
  13052. for (let i2 = 0; i2 < points2.length; ) {
  13053. this._sketchPoints.push(Cesium.Cartesian3.fromDegrees(points2[i2], points2[i2 + 1], points2[i2 + 2]));
  13054. i2 = i2 + 3;
  13055. }
  13056. switch (type2) {
  13057. case SketchViewModel.SketchType.DrawPoint:
  13058. _self._createPoint(_self._sketchPoints[0], _self._lineLabel);
  13059. if (options2 && options2.onComplete)
  13060. options2.onComplete(_self._pointEntitys);
  13061. break;
  13062. case SketchViewModel.SketchType.DrawMultiplePoint:
  13063. for (let i2 = 0; i2 < _self._sketchPoints.length; i2++) {
  13064. _self._createPoint(_self._sketchPoints[i2], _self._lineLabel);
  13065. }
  13066. if (options2 && options2.onComplete)
  13067. options2.onComplete(_self._pointEntitys);
  13068. break;
  13069. case SketchViewModel.SketchType.DrawPolyline:
  13070. if (_self._sketchPoints.length < 2) {
  13071. if (options2 && options2.onError)
  13072. options2.onError("\u70B9\u6570\u5C11\u4E8E2\u4E2A\uFF0C\u65E0\u6CD5\u7ED8\u5236\uFF01");
  13073. } else {
  13074. _self._createPolyline();
  13075. if (options2 && options2.onComplete)
  13076. options2.onComplete(_self._sketchPolyline);
  13077. }
  13078. break;
  13079. case SketchViewModel.SketchType.DrawPolygon:
  13080. if (_self._sketchPoints.length < 3) {
  13081. if (options2 && options2.onError)
  13082. options2.onError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u65E0\u6CD5\u7ED8\u5236\uFF01");
  13083. } else {
  13084. _self._createPolygon();
  13085. if (options2 && options2.onComplete)
  13086. options2.onComplete(_self._sketchPolygon);
  13087. }
  13088. break;
  13089. default:
  13090. if (options2 && options2.onError)
  13091. options2.onError("\u7ED8\u5236\u7C7B\u578B\u5F02\u5E38\uFF01");
  13092. break;
  13093. }
  13094. },
  13095. sketchClear: function() {
  13096. this._clear(true);
  13097. this._clearEvent(this._sketchEventHandler);
  13098. },
  13099. sketchInit: function() {
  13100. this._clear(false);
  13101. }
  13102. });
  13103. Object.assign(SketchViewModel.prototype, {
  13104. _checkColor: function(color2) {
  13105. if (color2 === void 0 || color2 === null)
  13106. return false;
  13107. if (typeof color2 != "number")
  13108. return false;
  13109. let intColor = parseInt(color2);
  13110. if (intColor < 0 || intColor > 255)
  13111. return false;
  13112. return true;
  13113. },
  13114. _checkAlpha: function(alpha) {
  13115. if (alpha === void 0 || alpha === null)
  13116. return false;
  13117. if (typeof alpha != "number")
  13118. return false;
  13119. let floatAlpha = parseFloat(alpha);
  13120. if (floatAlpha < 0 || floatAlpha > 1)
  13121. return false;
  13122. return true;
  13123. },
  13124. _checkColorAndAlpha: function(colorAndAlpah) {
  13125. let setColor = void 0;
  13126. if (!colorAndAlpah || colorAndAlpah.length === void 0 || colorAndAlpah.length === 0)
  13127. return void 0;
  13128. if (colorAndAlpah.length === 1 && this._checkColor(colorAndAlpah[0])) {
  13129. setColor = [colorAndAlpah[0], 0, 0, 1];
  13130. } else if (colorAndAlpah.length === 2 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
  13131. colorAndAlpah[1]
  13132. )) {
  13133. setColor = [colorAndAlpah[0], colorAndAlpah[1], 0, 1];
  13134. } else if (colorAndAlpah.length === 3 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
  13135. colorAndAlpah[1]
  13136. ) && this._checkColor(colorAndAlpah[2])) {
  13137. setColor = [colorAndAlpah[0], colorAndAlpah[1], colorAndAlpah[2], 1];
  13138. } else if (colorAndAlpah.length === 4 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
  13139. colorAndAlpah[1]
  13140. ) && this._checkColor(colorAndAlpah[2]) && this._checkAlpha(
  13141. colorAndAlpah[3]
  13142. )) {
  13143. setColor = [colorAndAlpah[0], colorAndAlpah[1], colorAndAlpah[2], colorAndAlpah[3]];
  13144. }
  13145. return setColor;
  13146. },
  13147. sketchEditPickPolygonBody: function(options2) {
  13148. let _self = this;
  13149. let primitive = _self._sketchPickPolygonBody;
  13150. if (primitive === void 0) {
  13151. if (options2.onComplete)
  13152. options2.onComplete("\u672A\u62FE\u53D6\u5BF9\u8C61\u6216\u62FE\u53D6\u7684\u5BF9\u8C61\u4E0D\u7B26\u5408\u8981\u6C42\uFF01");
  13153. return;
  13154. }
  13155. let color2 = primitive._useGeometry.color;
  13156. let height2 = primitive._useGeometry.height;
  13157. this._sketchPoints = primitive._useGeometry.cPoints;
  13158. this._sketchOutputPoints = primitive._useGeometry.gPoints;
  13159. if (options2 && options2.height && typeof options2.height === "number")
  13160. height2 = parseInt(options2.height);
  13161. if (options2 && options2.color && this._checkColorAndAlpha(options2.color))
  13162. color2 = this._checkColorAndAlpha(options2.color);
  13163. this._viewer.scene.primitives.remove(primitive);
  13164. this._createPolygonBody({
  13165. color: color2,
  13166. height: height2
  13167. });
  13168. if (options2.onComplete)
  13169. options2.onComplete(void 0);
  13170. },
  13171. sketchRemovePickPolygonBody: function(onComplete) {
  13172. let _self = this;
  13173. let primitive = _self._sketchPickPolygonBody;
  13174. if (primitive === void 0) {
  13175. if (onComplete)
  13176. onComplete("\u672A\u62FE\u53D6\u5BF9\u8C61\u6216\u62FE\u53D6\u7684\u5BF9\u8C61\u4E0D\u7B26\u5408\u8981\u6C42\uFF01");
  13177. return;
  13178. }
  13179. this._viewer.scene.primitives.remove(primitive);
  13180. if (onComplete)
  13181. onComplete(void 0);
  13182. },
  13183. sketchPick: function(onComplete) {
  13184. let _self = this;
  13185. let handler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  13186. handler.setInputAction(function(event2) {
  13187. let pickObj = _self._viewer.scene.pick(event2.position);
  13188. if (pickObj && pickObj.primitive && pickObj.primitive._useGeometry != void 0) {
  13189. _self._sketchPickPolygonBody = pickObj.primitive;
  13190. if (onComplete)
  13191. onComplete({
  13192. color: pickObj.primitive._useGeometry.color,
  13193. height: pickObj.primitive._useGeometry.height
  13194. });
  13195. } else {
  13196. _self._sketchPickPolygonBody = void 0;
  13197. if (onComplete)
  13198. onComplete(void 0);
  13199. }
  13200. handler.destroy();
  13201. handler = null;
  13202. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  13203. }
  13204. });
  13205. SketchViewModel.SketchType = Object.freeze({
  13206. Point: "point",
  13207. MultiplePoint: "multiplePoint",
  13208. Line: "line",
  13209. Polygon: "polygon",
  13210. Height: "height",
  13211. Spatial: "spatial",
  13212. Circle: "circle",
  13213. Rectangle: "rectangle",
  13214. Triangle: "triangle",
  13215. PolygonBody: "polygonBody",
  13216. DrawPoint: "drawPoint",
  13217. DrawMultiplePoint: "drawMultiplePoint",
  13218. DrawPolyline: "drawPolyline",
  13219. DrawPolygon: "drawPolygon"
  13220. });
  13221. SketchViewModel.SketchIconType = Object.freeze({
  13222. Normal: "normal",
  13223. Blue: "blue",
  13224. Green: "green",
  13225. Violet: "violter"
  13226. });
  13227. SketchViewModel.RuntimeEnvironment = Object.freeze({
  13228. App: "app",
  13229. Web: "web"
  13230. });
  13231. class CommonTools {
  13232. constructor(viewer2, options2) {
  13233. this._viewer = viewer2;
  13234. options2 = options2 || {};
  13235. if (options2.isDrawPoint) {
  13236. this._isDrawPoint = options2.isDrawPoint;
  13237. } else {
  13238. this._isDrawPoint = false;
  13239. }
  13240. if (options2.isRetainDrawPoint) {
  13241. this._isRetainDrawPoint = options2.isRetainDrawPoint;
  13242. } else {
  13243. this._isRetainDrawPoint = false;
  13244. }
  13245. if (options2.isClear) {
  13246. this._isClear = options2.isClear;
  13247. } else {
  13248. this._isClear = false;
  13249. }
  13250. this._sketchViewModel = new SketchViewModel(viewer2, {
  13251. iconType: SketchViewModel.SketchIconType.Blue,
  13252. isDrawPoint: this._isDrawPoint,
  13253. isRetainDrawPoint: this._isRetainDrawPoint
  13254. });
  13255. let buttonDiv = document.getElementById("drawButtonDiv");
  13256. if (buttonDiv) {
  13257. document.body.removeChild(buttonDiv);
  13258. }
  13259. this._init();
  13260. }
  13261. _init() {
  13262. this._measureEntityName = "MeasureEntity";
  13263. this._entities = this._viewer.entities;
  13264. this._measurePointImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcEAYAAAAinQPXAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAB2FJREFUWMO9mHtQlNcZxn/nW65GxHtEqTEajUxVoLYRSIyipHG4qG0lajtxVIRFubgqXuOI28ZE7FAvCLKLSNKxg/FSIzdvqNE62kaRitqpYMxovBGigo4I4n6nfwjsCrsLrtjnn53vnPe87/Oc9/2+854VdBhCd6ZP6dMHlAXO/lOngrzMLz/8EEQ0ASNGANNY2aOHxYIdfHr3LuBCwPnzQIKcf/AgiJ8pQV99BfmvR4+orHxZVsLxpZFT0qd07gyP7zqrej3IInF47lwQkTLV3d1xv3KXWPT4MYhLzMzIgHpn10+Sk+Gw74w+jx79HwSGnzUYhg4FED4FBcBq/jtokOOC2oSb0FZUgHpKVoeHQ9GtGM/y8lcgMLxf5juDBwNDlOWnTgGvUdWz5wsQ7c179fUWzz9y0tX1BdZPILeqCpTtil9QEOT9c876K1faWqS07XeMzJFuboCXkpaX1w5hqxl14QJIKYRWCzLV5OXtDQXbon3c3c2/TeMoYvncucAgPrl40Y7fA0zv1QtMydKwb58FL7toRwbDYo3/0utB3OD8qlX2hIkLqalwO0b9+fLlUHJOG9vQ0P4EjfyFIdPZGfqsURampIBIlxsWLLBtL/NltF4PhUIrVq92QGDIeEOmpye4pYju164Bq6n29LTiopy8tDTIL48pSExsDq/Oj9is/eAD4CRbli1DMEFUBAYCewnUaJD8jr2lpQjpJ7M2bBBi0+L47Tt2mP2G5xhNaWnAHrLj461tKF1rasA0rW5b//6w/0rigQcPWhrZKVFXP8TkybaFyb3kXbkCbiO6fpyU1Dwq58vNG3U6BJvEiYMHEcwQW8aNA3pT7O4OaPmTiwuCnlwcNQrEDRGYmytloilj5vr1Zv+mNXVhSUnmOFYEVnt6gtM9t+8mTbKlwo5AoWdySIjteWUcIwwG2LX7o6lPnkiZULTlj/7+wEThm5oKbCBeCOANUisqkNRxLCEBSSzrYmOB3jw6c8Yi3kL5K51OyvkZGXUTJz7LSH09CIPwMBpt85CHhMf48Q4IJFPofHzsbMAAJfjIEQtXC9TZWi0wkEuKAmjEyspKpNN2pyVBQULZaIjbvXmzUDb6xF0zGJCqv+no6NGAK5fLyiz8JssVcXEWgQLUsZZxWmGbrLTN057Agfh7eNiefhpRb7h922LgOzFp2DDzxnJXrsvLE0rqOW3sTz+12h4lLfRZhuQybuXmWmQkgPzhwy0o1jlV37ljh+e3/L1LF0cEXqX04UPb0075rlovLwtBHuqZ5845T5Z37UqbEAPkzOfsUvlHXZ35saFnQ4++fe04eIfftv64tEfgdvkXeweprFIvBQaaebJH+f3x4xbPvsRPnixlQlHGtDFjWq2Wuqj0yz4+QKk4FxNjMVXD2998Y0FRKEsCAuzwzBKv2eZpR6DspxQcPWpnvrNYoNNBZOTOnRoN0ilJMzYjA3ibsKoqoIxezs6gLJbpxcVSTbyePurwYSkT76VPKSgAWQslJcAmenTrBszgP7W1wBlRmZICY2SydHIC8ZCvdTo7Ak+ri44dcySDNDTs2mVufluhThoGD4bHp6or4uOb3zWJnoqwMGAVLnfuACHscHJCiFRmhISA0BMcFob52PDC/8EDkLfkR5GRQmycN8/t8mXw8O73WVwctnvdJ3SqrQXNSJeY3bttaWhHJxMxzDh97VqQAwheutR2IC6pm/z8oOBm7LcVFVJNKNo0oUsXhBKmGR0VBfI0vkFBINzExxoNEKP+ePYsktefFmVnC2Vjvm5SZSVEpGUNefNNUH8ti8rKQCziaOfOVuL2563PP4eCjJhxK1a8hMCJJ7NTPDxAXWIaefEi0J2r/ftbMfyryDhxAkZ2u1EaHAx6oReq2rb/JiTLZKkoUHLf2//YMWCGnPf++1YM7zHw+nVQ1mlKhg2DvPeiltr+GLaj2W524Kd6zZ4NhGOQ0ophI6GSkr4Gq61VGyjx7vdZQoIdYY1xVZ06RKttS1gTHLkPLjVmGo3AJZToaCsGjSWrPFBKfH3bvta0uyR3ySlGIxS4a7trte1l244MtoRpT93XSUk0l0oruFDbqROYUtQ9X3xhLr2WaBpX4+WnOTl2hHkw9eZN0Li5dLP6Dehogc1dexslK/7MynffhbNDvZXnWq9GNJWyiKC69TlphvobtWbOHNgnZonq6hdl+xL/yTQhbKUxeOtWEP9melSUFYMWJSv/IAtNprZLUu4Rf9u6FQpdo49bfRXaBQcy2BL1p+XURYtAZrLwhx+sGDSWrDpc3ZeVBbJMPt22zY6wRj/1oep08zXMUXRABpsQFmqcHhICYiLlhw4BBWiFA/5FOXmhoc8u0Pv3vyyrDshgEwqLYnKLi4FO5OfkvPh66UdudnZHCXsFAptQ96XMW7jQTsm2xAF23roFlD6NXLy4o9m8AoHFR7SxNTWgjGOsVovtxqBxXAzEbc4cKCycN+/+/Y7n88oRvjarcNYsCDtprP/+ewjvZ1xz9SpERBp3zpz5qqP/D5zQE33tptaiAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTA0LTA5VDE2OjQyOjI5KzA4OjAwjRBbGwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0wNC0wOVQxNjo0MjoyOSswODowMPxN46cAAABKdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL2hvbWUvYWRtaW4vaWNvbi1mb250L3RtcC9pY29uXzJhcHo1b3VpcnV4L2Rpbmd3ZWkuc3ZncY9vkgAAAABJRU5ErkJggg==";
  13265. this._iconBlue = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MkEyMUE1MDg3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MkEyMUE1MDc3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv/grmkAAAhxSURBVHjazFoLUFVFGN49597LBdFUEpEQI0IpyxIfqU1ZkY/pNZg1RZlWY2lW4yMncxq18oHZ0+lhOaWZUo0zPjIr8W1NiubI+AxBIkRQQsQE7us8tv3P7qGL7gXOPRdzZ3bmcnf3+7/v/Lv/+f/lYkIIMpur2yBktQVO5yM7LRybIvsOFKFGCeHyQz/dFO2Ousflcg6UJSlVlqVEjHEMjNMH5tE0vVLT9ZJAQNnn9fm3d+9z3xEYioR9bNcjW9Z8Gtv35l7PUAFjnU5HLytrFUU9TgV9XXD4+PJhoyfV2/GIFO4TGD8my1lVuGXSHYNuPdyhfbv5VkVAgzWwFjAACzAvp0fwoV++uz6lxzXLolzOW1AEmz+gHCwtq3i2z52Pn2jtlgvXI1LpgQ0jeqYm74y0CGiACdjUxkir3KxMlsoKNj6WmNAlV5Kk9qiNGmBTG6vAlhV+rd1aUuGeNSNSeiSuolGo2X1cdDogbThQ79h21CMfP6NKtR4dw/edYiTSK8GhZ/aO0R7KiFV7dnPpzeFQXkppWeWY9MGj8+ifektbqzVC8KbVH6UNHdJvOw2nHUIB7vrDI89df861p0SRsUSjuiSzB4qxyYzx0TVEdBUNTnVqs7I6B4beEKOFwqThuu7X/IJ7hj/yYlGoM9NqIakpSVH7t67c3C4muq8IyKcQ9EpuddSK3xqcSHJR7g7WsSkCm8+YiSEgRuU9gMbd3k5578kufrcTC8U0eLwF/e99anhJ6Sm/HSHSid/Xv5CclJAjAjlXr+GHP6x07z9JZCSDCBfzBJapBomJabJfdKqFCiGa4RkQgrQA6p+MtbVTEn2dY2XhUz956szM6wdkLRFtsVZFrReeeaRTQte46aIxT4DgrA9ABJKRw42QTLsjimqATgUZwpxNO/0OGz3KmMvWuBFgABZgimwBB+ASbtSSp0zIHutyOuNEg9NW/e06UE49YRBi5LFB2NxaMoQg5iGJfza+Y+MwlwlmogALMIXpD+UAXIBTOEKi4rt0zg51sFft8TjN7YQbnzrbVpeeD8Q+w3fYFCQba9ha5kHABGyRTcrlCeBkVQjO/Wxeb3rA00WDb62rcbHzAARML0hBAloK+lyQ4TEHx2B4BragUS69vl06/6aLnk6LQuQ+vdMyRQMHT/ql/D9VGfEQi00PGFDYwqsP8/AsMQyJbTvABhuiFb3TU+8Otb1CCXFd1SF2gGhg/f56Bw4+B9iCJ0J5Bv93fgAbbIimd7yq/UDgZklITLQ7RTSwp9grs7MgBYXYMEQ0OTtBWBR7d5FX+NQ5J0tCHG63K0GYglSpkrklGkXY1GGKMbdo8d+qkBfn5LB0RpwOeDlc2mo9NNYHbyOMIuCRptvNsCGqXxgnS2dEoslhxMrgSDXOSbL0HlFVzSv6vlMMJigorWGpnJ2ymzRdTrENGxY4NSeE+PwBYQ3ds6tDN1IewvvFRMLQwTBMPB2lxTuEaTvnRKwI0S/U1ZeLBganRWtGwteYAOoR8EgQFsUe3DNamNpzTroVIWp1TW2xaCCrf6xKzDScaP89SRKGGBLkCSMjVo1aZRS1IZrOOalWhCgHjxTvEw3ckhylD7rOobF6ghZJphhk1TO80DK8Yab1KgJssCHMKhgnxYqQQM7i5bv9AaVONDh7VFzAqCWMekLhRZIFzzQWWLzIMjAY3qwsii2+YakDTsDNkkdoRVZbXHLyN9EglKdjh8QoUBSBcaIDEYU91cbtRi7yUFCF2OgBha9lBRZg3nWjuPQFLsDJqkfAtfWfr1jzDSHiR/zuk/GBjO5YQyqtQDU/5WYKCjo/Oicd/JmPw1xYA2sBA7AAM8RFBAEuwMnqYTei3Q95vx47U1VzTJj3uDBZNzXRl9EdUTE+SshnECJcFPOWwraNxj0GYo3OyLM1PgQYgAWYIlvAAbgAp3AKK6XyTPXZ56bOm0f3p/BFFEdr7LwZSd5xQ9wKUukUo/u4h8SdecCHzPmwdtOMJF9ciHodbE+cvmA+cAm1rVoSAsD1m3fmH127cfvSUJOiXRh98nS8/8dpXb0DknWNKB5qzsOIKlwYdIULpWMwB+ZunNrVC2tDeQIa2P552+4jfFsROxd0sbRfm5/31dyMPumZLQWkwsqA9EOTCzqCzdTGvKB7MCNWTU9s/oIOWsHh41tvGz5uNv34Fxdi64IOvNaxQ/t2aXvzVixKTUnqezkSRBqhCm4bMW7GhboGuJw7H+qQW7nEBoALFPCvOx8cP+toYUl+W4v4o6h0L9iiNkvBdnNXplYvsSEtOFddc75owLCxc6jLd7aVCMDulzlmDtgCm6FSEju38RAxztJUumTkoy+9faqyqjDSIgDzgezJi6gN+P9Is1HKjpBGz9T+U1cy+ulXZ9XU/lMRKRGABZjUEyeseCJcIY1i6BY4NmHagjlen/+CXREUow6wADMcEeEKQTxxq96wadfvCz9cvpBuBSVcEbCWYuQAFmCGSgrbSojx0qW9KmfxV5u/zP1+MTEqI6vlCNFhLWAAFsdEl1sIvIAgdTn98muL1mzZtXe1VYCtv+xbDWsBg2OR/0OIKaaB9ooHsqcsoXt8h4Uwu+P+xyfD/zwqOIatHw7YFQJvVthSUICVDxs9Kae0rOJwS2vKyk8fgbmwhq/V7fKwLYSLgWLoPLz9s59//c3mwjKMPTZ+5hswl6ceWiQ4REQIF2OE5QOHCo9NfCVndoPHW3vxHPgOxmAOzOVr0BUlhIuB0Hn2+5937p/77hcLgsMyfF7wwbKFMAZz+Fx0RQoJDsvvL8ndYYZlM8y+8/HKbXbDbKgW8ftd+qQJLQcglFZCaE3qFn81wogEh1mYE/F74bb64RnFAm/DDwy6mPdrkJLzKGfLpsj+vwIMACSZzfDJFmOPAAAAAElFTkSuQmCC";
  13266. this._iconGreen = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MjI1NDIwOUU3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MjI1NDIwOUQ3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgEE4igAAAgKSURBVHjazFoJbFRVFP3L/OlMoQXKImAFm0JbFtFKShEQI6UsggmkGKghIKTIIgZUohIDKEuLaFTQiIKyKKghqSyyF0pZbcHQsJVpoRkKbYFAW+iU2f78/313+qY+hvc78+dPkZfcMJ377rn3/Pve/fe9gVUUhfENY5eBjNbhvlnI6Bmh+KT5NzBhGigg9sb5vX3NpohhRqMwgOe4eJ7nurIsGwl69MDskiRXS7Jc7naLpx1OV/4z/V67CKpw+Gf1ZiQv9/vWyc8lTkMEpgiCIVGLrSh6ShGhX4ovlG5Mz5jToCcjXKhPIGvyOOG2JW/OywNfuBAd1WqFVhIwwAZsAQOwAPNxZoQ9f+yPHnHdn94QYRSeZ8I4XG7xnLWianq/oZOuBrvkQs0IZz27a2RCfLeCcJOAAZiAjXyM0hqblslcRfHuiV07d9zKcVwU00IDsJGPLeBLS3zBLi3O8nfuyLjuXbegKtTsOrY4Ldz22u2GPFue4bL7MlfrqWXh+xhDjNLL2EtOj0r3jI8Z70kyJcnN4aC4RGtF9eSklzIOoD/lQEsrGCLs/m3f9nxlUP98VE6j1QDz6/P5xZWLI06KJ3lGwIWdB2tfZEgkJB4oVwwzWBgsLY1d6hoWPUxSw0Tl2na8sHjYiAnvlKntmaD3SHxcrDG1f9/1aiScspOZYZ1hGm4dHnmSRyRglk+i/ITQwVywAVvAoA3kMyolufc6iEHv0uKuntkxu1ts5xyacY2nhh1TNsZcpBTxjBl2K4AQ2eD8MiITWXFDmULiYJhUNlXak7DH0d7QnvrUr1feWtgjZdxa2hILKiOzp01o1/mp9gtoOrtsZ0eXjjYXMYhEa/RFKyxmLCaCmBF/NhF633xkCxiABZg0XxADxBJq1eLnz8ycYhSE9jTl3Iq5EWeYM/wjwUPQvj1CEwHP8SMFWIBJbX9QDBALzrNmIhGdOsZkqm3sTfWbhKbgTcSSMhBLiiYcMc9I2CMswARsmk8Uy5s4r5qIsFt/WN6nVaQ5iaZcVLkoQjEpjbD++4IM+hFUQniCDMYBTMCm+USxJP6+bkVfFWRVIny/Pj3TaIpiezF3SjzFN619AaNwRLABSwzhnSOWGxLABh80sz5J8a+qLS81IsY20a1TaIrc2lzhoX3A+2Ui6FcxkRn+4f3j9UEZbdtEDcCUgycSaTbF0RQnGk7wTY79S2xIbSvGIDCPNxynPnUckyYiBpPJ2JmmKBVLuSYCXIA9EWxWWAIPYZeJZdS4cEwGTXtEMBhMNEWthHonVieB5gix2Aft/NIYk6Y9wqHmMGzH4HANHBOn6T3i8UgO2vcxfIzibTdI0Tv88Lw+NMTUHBHF6XJTz9CJQqLs7ZdkLHoIkbbyf71YgpBAbdtxTIoWInK9reEGTTGk9RCpqfGTCDJ6skE2kxL2QRk4JlkLEc+dmrorNEVGTIbo7VxFgowUQlYU4oxCnFMAe0LMBJFmgmPyaCEinrt45TRNkRyZLA8SBkleMj5CMvGclCBJMIQdJgAC2OCDZoZjErUQcees3njK5RZtNOWy2GUu1sk2nidcOAiPX2aUAHvC/1yCBDDh1Khyw2KDmLBF8Bkpt1bWXSm/fpKmhOPp9OjpIhyKGCcWHxkPpQj4b2oPQcJnj7AAMy06jbo/IBaISWtGwF3Dj5tzf1PIIyQx1nRf40phUiTmQWMQTaTI/ePx2wPEPvAF7xWEAViAqXIRoUAsEJPWze6tdn8dOF5y63ZNCbXv4SKVvYl7HSkKItPQGMwjpFx+4he8V5AtYAAWYNJ8QQwQC0bQfLASq2/duTvjveXL0fqkvog6GDooR3sdtWdFZomsjW18Xj5SdhXBwYOADdgW9CpwAJbK3nDMWpC9AmJRW1aBiABww8GCwkt/7s5fpzbJzJmZ9XHrnYfiDtkHSgMlph59CSXC9y8phA7m5sXl2cFWLRMwwPe+w6cuYvqKngs6uFp4tvDApmUv9ktKC1RZSxwl3I66HYaD9QcNFtHC+RpAaDuShCR5RPQIz7h24zy9zb3lQFjFF0oPpY6Yuhh9vIaJ6Lqgg6y1jY5q1bPowOZV8XGxyY+jQUQVqjh15NSP6m0P4HLuntom13KJDQD1CPDa0NezFl2ylBe2NInLZdYi8IV8WvGCDJi9YC+JoXDW3qm5V5aSPmUJSnlBS5EA7P5pk5eAL/Cp1pLouY2HinEXtdLlo96Y+3ll9W1LuEkA5tjMeauQD/h9pNkqpYdIU2bq7tvKM976cFFN3f2qcJEALMBEmbiqJROhEmkig5ZAycz3s5c4nK56vSQQhg2wADMUEqESYXCTcWfX/qNnVn6zcSVaCmKoJMAWYeQAFmCqNYUtRYTBTcftnNWbDv68dedqVMZlrQBgA7aAAVgYk3ncRBTcNd189+NVuXlHi7ZpBTh07PQ2sAUMjKX8H0R8ZKB7qhqbOX8tWuNHNJTZI2MmzYPfPKowhq5rDL1E4M0q4w7qRnrGnBxrRdWFQDYVN25ehLlgg21lvXHoJoLJwInjHrz9M9/+5LPmyjLoJmYt/BTm4tZDCkcMYSGCyXjL8tnzlpJZH+QsfmB31PnPge9AB3NgLrZhnigimAyUzrs79xX8s+zLn7LJsgyfs7/esBJ0MAfPZZ5IImRZ/mrt1iO+suwrs1989+thvWVWbYT9fhc9aQUdB6CUVkNpje3SqQPDMgpZZmFO2O+FW+o/niEsyDb8qt7Rd78GLTmucrp80vz/K8AAYAEv1AHM/GwAAAAASUVORK5CYII=";
  13267. this._iconViolet = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzFDREU3Mjk3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzFDREU3Mjg3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Ppb+WxIAAAhcSURBVHjazFoLcFTVGb6vvdnNY0lEEJOIxhCSKTEFKSC1osIgjqIyA62mZfAxWJU+tC3TVh2lHSGhtNOKOqK0ii+0QwcfFB+IAsKIITpJhUBDHhMiSSBCTMgm2d377PnungubnXOT3L0b6rlzmM2e83/n+87/n/+ecxbeNE3OLvLFV3Fui3KiivNSkhmTNb7EpagQQvzxg++VBvxpc2XZN1MUhEJRFHJ5nk9HO5mwAV03OnTDaFYUtTocie66pOymOjSlYnzeq0d2bn02c9oVxXcTAct8PqnYja2qakeJoFdqDx3dNH/xij4vHhGSnYHlSxf5Out3rrjmqqmHglkZa9yKQIENbIEBLGCeT4/wB/f+c1LBpXkvpsm+73IpLFFF/bKltf2esjl3NI005JL1iNBSs23B5MKJe1ItAgWYwCZj3OiWm5vOQmvt9ttzJ4zbLAhCFjdKBdhkjNcwlht+Iw0tof6zrQsKLs19jWShIeM40hASure3S727O0WloV/QehTeSo/ZsilPzjCC11+k5yzM0/yTs4yhcAgvtaW1Y2nJ7MU7yJ/GcKE1EiH8B1ueLrr2+9N3kXQadAIM7f1abK84LEcOnBFFXuREMpk8TyrHx4jhMQ1OJ5x0U+f8s8boeY9MUbLmjNedMEm6Du2rqp17w5KfNTitmRGvkcKCfHnW9NK/O4kwIjp37JdfpDUv+jSgVw+IASHAofpRef/gSttQ0Rc2sAUGq5Axs2ZM+85GcPAaWkLT528/MDF/QiXLWPtG4Rt/tM+v1vSLMi9zPl4iniCVeASeEPjB82QQj8Az8IjOaZxqapxiKpzvygy9aMs1EekCmTnrX7WdfHjSjEUbWCE2Io88cPeSnAkXjV3J9ERY5xuX7PNrNQOin0/j0kiVUQUI8llVSnjs79FHpjawBQawgMkaCxzAJdmsJT50X/ky2ecby5yllTWy+p9+MY2PkYonb60RUuER1udBoixBMgcsYDK3P4QDuIBTMkLSxo+7oNxpYfe80eaLhZPMSSSkUAU8vPWvFVr2QrdimD7xfWw7nzUZMgdMYLPGJFx+DE5uhfCbn1s9JSM9UMJqbF9TJ5O5tNZEooh48o4Lk66fwWJIJZjAZtkQLsVvbFxTapm7ECKWTSmax2oYONgjRKp7RSluYbsRwRITS9cxQcDGGCybKSWF1zuFl5MQeUwwcwaroXtbmyTRWLdFkJekKxGDwo3nz4nB+iEVY7D6Z4/JmgluroSkB/wFrIa+z7rE2DyeWwfJiEhcO2fXD3n69p9mzjrl5EqI5PfLE5hv0qZ+gach4TacRhJmwFaaB5i8KCfJ1RrxSZKfuW3oUflE8l49kvg3xmCeX2KcXK0RMut8yo7BqSqUk+DqPaJpepjpqmyfaSbs30wPx24WFsZww2koIWYkqjDP0PKkDAO7WOuheyevBRgGxQS2XJjO3LZTTqYbIUZvqO84qyFz9lidyohtzenjRYT92LiZsy9kbocpJ8ONEO1UV3cjqyHn1nxNw+6V1tgsJicmdkaJCbDxgJ1zW77G6k85aW6EqF/WNVYzc3lZtuGfGdQ1sgXHVtwW4zbM4sPJ3tYDE9gYg2VDOaluhCiV6zftjypqiNWY92iponKKdZ7QaHUjJl6EbQ8sYOY+Uqo43LCEwAncXHmkuaWtu7H5q09ZjTieZv/kEhWHIpXURDHx6ydxLcT3OSdCsQ5YwAxeyz76ggs4ufUIXNv3/MtbXzfjj5BxZeK6aYpvaoYetUhECRnVqhoNNyvkTIP5WbNOh7H+sAUGsIDpcBFhggs4uV3sVrb79459R052dh1hGgZEs+hfP4hIU9P1iEUmapFSDGWQqPjnLHlDoQKiHGyBASxgssYCB3ABp2QOVmrHyVOn7/3V6tUkPpkvImlsmln83nXh4NJcNWKGuYgRIxcTpcQIx1fynd2OvrCBbfG710WA5bA2wvevrFgDLk5hNZwQAPd9uKfq8Jvbd210BPCL3GVPfS9a+PbVYWF6QA8bEBSrYYgzI1a1Ptvfk4q+l791dRi2Tp5Awdjvf7y/joaV6eWCLpPUy6p2vPTElWUl84bLSOH6XqHn3Xapd9fXotLUJ+jdmrUBFHMkU56UaQTnkkRxc54WKAkaw2HVHjr60awb7nycfDxGhXi6oIPXsoNZGUUHdry8rrAgf9r52CCSDFU7a8Gdv+sN9eNyrsdpkbu5xAZALwE8NueW5Y8drm+uGm0R/21oOYCxyJgtGHuoK1O3l9jYFnxzqqunYcb8ZauIy/eMlghgT5+3dBXGwphOWxIvt/HIGKfJVrr5xh/+/E9tHZ31qRYBzIXlD64jY+D3kSGzlBchZz3TfSbUvPiu3z7W1X2mPVUigAVM4okmN55IVshZMSQEjtz364pV4Ui016sIghECFjCTEZGsEI5u3E5t++CTz9c+uWktCQU1WRGwJRiVwAKm06ZwtIRYL11SOyvXv/ThC5vfWW/iaOf2PEJsYAsMYFFM7nwLwQsIW5cTv/j9uq07PzmwxS3AR3urt8AWGBTL/H8IscX04zp4YflDG0iM73aRZnfffMeD+M2jnWJ4Ovx7FYI3K0IKB7Dj8xevqGxpbT80nE3r8RN16Asbamt45eFZCBWDw1AP3v7lP330j0OlZbTdvvzhP6Av3XroqeCQEiFUjJWWaw7WH7n/N5WP9w+EuxP74Du0oQ/6UhvuWyWEikHqPP3O+3u+eOIv/6iIT8v4XPG3F9eiDX1oX+5bKSQ+Lf91w+bddlq20+yfn3n1Y69p1qmk/H6XzLRJjgNIpR1IrfkXj7+Q4zkzPs2iT8rvhUfrP54RLHgbv82Ps+/XsCWnWc7TmKzx/yfAAHo1CtU9myPWAAAAAElFTkSuQmCC";
  13268. this._measureTempPoints = [];
  13269. }
  13270. _updateScene() {
  13271. this._viewer.scene.requestRender();
  13272. }
  13273. _removeEntityByName(entityName) {
  13274. let entities2 = this._entities;
  13275. if (!entities2 || !entities2.values)
  13276. return;
  13277. let delEntitys = [];
  13278. for (let i2 = 0; i2 < entities2.values.length; i2++) {
  13279. if (entities2.values[i2].name == entityName) {
  13280. delEntitys.push(entities2.values[i2]);
  13281. }
  13282. }
  13283. for (let i2 = 0; i2 < delEntitys.length; i2++) {
  13284. entities2.remove(delEntitys[i2]);
  13285. }
  13286. this._updateScene();
  13287. }
  13288. _clear(isAll) {
  13289. if (isAll != void 0 && isAll === true) {
  13290. this._removeEntityByName(this._measureEntityName);
  13291. if (this._sketchViewModel != void 0) {
  13292. this._sketchViewModel.sketchClear();
  13293. }
  13294. }
  13295. this._measureTempPoints = [];
  13296. this._altitudeDynamicLabel = void 0;
  13297. this._tooltipRemove();
  13298. let buttonDiv = document.getElementById("drawButtonDiv");
  13299. if (buttonDiv) {
  13300. document.body.removeChild(buttonDiv);
  13301. }
  13302. }
  13303. _toColor(red, green, blue, alpha) {
  13304. return new Cesium.Color(red / 255, green / 255, blue / 255, alpha);
  13305. }
  13306. _cartesianToGeography(cartesian) {
  13307. let ellipsoid = Cesium.Ellipsoid.WGS84;
  13308. let cartographic = ellipsoid.cartesianToCartographic(cartesian);
  13309. let latitude = Cesium.Math.toDegrees(cartographic.latitude);
  13310. let longitude = Cesium.Math.toDegrees(cartographic.longitude);
  13311. let altitude = cartographic.height;
  13312. return {
  13313. lon: longitude,
  13314. lat: latitude,
  13315. hei: altitude
  13316. };
  13317. }
  13318. _createPoint(coord, label2) {
  13319. let _self = this;
  13320. let entity = new Cesium.Entity({
  13321. name: _self._measureEntityName,
  13322. position: coord,
  13323. billboard: {
  13324. image: _self._iconBlue,
  13325. horizontalOrigin: Cesium.HorizontalOrigin.center,
  13326. verticalOrigin: Cesium.VerticalOrigin.bottom,
  13327. scale: 0.5,
  13328. pixelOffset: new Cesium.Cartesian2(0, -11),
  13329. disableDepthTestDistance: Number.POSITIVE_INFINITY
  13330. }
  13331. });
  13332. if (label2) {
  13333. entity.label = {
  13334. text: label2,
  13335. font: "30px SimHei",
  13336. scale: 0.5,
  13337. fillColor: this._toColor(255, 255, 255, 1),
  13338. outlineColor: this._toColor(14, 30, 79, 1),
  13339. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  13340. outlineWidth: 2,
  13341. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  13342. showBackground: true,
  13343. backgroundColor: _self._toColor(0, 0, 0, 0.6),
  13344. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  13345. pixelOffset: new Cesium.Cartesian2(0, -28)
  13346. };
  13347. }
  13348. this._entities.add(entity);
  13349. this._updateScene();
  13350. return entity;
  13351. }
  13352. _createLabel(coord, label2) {
  13353. let _self = this;
  13354. let entity = new Cesium.Entity({
  13355. name: _self._measureEntityName,
  13356. position: coord,
  13357. label: {
  13358. text: label2,
  13359. font: "30px SimHei",
  13360. scale: 0.5,
  13361. fillColor: this._toColor(255, 255, 255, 1),
  13362. outlineColor: this._toColor(14, 30, 79, 1),
  13363. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  13364. outlineWidth: 2,
  13365. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  13366. showBackground: true,
  13367. backgroundColor: _self._toColor(0, 0, 0, 0.6),
  13368. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  13369. pixelOffset: new Cesium.Cartesian2(0, -14)
  13370. }
  13371. });
  13372. this._entities.add(entity);
  13373. this._updateScene();
  13374. }
  13375. _createAltitudeDynamicLabel() {
  13376. let _self = this;
  13377. this._altitudeDynamicLabel = new Cesium.Entity({
  13378. name: _self._measureEntityName,
  13379. position: new Cesium.CallbackProperty(function() {
  13380. return _self._altitudeLabelPosition;
  13381. }, false),
  13382. label: {
  13383. text: new Cesium.CallbackProperty(function() {
  13384. return _self._altitudeLabelText;
  13385. }, false),
  13386. font: "12px sans-serif",
  13387. fillColor: this._toColor(255, 255, 255, 1),
  13388. outlineColor: this._toColor(0, 154, 94, 1),
  13389. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  13390. outlineWidth: 1,
  13391. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  13392. pixelOffset: new Cesium.Cartesian2(0, -28),
  13393. showBackground: true,
  13394. backgroundColor: this._toColor(0, 0, 0, 0.6),
  13395. disableDepthTestDistance: Number.POSITIVE_INFINITY
  13396. }
  13397. });
  13398. this._entities.add(this._altitudeDynamicLabel);
  13399. this._updateScene();
  13400. }
  13401. _measureDistance(positions) {
  13402. let distance2 = 0;
  13403. for (let i2 = 0; i2 < positions.length - 1; i2++) {
  13404. let point1cartographic = Cesium.Cartographic.fromCartesian(positions[i2]);
  13405. let point2cartographic = Cesium.Cartographic.fromCartesian(positions[i2 + 1]);
  13406. let geodesic = new Cesium.EllipsoidGeodesic();
  13407. geodesic.setEndPoints(point1cartographic, point2cartographic);
  13408. let s = geodesic.surfaceDistance;
  13409. s = Math.sqrt(Math.pow(s, 2) + Math.pow(
  13410. point2cartographic.height - point1cartographic.height,
  13411. 2
  13412. ));
  13413. distance2 = distance2 + s;
  13414. }
  13415. if (distance2 < 1e3)
  13416. return distance2.toFixed(2) + "\u7C73";
  13417. else
  13418. return (distance2 / 1e3).toFixed(2) + "\u516C\u91CC";
  13419. }
  13420. _measureSpaceDistance(positions) {
  13421. let distance2 = 0;
  13422. for (let i2 = 0; i2 < positions.length - 1; i2++) {
  13423. let point1 = positions[i2];
  13424. let point2 = positions[i2 + 1];
  13425. let sx = Math.abs(point1.x - point2.x);
  13426. let sy = Math.abs(point1.y - point2.y);
  13427. let sz = Math.abs(point1.z - point2.z);
  13428. let s = Math.sqrt(Math.pow(sx, 2) + Math.pow(sy, 2) + Math.pow(sz, 2));
  13429. distance2 = distance2 + s;
  13430. }
  13431. if (distance2 < 1e3)
  13432. return distance2.toFixed(2) + "\u7C73";
  13433. else
  13434. return (distance2 / 1e3).toFixed(2) + "\u516C\u91CC";
  13435. }
  13436. _measureAreaBearing(from3, to) {
  13437. let radiansPerDegree = Math.PI / 180;
  13438. let degreesPerRadian = 180 / Math.PI;
  13439. let lat1 = from3.lat * radiansPerDegree;
  13440. let lon1 = from3.lon * radiansPerDegree;
  13441. let lat2 = to.lat * radiansPerDegree;
  13442. let lon2 = to.lon * radiansPerDegree;
  13443. let angle = -Math.atan2(Math.sin(lon1 - lon2) * Math.cos(lat2), Math.cos(lat1) * Math.sin(
  13444. lat2
  13445. ) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon1 - lon2));
  13446. if (angle < 0) {
  13447. angle += Math.PI * 2;
  13448. }
  13449. angle = angle * degreesPerRadian;
  13450. return angle;
  13451. }
  13452. _calculateAreaAngle(p1, p2, p3) {
  13453. let bearing21 = this._measureAreaBearing(p2, p1);
  13454. let bearing23 = this._measureAreaBearing(p2, p3);
  13455. let angle = bearing21 - bearing23;
  13456. if (angle < 0) {
  13457. angle += 360;
  13458. }
  13459. return angle;
  13460. }
  13461. _calculateDistance(point1, point2) {
  13462. let point1cartographic = Cesium.Cartographic.fromCartesian(point1);
  13463. let point2cartographic = Cesium.Cartographic.fromCartesian(point2);
  13464. let geodesic = new Cesium.EllipsoidGeodesic();
  13465. geodesic.setEndPoints(point1cartographic, point2cartographic);
  13466. let s = geodesic.surfaceDistance;
  13467. s = Math.sqrt(Math.pow(s, 2) + Math.pow(point2cartographic.height - point1cartographic.height, 2));
  13468. return s;
  13469. }
  13470. _measureArea(points2, cartesianPoints) {
  13471. let self2 = this;
  13472. let res = 0;
  13473. for (let i2 = 0; i2 < points2.length - 2; i2++) {
  13474. let j = (i2 + 1) % points2.length;
  13475. let k = (i2 + 2) % points2.length;
  13476. let totalAngle = self2._calculateAreaAngle(points2[i2], points2[j], points2[k]);
  13477. let dis_temp1 = self2._calculateDistance(cartesianPoints[i2], cartesianPoints[j]);
  13478. let dis_temp2 = self2._calculateDistance(cartesianPoints[j], cartesianPoints[k]);
  13479. res += dis_temp1 * dis_temp2 * Math.abs(Math.sin(totalAngle));
  13480. }
  13481. return res;
  13482. }
  13483. _calculatePolylineAltitudeHeight(points2) {
  13484. if (points2 === void 0 || points2.length < 2)
  13485. return -1;
  13486. let cartographic = Cesium.Cartographic.fromCartesian(points2[0]);
  13487. let cartographic1 = Cesium.Cartographic.fromCartesian(points2[1]);
  13488. let height_temp = cartographic1.height - cartographic.height;
  13489. return Math.abs(height_temp).toFixed(2) + "\u7C73";
  13490. }
  13491. _setMousePointerStyle() {
  13492. document.querySelector("body").style.cursor = "crosshair";
  13493. }
  13494. _initMousePointerStyle() {
  13495. document.querySelector("body").style.cursor = "default";
  13496. }
  13497. _checkAppOrWeb() {
  13498. if (window.navigator.userAgent.match(
  13499. /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
  13500. )) {
  13501. return CommonTools.RuntimeEnvironment.App;
  13502. } else {
  13503. return CommonTools.RuntimeEnvironment.Web;
  13504. }
  13505. }
  13506. _isRuntimeApp() {
  13507. if (this._checkAppOrWeb() === CommonTools.RuntimeEnvironment.App) {
  13508. return true;
  13509. }
  13510. return false;
  13511. }
  13512. _isRuntimeWeb() {
  13513. if (this._checkAppOrWeb() === CommonTools.RuntimeEnvironment.Web) {
  13514. return true;
  13515. }
  13516. return false;
  13517. }
  13518. _createOperationMainDom() {
  13519. let buttonDiv = document.createElement("div");
  13520. buttonDiv.id = "drawButtonDiv";
  13521. buttonDiv.style.width = "80px";
  13522. buttonDiv.style.backgroundColor = "rgba(5, 45, 155, 0.7)";
  13523. buttonDiv.style.borderRadius = "5px";
  13524. buttonDiv.style.display = "flex";
  13525. buttonDiv.style.flexDirection = "column";
  13526. buttonDiv.style.padding = "8px";
  13527. buttonDiv.style.justifyContent = "center";
  13528. buttonDiv.style.position = "absolute";
  13529. buttonDiv.style.bottom = "150px";
  13530. buttonDiv.style.right = "10px";
  13531. let btnUndo = document.createElement("button");
  13532. btnUndo.id = "btnDrawBackout";
  13533. btnUndo.style.height = "30px";
  13534. btnUndo.style.marginBottom = "8px";
  13535. btnUndo.style.backgroundColor = "rgba(52, 137, 255, 1.0)";
  13536. btnUndo.style.color = "rgb(255, 255, 255)";
  13537. btnUndo.style.border = "0px solid red";
  13538. btnUndo.style.borderRadius = "5px";
  13539. btnUndo.innerHTML = "\u56DE\u9000";
  13540. btnUndo.style.fontSize = "13px";
  13541. btnUndo.style.cursor = "pointer";
  13542. buttonDiv.appendChild(btnUndo);
  13543. let btnCompletion = document.createElement("button");
  13544. btnCompletion.id = "btnDrawComplete";
  13545. btnCompletion.style.height = "30px";
  13546. btnCompletion.style.backgroundColor = "rgba(88, 185, 45, 1.0)";
  13547. btnCompletion.style.color = "rgb(255, 255, 255)";
  13548. btnCompletion.style.border = "0px solid red";
  13549. btnCompletion.style.borderRadius = "5px";
  13550. btnCompletion.innerHTML = "\u5B8C\u6210";
  13551. btnCompletion.style.fontSize = "13px";
  13552. btnCompletion.style.cursor = "pointer";
  13553. buttonDiv.appendChild(btnCompletion);
  13554. document.body.appendChild(buttonDiv);
  13555. }
  13556. _showTooltipMessage(message) {
  13557. let msgMainDom = document.getElementById("messageMainDom");
  13558. if (msgMainDom !== null && msgMainDom !== void 0) {
  13559. document.body.removeChild(msgMainDom);
  13560. }
  13561. msgMainDom = document.createElement("div");
  13562. msgMainDom.style.width = "30%";
  13563. msgMainDom.style.backgroundColor = "rgba(237, 248, 230, 1.0)";
  13564. msgMainDom.style.height = "45px";
  13565. msgMainDom.style.border = "solid 2px rgb(219, 241, 208)";
  13566. msgMainDom.style.borderRadius = "8px";
  13567. msgMainDom.style.display = "flex";
  13568. msgMainDom.style.alignItems = "center";
  13569. msgMainDom.style.paddingLeft = "10px";
  13570. msgMainDom.style.color = "rgb(91, 188, 48)";
  13571. msgMainDom.style.fontSize = "14px";
  13572. msgMainDom.style.fontWeight = "600";
  13573. msgMainDom.style.position = "absolute";
  13574. msgMainDom.style.left = "35%";
  13575. msgMainDom.style.transition = "transform 1s";
  13576. msgMainDom.style.transform = "translateY(-90px)";
  13577. msgMainDom.style.top = "0px";
  13578. msgMainDom.style.zIndex = 1e3;
  13579. document.body.appendChild(msgMainDom);
  13580. let strHtml = "";
  13581. strHtml += "<div style='";
  13582. strHtml += "background-color: rgb(88, 185, 45);";
  13583. strHtml += "color: rgb(255, 255, 255);";
  13584. strHtml += "height: 24px;";
  13585. strHtml += "width: 24px;";
  13586. strHtml += "border-radius: 20px;";
  13587. strHtml += "display: flex;";
  13588. strHtml += "justify-content: center;";
  13589. strHtml += "align-items: center;";
  13590. strHtml += "font-size: 14px;";
  13591. strHtml += "margin-right: 18px;";
  13592. strHtml += "'>&#10003</div>";
  13593. strHtml += "<div>" + message + "</div>";
  13594. msgMainDom.innerHTML = strHtml;
  13595. msgMainDom.addEventListener("transitionend", function() {
  13596. setTimeout(function() {
  13597. document.body.removeChild(msgMainDom);
  13598. }, 1e3);
  13599. }, false);
  13600. setTimeout(function() {
  13601. msgMainDom.style.transform = "translateY(50px)";
  13602. }, 100);
  13603. }
  13604. }
  13605. Object.assign(CommonTools.prototype, {
  13606. _tooltipInit: function(text) {
  13607. this._tooltipId = "tooltipJt";
  13608. let tooltipObj = document.getElementById(this._tooltipId);
  13609. if (tooltipObj === null) {
  13610. tooltipObj = document.createElement("div");
  13611. tooltipObj.id = this._tooltipId;
  13612. document.body.appendChild(tooltipObj);
  13613. let divStyle = "";
  13614. divStyle += "top: 30px;";
  13615. divStyle += "left: 30px;";
  13616. divStyle += "position: absolute;";
  13617. divStyle += "display: flex;";
  13618. divStyle += "align-items: center;";
  13619. divStyle += "width: 12x0px;";
  13620. divStyle += "height: auto;";
  13621. divStyle += "background-color: rgba(0, 0, 0, 0.65);";
  13622. divStyle += "border-radius: 5px;";
  13623. divStyle += "color: rgb(255, 255, 255);";
  13624. divStyle += "font-size: 12px;";
  13625. divStyle += "font-family: 'Alimama_ShuHeiTi_Bold';";
  13626. divStyle += "padding: 8px;";
  13627. divStyle += "border:solid 1px rgb(255,0,0);";
  13628. tooltipObj.setAttribute("style", divStyle);
  13629. }
  13630. if (text != void 0)
  13631. tooltipObj.innerHTML = text;
  13632. document.onmousemove = function(event2) {
  13633. tooltipObj.style.left = event2.clientX + 10 + "px";
  13634. tooltipObj.style.top = event2.clientY - tooltipObj.offsetHeight / 2 + "px";
  13635. };
  13636. },
  13637. _tooltipRemove: function() {
  13638. let tooltipObj = document.getElementById(this._tooltipId);
  13639. if (tooltipObj != null) {
  13640. document.body.removeChild(tooltipObj);
  13641. }
  13642. },
  13643. _tooltipSetText: function(text) {
  13644. let tooltipObj = document.getElementById(this._tooltipId);
  13645. if (tooltipObj != null) {
  13646. tooltipObj.innerHTML = text;
  13647. }
  13648. }
  13649. });
  13650. Object.assign(CommonTools.prototype, {
  13651. clear: function() {
  13652. this._clear(true);
  13653. this._initMousePointerStyle();
  13654. }
  13655. });
  13656. Object.assign(CommonTools.prototype, {
  13657. measureLength: function(callError) {
  13658. let _self = this;
  13659. this._tempEntitys = [];
  13660. this._clear(this._isClear);
  13661. this._setMousePointerStyle();
  13662. if (this._isRuntimeApp()) {
  13663. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
  13664. } else {
  13665. this._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
  13666. }
  13667. if (this._isRuntimeWeb()) {
  13668. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Line, {
  13669. onAdded: function(cPoints, gPoints) {
  13670. if (cPoints.length === 1) {
  13671. _self._createPoint(cPoints[0], "\u8D77\u70B9");
  13672. } else {
  13673. let distince = _self._measureDistance(cPoints);
  13674. let tempPoints = [cPoints[cPoints.length - 2], cPoints[cPoints.length - 1]];
  13675. distince += " +" + _self._measureDistance(tempPoints);
  13676. _self._tempEntitys.push(_self._createPoint(
  13677. cPoints[cPoints.length - 1],
  13678. distince
  13679. ));
  13680. }
  13681. },
  13682. onUndo: function() {
  13683. _self._viewer.entities.remove(_self._tempEntitys[_self._tempEntitys.length - 1]);
  13684. _self._tempEntitys.pop();
  13685. },
  13686. onMoving: function(cPoint, scPoint) {
  13687. _self._tooltipSetText("\u53F3\u952E\u5355\u51FB\u56DE\u9000<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  13688. },
  13689. onError: function(error) {
  13690. if (callError)
  13691. callError(error);
  13692. },
  13693. onComplete: function(cPoints, gPoints) {
  13694. _self._initMousePointerStyle();
  13695. _self._tooltipRemove();
  13696. }
  13697. });
  13698. } else {
  13699. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Line, {
  13700. onAdded: function(cPoints, gPoints) {
  13701. if (cPoints.length === 1) {
  13702. _self._tooltipRemove();
  13703. _self._createPoint(cPoints[0], "\u8D77\u70B9");
  13704. let buttonDiv = document.getElementById("drawButtonDiv");
  13705. if (buttonDiv == null) {
  13706. _self._createOperationMainDom();
  13707. document.getElementById("btnDrawBackout").onclick = () => {
  13708. if (_self._sketchViewModel._sketchTempPoints.length > 2) {
  13709. _self._sketchViewModel._sketchPoints.pop();
  13710. _self._sketchViewModel._sketchTempPoints.splice(_self._sketchViewModel._sketchTempPoints.length - 1, 1);
  13711. if (_self._sketchViewModel._isDrawPoint) {
  13712. let lastPointEntity = _self._sketchViewModel._pointEntitys[_self._sketchViewModel._pointEntitys.length - 1];
  13713. _self._sketchViewModel._entities.remove(lastPointEntity);
  13714. _self._sketchViewModel._pointEntitys.pop();
  13715. }
  13716. _self._viewer.entities.remove(_self._tempEntitys[_self._tempEntitys.length - 1]);
  13717. _self._tempEntitys.pop();
  13718. }
  13719. };
  13720. document.getElementById("btnDrawComplete").onclick = () => {
  13721. if (_self._sketchViewModel._sketchPoints.length < 2) {
  13722. if (callError)
  13723. callError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  13724. return;
  13725. }
  13726. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolyline);
  13727. _self._sketchViewModel._createPolyline();
  13728. if (!_self._sketchViewModel._isRetainDrawPoint)
  13729. _self._sketchViewModel._removePointEntitys();
  13730. _self._sketchViewModel._clearEvent(_self._sketchViewModel._sketchEventHandler);
  13731. _self._initMousePointerStyle();
  13732. _self._tooltipRemove();
  13733. let buttonDiv2 = document.getElementById("drawButtonDiv");
  13734. if (buttonDiv2) {
  13735. document.body.removeChild(buttonDiv2);
  13736. }
  13737. };
  13738. }
  13739. } else {
  13740. let distince = _self._measureDistance(cPoints);
  13741. let tempPoints = [cPoints[cPoints.length - 2], cPoints[cPoints.length - 1]];
  13742. distince += " +" + _self._measureDistance(tempPoints);
  13743. _self._tempEntitys.push(_self._createPoint(cPoints[cPoints.length - 1], distince));
  13744. }
  13745. }
  13746. });
  13747. }
  13748. },
  13749. measureSpatialLength: function(callError) {
  13750. let _self = this;
  13751. this._clear(this._isClear);
  13752. this._setMousePointerStyle();
  13753. if (this._isRuntimeApp()) {
  13754. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
  13755. } else {
  13756. this._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
  13757. }
  13758. this._tempEntitys = [];
  13759. if (this._isRuntimeWeb()) {
  13760. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Spatial, {
  13761. onAdded: function(cPoints, gPoints) {
  13762. if (cPoints.length === 1) {
  13763. _self._createPoint(cPoints[0], "\u8D77\u70B9");
  13764. } else {
  13765. let distince = _self._measureSpaceDistance(cPoints);
  13766. _self._tempEntitys.push(_self._createPoint(
  13767. cPoints[cPoints.length - 1],
  13768. distince
  13769. ));
  13770. }
  13771. },
  13772. onUndo: function() {
  13773. _self._viewer.entities.remove(_self._tempEntitys[_self._tempEntitys.length - 1]);
  13774. _self._tempEntitys.pop();
  13775. },
  13776. onMoving: function(cPoint, scPoint) {
  13777. _self._tooltipSetText("\u53F3\u952E\u5355\u51FB\u56DE\u9000<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  13778. },
  13779. onError: function(error) {
  13780. if (callError)
  13781. callError(error);
  13782. },
  13783. onComplete: function(cPoints, gPoints) {
  13784. _self._initMousePointerStyle();
  13785. _self._tooltipRemove();
  13786. }
  13787. });
  13788. } else {
  13789. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Spatial, {
  13790. onAdded: function(cPoints, gPoints) {
  13791. if (cPoints.length === 1) {
  13792. _self._tooltipRemove();
  13793. _self._createPoint(cPoints[0], "\u8D77\u70B9");
  13794. let buttonDiv = document.getElementById("drawButtonDiv");
  13795. if (buttonDiv == null) {
  13796. _self._createOperationMainDom();
  13797. document.getElementById("btnDrawBackout").onclick = () => {
  13798. if (_self._sketchViewModel._sketchTempPoints.length > 2) {
  13799. _self._sketchViewModel._sketchPoints.pop();
  13800. _self._sketchViewModel._sketchTempPoints.splice(_self._sketchViewModel._sketchTempPoints.length - 1, 1);
  13801. _self._viewer.entities.remove(_self._tempEntitys[_self._tempEntitys.length - 1]);
  13802. _self._tempEntitys.pop();
  13803. }
  13804. };
  13805. document.getElementById("btnDrawComplete").onclick = () => {
  13806. if (_self._sketchViewModel._sketchPoints.length < 2) {
  13807. if (callError)
  13808. callError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  13809. return;
  13810. }
  13811. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempSpatialPolyline);
  13812. _self._sketchViewModel._createSpatialPolyline();
  13813. _self._sketchViewModel._removePointEntitys();
  13814. _self._sketchViewModel._clearEvent(_self._sketchViewModel._sketchEventHandler);
  13815. _self._initMousePointerStyle();
  13816. _self._tooltipRemove();
  13817. let buttonDiv2 = document.getElementById("drawButtonDiv");
  13818. if (buttonDiv2) {
  13819. document.body.removeChild(buttonDiv2);
  13820. }
  13821. };
  13822. }
  13823. } else {
  13824. let distince = _self._measureSpaceDistance(cPoints);
  13825. _self._tempEntitys.push(_self._createPoint(cPoints[cPoints.length - 1], distince));
  13826. }
  13827. }
  13828. });
  13829. }
  13830. },
  13831. measureArea: function(callError) {
  13832. let _self = this;
  13833. this._clear(this._isClear);
  13834. this._setMousePointerStyle();
  13835. if (this._isRuntimeApp()) {
  13836. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
  13837. } else {
  13838. this._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
  13839. }
  13840. var _areaLabel = "";
  13841. if (this._isRuntimeWeb()) {
  13842. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Polygon, {
  13843. onAdded: function(cPoints, gPoints) {
  13844. _self._measureTempPoints.push(_self._cartesianToGeography(cPoints[cPoints.length - 1]));
  13845. if (cPoints.length === 1) {
  13846. _areaLabel = "\u8D77\u70B9";
  13847. _self._createPoint(cPoints[0], new Cesium.CallbackProperty(function() {
  13848. var lable = _areaLabel;
  13849. return lable;
  13850. }, false));
  13851. } else if (cPoints.length >= 3) {
  13852. let area = _self._measureArea(_self._measureTempPoints, cPoints);
  13853. if (area > 1e5) {
  13854. _areaLabel = (area / 1e5).toFixed(2) + "km\xB2";
  13855. } else {
  13856. _areaLabel = area.toFixed(2) + "m\xB2";
  13857. }
  13858. }
  13859. },
  13860. onUndo: function() {
  13861. _self._measureTempPoints.pop();
  13862. if (_self._measureTempPoints.length === 1)
  13863. _self._areaLabel = "\u8D77\u70B9";
  13864. },
  13865. onMoving: function(cPoint, scPoint) {
  13866. _self._tooltipSetText("\u53F3\u952E\u5355\u51FB\u56DE\u9000<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  13867. },
  13868. onError: function(error) {
  13869. if (callError)
  13870. callError(error);
  13871. },
  13872. onComplete: function(cPoints, gPoints) {
  13873. _self._initMousePointerStyle();
  13874. _self._tooltipRemove();
  13875. }
  13876. });
  13877. } else {
  13878. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Polygon, {
  13879. onAdded: function(cPoints, gPoints) {
  13880. _self._measureTempPoints.push(_self._cartesianToGeography(cPoints[cPoints.length - 1]));
  13881. if (cPoints.length === 1) {
  13882. _self._tooltipRemove();
  13883. _areaLabel = "\u8D77\u70B9";
  13884. _self._createPoint(cPoints[0], new Cesium.CallbackProperty(function() {
  13885. var lable = _areaLabel;
  13886. return lable;
  13887. }, false));
  13888. let buttonDiv = document.getElementById("drawButtonDiv");
  13889. if (buttonDiv == null) {
  13890. _self._createOperationMainDom();
  13891. document.getElementById("btnDrawBackout").onclick = () => {
  13892. if (_self._sketchViewModel._sketchTempPoints.length > 2) {
  13893. _self._sketchViewModel._sketchPoints.pop();
  13894. _self._sketchViewModel._sketchTempPoints.splice(_self._sketchViewModel._sketchTempPoints.length - 1, 1);
  13895. if (_self._sketchViewModel._isDrawPoint) {
  13896. let lastPointEntity = _self._sketchViewModel._pointEntitys[_self._sketchViewModel._pointEntitys.length - 1];
  13897. _self._entities.remove(lastPointEntity);
  13898. _self._sketchViewModel._pointEntitys.pop();
  13899. }
  13900. _self._measureTempPoints.pop();
  13901. if (_self._measureTempPoints.length === 1)
  13902. _self._areaLabel = "\u8D77\u70B9";
  13903. }
  13904. };
  13905. document.getElementById("btnDrawComplete").onclick = () => {
  13906. if (_self._sketchViewModel._sketchPoints.length < 3) {
  13907. if (callError)
  13908. callError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  13909. return;
  13910. }
  13911. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolygon);
  13912. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolyline);
  13913. _self._sketchViewModel._createPolygon();
  13914. if (!_self._sketchViewModel._isRetainDrawPoint)
  13915. _self._sketchViewModel._removePointEntitys();
  13916. _self._sketchViewModel._clearEvent(_self._sketchViewModel._sketchEventHandler);
  13917. _self._initMousePointerStyle();
  13918. _self._tooltipRemove();
  13919. let buttonDiv2 = document.getElementById("drawButtonDiv");
  13920. if (buttonDiv2) {
  13921. document.body.removeChild(buttonDiv2);
  13922. }
  13923. };
  13924. }
  13925. } else if (cPoints.length >= 3) {
  13926. let area = _self._measureArea(_self._measureTempPoints, cPoints);
  13927. if (area > 1e5) {
  13928. _areaLabel = (area / 1e5).toFixed(2) + "km\xB2";
  13929. } else {
  13930. _areaLabel = area.toFixed(2) + "m\xB2";
  13931. }
  13932. }
  13933. }
  13934. });
  13935. }
  13936. },
  13937. measureHeight: function(callError) {
  13938. let _self = this;
  13939. this._clear(this._isClear);
  13940. this._setMousePointerStyle();
  13941. if (this._isRuntimeApp()) {
  13942. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
  13943. } else {
  13944. this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
  13945. }
  13946. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Height, {
  13947. onAdded: function(cPoint) {
  13948. if (_self._isRuntimeApp()) {
  13949. _self._showTooltipMessage("\u518D\u6B21\u70B9\u51FB\u7ED3\u675F\u6D4B\u91CF");
  13950. } else {
  13951. _self._tooltipSetText("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u6D4B\u91CF");
  13952. }
  13953. },
  13954. onMoving: function(cPoints, centerPoint) {
  13955. let height2 = _self._calculatePolylineAltitudeHeight(cPoints);
  13956. _self._altitudeLabelPosition = centerPoint;
  13957. _self._altitudeLabelText = height2;
  13958. if (_self._altitudeDynamicLabel === void 0) {
  13959. _self._createAltitudeDynamicLabel();
  13960. }
  13961. },
  13962. onError: function(error) {
  13963. if (callError)
  13964. callError(error);
  13965. },
  13966. onComplete: function(cPoints, centerPoint) {
  13967. let height2 = _self._calculatePolylineAltitudeHeight(cPoints);
  13968. _self._entities.remove(_self._altitudeDynamicLabel);
  13969. _self._createLabel(centerPoint, height2);
  13970. _self._initMousePointerStyle();
  13971. _self._tooltipRemove();
  13972. }
  13973. });
  13974. },
  13975. measureTriangle: function(callError) {
  13976. let _self = this;
  13977. this._clear(this._isClear);
  13978. this._setMousePointerStyle();
  13979. if (this._isRuntimeApp()) {
  13980. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
  13981. } else {
  13982. this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
  13983. }
  13984. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Triangle, {
  13985. onAdded: function(cPoint) {
  13986. if (_self._isRuntimeApp()) {
  13987. _self._showTooltipMessage("\u518D\u6B21\u70B9\u51FB\u7ED3\u675F\u6D4B\u91CF");
  13988. } else {
  13989. _self._tooltipSetText("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u6D4B\u91CF");
  13990. }
  13991. },
  13992. onMoving: function(cPoint) {
  13993. _self._tooltipSetText("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u6D4B\u91CF");
  13994. },
  13995. onError: function(error) {
  13996. if (callError)
  13997. callError(error);
  13998. },
  13999. onComplete: function(positions) {
  14000. _self._initMousePointerStyle();
  14001. _self._tooltipRemove();
  14002. let sPoints = [positions[0], positions[1]];
  14003. let sDistince = _self._measureSpaceDistance(sPoints);
  14004. let hPoints = [positions[1], positions[2]];
  14005. let hDistince = _self._measureSpaceDistance(hPoints);
  14006. let hePoints = [positions[2], positions[0]];
  14007. let height2 = _self._calculatePolylineAltitudeHeight(hePoints);
  14008. _self._createLabel(positions[0], "\u659C\u8DDD:" + sDistince);
  14009. _self._createLabel(positions[1], "\u5E73\u8DDD:" + hDistince);
  14010. _self._createLabel(positions[2], "\u9AD8\u5EA6:" + height2);
  14011. }
  14012. });
  14013. }
  14014. });
  14015. Object.assign(CommonTools.prototype, {
  14016. queryByPoint: function(callComplete) {
  14017. let _self = this;
  14018. this._setMousePointerStyle();
  14019. this._clear(this._isClear);
  14020. if (this._isRuntimeApp()) {
  14021. this._showTooltipMessage("\u70B9\u51FB\u4F4D\u7F6E\u8FDB\u884C\u67E5\u8BE2");
  14022. } else {
  14023. this._tooltipInit("\u5355\u51FB\u4F4D\u7F6E\u8FDB\u884C\u67E5\u8BE2");
  14024. }
  14025. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Point, {
  14026. onComplete: function(cPoint, gPoint) {
  14027. _self._initMousePointerStyle();
  14028. _self._tooltipRemove();
  14029. _self._createPoint(cPoint);
  14030. let coordinates = gPoint.lng + "," + gPoint.lat;
  14031. if (callComplete)
  14032. callComplete(coordinates);
  14033. }
  14034. });
  14035. },
  14036. queryByMultiplePoint: function(callComplete) {
  14037. let _self = this;
  14038. this._setMousePointerStyle();
  14039. this._clear(this._isClear);
  14040. this._tooltipInit("\u70B9\u51FB\u4F4D\u7F6E\u7ED8\u5236<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  14041. this._tempEntitys = [];
  14042. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.MultiplePoint, {
  14043. onAdded: function(cPoint, gPoint) {
  14044. let res = gPoint.lng.toFixed(6) + "," + gPoint.lat.toFixed(6);
  14045. _self._tempEntitys.push(_self._createPoint(cPoint, res));
  14046. },
  14047. onUndo: function() {
  14048. _self._viewer.entities.remove(_self._tempEntitys[_self._tempEntitys.length - 1]);
  14049. _self._tempEntitys.pop();
  14050. },
  14051. onComplete: function(cPoints, gPoints) {
  14052. _self._initMousePointerStyle();
  14053. _self._tooltipRemove();
  14054. let res = [];
  14055. for (let i2 = 0; i2 < gPoints.length; i2++) {
  14056. res.push(gPoints[i2].lng);
  14057. res.push(gPoints[i2].lat);
  14058. }
  14059. if (callComplete)
  14060. callComplete(res);
  14061. }
  14062. });
  14063. },
  14064. queryByLine: function(callComplete, callError) {
  14065. let _self = this;
  14066. this._clear(this._isClear);
  14067. this._setMousePointerStyle();
  14068. if (this._isRuntimeApp()) {
  14069. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
  14070. } else {
  14071. this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
  14072. }
  14073. if (this._isRuntimeWeb()) {
  14074. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Line, {
  14075. onAdded: function(cPoints, gPoints) {
  14076. },
  14077. onMoving: function(cPoint, scPoint) {
  14078. _self._tooltipSetText("\u53F3\u952E\u5355\u51FB\u56DE\u9000<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236\u5F00\u59CB\u67E5\u8BE2");
  14079. },
  14080. onError: function(error) {
  14081. if (callError)
  14082. callError(error);
  14083. },
  14084. onComplete: function(cPoints, gPoints) {
  14085. _self._initMousePointerStyle();
  14086. _self._tooltipRemove();
  14087. let coordinates = void 0;
  14088. for (let i2 = 0; i2 < gPoints.length; i2++) {
  14089. let point2 = gPoints[i2];
  14090. if (coordinates === void 0)
  14091. coordinates = point2.lng + "," + point2.lat;
  14092. else
  14093. coordinates += "," + point2.lng + "," + point2.lat;
  14094. }
  14095. if (callComplete)
  14096. callComplete(coordinates);
  14097. }
  14098. });
  14099. } else {
  14100. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Line, {
  14101. onAdded: function(cPoints, gPoints) {
  14102. if (cPoints.length === 1) {
  14103. _self._tooltipRemove();
  14104. let buttonDiv = document.getElementById("drawButtonDiv");
  14105. if (buttonDiv == null) {
  14106. _self._createOperationMainDom();
  14107. document.getElementById("btnDrawBackout").onclick = () => {
  14108. if (_self._sketchViewModel._sketchTempPoints.length > 2) {
  14109. _self._sketchViewModel._sketchPoints.pop();
  14110. _self._sketchViewModel._sketchTempPoints.splice(_self._sketchViewModel._sketchTempPoints.length - 1, 1);
  14111. if (_self._sketchViewModel._isDrawPoint) {
  14112. let lastPointEntity = _self._sketchViewModel._pointEntitys[_self._sketchViewModel._pointEntitys.length - 1];
  14113. _self._sketchViewModel._entities.remove(lastPointEntity);
  14114. _self._sketchViewModel._pointEntitys.pop();
  14115. }
  14116. }
  14117. };
  14118. document.getElementById("btnDrawComplete").onclick = () => {
  14119. if (_self._sketchViewModel._sketchPoints.length < 2) {
  14120. if (callError)
  14121. callError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  14122. return;
  14123. }
  14124. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolyline);
  14125. _self._sketchViewModel._createPolyline();
  14126. if (!_self._sketchViewModel._isRetainDrawPoint)
  14127. _self._sketchViewModel._removePointEntitys();
  14128. _self._sketchViewModel._clearEvent(_self._sketchViewModel._sketchEventHandler);
  14129. _self._initMousePointerStyle();
  14130. _self._tooltipRemove();
  14131. let coordinates = void 0;
  14132. for (let i2 = 0; i2 < gPoints.length; i2++) {
  14133. let point2 = gPoints[i2];
  14134. if (coordinates === void 0)
  14135. coordinates = point2.lng + "," + point2.lat;
  14136. else
  14137. coordinates += "," + point2.lng + "," + point2.lat;
  14138. }
  14139. let buttonDiv2 = document.getElementById("drawButtonDiv");
  14140. if (buttonDiv2) {
  14141. document.body.removeChild(buttonDiv2);
  14142. }
  14143. if (callComplete)
  14144. callComplete(coordinates);
  14145. };
  14146. }
  14147. }
  14148. }
  14149. });
  14150. }
  14151. },
  14152. queryByPolygon: function(callComplete, callError) {
  14153. let _self = this;
  14154. this._clear(this._isClear);
  14155. this._setMousePointerStyle();
  14156. if (this._isRuntimeApp()) {
  14157. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u533A\u57DF");
  14158. } else {
  14159. this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u533A\u57DF");
  14160. }
  14161. if (this._isRuntimeWeb()) {
  14162. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Polygon, {
  14163. onMoving: function(cPoint, scPoint) {
  14164. _self._tooltipSetText("\u53F3\u952E\u5355\u51FB\u56DE\u9000<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236\u5F00\u59CB\u67E5\u8BE2");
  14165. },
  14166. onError: function(error) {
  14167. if (callError)
  14168. callError(error);
  14169. },
  14170. onComplete: function(cPoints, gPoints) {
  14171. _self._initMousePointerStyle();
  14172. _self._tooltipRemove();
  14173. let coordinates = void 0;
  14174. for (let i2 = 0; i2 < gPoints.length; i2++) {
  14175. let point2 = gPoints[i2];
  14176. if (coordinates === void 0)
  14177. coordinates = point2.lng + "," + point2.lat;
  14178. else
  14179. coordinates += "," + point2.lng + "," + point2.lat;
  14180. }
  14181. coordinates += "," + gPoints[0].lng + "," + gPoints[0].lat;
  14182. if (callComplete)
  14183. callComplete(coordinates);
  14184. }
  14185. });
  14186. } else {
  14187. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Polygon, {
  14188. onAdded: function(cPoints, gPoints) {
  14189. if (cPoints.length === 1) {
  14190. _self._tooltipRemove();
  14191. let buttonDiv = document.getElementById("drawButtonDiv");
  14192. if (buttonDiv == null) {
  14193. _self._createOperationMainDom();
  14194. document.getElementById("btnDrawBackout").onclick = () => {
  14195. if (_self._sketchViewModel._sketchTempPoints.length > 2) {
  14196. _self._sketchViewModel._sketchPoints.pop();
  14197. _self._sketchViewModel._sketchTempPoints.splice(_self._sketchViewModel._sketchTempPoints.length - 1, 1);
  14198. if (_self._sketchViewModel._isDrawPoint) {
  14199. let lastPointEntity = _self._sketchViewModel._pointEntitys[_self._sketchViewModel._pointEntitys.length - 1];
  14200. _self._entities.remove(lastPointEntity);
  14201. _self._sketchViewModel._pointEntitys.pop();
  14202. }
  14203. }
  14204. };
  14205. document.getElementById("btnDrawComplete").onclick = () => {
  14206. if (_self._sketchViewModel._sketchPoints.length < 3) {
  14207. if (callError)
  14208. callError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  14209. return;
  14210. }
  14211. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolygon);
  14212. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolyline);
  14213. _self._sketchViewModel._createPolygon();
  14214. if (!_self._sketchViewModel._isRetainDrawPoint)
  14215. _self._sketchViewModel._removePointEntitys();
  14216. _self._sketchViewModel._clearEvent(_self._sketchViewModel._sketchEventHandler);
  14217. _self._initMousePointerStyle();
  14218. _self._tooltipRemove();
  14219. let coordinates = void 0;
  14220. for (let i2 = 0; i2 < gPoints.length; i2++) {
  14221. let point2 = gPoints[i2];
  14222. if (coordinates === void 0)
  14223. coordinates = point2.lng + "," + point2.lat;
  14224. else
  14225. coordinates += "," + point2.lng + "," + point2.lat;
  14226. }
  14227. coordinates += "," + gPoints[0].lng + "," + gPoints[0].lat;
  14228. let buttonDiv2 = document.getElementById("drawButtonDiv");
  14229. if (buttonDiv2) {
  14230. document.body.removeChild(buttonDiv2);
  14231. }
  14232. if (callComplete)
  14233. callComplete(coordinates);
  14234. };
  14235. }
  14236. }
  14237. }
  14238. });
  14239. }
  14240. },
  14241. queryByCircle: function(callComplete) {
  14242. let _self = this;
  14243. this._clear(this._isClear);
  14244. this._setMousePointerStyle();
  14245. if (this._isRuntimeApp()) {
  14246. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u5706");
  14247. } else {
  14248. this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u5706");
  14249. }
  14250. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Circle, {
  14251. onAdded: function(center2) {
  14252. if (_self._isRuntimeApp()) {
  14253. _self._showTooltipMessage("\u518D\u6B21\u70B9\u51FB\u7ED3\u675F\u7ED8\u5236");
  14254. } else {
  14255. _self._tooltipInit("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u7ED8\u5236");
  14256. }
  14257. },
  14258. onComplete: function(center2, radius) {
  14259. _self._initMousePointerStyle();
  14260. _self._tooltipRemove();
  14261. if (callComplete)
  14262. callComplete(center2.lng + "," + center2.lat, radius);
  14263. }
  14264. });
  14265. },
  14266. queryByRectangle: function(callComplete) {
  14267. let _self = this;
  14268. this._clear(this._isClear);
  14269. this._setMousePointerStyle();
  14270. if (this._isRuntimeApp()) {
  14271. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u77E9\u5F62");
  14272. } else {
  14273. this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u77E9\u5F62");
  14274. }
  14275. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Rectangle, {
  14276. onAdded: function(center2) {
  14277. if (_self._isRuntimeApp()) {
  14278. _self._showTooltipMessage("\u518D\u6B21\u70B9\u51FB\u7ED3\u675F\u7ED8\u5236");
  14279. } else {
  14280. _self._tooltipInit("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u7ED8\u5236");
  14281. }
  14282. },
  14283. onComplete: function(gPoints) {
  14284. _self._initMousePointerStyle();
  14285. _self._tooltipRemove();
  14286. let coordinates = void 0;
  14287. for (let i2 = 0; i2 < gPoints.length; i2++) {
  14288. let point2 = gPoints[i2];
  14289. if (coordinates === void 0)
  14290. coordinates = point2.lng + "," + point2.lat;
  14291. else
  14292. coordinates += "," + point2.lng + "," + point2.lat;
  14293. }
  14294. if (callComplete)
  14295. callComplete(coordinates);
  14296. }
  14297. });
  14298. }
  14299. });
  14300. Object.assign(CommonTools.prototype, {
  14301. drawPolygonBody: function(callComplete) {
  14302. let _self = this;
  14303. this._clear(this._isClear);
  14304. this._setMousePointerStyle();
  14305. this._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  14306. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.PolygonBody, {
  14307. onAdded: function(cPoints, gPoints) {
  14308. if (cPoints.length === 0) {
  14309. _self._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  14310. } else if (cPoints.length < 3) {
  14311. _self._tooltipInit("\u53F3\u952E\u5355\u51FB\u56DE\u9000");
  14312. } else {
  14313. _self._tooltipInit("\u53F3\u952E\u5355\u51FB\u56DE\u9000<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  14314. }
  14315. },
  14316. onUndo: function(cPoints) {
  14317. if (cPoints.length === 0) {
  14318. _self._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  14319. } else if (cPoints.length < 3) {
  14320. _self._tooltipInit("\u53F3\u952E\u5355\u51FB\u56DE\u9000");
  14321. } else {
  14322. _self._tooltipInit("\u53F3\u952E\u5355\u51FB\u56DE\u9000<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  14323. }
  14324. },
  14325. onComplete: function(cPoints, gPoints) {
  14326. _self._initMousePointerStyle();
  14327. _self._tooltipRemove();
  14328. if (callComplete)
  14329. callComplete();
  14330. }
  14331. });
  14332. },
  14333. drawPointFeacture: function(points2, options2) {
  14334. this._sketchViewModel.sketchDrawFeacture(points2, SketchViewModel.SketchType.DrawPoint, options2);
  14335. },
  14336. drawMultiplePointFeacture: function(points2, options2) {
  14337. this._sketchViewModel.sketchDrawFeacture(points2, SketchViewModel.SketchType.DrawMultiplePoint, options2);
  14338. },
  14339. drawPolylineFeacture: function(points2, options2) {
  14340. this._sketchViewModel.sketchDrawFeacture(points2, SketchViewModel.SketchType.DrawPolyline, options2);
  14341. },
  14342. drawPolygonFeacture: function(points2, options2) {
  14343. this._sketchViewModel.sketchDrawFeacture(points2, SketchViewModel.SketchType.DrawPolygon, options2);
  14344. }
  14345. });
  14346. Object.assign(CommonTools.prototype, {
  14347. tooltipInit: function(text) {
  14348. this._tooltipInit(text);
  14349. },
  14350. tooltipRemove: function() {
  14351. this._tooltipRemove();
  14352. },
  14353. tooltipSetText: function(text) {
  14354. this._tooltipSetText(text);
  14355. }
  14356. });
  14357. Object.assign(CommonTools.prototype, {
  14358. pickPolygonBody: function(callComplete) {
  14359. this._sketchViewModel.sketchPick(function(options2) {
  14360. if (options2 === void 0) {
  14361. if (callComplete)
  14362. callComplete(void 0);
  14363. } else {
  14364. if (callComplete)
  14365. callComplete({
  14366. color: options2.color,
  14367. height: options2.height
  14368. });
  14369. }
  14370. });
  14371. },
  14372. setPolygonBody: function(options2) {
  14373. this._sketchViewModel.sketchEditPickPolygonBody({
  14374. color: options2.color,
  14375. height: options2.height,
  14376. onComplete: options2.onComplete
  14377. });
  14378. },
  14379. removePolygonBody: function(onComplete) {
  14380. this._sketchViewModel.sketchRemovePickPolygonBody(onComplete);
  14381. }
  14382. });
  14383. CommonTools.RuntimeEnvironment = Object.freeze({
  14384. App: "app",
  14385. Web: "web"
  14386. });
  14387. const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
  14388. const handleEvent = (event2) => {
  14389. const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event2);
  14390. if (checkForDefaultPrevented === false || !shouldPrevent) {
  14391. return oursHandler == null ? void 0 : oursHandler(event2);
  14392. }
  14393. };
  14394. return handleEvent;
  14395. };
  14396. var _a;
  14397. const isClient = typeof window !== "undefined";
  14398. const isString$1 = (val) => typeof val === "string";
  14399. const noop$3 = () => {
  14400. };
  14401. const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
  14402. function resolveUnref(r2) {
  14403. return typeof r2 === "function" ? r2() : unref(r2);
  14404. }
  14405. function identity(arg) {
  14406. return arg;
  14407. }
  14408. function tryOnScopeDispose(fn2) {
  14409. if (getCurrentScope()) {
  14410. onScopeDispose(fn2);
  14411. return true;
  14412. }
  14413. return false;
  14414. }
  14415. function tryOnMounted(fn2, sync = true) {
  14416. if (getCurrentInstance())
  14417. onMounted(fn2);
  14418. else if (sync)
  14419. fn2();
  14420. else
  14421. nextTick(fn2);
  14422. }
  14423. function useTimeoutFn(cb, interval, options2 = {}) {
  14424. const {
  14425. immediate = true
  14426. } = options2;
  14427. const isPending = ref(false);
  14428. let timer = null;
  14429. function clear() {
  14430. if (timer) {
  14431. clearTimeout(timer);
  14432. timer = null;
  14433. }
  14434. }
  14435. function stop() {
  14436. isPending.value = false;
  14437. clear();
  14438. }
  14439. function start2(...args) {
  14440. clear();
  14441. isPending.value = true;
  14442. timer = setTimeout(() => {
  14443. isPending.value = false;
  14444. timer = null;
  14445. cb(...args);
  14446. }, resolveUnref(interval));
  14447. }
  14448. if (immediate) {
  14449. isPending.value = true;
  14450. if (isClient)
  14451. start2();
  14452. }
  14453. tryOnScopeDispose(stop);
  14454. return {
  14455. isPending: readonly(isPending),
  14456. start: start2,
  14457. stop
  14458. };
  14459. }
  14460. function unrefElement(elRef) {
  14461. var _a2;
  14462. const plain = resolveUnref(elRef);
  14463. return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
  14464. }
  14465. const defaultWindow = isClient ? window : void 0;
  14466. function useEventListener(...args) {
  14467. let target;
  14468. let events;
  14469. let listeners;
  14470. let options2;
  14471. if (isString$1(args[0]) || Array.isArray(args[0])) {
  14472. [events, listeners, options2] = args;
  14473. target = defaultWindow;
  14474. } else {
  14475. [target, events, listeners, options2] = args;
  14476. }
  14477. if (!target)
  14478. return noop$3;
  14479. if (!Array.isArray(events))
  14480. events = [events];
  14481. if (!Array.isArray(listeners))
  14482. listeners = [listeners];
  14483. const cleanups = [];
  14484. const cleanup = () => {
  14485. cleanups.forEach((fn2) => fn2());
  14486. cleanups.length = 0;
  14487. };
  14488. const register = (el, event2, listener, options22) => {
  14489. el.addEventListener(event2, listener, options22);
  14490. return () => el.removeEventListener(event2, listener, options22);
  14491. };
  14492. const stopWatch = watch(() => [unrefElement(target), resolveUnref(options2)], ([el, options22]) => {
  14493. cleanup();
  14494. if (!el)
  14495. return;
  14496. cleanups.push(...events.flatMap((event2) => {
  14497. return listeners.map((listener) => register(el, event2, listener, options22));
  14498. }));
  14499. }, { immediate: true, flush: "post" });
  14500. const stop = () => {
  14501. stopWatch();
  14502. cleanup();
  14503. };
  14504. tryOnScopeDispose(stop);
  14505. return stop;
  14506. }
  14507. let _iOSWorkaround = false;
  14508. function onClickOutside(target, handler, options2 = {}) {
  14509. const { window: window2 = defaultWindow, ignore = [], capture = true, detectIframe = false } = options2;
  14510. if (!window2)
  14511. return;
  14512. if (isIOS && !_iOSWorkaround) {
  14513. _iOSWorkaround = true;
  14514. Array.from(window2.document.body.children).forEach((el) => el.addEventListener("click", noop$3));
  14515. }
  14516. let shouldListen = true;
  14517. const shouldIgnore = (event2) => {
  14518. return ignore.some((target2) => {
  14519. if (typeof target2 === "string") {
  14520. return Array.from(window2.document.querySelectorAll(target2)).some((el) => el === event2.target || event2.composedPath().includes(el));
  14521. } else {
  14522. const el = unrefElement(target2);
  14523. return el && (event2.target === el || event2.composedPath().includes(el));
  14524. }
  14525. });
  14526. };
  14527. const listener = (event2) => {
  14528. const el = unrefElement(target);
  14529. if (!el || el === event2.target || event2.composedPath().includes(el))
  14530. return;
  14531. if (event2.detail === 0)
  14532. shouldListen = !shouldIgnore(event2);
  14533. if (!shouldListen) {
  14534. shouldListen = true;
  14535. return;
  14536. }
  14537. handler(event2);
  14538. };
  14539. const cleanup = [
  14540. useEventListener(window2, "click", listener, { passive: true, capture }),
  14541. useEventListener(window2, "pointerdown", (e) => {
  14542. const el = unrefElement(target);
  14543. if (el)
  14544. shouldListen = !e.composedPath().includes(el) && !shouldIgnore(e);
  14545. }, { passive: true }),
  14546. detectIframe && useEventListener(window2, "blur", (event2) => {
  14547. var _a2;
  14548. const el = unrefElement(target);
  14549. if (((_a2 = window2.document.activeElement) == null ? void 0 : _a2.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window2.document.activeElement)))
  14550. handler(event2);
  14551. })
  14552. ].filter(Boolean);
  14553. const stop = () => cleanup.forEach((fn2) => fn2());
  14554. return stop;
  14555. }
  14556. function useSupported(callback2, sync = false) {
  14557. const isSupported = ref();
  14558. const update = () => isSupported.value = Boolean(callback2());
  14559. update();
  14560. tryOnMounted(update, sync);
  14561. return isSupported;
  14562. }
  14563. const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  14564. const globalKey = "__vueuse_ssr_handlers__";
  14565. _global[globalKey] = _global[globalKey] || {};
  14566. _global[globalKey];
  14567. var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
  14568. var __hasOwnProp$g = Object.prototype.hasOwnProperty;
  14569. var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
  14570. var __objRest$2 = (source, exclude) => {
  14571. var target = {};
  14572. for (var prop in source)
  14573. if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
  14574. target[prop] = source[prop];
  14575. if (source != null && __getOwnPropSymbols$g)
  14576. for (var prop of __getOwnPropSymbols$g(source)) {
  14577. if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop))
  14578. target[prop] = source[prop];
  14579. }
  14580. return target;
  14581. };
  14582. function useResizeObserver(target, callback2, options2 = {}) {
  14583. const _a2 = options2, { window: window2 = defaultWindow } = _a2, observerOptions = __objRest$2(_a2, ["window"]);
  14584. let observer;
  14585. const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
  14586. const cleanup = () => {
  14587. if (observer) {
  14588. observer.disconnect();
  14589. observer = void 0;
  14590. }
  14591. };
  14592. const stopWatch = watch(() => unrefElement(target), (el) => {
  14593. cleanup();
  14594. if (isSupported.value && window2 && el) {
  14595. observer = new ResizeObserver(callback2);
  14596. observer.observe(el, observerOptions);
  14597. }
  14598. }, { immediate: true, flush: "post" });
  14599. const stop = () => {
  14600. cleanup();
  14601. stopWatch();
  14602. };
  14603. tryOnScopeDispose(stop);
  14604. return {
  14605. isSupported,
  14606. stop
  14607. };
  14608. }
  14609. var SwipeDirection;
  14610. (function(SwipeDirection2) {
  14611. SwipeDirection2["UP"] = "UP";
  14612. SwipeDirection2["RIGHT"] = "RIGHT";
  14613. SwipeDirection2["DOWN"] = "DOWN";
  14614. SwipeDirection2["LEFT"] = "LEFT";
  14615. SwipeDirection2["NONE"] = "NONE";
  14616. })(SwipeDirection || (SwipeDirection = {}));
  14617. var __defProp2 = Object.defineProperty;
  14618. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  14619. var __hasOwnProp = Object.prototype.hasOwnProperty;
  14620. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  14621. var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  14622. var __spreadValues = (a, b) => {
  14623. for (var prop in b || (b = {}))
  14624. if (__hasOwnProp.call(b, prop))
  14625. __defNormalProp2(a, prop, b[prop]);
  14626. if (__getOwnPropSymbols)
  14627. for (var prop of __getOwnPropSymbols(b)) {
  14628. if (__propIsEnum.call(b, prop))
  14629. __defNormalProp2(a, prop, b[prop]);
  14630. }
  14631. return a;
  14632. };
  14633. const _TransitionPresets = {
  14634. easeInSine: [0.12, 0, 0.39, 0],
  14635. easeOutSine: [0.61, 1, 0.88, 1],
  14636. easeInOutSine: [0.37, 0, 0.63, 1],
  14637. easeInQuad: [0.11, 0, 0.5, 0],
  14638. easeOutQuad: [0.5, 1, 0.89, 1],
  14639. easeInOutQuad: [0.45, 0, 0.55, 1],
  14640. easeInCubic: [0.32, 0, 0.67, 0],
  14641. easeOutCubic: [0.33, 1, 0.68, 1],
  14642. easeInOutCubic: [0.65, 0, 0.35, 1],
  14643. easeInQuart: [0.5, 0, 0.75, 0],
  14644. easeOutQuart: [0.25, 1, 0.5, 1],
  14645. easeInOutQuart: [0.76, 0, 0.24, 1],
  14646. easeInQuint: [0.64, 0, 0.78, 0],
  14647. easeOutQuint: [0.22, 1, 0.36, 1],
  14648. easeInOutQuint: [0.83, 0, 0.17, 1],
  14649. easeInExpo: [0.7, 0, 0.84, 0],
  14650. easeOutExpo: [0.16, 1, 0.3, 1],
  14651. easeInOutExpo: [0.87, 0, 0.13, 1],
  14652. easeInCirc: [0.55, 0, 1, 0.45],
  14653. easeOutCirc: [0, 0.55, 0.45, 1],
  14654. easeInOutCirc: [0.85, 0, 0.15, 1],
  14655. easeInBack: [0.36, 0, 0.66, -0.56],
  14656. easeOutBack: [0.34, 1.56, 0.64, 1],
  14657. easeInOutBack: [0.68, -0.6, 0.32, 1.6]
  14658. };
  14659. __spreadValues({
  14660. linear: identity
  14661. }, _TransitionPresets);
  14662. const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
  14663. const getClientXY = (event2) => {
  14664. let clientX;
  14665. let clientY;
  14666. if (event2.type === "touchend") {
  14667. clientY = event2.changedTouches[0].clientY;
  14668. clientX = event2.changedTouches[0].clientX;
  14669. } else if (event2.type.startsWith("touch")) {
  14670. clientY = event2.touches[0].clientY;
  14671. clientX = event2.touches[0].clientX;
  14672. } else {
  14673. clientY = event2.clientY;
  14674. clientX = event2.clientX;
  14675. }
  14676. return {
  14677. clientX,
  14678. clientY
  14679. };
  14680. };
  14681. const NOOP = () => {
  14682. };
  14683. const hasOwnProperty$9 = Object.prototype.hasOwnProperty;
  14684. const hasOwn = (val, key) => hasOwnProperty$9.call(val, key);
  14685. const isArray$2 = Array.isArray;
  14686. const isFunction$3 = (val) => typeof val === "function";
  14687. const isString = (val) => typeof val === "string";
  14688. const isObject$5 = (val) => val !== null && typeof val === "object";
  14689. const isPromise$2 = (val) => {
  14690. return isObject$5(val) && isFunction$3(val.then) && isFunction$3(val.catch);
  14691. };
  14692. const objectToString$1 = Object.prototype.toString;
  14693. const toTypeString = (value) => objectToString$1.call(value);
  14694. const toRawType = (value) => {
  14695. return toTypeString(value).slice(8, -1);
  14696. };
  14697. const cacheStringFunction = (fn2) => {
  14698. const cache = /* @__PURE__ */ Object.create(null);
  14699. return (str) => {
  14700. const hit = cache[str];
  14701. return hit || (cache[str] = fn2(str));
  14702. };
  14703. };
  14704. const camelizeRE = /-(\w)/g;
  14705. const camelize = cacheStringFunction((str) => {
  14706. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  14707. });
  14708. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  14709. var freeGlobal$1 = freeGlobal;
  14710. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  14711. var root = freeGlobal$1 || freeSelf || Function("return this")();
  14712. var root$1 = root;
  14713. var Symbol$1 = root$1.Symbol;
  14714. var Symbol$2 = Symbol$1;
  14715. var objectProto$b = Object.prototype;
  14716. var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
  14717. var nativeObjectToString$1 = objectProto$b.toString;
  14718. var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
  14719. function getRawTag(value) {
  14720. var isOwn = hasOwnProperty$8.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  14721. try {
  14722. value[symToStringTag$1] = void 0;
  14723. var unmasked = true;
  14724. } catch (e) {
  14725. }
  14726. var result = nativeObjectToString$1.call(value);
  14727. if (unmasked) {
  14728. if (isOwn) {
  14729. value[symToStringTag$1] = tag;
  14730. } else {
  14731. delete value[symToStringTag$1];
  14732. }
  14733. }
  14734. return result;
  14735. }
  14736. var objectProto$a = Object.prototype;
  14737. var nativeObjectToString = objectProto$a.toString;
  14738. function objectToString(value) {
  14739. return nativeObjectToString.call(value);
  14740. }
  14741. var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
  14742. var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
  14743. function baseGetTag(value) {
  14744. if (value == null) {
  14745. return value === void 0 ? undefinedTag : nullTag;
  14746. }
  14747. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
  14748. }
  14749. function isObjectLike(value) {
  14750. return value != null && typeof value == "object";
  14751. }
  14752. var symbolTag$1 = "[object Symbol]";
  14753. function isSymbol(value) {
  14754. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$1;
  14755. }
  14756. function arrayMap(array, iteratee) {
  14757. var index2 = -1, length = array == null ? 0 : array.length, result = Array(length);
  14758. while (++index2 < length) {
  14759. result[index2] = iteratee(array[index2], index2, array);
  14760. }
  14761. return result;
  14762. }
  14763. var isArray = Array.isArray;
  14764. var isArray$1 = isArray;
  14765. var INFINITY$1 = 1 / 0;
  14766. var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto$1 ? symbolProto$1.toString : void 0;
  14767. function baseToString(value) {
  14768. if (typeof value == "string") {
  14769. return value;
  14770. }
  14771. if (isArray$1(value)) {
  14772. return arrayMap(value, baseToString) + "";
  14773. }
  14774. if (isSymbol(value)) {
  14775. return symbolToString ? symbolToString.call(value) : "";
  14776. }
  14777. var result = value + "";
  14778. return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result;
  14779. }
  14780. var reWhitespace = /\s/;
  14781. function trimmedEndIndex(string) {
  14782. var index2 = string.length;
  14783. while (index2-- && reWhitespace.test(string.charAt(index2))) {
  14784. }
  14785. return index2;
  14786. }
  14787. var reTrimStart = /^\s+/;
  14788. function baseTrim(string) {
  14789. return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
  14790. }
  14791. function isObject$4(value) {
  14792. var type2 = typeof value;
  14793. return value != null && (type2 == "object" || type2 == "function");
  14794. }
  14795. var NAN = 0 / 0;
  14796. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  14797. var reIsBinary = /^0b[01]+$/i;
  14798. var reIsOctal = /^0o[0-7]+$/i;
  14799. var freeParseInt = parseInt;
  14800. function toNumber(value) {
  14801. if (typeof value == "number") {
  14802. return value;
  14803. }
  14804. if (isSymbol(value)) {
  14805. return NAN;
  14806. }
  14807. if (isObject$4(value)) {
  14808. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  14809. value = isObject$4(other) ? other + "" : other;
  14810. }
  14811. if (typeof value != "string") {
  14812. return value === 0 ? value : +value;
  14813. }
  14814. value = baseTrim(value);
  14815. var isBinary = reIsBinary.test(value);
  14816. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
  14817. }
  14818. var asyncTag = "[object AsyncFunction]", funcTag$1 = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
  14819. function isFunction$2(value) {
  14820. if (!isObject$4(value)) {
  14821. return false;
  14822. }
  14823. var tag = baseGetTag(value);
  14824. return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
  14825. }
  14826. var coreJsData = root$1["__core-js_shared__"];
  14827. var coreJsData$1 = coreJsData;
  14828. var maskSrcKey = function() {
  14829. var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
  14830. return uid ? "Symbol(src)_1." + uid : "";
  14831. }();
  14832. function isMasked(func) {
  14833. return !!maskSrcKey && maskSrcKey in func;
  14834. }
  14835. var funcProto$1 = Function.prototype;
  14836. var funcToString$1 = funcProto$1.toString;
  14837. function toSource(func) {
  14838. if (func != null) {
  14839. try {
  14840. return funcToString$1.call(func);
  14841. } catch (e) {
  14842. }
  14843. try {
  14844. return func + "";
  14845. } catch (e) {
  14846. }
  14847. }
  14848. return "";
  14849. }
  14850. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  14851. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  14852. var funcProto = Function.prototype, objectProto$9 = Object.prototype;
  14853. var funcToString = funcProto.toString;
  14854. var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
  14855. var reIsNative = RegExp(
  14856. "^" + funcToString.call(hasOwnProperty$7).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
  14857. );
  14858. function baseIsNative(value) {
  14859. if (!isObject$4(value) || isMasked(value)) {
  14860. return false;
  14861. }
  14862. var pattern = isFunction$2(value) ? reIsNative : reIsHostCtor;
  14863. return pattern.test(toSource(value));
  14864. }
  14865. function getValue(object, key) {
  14866. return object == null ? void 0 : object[key];
  14867. }
  14868. function getNative(object, key) {
  14869. var value = getValue(object, key);
  14870. return baseIsNative(value) ? value : void 0;
  14871. }
  14872. var WeakMap$1 = getNative(root$1, "WeakMap");
  14873. var WeakMap$2 = WeakMap$1;
  14874. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  14875. var reIsUint = /^(?:0|[1-9]\d*)$/;
  14876. function isIndex(value, length) {
  14877. var type2 = typeof value;
  14878. length = length == null ? MAX_SAFE_INTEGER$1 : length;
  14879. return !!length && (type2 == "number" || type2 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
  14880. }
  14881. function eq(value, other) {
  14882. return value === other || value !== value && other !== other;
  14883. }
  14884. var MAX_SAFE_INTEGER = 9007199254740991;
  14885. function isLength(value) {
  14886. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  14887. }
  14888. function isArrayLike(value) {
  14889. return value != null && isLength(value.length) && !isFunction$2(value);
  14890. }
  14891. var objectProto$8 = Object.prototype;
  14892. function isPrototype(value) {
  14893. var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$8;
  14894. return value === proto;
  14895. }
  14896. function baseTimes(n, iteratee) {
  14897. var index2 = -1, result = Array(n);
  14898. while (++index2 < n) {
  14899. result[index2] = iteratee(index2);
  14900. }
  14901. return result;
  14902. }
  14903. var argsTag$2 = "[object Arguments]";
  14904. function baseIsArguments(value) {
  14905. return isObjectLike(value) && baseGetTag(value) == argsTag$2;
  14906. }
  14907. var objectProto$7 = Object.prototype;
  14908. var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
  14909. var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
  14910. var isArguments = baseIsArguments(function() {
  14911. return arguments;
  14912. }()) ? baseIsArguments : function(value) {
  14913. return isObjectLike(value) && hasOwnProperty$6.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  14914. };
  14915. var isArguments$1 = isArguments;
  14916. function stubFalse() {
  14917. return false;
  14918. }
  14919. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  14920. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  14921. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  14922. var Buffer$1 = moduleExports$1 ? root$1.Buffer : void 0;
  14923. var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
  14924. var isBuffer = nativeIsBuffer || stubFalse;
  14925. var isBuffer$1 = isBuffer;
  14926. var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", mapTag$2 = "[object Map]", numberTag$1 = "[object Number]", objectTag$2 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$2 = "[object Set]", stringTag$1 = "[object String]", weakMapTag$1 = "[object WeakMap]";
  14927. var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
  14928. var typedArrayTags = {};
  14929. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
  14930. typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
  14931. function baseIsTypedArray(value) {
  14932. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  14933. }
  14934. function baseUnary(func) {
  14935. return function(value) {
  14936. return func(value);
  14937. };
  14938. }
  14939. var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
  14940. var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
  14941. var moduleExports = freeModule && freeModule.exports === freeExports;
  14942. var freeProcess = moduleExports && freeGlobal$1.process;
  14943. var nodeUtil = function() {
  14944. try {
  14945. var types = freeModule && freeModule.require && freeModule.require("util").types;
  14946. if (types) {
  14947. return types;
  14948. }
  14949. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  14950. } catch (e) {
  14951. }
  14952. }();
  14953. var nodeUtil$1 = nodeUtil;
  14954. var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
  14955. var isTypedArray$2 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  14956. var isTypedArray$3 = isTypedArray$2;
  14957. var objectProto$6 = Object.prototype;
  14958. var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
  14959. function arrayLikeKeys(value, inherited) {
  14960. var isArr = isArray$1(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray$3(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
  14961. for (var key in value) {
  14962. if ((inherited || hasOwnProperty$5.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
  14963. result.push(key);
  14964. }
  14965. }
  14966. return result;
  14967. }
  14968. function overArg(func, transform3) {
  14969. return function(arg) {
  14970. return func(transform3(arg));
  14971. };
  14972. }
  14973. var nativeKeys = overArg(Object.keys, Object);
  14974. var nativeKeys$1 = nativeKeys;
  14975. var objectProto$5 = Object.prototype;
  14976. var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
  14977. function baseKeys(object) {
  14978. if (!isPrototype(object)) {
  14979. return nativeKeys$1(object);
  14980. }
  14981. var result = [];
  14982. for (var key in Object(object)) {
  14983. if (hasOwnProperty$4.call(object, key) && key != "constructor") {
  14984. result.push(key);
  14985. }
  14986. }
  14987. return result;
  14988. }
  14989. function keys$2(object) {
  14990. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  14991. }
  14992. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
  14993. function isKey(value, object) {
  14994. if (isArray$1(value)) {
  14995. return false;
  14996. }
  14997. var type2 = typeof value;
  14998. if (type2 == "number" || type2 == "symbol" || type2 == "boolean" || value == null || isSymbol(value)) {
  14999. return true;
  15000. }
  15001. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
  15002. }
  15003. var nativeCreate = getNative(Object, "create");
  15004. var nativeCreate$1 = nativeCreate;
  15005. function hashClear() {
  15006. this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
  15007. this.size = 0;
  15008. }
  15009. function hashDelete(key) {
  15010. var result = this.has(key) && delete this.__data__[key];
  15011. this.size -= result ? 1 : 0;
  15012. return result;
  15013. }
  15014. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  15015. var objectProto$4 = Object.prototype;
  15016. var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
  15017. function hashGet(key) {
  15018. var data = this.__data__;
  15019. if (nativeCreate$1) {
  15020. var result = data[key];
  15021. return result === HASH_UNDEFINED$2 ? void 0 : result;
  15022. }
  15023. return hasOwnProperty$3.call(data, key) ? data[key] : void 0;
  15024. }
  15025. var objectProto$3 = Object.prototype;
  15026. var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
  15027. function hashHas(key) {
  15028. var data = this.__data__;
  15029. return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$2.call(data, key);
  15030. }
  15031. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  15032. function hashSet(key, value) {
  15033. var data = this.__data__;
  15034. this.size += this.has(key) ? 0 : 1;
  15035. data[key] = nativeCreate$1 && value === void 0 ? HASH_UNDEFINED$1 : value;
  15036. return this;
  15037. }
  15038. function Hash(entries) {
  15039. var index2 = -1, length = entries == null ? 0 : entries.length;
  15040. this.clear();
  15041. while (++index2 < length) {
  15042. var entry = entries[index2];
  15043. this.set(entry[0], entry[1]);
  15044. }
  15045. }
  15046. Hash.prototype.clear = hashClear;
  15047. Hash.prototype["delete"] = hashDelete;
  15048. Hash.prototype.get = hashGet;
  15049. Hash.prototype.has = hashHas;
  15050. Hash.prototype.set = hashSet;
  15051. function listCacheClear() {
  15052. this.__data__ = [];
  15053. this.size = 0;
  15054. }
  15055. function assocIndexOf(array, key) {
  15056. var length = array.length;
  15057. while (length--) {
  15058. if (eq(array[length][0], key)) {
  15059. return length;
  15060. }
  15061. }
  15062. return -1;
  15063. }
  15064. var arrayProto = Array.prototype;
  15065. var splice = arrayProto.splice;
  15066. function listCacheDelete(key) {
  15067. var data = this.__data__, index2 = assocIndexOf(data, key);
  15068. if (index2 < 0) {
  15069. return false;
  15070. }
  15071. var lastIndex = data.length - 1;
  15072. if (index2 == lastIndex) {
  15073. data.pop();
  15074. } else {
  15075. splice.call(data, index2, 1);
  15076. }
  15077. --this.size;
  15078. return true;
  15079. }
  15080. function listCacheGet(key) {
  15081. var data = this.__data__, index2 = assocIndexOf(data, key);
  15082. return index2 < 0 ? void 0 : data[index2][1];
  15083. }
  15084. function listCacheHas(key) {
  15085. return assocIndexOf(this.__data__, key) > -1;
  15086. }
  15087. function listCacheSet(key, value) {
  15088. var data = this.__data__, index2 = assocIndexOf(data, key);
  15089. if (index2 < 0) {
  15090. ++this.size;
  15091. data.push([key, value]);
  15092. } else {
  15093. data[index2][1] = value;
  15094. }
  15095. return this;
  15096. }
  15097. function ListCache(entries) {
  15098. var index2 = -1, length = entries == null ? 0 : entries.length;
  15099. this.clear();
  15100. while (++index2 < length) {
  15101. var entry = entries[index2];
  15102. this.set(entry[0], entry[1]);
  15103. }
  15104. }
  15105. ListCache.prototype.clear = listCacheClear;
  15106. ListCache.prototype["delete"] = listCacheDelete;
  15107. ListCache.prototype.get = listCacheGet;
  15108. ListCache.prototype.has = listCacheHas;
  15109. ListCache.prototype.set = listCacheSet;
  15110. var Map$2 = getNative(root$1, "Map");
  15111. var Map$3 = Map$2;
  15112. function mapCacheClear() {
  15113. this.size = 0;
  15114. this.__data__ = {
  15115. "hash": new Hash(),
  15116. "map": new (Map$3 || ListCache)(),
  15117. "string": new Hash()
  15118. };
  15119. }
  15120. function isKeyable(value) {
  15121. var type2 = typeof value;
  15122. return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
  15123. }
  15124. function getMapData(map, key) {
  15125. var data = map.__data__;
  15126. return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
  15127. }
  15128. function mapCacheDelete(key) {
  15129. var result = getMapData(this, key)["delete"](key);
  15130. this.size -= result ? 1 : 0;
  15131. return result;
  15132. }
  15133. function mapCacheGet(key) {
  15134. return getMapData(this, key).get(key);
  15135. }
  15136. function mapCacheHas(key) {
  15137. return getMapData(this, key).has(key);
  15138. }
  15139. function mapCacheSet(key, value) {
  15140. var data = getMapData(this, key), size = data.size;
  15141. data.set(key, value);
  15142. this.size += data.size == size ? 0 : 1;
  15143. return this;
  15144. }
  15145. function MapCache(entries) {
  15146. var index2 = -1, length = entries == null ? 0 : entries.length;
  15147. this.clear();
  15148. while (++index2 < length) {
  15149. var entry = entries[index2];
  15150. this.set(entry[0], entry[1]);
  15151. }
  15152. }
  15153. MapCache.prototype.clear = mapCacheClear;
  15154. MapCache.prototype["delete"] = mapCacheDelete;
  15155. MapCache.prototype.get = mapCacheGet;
  15156. MapCache.prototype.has = mapCacheHas;
  15157. MapCache.prototype.set = mapCacheSet;
  15158. var FUNC_ERROR_TEXT$1 = "Expected a function";
  15159. function memoize(func, resolver) {
  15160. if (typeof func != "function" || resolver != null && typeof resolver != "function") {
  15161. throw new TypeError(FUNC_ERROR_TEXT$1);
  15162. }
  15163. var memoized = function() {
  15164. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
  15165. if (cache.has(key)) {
  15166. return cache.get(key);
  15167. }
  15168. var result = func.apply(this, args);
  15169. memoized.cache = cache.set(key, result) || cache;
  15170. return result;
  15171. };
  15172. memoized.cache = new (memoize.Cache || MapCache)();
  15173. return memoized;
  15174. }
  15175. memoize.Cache = MapCache;
  15176. var MAX_MEMOIZE_SIZE = 500;
  15177. function memoizeCapped(func) {
  15178. var result = memoize(func, function(key) {
  15179. if (cache.size === MAX_MEMOIZE_SIZE) {
  15180. cache.clear();
  15181. }
  15182. return key;
  15183. });
  15184. var cache = result.cache;
  15185. return result;
  15186. }
  15187. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  15188. var reEscapeChar = /\\(\\)?/g;
  15189. var stringToPath = memoizeCapped(function(string) {
  15190. var result = [];
  15191. if (string.charCodeAt(0) === 46) {
  15192. result.push("");
  15193. }
  15194. string.replace(rePropName, function(match, number, quote, subString) {
  15195. result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
  15196. });
  15197. return result;
  15198. });
  15199. var stringToPath$1 = stringToPath;
  15200. function toString$3(value) {
  15201. return value == null ? "" : baseToString(value);
  15202. }
  15203. function castPath(value, object) {
  15204. if (isArray$1(value)) {
  15205. return value;
  15206. }
  15207. return isKey(value, object) ? [value] : stringToPath$1(toString$3(value));
  15208. }
  15209. var INFINITY = 1 / 0;
  15210. function toKey(value) {
  15211. if (typeof value == "string" || isSymbol(value)) {
  15212. return value;
  15213. }
  15214. var result = value + "";
  15215. return result == "0" && 1 / value == -INFINITY ? "-0" : result;
  15216. }
  15217. function baseGet(object, path) {
  15218. path = castPath(path, object);
  15219. var index2 = 0, length = path.length;
  15220. while (object != null && index2 < length) {
  15221. object = object[toKey(path[index2++])];
  15222. }
  15223. return index2 && index2 == length ? object : void 0;
  15224. }
  15225. function get$2(object, path, defaultValue2) {
  15226. var result = object == null ? void 0 : baseGet(object, path);
  15227. return result === void 0 ? defaultValue2 : result;
  15228. }
  15229. function arrayPush(array, values3) {
  15230. var index2 = -1, length = values3.length, offset = array.length;
  15231. while (++index2 < length) {
  15232. array[offset + index2] = values3[index2];
  15233. }
  15234. return array;
  15235. }
  15236. function castArray() {
  15237. if (!arguments.length) {
  15238. return [];
  15239. }
  15240. var value = arguments[0];
  15241. return isArray$1(value) ? value : [value];
  15242. }
  15243. function stackClear() {
  15244. this.__data__ = new ListCache();
  15245. this.size = 0;
  15246. }
  15247. function stackDelete(key) {
  15248. var data = this.__data__, result = data["delete"](key);
  15249. this.size = data.size;
  15250. return result;
  15251. }
  15252. function stackGet(key) {
  15253. return this.__data__.get(key);
  15254. }
  15255. function stackHas(key) {
  15256. return this.__data__.has(key);
  15257. }
  15258. var LARGE_ARRAY_SIZE = 200;
  15259. function stackSet(key, value) {
  15260. var data = this.__data__;
  15261. if (data instanceof ListCache) {
  15262. var pairs = data.__data__;
  15263. if (!Map$3 || pairs.length < LARGE_ARRAY_SIZE - 1) {
  15264. pairs.push([key, value]);
  15265. this.size = ++data.size;
  15266. return this;
  15267. }
  15268. data = this.__data__ = new MapCache(pairs);
  15269. }
  15270. data.set(key, value);
  15271. this.size = data.size;
  15272. return this;
  15273. }
  15274. function Stack(entries) {
  15275. var data = this.__data__ = new ListCache(entries);
  15276. this.size = data.size;
  15277. }
  15278. Stack.prototype.clear = stackClear;
  15279. Stack.prototype["delete"] = stackDelete;
  15280. Stack.prototype.get = stackGet;
  15281. Stack.prototype.has = stackHas;
  15282. Stack.prototype.set = stackSet;
  15283. function arrayFilter(array, predicate) {
  15284. var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  15285. while (++index2 < length) {
  15286. var value = array[index2];
  15287. if (predicate(value, index2, array)) {
  15288. result[resIndex++] = value;
  15289. }
  15290. }
  15291. return result;
  15292. }
  15293. function stubArray() {
  15294. return [];
  15295. }
  15296. var objectProto$2 = Object.prototype;
  15297. var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
  15298. var nativeGetSymbols = Object.getOwnPropertySymbols;
  15299. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  15300. if (object == null) {
  15301. return [];
  15302. }
  15303. object = Object(object);
  15304. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  15305. return propertyIsEnumerable.call(object, symbol);
  15306. });
  15307. };
  15308. var getSymbols$1 = getSymbols;
  15309. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  15310. var result = keysFunc(object);
  15311. return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
  15312. }
  15313. function getAllKeys(object) {
  15314. return baseGetAllKeys(object, keys$2, getSymbols$1);
  15315. }
  15316. var DataView$1 = getNative(root$1, "DataView");
  15317. var DataView$2 = DataView$1;
  15318. var Promise$1 = getNative(root$1, "Promise");
  15319. var Promise$2 = Promise$1;
  15320. var Set$2 = getNative(root$1, "Set");
  15321. var Set$3 = Set$2;
  15322. var mapTag$1 = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag$1 = "[object Set]", weakMapTag = "[object WeakMap]";
  15323. var dataViewTag$1 = "[object DataView]";
  15324. var dataViewCtorString = toSource(DataView$2), mapCtorString = toSource(Map$3), promiseCtorString = toSource(Promise$2), setCtorString = toSource(Set$3), weakMapCtorString = toSource(WeakMap$2);
  15325. var getTag = baseGetTag;
  15326. if (DataView$2 && getTag(new DataView$2(new ArrayBuffer(1))) != dataViewTag$1 || Map$3 && getTag(new Map$3()) != mapTag$1 || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$3 && getTag(new Set$3()) != setTag$1 || WeakMap$2 && getTag(new WeakMap$2()) != weakMapTag) {
  15327. getTag = function(value) {
  15328. var result = baseGetTag(value), Ctor = result == objectTag$1 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
  15329. if (ctorString) {
  15330. switch (ctorString) {
  15331. case dataViewCtorString:
  15332. return dataViewTag$1;
  15333. case mapCtorString:
  15334. return mapTag$1;
  15335. case promiseCtorString:
  15336. return promiseTag;
  15337. case setCtorString:
  15338. return setTag$1;
  15339. case weakMapCtorString:
  15340. return weakMapTag;
  15341. }
  15342. }
  15343. return result;
  15344. };
  15345. }
  15346. var getTag$1 = getTag;
  15347. var Uint8Array$1 = root$1.Uint8Array;
  15348. var Uint8Array$2 = Uint8Array$1;
  15349. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  15350. function setCacheAdd(value) {
  15351. this.__data__.set(value, HASH_UNDEFINED);
  15352. return this;
  15353. }
  15354. function setCacheHas(value) {
  15355. return this.__data__.has(value);
  15356. }
  15357. function SetCache(values3) {
  15358. var index2 = -1, length = values3 == null ? 0 : values3.length;
  15359. this.__data__ = new MapCache();
  15360. while (++index2 < length) {
  15361. this.add(values3[index2]);
  15362. }
  15363. }
  15364. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  15365. SetCache.prototype.has = setCacheHas;
  15366. function arraySome(array, predicate) {
  15367. var index2 = -1, length = array == null ? 0 : array.length;
  15368. while (++index2 < length) {
  15369. if (predicate(array[index2], index2, array)) {
  15370. return true;
  15371. }
  15372. }
  15373. return false;
  15374. }
  15375. function cacheHas(cache, key) {
  15376. return cache.has(key);
  15377. }
  15378. var COMPARE_PARTIAL_FLAG$3 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
  15379. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  15380. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, arrLength = array.length, othLength = other.length;
  15381. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  15382. return false;
  15383. }
  15384. var arrStacked = stack.get(array);
  15385. var othStacked = stack.get(other);
  15386. if (arrStacked && othStacked) {
  15387. return arrStacked == other && othStacked == array;
  15388. }
  15389. var index2 = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : void 0;
  15390. stack.set(array, other);
  15391. stack.set(other, array);
  15392. while (++index2 < arrLength) {
  15393. var arrValue = array[index2], othValue = other[index2];
  15394. if (customizer) {
  15395. var compared = isPartial ? customizer(othValue, arrValue, index2, other, array, stack) : customizer(arrValue, othValue, index2, array, other, stack);
  15396. }
  15397. if (compared !== void 0) {
  15398. if (compared) {
  15399. continue;
  15400. }
  15401. result = false;
  15402. break;
  15403. }
  15404. if (seen) {
  15405. if (!arraySome(other, function(othValue2, othIndex) {
  15406. if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
  15407. return seen.push(othIndex);
  15408. }
  15409. })) {
  15410. result = false;
  15411. break;
  15412. }
  15413. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  15414. result = false;
  15415. break;
  15416. }
  15417. }
  15418. stack["delete"](array);
  15419. stack["delete"](other);
  15420. return result;
  15421. }
  15422. function mapToArray(map) {
  15423. var index2 = -1, result = Array(map.size);
  15424. map.forEach(function(value, key) {
  15425. result[++index2] = [key, value];
  15426. });
  15427. return result;
  15428. }
  15429. function setToArray(set4) {
  15430. var index2 = -1, result = Array(set4.size);
  15431. set4.forEach(function(value) {
  15432. result[++index2] = value;
  15433. });
  15434. return result;
  15435. }
  15436. var COMPARE_PARTIAL_FLAG$2 = 1, COMPARE_UNORDERED_FLAG = 2;
  15437. var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]";
  15438. var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
  15439. var symbolProto = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
  15440. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  15441. switch (tag) {
  15442. case dataViewTag:
  15443. if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
  15444. return false;
  15445. }
  15446. object = object.buffer;
  15447. other = other.buffer;
  15448. case arrayBufferTag:
  15449. if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array$2(object), new Uint8Array$2(other))) {
  15450. return false;
  15451. }
  15452. return true;
  15453. case boolTag:
  15454. case dateTag:
  15455. case numberTag:
  15456. return eq(+object, +other);
  15457. case errorTag:
  15458. return object.name == other.name && object.message == other.message;
  15459. case regexpTag:
  15460. case stringTag:
  15461. return object == other + "";
  15462. case mapTag:
  15463. var convert = mapToArray;
  15464. case setTag:
  15465. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
  15466. convert || (convert = setToArray);
  15467. if (object.size != other.size && !isPartial) {
  15468. return false;
  15469. }
  15470. var stacked = stack.get(object);
  15471. if (stacked) {
  15472. return stacked == other;
  15473. }
  15474. bitmask |= COMPARE_UNORDERED_FLAG;
  15475. stack.set(object, other);
  15476. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  15477. stack["delete"](object);
  15478. return result;
  15479. case symbolTag:
  15480. if (symbolValueOf) {
  15481. return symbolValueOf.call(object) == symbolValueOf.call(other);
  15482. }
  15483. }
  15484. return false;
  15485. }
  15486. var COMPARE_PARTIAL_FLAG$1 = 1;
  15487. var objectProto$1 = Object.prototype;
  15488. var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
  15489. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  15490. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
  15491. if (objLength != othLength && !isPartial) {
  15492. return false;
  15493. }
  15494. var index2 = objLength;
  15495. while (index2--) {
  15496. var key = objProps[index2];
  15497. if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
  15498. return false;
  15499. }
  15500. }
  15501. var objStacked = stack.get(object);
  15502. var othStacked = stack.get(other);
  15503. if (objStacked && othStacked) {
  15504. return objStacked == other && othStacked == object;
  15505. }
  15506. var result = true;
  15507. stack.set(object, other);
  15508. stack.set(other, object);
  15509. var skipCtor = isPartial;
  15510. while (++index2 < objLength) {
  15511. key = objProps[index2];
  15512. var objValue = object[key], othValue = other[key];
  15513. if (customizer) {
  15514. var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
  15515. }
  15516. if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
  15517. result = false;
  15518. break;
  15519. }
  15520. skipCtor || (skipCtor = key == "constructor");
  15521. }
  15522. if (result && !skipCtor) {
  15523. var objCtor = object.constructor, othCtor = other.constructor;
  15524. if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
  15525. result = false;
  15526. }
  15527. }
  15528. stack["delete"](object);
  15529. stack["delete"](other);
  15530. return result;
  15531. }
  15532. var COMPARE_PARTIAL_FLAG = 1;
  15533. var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
  15534. var objectProto = Object.prototype;
  15535. var hasOwnProperty = objectProto.hasOwnProperty;
  15536. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  15537. var objIsArr = isArray$1(object), othIsArr = isArray$1(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
  15538. objTag = objTag == argsTag ? objectTag : objTag;
  15539. othTag = othTag == argsTag ? objectTag : othTag;
  15540. var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  15541. if (isSameTag && isBuffer$1(object)) {
  15542. if (!isBuffer$1(other)) {
  15543. return false;
  15544. }
  15545. objIsArr = true;
  15546. objIsObj = false;
  15547. }
  15548. if (isSameTag && !objIsObj) {
  15549. stack || (stack = new Stack());
  15550. return objIsArr || isTypedArray$3(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  15551. }
  15552. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  15553. var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
  15554. if (objIsWrapped || othIsWrapped) {
  15555. var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
  15556. stack || (stack = new Stack());
  15557. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  15558. }
  15559. }
  15560. if (!isSameTag) {
  15561. return false;
  15562. }
  15563. stack || (stack = new Stack());
  15564. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  15565. }
  15566. function baseIsEqual(value, other, bitmask, customizer, stack) {
  15567. if (value === other) {
  15568. return true;
  15569. }
  15570. if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
  15571. return value !== value && other !== other;
  15572. }
  15573. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  15574. }
  15575. var now = function() {
  15576. return root$1.Date.now();
  15577. };
  15578. var now$1 = now;
  15579. var FUNC_ERROR_TEXT = "Expected a function";
  15580. var nativeMax = Math.max, nativeMin = Math.min;
  15581. function debounce$2(func, wait, options2) {
  15582. var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  15583. if (typeof func != "function") {
  15584. throw new TypeError(FUNC_ERROR_TEXT);
  15585. }
  15586. wait = toNumber(wait) || 0;
  15587. if (isObject$4(options2)) {
  15588. leading = !!options2.leading;
  15589. maxing = "maxWait" in options2;
  15590. maxWait = maxing ? nativeMax(toNumber(options2.maxWait) || 0, wait) : maxWait;
  15591. trailing = "trailing" in options2 ? !!options2.trailing : trailing;
  15592. }
  15593. function invokeFunc(time) {
  15594. var args = lastArgs, thisArg = lastThis;
  15595. lastArgs = lastThis = void 0;
  15596. lastInvokeTime = time;
  15597. result = func.apply(thisArg, args);
  15598. return result;
  15599. }
  15600. function leadingEdge(time) {
  15601. lastInvokeTime = time;
  15602. timerId = setTimeout(timerExpired, wait);
  15603. return leading ? invokeFunc(time) : result;
  15604. }
  15605. function remainingWait(time) {
  15606. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
  15607. return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  15608. }
  15609. function shouldInvoke(time) {
  15610. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
  15611. return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  15612. }
  15613. function timerExpired() {
  15614. var time = now$1();
  15615. if (shouldInvoke(time)) {
  15616. return trailingEdge(time);
  15617. }
  15618. timerId = setTimeout(timerExpired, remainingWait(time));
  15619. }
  15620. function trailingEdge(time) {
  15621. timerId = void 0;
  15622. if (trailing && lastArgs) {
  15623. return invokeFunc(time);
  15624. }
  15625. lastArgs = lastThis = void 0;
  15626. return result;
  15627. }
  15628. function cancel() {
  15629. if (timerId !== void 0) {
  15630. clearTimeout(timerId);
  15631. }
  15632. lastInvokeTime = 0;
  15633. lastArgs = lastCallTime = lastThis = timerId = void 0;
  15634. }
  15635. function flush() {
  15636. return timerId === void 0 ? result : trailingEdge(now$1());
  15637. }
  15638. function debounced() {
  15639. var time = now$1(), isInvoking = shouldInvoke(time);
  15640. lastArgs = arguments;
  15641. lastThis = this;
  15642. lastCallTime = time;
  15643. if (isInvoking) {
  15644. if (timerId === void 0) {
  15645. return leadingEdge(lastCallTime);
  15646. }
  15647. if (maxing) {
  15648. clearTimeout(timerId);
  15649. timerId = setTimeout(timerExpired, wait);
  15650. return invokeFunc(lastCallTime);
  15651. }
  15652. }
  15653. if (timerId === void 0) {
  15654. timerId = setTimeout(timerExpired, wait);
  15655. }
  15656. return result;
  15657. }
  15658. debounced.cancel = cancel;
  15659. debounced.flush = flush;
  15660. return debounced;
  15661. }
  15662. function fromPairs(pairs) {
  15663. var index2 = -1, length = pairs == null ? 0 : pairs.length, result = {};
  15664. while (++index2 < length) {
  15665. var pair = pairs[index2];
  15666. result[pair[0]] = pair[1];
  15667. }
  15668. return result;
  15669. }
  15670. function isEqual(value, other) {
  15671. return baseIsEqual(value, other);
  15672. }
  15673. function isNil(value) {
  15674. return value == null;
  15675. }
  15676. function isUndefined$1(value) {
  15677. return value === void 0;
  15678. }
  15679. const isUndefined = (val) => val === void 0;
  15680. const isBoolean = (val) => typeof val === "boolean";
  15681. const isNumber = (val) => typeof val === "number";
  15682. const isElement = (e) => {
  15683. if (typeof Element === "undefined")
  15684. return false;
  15685. return e instanceof Element;
  15686. };
  15687. const isStringNumber = (val) => {
  15688. if (!isString(val)) {
  15689. return false;
  15690. }
  15691. return !Number.isNaN(Number(val));
  15692. };
  15693. const escapeStringRegexp = (string = "") => string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  15694. const keysOf = (arr) => Object.keys(arr);
  15695. class ElementPlusError extends Error {
  15696. constructor(m) {
  15697. super(m);
  15698. this.name = "ElementPlusError";
  15699. }
  15700. }
  15701. function throwError(scope, m) {
  15702. throw new ElementPlusError(`[${scope}] ${m}`);
  15703. }
  15704. function debugWarn(scope, message) {
  15705. }
  15706. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  15707. const hasClass$2 = (el, cls) => {
  15708. if (!el || !cls)
  15709. return false;
  15710. if (cls.includes(" "))
  15711. throw new Error("className should not contain space.");
  15712. return el.classList.contains(cls);
  15713. };
  15714. const addClass$2 = (el, cls) => {
  15715. if (!el || !cls.trim())
  15716. return;
  15717. el.classList.add(...classNameToArray(cls));
  15718. };
  15719. const removeClass$2 = (el, cls) => {
  15720. if (!el || !cls.trim())
  15721. return;
  15722. el.classList.remove(...classNameToArray(cls));
  15723. };
  15724. const getStyle = (element, styleName) => {
  15725. var _a2;
  15726. if (!isClient || !element || !styleName)
  15727. return "";
  15728. let key = camelize(styleName);
  15729. if (key === "float")
  15730. key = "cssFloat";
  15731. try {
  15732. const style = element.style[key];
  15733. if (style)
  15734. return style;
  15735. const computed2 = (_a2 = document.defaultView) == null ? void 0 : _a2.getComputedStyle(element, "");
  15736. return computed2 ? computed2[key] : "";
  15737. } catch (e) {
  15738. return element.style[key];
  15739. }
  15740. };
  15741. function addUnit(value, defaultUnit = "px") {
  15742. if (!value)
  15743. return "";
  15744. if (isNumber(value) || isStringNumber(value)) {
  15745. return `${value}${defaultUnit}`;
  15746. } else if (isString(value)) {
  15747. return value;
  15748. }
  15749. }
  15750. let scrollBarWidth;
  15751. const getScrollBarWidth = (namespace) => {
  15752. var _a2;
  15753. if (!isClient)
  15754. return 0;
  15755. if (scrollBarWidth !== void 0)
  15756. return scrollBarWidth;
  15757. const outer = document.createElement("div");
  15758. outer.className = `${namespace}-scrollbar__wrap`;
  15759. outer.style.visibility = "hidden";
  15760. outer.style.width = "100px";
  15761. outer.style.position = "absolute";
  15762. outer.style.top = "-9999px";
  15763. document.body.appendChild(outer);
  15764. const widthNoScroll = outer.offsetWidth;
  15765. outer.style.overflow = "scroll";
  15766. const inner = document.createElement("div");
  15767. inner.style.width = "100%";
  15768. outer.appendChild(inner);
  15769. const widthWithScroll = inner.offsetWidth;
  15770. (_a2 = outer.parentNode) == null ? void 0 : _a2.removeChild(outer);
  15771. scrollBarWidth = widthNoScroll - widthWithScroll;
  15772. return scrollBarWidth;
  15773. };
  15774. function scrollIntoView(container, selected) {
  15775. if (!isClient)
  15776. return;
  15777. if (!selected) {
  15778. container.scrollTop = 0;
  15779. return;
  15780. }
  15781. const offsetParents = [];
  15782. let pointer = selected.offsetParent;
  15783. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  15784. offsetParents.push(pointer);
  15785. pointer = pointer.offsetParent;
  15786. }
  15787. const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  15788. const bottom = top + selected.offsetHeight;
  15789. const viewRectTop = container.scrollTop;
  15790. const viewRectBottom = viewRectTop + container.clientHeight;
  15791. if (top < viewRectTop) {
  15792. container.scrollTop = top;
  15793. } else if (bottom > viewRectBottom) {
  15794. container.scrollTop = bottom - container.clientHeight;
  15795. }
  15796. }
  15797. /*! Element Plus Icons Vue v2.1.0 */
  15798. var export_helper_default = (sfc, props) => {
  15799. let target = sfc.__vccOpts || sfc;
  15800. for (let [key, val] of props)
  15801. target[key] = val;
  15802. return target;
  15803. };
  15804. var arrow_down_vue_vue_type_script_lang_default = {
  15805. name: "ArrowDown"
  15806. };
  15807. var _hoisted_16$2 = {
  15808. xmlns: "http://www.w3.org/2000/svg",
  15809. viewBox: "0 0 1024 1024"
  15810. }, _hoisted_26$2 = /* @__PURE__ */ createElementVNode(
  15811. "path",
  15812. {
  15813. fill: "currentColor",
  15814. d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"
  15815. },
  15816. null,
  15817. -1
  15818. ), _hoisted_36$2 = [
  15819. _hoisted_26$2
  15820. ];
  15821. function _sfc_render6(_ctx, _cache, $props, $setup, $data, $options) {
  15822. return openBlock(), createElementBlock("svg", _hoisted_16$2, _hoisted_36$2);
  15823. }
  15824. var arrow_down_default = /* @__PURE__ */ export_helper_default(arrow_down_vue_vue_type_script_lang_default, [["render", _sfc_render6], ["__file", "arrow-down.vue"]]);
  15825. var arrow_right_vue_vue_type_script_lang_default = {
  15826. name: "ArrowRight"
  15827. };
  15828. var _hoisted_110 = {
  15829. xmlns: "http://www.w3.org/2000/svg",
  15830. viewBox: "0 0 1024 1024"
  15831. }, _hoisted_210 = /* @__PURE__ */ createElementVNode(
  15832. "path",
  15833. {
  15834. fill: "currentColor",
  15835. d: "M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"
  15836. },
  15837. null,
  15838. -1
  15839. ), _hoisted_310 = [
  15840. _hoisted_210
  15841. ];
  15842. function _sfc_render10(_ctx, _cache, $props, $setup, $data, $options) {
  15843. return openBlock(), createElementBlock("svg", _hoisted_110, _hoisted_310);
  15844. }
  15845. var arrow_right_default = /* @__PURE__ */ export_helper_default(arrow_right_vue_vue_type_script_lang_default, [["render", _sfc_render10], ["__file", "arrow-right.vue"]]);
  15846. var arrow_up_vue_vue_type_script_lang_default = {
  15847. name: "ArrowUp"
  15848. };
  15849. var _hoisted_112 = {
  15850. xmlns: "http://www.w3.org/2000/svg",
  15851. viewBox: "0 0 1024 1024"
  15852. }, _hoisted_212 = /* @__PURE__ */ createElementVNode(
  15853. "path",
  15854. {
  15855. fill: "currentColor",
  15856. d: "m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0z"
  15857. },
  15858. null,
  15859. -1
  15860. ), _hoisted_312 = [
  15861. _hoisted_212
  15862. ];
  15863. function _sfc_render12(_ctx, _cache, $props, $setup, $data, $options) {
  15864. return openBlock(), createElementBlock("svg", _hoisted_112, _hoisted_312);
  15865. }
  15866. var arrow_up_default = /* @__PURE__ */ export_helper_default(arrow_up_vue_vue_type_script_lang_default, [["render", _sfc_render12], ["__file", "arrow-up.vue"]]);
  15867. var circle_check_vue_vue_type_script_lang_default = {
  15868. name: "CircleCheck"
  15869. };
  15870. var _hoisted_149 = {
  15871. xmlns: "http://www.w3.org/2000/svg",
  15872. viewBox: "0 0 1024 1024"
  15873. }, _hoisted_249 = /* @__PURE__ */ createElementVNode(
  15874. "path",
  15875. {
  15876. fill: "currentColor",
  15877. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  15878. },
  15879. null,
  15880. -1
  15881. ), _hoisted_348 = /* @__PURE__ */ createElementVNode(
  15882. "path",
  15883. {
  15884. fill: "currentColor",
  15885. d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"
  15886. },
  15887. null,
  15888. -1
  15889. ), _hoisted_415 = [
  15890. _hoisted_249,
  15891. _hoisted_348
  15892. ];
  15893. function _sfc_render49(_ctx, _cache, $props, $setup, $data, $options) {
  15894. return openBlock(), createElementBlock("svg", _hoisted_149, _hoisted_415);
  15895. }
  15896. var circle_check_default = /* @__PURE__ */ export_helper_default(circle_check_vue_vue_type_script_lang_default, [["render", _sfc_render49], ["__file", "circle-check.vue"]]);
  15897. var circle_close_vue_vue_type_script_lang_default = {
  15898. name: "CircleClose"
  15899. };
  15900. var _hoisted_151 = {
  15901. xmlns: "http://www.w3.org/2000/svg",
  15902. viewBox: "0 0 1024 1024"
  15903. }, _hoisted_251 = /* @__PURE__ */ createElementVNode(
  15904. "path",
  15905. {
  15906. fill: "currentColor",
  15907. d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248L466.752 512z"
  15908. },
  15909. null,
  15910. -1
  15911. ), _hoisted_350 = /* @__PURE__ */ createElementVNode(
  15912. "path",
  15913. {
  15914. fill: "currentColor",
  15915. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  15916. },
  15917. null,
  15918. -1
  15919. ), _hoisted_416 = [
  15920. _hoisted_251,
  15921. _hoisted_350
  15922. ];
  15923. function _sfc_render51(_ctx, _cache, $props, $setup, $data, $options) {
  15924. return openBlock(), createElementBlock("svg", _hoisted_151, _hoisted_416);
  15925. }
  15926. var circle_close_default = /* @__PURE__ */ export_helper_default(circle_close_vue_vue_type_script_lang_default, [["render", _sfc_render51], ["__file", "circle-close.vue"]]);
  15927. var close_vue_vue_type_script_lang_default = {
  15928. name: "Close"
  15929. };
  15930. var _hoisted_156 = {
  15931. xmlns: "http://www.w3.org/2000/svg",
  15932. viewBox: "0 0 1024 1024"
  15933. }, _hoisted_256 = /* @__PURE__ */ createElementVNode(
  15934. "path",
  15935. {
  15936. fill: "currentColor",
  15937. d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
  15938. },
  15939. null,
  15940. -1
  15941. ), _hoisted_355 = [
  15942. _hoisted_256
  15943. ];
  15944. function _sfc_render56(_ctx, _cache, $props, $setup, $data, $options) {
  15945. return openBlock(), createElementBlock("svg", _hoisted_156, _hoisted_355);
  15946. }
  15947. var close_default = /* @__PURE__ */ export_helper_default(close_vue_vue_type_script_lang_default, [["render", _sfc_render56], ["__file", "close.vue"]]);
  15948. var delete_vue_vue_type_script_lang_default = {
  15949. name: "Delete"
  15950. };
  15951. var _hoisted_180 = {
  15952. xmlns: "http://www.w3.org/2000/svg",
  15953. viewBox: "0 0 1024 1024"
  15954. }, _hoisted_280 = /* @__PURE__ */ createElementVNode(
  15955. "path",
  15956. {
  15957. fill: "currentColor",
  15958. d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32zm192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32z"
  15959. },
  15960. null,
  15961. -1
  15962. ), _hoisted_379 = [
  15963. _hoisted_280
  15964. ];
  15965. function _sfc_render80(_ctx, _cache, $props, $setup, $data, $options) {
  15966. return openBlock(), createElementBlock("svg", _hoisted_180, _hoisted_379);
  15967. }
  15968. var delete_default = /* @__PURE__ */ export_helper_default(delete_vue_vue_type_script_lang_default, [["render", _sfc_render80], ["__file", "delete.vue"]]);
  15969. var edit_vue_vue_type_script_lang_default = {
  15970. name: "Edit"
  15971. };
  15972. var _hoisted_194 = {
  15973. xmlns: "http://www.w3.org/2000/svg",
  15974. viewBox: "0 0 1024 1024"
  15975. }, _hoisted_294 = /* @__PURE__ */ createElementVNode(
  15976. "path",
  15977. {
  15978. fill: "currentColor",
  15979. d: "M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640V512z"
  15980. },
  15981. null,
  15982. -1
  15983. ), _hoisted_393 = /* @__PURE__ */ createElementVNode(
  15984. "path",
  15985. {
  15986. fill: "currentColor",
  15987. d: "m469.952 554.24 52.8-7.552L847.104 222.4a32 32 0 1 0-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 0 1 0 135.808l-331.84 331.84a32 32 0 0 1-18.112 9.088L436.8 623.68a32 32 0 0 1-36.224-36.224l15.104-105.6a32 32 0 0 1 9.024-18.112l331.904-331.84a96 96 0 0 1 135.744 0z"
  15988. },
  15989. null,
  15990. -1
  15991. ), _hoisted_431 = [
  15992. _hoisted_294,
  15993. _hoisted_393
  15994. ];
  15995. function _sfc_render94(_ctx, _cache, $props, $setup, $data, $options) {
  15996. return openBlock(), createElementBlock("svg", _hoisted_194, _hoisted_431);
  15997. }
  15998. var edit_default = /* @__PURE__ */ export_helper_default(edit_vue_vue_type_script_lang_default, [["render", _sfc_render94], ["__file", "edit.vue"]]);
  15999. var hide_vue_vue_type_script_lang_default = {
  16000. name: "Hide"
  16001. };
  16002. var _hoisted_1133 = {
  16003. xmlns: "http://www.w3.org/2000/svg",
  16004. viewBox: "0 0 1024 1024"
  16005. }, _hoisted_2133 = /* @__PURE__ */ createElementVNode(
  16006. "path",
  16007. {
  16008. fill: "currentColor",
  16009. d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2L371.2 588.8ZM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z"
  16010. },
  16011. null,
  16012. -1
  16013. ), _hoisted_3132 = /* @__PURE__ */ createElementVNode(
  16014. "path",
  16015. {
  16016. fill: "currentColor",
  16017. d: "M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z"
  16018. },
  16019. null,
  16020. -1
  16021. ), _hoisted_438 = [
  16022. _hoisted_2133,
  16023. _hoisted_3132
  16024. ];
  16025. function _sfc_render133(_ctx, _cache, $props, $setup, $data, $options) {
  16026. return openBlock(), createElementBlock("svg", _hoisted_1133, _hoisted_438);
  16027. }
  16028. var hide_default = /* @__PURE__ */ export_helper_default(hide_vue_vue_type_script_lang_default, [["render", _sfc_render133], ["__file", "hide.vue"]]);
  16029. var loading_vue_vue_type_script_lang_default = {
  16030. name: "Loading"
  16031. };
  16032. var _hoisted_1150 = {
  16033. xmlns: "http://www.w3.org/2000/svg",
  16034. viewBox: "0 0 1024 1024"
  16035. }, _hoisted_2150 = /* @__PURE__ */ createElementVNode(
  16036. "path",
  16037. {
  16038. fill: "currentColor",
  16039. d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"
  16040. },
  16041. null,
  16042. -1
  16043. ), _hoisted_3149 = [
  16044. _hoisted_2150
  16045. ];
  16046. function _sfc_render150(_ctx, _cache, $props, $setup, $data, $options) {
  16047. return openBlock(), createElementBlock("svg", _hoisted_1150, _hoisted_3149);
  16048. }
  16049. var loading_default = /* @__PURE__ */ export_helper_default(loading_vue_vue_type_script_lang_default, [["render", _sfc_render150], ["__file", "loading.vue"]]);
  16050. var minus_vue_vue_type_script_lang_default = {
  16051. name: "Minus"
  16052. };
  16053. var _hoisted_1169 = {
  16054. xmlns: "http://www.w3.org/2000/svg",
  16055. viewBox: "0 0 1024 1024"
  16056. }, _hoisted_2169 = /* @__PURE__ */ createElementVNode(
  16057. "path",
  16058. {
  16059. fill: "currentColor",
  16060. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z"
  16061. },
  16062. null,
  16063. -1
  16064. ), _hoisted_3168 = [
  16065. _hoisted_2169
  16066. ];
  16067. function _sfc_render169(_ctx, _cache, $props, $setup, $data, $options) {
  16068. return openBlock(), createElementBlock("svg", _hoisted_1169, _hoisted_3168);
  16069. }
  16070. var minus_default = /* @__PURE__ */ export_helper_default(minus_vue_vue_type_script_lang_default, [["render", _sfc_render169], ["__file", "minus.vue"]]);
  16071. var plus_vue_vue_type_script_lang_default = {
  16072. name: "Plus"
  16073. };
  16074. var _hoisted_1201 = {
  16075. xmlns: "http://www.w3.org/2000/svg",
  16076. viewBox: "0 0 1024 1024"
  16077. }, _hoisted_2201 = /* @__PURE__ */ createElementVNode(
  16078. "path",
  16079. {
  16080. fill: "currentColor",
  16081. d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64h352z"
  16082. },
  16083. null,
  16084. -1
  16085. ), _hoisted_3200 = [
  16086. _hoisted_2201
  16087. ];
  16088. function _sfc_render201(_ctx, _cache, $props, $setup, $data, $options) {
  16089. return openBlock(), createElementBlock("svg", _hoisted_1201, _hoisted_3200);
  16090. }
  16091. var plus_default = /* @__PURE__ */ export_helper_default(plus_vue_vue_type_script_lang_default, [["render", _sfc_render201], ["__file", "plus.vue"]]);
  16092. var setting_vue_vue_type_script_lang_default = {
  16093. name: "Setting"
  16094. };
  16095. var _hoisted_1231 = {
  16096. xmlns: "http://www.w3.org/2000/svg",
  16097. viewBox: "0 0 1024 1024"
  16098. }, _hoisted_2231 = /* @__PURE__ */ createElementVNode(
  16099. "path",
  16100. {
  16101. fill: "currentColor",
  16102. d: "M600.704 64a32 32 0 0 1 30.464 22.208l35.2 109.376c14.784 7.232 28.928 15.36 42.432 24.512l112.384-24.192a32 32 0 0 1 34.432 15.36L944.32 364.8a32 32 0 0 1-4.032 37.504l-77.12 85.12a357.12 357.12 0 0 1 0 49.024l77.12 85.248a32 32 0 0 1 4.032 37.504l-88.704 153.6a32 32 0 0 1-34.432 15.296L708.8 803.904c-13.44 9.088-27.648 17.28-42.368 24.512l-35.264 109.376A32 32 0 0 1 600.704 960H423.296a32 32 0 0 1-30.464-22.208L357.696 828.48a351.616 351.616 0 0 1-42.56-24.64l-112.32 24.256a32 32 0 0 1-34.432-15.36L79.68 659.2a32 32 0 0 1 4.032-37.504l77.12-85.248a357.12 357.12 0 0 1 0-48.896l-77.12-85.248A32 32 0 0 1 79.68 364.8l88.704-153.6a32 32 0 0 1 34.432-15.296l112.32 24.256c13.568-9.152 27.776-17.408 42.56-24.64l35.2-109.312A32 32 0 0 1 423.232 64H600.64zm-23.424 64H446.72l-36.352 113.088-24.512 11.968a294.113 294.113 0 0 0-34.816 20.096l-22.656 15.36-116.224-25.088-65.28 113.152 79.68 88.192-1.92 27.136a293.12 293.12 0 0 0 0 40.192l1.92 27.136-79.808 88.192 65.344 113.152 116.224-25.024 22.656 15.296a294.113 294.113 0 0 0 34.816 20.096l24.512 11.968L446.72 896h130.688l36.48-113.152 24.448-11.904a288.282 288.282 0 0 0 34.752-20.096l22.592-15.296 116.288 25.024 65.28-113.152-79.744-88.192 1.92-27.136a293.12 293.12 0 0 0 0-40.256l-1.92-27.136 79.808-88.128-65.344-113.152-116.288 24.96-22.592-15.232a287.616 287.616 0 0 0-34.752-20.096l-24.448-11.904L577.344 128zM512 320a192 192 0 1 1 0 384 192 192 0 0 1 0-384zm0 64a128 128 0 1 0 0 256 128 128 0 0 0 0-256z"
  16103. },
  16104. null,
  16105. -1
  16106. ), _hoisted_3230 = [
  16107. _hoisted_2231
  16108. ];
  16109. function _sfc_render231(_ctx, _cache, $props, $setup, $data, $options) {
  16110. return openBlock(), createElementBlock("svg", _hoisted_1231, _hoisted_3230);
  16111. }
  16112. var setting_default = /* @__PURE__ */ export_helper_default(setting_vue_vue_type_script_lang_default, [["render", _sfc_render231], ["__file", "setting.vue"]]);
  16113. var view_vue_vue_type_script_lang_default = {
  16114. name: "View"
  16115. };
  16116. var _hoisted_1283 = {
  16117. xmlns: "http://www.w3.org/2000/svg",
  16118. viewBox: "0 0 1024 1024"
  16119. }, _hoisted_2283 = /* @__PURE__ */ createElementVNode(
  16120. "path",
  16121. {
  16122. fill: "currentColor",
  16123. d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448zm0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"
  16124. },
  16125. null,
  16126. -1
  16127. ), _hoisted_3282 = [
  16128. _hoisted_2283
  16129. ];
  16130. function _sfc_render283(_ctx, _cache, $props, $setup, $data, $options) {
  16131. return openBlock(), createElementBlock("svg", _hoisted_1283, _hoisted_3282);
  16132. }
  16133. var view_default = /* @__PURE__ */ export_helper_default(view_vue_vue_type_script_lang_default, [["render", _sfc_render283], ["__file", "view.vue"]]);
  16134. const epPropKey = "__epPropKey";
  16135. const definePropType = (val) => val;
  16136. const isEpProp = (val) => isObject$5(val) && !!val[epPropKey];
  16137. const buildProp = (prop, key) => {
  16138. if (!isObject$5(prop) || isEpProp(prop))
  16139. return prop;
  16140. const { values: values3, required, default: defaultValue2, type: type2, validator } = prop;
  16141. const _validator = values3 || validator ? (val) => {
  16142. let valid = false;
  16143. let allowedValues = [];
  16144. if (values3) {
  16145. allowedValues = Array.from(values3);
  16146. if (hasOwn(prop, "default")) {
  16147. allowedValues.push(defaultValue2);
  16148. }
  16149. valid || (valid = allowedValues.includes(val));
  16150. }
  16151. if (validator)
  16152. valid || (valid = validator(val));
  16153. if (!valid && allowedValues.length > 0) {
  16154. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  16155. warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  16156. }
  16157. return valid;
  16158. } : void 0;
  16159. const epProp = {
  16160. type: type2,
  16161. required: !!required,
  16162. validator: _validator,
  16163. [epPropKey]: true
  16164. };
  16165. if (hasOwn(prop, "default"))
  16166. epProp.default = defaultValue2;
  16167. return epProp;
  16168. };
  16169. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  16170. key,
  16171. buildProp(option, key)
  16172. ]));
  16173. const iconPropType = definePropType([
  16174. String,
  16175. Object,
  16176. Function
  16177. ]);
  16178. const CloseComponents = {
  16179. Close: close_default
  16180. };
  16181. const ValidateComponentsMap = {
  16182. validating: loading_default,
  16183. success: circle_check_default,
  16184. error: circle_close_default
  16185. };
  16186. const withInstall = (main, extra) => {
  16187. main.install = (app) => {
  16188. for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
  16189. app.component(comp.name, comp);
  16190. }
  16191. };
  16192. if (extra) {
  16193. for (const [key, comp] of Object.entries(extra)) {
  16194. main[key] = comp;
  16195. }
  16196. }
  16197. return main;
  16198. };
  16199. const withNoopInstall = (component) => {
  16200. component.install = NOOP;
  16201. return component;
  16202. };
  16203. const composeRefs = (...refs) => {
  16204. return (el) => {
  16205. refs.forEach((ref2) => {
  16206. if (isFunction$3(ref2)) {
  16207. ref2(el);
  16208. } else {
  16209. ref2.value = el;
  16210. }
  16211. });
  16212. };
  16213. };
  16214. const EVENT_CODE = {
  16215. tab: "Tab",
  16216. enter: "Enter",
  16217. space: "Space",
  16218. left: "ArrowLeft",
  16219. up: "ArrowUp",
  16220. right: "ArrowRight",
  16221. down: "ArrowDown",
  16222. esc: "Escape",
  16223. delete: "Delete",
  16224. backspace: "Backspace",
  16225. numpadEnter: "NumpadEnter",
  16226. pageUp: "PageUp",
  16227. pageDown: "PageDown",
  16228. home: "Home",
  16229. end: "End"
  16230. };
  16231. const UPDATE_MODEL_EVENT = "update:modelValue";
  16232. const CHANGE_EVENT = "change";
  16233. const INPUT_EVENT = "input";
  16234. const componentSizes = ["", "default", "small", "large"];
  16235. const componentSizeMap = {
  16236. large: 40,
  16237. default: 32,
  16238. small: 24
  16239. };
  16240. const getComponentSize = (size) => {
  16241. return componentSizeMap[size || "default"];
  16242. };
  16243. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  16244. var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
  16245. PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
  16246. PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
  16247. PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
  16248. PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
  16249. PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
  16250. PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  16251. PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  16252. PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  16253. PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  16254. PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
  16255. PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  16256. PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
  16257. PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
  16258. return PatchFlags2;
  16259. })(PatchFlags || {});
  16260. const isKorean = (text) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(text);
  16261. const generateId = () => Math.floor(Math.random() * 1e4);
  16262. const mutable = (val) => val;
  16263. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  16264. const LISTENER_PREFIX = /^on[A-Z]/;
  16265. const useAttrs = (params = {}) => {
  16266. const { excludeListeners = false, excludeKeys } = params;
  16267. const allExcludeKeys = computed$1(() => {
  16268. return ((excludeKeys == null ? void 0 : excludeKeys.value) || []).concat(DEFAULT_EXCLUDE_KEYS);
  16269. });
  16270. const instance = getCurrentInstance();
  16271. if (!instance) {
  16272. return computed$1(() => ({}));
  16273. }
  16274. return computed$1(() => {
  16275. var _a2;
  16276. return fromPairs(Object.entries((_a2 = instance.proxy) == null ? void 0 : _a2.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  16277. });
  16278. };
  16279. const useDeprecated = ({ from: from3, replacement, scope, version: version2, ref: ref2, type: type2 = "API" }, condition) => {
  16280. watch(() => unref(condition), (val) => {
  16281. }, {
  16282. immediate: true
  16283. });
  16284. };
  16285. const useDraggable = (targetRef, dragRef, draggable2) => {
  16286. let transform3 = {
  16287. offsetX: 0,
  16288. offsetY: 0
  16289. };
  16290. const onMousedown = (e) => {
  16291. const downX = e.clientX;
  16292. const downY = e.clientY;
  16293. const { offsetX, offsetY } = transform3;
  16294. const targetRect = targetRef.value.getBoundingClientRect();
  16295. const targetLeft = targetRect.left;
  16296. const targetTop = targetRect.top;
  16297. const targetWidth = targetRect.width;
  16298. const targetHeight = targetRect.height;
  16299. const clientWidth = document.documentElement.clientWidth;
  16300. const clientHeight = document.documentElement.clientHeight;
  16301. const minLeft = -targetLeft + offsetX;
  16302. const minTop = -targetTop + offsetY;
  16303. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  16304. const maxTop = clientHeight - targetTop - targetHeight + offsetY;
  16305. const onMousemove = (e2) => {
  16306. const moveX = Math.min(Math.max(offsetX + e2.clientX - downX, minLeft), maxLeft);
  16307. const moveY = Math.min(Math.max(offsetY + e2.clientY - downY, minTop), maxTop);
  16308. transform3 = {
  16309. offsetX: moveX,
  16310. offsetY: moveY
  16311. };
  16312. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  16313. };
  16314. const onMouseup = () => {
  16315. document.removeEventListener("mousemove", onMousemove);
  16316. document.removeEventListener("mouseup", onMouseup);
  16317. };
  16318. document.addEventListener("mousemove", onMousemove);
  16319. document.addEventListener("mouseup", onMouseup);
  16320. };
  16321. const onDraggable = () => {
  16322. if (dragRef.value && targetRef.value) {
  16323. dragRef.value.addEventListener("mousedown", onMousedown);
  16324. }
  16325. };
  16326. const offDraggable = () => {
  16327. if (dragRef.value && targetRef.value) {
  16328. dragRef.value.removeEventListener("mousedown", onMousedown);
  16329. }
  16330. };
  16331. onMounted(() => {
  16332. watchEffect(() => {
  16333. if (draggable2.value) {
  16334. onDraggable();
  16335. } else {
  16336. offDraggable();
  16337. }
  16338. });
  16339. });
  16340. onBeforeUnmount(() => {
  16341. offDraggable();
  16342. });
  16343. };
  16344. const useFocus = (el) => {
  16345. return {
  16346. focus: () => {
  16347. var _a2, _b;
  16348. (_b = (_a2 = el.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2);
  16349. }
  16350. };
  16351. };
  16352. var English = {
  16353. name: "en",
  16354. el: {
  16355. colorpicker: {
  16356. confirm: "OK",
  16357. clear: "Clear",
  16358. defaultLabel: "color picker",
  16359. description: "current color is {color}. press enter to select a new color."
  16360. },
  16361. datepicker: {
  16362. now: "Now",
  16363. today: "Today",
  16364. cancel: "Cancel",
  16365. clear: "Clear",
  16366. confirm: "OK",
  16367. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  16368. monthTablePrompt: "Use the arrow keys and enter to select the month",
  16369. yearTablePrompt: "Use the arrow keys and enter to select the year",
  16370. selectedDate: "Selected date",
  16371. selectDate: "Select date",
  16372. selectTime: "Select time",
  16373. startDate: "Start Date",
  16374. startTime: "Start Time",
  16375. endDate: "End Date",
  16376. endTime: "End Time",
  16377. prevYear: "Previous Year",
  16378. nextYear: "Next Year",
  16379. prevMonth: "Previous Month",
  16380. nextMonth: "Next Month",
  16381. year: "",
  16382. month1: "January",
  16383. month2: "February",
  16384. month3: "March",
  16385. month4: "April",
  16386. month5: "May",
  16387. month6: "June",
  16388. month7: "July",
  16389. month8: "August",
  16390. month9: "September",
  16391. month10: "October",
  16392. month11: "November",
  16393. month12: "December",
  16394. week: "week",
  16395. weeks: {
  16396. sun: "Sun",
  16397. mon: "Mon",
  16398. tue: "Tue",
  16399. wed: "Wed",
  16400. thu: "Thu",
  16401. fri: "Fri",
  16402. sat: "Sat"
  16403. },
  16404. weeksFull: {
  16405. sun: "Sunday",
  16406. mon: "Monday",
  16407. tue: "Tuesday",
  16408. wed: "Wednesday",
  16409. thu: "Thursday",
  16410. fri: "Friday",
  16411. sat: "Saturday"
  16412. },
  16413. months: {
  16414. jan: "Jan",
  16415. feb: "Feb",
  16416. mar: "Mar",
  16417. apr: "Apr",
  16418. may: "May",
  16419. jun: "Jun",
  16420. jul: "Jul",
  16421. aug: "Aug",
  16422. sep: "Sep",
  16423. oct: "Oct",
  16424. nov: "Nov",
  16425. dec: "Dec"
  16426. }
  16427. },
  16428. inputNumber: {
  16429. decrease: "decrease number",
  16430. increase: "increase number"
  16431. },
  16432. select: {
  16433. loading: "Loading",
  16434. noMatch: "No matching data",
  16435. noData: "No data",
  16436. placeholder: "Select"
  16437. },
  16438. dropdown: {
  16439. toggleDropdown: "Toggle Dropdown"
  16440. },
  16441. cascader: {
  16442. noMatch: "No matching data",
  16443. loading: "Loading",
  16444. placeholder: "Select",
  16445. noData: "No data"
  16446. },
  16447. pagination: {
  16448. goto: "Go to",
  16449. pagesize: "/page",
  16450. total: "Total {total}",
  16451. pageClassifier: "",
  16452. page: "Page",
  16453. prev: "Go to previous page",
  16454. next: "Go to next page",
  16455. currentPage: "page {pager}",
  16456. prevPages: "Previous {pager} pages",
  16457. nextPages: "Next {pager} pages",
  16458. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  16459. },
  16460. dialog: {
  16461. close: "Close this dialog"
  16462. },
  16463. drawer: {
  16464. close: "Close this dialog"
  16465. },
  16466. messagebox: {
  16467. title: "Message",
  16468. confirm: "OK",
  16469. cancel: "Cancel",
  16470. error: "Illegal input",
  16471. close: "Close this dialog"
  16472. },
  16473. upload: {
  16474. deleteTip: "press delete to remove",
  16475. delete: "Delete",
  16476. preview: "Preview",
  16477. continue: "Continue"
  16478. },
  16479. slider: {
  16480. defaultLabel: "slider between {min} and {max}",
  16481. defaultRangeStartLabel: "pick start value",
  16482. defaultRangeEndLabel: "pick end value"
  16483. },
  16484. table: {
  16485. emptyText: "No Data",
  16486. confirmFilter: "Confirm",
  16487. resetFilter: "Reset",
  16488. clearFilter: "All",
  16489. sumText: "Sum"
  16490. },
  16491. tree: {
  16492. emptyText: "No Data"
  16493. },
  16494. transfer: {
  16495. noMatch: "No matching data",
  16496. noData: "No data",
  16497. titles: ["List 1", "List 2"],
  16498. filterPlaceholder: "Enter keyword",
  16499. noCheckedFormat: "{total} items",
  16500. hasCheckedFormat: "{checked}/{total} checked"
  16501. },
  16502. image: {
  16503. error: "FAILED"
  16504. },
  16505. pageHeader: {
  16506. title: "Back"
  16507. },
  16508. popconfirm: {
  16509. confirmButtonText: "Yes",
  16510. cancelButtonText: "No"
  16511. }
  16512. }
  16513. };
  16514. const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale));
  16515. const translate = (path, option, locale) => get$2(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => {
  16516. var _a2;
  16517. return `${(_a2 = option == null ? void 0 : option[key]) != null ? _a2 : `{${key}}`}`;
  16518. });
  16519. const buildLocaleContext = (locale) => {
  16520. const lang = computed$1(() => unref(locale).name);
  16521. const localeRef = isRef(locale) ? locale : ref(locale);
  16522. return {
  16523. lang,
  16524. locale: localeRef,
  16525. t: buildTranslator(locale)
  16526. };
  16527. };
  16528. const localeContextKey = Symbol("localeContextKey");
  16529. const useLocale = (localeOverrides) => {
  16530. const locale = localeOverrides || inject(localeContextKey, ref());
  16531. return buildLocaleContext(computed$1(() => locale.value || English));
  16532. };
  16533. let activeEffectScope;
  16534. function recordEffectScope(effect, scope = activeEffectScope) {
  16535. if (scope && scope.active) {
  16536. scope.effects.push(effect);
  16537. }
  16538. }
  16539. const createDep = (effects) => {
  16540. const dep = new Set(effects);
  16541. dep.w = 0;
  16542. dep.n = 0;
  16543. return dep;
  16544. };
  16545. const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
  16546. const newTracked = (dep) => (dep.n & trackOpBit) > 0;
  16547. const initDepMarkers = ({ deps }) => {
  16548. if (deps.length) {
  16549. for (let i2 = 0; i2 < deps.length; i2++) {
  16550. deps[i2].w |= trackOpBit;
  16551. }
  16552. }
  16553. };
  16554. const finalizeDepMarkers = (effect) => {
  16555. const { deps } = effect;
  16556. if (deps.length) {
  16557. let ptr = 0;
  16558. for (let i2 = 0; i2 < deps.length; i2++) {
  16559. const dep = deps[i2];
  16560. if (wasTracked(dep) && !newTracked(dep)) {
  16561. dep.delete(effect);
  16562. } else {
  16563. deps[ptr++] = dep;
  16564. }
  16565. dep.w &= ~trackOpBit;
  16566. dep.n &= ~trackOpBit;
  16567. }
  16568. deps.length = ptr;
  16569. }
  16570. };
  16571. let effectTrackDepth = 0;
  16572. let trackOpBit = 1;
  16573. const maxMarkerBits = 30;
  16574. let activeEffect;
  16575. class ReactiveEffect {
  16576. constructor(fn2, scheduler = null, scope) {
  16577. this.fn = fn2;
  16578. this.scheduler = scheduler;
  16579. this.active = true;
  16580. this.deps = [];
  16581. this.parent = void 0;
  16582. recordEffectScope(this, scope);
  16583. }
  16584. run() {
  16585. if (!this.active) {
  16586. return this.fn();
  16587. }
  16588. let parent = activeEffect;
  16589. let lastShouldTrack = shouldTrack;
  16590. while (parent) {
  16591. if (parent === this) {
  16592. return;
  16593. }
  16594. parent = parent.parent;
  16595. }
  16596. try {
  16597. this.parent = activeEffect;
  16598. activeEffect = this;
  16599. shouldTrack = true;
  16600. trackOpBit = 1 << ++effectTrackDepth;
  16601. if (effectTrackDepth <= maxMarkerBits) {
  16602. initDepMarkers(this);
  16603. } else {
  16604. cleanupEffect(this);
  16605. }
  16606. return this.fn();
  16607. } finally {
  16608. if (effectTrackDepth <= maxMarkerBits) {
  16609. finalizeDepMarkers(this);
  16610. }
  16611. trackOpBit = 1 << --effectTrackDepth;
  16612. activeEffect = this.parent;
  16613. shouldTrack = lastShouldTrack;
  16614. this.parent = void 0;
  16615. if (this.deferStop) {
  16616. this.stop();
  16617. }
  16618. }
  16619. }
  16620. stop() {
  16621. if (activeEffect === this) {
  16622. this.deferStop = true;
  16623. } else if (this.active) {
  16624. cleanupEffect(this);
  16625. if (this.onStop) {
  16626. this.onStop();
  16627. }
  16628. this.active = false;
  16629. }
  16630. }
  16631. }
  16632. function cleanupEffect(effect2) {
  16633. const { deps } = effect2;
  16634. if (deps.length) {
  16635. for (let i2 = 0; i2 < deps.length; i2++) {
  16636. deps[i2].delete(effect2);
  16637. }
  16638. deps.length = 0;
  16639. }
  16640. }
  16641. let shouldTrack = true;
  16642. function trackEffects(dep, debuggerEventExtraInfo) {
  16643. let shouldTrack2 = false;
  16644. if (effectTrackDepth <= maxMarkerBits) {
  16645. if (!newTracked(dep)) {
  16646. dep.n |= trackOpBit;
  16647. shouldTrack2 = !wasTracked(dep);
  16648. }
  16649. } else {
  16650. shouldTrack2 = !dep.has(activeEffect);
  16651. }
  16652. if (shouldTrack2) {
  16653. dep.add(activeEffect);
  16654. activeEffect.deps.push(dep);
  16655. }
  16656. }
  16657. function triggerEffects(dep, debuggerEventExtraInfo) {
  16658. const effects = isArray$2(dep) ? dep : [...dep];
  16659. for (const effect2 of effects) {
  16660. if (effect2.computed) {
  16661. triggerEffect(effect2);
  16662. }
  16663. }
  16664. for (const effect2 of effects) {
  16665. if (!effect2.computed) {
  16666. triggerEffect(effect2);
  16667. }
  16668. }
  16669. }
  16670. function triggerEffect(effect2, debuggerEventExtraInfo) {
  16671. if (effect2 !== activeEffect || effect2.allowRecurse) {
  16672. if (effect2.scheduler) {
  16673. effect2.scheduler();
  16674. } else {
  16675. effect2.run();
  16676. }
  16677. }
  16678. }
  16679. function toRaw(observed) {
  16680. const raw = observed && observed["__v_raw"];
  16681. return raw ? toRaw(raw) : observed;
  16682. }
  16683. function trackRefValue(ref2) {
  16684. if (shouldTrack && activeEffect) {
  16685. ref2 = toRaw(ref2);
  16686. {
  16687. trackEffects(ref2.dep || (ref2.dep = createDep()));
  16688. }
  16689. }
  16690. }
  16691. function triggerRefValue(ref2, newVal) {
  16692. ref2 = toRaw(ref2);
  16693. const dep = ref2.dep;
  16694. if (dep) {
  16695. {
  16696. triggerEffects(dep);
  16697. }
  16698. }
  16699. }
  16700. class ComputedRefImpl {
  16701. constructor(getter, _setter, isReadonly, isSSR) {
  16702. this._setter = _setter;
  16703. this.dep = void 0;
  16704. this.__v_isRef = true;
  16705. this["__v_isReadonly"] = false;
  16706. this._dirty = true;
  16707. this.effect = new ReactiveEffect(getter, () => {
  16708. if (!this._dirty) {
  16709. this._dirty = true;
  16710. triggerRefValue(this);
  16711. }
  16712. });
  16713. this.effect.computed = this;
  16714. this.effect.active = this._cacheable = !isSSR;
  16715. this["__v_isReadonly"] = isReadonly;
  16716. }
  16717. get value() {
  16718. const self2 = toRaw(this);
  16719. trackRefValue(self2);
  16720. if (self2._dirty || !self2._cacheable) {
  16721. self2._dirty = false;
  16722. self2._value = self2.effect.run();
  16723. }
  16724. return self2._value;
  16725. }
  16726. set value(newValue) {
  16727. this._setter(newValue);
  16728. }
  16729. }
  16730. function computed(getterOrOptions, debugOptions, isSSR = false) {
  16731. let getter;
  16732. let setter;
  16733. const onlyGetter = isFunction$3(getterOrOptions);
  16734. if (onlyGetter) {
  16735. getter = getterOrOptions;
  16736. setter = NOOP;
  16737. } else {
  16738. getter = getterOrOptions.get;
  16739. setter = getterOrOptions.set;
  16740. }
  16741. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  16742. return cRef;
  16743. }
  16744. const defaultNamespace = "el";
  16745. const statePrefix = "is-";
  16746. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  16747. let cls = `${namespace}-${block}`;
  16748. if (blockSuffix) {
  16749. cls += `-${blockSuffix}`;
  16750. }
  16751. if (element) {
  16752. cls += `__${element}`;
  16753. }
  16754. if (modifier) {
  16755. cls += `--${modifier}`;
  16756. }
  16757. return cls;
  16758. };
  16759. const namespaceContextKey = Symbol("namespaceContextKey");
  16760. const useGetDerivedNamespace = (namespaceOverrides) => {
  16761. const derivedNamespace = namespaceOverrides || inject(namespaceContextKey, ref(defaultNamespace));
  16762. const namespace = computed$1(() => {
  16763. return unref(derivedNamespace) || defaultNamespace;
  16764. });
  16765. return namespace;
  16766. };
  16767. const useNamespace = (block, namespaceOverrides) => {
  16768. const namespace = useGetDerivedNamespace(namespaceOverrides);
  16769. const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
  16770. const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
  16771. const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
  16772. const be2 = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
  16773. const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
  16774. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
  16775. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
  16776. const is = (name, ...args) => {
  16777. const state = args.length >= 1 ? args[0] : true;
  16778. return name && state ? `${statePrefix}${name}` : "";
  16779. };
  16780. const cssVar = (object) => {
  16781. const styles = {};
  16782. for (const key in object) {
  16783. if (object[key]) {
  16784. styles[`--${namespace.value}-${key}`] = object[key];
  16785. }
  16786. }
  16787. return styles;
  16788. };
  16789. const cssVarBlock = (object) => {
  16790. const styles = {};
  16791. for (const key in object) {
  16792. if (object[key]) {
  16793. styles[`--${namespace.value}-${block}-${key}`] = object[key];
  16794. }
  16795. }
  16796. return styles;
  16797. };
  16798. const cssVarName = (name) => `--${namespace.value}-${name}`;
  16799. const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
  16800. return {
  16801. namespace,
  16802. b,
  16803. e,
  16804. m,
  16805. be: be2,
  16806. em,
  16807. bm,
  16808. bem,
  16809. is,
  16810. cssVar,
  16811. cssVarName,
  16812. cssVarBlock,
  16813. cssVarBlockName
  16814. };
  16815. };
  16816. const useLockscreen = (trigger2, options2 = {}) => {
  16817. if (!isRef(trigger2)) {
  16818. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  16819. }
  16820. const ns = options2.ns || useNamespace("popup");
  16821. const hiddenCls = computed(() => ns.bm("parent", "hidden"));
  16822. if (!isClient || hasClass$2(document.body, hiddenCls.value)) {
  16823. return;
  16824. }
  16825. let scrollBarWidth2 = 0;
  16826. let withoutHiddenClass = false;
  16827. let bodyWidth = "0";
  16828. const cleanup = () => {
  16829. setTimeout(() => {
  16830. removeClass$2(document == null ? void 0 : document.body, hiddenCls.value);
  16831. if (withoutHiddenClass && document) {
  16832. document.body.style.width = bodyWidth;
  16833. }
  16834. }, 200);
  16835. };
  16836. watch(trigger2, (val) => {
  16837. if (!val) {
  16838. cleanup();
  16839. return;
  16840. }
  16841. withoutHiddenClass = !hasClass$2(document.body, hiddenCls.value);
  16842. if (withoutHiddenClass) {
  16843. bodyWidth = document.body.style.width;
  16844. }
  16845. scrollBarWidth2 = getScrollBarWidth(ns.namespace.value);
  16846. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  16847. const bodyOverflowY = getStyle(document.body, "overflowY");
  16848. if (scrollBarWidth2 > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  16849. document.body.style.width = `calc(100% - ${scrollBarWidth2}px)`;
  16850. }
  16851. addClass$2(document.body, hiddenCls.value);
  16852. });
  16853. onScopeDispose(() => cleanup());
  16854. };
  16855. const _prop = buildProp({
  16856. type: definePropType(Boolean),
  16857. default: null
  16858. });
  16859. const _event = buildProp({
  16860. type: definePropType(Function)
  16861. });
  16862. const createModelToggleComposable = (name) => {
  16863. const updateEventKey = `update:${name}`;
  16864. const updateEventKeyRaw = `onUpdate:${name}`;
  16865. const useModelToggleEmits2 = [updateEventKey];
  16866. const useModelToggleProps2 = {
  16867. [name]: _prop,
  16868. [updateEventKeyRaw]: _event
  16869. };
  16870. const useModelToggle2 = ({
  16871. indicator,
  16872. toggleReason,
  16873. shouldHideWhenRouteChanges,
  16874. shouldProceed,
  16875. onShow,
  16876. onHide
  16877. }) => {
  16878. const instance = getCurrentInstance();
  16879. const { emit } = instance;
  16880. const props = instance.props;
  16881. const hasUpdateHandler = computed$1(() => isFunction$3(props[updateEventKeyRaw]));
  16882. const isModelBindingAbsent = computed$1(() => props[name] === null);
  16883. const doShow = (event2) => {
  16884. if (indicator.value === true) {
  16885. return;
  16886. }
  16887. indicator.value = true;
  16888. if (toggleReason) {
  16889. toggleReason.value = event2;
  16890. }
  16891. if (isFunction$3(onShow)) {
  16892. onShow(event2);
  16893. }
  16894. };
  16895. const doHide = (event2) => {
  16896. if (indicator.value === false) {
  16897. return;
  16898. }
  16899. indicator.value = false;
  16900. if (toggleReason) {
  16901. toggleReason.value = event2;
  16902. }
  16903. if (isFunction$3(onHide)) {
  16904. onHide(event2);
  16905. }
  16906. };
  16907. const show = (event2) => {
  16908. if (props.disabled === true || isFunction$3(shouldProceed) && !shouldProceed())
  16909. return;
  16910. const shouldEmit = hasUpdateHandler.value && isClient;
  16911. if (shouldEmit) {
  16912. emit(updateEventKey, true);
  16913. }
  16914. if (isModelBindingAbsent.value || !shouldEmit) {
  16915. doShow(event2);
  16916. }
  16917. };
  16918. const hide = (event2) => {
  16919. if (props.disabled === true || !isClient)
  16920. return;
  16921. const shouldEmit = hasUpdateHandler.value && isClient;
  16922. if (shouldEmit) {
  16923. emit(updateEventKey, false);
  16924. }
  16925. if (isModelBindingAbsent.value || !shouldEmit) {
  16926. doHide(event2);
  16927. }
  16928. };
  16929. const onChange = (val) => {
  16930. if (!isBoolean(val))
  16931. return;
  16932. if (props.disabled && val) {
  16933. if (hasUpdateHandler.value) {
  16934. emit(updateEventKey, false);
  16935. }
  16936. } else if (indicator.value !== val) {
  16937. if (val) {
  16938. doShow();
  16939. } else {
  16940. doHide();
  16941. }
  16942. }
  16943. };
  16944. const toggle = () => {
  16945. if (indicator.value) {
  16946. hide();
  16947. } else {
  16948. show();
  16949. }
  16950. };
  16951. watch(() => props[name], onChange);
  16952. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  16953. watch(() => ({
  16954. ...instance.proxy.$route
  16955. }), () => {
  16956. if (shouldHideWhenRouteChanges.value && indicator.value) {
  16957. hide();
  16958. }
  16959. });
  16960. }
  16961. onMounted(() => {
  16962. onChange(props[name]);
  16963. });
  16964. return {
  16965. hide,
  16966. show,
  16967. toggle,
  16968. hasUpdateHandler
  16969. };
  16970. };
  16971. return {
  16972. useModelToggle: useModelToggle2,
  16973. useModelToggleProps: useModelToggleProps2,
  16974. useModelToggleEmits: useModelToggleEmits2
  16975. };
  16976. };
  16977. const useProp = (name) => {
  16978. const vm = getCurrentInstance();
  16979. return computed$1(() => {
  16980. var _a2, _b;
  16981. return (_b = (_a2 = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a2.$props) == null ? void 0 : _b[name];
  16982. });
  16983. };
  16984. var E = "top", R = "bottom", W = "right", P = "left", me = "auto", G = [E, R, W, P], U = "start", J = "end", Xe = "clippingParents", je = "viewport", K = "popper", Ye = "reference", De = G.reduce(function(t2, e) {
  16985. return t2.concat([e + "-" + U, e + "-" + J]);
  16986. }, []), Ee = [].concat(G, [me]).reduce(function(t2, e) {
  16987. return t2.concat([e, e + "-" + U, e + "-" + J]);
  16988. }, []), Ge = "beforeRead", Je = "read", Ke = "afterRead", Qe = "beforeMain", Ze = "main", et = "afterMain", tt = "beforeWrite", nt = "write", rt = "afterWrite", ot = [Ge, Je, Ke, Qe, Ze, et, tt, nt, rt];
  16989. function C(t2) {
  16990. return t2 ? (t2.nodeName || "").toLowerCase() : null;
  16991. }
  16992. function H(t2) {
  16993. if (t2 == null)
  16994. return window;
  16995. if (t2.toString() !== "[object Window]") {
  16996. var e = t2.ownerDocument;
  16997. return e && e.defaultView || window;
  16998. }
  16999. return t2;
  17000. }
  17001. function Q(t2) {
  17002. var e = H(t2).Element;
  17003. return t2 instanceof e || t2 instanceof Element;
  17004. }
  17005. function B(t2) {
  17006. var e = H(t2).HTMLElement;
  17007. return t2 instanceof e || t2 instanceof HTMLElement;
  17008. }
  17009. function Pe(t2) {
  17010. if (typeof ShadowRoot == "undefined")
  17011. return false;
  17012. var e = H(t2).ShadowRoot;
  17013. return t2 instanceof e || t2 instanceof ShadowRoot;
  17014. }
  17015. function Mt(t2) {
  17016. var e = t2.state;
  17017. Object.keys(e.elements).forEach(function(n) {
  17018. var r2 = e.styles[n] || {}, o = e.attributes[n] || {}, i2 = e.elements[n];
  17019. !B(i2) || !C(i2) || (Object.assign(i2.style, r2), Object.keys(o).forEach(function(a) {
  17020. var s = o[a];
  17021. s === false ? i2.removeAttribute(a) : i2.setAttribute(a, s === true ? "" : s);
  17022. }));
  17023. });
  17024. }
  17025. function Rt(t2) {
  17026. var e = t2.state, n = { popper: { position: e.options.strategy, left: "0", top: "0", margin: "0" }, arrow: { position: "absolute" }, reference: {} };
  17027. return Object.assign(e.elements.popper.style, n.popper), e.styles = n, e.elements.arrow && Object.assign(e.elements.arrow.style, n.arrow), function() {
  17028. Object.keys(e.elements).forEach(function(r2) {
  17029. var o = e.elements[r2], i2 = e.attributes[r2] || {}, a = Object.keys(e.styles.hasOwnProperty(r2) ? e.styles[r2] : n[r2]), s = a.reduce(function(f, c) {
  17030. return f[c] = "", f;
  17031. }, {});
  17032. !B(o) || !C(o) || (Object.assign(o.style, s), Object.keys(i2).forEach(function(f) {
  17033. o.removeAttribute(f);
  17034. }));
  17035. });
  17036. };
  17037. }
  17038. var Ae = { name: "applyStyles", enabled: true, phase: "write", fn: Mt, effect: Rt, requires: ["computeStyles"] };
  17039. function q(t2) {
  17040. return t2.split("-")[0];
  17041. }
  17042. var X = Math.max, ve = Math.min, Z = Math.round;
  17043. function ee(t2, e) {
  17044. e === void 0 && (e = false);
  17045. var n = t2.getBoundingClientRect(), r2 = 1, o = 1;
  17046. if (B(t2) && e) {
  17047. var i2 = t2.offsetHeight, a = t2.offsetWidth;
  17048. a > 0 && (r2 = Z(n.width) / a || 1), i2 > 0 && (o = Z(n.height) / i2 || 1);
  17049. }
  17050. return { width: n.width / r2, height: n.height / o, top: n.top / o, right: n.right / r2, bottom: n.bottom / o, left: n.left / r2, x: n.left / r2, y: n.top / o };
  17051. }
  17052. function ke(t2) {
  17053. var e = ee(t2), n = t2.offsetWidth, r2 = t2.offsetHeight;
  17054. return Math.abs(e.width - n) <= 1 && (n = e.width), Math.abs(e.height - r2) <= 1 && (r2 = e.height), { x: t2.offsetLeft, y: t2.offsetTop, width: n, height: r2 };
  17055. }
  17056. function it(t2, e) {
  17057. var n = e.getRootNode && e.getRootNode();
  17058. if (t2.contains(e))
  17059. return true;
  17060. if (n && Pe(n)) {
  17061. var r2 = e;
  17062. do {
  17063. if (r2 && t2.isSameNode(r2))
  17064. return true;
  17065. r2 = r2.parentNode || r2.host;
  17066. } while (r2);
  17067. }
  17068. return false;
  17069. }
  17070. function N(t2) {
  17071. return H(t2).getComputedStyle(t2);
  17072. }
  17073. function Wt(t2) {
  17074. return ["table", "td", "th"].indexOf(C(t2)) >= 0;
  17075. }
  17076. function I(t2) {
  17077. return ((Q(t2) ? t2.ownerDocument : t2.document) || window.document).documentElement;
  17078. }
  17079. function ge(t2) {
  17080. return C(t2) === "html" ? t2 : t2.assignedSlot || t2.parentNode || (Pe(t2) ? t2.host : null) || I(t2);
  17081. }
  17082. function at(t2) {
  17083. return !B(t2) || N(t2).position === "fixed" ? null : t2.offsetParent;
  17084. }
  17085. function Bt(t2) {
  17086. var e = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1, n = navigator.userAgent.indexOf("Trident") !== -1;
  17087. if (n && B(t2)) {
  17088. var r2 = N(t2);
  17089. if (r2.position === "fixed")
  17090. return null;
  17091. }
  17092. var o = ge(t2);
  17093. for (Pe(o) && (o = o.host); B(o) && ["html", "body"].indexOf(C(o)) < 0; ) {
  17094. var i2 = N(o);
  17095. if (i2.transform !== "none" || i2.perspective !== "none" || i2.contain === "paint" || ["transform", "perspective"].indexOf(i2.willChange) !== -1 || e && i2.willChange === "filter" || e && i2.filter && i2.filter !== "none")
  17096. return o;
  17097. o = o.parentNode;
  17098. }
  17099. return null;
  17100. }
  17101. function se(t2) {
  17102. for (var e = H(t2), n = at(t2); n && Wt(n) && N(n).position === "static"; )
  17103. n = at(n);
  17104. return n && (C(n) === "html" || C(n) === "body" && N(n).position === "static") ? e : n || Bt(t2) || e;
  17105. }
  17106. function Le(t2) {
  17107. return ["top", "bottom"].indexOf(t2) >= 0 ? "x" : "y";
  17108. }
  17109. function fe(t2, e, n) {
  17110. return X(t2, ve(e, n));
  17111. }
  17112. function St(t2, e, n) {
  17113. var r2 = fe(t2, e, n);
  17114. return r2 > n ? n : r2;
  17115. }
  17116. function st() {
  17117. return { top: 0, right: 0, bottom: 0, left: 0 };
  17118. }
  17119. function ft(t2) {
  17120. return Object.assign({}, st(), t2);
  17121. }
  17122. function ct(t2, e) {
  17123. return e.reduce(function(n, r2) {
  17124. return n[r2] = t2, n;
  17125. }, {});
  17126. }
  17127. var Tt = function(t2, e) {
  17128. return t2 = typeof t2 == "function" ? t2(Object.assign({}, e.rects, { placement: e.placement })) : t2, ft(typeof t2 != "number" ? t2 : ct(t2, G));
  17129. };
  17130. function Ht(t2) {
  17131. var e, n = t2.state, r2 = t2.name, o = t2.options, i2 = n.elements.arrow, a = n.modifiersData.popperOffsets, s = q(n.placement), f = Le(s), c = [P, W].indexOf(s) >= 0, u = c ? "height" : "width";
  17132. if (!(!i2 || !a)) {
  17133. var m = Tt(o.padding, n), v = ke(i2), l = f === "y" ? E : P, h2 = f === "y" ? R : W, p = n.rects.reference[u] + n.rects.reference[f] - a[f] - n.rects.popper[u], g = a[f] - n.rects.reference[f], x = se(i2), y = x ? f === "y" ? x.clientHeight || 0 : x.clientWidth || 0 : 0, $2 = p / 2 - g / 2, d2 = m[l], b = y - v[u] - m[h2], w = y / 2 - v[u] / 2 + $2, O = fe(d2, w, b), j = f;
  17134. n.modifiersData[r2] = (e = {}, e[j] = O, e.centerOffset = O - w, e);
  17135. }
  17136. }
  17137. function Ct(t2) {
  17138. var e = t2.state, n = t2.options, r2 = n.element, o = r2 === void 0 ? "[data-popper-arrow]" : r2;
  17139. o != null && (typeof o == "string" && (o = e.elements.popper.querySelector(o), !o) || !it(e.elements.popper, o) || (e.elements.arrow = o));
  17140. }
  17141. var pt = { name: "arrow", enabled: true, phase: "main", fn: Ht, effect: Ct, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] };
  17142. function te(t2) {
  17143. return t2.split("-")[1];
  17144. }
  17145. var qt = { top: "auto", right: "auto", bottom: "auto", left: "auto" };
  17146. function Vt(t2) {
  17147. var e = t2.x, n = t2.y, r2 = window, o = r2.devicePixelRatio || 1;
  17148. return { x: Z(e * o) / o || 0, y: Z(n * o) / o || 0 };
  17149. }
  17150. function ut(t2) {
  17151. var e, n = t2.popper, r2 = t2.popperRect, o = t2.placement, i2 = t2.variation, a = t2.offsets, s = t2.position, f = t2.gpuAcceleration, c = t2.adaptive, u = t2.roundOffsets, m = t2.isFixed, v = a.x, l = v === void 0 ? 0 : v, h2 = a.y, p = h2 === void 0 ? 0 : h2, g = typeof u == "function" ? u({ x: l, y: p }) : { x: l, y: p };
  17152. l = g.x, p = g.y;
  17153. var x = a.hasOwnProperty("x"), y = a.hasOwnProperty("y"), $2 = P, d2 = E, b = window;
  17154. if (c) {
  17155. var w = se(n), O = "clientHeight", j = "clientWidth";
  17156. if (w === H(n) && (w = I(n), N(w).position !== "static" && s === "absolute" && (O = "scrollHeight", j = "scrollWidth")), w = w, o === E || (o === P || o === W) && i2 === J) {
  17157. d2 = R;
  17158. var A = m && w === b && b.visualViewport ? b.visualViewport.height : w[O];
  17159. p -= A - r2.height, p *= f ? 1 : -1;
  17160. }
  17161. if (o === P || (o === E || o === R) && i2 === J) {
  17162. $2 = W;
  17163. var k = m && w === b && b.visualViewport ? b.visualViewport.width : w[j];
  17164. l -= k - r2.width, l *= f ? 1 : -1;
  17165. }
  17166. }
  17167. var D = Object.assign({ position: s }, c && qt), S = u === true ? Vt({ x: l, y: p }) : { x: l, y: p };
  17168. if (l = S.x, p = S.y, f) {
  17169. var L;
  17170. return Object.assign({}, D, (L = {}, L[d2] = y ? "0" : "", L[$2] = x ? "0" : "", L.transform = (b.devicePixelRatio || 1) <= 1 ? "translate(" + l + "px, " + p + "px)" : "translate3d(" + l + "px, " + p + "px, 0)", L));
  17171. }
  17172. return Object.assign({}, D, (e = {}, e[d2] = y ? p + "px" : "", e[$2] = x ? l + "px" : "", e.transform = "", e));
  17173. }
  17174. function Nt(t2) {
  17175. var e = t2.state, n = t2.options, r2 = n.gpuAcceleration, o = r2 === void 0 ? true : r2, i2 = n.adaptive, a = i2 === void 0 ? true : i2, s = n.roundOffsets, f = s === void 0 ? true : s, c = { placement: q(e.placement), variation: te(e.placement), popper: e.elements.popper, popperRect: e.rects.popper, gpuAcceleration: o, isFixed: e.options.strategy === "fixed" };
  17176. e.modifiersData.popperOffsets != null && (e.styles.popper = Object.assign({}, e.styles.popper, ut(Object.assign({}, c, { offsets: e.modifiersData.popperOffsets, position: e.options.strategy, adaptive: a, roundOffsets: f })))), e.modifiersData.arrow != null && (e.styles.arrow = Object.assign({}, e.styles.arrow, ut(Object.assign({}, c, { offsets: e.modifiersData.arrow, position: "absolute", adaptive: false, roundOffsets: f })))), e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-placement": e.placement });
  17177. }
  17178. var Me = { name: "computeStyles", enabled: true, phase: "beforeWrite", fn: Nt, data: {} }, ye = { passive: true };
  17179. function It(t2) {
  17180. var e = t2.state, n = t2.instance, r2 = t2.options, o = r2.scroll, i2 = o === void 0 ? true : o, a = r2.resize, s = a === void 0 ? true : a, f = H(e.elements.popper), c = [].concat(e.scrollParents.reference, e.scrollParents.popper);
  17181. return i2 && c.forEach(function(u) {
  17182. u.addEventListener("scroll", n.update, ye);
  17183. }), s && f.addEventListener("resize", n.update, ye), function() {
  17184. i2 && c.forEach(function(u) {
  17185. u.removeEventListener("scroll", n.update, ye);
  17186. }), s && f.removeEventListener("resize", n.update, ye);
  17187. };
  17188. }
  17189. var Re = { name: "eventListeners", enabled: true, phase: "write", fn: function() {
  17190. }, effect: It, data: {} }, _t = { left: "right", right: "left", bottom: "top", top: "bottom" };
  17191. function be(t2) {
  17192. return t2.replace(/left|right|bottom|top/g, function(e) {
  17193. return _t[e];
  17194. });
  17195. }
  17196. var zt = { start: "end", end: "start" };
  17197. function lt(t2) {
  17198. return t2.replace(/start|end/g, function(e) {
  17199. return zt[e];
  17200. });
  17201. }
  17202. function We(t2) {
  17203. var e = H(t2), n = e.pageXOffset, r2 = e.pageYOffset;
  17204. return { scrollLeft: n, scrollTop: r2 };
  17205. }
  17206. function Be(t2) {
  17207. return ee(I(t2)).left + We(t2).scrollLeft;
  17208. }
  17209. function Ft(t2) {
  17210. var e = H(t2), n = I(t2), r2 = e.visualViewport, o = n.clientWidth, i2 = n.clientHeight, a = 0, s = 0;
  17211. return r2 && (o = r2.width, i2 = r2.height, /^((?!chrome|android).)*safari/i.test(navigator.userAgent) || (a = r2.offsetLeft, s = r2.offsetTop)), { width: o, height: i2, x: a + Be(t2), y: s };
  17212. }
  17213. function Ut(t2) {
  17214. var e, n = I(t2), r2 = We(t2), o = (e = t2.ownerDocument) == null ? void 0 : e.body, i2 = X(n.scrollWidth, n.clientWidth, o ? o.scrollWidth : 0, o ? o.clientWidth : 0), a = X(n.scrollHeight, n.clientHeight, o ? o.scrollHeight : 0, o ? o.clientHeight : 0), s = -r2.scrollLeft + Be(t2), f = -r2.scrollTop;
  17215. return N(o || n).direction === "rtl" && (s += X(n.clientWidth, o ? o.clientWidth : 0) - i2), { width: i2, height: a, x: s, y: f };
  17216. }
  17217. function Se(t2) {
  17218. var e = N(t2), n = e.overflow, r2 = e.overflowX, o = e.overflowY;
  17219. return /auto|scroll|overlay|hidden/.test(n + o + r2);
  17220. }
  17221. function dt(t2) {
  17222. return ["html", "body", "#document"].indexOf(C(t2)) >= 0 ? t2.ownerDocument.body : B(t2) && Se(t2) ? t2 : dt(ge(t2));
  17223. }
  17224. function ce(t2, e) {
  17225. var n;
  17226. e === void 0 && (e = []);
  17227. var r2 = dt(t2), o = r2 === ((n = t2.ownerDocument) == null ? void 0 : n.body), i2 = H(r2), a = o ? [i2].concat(i2.visualViewport || [], Se(r2) ? r2 : []) : r2, s = e.concat(a);
  17228. return o ? s : s.concat(ce(ge(a)));
  17229. }
  17230. function Te(t2) {
  17231. return Object.assign({}, t2, { left: t2.x, top: t2.y, right: t2.x + t2.width, bottom: t2.y + t2.height });
  17232. }
  17233. function Xt(t2) {
  17234. var e = ee(t2);
  17235. return e.top = e.top + t2.clientTop, e.left = e.left + t2.clientLeft, e.bottom = e.top + t2.clientHeight, e.right = e.left + t2.clientWidth, e.width = t2.clientWidth, e.height = t2.clientHeight, e.x = e.left, e.y = e.top, e;
  17236. }
  17237. function ht(t2, e) {
  17238. return e === je ? Te(Ft(t2)) : Q(e) ? Xt(e) : Te(Ut(I(t2)));
  17239. }
  17240. function Yt(t2) {
  17241. var e = ce(ge(t2)), n = ["absolute", "fixed"].indexOf(N(t2).position) >= 0, r2 = n && B(t2) ? se(t2) : t2;
  17242. return Q(r2) ? e.filter(function(o) {
  17243. return Q(o) && it(o, r2) && C(o) !== "body";
  17244. }) : [];
  17245. }
  17246. function Gt(t2, e, n) {
  17247. var r2 = e === "clippingParents" ? Yt(t2) : [].concat(e), o = [].concat(r2, [n]), i2 = o[0], a = o.reduce(function(s, f) {
  17248. var c = ht(t2, f);
  17249. return s.top = X(c.top, s.top), s.right = ve(c.right, s.right), s.bottom = ve(c.bottom, s.bottom), s.left = X(c.left, s.left), s;
  17250. }, ht(t2, i2));
  17251. return a.width = a.right - a.left, a.height = a.bottom - a.top, a.x = a.left, a.y = a.top, a;
  17252. }
  17253. function mt(t2) {
  17254. var e = t2.reference, n = t2.element, r2 = t2.placement, o = r2 ? q(r2) : null, i2 = r2 ? te(r2) : null, a = e.x + e.width / 2 - n.width / 2, s = e.y + e.height / 2 - n.height / 2, f;
  17255. switch (o) {
  17256. case E:
  17257. f = { x: a, y: e.y - n.height };
  17258. break;
  17259. case R:
  17260. f = { x: a, y: e.y + e.height };
  17261. break;
  17262. case W:
  17263. f = { x: e.x + e.width, y: s };
  17264. break;
  17265. case P:
  17266. f = { x: e.x - n.width, y: s };
  17267. break;
  17268. default:
  17269. f = { x: e.x, y: e.y };
  17270. }
  17271. var c = o ? Le(o) : null;
  17272. if (c != null) {
  17273. var u = c === "y" ? "height" : "width";
  17274. switch (i2) {
  17275. case U:
  17276. f[c] = f[c] - (e[u] / 2 - n[u] / 2);
  17277. break;
  17278. case J:
  17279. f[c] = f[c] + (e[u] / 2 - n[u] / 2);
  17280. break;
  17281. }
  17282. }
  17283. return f;
  17284. }
  17285. function ne(t2, e) {
  17286. e === void 0 && (e = {});
  17287. var n = e, r2 = n.placement, o = r2 === void 0 ? t2.placement : r2, i2 = n.boundary, a = i2 === void 0 ? Xe : i2, s = n.rootBoundary, f = s === void 0 ? je : s, c = n.elementContext, u = c === void 0 ? K : c, m = n.altBoundary, v = m === void 0 ? false : m, l = n.padding, h2 = l === void 0 ? 0 : l, p = ft(typeof h2 != "number" ? h2 : ct(h2, G)), g = u === K ? Ye : K, x = t2.rects.popper, y = t2.elements[v ? g : u], $2 = Gt(Q(y) ? y : y.contextElement || I(t2.elements.popper), a, f), d2 = ee(t2.elements.reference), b = mt({ reference: d2, element: x, strategy: "absolute", placement: o }), w = Te(Object.assign({}, x, b)), O = u === K ? w : d2, j = { top: $2.top - O.top + p.top, bottom: O.bottom - $2.bottom + p.bottom, left: $2.left - O.left + p.left, right: O.right - $2.right + p.right }, A = t2.modifiersData.offset;
  17288. if (u === K && A) {
  17289. var k = A[o];
  17290. Object.keys(j).forEach(function(D) {
  17291. var S = [W, R].indexOf(D) >= 0 ? 1 : -1, L = [E, R].indexOf(D) >= 0 ? "y" : "x";
  17292. j[D] += k[L] * S;
  17293. });
  17294. }
  17295. return j;
  17296. }
  17297. function Jt(t2, e) {
  17298. e === void 0 && (e = {});
  17299. var n = e, r2 = n.placement, o = n.boundary, i2 = n.rootBoundary, a = n.padding, s = n.flipVariations, f = n.allowedAutoPlacements, c = f === void 0 ? Ee : f, u = te(r2), m = u ? s ? De : De.filter(function(h2) {
  17300. return te(h2) === u;
  17301. }) : G, v = m.filter(function(h2) {
  17302. return c.indexOf(h2) >= 0;
  17303. });
  17304. v.length === 0 && (v = m);
  17305. var l = v.reduce(function(h2, p) {
  17306. return h2[p] = ne(t2, { placement: p, boundary: o, rootBoundary: i2, padding: a })[q(p)], h2;
  17307. }, {});
  17308. return Object.keys(l).sort(function(h2, p) {
  17309. return l[h2] - l[p];
  17310. });
  17311. }
  17312. function Kt(t2) {
  17313. if (q(t2) === me)
  17314. return [];
  17315. var e = be(t2);
  17316. return [lt(t2), e, lt(e)];
  17317. }
  17318. function Qt(t2) {
  17319. var e = t2.state, n = t2.options, r2 = t2.name;
  17320. if (!e.modifiersData[r2]._skip) {
  17321. for (var o = n.mainAxis, i2 = o === void 0 ? true : o, a = n.altAxis, s = a === void 0 ? true : a, f = n.fallbackPlacements, c = n.padding, u = n.boundary, m = n.rootBoundary, v = n.altBoundary, l = n.flipVariations, h2 = l === void 0 ? true : l, p = n.allowedAutoPlacements, g = e.options.placement, x = q(g), y = x === g, $2 = f || (y || !h2 ? [be(g)] : Kt(g)), d2 = [g].concat($2).reduce(function(z, V) {
  17322. return z.concat(q(V) === me ? Jt(e, { placement: V, boundary: u, rootBoundary: m, padding: c, flipVariations: h2, allowedAutoPlacements: p }) : V);
  17323. }, []), b = e.rects.reference, w = e.rects.popper, O = /* @__PURE__ */ new Map(), j = true, A = d2[0], k = 0; k < d2.length; k++) {
  17324. var D = d2[k], S = q(D), L = te(D) === U, re = [E, R].indexOf(S) >= 0, oe = re ? "width" : "height", M = ne(e, { placement: D, boundary: u, rootBoundary: m, altBoundary: v, padding: c }), T = re ? L ? W : P : L ? R : E;
  17325. b[oe] > w[oe] && (T = be(T));
  17326. var pe = be(T), _ = [];
  17327. if (i2 && _.push(M[S] <= 0), s && _.push(M[T] <= 0, M[pe] <= 0), _.every(function(z) {
  17328. return z;
  17329. })) {
  17330. A = D, j = false;
  17331. break;
  17332. }
  17333. O.set(D, _);
  17334. }
  17335. if (j)
  17336. for (var ue = h2 ? 3 : 1, xe = function(z) {
  17337. var V = d2.find(function(de) {
  17338. var ae = O.get(de);
  17339. if (ae)
  17340. return ae.slice(0, z).every(function(Y) {
  17341. return Y;
  17342. });
  17343. });
  17344. if (V)
  17345. return A = V, "break";
  17346. }, ie = ue; ie > 0; ie--) {
  17347. var le = xe(ie);
  17348. if (le === "break")
  17349. break;
  17350. }
  17351. e.placement !== A && (e.modifiersData[r2]._skip = true, e.placement = A, e.reset = true);
  17352. }
  17353. }
  17354. var vt = { name: "flip", enabled: true, phase: "main", fn: Qt, requiresIfExists: ["offset"], data: { _skip: false } };
  17355. function gt(t2, e, n) {
  17356. return n === void 0 && (n = { x: 0, y: 0 }), { top: t2.top - e.height - n.y, right: t2.right - e.width + n.x, bottom: t2.bottom - e.height + n.y, left: t2.left - e.width - n.x };
  17357. }
  17358. function yt(t2) {
  17359. return [E, W, R, P].some(function(e) {
  17360. return t2[e] >= 0;
  17361. });
  17362. }
  17363. function Zt(t2) {
  17364. var e = t2.state, n = t2.name, r2 = e.rects.reference, o = e.rects.popper, i2 = e.modifiersData.preventOverflow, a = ne(e, { elementContext: "reference" }), s = ne(e, { altBoundary: true }), f = gt(a, r2), c = gt(s, o, i2), u = yt(f), m = yt(c);
  17365. e.modifiersData[n] = { referenceClippingOffsets: f, popperEscapeOffsets: c, isReferenceHidden: u, hasPopperEscaped: m }, e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-reference-hidden": u, "data-popper-escaped": m });
  17366. }
  17367. var bt = { name: "hide", enabled: true, phase: "main", requiresIfExists: ["preventOverflow"], fn: Zt };
  17368. function en$1(t2, e, n) {
  17369. var r2 = q(t2), o = [P, E].indexOf(r2) >= 0 ? -1 : 1, i2 = typeof n == "function" ? n(Object.assign({}, e, { placement: t2 })) : n, a = i2[0], s = i2[1];
  17370. return a = a || 0, s = (s || 0) * o, [P, W].indexOf(r2) >= 0 ? { x: s, y: a } : { x: a, y: s };
  17371. }
  17372. function tn(t2) {
  17373. var e = t2.state, n = t2.options, r2 = t2.name, o = n.offset, i2 = o === void 0 ? [0, 0] : o, a = Ee.reduce(function(u, m) {
  17374. return u[m] = en$1(m, e.rects, i2), u;
  17375. }, {}), s = a[e.placement], f = s.x, c = s.y;
  17376. e.modifiersData.popperOffsets != null && (e.modifiersData.popperOffsets.x += f, e.modifiersData.popperOffsets.y += c), e.modifiersData[r2] = a;
  17377. }
  17378. var wt = { name: "offset", enabled: true, phase: "main", requires: ["popperOffsets"], fn: tn };
  17379. function nn(t2) {
  17380. var e = t2.state, n = t2.name;
  17381. e.modifiersData[n] = mt({ reference: e.rects.reference, element: e.rects.popper, strategy: "absolute", placement: e.placement });
  17382. }
  17383. var He = { name: "popperOffsets", enabled: true, phase: "read", fn: nn, data: {} };
  17384. function rn(t2) {
  17385. return t2 === "x" ? "y" : "x";
  17386. }
  17387. function on$2(t2) {
  17388. var e = t2.state, n = t2.options, r2 = t2.name, o = n.mainAxis, i2 = o === void 0 ? true : o, a = n.altAxis, s = a === void 0 ? false : a, f = n.boundary, c = n.rootBoundary, u = n.altBoundary, m = n.padding, v = n.tether, l = v === void 0 ? true : v, h2 = n.tetherOffset, p = h2 === void 0 ? 0 : h2, g = ne(e, { boundary: f, rootBoundary: c, padding: m, altBoundary: u }), x = q(e.placement), y = te(e.placement), $2 = !y, d2 = Le(x), b = rn(d2), w = e.modifiersData.popperOffsets, O = e.rects.reference, j = e.rects.popper, A = typeof p == "function" ? p(Object.assign({}, e.rects, { placement: e.placement })) : p, k = typeof A == "number" ? { mainAxis: A, altAxis: A } : Object.assign({ mainAxis: 0, altAxis: 0 }, A), D = e.modifiersData.offset ? e.modifiersData.offset[e.placement] : null, S = { x: 0, y: 0 };
  17389. if (w) {
  17390. if (i2) {
  17391. var L, re = d2 === "y" ? E : P, oe = d2 === "y" ? R : W, M = d2 === "y" ? "height" : "width", T = w[d2], pe = T + g[re], _ = T - g[oe], ue = l ? -j[M] / 2 : 0, xe = y === U ? O[M] : j[M], ie = y === U ? -j[M] : -O[M], le = e.elements.arrow, z = l && le ? ke(le) : { width: 0, height: 0 }, V = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : st(), de = V[re], ae = V[oe], Y = fe(0, O[M], z[M]), jt = $2 ? O[M] / 2 - ue - Y - de - k.mainAxis : xe - Y - de - k.mainAxis, Dt = $2 ? -O[M] / 2 + ue + Y + ae + k.mainAxis : ie + Y + ae + k.mainAxis, Oe = e.elements.arrow && se(e.elements.arrow), Et = Oe ? d2 === "y" ? Oe.clientTop || 0 : Oe.clientLeft || 0 : 0, Ce = (L = D == null ? void 0 : D[d2]) != null ? L : 0, Pt = T + jt - Ce - Et, At = T + Dt - Ce, qe = fe(l ? ve(pe, Pt) : pe, T, l ? X(_, At) : _);
  17392. w[d2] = qe, S[d2] = qe - T;
  17393. }
  17394. if (s) {
  17395. var Ve, kt = d2 === "x" ? E : P, Lt = d2 === "x" ? R : W, F = w[b], he = b === "y" ? "height" : "width", Ne = F + g[kt], Ie = F - g[Lt], $e = [E, P].indexOf(x) !== -1, _e = (Ve = D == null ? void 0 : D[b]) != null ? Ve : 0, ze = $e ? Ne : F - O[he] - j[he] - _e + k.altAxis, Fe = $e ? F + O[he] + j[he] - _e - k.altAxis : Ie, Ue = l && $e ? St(ze, F, Fe) : fe(l ? ze : Ne, F, l ? Fe : Ie);
  17396. w[b] = Ue, S[b] = Ue - F;
  17397. }
  17398. e.modifiersData[r2] = S;
  17399. }
  17400. }
  17401. var xt = { name: "preventOverflow", enabled: true, phase: "main", fn: on$2, requiresIfExists: ["offset"] };
  17402. function an(t2) {
  17403. return { scrollLeft: t2.scrollLeft, scrollTop: t2.scrollTop };
  17404. }
  17405. function sn(t2) {
  17406. return t2 === H(t2) || !B(t2) ? We(t2) : an(t2);
  17407. }
  17408. function fn(t2) {
  17409. var e = t2.getBoundingClientRect(), n = Z(e.width) / t2.offsetWidth || 1, r2 = Z(e.height) / t2.offsetHeight || 1;
  17410. return n !== 1 || r2 !== 1;
  17411. }
  17412. function cn(t2, e, n) {
  17413. n === void 0 && (n = false);
  17414. var r2 = B(e), o = B(e) && fn(e), i2 = I(e), a = ee(t2, o), s = { scrollLeft: 0, scrollTop: 0 }, f = { x: 0, y: 0 };
  17415. return (r2 || !r2 && !n) && ((C(e) !== "body" || Se(i2)) && (s = sn(e)), B(e) ? (f = ee(e, true), f.x += e.clientLeft, f.y += e.clientTop) : i2 && (f.x = Be(i2))), { x: a.left + s.scrollLeft - f.x, y: a.top + s.scrollTop - f.y, width: a.width, height: a.height };
  17416. }
  17417. function pn(t2) {
  17418. var e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r2 = [];
  17419. t2.forEach(function(i2) {
  17420. e.set(i2.name, i2);
  17421. });
  17422. function o(i2) {
  17423. n.add(i2.name);
  17424. var a = [].concat(i2.requires || [], i2.requiresIfExists || []);
  17425. a.forEach(function(s) {
  17426. if (!n.has(s)) {
  17427. var f = e.get(s);
  17428. f && o(f);
  17429. }
  17430. }), r2.push(i2);
  17431. }
  17432. return t2.forEach(function(i2) {
  17433. n.has(i2.name) || o(i2);
  17434. }), r2;
  17435. }
  17436. function un(t2) {
  17437. var e = pn(t2);
  17438. return ot.reduce(function(n, r2) {
  17439. return n.concat(e.filter(function(o) {
  17440. return o.phase === r2;
  17441. }));
  17442. }, []);
  17443. }
  17444. function ln(t2) {
  17445. var e;
  17446. return function() {
  17447. return e || (e = new Promise(function(n) {
  17448. Promise.resolve().then(function() {
  17449. e = void 0, n(t2());
  17450. });
  17451. })), e;
  17452. };
  17453. }
  17454. function dn(t2) {
  17455. var e = t2.reduce(function(n, r2) {
  17456. var o = n[r2.name];
  17457. return n[r2.name] = o ? Object.assign({}, o, r2, { options: Object.assign({}, o.options, r2.options), data: Object.assign({}, o.data, r2.data) }) : r2, n;
  17458. }, {});
  17459. return Object.keys(e).map(function(n) {
  17460. return e[n];
  17461. });
  17462. }
  17463. var Ot = { placement: "bottom", modifiers: [], strategy: "absolute" };
  17464. function $t() {
  17465. for (var t2 = arguments.length, e = new Array(t2), n = 0; n < t2; n++)
  17466. e[n] = arguments[n];
  17467. return !e.some(function(r2) {
  17468. return !(r2 && typeof r2.getBoundingClientRect == "function");
  17469. });
  17470. }
  17471. function we(t2) {
  17472. t2 === void 0 && (t2 = {});
  17473. var e = t2, n = e.defaultModifiers, r2 = n === void 0 ? [] : n, o = e.defaultOptions, i2 = o === void 0 ? Ot : o;
  17474. return function(a, s, f) {
  17475. f === void 0 && (f = i2);
  17476. var c = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, Ot, i2), modifiersData: {}, elements: { reference: a, popper: s }, attributes: {}, styles: {} }, u = [], m = false, v = { state: c, setOptions: function(p) {
  17477. var g = typeof p == "function" ? p(c.options) : p;
  17478. h2(), c.options = Object.assign({}, i2, c.options, g), c.scrollParents = { reference: Q(a) ? ce(a) : a.contextElement ? ce(a.contextElement) : [], popper: ce(s) };
  17479. var x = un(dn([].concat(r2, c.options.modifiers)));
  17480. return c.orderedModifiers = x.filter(function(y) {
  17481. return y.enabled;
  17482. }), l(), v.update();
  17483. }, forceUpdate: function() {
  17484. if (!m) {
  17485. var p = c.elements, g = p.reference, x = p.popper;
  17486. if ($t(g, x)) {
  17487. c.rects = { reference: cn(g, se(x), c.options.strategy === "fixed"), popper: ke(x) }, c.reset = false, c.placement = c.options.placement, c.orderedModifiers.forEach(function(j) {
  17488. return c.modifiersData[j.name] = Object.assign({}, j.data);
  17489. });
  17490. for (var y = 0; y < c.orderedModifiers.length; y++) {
  17491. if (c.reset === true) {
  17492. c.reset = false, y = -1;
  17493. continue;
  17494. }
  17495. var $2 = c.orderedModifiers[y], d2 = $2.fn, b = $2.options, w = b === void 0 ? {} : b, O = $2.name;
  17496. typeof d2 == "function" && (c = d2({ state: c, options: w, name: O, instance: v }) || c);
  17497. }
  17498. }
  17499. }
  17500. }, update: ln(function() {
  17501. return new Promise(function(p) {
  17502. v.forceUpdate(), p(c);
  17503. });
  17504. }), destroy: function() {
  17505. h2(), m = true;
  17506. } };
  17507. if (!$t(a, s))
  17508. return v;
  17509. v.setOptions(f).then(function(p) {
  17510. !m && f.onFirstUpdate && f.onFirstUpdate(p);
  17511. });
  17512. function l() {
  17513. c.orderedModifiers.forEach(function(p) {
  17514. var g = p.name, x = p.options, y = x === void 0 ? {} : x, $2 = p.effect;
  17515. if (typeof $2 == "function") {
  17516. var d2 = $2({ state: c, name: g, instance: v, options: y }), b = function() {
  17517. };
  17518. u.push(d2 || b);
  17519. }
  17520. });
  17521. }
  17522. function h2() {
  17523. u.forEach(function(p) {
  17524. return p();
  17525. }), u = [];
  17526. }
  17527. return v;
  17528. };
  17529. }
  17530. we();
  17531. var mn = [Re, He, Me, Ae];
  17532. we({ defaultModifiers: mn });
  17533. var gn = [Re, He, Me, Ae, wt, vt, xt, pt, bt], yn = we({ defaultModifiers: gn });
  17534. const usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
  17535. const stateUpdater = {
  17536. name: "updateState",
  17537. enabled: true,
  17538. phase: "write",
  17539. fn: ({ state }) => {
  17540. const derivedState = deriveState(state);
  17541. Object.assign(states.value, derivedState);
  17542. },
  17543. requires: ["computeStyles"]
  17544. };
  17545. const options2 = computed$1(() => {
  17546. const { onFirstUpdate, placement, strategy, modifiers } = unref(opts);
  17547. return {
  17548. onFirstUpdate,
  17549. placement: placement || "bottom",
  17550. strategy: strategy || "absolute",
  17551. modifiers: [
  17552. ...modifiers || [],
  17553. stateUpdater,
  17554. { name: "applyStyles", enabled: false }
  17555. ]
  17556. };
  17557. });
  17558. const instanceRef = shallowRef();
  17559. const states = ref({
  17560. styles: {
  17561. popper: {
  17562. position: unref(options2).strategy,
  17563. left: "0",
  17564. top: "0"
  17565. },
  17566. arrow: {
  17567. position: "absolute"
  17568. }
  17569. },
  17570. attributes: {}
  17571. });
  17572. const destroy = () => {
  17573. if (!instanceRef.value)
  17574. return;
  17575. instanceRef.value.destroy();
  17576. instanceRef.value = void 0;
  17577. };
  17578. watch(options2, (newOptions) => {
  17579. const instance = unref(instanceRef);
  17580. if (instance) {
  17581. instance.setOptions(newOptions);
  17582. }
  17583. }, {
  17584. deep: true
  17585. });
  17586. watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
  17587. destroy();
  17588. if (!referenceElement || !popperElement)
  17589. return;
  17590. instanceRef.value = yn(referenceElement, popperElement, unref(options2));
  17591. });
  17592. onBeforeUnmount(() => {
  17593. destroy();
  17594. });
  17595. return {
  17596. state: computed$1(() => {
  17597. var _a2;
  17598. return { ...((_a2 = unref(instanceRef)) == null ? void 0 : _a2.state) || {} };
  17599. }),
  17600. styles: computed$1(() => unref(states).styles),
  17601. attributes: computed$1(() => unref(states).attributes),
  17602. update: () => {
  17603. var _a2;
  17604. return (_a2 = unref(instanceRef)) == null ? void 0 : _a2.update();
  17605. },
  17606. forceUpdate: () => {
  17607. var _a2;
  17608. return (_a2 = unref(instanceRef)) == null ? void 0 : _a2.forceUpdate();
  17609. },
  17610. instanceRef: computed$1(() => unref(instanceRef))
  17611. };
  17612. };
  17613. function deriveState(state) {
  17614. const elements = Object.keys(state.elements);
  17615. const styles = fromPairs(elements.map((element) => [element, state.styles[element] || {}]));
  17616. const attributes = fromPairs(elements.map((element) => [element, state.attributes[element]]));
  17617. return {
  17618. styles,
  17619. attributes
  17620. };
  17621. }
  17622. const useSameTarget = (handleClick) => {
  17623. if (!handleClick) {
  17624. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  17625. }
  17626. let mousedownTarget = false;
  17627. let mouseupTarget = false;
  17628. const onClick = (e) => {
  17629. if (mousedownTarget && mouseupTarget) {
  17630. handleClick(e);
  17631. }
  17632. mousedownTarget = mouseupTarget = false;
  17633. };
  17634. const onMousedown = (e) => {
  17635. mousedownTarget = e.target === e.currentTarget;
  17636. };
  17637. const onMouseup = (e) => {
  17638. mouseupTarget = e.target === e.currentTarget;
  17639. };
  17640. return { onClick, onMousedown, onMouseup };
  17641. };
  17642. function useTimeout() {
  17643. let timeoutHandle;
  17644. const registerTimeout = (fn2, delay) => {
  17645. cancelTimeout();
  17646. timeoutHandle = window.setTimeout(fn2, delay);
  17647. };
  17648. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  17649. tryOnScopeDispose(() => cancelTimeout());
  17650. return {
  17651. registerTimeout,
  17652. cancelTimeout
  17653. };
  17654. }
  17655. const defaultIdInjection = {
  17656. prefix: Math.floor(Math.random() * 1e4),
  17657. current: 0
  17658. };
  17659. const ID_INJECTION_KEY = Symbol("elIdInjection");
  17660. const useIdInjection = () => {
  17661. return getCurrentInstance() ? inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
  17662. };
  17663. const useId = (deterministicId) => {
  17664. const idInjection = useIdInjection();
  17665. const namespace = useGetDerivedNamespace();
  17666. const idRef = computed$1(() => unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
  17667. return idRef;
  17668. };
  17669. let registeredEscapeHandlers = [];
  17670. const cachedHandler = (e) => {
  17671. const event2 = e;
  17672. if (event2.key === EVENT_CODE.esc) {
  17673. registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event2));
  17674. }
  17675. };
  17676. const useEscapeKeydown = (handler) => {
  17677. onMounted(() => {
  17678. if (registeredEscapeHandlers.length === 0) {
  17679. document.addEventListener("keydown", cachedHandler);
  17680. }
  17681. if (isClient)
  17682. registeredEscapeHandlers.push(handler);
  17683. });
  17684. onBeforeUnmount(() => {
  17685. registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
  17686. if (registeredEscapeHandlers.length === 0) {
  17687. if (isClient)
  17688. document.removeEventListener("keydown", cachedHandler);
  17689. }
  17690. });
  17691. };
  17692. let cachedContainer;
  17693. const usePopperContainerId = () => {
  17694. const namespace = useGetDerivedNamespace();
  17695. const idInjection = useIdInjection();
  17696. const id = computed$1(() => {
  17697. return `${namespace.value}-popper-container-${idInjection.prefix}`;
  17698. });
  17699. const selector = computed$1(() => `#${id.value}`);
  17700. return {
  17701. id,
  17702. selector
  17703. };
  17704. };
  17705. const createContainer = (id) => {
  17706. const container = document.createElement("div");
  17707. container.id = id;
  17708. document.body.appendChild(container);
  17709. return container;
  17710. };
  17711. const usePopperContainer = () => {
  17712. const { id, selector } = usePopperContainerId();
  17713. onBeforeMount(() => {
  17714. if (!isClient)
  17715. return;
  17716. if (!cachedContainer && !document.body.querySelector(selector.value)) {
  17717. cachedContainer = createContainer(id.value);
  17718. }
  17719. });
  17720. return {
  17721. id,
  17722. selector
  17723. };
  17724. };
  17725. const useDelayedToggleProps = buildProps({
  17726. showAfter: {
  17727. type: Number,
  17728. default: 0
  17729. },
  17730. hideAfter: {
  17731. type: Number,
  17732. default: 200
  17733. },
  17734. autoClose: {
  17735. type: Number,
  17736. default: 0
  17737. }
  17738. });
  17739. const useDelayedToggle = ({
  17740. showAfter,
  17741. hideAfter,
  17742. autoClose,
  17743. open,
  17744. close
  17745. }) => {
  17746. const { registerTimeout } = useTimeout();
  17747. const {
  17748. registerTimeout: registerTimeoutForAutoClose,
  17749. cancelTimeout: cancelTimeoutForAutoClose
  17750. } = useTimeout();
  17751. const onOpen = (event2) => {
  17752. registerTimeout(() => {
  17753. open(event2);
  17754. const _autoClose = unref(autoClose);
  17755. if (isNumber(_autoClose) && _autoClose > 0) {
  17756. registerTimeoutForAutoClose(() => {
  17757. close(event2);
  17758. }, _autoClose);
  17759. }
  17760. }, unref(showAfter));
  17761. };
  17762. const onClose = (event2) => {
  17763. cancelTimeoutForAutoClose();
  17764. registerTimeout(() => {
  17765. close(event2);
  17766. }, unref(hideAfter));
  17767. };
  17768. return {
  17769. onOpen,
  17770. onClose
  17771. };
  17772. };
  17773. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  17774. const useForwardRef = (forwardRef) => {
  17775. const setForwardRef = (el) => {
  17776. forwardRef.value = el;
  17777. };
  17778. provide(FORWARD_REF_INJECTION_KEY, {
  17779. setForwardRef
  17780. });
  17781. };
  17782. const useForwardRefDirective = (setForwardRef) => {
  17783. return {
  17784. mounted(el) {
  17785. setForwardRef(el);
  17786. },
  17787. updated(el) {
  17788. setForwardRef(el);
  17789. },
  17790. unmounted() {
  17791. setForwardRef(null);
  17792. }
  17793. };
  17794. };
  17795. const zIndex = ref(0);
  17796. const defaultInitialZIndex = 2e3;
  17797. const zIndexContextKey = Symbol("zIndexContextKey");
  17798. const useZIndex = (zIndexOverrides) => {
  17799. const zIndexInjection = zIndexOverrides || inject(zIndexContextKey, void 0);
  17800. const initialZIndex = computed$1(() => {
  17801. const zIndexFromInjection = unref(zIndexInjection);
  17802. return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
  17803. });
  17804. const currentZIndex = computed$1(() => initialZIndex.value + zIndex.value);
  17805. const nextZIndex = () => {
  17806. zIndex.value++;
  17807. return currentZIndex.value;
  17808. };
  17809. return {
  17810. initialZIndex,
  17811. currentZIndex,
  17812. nextZIndex
  17813. };
  17814. };
  17815. function useCursor(input) {
  17816. const selectionRef = ref();
  17817. function recordCursor() {
  17818. if (input.value == void 0)
  17819. return;
  17820. const { selectionStart, selectionEnd, value } = input.value;
  17821. if (selectionStart == null || selectionEnd == null)
  17822. return;
  17823. const beforeTxt = value.slice(0, Math.max(0, selectionStart));
  17824. const afterTxt = value.slice(Math.max(0, selectionEnd));
  17825. selectionRef.value = {
  17826. selectionStart,
  17827. selectionEnd,
  17828. value,
  17829. beforeTxt,
  17830. afterTxt
  17831. };
  17832. }
  17833. function setCursor() {
  17834. if (input.value == void 0 || selectionRef.value == void 0)
  17835. return;
  17836. const { value } = input.value;
  17837. const { beforeTxt, afterTxt, selectionStart } = selectionRef.value;
  17838. if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
  17839. return;
  17840. let startPos = value.length;
  17841. if (value.endsWith(afterTxt)) {
  17842. startPos = value.length - afterTxt.length;
  17843. } else if (value.startsWith(beforeTxt)) {
  17844. startPos = beforeTxt.length;
  17845. } else {
  17846. const beforeLastChar = beforeTxt[selectionStart - 1];
  17847. const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
  17848. if (newIndex !== -1) {
  17849. startPos = newIndex + 1;
  17850. }
  17851. }
  17852. input.value.setSelectionRange(startPos, startPos);
  17853. }
  17854. return [recordCursor, setCursor];
  17855. }
  17856. const useSizeProp = buildProp({
  17857. type: String,
  17858. values: componentSizes,
  17859. required: false
  17860. });
  17861. const SIZE_INJECTION_KEY = Symbol("size");
  17862. const useGlobalSize = () => {
  17863. const injectedSize = inject(SIZE_INJECTION_KEY, {});
  17864. return computed$1(() => {
  17865. return unref(injectedSize.size) || "";
  17866. });
  17867. };
  17868. const configProviderContextKey = Symbol();
  17869. const globalConfig = ref();
  17870. function useGlobalConfig(key, defaultValue2 = void 0) {
  17871. const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
  17872. if (key) {
  17873. return computed$1(() => {
  17874. var _a2, _b;
  17875. return (_b = (_a2 = config.value) == null ? void 0 : _a2[key]) != null ? _b : defaultValue2;
  17876. });
  17877. } else {
  17878. return config;
  17879. }
  17880. }
  17881. const provideGlobalConfig = (config, app, global2 = false) => {
  17882. var _a2;
  17883. const inSetup = !!getCurrentInstance();
  17884. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  17885. const provideFn = (_a2 = app == null ? void 0 : app.provide) != null ? _a2 : inSetup ? provide : void 0;
  17886. if (!provideFn) {
  17887. return;
  17888. }
  17889. const context = computed$1(() => {
  17890. const cfg = unref(config);
  17891. if (!(oldConfig == null ? void 0 : oldConfig.value))
  17892. return cfg;
  17893. return mergeConfig(oldConfig.value, cfg);
  17894. });
  17895. provideFn(configProviderContextKey, context);
  17896. provideFn(localeContextKey, computed$1(() => context.value.locale));
  17897. provideFn(namespaceContextKey, computed$1(() => context.value.namespace));
  17898. provideFn(zIndexContextKey, computed$1(() => context.value.zIndex));
  17899. provideFn(SIZE_INJECTION_KEY, {
  17900. size: computed$1(() => context.value.size || "")
  17901. });
  17902. if (global2 || !globalConfig.value) {
  17903. globalConfig.value = context.value;
  17904. }
  17905. return context;
  17906. };
  17907. const mergeConfig = (a, b) => {
  17908. var _a2;
  17909. const keys3 = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
  17910. const obj = {};
  17911. for (const key of keys3) {
  17912. obj[key] = (_a2 = b[key]) != null ? _a2 : a[key];
  17913. }
  17914. return obj;
  17915. };
  17916. const configProviderProps = buildProps({
  17917. a11y: {
  17918. type: Boolean,
  17919. default: true
  17920. },
  17921. locale: {
  17922. type: definePropType(Object)
  17923. },
  17924. size: useSizeProp,
  17925. button: {
  17926. type: definePropType(Object)
  17927. },
  17928. experimentalFeatures: {
  17929. type: definePropType(Object)
  17930. },
  17931. keyboardNavigation: {
  17932. type: Boolean,
  17933. default: true
  17934. },
  17935. message: {
  17936. type: definePropType(Object)
  17937. },
  17938. zIndex: Number,
  17939. namespace: {
  17940. type: String,
  17941. default: "el"
  17942. }
  17943. });
  17944. const messageConfig = {};
  17945. const ConfigProvider = defineComponent({
  17946. name: "ElConfigProvider",
  17947. props: configProviderProps,
  17948. setup(props, { slots }) {
  17949. watch(() => props.message, (val) => {
  17950. Object.assign(messageConfig, val != null ? val : {});
  17951. }, { immediate: true, deep: true });
  17952. const config = provideGlobalConfig(props);
  17953. return () => renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  17954. }
  17955. });
  17956. const ElConfigProvider = withInstall(ConfigProvider);
  17957. var _export_sfc$1 = (sfc, props) => {
  17958. const target = sfc.__vccOpts || sfc;
  17959. for (const [key, val] of props) {
  17960. target[key] = val;
  17961. }
  17962. return target;
  17963. };
  17964. const iconProps = buildProps({
  17965. size: {
  17966. type: definePropType([Number, String])
  17967. },
  17968. color: {
  17969. type: String
  17970. }
  17971. });
  17972. const __default__$o = defineComponent({
  17973. name: "ElIcon",
  17974. inheritAttrs: false
  17975. });
  17976. const _sfc_main$B = /* @__PURE__ */ defineComponent({
  17977. ...__default__$o,
  17978. props: iconProps,
  17979. setup(__props) {
  17980. const props = __props;
  17981. const ns = useNamespace("icon");
  17982. const style = computed$1(() => {
  17983. const { size, color: color2 } = props;
  17984. if (!size && !color2)
  17985. return {};
  17986. return {
  17987. fontSize: isUndefined(size) ? void 0 : addUnit(size),
  17988. "--color": color2
  17989. };
  17990. });
  17991. return (_ctx, _cache) => {
  17992. return openBlock(), createElementBlock("i", mergeProps({
  17993. class: unref(ns).b(),
  17994. style: unref(style)
  17995. }, _ctx.$attrs), [
  17996. renderSlot(_ctx.$slots, "default")
  17997. ], 16);
  17998. };
  17999. }
  18000. });
  18001. var Icon = /* @__PURE__ */ _export_sfc$1(_sfc_main$B, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);
  18002. const ElIcon = withInstall(Icon);
  18003. const formContextKey = Symbol("formContextKey");
  18004. const formItemContextKey = Symbol("formItemContextKey");
  18005. const useFormSize = (fallback, ignore = {}) => {
  18006. const emptyRef = ref(void 0);
  18007. const size = ignore.prop ? emptyRef : useProp("size");
  18008. const globalConfig2 = ignore.global ? emptyRef : useGlobalSize();
  18009. const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
  18010. const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
  18011. return computed$1(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig2.value || "");
  18012. };
  18013. const useFormDisabled = (fallback) => {
  18014. const disabled = useProp("disabled");
  18015. const form = inject(formContextKey, void 0);
  18016. return computed$1(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  18017. };
  18018. const useFormItem = () => {
  18019. const form = inject(formContextKey, void 0);
  18020. const formItem = inject(formItemContextKey, void 0);
  18021. return {
  18022. form,
  18023. formItem
  18024. };
  18025. };
  18026. const useFormItemInputId = (props, {
  18027. formItemContext,
  18028. disableIdGeneration,
  18029. disableIdManagement
  18030. }) => {
  18031. if (!disableIdGeneration) {
  18032. disableIdGeneration = ref(false);
  18033. }
  18034. if (!disableIdManagement) {
  18035. disableIdManagement = ref(false);
  18036. }
  18037. const inputId = ref();
  18038. let idUnwatch = void 0;
  18039. const isLabeledByFormItem = computed$1(() => {
  18040. var _a2;
  18041. return !!(!props.label && formItemContext && formItemContext.inputIds && ((_a2 = formItemContext.inputIds) == null ? void 0 : _a2.length) <= 1);
  18042. });
  18043. onMounted(() => {
  18044. idUnwatch = watch([toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
  18045. const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
  18046. if (newId !== inputId.value) {
  18047. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  18048. inputId.value && formItemContext.removeInputId(inputId.value);
  18049. if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
  18050. formItemContext.addInputId(newId);
  18051. }
  18052. }
  18053. inputId.value = newId;
  18054. }
  18055. }, { immediate: true });
  18056. });
  18057. onUnmounted(() => {
  18058. idUnwatch && idUnwatch();
  18059. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  18060. inputId.value && formItemContext.removeInputId(inputId.value);
  18061. }
  18062. });
  18063. return {
  18064. isLabeledByFormItem,
  18065. inputId
  18066. };
  18067. };
  18068. let hiddenTextarea = void 0;
  18069. const HIDDEN_STYLE = `
  18070. height:0 !important;
  18071. visibility:hidden !important;
  18072. ${isFirefox() ? "" : "overflow:hidden !important;"}
  18073. position:absolute !important;
  18074. z-index:-1000 !important;
  18075. top:0 !important;
  18076. right:0 !important;
  18077. `;
  18078. const CONTEXT_STYLE = [
  18079. "letter-spacing",
  18080. "line-height",
  18081. "padding-top",
  18082. "padding-bottom",
  18083. "font-family",
  18084. "font-weight",
  18085. "font-size",
  18086. "text-rendering",
  18087. "text-transform",
  18088. "width",
  18089. "text-indent",
  18090. "padding-left",
  18091. "padding-right",
  18092. "border-width",
  18093. "box-sizing"
  18094. ];
  18095. function calculateNodeStyling(targetElement) {
  18096. const style = window.getComputedStyle(targetElement);
  18097. const boxSizing = style.getPropertyValue("box-sizing");
  18098. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  18099. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  18100. const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
  18101. return { contextStyle, paddingSize, borderSize, boxSizing };
  18102. }
  18103. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  18104. var _a2;
  18105. if (!hiddenTextarea) {
  18106. hiddenTextarea = document.createElement("textarea");
  18107. document.body.appendChild(hiddenTextarea);
  18108. }
  18109. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  18110. hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`);
  18111. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  18112. let height2 = hiddenTextarea.scrollHeight;
  18113. const result = {};
  18114. if (boxSizing === "border-box") {
  18115. height2 = height2 + borderSize;
  18116. } else if (boxSizing === "content-box") {
  18117. height2 = height2 - paddingSize;
  18118. }
  18119. hiddenTextarea.value = "";
  18120. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  18121. if (isNumber(minRows)) {
  18122. let minHeight = singleRowHeight * minRows;
  18123. if (boxSizing === "border-box") {
  18124. minHeight = minHeight + paddingSize + borderSize;
  18125. }
  18126. height2 = Math.max(minHeight, height2);
  18127. result.minHeight = `${minHeight}px`;
  18128. }
  18129. if (isNumber(maxRows)) {
  18130. let maxHeight = singleRowHeight * maxRows;
  18131. if (boxSizing === "border-box") {
  18132. maxHeight = maxHeight + paddingSize + borderSize;
  18133. }
  18134. height2 = Math.min(maxHeight, height2);
  18135. }
  18136. result.height = `${height2}px`;
  18137. (_a2 = hiddenTextarea.parentNode) == null ? void 0 : _a2.removeChild(hiddenTextarea);
  18138. hiddenTextarea = void 0;
  18139. return result;
  18140. }
  18141. const inputProps = buildProps({
  18142. id: {
  18143. type: String,
  18144. default: void 0
  18145. },
  18146. size: useSizeProp,
  18147. disabled: Boolean,
  18148. modelValue: {
  18149. type: definePropType([
  18150. String,
  18151. Number,
  18152. Object
  18153. ]),
  18154. default: ""
  18155. },
  18156. type: {
  18157. type: String,
  18158. default: "text"
  18159. },
  18160. resize: {
  18161. type: String,
  18162. values: ["none", "both", "horizontal", "vertical"]
  18163. },
  18164. autosize: {
  18165. type: definePropType([Boolean, Object]),
  18166. default: false
  18167. },
  18168. autocomplete: {
  18169. type: String,
  18170. default: "off"
  18171. },
  18172. formatter: {
  18173. type: Function
  18174. },
  18175. parser: {
  18176. type: Function
  18177. },
  18178. placeholder: {
  18179. type: String
  18180. },
  18181. form: {
  18182. type: String
  18183. },
  18184. readonly: {
  18185. type: Boolean,
  18186. default: false
  18187. },
  18188. clearable: {
  18189. type: Boolean,
  18190. default: false
  18191. },
  18192. showPassword: {
  18193. type: Boolean,
  18194. default: false
  18195. },
  18196. showWordLimit: {
  18197. type: Boolean,
  18198. default: false
  18199. },
  18200. suffixIcon: {
  18201. type: iconPropType
  18202. },
  18203. prefixIcon: {
  18204. type: iconPropType
  18205. },
  18206. containerRole: {
  18207. type: String,
  18208. default: void 0
  18209. },
  18210. label: {
  18211. type: String,
  18212. default: void 0
  18213. },
  18214. tabindex: {
  18215. type: [String, Number],
  18216. default: 0
  18217. },
  18218. validateEvent: {
  18219. type: Boolean,
  18220. default: true
  18221. },
  18222. inputStyle: {
  18223. type: definePropType([Object, Array, String]),
  18224. default: () => mutable({})
  18225. }
  18226. });
  18227. const inputEmits = {
  18228. [UPDATE_MODEL_EVENT]: (value) => isString(value),
  18229. input: (value) => isString(value),
  18230. change: (value) => isString(value),
  18231. focus: (evt) => evt instanceof FocusEvent,
  18232. blur: (evt) => evt instanceof FocusEvent,
  18233. clear: () => true,
  18234. mouseleave: (evt) => evt instanceof MouseEvent,
  18235. mouseenter: (evt) => evt instanceof MouseEvent,
  18236. keydown: (evt) => evt instanceof Event,
  18237. compositionstart: (evt) => evt instanceof CompositionEvent,
  18238. compositionupdate: (evt) => evt instanceof CompositionEvent,
  18239. compositionend: (evt) => evt instanceof CompositionEvent
  18240. };
  18241. const _hoisted_1$g = ["role"];
  18242. const _hoisted_2$a = ["id", "type", "disabled", "formatter", "parser", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form"];
  18243. const _hoisted_3$6 = ["id", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form"];
  18244. const __default__$n = defineComponent({
  18245. name: "ElInput",
  18246. inheritAttrs: false
  18247. });
  18248. const _sfc_main$A = /* @__PURE__ */ defineComponent({
  18249. ...__default__$n,
  18250. props: inputProps,
  18251. emits: inputEmits,
  18252. setup(__props, { expose, emit }) {
  18253. const props = __props;
  18254. const rawAttrs = useAttrs$1();
  18255. const slots = useSlots();
  18256. const containerAttrs = computed$1(() => {
  18257. const comboBoxAttrs = {};
  18258. if (props.containerRole === "combobox") {
  18259. comboBoxAttrs["aria-haspopup"] = rawAttrs["aria-haspopup"];
  18260. comboBoxAttrs["aria-owns"] = rawAttrs["aria-owns"];
  18261. comboBoxAttrs["aria-expanded"] = rawAttrs["aria-expanded"];
  18262. }
  18263. return comboBoxAttrs;
  18264. });
  18265. const containerKls = computed$1(() => [
  18266. props.type === "textarea" ? nsTextarea.b() : nsInput.b(),
  18267. nsInput.m(inputSize.value),
  18268. nsInput.is("disabled", inputDisabled.value),
  18269. nsInput.is("exceed", inputExceed.value),
  18270. {
  18271. [nsInput.b("group")]: slots.prepend || slots.append,
  18272. [nsInput.bm("group", "append")]: slots.append,
  18273. [nsInput.bm("group", "prepend")]: slots.prepend,
  18274. [nsInput.m("prefix")]: slots.prefix || props.prefixIcon,
  18275. [nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword,
  18276. [nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value
  18277. },
  18278. rawAttrs.class
  18279. ]);
  18280. const wrapperKls = computed$1(() => [
  18281. nsInput.e("wrapper"),
  18282. nsInput.is("focus", focused.value)
  18283. ]);
  18284. const attrs = useAttrs({
  18285. excludeKeys: computed$1(() => {
  18286. return Object.keys(containerAttrs.value);
  18287. })
  18288. });
  18289. const { form, formItem } = useFormItem();
  18290. const { inputId } = useFormItemInputId(props, {
  18291. formItemContext: formItem
  18292. });
  18293. const inputSize = useFormSize();
  18294. const inputDisabled = useFormDisabled();
  18295. const nsInput = useNamespace("input");
  18296. const nsTextarea = useNamespace("textarea");
  18297. const input = shallowRef();
  18298. const textarea = shallowRef();
  18299. const focused = ref(false);
  18300. const hovering = ref(false);
  18301. const isComposing = ref(false);
  18302. const passwordVisible = ref(false);
  18303. const countStyle = ref();
  18304. const textareaCalcStyle = shallowRef(props.inputStyle);
  18305. const _ref = computed$1(() => input.value || textarea.value);
  18306. const needStatusIcon = computed$1(() => {
  18307. var _a2;
  18308. return (_a2 = form == null ? void 0 : form.statusIcon) != null ? _a2 : false;
  18309. });
  18310. const validateState = computed$1(() => (formItem == null ? void 0 : formItem.validateState) || "");
  18311. const validateIcon = computed$1(() => validateState.value && ValidateComponentsMap[validateState.value]);
  18312. const passwordIcon = computed$1(() => passwordVisible.value ? view_default : hide_default);
  18313. const containerStyle = computed$1(() => [
  18314. rawAttrs.style,
  18315. props.inputStyle
  18316. ]);
  18317. const textareaStyle = computed$1(() => [
  18318. props.inputStyle,
  18319. textareaCalcStyle.value,
  18320. { resize: props.resize }
  18321. ]);
  18322. const nativeInputValue = computed$1(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  18323. const showClear = computed$1(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (focused.value || hovering.value));
  18324. const showPwdVisible = computed$1(() => props.showPassword && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (!!nativeInputValue.value || focused.value));
  18325. const isWordLimitVisible = computed$1(() => props.showWordLimit && !!attrs.value.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  18326. const textLength = computed$1(() => nativeInputValue.value.length);
  18327. const inputExceed = computed$1(() => !!isWordLimitVisible.value && textLength.value > Number(attrs.value.maxlength));
  18328. const suffixVisible = computed$1(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  18329. const [recordCursor, setCursor] = useCursor(input);
  18330. useResizeObserver(textarea, (entries) => {
  18331. onceInitSizeTextarea();
  18332. if (!isWordLimitVisible.value || props.resize !== "both")
  18333. return;
  18334. const entry = entries[0];
  18335. const { width: width2 } = entry.contentRect;
  18336. countStyle.value = {
  18337. right: `calc(100% - ${width2 + 15 + 6}px)`
  18338. };
  18339. });
  18340. const resizeTextarea = () => {
  18341. const { type: type2, autosize } = props;
  18342. if (!isClient || type2 !== "textarea" || !textarea.value)
  18343. return;
  18344. if (autosize) {
  18345. const minRows = isObject$5(autosize) ? autosize.minRows : void 0;
  18346. const maxRows = isObject$5(autosize) ? autosize.maxRows : void 0;
  18347. const textareaStyle2 = calcTextareaHeight(textarea.value, minRows, maxRows);
  18348. textareaCalcStyle.value = {
  18349. overflowY: "hidden",
  18350. ...textareaStyle2
  18351. };
  18352. nextTick(() => {
  18353. textarea.value.offsetHeight;
  18354. textareaCalcStyle.value = textareaStyle2;
  18355. });
  18356. } else {
  18357. textareaCalcStyle.value = {
  18358. minHeight: calcTextareaHeight(textarea.value).minHeight
  18359. };
  18360. }
  18361. };
  18362. const createOnceInitResize = (resizeTextarea2) => {
  18363. let isInit = false;
  18364. return () => {
  18365. var _a2;
  18366. if (isInit || !props.autosize)
  18367. return;
  18368. const isElHidden = ((_a2 = textarea.value) == null ? void 0 : _a2.offsetParent) === null;
  18369. if (!isElHidden) {
  18370. resizeTextarea2();
  18371. isInit = true;
  18372. }
  18373. };
  18374. };
  18375. const onceInitSizeTextarea = createOnceInitResize(resizeTextarea);
  18376. const setNativeInputValue = () => {
  18377. const input2 = _ref.value;
  18378. if (!input2 || input2.value === nativeInputValue.value)
  18379. return;
  18380. input2.value = nativeInputValue.value;
  18381. };
  18382. const handleInput = async (event2) => {
  18383. recordCursor();
  18384. let { value } = event2.target;
  18385. if (props.formatter) {
  18386. value = props.parser ? props.parser(value) : value;
  18387. value = props.formatter(value);
  18388. }
  18389. if (isComposing.value)
  18390. return;
  18391. if (value === nativeInputValue.value) {
  18392. setNativeInputValue();
  18393. return;
  18394. }
  18395. emit(UPDATE_MODEL_EVENT, value);
  18396. emit("input", value);
  18397. await nextTick();
  18398. setNativeInputValue();
  18399. setCursor();
  18400. };
  18401. const handleChange = (event2) => {
  18402. emit("change", event2.target.value);
  18403. };
  18404. const handleCompositionStart = (event2) => {
  18405. emit("compositionstart", event2);
  18406. isComposing.value = true;
  18407. };
  18408. const handleCompositionUpdate = (event2) => {
  18409. var _a2;
  18410. emit("compositionupdate", event2);
  18411. const text = (_a2 = event2.target) == null ? void 0 : _a2.value;
  18412. const lastCharacter = text[text.length - 1] || "";
  18413. isComposing.value = !isKorean(lastCharacter);
  18414. };
  18415. const handleCompositionEnd = (event2) => {
  18416. emit("compositionend", event2);
  18417. if (isComposing.value) {
  18418. isComposing.value = false;
  18419. handleInput(event2);
  18420. }
  18421. };
  18422. const handlePasswordVisible = () => {
  18423. passwordVisible.value = !passwordVisible.value;
  18424. focus();
  18425. };
  18426. const focus = async () => {
  18427. var _a2;
  18428. await nextTick();
  18429. (_a2 = _ref.value) == null ? void 0 : _a2.focus();
  18430. };
  18431. const blur = () => {
  18432. var _a2;
  18433. return (_a2 = _ref.value) == null ? void 0 : _a2.blur();
  18434. };
  18435. const handleFocus = (event2) => {
  18436. focused.value = true;
  18437. emit("focus", event2);
  18438. };
  18439. const handleBlur = (event2) => {
  18440. var _a2;
  18441. focused.value = false;
  18442. emit("blur", event2);
  18443. if (props.validateEvent) {
  18444. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
  18445. }
  18446. };
  18447. const handleMouseLeave = (evt) => {
  18448. hovering.value = false;
  18449. emit("mouseleave", evt);
  18450. };
  18451. const handleMouseEnter = (evt) => {
  18452. hovering.value = true;
  18453. emit("mouseenter", evt);
  18454. };
  18455. const handleKeydown = (evt) => {
  18456. emit("keydown", evt);
  18457. };
  18458. const select = () => {
  18459. var _a2;
  18460. (_a2 = _ref.value) == null ? void 0 : _a2.select();
  18461. };
  18462. const clear = () => {
  18463. emit(UPDATE_MODEL_EVENT, "");
  18464. emit("change", "");
  18465. emit("clear");
  18466. emit("input", "");
  18467. };
  18468. watch(() => props.modelValue, () => {
  18469. var _a2;
  18470. nextTick(() => resizeTextarea());
  18471. if (props.validateEvent) {
  18472. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  18473. }
  18474. });
  18475. watch(nativeInputValue, () => setNativeInputValue());
  18476. watch(() => props.type, async () => {
  18477. await nextTick();
  18478. setNativeInputValue();
  18479. resizeTextarea();
  18480. });
  18481. onMounted(() => {
  18482. if (!props.formatter && props.parser)
  18483. ;
  18484. setNativeInputValue();
  18485. nextTick(resizeTextarea);
  18486. });
  18487. expose({
  18488. input,
  18489. textarea,
  18490. ref: _ref,
  18491. textareaStyle,
  18492. autosize: toRef(props, "autosize"),
  18493. focus,
  18494. blur,
  18495. select,
  18496. clear,
  18497. resizeTextarea
  18498. });
  18499. return (_ctx, _cache) => {
  18500. return withDirectives((openBlock(), createElementBlock("div", mergeProps(unref(containerAttrs), {
  18501. class: unref(containerKls),
  18502. style: unref(containerStyle),
  18503. role: _ctx.containerRole,
  18504. onMouseenter: handleMouseEnter,
  18505. onMouseleave: handleMouseLeave
  18506. }), [
  18507. createCommentVNode(" input "),
  18508. _ctx.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  18509. createCommentVNode(" prepend slot "),
  18510. _ctx.$slots.prepend ? (openBlock(), createElementBlock("div", {
  18511. key: 0,
  18512. class: normalizeClass(unref(nsInput).be("group", "prepend"))
  18513. }, [
  18514. renderSlot(_ctx.$slots, "prepend")
  18515. ], 2)) : createCommentVNode("v-if", true),
  18516. createElementVNode("div", {
  18517. class: normalizeClass(unref(wrapperKls))
  18518. }, [
  18519. createCommentVNode(" prefix slot "),
  18520. _ctx.$slots.prefix || _ctx.prefixIcon ? (openBlock(), createElementBlock("span", {
  18521. key: 0,
  18522. class: normalizeClass(unref(nsInput).e("prefix"))
  18523. }, [
  18524. createElementVNode("span", {
  18525. class: normalizeClass(unref(nsInput).e("prefix-inner")),
  18526. onClick: focus
  18527. }, [
  18528. renderSlot(_ctx.$slots, "prefix"),
  18529. _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  18530. key: 0,
  18531. class: normalizeClass(unref(nsInput).e("icon"))
  18532. }, {
  18533. default: withCtx(() => [
  18534. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
  18535. ]),
  18536. _: 1
  18537. }, 8, ["class"])) : createCommentVNode("v-if", true)
  18538. ], 2)
  18539. ], 2)) : createCommentVNode("v-if", true),
  18540. createElementVNode("input", mergeProps({
  18541. id: unref(inputId),
  18542. ref_key: "input",
  18543. ref: input,
  18544. class: unref(nsInput).e("inner")
  18545. }, unref(attrs), {
  18546. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  18547. disabled: unref(inputDisabled),
  18548. formatter: _ctx.formatter,
  18549. parser: _ctx.parser,
  18550. readonly: _ctx.readonly,
  18551. autocomplete: _ctx.autocomplete,
  18552. tabindex: _ctx.tabindex,
  18553. "aria-label": _ctx.label,
  18554. placeholder: _ctx.placeholder,
  18555. style: _ctx.inputStyle,
  18556. form: props.form,
  18557. onCompositionstart: handleCompositionStart,
  18558. onCompositionupdate: handleCompositionUpdate,
  18559. onCompositionend: handleCompositionEnd,
  18560. onInput: handleInput,
  18561. onFocus: handleFocus,
  18562. onBlur: handleBlur,
  18563. onChange: handleChange,
  18564. onKeydown: handleKeydown
  18565. }), null, 16, _hoisted_2$a),
  18566. createCommentVNode(" suffix slot "),
  18567. unref(suffixVisible) ? (openBlock(), createElementBlock("span", {
  18568. key: 1,
  18569. class: normalizeClass(unref(nsInput).e("suffix"))
  18570. }, [
  18571. createElementVNode("span", {
  18572. class: normalizeClass(unref(nsInput).e("suffix-inner")),
  18573. onClick: focus
  18574. }, [
  18575. !unref(showClear) || !unref(showPwdVisible) || !unref(isWordLimitVisible) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  18576. renderSlot(_ctx.$slots, "suffix"),
  18577. _ctx.suffixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  18578. key: 0,
  18579. class: normalizeClass(unref(nsInput).e("icon"))
  18580. }, {
  18581. default: withCtx(() => [
  18582. (openBlock(), createBlock(resolveDynamicComponent(_ctx.suffixIcon)))
  18583. ]),
  18584. _: 1
  18585. }, 8, ["class"])) : createCommentVNode("v-if", true)
  18586. ], 64)) : createCommentVNode("v-if", true),
  18587. unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
  18588. key: 1,
  18589. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("clear")]),
  18590. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  18591. onClick: clear
  18592. }, {
  18593. default: withCtx(() => [
  18594. createVNode(unref(circle_close_default))
  18595. ]),
  18596. _: 1
  18597. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true),
  18598. unref(showPwdVisible) ? (openBlock(), createBlock(unref(ElIcon), {
  18599. key: 2,
  18600. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("password")]),
  18601. onClick: handlePasswordVisible
  18602. }, {
  18603. default: withCtx(() => [
  18604. (openBlock(), createBlock(resolveDynamicComponent(unref(passwordIcon))))
  18605. ]),
  18606. _: 1
  18607. }, 8, ["class"])) : createCommentVNode("v-if", true),
  18608. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  18609. key: 3,
  18610. class: normalizeClass(unref(nsInput).e("count"))
  18611. }, [
  18612. createElementVNode("span", {
  18613. class: normalizeClass(unref(nsInput).e("count-inner"))
  18614. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 3)
  18615. ], 2)) : createCommentVNode("v-if", true),
  18616. unref(validateState) && unref(validateIcon) && unref(needStatusIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  18617. key: 4,
  18618. class: normalizeClass([
  18619. unref(nsInput).e("icon"),
  18620. unref(nsInput).e("validateIcon"),
  18621. unref(nsInput).is("loading", unref(validateState) === "validating")
  18622. ])
  18623. }, {
  18624. default: withCtx(() => [
  18625. (openBlock(), createBlock(resolveDynamicComponent(unref(validateIcon))))
  18626. ]),
  18627. _: 1
  18628. }, 8, ["class"])) : createCommentVNode("v-if", true)
  18629. ], 2)
  18630. ], 2)) : createCommentVNode("v-if", true)
  18631. ], 2),
  18632. createCommentVNode(" append slot "),
  18633. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  18634. key: 1,
  18635. class: normalizeClass(unref(nsInput).be("group", "append"))
  18636. }, [
  18637. renderSlot(_ctx.$slots, "append")
  18638. ], 2)) : createCommentVNode("v-if", true)
  18639. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  18640. createCommentVNode(" textarea "),
  18641. createElementVNode("textarea", mergeProps({
  18642. id: unref(inputId),
  18643. ref_key: "textarea",
  18644. ref: textarea,
  18645. class: unref(nsTextarea).e("inner")
  18646. }, unref(attrs), {
  18647. tabindex: _ctx.tabindex,
  18648. disabled: unref(inputDisabled),
  18649. readonly: _ctx.readonly,
  18650. autocomplete: _ctx.autocomplete,
  18651. style: unref(textareaStyle),
  18652. "aria-label": _ctx.label,
  18653. placeholder: _ctx.placeholder,
  18654. form: props.form,
  18655. onCompositionstart: handleCompositionStart,
  18656. onCompositionupdate: handleCompositionUpdate,
  18657. onCompositionend: handleCompositionEnd,
  18658. onInput: handleInput,
  18659. onFocus: handleFocus,
  18660. onBlur: handleBlur,
  18661. onChange: handleChange,
  18662. onKeydown: handleKeydown
  18663. }), null, 16, _hoisted_3$6),
  18664. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  18665. key: 0,
  18666. style: normalizeStyle(countStyle.value),
  18667. class: normalizeClass(unref(nsInput).e("count"))
  18668. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 7)) : createCommentVNode("v-if", true)
  18669. ], 64))
  18670. ], 16, _hoisted_1$g)), [
  18671. [vShow, _ctx.type !== "hidden"]
  18672. ]);
  18673. };
  18674. }
  18675. });
  18676. var Input = /* @__PURE__ */ _export_sfc$1(_sfc_main$A, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/input/src/input.vue"]]);
  18677. const ElInput = withInstall(Input);
  18678. const GAP = 4;
  18679. const BAR_MAP = {
  18680. vertical: {
  18681. offset: "offsetHeight",
  18682. scroll: "scrollTop",
  18683. scrollSize: "scrollHeight",
  18684. size: "height",
  18685. key: "vertical",
  18686. axis: "Y",
  18687. client: "clientY",
  18688. direction: "top"
  18689. },
  18690. horizontal: {
  18691. offset: "offsetWidth",
  18692. scroll: "scrollLeft",
  18693. scrollSize: "scrollWidth",
  18694. size: "width",
  18695. key: "horizontal",
  18696. axis: "X",
  18697. client: "clientX",
  18698. direction: "left"
  18699. }
  18700. };
  18701. const renderThumbStyle = ({
  18702. move,
  18703. size,
  18704. bar
  18705. }) => ({
  18706. [bar.size]: size,
  18707. transform: `translate${bar.axis}(${move}%)`
  18708. });
  18709. const scrollbarContextKey = Symbol("scrollbarContextKey");
  18710. const thumbProps = buildProps({
  18711. vertical: Boolean,
  18712. size: String,
  18713. move: Number,
  18714. ratio: {
  18715. type: Number,
  18716. required: true
  18717. },
  18718. always: Boolean
  18719. });
  18720. const COMPONENT_NAME$4 = "Thumb";
  18721. const _sfc_main$z = /* @__PURE__ */ defineComponent({
  18722. __name: "thumb",
  18723. props: thumbProps,
  18724. setup(__props) {
  18725. const props = __props;
  18726. const scrollbar = inject(scrollbarContextKey);
  18727. const ns = useNamespace("scrollbar");
  18728. if (!scrollbar)
  18729. throwError(COMPONENT_NAME$4, "can not inject scrollbar context");
  18730. const instance = ref();
  18731. const thumb = ref();
  18732. const thumbState = ref({});
  18733. const visible = ref(false);
  18734. let cursorDown = false;
  18735. let cursorLeave = false;
  18736. let originalOnSelectStart = isClient ? document.onselectstart : null;
  18737. const bar = computed$1(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  18738. const thumbStyle = computed$1(() => renderThumbStyle({
  18739. size: props.size,
  18740. move: props.move,
  18741. bar: bar.value
  18742. }));
  18743. const offsetRatio = computed$1(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  18744. const clickThumbHandler = (e) => {
  18745. var _a2;
  18746. e.stopPropagation();
  18747. if (e.ctrlKey || [1, 2].includes(e.button))
  18748. return;
  18749. (_a2 = window.getSelection()) == null ? void 0 : _a2.removeAllRanges();
  18750. startDrag(e);
  18751. const el = e.currentTarget;
  18752. if (!el)
  18753. return;
  18754. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  18755. };
  18756. const clickTrackHandler = (e) => {
  18757. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  18758. return;
  18759. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  18760. const thumbHalf = thumb.value[bar.value.offset] / 2;
  18761. const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  18762. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  18763. };
  18764. const startDrag = (e) => {
  18765. e.stopImmediatePropagation();
  18766. cursorDown = true;
  18767. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  18768. document.addEventListener("mouseup", mouseUpDocumentHandler);
  18769. originalOnSelectStart = document.onselectstart;
  18770. document.onselectstart = () => false;
  18771. };
  18772. const mouseMoveDocumentHandler = (e) => {
  18773. if (!instance.value || !thumb.value)
  18774. return;
  18775. if (cursorDown === false)
  18776. return;
  18777. const prevPage = thumbState.value[bar.value.axis];
  18778. if (!prevPage)
  18779. return;
  18780. const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  18781. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  18782. const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  18783. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  18784. };
  18785. const mouseUpDocumentHandler = () => {
  18786. cursorDown = false;
  18787. thumbState.value[bar.value.axis] = 0;
  18788. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  18789. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  18790. restoreOnselectstart();
  18791. if (cursorLeave)
  18792. visible.value = false;
  18793. };
  18794. const mouseMoveScrollbarHandler = () => {
  18795. cursorLeave = false;
  18796. visible.value = !!props.size;
  18797. };
  18798. const mouseLeaveScrollbarHandler = () => {
  18799. cursorLeave = true;
  18800. visible.value = cursorDown;
  18801. };
  18802. onBeforeUnmount(() => {
  18803. restoreOnselectstart();
  18804. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  18805. });
  18806. const restoreOnselectstart = () => {
  18807. if (document.onselectstart !== originalOnSelectStart)
  18808. document.onselectstart = originalOnSelectStart;
  18809. };
  18810. useEventListener(toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  18811. useEventListener(toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  18812. return (_ctx, _cache) => {
  18813. return openBlock(), createBlock(Transition, {
  18814. name: unref(ns).b("fade"),
  18815. persisted: ""
  18816. }, {
  18817. default: withCtx(() => [
  18818. withDirectives(createElementVNode("div", {
  18819. ref_key: "instance",
  18820. ref: instance,
  18821. class: normalizeClass([unref(ns).e("bar"), unref(ns).is(unref(bar).key)]),
  18822. onMousedown: clickTrackHandler
  18823. }, [
  18824. createElementVNode("div", {
  18825. ref_key: "thumb",
  18826. ref: thumb,
  18827. class: normalizeClass(unref(ns).e("thumb")),
  18828. style: normalizeStyle(unref(thumbStyle)),
  18829. onMousedown: clickThumbHandler
  18830. }, null, 38)
  18831. ], 34), [
  18832. [vShow, _ctx.always || visible.value]
  18833. ])
  18834. ]),
  18835. _: 1
  18836. }, 8, ["name"]);
  18837. };
  18838. }
  18839. });
  18840. var Thumb = /* @__PURE__ */ _export_sfc$1(_sfc_main$z, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/thumb.vue"]]);
  18841. const barProps = buildProps({
  18842. always: {
  18843. type: Boolean,
  18844. default: true
  18845. },
  18846. width: String,
  18847. height: String,
  18848. ratioX: {
  18849. type: Number,
  18850. default: 1
  18851. },
  18852. ratioY: {
  18853. type: Number,
  18854. default: 1
  18855. }
  18856. });
  18857. const _sfc_main$y = /* @__PURE__ */ defineComponent({
  18858. __name: "bar",
  18859. props: barProps,
  18860. setup(__props, { expose }) {
  18861. const props = __props;
  18862. const moveX = ref(0);
  18863. const moveY = ref(0);
  18864. const handleScroll = (wrap) => {
  18865. if (wrap) {
  18866. const offsetHeight = wrap.offsetHeight - GAP;
  18867. const offsetWidth = wrap.offsetWidth - GAP;
  18868. moveY.value = wrap.scrollTop * 100 / offsetHeight * props.ratioY;
  18869. moveX.value = wrap.scrollLeft * 100 / offsetWidth * props.ratioX;
  18870. }
  18871. };
  18872. expose({
  18873. handleScroll
  18874. });
  18875. return (_ctx, _cache) => {
  18876. return openBlock(), createElementBlock(Fragment, null, [
  18877. createVNode(Thumb, {
  18878. move: moveX.value,
  18879. ratio: _ctx.ratioX,
  18880. size: _ctx.width,
  18881. always: _ctx.always
  18882. }, null, 8, ["move", "ratio", "size", "always"]),
  18883. createVNode(Thumb, {
  18884. move: moveY.value,
  18885. ratio: _ctx.ratioY,
  18886. size: _ctx.height,
  18887. vertical: "",
  18888. always: _ctx.always
  18889. }, null, 8, ["move", "ratio", "size", "always"])
  18890. ], 64);
  18891. };
  18892. }
  18893. });
  18894. var Bar = /* @__PURE__ */ _export_sfc$1(_sfc_main$y, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/bar.vue"]]);
  18895. const scrollbarProps = buildProps({
  18896. height: {
  18897. type: [String, Number],
  18898. default: ""
  18899. },
  18900. maxHeight: {
  18901. type: [String, Number],
  18902. default: ""
  18903. },
  18904. native: {
  18905. type: Boolean,
  18906. default: false
  18907. },
  18908. wrapStyle: {
  18909. type: definePropType([String, Object, Array]),
  18910. default: ""
  18911. },
  18912. wrapClass: {
  18913. type: [String, Array],
  18914. default: ""
  18915. },
  18916. viewClass: {
  18917. type: [String, Array],
  18918. default: ""
  18919. },
  18920. viewStyle: {
  18921. type: [String, Array, Object],
  18922. default: ""
  18923. },
  18924. noresize: Boolean,
  18925. tag: {
  18926. type: String,
  18927. default: "div"
  18928. },
  18929. always: Boolean,
  18930. minSize: {
  18931. type: Number,
  18932. default: 20
  18933. }
  18934. });
  18935. const scrollbarEmits = {
  18936. scroll: ({
  18937. scrollTop,
  18938. scrollLeft
  18939. }) => [scrollTop, scrollLeft].every(isNumber)
  18940. };
  18941. const COMPONENT_NAME$3 = "ElScrollbar";
  18942. const __default__$m = defineComponent({
  18943. name: COMPONENT_NAME$3
  18944. });
  18945. const _sfc_main$x = /* @__PURE__ */ defineComponent({
  18946. ...__default__$m,
  18947. props: scrollbarProps,
  18948. emits: scrollbarEmits,
  18949. setup(__props, { expose, emit }) {
  18950. const props = __props;
  18951. const ns = useNamespace("scrollbar");
  18952. let stopResizeObserver = void 0;
  18953. let stopResizeListener = void 0;
  18954. const scrollbarRef = ref();
  18955. const wrapRef = ref();
  18956. const resizeRef = ref();
  18957. const sizeWidth = ref("0");
  18958. const sizeHeight = ref("0");
  18959. const barRef = ref();
  18960. const ratioY = ref(1);
  18961. const ratioX = ref(1);
  18962. const style = computed$1(() => {
  18963. const style2 = {};
  18964. if (props.height)
  18965. style2.height = addUnit(props.height);
  18966. if (props.maxHeight)
  18967. style2.maxHeight = addUnit(props.maxHeight);
  18968. return [props.wrapStyle, style2];
  18969. });
  18970. const wrapKls = computed$1(() => {
  18971. return [
  18972. props.wrapClass,
  18973. ns.e("wrap"),
  18974. { [ns.em("wrap", "hidden-default")]: !props.native }
  18975. ];
  18976. });
  18977. const resizeKls = computed$1(() => {
  18978. return [ns.e("view"), props.viewClass];
  18979. });
  18980. const handleScroll = () => {
  18981. var _a2;
  18982. if (wrapRef.value) {
  18983. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrapRef.value);
  18984. emit("scroll", {
  18985. scrollTop: wrapRef.value.scrollTop,
  18986. scrollLeft: wrapRef.value.scrollLeft
  18987. });
  18988. }
  18989. };
  18990. function scrollTo(arg1, arg2) {
  18991. if (isObject$5(arg1)) {
  18992. wrapRef.value.scrollTo(arg1);
  18993. } else if (isNumber(arg1) && isNumber(arg2)) {
  18994. wrapRef.value.scrollTo(arg1, arg2);
  18995. }
  18996. }
  18997. const setScrollTop = (value) => {
  18998. if (!isNumber(value)) {
  18999. return;
  19000. }
  19001. wrapRef.value.scrollTop = value;
  19002. };
  19003. const setScrollLeft = (value) => {
  19004. if (!isNumber(value)) {
  19005. return;
  19006. }
  19007. wrapRef.value.scrollLeft = value;
  19008. };
  19009. const update = () => {
  19010. if (!wrapRef.value)
  19011. return;
  19012. const offsetHeight = wrapRef.value.offsetHeight - GAP;
  19013. const offsetWidth = wrapRef.value.offsetWidth - GAP;
  19014. const originalHeight = offsetHeight ** 2 / wrapRef.value.scrollHeight;
  19015. const originalWidth = offsetWidth ** 2 / wrapRef.value.scrollWidth;
  19016. const height2 = Math.max(originalHeight, props.minSize);
  19017. const width2 = Math.max(originalWidth, props.minSize);
  19018. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height2 / (offsetHeight - height2));
  19019. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width2 / (offsetWidth - width2));
  19020. sizeHeight.value = height2 + GAP < offsetHeight ? `${height2}px` : "";
  19021. sizeWidth.value = width2 + GAP < offsetWidth ? `${width2}px` : "";
  19022. };
  19023. watch(() => props.noresize, (noresize) => {
  19024. if (noresize) {
  19025. stopResizeObserver == null ? void 0 : stopResizeObserver();
  19026. stopResizeListener == null ? void 0 : stopResizeListener();
  19027. } else {
  19028. ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
  19029. stopResizeListener = useEventListener("resize", update);
  19030. }
  19031. }, { immediate: true });
  19032. watch(() => [props.maxHeight, props.height], () => {
  19033. if (!props.native)
  19034. nextTick(() => {
  19035. var _a2;
  19036. update();
  19037. if (wrapRef.value) {
  19038. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrapRef.value);
  19039. }
  19040. });
  19041. });
  19042. provide(scrollbarContextKey, reactive({
  19043. scrollbarElement: scrollbarRef,
  19044. wrapElement: wrapRef
  19045. }));
  19046. onMounted(() => {
  19047. if (!props.native)
  19048. nextTick(() => {
  19049. update();
  19050. });
  19051. });
  19052. onUpdated(() => update());
  19053. expose({
  19054. wrapRef,
  19055. update,
  19056. scrollTo,
  19057. setScrollTop,
  19058. setScrollLeft,
  19059. handleScroll
  19060. });
  19061. return (_ctx, _cache) => {
  19062. return openBlock(), createElementBlock("div", {
  19063. ref_key: "scrollbarRef",
  19064. ref: scrollbarRef,
  19065. class: normalizeClass(unref(ns).b())
  19066. }, [
  19067. createElementVNode("div", {
  19068. ref_key: "wrapRef",
  19069. ref: wrapRef,
  19070. class: normalizeClass(unref(wrapKls)),
  19071. style: normalizeStyle(unref(style)),
  19072. onScroll: handleScroll
  19073. }, [
  19074. (openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  19075. ref_key: "resizeRef",
  19076. ref: resizeRef,
  19077. class: normalizeClass(unref(resizeKls)),
  19078. style: normalizeStyle(_ctx.viewStyle)
  19079. }, {
  19080. default: withCtx(() => [
  19081. renderSlot(_ctx.$slots, "default")
  19082. ]),
  19083. _: 3
  19084. }, 8, ["class", "style"]))
  19085. ], 38),
  19086. !_ctx.native ? (openBlock(), createBlock(Bar, {
  19087. key: 0,
  19088. ref_key: "barRef",
  19089. ref: barRef,
  19090. height: sizeHeight.value,
  19091. width: sizeWidth.value,
  19092. always: _ctx.always,
  19093. "ratio-x": ratioX.value,
  19094. "ratio-y": ratioY.value
  19095. }, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : createCommentVNode("v-if", true)
  19096. ], 2);
  19097. };
  19098. }
  19099. });
  19100. var Scrollbar = /* @__PURE__ */ _export_sfc$1(_sfc_main$x, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/scrollbar.vue"]]);
  19101. const ElScrollbar = withInstall(Scrollbar);
  19102. const POPPER_INJECTION_KEY = Symbol("popper");
  19103. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  19104. const roleTypes = [
  19105. "dialog",
  19106. "grid",
  19107. "group",
  19108. "listbox",
  19109. "menu",
  19110. "navigation",
  19111. "tooltip",
  19112. "tree"
  19113. ];
  19114. const popperProps = buildProps({
  19115. role: {
  19116. type: String,
  19117. values: roleTypes,
  19118. default: "tooltip"
  19119. }
  19120. });
  19121. const __default__$l = defineComponent({
  19122. name: "ElPopper",
  19123. inheritAttrs: false
  19124. });
  19125. const _sfc_main$w = /* @__PURE__ */ defineComponent({
  19126. ...__default__$l,
  19127. props: popperProps,
  19128. setup(__props, { expose }) {
  19129. const props = __props;
  19130. const triggerRef2 = ref();
  19131. const popperInstanceRef = ref();
  19132. const contentRef = ref();
  19133. const referenceRef = ref();
  19134. const role = computed$1(() => props.role);
  19135. const popperProvides = {
  19136. triggerRef: triggerRef2,
  19137. popperInstanceRef,
  19138. contentRef,
  19139. referenceRef,
  19140. role
  19141. };
  19142. expose(popperProvides);
  19143. provide(POPPER_INJECTION_KEY, popperProvides);
  19144. return (_ctx, _cache) => {
  19145. return renderSlot(_ctx.$slots, "default");
  19146. };
  19147. }
  19148. });
  19149. var Popper = /* @__PURE__ */ _export_sfc$1(_sfc_main$w, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/popper.vue"]]);
  19150. const popperArrowProps = buildProps({
  19151. arrowOffset: {
  19152. type: Number,
  19153. default: 5
  19154. }
  19155. });
  19156. const __default__$k = defineComponent({
  19157. name: "ElPopperArrow",
  19158. inheritAttrs: false
  19159. });
  19160. const _sfc_main$v = /* @__PURE__ */ defineComponent({
  19161. ...__default__$k,
  19162. props: popperArrowProps,
  19163. setup(__props, { expose }) {
  19164. const props = __props;
  19165. const ns = useNamespace("popper");
  19166. const { arrowOffset, arrowRef, arrowStyle } = inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  19167. watch(() => props.arrowOffset, (val) => {
  19168. arrowOffset.value = val;
  19169. });
  19170. onBeforeUnmount(() => {
  19171. arrowRef.value = void 0;
  19172. });
  19173. expose({
  19174. arrowRef
  19175. });
  19176. return (_ctx, _cache) => {
  19177. return openBlock(), createElementBlock("span", {
  19178. ref_key: "arrowRef",
  19179. ref: arrowRef,
  19180. class: normalizeClass(unref(ns).e("arrow")),
  19181. style: normalizeStyle(unref(arrowStyle)),
  19182. "data-popper-arrow": ""
  19183. }, null, 6);
  19184. };
  19185. }
  19186. });
  19187. var ElPopperArrow = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/arrow.vue"]]);
  19188. const NAME = "ElOnlyChild";
  19189. const OnlyChild = defineComponent({
  19190. name: NAME,
  19191. setup(_, {
  19192. slots,
  19193. attrs
  19194. }) {
  19195. var _a2;
  19196. const forwardRefInjection = inject(FORWARD_REF_INJECTION_KEY);
  19197. const forwardRefDirective = useForwardRefDirective((_a2 = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a2 : NOOP);
  19198. return () => {
  19199. var _a22;
  19200. const defaultSlot = (_a22 = slots.default) == null ? void 0 : _a22.call(slots, attrs);
  19201. if (!defaultSlot)
  19202. return null;
  19203. if (defaultSlot.length > 1) {
  19204. return null;
  19205. }
  19206. const firstLegitNode = findFirstLegitChild(defaultSlot);
  19207. if (!firstLegitNode) {
  19208. return null;
  19209. }
  19210. return withDirectives(cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  19211. };
  19212. }
  19213. });
  19214. function findFirstLegitChild(node) {
  19215. if (!node)
  19216. return null;
  19217. const children = node;
  19218. for (const child of children) {
  19219. if (isObject$5(child)) {
  19220. switch (child.type) {
  19221. case Comment$1:
  19222. continue;
  19223. case Text$1:
  19224. case "svg":
  19225. return wrapTextContent(child);
  19226. case Fragment:
  19227. return findFirstLegitChild(child.children);
  19228. default:
  19229. return child;
  19230. }
  19231. }
  19232. return wrapTextContent(child);
  19233. }
  19234. return null;
  19235. }
  19236. function wrapTextContent(s) {
  19237. const ns = useNamespace("only-child");
  19238. return createVNode("span", {
  19239. "class": ns.e("content")
  19240. }, [s]);
  19241. }
  19242. const popperTriggerProps = buildProps({
  19243. virtualRef: {
  19244. type: definePropType(Object)
  19245. },
  19246. virtualTriggering: Boolean,
  19247. onMouseenter: {
  19248. type: definePropType(Function)
  19249. },
  19250. onMouseleave: {
  19251. type: definePropType(Function)
  19252. },
  19253. onClick: {
  19254. type: definePropType(Function)
  19255. },
  19256. onKeydown: {
  19257. type: definePropType(Function)
  19258. },
  19259. onFocus: {
  19260. type: definePropType(Function)
  19261. },
  19262. onBlur: {
  19263. type: definePropType(Function)
  19264. },
  19265. onContextmenu: {
  19266. type: definePropType(Function)
  19267. },
  19268. id: String,
  19269. open: Boolean
  19270. });
  19271. const __default__$j = defineComponent({
  19272. name: "ElPopperTrigger",
  19273. inheritAttrs: false
  19274. });
  19275. const _sfc_main$u = /* @__PURE__ */ defineComponent({
  19276. ...__default__$j,
  19277. props: popperTriggerProps,
  19278. setup(__props, { expose }) {
  19279. const props = __props;
  19280. const { role, triggerRef: triggerRef2 } = inject(POPPER_INJECTION_KEY, void 0);
  19281. useForwardRef(triggerRef2);
  19282. const ariaControls = computed$1(() => {
  19283. return ariaHaspopup.value ? props.id : void 0;
  19284. });
  19285. const ariaDescribedby = computed$1(() => {
  19286. if (role && role.value === "tooltip") {
  19287. return props.open && props.id ? props.id : void 0;
  19288. }
  19289. return void 0;
  19290. });
  19291. const ariaHaspopup = computed$1(() => {
  19292. if (role && role.value !== "tooltip") {
  19293. return role.value;
  19294. }
  19295. return void 0;
  19296. });
  19297. const ariaExpanded = computed$1(() => {
  19298. return ariaHaspopup.value ? `${props.open}` : void 0;
  19299. });
  19300. let virtualTriggerAriaStopWatch = void 0;
  19301. onMounted(() => {
  19302. watch(() => props.virtualRef, (virtualEl) => {
  19303. if (virtualEl) {
  19304. triggerRef2.value = unrefElement(virtualEl);
  19305. }
  19306. }, {
  19307. immediate: true
  19308. });
  19309. watch(triggerRef2, (el, prevEl) => {
  19310. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  19311. virtualTriggerAriaStopWatch = void 0;
  19312. if (isElement(el)) {
  19313. [
  19314. "onMouseenter",
  19315. "onMouseleave",
  19316. "onClick",
  19317. "onKeydown",
  19318. "onFocus",
  19319. "onBlur",
  19320. "onContextmenu"
  19321. ].forEach((eventName) => {
  19322. var _a2;
  19323. const handler = props[eventName];
  19324. if (handler) {
  19325. el.addEventListener(eventName.slice(2).toLowerCase(), handler);
  19326. (_a2 = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a2.call(prevEl, eventName.slice(2).toLowerCase(), handler);
  19327. }
  19328. });
  19329. virtualTriggerAriaStopWatch = watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
  19330. [
  19331. "aria-controls",
  19332. "aria-describedby",
  19333. "aria-haspopup",
  19334. "aria-expanded"
  19335. ].forEach((key, idx) => {
  19336. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  19337. });
  19338. }, { immediate: true });
  19339. }
  19340. if (isElement(prevEl)) {
  19341. [
  19342. "aria-controls",
  19343. "aria-describedby",
  19344. "aria-haspopup",
  19345. "aria-expanded"
  19346. ].forEach((key) => prevEl.removeAttribute(key));
  19347. }
  19348. }, {
  19349. immediate: true
  19350. });
  19351. });
  19352. onBeforeUnmount(() => {
  19353. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  19354. virtualTriggerAriaStopWatch = void 0;
  19355. });
  19356. expose({
  19357. triggerRef: triggerRef2
  19358. });
  19359. return (_ctx, _cache) => {
  19360. return !_ctx.virtualTriggering ? (openBlock(), createBlock(unref(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
  19361. "aria-controls": unref(ariaControls),
  19362. "aria-describedby": unref(ariaDescribedby),
  19363. "aria-expanded": unref(ariaExpanded),
  19364. "aria-haspopup": unref(ariaHaspopup)
  19365. }), {
  19366. default: withCtx(() => [
  19367. renderSlot(_ctx.$slots, "default")
  19368. ]),
  19369. _: 3
  19370. }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : createCommentVNode("v-if", true);
  19371. };
  19372. }
  19373. });
  19374. var ElPopperTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$u, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/trigger.vue"]]);
  19375. const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
  19376. const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
  19377. const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
  19378. const FOCUS_AFTER_TRAPPED_OPTS = {
  19379. cancelable: true,
  19380. bubbles: false
  19381. };
  19382. const FOCUSOUT_PREVENTED_OPTS = {
  19383. cancelable: true,
  19384. bubbles: false
  19385. };
  19386. const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
  19387. const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
  19388. const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
  19389. const focusReason = ref();
  19390. const lastUserFocusTimestamp = ref(0);
  19391. const lastAutomatedFocusTimestamp = ref(0);
  19392. let focusReasonUserCount = 0;
  19393. const obtainAllFocusableElements = (element) => {
  19394. const nodes = [];
  19395. const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, {
  19396. acceptNode: (node) => {
  19397. const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
  19398. if (node.disabled || node.hidden || isHiddenInput)
  19399. return NodeFilter.FILTER_SKIP;
  19400. return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
  19401. }
  19402. });
  19403. while (walker.nextNode())
  19404. nodes.push(walker.currentNode);
  19405. return nodes;
  19406. };
  19407. const getVisibleElement = (elements, container) => {
  19408. for (const element of elements) {
  19409. if (!isHidden(element, container))
  19410. return element;
  19411. }
  19412. };
  19413. const isHidden = (element, container) => {
  19414. if (getComputedStyle(element).visibility === "hidden")
  19415. return true;
  19416. while (element) {
  19417. if (container && element === container)
  19418. return false;
  19419. if (getComputedStyle(element).display === "none")
  19420. return true;
  19421. element = element.parentElement;
  19422. }
  19423. return false;
  19424. };
  19425. const getEdges = (container) => {
  19426. const focusable = obtainAllFocusableElements(container);
  19427. const first = getVisibleElement(focusable, container);
  19428. const last = getVisibleElement(focusable.reverse(), container);
  19429. return [first, last];
  19430. };
  19431. const isSelectable = (element) => {
  19432. return element instanceof HTMLInputElement && "select" in element;
  19433. };
  19434. const tryFocus = (element, shouldSelect) => {
  19435. if (element && element.focus) {
  19436. const prevFocusedElement = document.activeElement;
  19437. element.focus({ preventScroll: true });
  19438. lastAutomatedFocusTimestamp.value = window.performance.now();
  19439. if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) {
  19440. element.select();
  19441. }
  19442. }
  19443. };
  19444. function removeFromStack(list, item) {
  19445. const copy2 = [...list];
  19446. const idx = list.indexOf(item);
  19447. if (idx !== -1) {
  19448. copy2.splice(idx, 1);
  19449. }
  19450. return copy2;
  19451. }
  19452. const createFocusableStack = () => {
  19453. let stack = [];
  19454. const push = (layer) => {
  19455. const currentLayer = stack[0];
  19456. if (currentLayer && layer !== currentLayer) {
  19457. currentLayer.pause();
  19458. }
  19459. stack = removeFromStack(stack, layer);
  19460. stack.unshift(layer);
  19461. };
  19462. const remove2 = (layer) => {
  19463. var _a2, _b;
  19464. stack = removeFromStack(stack, layer);
  19465. (_b = (_a2 = stack[0]) == null ? void 0 : _a2.resume) == null ? void 0 : _b.call(_a2);
  19466. };
  19467. return {
  19468. push,
  19469. remove: remove2
  19470. };
  19471. };
  19472. const focusFirstDescendant = (elements, shouldSelect = false) => {
  19473. const prevFocusedElement = document.activeElement;
  19474. for (const element of elements) {
  19475. tryFocus(element, shouldSelect);
  19476. if (document.activeElement !== prevFocusedElement)
  19477. return;
  19478. }
  19479. };
  19480. const focusableStack = createFocusableStack();
  19481. const isFocusCausedByUserEvent = () => {
  19482. return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
  19483. };
  19484. const notifyFocusReasonPointer = () => {
  19485. focusReason.value = "pointer";
  19486. lastUserFocusTimestamp.value = window.performance.now();
  19487. };
  19488. const notifyFocusReasonKeydown = () => {
  19489. focusReason.value = "keyboard";
  19490. lastUserFocusTimestamp.value = window.performance.now();
  19491. };
  19492. const useFocusReason = () => {
  19493. onMounted(() => {
  19494. if (focusReasonUserCount === 0) {
  19495. document.addEventListener("mousedown", notifyFocusReasonPointer);
  19496. document.addEventListener("touchstart", notifyFocusReasonPointer);
  19497. document.addEventListener("keydown", notifyFocusReasonKeydown);
  19498. }
  19499. focusReasonUserCount++;
  19500. });
  19501. onBeforeUnmount(() => {
  19502. focusReasonUserCount--;
  19503. if (focusReasonUserCount <= 0) {
  19504. document.removeEventListener("mousedown", notifyFocusReasonPointer);
  19505. document.removeEventListener("touchstart", notifyFocusReasonPointer);
  19506. document.removeEventListener("keydown", notifyFocusReasonKeydown);
  19507. }
  19508. });
  19509. return {
  19510. focusReason,
  19511. lastUserFocusTimestamp,
  19512. lastAutomatedFocusTimestamp
  19513. };
  19514. };
  19515. const createFocusOutPreventedEvent = (detail) => {
  19516. return new CustomEvent(FOCUSOUT_PREVENTED, {
  19517. ...FOCUSOUT_PREVENTED_OPTS,
  19518. detail
  19519. });
  19520. };
  19521. const _sfc_main$t = defineComponent({
  19522. name: "ElFocusTrap",
  19523. inheritAttrs: false,
  19524. props: {
  19525. loop: Boolean,
  19526. trapped: Boolean,
  19527. focusTrapEl: Object,
  19528. focusStartEl: {
  19529. type: [Object, String],
  19530. default: "first"
  19531. }
  19532. },
  19533. emits: [
  19534. ON_TRAP_FOCUS_EVT,
  19535. ON_RELEASE_FOCUS_EVT,
  19536. "focusin",
  19537. "focusout",
  19538. "focusout-prevented",
  19539. "release-requested"
  19540. ],
  19541. setup(props, { emit }) {
  19542. const forwardRef = ref();
  19543. let lastFocusBeforeTrapped;
  19544. let lastFocusAfterTrapped;
  19545. const { focusReason: focusReason2 } = useFocusReason();
  19546. useEscapeKeydown((event2) => {
  19547. if (props.trapped && !focusLayer.paused) {
  19548. emit("release-requested", event2);
  19549. }
  19550. });
  19551. const focusLayer = {
  19552. paused: false,
  19553. pause() {
  19554. this.paused = true;
  19555. },
  19556. resume() {
  19557. this.paused = false;
  19558. }
  19559. };
  19560. const onKeydown = (e) => {
  19561. if (!props.loop && !props.trapped)
  19562. return;
  19563. if (focusLayer.paused)
  19564. return;
  19565. const { key, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
  19566. const { loop } = props;
  19567. const isTabbing = key === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
  19568. const currentFocusingEl = document.activeElement;
  19569. if (isTabbing && currentFocusingEl) {
  19570. const container = currentTarget;
  19571. const [first, last] = getEdges(container);
  19572. const isTabbable = first && last;
  19573. if (!isTabbable) {
  19574. if (currentFocusingEl === container) {
  19575. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  19576. focusReason: focusReason2.value
  19577. });
  19578. emit("focusout-prevented", focusoutPreventedEvent);
  19579. if (!focusoutPreventedEvent.defaultPrevented) {
  19580. e.preventDefault();
  19581. }
  19582. }
  19583. } else {
  19584. if (!shiftKey && currentFocusingEl === last) {
  19585. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  19586. focusReason: focusReason2.value
  19587. });
  19588. emit("focusout-prevented", focusoutPreventedEvent);
  19589. if (!focusoutPreventedEvent.defaultPrevented) {
  19590. e.preventDefault();
  19591. if (loop)
  19592. tryFocus(first, true);
  19593. }
  19594. } else if (shiftKey && [first, container].includes(currentFocusingEl)) {
  19595. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  19596. focusReason: focusReason2.value
  19597. });
  19598. emit("focusout-prevented", focusoutPreventedEvent);
  19599. if (!focusoutPreventedEvent.defaultPrevented) {
  19600. e.preventDefault();
  19601. if (loop)
  19602. tryFocus(last, true);
  19603. }
  19604. }
  19605. }
  19606. }
  19607. };
  19608. provide(FOCUS_TRAP_INJECTION_KEY, {
  19609. focusTrapRef: forwardRef,
  19610. onKeydown
  19611. });
  19612. watch(() => props.focusTrapEl, (focusTrapEl) => {
  19613. if (focusTrapEl) {
  19614. forwardRef.value = focusTrapEl;
  19615. }
  19616. }, { immediate: true });
  19617. watch([forwardRef], ([forwardRef2], [oldForwardRef]) => {
  19618. if (forwardRef2) {
  19619. forwardRef2.addEventListener("keydown", onKeydown);
  19620. forwardRef2.addEventListener("focusin", onFocusIn);
  19621. forwardRef2.addEventListener("focusout", onFocusOut);
  19622. }
  19623. if (oldForwardRef) {
  19624. oldForwardRef.removeEventListener("keydown", onKeydown);
  19625. oldForwardRef.removeEventListener("focusin", onFocusIn);
  19626. oldForwardRef.removeEventListener("focusout", onFocusOut);
  19627. }
  19628. });
  19629. const trapOnFocus = (e) => {
  19630. emit(ON_TRAP_FOCUS_EVT, e);
  19631. };
  19632. const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e);
  19633. const onFocusIn = (e) => {
  19634. const trapContainer = unref(forwardRef);
  19635. if (!trapContainer)
  19636. return;
  19637. const target = e.target;
  19638. const relatedTarget = e.relatedTarget;
  19639. const isFocusedInTrap = target && trapContainer.contains(target);
  19640. if (!props.trapped) {
  19641. const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
  19642. if (!isPrevFocusedInTrap) {
  19643. lastFocusBeforeTrapped = relatedTarget;
  19644. }
  19645. }
  19646. if (isFocusedInTrap)
  19647. emit("focusin", e);
  19648. if (focusLayer.paused)
  19649. return;
  19650. if (props.trapped) {
  19651. if (isFocusedInTrap) {
  19652. lastFocusAfterTrapped = target;
  19653. } else {
  19654. tryFocus(lastFocusAfterTrapped, true);
  19655. }
  19656. }
  19657. };
  19658. const onFocusOut = (e) => {
  19659. const trapContainer = unref(forwardRef);
  19660. if (focusLayer.paused || !trapContainer)
  19661. return;
  19662. if (props.trapped) {
  19663. const relatedTarget = e.relatedTarget;
  19664. if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {
  19665. setTimeout(() => {
  19666. if (!focusLayer.paused && props.trapped) {
  19667. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  19668. focusReason: focusReason2.value
  19669. });
  19670. emit("focusout-prevented", focusoutPreventedEvent);
  19671. if (!focusoutPreventedEvent.defaultPrevented) {
  19672. tryFocus(lastFocusAfterTrapped, true);
  19673. }
  19674. }
  19675. }, 0);
  19676. }
  19677. } else {
  19678. const target = e.target;
  19679. const isFocusedInTrap = target && trapContainer.contains(target);
  19680. if (!isFocusedInTrap)
  19681. emit("focusout", e);
  19682. }
  19683. };
  19684. async function startTrap() {
  19685. await nextTick();
  19686. const trapContainer = unref(forwardRef);
  19687. if (trapContainer) {
  19688. focusableStack.push(focusLayer);
  19689. const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement;
  19690. lastFocusBeforeTrapped = prevFocusedElement;
  19691. const isPrevFocusContained = trapContainer.contains(prevFocusedElement);
  19692. if (!isPrevFocusContained) {
  19693. const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS);
  19694. trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  19695. trapContainer.dispatchEvent(focusEvent);
  19696. if (!focusEvent.defaultPrevented) {
  19697. nextTick(() => {
  19698. let focusStartEl = props.focusStartEl;
  19699. if (!isString(focusStartEl)) {
  19700. tryFocus(focusStartEl);
  19701. if (document.activeElement !== focusStartEl) {
  19702. focusStartEl = "first";
  19703. }
  19704. }
  19705. if (focusStartEl === "first") {
  19706. focusFirstDescendant(obtainAllFocusableElements(trapContainer), true);
  19707. }
  19708. if (document.activeElement === prevFocusedElement || focusStartEl === "container") {
  19709. tryFocus(trapContainer);
  19710. }
  19711. });
  19712. }
  19713. }
  19714. }
  19715. }
  19716. function stopTrap() {
  19717. const trapContainer = unref(forwardRef);
  19718. if (trapContainer) {
  19719. trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  19720. const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
  19721. ...FOCUS_AFTER_TRAPPED_OPTS,
  19722. detail: {
  19723. focusReason: focusReason2.value
  19724. }
  19725. });
  19726. trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  19727. trapContainer.dispatchEvent(releasedEvent);
  19728. if (!releasedEvent.defaultPrevented && (focusReason2.value == "keyboard" || !isFocusCausedByUserEvent() || trapContainer.contains(document.activeElement))) {
  19729. tryFocus(lastFocusBeforeTrapped != null ? lastFocusBeforeTrapped : document.body);
  19730. }
  19731. trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, trapOnFocus);
  19732. focusableStack.remove(focusLayer);
  19733. }
  19734. }
  19735. onMounted(() => {
  19736. if (props.trapped) {
  19737. startTrap();
  19738. }
  19739. watch(() => props.trapped, (trapped) => {
  19740. if (trapped) {
  19741. startTrap();
  19742. } else {
  19743. stopTrap();
  19744. }
  19745. });
  19746. });
  19747. onBeforeUnmount(() => {
  19748. if (props.trapped) {
  19749. stopTrap();
  19750. }
  19751. });
  19752. return {
  19753. onKeydown
  19754. };
  19755. }
  19756. });
  19757. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  19758. return renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
  19759. }
  19760. var ElFocusTrap = /* @__PURE__ */ _export_sfc$1(_sfc_main$t, [["render", _sfc_render$7], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/focus-trap/src/focus-trap.vue"]]);
  19761. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  19762. const popperCoreConfigProps = buildProps({
  19763. boundariesPadding: {
  19764. type: Number,
  19765. default: 0
  19766. },
  19767. fallbackPlacements: {
  19768. type: definePropType(Array),
  19769. default: void 0
  19770. },
  19771. gpuAcceleration: {
  19772. type: Boolean,
  19773. default: true
  19774. },
  19775. offset: {
  19776. type: Number,
  19777. default: 12
  19778. },
  19779. placement: {
  19780. type: String,
  19781. values: Ee,
  19782. default: "bottom"
  19783. },
  19784. popperOptions: {
  19785. type: definePropType(Object),
  19786. default: () => ({})
  19787. },
  19788. strategy: {
  19789. type: String,
  19790. values: POSITIONING_STRATEGIES,
  19791. default: "absolute"
  19792. }
  19793. });
  19794. const popperContentProps = buildProps({
  19795. ...popperCoreConfigProps,
  19796. id: String,
  19797. style: {
  19798. type: definePropType([String, Array, Object])
  19799. },
  19800. className: {
  19801. type: definePropType([String, Array, Object])
  19802. },
  19803. effect: {
  19804. type: String,
  19805. default: "dark"
  19806. },
  19807. visible: Boolean,
  19808. enterable: {
  19809. type: Boolean,
  19810. default: true
  19811. },
  19812. pure: Boolean,
  19813. focusOnShow: {
  19814. type: Boolean,
  19815. default: false
  19816. },
  19817. trapping: {
  19818. type: Boolean,
  19819. default: false
  19820. },
  19821. popperClass: {
  19822. type: definePropType([String, Array, Object])
  19823. },
  19824. popperStyle: {
  19825. type: definePropType([String, Array, Object])
  19826. },
  19827. referenceEl: {
  19828. type: definePropType(Object)
  19829. },
  19830. triggerTargetEl: {
  19831. type: definePropType(Object)
  19832. },
  19833. stopPopperMouseEvent: {
  19834. type: Boolean,
  19835. default: true
  19836. },
  19837. ariaLabel: {
  19838. type: String,
  19839. default: void 0
  19840. },
  19841. virtualTriggering: Boolean,
  19842. zIndex: Number
  19843. });
  19844. const popperContentEmits = {
  19845. mouseenter: (evt) => evt instanceof MouseEvent,
  19846. mouseleave: (evt) => evt instanceof MouseEvent,
  19847. focus: () => true,
  19848. blur: () => true,
  19849. close: () => true
  19850. };
  19851. const buildPopperOptions = (props, modifiers = []) => {
  19852. const { placement, strategy, popperOptions } = props;
  19853. const options2 = {
  19854. placement,
  19855. strategy,
  19856. ...popperOptions,
  19857. modifiers: [...genModifiers(props), ...modifiers]
  19858. };
  19859. deriveExtraModifiers(options2, popperOptions == null ? void 0 : popperOptions.modifiers);
  19860. return options2;
  19861. };
  19862. const unwrapMeasurableEl = ($el) => {
  19863. if (!isClient)
  19864. return;
  19865. return unrefElement($el);
  19866. };
  19867. function genModifiers(options2) {
  19868. const { offset, gpuAcceleration, fallbackPlacements } = options2;
  19869. return [
  19870. {
  19871. name: "offset",
  19872. options: {
  19873. offset: [0, offset != null ? offset : 12]
  19874. }
  19875. },
  19876. {
  19877. name: "preventOverflow",
  19878. options: {
  19879. padding: {
  19880. top: 2,
  19881. bottom: 2,
  19882. left: 5,
  19883. right: 5
  19884. }
  19885. }
  19886. },
  19887. {
  19888. name: "flip",
  19889. options: {
  19890. padding: 5,
  19891. fallbackPlacements
  19892. }
  19893. },
  19894. {
  19895. name: "computeStyles",
  19896. options: {
  19897. gpuAcceleration
  19898. }
  19899. }
  19900. ];
  19901. }
  19902. function deriveExtraModifiers(options2, modifiers) {
  19903. if (modifiers) {
  19904. options2.modifiers = [...options2.modifiers, ...modifiers != null ? modifiers : []];
  19905. }
  19906. }
  19907. const DEFAULT_ARROW_OFFSET = 0;
  19908. const usePopperContent = (props) => {
  19909. const { popperInstanceRef, contentRef, triggerRef: triggerRef2, role } = inject(POPPER_INJECTION_KEY, void 0);
  19910. const arrowRef = ref();
  19911. const arrowOffset = ref();
  19912. const eventListenerModifier = computed$1(() => {
  19913. return {
  19914. name: "eventListeners",
  19915. enabled: !!props.visible
  19916. };
  19917. });
  19918. const arrowModifier = computed$1(() => {
  19919. var _a2;
  19920. const arrowEl = unref(arrowRef);
  19921. const offset = (_a2 = unref(arrowOffset)) != null ? _a2 : DEFAULT_ARROW_OFFSET;
  19922. return {
  19923. name: "arrow",
  19924. enabled: !isUndefined$1(arrowEl),
  19925. options: {
  19926. element: arrowEl,
  19927. padding: offset
  19928. }
  19929. };
  19930. });
  19931. const options2 = computed$1(() => {
  19932. return {
  19933. onFirstUpdate: () => {
  19934. update();
  19935. },
  19936. ...buildPopperOptions(props, [
  19937. unref(arrowModifier),
  19938. unref(eventListenerModifier)
  19939. ])
  19940. };
  19941. });
  19942. const computedReference = computed$1(() => unwrapMeasurableEl(props.referenceEl) || unref(triggerRef2));
  19943. const { attributes, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options2);
  19944. watch(instanceRef, (instance) => popperInstanceRef.value = instance);
  19945. onMounted(() => {
  19946. watch(() => {
  19947. var _a2;
  19948. return (_a2 = unref(computedReference)) == null ? void 0 : _a2.getBoundingClientRect();
  19949. }, () => {
  19950. update();
  19951. });
  19952. });
  19953. return {
  19954. attributes,
  19955. arrowRef,
  19956. contentRef,
  19957. instanceRef,
  19958. state,
  19959. styles,
  19960. role,
  19961. forceUpdate,
  19962. update
  19963. };
  19964. };
  19965. const usePopperContentDOM = (props, {
  19966. attributes,
  19967. styles,
  19968. role
  19969. }) => {
  19970. const { nextZIndex } = useZIndex();
  19971. const ns = useNamespace("popper");
  19972. const contentAttrs = computed$1(() => unref(attributes).popper);
  19973. const contentZIndex = ref(props.zIndex || nextZIndex());
  19974. const contentClass = computed$1(() => [
  19975. ns.b(),
  19976. ns.is("pure", props.pure),
  19977. ns.is(props.effect),
  19978. props.popperClass
  19979. ]);
  19980. const contentStyle = computed$1(() => {
  19981. return [
  19982. { zIndex: unref(contentZIndex) },
  19983. props.popperStyle || {},
  19984. unref(styles).popper
  19985. ];
  19986. });
  19987. const ariaModal = computed$1(() => role.value === "dialog" ? "false" : void 0);
  19988. const arrowStyle = computed$1(() => unref(styles).arrow || {});
  19989. const updateZIndex = () => {
  19990. contentZIndex.value = props.zIndex || nextZIndex();
  19991. };
  19992. return {
  19993. ariaModal,
  19994. arrowStyle,
  19995. contentAttrs,
  19996. contentClass,
  19997. contentStyle,
  19998. contentZIndex,
  19999. updateZIndex
  20000. };
  20001. };
  20002. const usePopperContentFocusTrap = (props, emit) => {
  20003. const trapped = ref(false);
  20004. const focusStartRef = ref();
  20005. const onFocusAfterTrapped = () => {
  20006. emit("focus");
  20007. };
  20008. const onFocusAfterReleased = (event2) => {
  20009. var _a2;
  20010. if (((_a2 = event2.detail) == null ? void 0 : _a2.focusReason) !== "pointer") {
  20011. focusStartRef.value = "first";
  20012. emit("blur");
  20013. }
  20014. };
  20015. const onFocusInTrap = (event2) => {
  20016. if (props.visible && !trapped.value) {
  20017. if (event2.target) {
  20018. focusStartRef.value = event2.target;
  20019. }
  20020. trapped.value = true;
  20021. }
  20022. };
  20023. const onFocusoutPrevented = (event2) => {
  20024. if (!props.trapping) {
  20025. if (event2.detail.focusReason === "pointer") {
  20026. event2.preventDefault();
  20027. }
  20028. trapped.value = false;
  20029. }
  20030. };
  20031. const onReleaseRequested = () => {
  20032. trapped.value = false;
  20033. emit("close");
  20034. };
  20035. return {
  20036. focusStartRef,
  20037. trapped,
  20038. onFocusAfterReleased,
  20039. onFocusAfterTrapped,
  20040. onFocusInTrap,
  20041. onFocusoutPrevented,
  20042. onReleaseRequested
  20043. };
  20044. };
  20045. const __default__$i = defineComponent({
  20046. name: "ElPopperContent"
  20047. });
  20048. const _sfc_main$s = /* @__PURE__ */ defineComponent({
  20049. ...__default__$i,
  20050. props: popperContentProps,
  20051. emits: popperContentEmits,
  20052. setup(__props, { expose, emit }) {
  20053. const props = __props;
  20054. const {
  20055. focusStartRef,
  20056. trapped,
  20057. onFocusAfterReleased,
  20058. onFocusAfterTrapped,
  20059. onFocusInTrap,
  20060. onFocusoutPrevented,
  20061. onReleaseRequested
  20062. } = usePopperContentFocusTrap(props, emit);
  20063. const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
  20064. const {
  20065. ariaModal,
  20066. arrowStyle,
  20067. contentAttrs,
  20068. contentClass,
  20069. contentStyle,
  20070. updateZIndex
  20071. } = usePopperContentDOM(props, {
  20072. styles,
  20073. attributes,
  20074. role
  20075. });
  20076. const formItemContext = inject(formItemContextKey, void 0);
  20077. const arrowOffset = ref();
  20078. provide(POPPER_CONTENT_INJECTION_KEY, {
  20079. arrowStyle,
  20080. arrowRef,
  20081. arrowOffset
  20082. });
  20083. if (formItemContext && (formItemContext.addInputId || formItemContext.removeInputId)) {
  20084. provide(formItemContextKey, {
  20085. ...formItemContext,
  20086. addInputId: NOOP,
  20087. removeInputId: NOOP
  20088. });
  20089. }
  20090. let triggerTargetAriaStopWatch = void 0;
  20091. const updatePopper = (shouldUpdateZIndex = true) => {
  20092. update();
  20093. shouldUpdateZIndex && updateZIndex();
  20094. };
  20095. const togglePopperAlive = () => {
  20096. updatePopper(false);
  20097. if (props.visible && props.focusOnShow) {
  20098. trapped.value = true;
  20099. } else if (props.visible === false) {
  20100. trapped.value = false;
  20101. }
  20102. };
  20103. onMounted(() => {
  20104. watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
  20105. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  20106. triggerTargetAriaStopWatch = void 0;
  20107. const el = unref(triggerTargetEl || contentRef.value);
  20108. const prevEl = unref(prevTriggerTargetEl || contentRef.value);
  20109. if (isElement(el)) {
  20110. triggerTargetAriaStopWatch = watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
  20111. ["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
  20112. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  20113. });
  20114. }, { immediate: true });
  20115. }
  20116. if (prevEl !== el && isElement(prevEl)) {
  20117. ["role", "aria-label", "aria-modal", "id"].forEach((key) => {
  20118. prevEl.removeAttribute(key);
  20119. });
  20120. }
  20121. }, { immediate: true });
  20122. watch(() => props.visible, togglePopperAlive, { immediate: true });
  20123. });
  20124. onBeforeUnmount(() => {
  20125. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  20126. triggerTargetAriaStopWatch = void 0;
  20127. });
  20128. expose({
  20129. popperContentRef: contentRef,
  20130. popperInstanceRef: instanceRef,
  20131. updatePopper,
  20132. contentStyle
  20133. });
  20134. return (_ctx, _cache) => {
  20135. return openBlock(), createElementBlock("div", mergeProps({
  20136. ref_key: "contentRef",
  20137. ref: contentRef
  20138. }, unref(contentAttrs), {
  20139. style: unref(contentStyle),
  20140. class: unref(contentClass),
  20141. tabindex: "-1",
  20142. onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
  20143. onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
  20144. }), [
  20145. createVNode(unref(ElFocusTrap), {
  20146. trapped: unref(trapped),
  20147. "trap-on-focus-in": true,
  20148. "focus-trap-el": unref(contentRef),
  20149. "focus-start-el": unref(focusStartRef),
  20150. onFocusAfterTrapped: unref(onFocusAfterTrapped),
  20151. onFocusAfterReleased: unref(onFocusAfterReleased),
  20152. onFocusin: unref(onFocusInTrap),
  20153. onFocusoutPrevented: unref(onFocusoutPrevented),
  20154. onReleaseRequested: unref(onReleaseRequested)
  20155. }, {
  20156. default: withCtx(() => [
  20157. renderSlot(_ctx.$slots, "default")
  20158. ]),
  20159. _: 3
  20160. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
  20161. ], 16);
  20162. };
  20163. }
  20164. });
  20165. var ElPopperContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$s, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/content.vue"]]);
  20166. const ElPopper = withInstall(Popper);
  20167. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  20168. const useTooltipContentProps = buildProps({
  20169. ...useDelayedToggleProps,
  20170. ...popperContentProps,
  20171. appendTo: {
  20172. type: definePropType([String, Object])
  20173. },
  20174. content: {
  20175. type: String,
  20176. default: ""
  20177. },
  20178. rawContent: {
  20179. type: Boolean,
  20180. default: false
  20181. },
  20182. persistent: Boolean,
  20183. ariaLabel: String,
  20184. visible: {
  20185. type: definePropType(Boolean),
  20186. default: null
  20187. },
  20188. transition: String,
  20189. teleported: {
  20190. type: Boolean,
  20191. default: true
  20192. },
  20193. disabled: Boolean
  20194. });
  20195. const useTooltipTriggerProps = buildProps({
  20196. ...popperTriggerProps,
  20197. disabled: Boolean,
  20198. trigger: {
  20199. type: definePropType([String, Array]),
  20200. default: "hover"
  20201. },
  20202. triggerKeys: {
  20203. type: definePropType(Array),
  20204. default: () => [EVENT_CODE.enter, EVENT_CODE.space]
  20205. }
  20206. });
  20207. const {
  20208. useModelToggleProps: useTooltipModelToggleProps,
  20209. useModelToggleEmits: useTooltipModelToggleEmits,
  20210. useModelToggle: useTooltipModelToggle
  20211. } = createModelToggleComposable("visible");
  20212. const useTooltipProps = buildProps({
  20213. ...popperProps,
  20214. ...useTooltipModelToggleProps,
  20215. ...useTooltipContentProps,
  20216. ...useTooltipTriggerProps,
  20217. ...popperArrowProps,
  20218. showArrow: {
  20219. type: Boolean,
  20220. default: true
  20221. }
  20222. });
  20223. const tooltipEmits = [
  20224. ...useTooltipModelToggleEmits,
  20225. "before-show",
  20226. "before-hide",
  20227. "show",
  20228. "hide",
  20229. "open",
  20230. "close"
  20231. ];
  20232. const isTriggerType = (trigger2, type2) => {
  20233. if (isArray$2(trigger2)) {
  20234. return trigger2.includes(type2);
  20235. }
  20236. return trigger2 === type2;
  20237. };
  20238. const whenTrigger = (trigger2, type2, handler) => {
  20239. return (e) => {
  20240. isTriggerType(unref(trigger2), type2) && handler(e);
  20241. };
  20242. };
  20243. const __default__$h = defineComponent({
  20244. name: "ElTooltipTrigger"
  20245. });
  20246. const _sfc_main$r = /* @__PURE__ */ defineComponent({
  20247. ...__default__$h,
  20248. props: useTooltipTriggerProps,
  20249. setup(__props, { expose }) {
  20250. const props = __props;
  20251. const ns = useNamespace("tooltip");
  20252. const { controlled, id, open, onOpen, onClose, onToggle } = inject(TOOLTIP_INJECTION_KEY, void 0);
  20253. const triggerRef2 = ref(null);
  20254. const stopWhenControlledOrDisabled = () => {
  20255. if (unref(controlled) || props.disabled) {
  20256. return true;
  20257. }
  20258. };
  20259. const trigger2 = toRef(props, "trigger");
  20260. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "hover", onOpen));
  20261. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "hover", onClose));
  20262. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "click", (e) => {
  20263. if (e.button === 0) {
  20264. onToggle(e);
  20265. }
  20266. }));
  20267. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "focus", onOpen));
  20268. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "focus", onClose));
  20269. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "contextmenu", (e) => {
  20270. e.preventDefault();
  20271. onToggle(e);
  20272. }));
  20273. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  20274. const { code } = e;
  20275. if (props.triggerKeys.includes(code)) {
  20276. e.preventDefault();
  20277. onToggle(e);
  20278. }
  20279. });
  20280. expose({
  20281. triggerRef: triggerRef2
  20282. });
  20283. return (_ctx, _cache) => {
  20284. return openBlock(), createBlock(unref(ElPopperTrigger), {
  20285. id: unref(id),
  20286. "virtual-ref": _ctx.virtualRef,
  20287. open: unref(open),
  20288. "virtual-triggering": _ctx.virtualTriggering,
  20289. class: normalizeClass(unref(ns).e("trigger")),
  20290. onBlur: unref(onBlur),
  20291. onClick: unref(onClick),
  20292. onContextmenu: unref(onContextMenu),
  20293. onFocus: unref(onFocus),
  20294. onMouseenter: unref(onMouseenter),
  20295. onMouseleave: unref(onMouseleave),
  20296. onKeydown: unref(onKeydown)
  20297. }, {
  20298. default: withCtx(() => [
  20299. renderSlot(_ctx.$slots, "default")
  20300. ]),
  20301. _: 3
  20302. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  20303. };
  20304. }
  20305. });
  20306. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$r, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/trigger.vue"]]);
  20307. const __default__$g = defineComponent({
  20308. name: "ElTooltipContent",
  20309. inheritAttrs: false
  20310. });
  20311. const _sfc_main$q = /* @__PURE__ */ defineComponent({
  20312. ...__default__$g,
  20313. props: useTooltipContentProps,
  20314. setup(__props, { expose }) {
  20315. const props = __props;
  20316. const { selector } = usePopperContainerId();
  20317. const ns = useNamespace("tooltip");
  20318. const contentRef = ref(null);
  20319. const destroyed = ref(false);
  20320. const {
  20321. controlled,
  20322. id,
  20323. open,
  20324. trigger: trigger2,
  20325. onClose,
  20326. onOpen,
  20327. onShow,
  20328. onHide,
  20329. onBeforeShow,
  20330. onBeforeHide
  20331. } = inject(TOOLTIP_INJECTION_KEY, void 0);
  20332. const transitionClass = computed$1(() => {
  20333. return props.transition || `${ns.namespace.value}-fade-in-linear`;
  20334. });
  20335. const persistentRef = computed$1(() => {
  20336. return props.persistent;
  20337. });
  20338. onBeforeUnmount(() => {
  20339. destroyed.value = true;
  20340. });
  20341. const shouldRender = computed$1(() => {
  20342. return unref(persistentRef) ? true : unref(open);
  20343. });
  20344. const shouldShow = computed$1(() => {
  20345. return props.disabled ? false : unref(open);
  20346. });
  20347. const appendTo = computed$1(() => {
  20348. return props.appendTo || selector.value;
  20349. });
  20350. const contentStyle = computed$1(() => {
  20351. var _a2;
  20352. return (_a2 = props.style) != null ? _a2 : {};
  20353. });
  20354. const ariaHidden = computed$1(() => !unref(open));
  20355. const onTransitionLeave = () => {
  20356. onHide();
  20357. };
  20358. const stopWhenControlled = () => {
  20359. if (unref(controlled))
  20360. return true;
  20361. };
  20362. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  20363. if (props.enterable && unref(trigger2) === "hover") {
  20364. onOpen();
  20365. }
  20366. });
  20367. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  20368. if (unref(trigger2) === "hover") {
  20369. onClose();
  20370. }
  20371. });
  20372. const onBeforeEnter = () => {
  20373. var _a2, _b;
  20374. (_b = (_a2 = contentRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  20375. onBeforeShow == null ? void 0 : onBeforeShow();
  20376. };
  20377. const onBeforeLeave = () => {
  20378. onBeforeHide == null ? void 0 : onBeforeHide();
  20379. };
  20380. const onAfterShow = () => {
  20381. onShow();
  20382. stopHandle = onClickOutside(computed$1(() => {
  20383. var _a2;
  20384. return (_a2 = contentRef.value) == null ? void 0 : _a2.popperContentRef;
  20385. }), () => {
  20386. if (unref(controlled))
  20387. return;
  20388. const $trigger = unref(trigger2);
  20389. if ($trigger !== "hover") {
  20390. onClose();
  20391. }
  20392. });
  20393. };
  20394. const onBlur = () => {
  20395. if (!props.virtualTriggering) {
  20396. onClose();
  20397. }
  20398. };
  20399. let stopHandle;
  20400. watch(() => unref(open), (val) => {
  20401. if (!val) {
  20402. stopHandle == null ? void 0 : stopHandle();
  20403. }
  20404. }, {
  20405. flush: "post"
  20406. });
  20407. watch(() => props.content, () => {
  20408. var _a2, _b;
  20409. (_b = (_a2 = contentRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  20410. });
  20411. expose({
  20412. contentRef
  20413. });
  20414. return (_ctx, _cache) => {
  20415. return openBlock(), createBlock(Teleport, {
  20416. disabled: !_ctx.teleported,
  20417. to: unref(appendTo)
  20418. }, [
  20419. createVNode(Transition, {
  20420. name: unref(transitionClass),
  20421. onAfterLeave: onTransitionLeave,
  20422. onBeforeEnter,
  20423. onAfterEnter: onAfterShow,
  20424. onBeforeLeave
  20425. }, {
  20426. default: withCtx(() => [
  20427. unref(shouldRender) ? withDirectives((openBlock(), createBlock(unref(ElPopperContent), mergeProps({
  20428. key: 0,
  20429. id: unref(id),
  20430. ref_key: "contentRef",
  20431. ref: contentRef
  20432. }, _ctx.$attrs, {
  20433. "aria-label": _ctx.ariaLabel,
  20434. "aria-hidden": unref(ariaHidden),
  20435. "boundaries-padding": _ctx.boundariesPadding,
  20436. "fallback-placements": _ctx.fallbackPlacements,
  20437. "gpu-acceleration": _ctx.gpuAcceleration,
  20438. offset: _ctx.offset,
  20439. placement: _ctx.placement,
  20440. "popper-options": _ctx.popperOptions,
  20441. strategy: _ctx.strategy,
  20442. effect: _ctx.effect,
  20443. enterable: _ctx.enterable,
  20444. pure: _ctx.pure,
  20445. "popper-class": _ctx.popperClass,
  20446. "popper-style": [_ctx.popperStyle, unref(contentStyle)],
  20447. "reference-el": _ctx.referenceEl,
  20448. "trigger-target-el": _ctx.triggerTargetEl,
  20449. visible: unref(shouldShow),
  20450. "z-index": _ctx.zIndex,
  20451. onMouseenter: unref(onContentEnter),
  20452. onMouseleave: unref(onContentLeave),
  20453. onBlur,
  20454. onClose: unref(onClose)
  20455. }), {
  20456. default: withCtx(() => [
  20457. !destroyed.value ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
  20458. ]),
  20459. _: 3
  20460. }, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "onMouseenter", "onMouseleave", "onClose"])), [
  20461. [vShow, unref(shouldShow)]
  20462. ]) : createCommentVNode("v-if", true)
  20463. ]),
  20464. _: 3
  20465. }, 8, ["name"])
  20466. ], 8, ["disabled", "to"]);
  20467. };
  20468. }
  20469. });
  20470. var ElTooltipContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$q, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/content.vue"]]);
  20471. const _hoisted_1$f = ["innerHTML"];
  20472. const _hoisted_2$9 = { key: 1 };
  20473. const __default__$f = defineComponent({
  20474. name: "ElTooltip"
  20475. });
  20476. const _sfc_main$p = /* @__PURE__ */ defineComponent({
  20477. ...__default__$f,
  20478. props: useTooltipProps,
  20479. emits: tooltipEmits,
  20480. setup(__props, { expose, emit }) {
  20481. const props = __props;
  20482. usePopperContainer();
  20483. const id = useId();
  20484. const popperRef = ref();
  20485. const contentRef = ref();
  20486. const updatePopper = () => {
  20487. var _a2;
  20488. const popperComponent = unref(popperRef);
  20489. if (popperComponent) {
  20490. (_a2 = popperComponent.popperInstanceRef) == null ? void 0 : _a2.update();
  20491. }
  20492. };
  20493. const open = ref(false);
  20494. const toggleReason = ref();
  20495. const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
  20496. indicator: open,
  20497. toggleReason
  20498. });
  20499. const { onOpen, onClose } = useDelayedToggle({
  20500. showAfter: toRef(props, "showAfter"),
  20501. hideAfter: toRef(props, "hideAfter"),
  20502. autoClose: toRef(props, "autoClose"),
  20503. open: show,
  20504. close: hide
  20505. });
  20506. const controlled = computed$1(() => isBoolean(props.visible) && !hasUpdateHandler.value);
  20507. provide(TOOLTIP_INJECTION_KEY, {
  20508. controlled,
  20509. id,
  20510. open: readonly(open),
  20511. trigger: toRef(props, "trigger"),
  20512. onOpen: (event2) => {
  20513. onOpen(event2);
  20514. },
  20515. onClose: (event2) => {
  20516. onClose(event2);
  20517. },
  20518. onToggle: (event2) => {
  20519. if (unref(open)) {
  20520. onClose(event2);
  20521. } else {
  20522. onOpen(event2);
  20523. }
  20524. },
  20525. onShow: () => {
  20526. emit("show", toggleReason.value);
  20527. },
  20528. onHide: () => {
  20529. emit("hide", toggleReason.value);
  20530. },
  20531. onBeforeShow: () => {
  20532. emit("before-show", toggleReason.value);
  20533. },
  20534. onBeforeHide: () => {
  20535. emit("before-hide", toggleReason.value);
  20536. },
  20537. updatePopper
  20538. });
  20539. watch(() => props.disabled, (disabled) => {
  20540. if (disabled && open.value) {
  20541. open.value = false;
  20542. }
  20543. });
  20544. const isFocusInsideContent = () => {
  20545. var _a2, _b;
  20546. const popperContent = (_b = (_a2 = contentRef.value) == null ? void 0 : _a2.contentRef) == null ? void 0 : _b.popperContentRef;
  20547. return popperContent && popperContent.contains(document.activeElement);
  20548. };
  20549. onDeactivated(() => open.value && hide());
  20550. expose({
  20551. popperRef,
  20552. contentRef,
  20553. isFocusInsideContent,
  20554. updatePopper,
  20555. onOpen,
  20556. onClose,
  20557. hide
  20558. });
  20559. return (_ctx, _cache) => {
  20560. return openBlock(), createBlock(unref(ElPopper), {
  20561. ref_key: "popperRef",
  20562. ref: popperRef,
  20563. role: _ctx.role
  20564. }, {
  20565. default: withCtx(() => [
  20566. createVNode(ElTooltipTrigger, {
  20567. disabled: _ctx.disabled,
  20568. trigger: _ctx.trigger,
  20569. "trigger-keys": _ctx.triggerKeys,
  20570. "virtual-ref": _ctx.virtualRef,
  20571. "virtual-triggering": _ctx.virtualTriggering
  20572. }, {
  20573. default: withCtx(() => [
  20574. _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
  20575. ]),
  20576. _: 3
  20577. }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
  20578. createVNode(ElTooltipContent, {
  20579. ref_key: "contentRef",
  20580. ref: contentRef,
  20581. "aria-label": _ctx.ariaLabel,
  20582. "boundaries-padding": _ctx.boundariesPadding,
  20583. content: _ctx.content,
  20584. disabled: _ctx.disabled,
  20585. effect: _ctx.effect,
  20586. enterable: _ctx.enterable,
  20587. "fallback-placements": _ctx.fallbackPlacements,
  20588. "hide-after": _ctx.hideAfter,
  20589. "gpu-acceleration": _ctx.gpuAcceleration,
  20590. offset: _ctx.offset,
  20591. persistent: _ctx.persistent,
  20592. "popper-class": _ctx.popperClass,
  20593. "popper-style": _ctx.popperStyle,
  20594. placement: _ctx.placement,
  20595. "popper-options": _ctx.popperOptions,
  20596. pure: _ctx.pure,
  20597. "raw-content": _ctx.rawContent,
  20598. "reference-el": _ctx.referenceEl,
  20599. "trigger-target-el": _ctx.triggerTargetEl,
  20600. "show-after": _ctx.showAfter,
  20601. strategy: _ctx.strategy,
  20602. teleported: _ctx.teleported,
  20603. transition: _ctx.transition,
  20604. "virtual-triggering": _ctx.virtualTriggering,
  20605. "z-index": _ctx.zIndex,
  20606. "append-to": _ctx.appendTo
  20607. }, {
  20608. default: withCtx(() => [
  20609. renderSlot(_ctx.$slots, "content", {}, () => [
  20610. _ctx.rawContent ? (openBlock(), createElementBlock("span", {
  20611. key: 0,
  20612. innerHTML: _ctx.content
  20613. }, null, 8, _hoisted_1$f)) : (openBlock(), createElementBlock("span", _hoisted_2$9, toDisplayString(_ctx.content), 1))
  20614. ]),
  20615. _ctx.showArrow ? (openBlock(), createBlock(unref(ElPopperArrow), {
  20616. key: 0,
  20617. "arrow-offset": _ctx.arrowOffset
  20618. }, null, 8, ["arrow-offset"])) : createCommentVNode("v-if", true)
  20619. ]),
  20620. _: 3
  20621. }, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to"])
  20622. ]),
  20623. _: 3
  20624. }, 8, ["role"]);
  20625. };
  20626. }
  20627. });
  20628. var Tooltip = /* @__PURE__ */ _export_sfc$1(_sfc_main$p, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/tooltip.vue"]]);
  20629. const ElTooltip = withInstall(Tooltip);
  20630. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  20631. const useButton = (props, emit) => {
  20632. useDeprecated({
  20633. from: "type.text",
  20634. replacement: "link",
  20635. version: "3.0.0",
  20636. scope: "props",
  20637. ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
  20638. }, computed$1(() => props.type === "text"));
  20639. const buttonGroupContext = inject(buttonGroupContextKey, void 0);
  20640. const globalConfig2 = useGlobalConfig("button");
  20641. const { form } = useFormItem();
  20642. const _size = useFormSize(computed$1(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  20643. const _disabled = useFormDisabled();
  20644. const _ref = ref();
  20645. const slots = useSlots();
  20646. const _type = computed$1(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
  20647. const autoInsertSpace = computed$1(() => {
  20648. var _a2, _b, _c;
  20649. return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a2 = globalConfig2.value) == null ? void 0 : _a2.autoInsertSpace) != null ? _c : false;
  20650. });
  20651. const _props = computed$1(() => {
  20652. if (props.tag === "button") {
  20653. return {
  20654. ariaDisabled: _disabled.value || props.loading,
  20655. disabled: _disabled.value || props.loading,
  20656. autofocus: props.autofocus,
  20657. type: props.nativeType
  20658. };
  20659. }
  20660. return {};
  20661. });
  20662. const shouldAddSpace = computed$1(() => {
  20663. var _a2;
  20664. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
  20665. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  20666. const slot = defaultSlot[0];
  20667. if ((slot == null ? void 0 : slot.type) === Text$1) {
  20668. const text = slot.children;
  20669. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  20670. }
  20671. }
  20672. return false;
  20673. });
  20674. const handleClick = (evt) => {
  20675. if (props.nativeType === "reset") {
  20676. form == null ? void 0 : form.resetFields();
  20677. }
  20678. emit("click", evt);
  20679. };
  20680. return {
  20681. _disabled,
  20682. _size,
  20683. _type,
  20684. _ref,
  20685. _props,
  20686. shouldAddSpace,
  20687. handleClick
  20688. };
  20689. };
  20690. const buttonTypes = [
  20691. "default",
  20692. "primary",
  20693. "success",
  20694. "warning",
  20695. "info",
  20696. "danger",
  20697. "text",
  20698. ""
  20699. ];
  20700. const buttonNativeTypes = ["button", "submit", "reset"];
  20701. const buttonProps = buildProps({
  20702. size: useSizeProp,
  20703. disabled: Boolean,
  20704. type: {
  20705. type: String,
  20706. values: buttonTypes,
  20707. default: ""
  20708. },
  20709. icon: {
  20710. type: iconPropType
  20711. },
  20712. nativeType: {
  20713. type: String,
  20714. values: buttonNativeTypes,
  20715. default: "button"
  20716. },
  20717. loading: Boolean,
  20718. loadingIcon: {
  20719. type: iconPropType,
  20720. default: () => loading_default
  20721. },
  20722. plain: Boolean,
  20723. text: Boolean,
  20724. link: Boolean,
  20725. bg: Boolean,
  20726. autofocus: Boolean,
  20727. round: Boolean,
  20728. circle: Boolean,
  20729. color: String,
  20730. dark: Boolean,
  20731. autoInsertSpace: {
  20732. type: Boolean,
  20733. default: void 0
  20734. },
  20735. tag: {
  20736. type: definePropType([String, Object]),
  20737. default: "button"
  20738. }
  20739. });
  20740. const buttonEmits = {
  20741. click: (evt) => evt instanceof MouseEvent
  20742. };
  20743. function bound01$1(n, max2) {
  20744. if (isOnePointZero$1(n)) {
  20745. n = "100%";
  20746. }
  20747. var isPercent = isPercentage$1(n);
  20748. n = max2 === 360 ? n : Math.min(max2, Math.max(0, parseFloat(n)));
  20749. if (isPercent) {
  20750. n = parseInt(String(n * max2), 10) / 100;
  20751. }
  20752. if (Math.abs(n - max2) < 1e-6) {
  20753. return 1;
  20754. }
  20755. if (max2 === 360) {
  20756. n = (n < 0 ? n % max2 + max2 : n % max2) / parseFloat(String(max2));
  20757. } else {
  20758. n = n % max2 / parseFloat(String(max2));
  20759. }
  20760. return n;
  20761. }
  20762. function clamp01(val) {
  20763. return Math.min(1, Math.max(0, val));
  20764. }
  20765. function isOnePointZero$1(n) {
  20766. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  20767. }
  20768. function isPercentage$1(n) {
  20769. return typeof n === "string" && n.indexOf("%") !== -1;
  20770. }
  20771. function boundAlpha(a) {
  20772. a = parseFloat(a);
  20773. if (isNaN(a) || a < 0 || a > 1) {
  20774. a = 1;
  20775. }
  20776. return a;
  20777. }
  20778. function convertToPercentage(n) {
  20779. if (n <= 1) {
  20780. return "".concat(Number(n) * 100, "%");
  20781. }
  20782. return n;
  20783. }
  20784. function pad2(c) {
  20785. return c.length === 1 ? "0" + c : String(c);
  20786. }
  20787. function rgbToRgb(r2, g, b) {
  20788. return {
  20789. r: bound01$1(r2, 255) * 255,
  20790. g: bound01$1(g, 255) * 255,
  20791. b: bound01$1(b, 255) * 255
  20792. };
  20793. }
  20794. function rgbToHsl(r2, g, b) {
  20795. r2 = bound01$1(r2, 255);
  20796. g = bound01$1(g, 255);
  20797. b = bound01$1(b, 255);
  20798. var max2 = Math.max(r2, g, b);
  20799. var min2 = Math.min(r2, g, b);
  20800. var h2 = 0;
  20801. var s = 0;
  20802. var l = (max2 + min2) / 2;
  20803. if (max2 === min2) {
  20804. s = 0;
  20805. h2 = 0;
  20806. } else {
  20807. var d2 = max2 - min2;
  20808. s = l > 0.5 ? d2 / (2 - max2 - min2) : d2 / (max2 + min2);
  20809. switch (max2) {
  20810. case r2:
  20811. h2 = (g - b) / d2 + (g < b ? 6 : 0);
  20812. break;
  20813. case g:
  20814. h2 = (b - r2) / d2 + 2;
  20815. break;
  20816. case b:
  20817. h2 = (r2 - g) / d2 + 4;
  20818. break;
  20819. }
  20820. h2 /= 6;
  20821. }
  20822. return { h: h2, s, l };
  20823. }
  20824. function hue2rgb(p, q2, t2) {
  20825. if (t2 < 0) {
  20826. t2 += 1;
  20827. }
  20828. if (t2 > 1) {
  20829. t2 -= 1;
  20830. }
  20831. if (t2 < 1 / 6) {
  20832. return p + (q2 - p) * (6 * t2);
  20833. }
  20834. if (t2 < 1 / 2) {
  20835. return q2;
  20836. }
  20837. if (t2 < 2 / 3) {
  20838. return p + (q2 - p) * (2 / 3 - t2) * 6;
  20839. }
  20840. return p;
  20841. }
  20842. function hslToRgb(h2, s, l) {
  20843. var r2;
  20844. var g;
  20845. var b;
  20846. h2 = bound01$1(h2, 360);
  20847. s = bound01$1(s, 100);
  20848. l = bound01$1(l, 100);
  20849. if (s === 0) {
  20850. g = l;
  20851. b = l;
  20852. r2 = l;
  20853. } else {
  20854. var q2 = l < 0.5 ? l * (1 + s) : l + s - l * s;
  20855. var p = 2 * l - q2;
  20856. r2 = hue2rgb(p, q2, h2 + 1 / 3);
  20857. g = hue2rgb(p, q2, h2);
  20858. b = hue2rgb(p, q2, h2 - 1 / 3);
  20859. }
  20860. return { r: r2 * 255, g: g * 255, b: b * 255 };
  20861. }
  20862. function rgbToHsv(r2, g, b) {
  20863. r2 = bound01$1(r2, 255);
  20864. g = bound01$1(g, 255);
  20865. b = bound01$1(b, 255);
  20866. var max2 = Math.max(r2, g, b);
  20867. var min2 = Math.min(r2, g, b);
  20868. var h2 = 0;
  20869. var v = max2;
  20870. var d2 = max2 - min2;
  20871. var s = max2 === 0 ? 0 : d2 / max2;
  20872. if (max2 === min2) {
  20873. h2 = 0;
  20874. } else {
  20875. switch (max2) {
  20876. case r2:
  20877. h2 = (g - b) / d2 + (g < b ? 6 : 0);
  20878. break;
  20879. case g:
  20880. h2 = (b - r2) / d2 + 2;
  20881. break;
  20882. case b:
  20883. h2 = (r2 - g) / d2 + 4;
  20884. break;
  20885. }
  20886. h2 /= 6;
  20887. }
  20888. return { h: h2, s, v };
  20889. }
  20890. function hsvToRgb(h2, s, v) {
  20891. h2 = bound01$1(h2, 360) * 6;
  20892. s = bound01$1(s, 100);
  20893. v = bound01$1(v, 100);
  20894. var i2 = Math.floor(h2);
  20895. var f = h2 - i2;
  20896. var p = v * (1 - s);
  20897. var q2 = v * (1 - f * s);
  20898. var t2 = v * (1 - (1 - f) * s);
  20899. var mod = i2 % 6;
  20900. var r2 = [v, q2, p, p, t2, v][mod];
  20901. var g = [t2, v, v, q2, p, p][mod];
  20902. var b = [p, p, t2, v, v, q2][mod];
  20903. return { r: r2 * 255, g: g * 255, b: b * 255 };
  20904. }
  20905. function rgbToHex(r2, g, b, allow3Char) {
  20906. var hex = [
  20907. pad2(Math.round(r2).toString(16)),
  20908. pad2(Math.round(g).toString(16)),
  20909. pad2(Math.round(b).toString(16))
  20910. ];
  20911. if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
  20912. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
  20913. }
  20914. return hex.join("");
  20915. }
  20916. function rgbaToHex(r2, g, b, a, allow4Char) {
  20917. var hex = [
  20918. pad2(Math.round(r2).toString(16)),
  20919. pad2(Math.round(g).toString(16)),
  20920. pad2(Math.round(b).toString(16)),
  20921. pad2(convertDecimalToHex(a))
  20922. ];
  20923. if (allow4Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1)) && hex[3].startsWith(hex[3].charAt(1))) {
  20924. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
  20925. }
  20926. return hex.join("");
  20927. }
  20928. function convertDecimalToHex(d2) {
  20929. return Math.round(parseFloat(d2) * 255).toString(16);
  20930. }
  20931. function convertHexToDecimal(h2) {
  20932. return parseIntFromHex(h2) / 255;
  20933. }
  20934. function parseIntFromHex(val) {
  20935. return parseInt(val, 16);
  20936. }
  20937. function numberInputToObject(color2) {
  20938. return {
  20939. r: color2 >> 16,
  20940. g: (color2 & 65280) >> 8,
  20941. b: color2 & 255
  20942. };
  20943. }
  20944. var names = {
  20945. aliceblue: "#f0f8ff",
  20946. antiquewhite: "#faebd7",
  20947. aqua: "#00ffff",
  20948. aquamarine: "#7fffd4",
  20949. azure: "#f0ffff",
  20950. beige: "#f5f5dc",
  20951. bisque: "#ffe4c4",
  20952. black: "#000000",
  20953. blanchedalmond: "#ffebcd",
  20954. blue: "#0000ff",
  20955. blueviolet: "#8a2be2",
  20956. brown: "#a52a2a",
  20957. burlywood: "#deb887",
  20958. cadetblue: "#5f9ea0",
  20959. chartreuse: "#7fff00",
  20960. chocolate: "#d2691e",
  20961. coral: "#ff7f50",
  20962. cornflowerblue: "#6495ed",
  20963. cornsilk: "#fff8dc",
  20964. crimson: "#dc143c",
  20965. cyan: "#00ffff",
  20966. darkblue: "#00008b",
  20967. darkcyan: "#008b8b",
  20968. darkgoldenrod: "#b8860b",
  20969. darkgray: "#a9a9a9",
  20970. darkgreen: "#006400",
  20971. darkgrey: "#a9a9a9",
  20972. darkkhaki: "#bdb76b",
  20973. darkmagenta: "#8b008b",
  20974. darkolivegreen: "#556b2f",
  20975. darkorange: "#ff8c00",
  20976. darkorchid: "#9932cc",
  20977. darkred: "#8b0000",
  20978. darksalmon: "#e9967a",
  20979. darkseagreen: "#8fbc8f",
  20980. darkslateblue: "#483d8b",
  20981. darkslategray: "#2f4f4f",
  20982. darkslategrey: "#2f4f4f",
  20983. darkturquoise: "#00ced1",
  20984. darkviolet: "#9400d3",
  20985. deeppink: "#ff1493",
  20986. deepskyblue: "#00bfff",
  20987. dimgray: "#696969",
  20988. dimgrey: "#696969",
  20989. dodgerblue: "#1e90ff",
  20990. firebrick: "#b22222",
  20991. floralwhite: "#fffaf0",
  20992. forestgreen: "#228b22",
  20993. fuchsia: "#ff00ff",
  20994. gainsboro: "#dcdcdc",
  20995. ghostwhite: "#f8f8ff",
  20996. goldenrod: "#daa520",
  20997. gold: "#ffd700",
  20998. gray: "#808080",
  20999. green: "#008000",
  21000. greenyellow: "#adff2f",
  21001. grey: "#808080",
  21002. honeydew: "#f0fff0",
  21003. hotpink: "#ff69b4",
  21004. indianred: "#cd5c5c",
  21005. indigo: "#4b0082",
  21006. ivory: "#fffff0",
  21007. khaki: "#f0e68c",
  21008. lavenderblush: "#fff0f5",
  21009. lavender: "#e6e6fa",
  21010. lawngreen: "#7cfc00",
  21011. lemonchiffon: "#fffacd",
  21012. lightblue: "#add8e6",
  21013. lightcoral: "#f08080",
  21014. lightcyan: "#e0ffff",
  21015. lightgoldenrodyellow: "#fafad2",
  21016. lightgray: "#d3d3d3",
  21017. lightgreen: "#90ee90",
  21018. lightgrey: "#d3d3d3",
  21019. lightpink: "#ffb6c1",
  21020. lightsalmon: "#ffa07a",
  21021. lightseagreen: "#20b2aa",
  21022. lightskyblue: "#87cefa",
  21023. lightslategray: "#778899",
  21024. lightslategrey: "#778899",
  21025. lightsteelblue: "#b0c4de",
  21026. lightyellow: "#ffffe0",
  21027. lime: "#00ff00",
  21028. limegreen: "#32cd32",
  21029. linen: "#faf0e6",
  21030. magenta: "#ff00ff",
  21031. maroon: "#800000",
  21032. mediumaquamarine: "#66cdaa",
  21033. mediumblue: "#0000cd",
  21034. mediumorchid: "#ba55d3",
  21035. mediumpurple: "#9370db",
  21036. mediumseagreen: "#3cb371",
  21037. mediumslateblue: "#7b68ee",
  21038. mediumspringgreen: "#00fa9a",
  21039. mediumturquoise: "#48d1cc",
  21040. mediumvioletred: "#c71585",
  21041. midnightblue: "#191970",
  21042. mintcream: "#f5fffa",
  21043. mistyrose: "#ffe4e1",
  21044. moccasin: "#ffe4b5",
  21045. navajowhite: "#ffdead",
  21046. navy: "#000080",
  21047. oldlace: "#fdf5e6",
  21048. olive: "#808000",
  21049. olivedrab: "#6b8e23",
  21050. orange: "#ffa500",
  21051. orangered: "#ff4500",
  21052. orchid: "#da70d6",
  21053. palegoldenrod: "#eee8aa",
  21054. palegreen: "#98fb98",
  21055. paleturquoise: "#afeeee",
  21056. palevioletred: "#db7093",
  21057. papayawhip: "#ffefd5",
  21058. peachpuff: "#ffdab9",
  21059. peru: "#cd853f",
  21060. pink: "#ffc0cb",
  21061. plum: "#dda0dd",
  21062. powderblue: "#b0e0e6",
  21063. purple: "#800080",
  21064. rebeccapurple: "#663399",
  21065. red: "#ff0000",
  21066. rosybrown: "#bc8f8f",
  21067. royalblue: "#4169e1",
  21068. saddlebrown: "#8b4513",
  21069. salmon: "#fa8072",
  21070. sandybrown: "#f4a460",
  21071. seagreen: "#2e8b57",
  21072. seashell: "#fff5ee",
  21073. sienna: "#a0522d",
  21074. silver: "#c0c0c0",
  21075. skyblue: "#87ceeb",
  21076. slateblue: "#6a5acd",
  21077. slategray: "#708090",
  21078. slategrey: "#708090",
  21079. snow: "#fffafa",
  21080. springgreen: "#00ff7f",
  21081. steelblue: "#4682b4",
  21082. tan: "#d2b48c",
  21083. teal: "#008080",
  21084. thistle: "#d8bfd8",
  21085. tomato: "#ff6347",
  21086. turquoise: "#40e0d0",
  21087. violet: "#ee82ee",
  21088. wheat: "#f5deb3",
  21089. white: "#ffffff",
  21090. whitesmoke: "#f5f5f5",
  21091. yellow: "#ffff00",
  21092. yellowgreen: "#9acd32"
  21093. };
  21094. function inputToRGB(color2) {
  21095. var rgb = { r: 0, g: 0, b: 0 };
  21096. var a = 1;
  21097. var s = null;
  21098. var v = null;
  21099. var l = null;
  21100. var ok = false;
  21101. var format = false;
  21102. if (typeof color2 === "string") {
  21103. color2 = stringInputToObject(color2);
  21104. }
  21105. if (typeof color2 === "object") {
  21106. if (isValidCSSUnit(color2.r) && isValidCSSUnit(color2.g) && isValidCSSUnit(color2.b)) {
  21107. rgb = rgbToRgb(color2.r, color2.g, color2.b);
  21108. ok = true;
  21109. format = String(color2.r).substr(-1) === "%" ? "prgb" : "rgb";
  21110. } else if (isValidCSSUnit(color2.h) && isValidCSSUnit(color2.s) && isValidCSSUnit(color2.v)) {
  21111. s = convertToPercentage(color2.s);
  21112. v = convertToPercentage(color2.v);
  21113. rgb = hsvToRgb(color2.h, s, v);
  21114. ok = true;
  21115. format = "hsv";
  21116. } else if (isValidCSSUnit(color2.h) && isValidCSSUnit(color2.s) && isValidCSSUnit(color2.l)) {
  21117. s = convertToPercentage(color2.s);
  21118. l = convertToPercentage(color2.l);
  21119. rgb = hslToRgb(color2.h, s, l);
  21120. ok = true;
  21121. format = "hsl";
  21122. }
  21123. if (Object.prototype.hasOwnProperty.call(color2, "a")) {
  21124. a = color2.a;
  21125. }
  21126. }
  21127. a = boundAlpha(a);
  21128. return {
  21129. ok,
  21130. format: color2.format || format,
  21131. r: Math.min(255, Math.max(rgb.r, 0)),
  21132. g: Math.min(255, Math.max(rgb.g, 0)),
  21133. b: Math.min(255, Math.max(rgb.b, 0)),
  21134. a
  21135. };
  21136. }
  21137. var CSS_INTEGER = "[-\\+]?\\d+%?";
  21138. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  21139. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  21140. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  21141. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  21142. var matchers = {
  21143. CSS_UNIT: new RegExp(CSS_UNIT),
  21144. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  21145. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  21146. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  21147. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  21148. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  21149. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  21150. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  21151. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  21152. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  21153. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  21154. };
  21155. function stringInputToObject(color2) {
  21156. color2 = color2.trim().toLowerCase();
  21157. if (color2.length === 0) {
  21158. return false;
  21159. }
  21160. var named = false;
  21161. if (names[color2]) {
  21162. color2 = names[color2];
  21163. named = true;
  21164. } else if (color2 === "transparent") {
  21165. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  21166. }
  21167. var match = matchers.rgb.exec(color2);
  21168. if (match) {
  21169. return { r: match[1], g: match[2], b: match[3] };
  21170. }
  21171. match = matchers.rgba.exec(color2);
  21172. if (match) {
  21173. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  21174. }
  21175. match = matchers.hsl.exec(color2);
  21176. if (match) {
  21177. return { h: match[1], s: match[2], l: match[3] };
  21178. }
  21179. match = matchers.hsla.exec(color2);
  21180. if (match) {
  21181. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  21182. }
  21183. match = matchers.hsv.exec(color2);
  21184. if (match) {
  21185. return { h: match[1], s: match[2], v: match[3] };
  21186. }
  21187. match = matchers.hsva.exec(color2);
  21188. if (match) {
  21189. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  21190. }
  21191. match = matchers.hex8.exec(color2);
  21192. if (match) {
  21193. return {
  21194. r: parseIntFromHex(match[1]),
  21195. g: parseIntFromHex(match[2]),
  21196. b: parseIntFromHex(match[3]),
  21197. a: convertHexToDecimal(match[4]),
  21198. format: named ? "name" : "hex8"
  21199. };
  21200. }
  21201. match = matchers.hex6.exec(color2);
  21202. if (match) {
  21203. return {
  21204. r: parseIntFromHex(match[1]),
  21205. g: parseIntFromHex(match[2]),
  21206. b: parseIntFromHex(match[3]),
  21207. format: named ? "name" : "hex"
  21208. };
  21209. }
  21210. match = matchers.hex4.exec(color2);
  21211. if (match) {
  21212. return {
  21213. r: parseIntFromHex(match[1] + match[1]),
  21214. g: parseIntFromHex(match[2] + match[2]),
  21215. b: parseIntFromHex(match[3] + match[3]),
  21216. a: convertHexToDecimal(match[4] + match[4]),
  21217. format: named ? "name" : "hex8"
  21218. };
  21219. }
  21220. match = matchers.hex3.exec(color2);
  21221. if (match) {
  21222. return {
  21223. r: parseIntFromHex(match[1] + match[1]),
  21224. g: parseIntFromHex(match[2] + match[2]),
  21225. b: parseIntFromHex(match[3] + match[3]),
  21226. format: named ? "name" : "hex"
  21227. };
  21228. }
  21229. return false;
  21230. }
  21231. function isValidCSSUnit(color2) {
  21232. return Boolean(matchers.CSS_UNIT.exec(String(color2)));
  21233. }
  21234. var TinyColor = function() {
  21235. function TinyColor2(color2, opts) {
  21236. if (color2 === void 0) {
  21237. color2 = "";
  21238. }
  21239. if (opts === void 0) {
  21240. opts = {};
  21241. }
  21242. var _a2;
  21243. if (color2 instanceof TinyColor2) {
  21244. return color2;
  21245. }
  21246. if (typeof color2 === "number") {
  21247. color2 = numberInputToObject(color2);
  21248. }
  21249. this.originalInput = color2;
  21250. var rgb = inputToRGB(color2);
  21251. this.originalInput = color2;
  21252. this.r = rgb.r;
  21253. this.g = rgb.g;
  21254. this.b = rgb.b;
  21255. this.a = rgb.a;
  21256. this.roundA = Math.round(100 * this.a) / 100;
  21257. this.format = (_a2 = opts.format) !== null && _a2 !== void 0 ? _a2 : rgb.format;
  21258. this.gradientType = opts.gradientType;
  21259. if (this.r < 1) {
  21260. this.r = Math.round(this.r);
  21261. }
  21262. if (this.g < 1) {
  21263. this.g = Math.round(this.g);
  21264. }
  21265. if (this.b < 1) {
  21266. this.b = Math.round(this.b);
  21267. }
  21268. this.isValid = rgb.ok;
  21269. }
  21270. TinyColor2.prototype.isDark = function() {
  21271. return this.getBrightness() < 128;
  21272. };
  21273. TinyColor2.prototype.isLight = function() {
  21274. return !this.isDark();
  21275. };
  21276. TinyColor2.prototype.getBrightness = function() {
  21277. var rgb = this.toRgb();
  21278. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  21279. };
  21280. TinyColor2.prototype.getLuminance = function() {
  21281. var rgb = this.toRgb();
  21282. var R2;
  21283. var G2;
  21284. var B2;
  21285. var RsRGB = rgb.r / 255;
  21286. var GsRGB = rgb.g / 255;
  21287. var BsRGB = rgb.b / 255;
  21288. if (RsRGB <= 0.03928) {
  21289. R2 = RsRGB / 12.92;
  21290. } else {
  21291. R2 = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  21292. }
  21293. if (GsRGB <= 0.03928) {
  21294. G2 = GsRGB / 12.92;
  21295. } else {
  21296. G2 = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  21297. }
  21298. if (BsRGB <= 0.03928) {
  21299. B2 = BsRGB / 12.92;
  21300. } else {
  21301. B2 = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  21302. }
  21303. return 0.2126 * R2 + 0.7152 * G2 + 0.0722 * B2;
  21304. };
  21305. TinyColor2.prototype.getAlpha = function() {
  21306. return this.a;
  21307. };
  21308. TinyColor2.prototype.setAlpha = function(alpha) {
  21309. this.a = boundAlpha(alpha);
  21310. this.roundA = Math.round(100 * this.a) / 100;
  21311. return this;
  21312. };
  21313. TinyColor2.prototype.isMonochrome = function() {
  21314. var s = this.toHsl().s;
  21315. return s === 0;
  21316. };
  21317. TinyColor2.prototype.toHsv = function() {
  21318. var hsv = rgbToHsv(this.r, this.g, this.b);
  21319. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  21320. };
  21321. TinyColor2.prototype.toHsvString = function() {
  21322. var hsv = rgbToHsv(this.r, this.g, this.b);
  21323. var h2 = Math.round(hsv.h * 360);
  21324. var s = Math.round(hsv.s * 100);
  21325. var v = Math.round(hsv.v * 100);
  21326. return this.a === 1 ? "hsv(".concat(h2, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h2, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
  21327. };
  21328. TinyColor2.prototype.toHsl = function() {
  21329. var hsl = rgbToHsl(this.r, this.g, this.b);
  21330. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  21331. };
  21332. TinyColor2.prototype.toHslString = function() {
  21333. var hsl = rgbToHsl(this.r, this.g, this.b);
  21334. var h2 = Math.round(hsl.h * 360);
  21335. var s = Math.round(hsl.s * 100);
  21336. var l = Math.round(hsl.l * 100);
  21337. return this.a === 1 ? "hsl(".concat(h2, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h2, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
  21338. };
  21339. TinyColor2.prototype.toHex = function(allow3Char) {
  21340. if (allow3Char === void 0) {
  21341. allow3Char = false;
  21342. }
  21343. return rgbToHex(this.r, this.g, this.b, allow3Char);
  21344. };
  21345. TinyColor2.prototype.toHexString = function(allow3Char) {
  21346. if (allow3Char === void 0) {
  21347. allow3Char = false;
  21348. }
  21349. return "#" + this.toHex(allow3Char);
  21350. };
  21351. TinyColor2.prototype.toHex8 = function(allow4Char) {
  21352. if (allow4Char === void 0) {
  21353. allow4Char = false;
  21354. }
  21355. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  21356. };
  21357. TinyColor2.prototype.toHex8String = function(allow4Char) {
  21358. if (allow4Char === void 0) {
  21359. allow4Char = false;
  21360. }
  21361. return "#" + this.toHex8(allow4Char);
  21362. };
  21363. TinyColor2.prototype.toHexShortString = function(allowShortChar) {
  21364. if (allowShortChar === void 0) {
  21365. allowShortChar = false;
  21366. }
  21367. return this.a === 1 ? this.toHexString(allowShortChar) : this.toHex8String(allowShortChar);
  21368. };
  21369. TinyColor2.prototype.toRgb = function() {
  21370. return {
  21371. r: Math.round(this.r),
  21372. g: Math.round(this.g),
  21373. b: Math.round(this.b),
  21374. a: this.a
  21375. };
  21376. };
  21377. TinyColor2.prototype.toRgbString = function() {
  21378. var r2 = Math.round(this.r);
  21379. var g = Math.round(this.g);
  21380. var b = Math.round(this.b);
  21381. return this.a === 1 ? "rgb(".concat(r2, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r2, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
  21382. };
  21383. TinyColor2.prototype.toPercentageRgb = function() {
  21384. var fmt = function(x) {
  21385. return "".concat(Math.round(bound01$1(x, 255) * 100), "%");
  21386. };
  21387. return {
  21388. r: fmt(this.r),
  21389. g: fmt(this.g),
  21390. b: fmt(this.b),
  21391. a: this.a
  21392. };
  21393. };
  21394. TinyColor2.prototype.toPercentageRgbString = function() {
  21395. var rnd = function(x) {
  21396. return Math.round(bound01$1(x, 255) * 100);
  21397. };
  21398. return this.a === 1 ? "rgb(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%)") : "rgba(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%, ").concat(this.roundA, ")");
  21399. };
  21400. TinyColor2.prototype.toName = function() {
  21401. if (this.a === 0) {
  21402. return "transparent";
  21403. }
  21404. if (this.a < 1) {
  21405. return false;
  21406. }
  21407. var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
  21408. for (var _i = 0, _a2 = Object.entries(names); _i < _a2.length; _i++) {
  21409. var _b = _a2[_i], key = _b[0], value = _b[1];
  21410. if (hex === value) {
  21411. return key;
  21412. }
  21413. }
  21414. return false;
  21415. };
  21416. TinyColor2.prototype.toString = function(format) {
  21417. var formatSet = Boolean(format);
  21418. format = format !== null && format !== void 0 ? format : this.format;
  21419. var formattedString = false;
  21420. var hasAlpha = this.a < 1 && this.a >= 0;
  21421. var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
  21422. if (needsAlphaFormat) {
  21423. if (format === "name" && this.a === 0) {
  21424. return this.toName();
  21425. }
  21426. return this.toRgbString();
  21427. }
  21428. if (format === "rgb") {
  21429. formattedString = this.toRgbString();
  21430. }
  21431. if (format === "prgb") {
  21432. formattedString = this.toPercentageRgbString();
  21433. }
  21434. if (format === "hex" || format === "hex6") {
  21435. formattedString = this.toHexString();
  21436. }
  21437. if (format === "hex3") {
  21438. formattedString = this.toHexString(true);
  21439. }
  21440. if (format === "hex4") {
  21441. formattedString = this.toHex8String(true);
  21442. }
  21443. if (format === "hex8") {
  21444. formattedString = this.toHex8String();
  21445. }
  21446. if (format === "name") {
  21447. formattedString = this.toName();
  21448. }
  21449. if (format === "hsl") {
  21450. formattedString = this.toHslString();
  21451. }
  21452. if (format === "hsv") {
  21453. formattedString = this.toHsvString();
  21454. }
  21455. return formattedString || this.toHexString();
  21456. };
  21457. TinyColor2.prototype.toNumber = function() {
  21458. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  21459. };
  21460. TinyColor2.prototype.clone = function() {
  21461. return new TinyColor2(this.toString());
  21462. };
  21463. TinyColor2.prototype.lighten = function(amount) {
  21464. if (amount === void 0) {
  21465. amount = 10;
  21466. }
  21467. var hsl = this.toHsl();
  21468. hsl.l += amount / 100;
  21469. hsl.l = clamp01(hsl.l);
  21470. return new TinyColor2(hsl);
  21471. };
  21472. TinyColor2.prototype.brighten = function(amount) {
  21473. if (amount === void 0) {
  21474. amount = 10;
  21475. }
  21476. var rgb = this.toRgb();
  21477. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  21478. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  21479. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  21480. return new TinyColor2(rgb);
  21481. };
  21482. TinyColor2.prototype.darken = function(amount) {
  21483. if (amount === void 0) {
  21484. amount = 10;
  21485. }
  21486. var hsl = this.toHsl();
  21487. hsl.l -= amount / 100;
  21488. hsl.l = clamp01(hsl.l);
  21489. return new TinyColor2(hsl);
  21490. };
  21491. TinyColor2.prototype.tint = function(amount) {
  21492. if (amount === void 0) {
  21493. amount = 10;
  21494. }
  21495. return this.mix("white", amount);
  21496. };
  21497. TinyColor2.prototype.shade = function(amount) {
  21498. if (amount === void 0) {
  21499. amount = 10;
  21500. }
  21501. return this.mix("black", amount);
  21502. };
  21503. TinyColor2.prototype.desaturate = function(amount) {
  21504. if (amount === void 0) {
  21505. amount = 10;
  21506. }
  21507. var hsl = this.toHsl();
  21508. hsl.s -= amount / 100;
  21509. hsl.s = clamp01(hsl.s);
  21510. return new TinyColor2(hsl);
  21511. };
  21512. TinyColor2.prototype.saturate = function(amount) {
  21513. if (amount === void 0) {
  21514. amount = 10;
  21515. }
  21516. var hsl = this.toHsl();
  21517. hsl.s += amount / 100;
  21518. hsl.s = clamp01(hsl.s);
  21519. return new TinyColor2(hsl);
  21520. };
  21521. TinyColor2.prototype.greyscale = function() {
  21522. return this.desaturate(100);
  21523. };
  21524. TinyColor2.prototype.spin = function(amount) {
  21525. var hsl = this.toHsl();
  21526. var hue = (hsl.h + amount) % 360;
  21527. hsl.h = hue < 0 ? 360 + hue : hue;
  21528. return new TinyColor2(hsl);
  21529. };
  21530. TinyColor2.prototype.mix = function(color2, amount) {
  21531. if (amount === void 0) {
  21532. amount = 50;
  21533. }
  21534. var rgb1 = this.toRgb();
  21535. var rgb2 = new TinyColor2(color2).toRgb();
  21536. var p = amount / 100;
  21537. var rgba = {
  21538. r: (rgb2.r - rgb1.r) * p + rgb1.r,
  21539. g: (rgb2.g - rgb1.g) * p + rgb1.g,
  21540. b: (rgb2.b - rgb1.b) * p + rgb1.b,
  21541. a: (rgb2.a - rgb1.a) * p + rgb1.a
  21542. };
  21543. return new TinyColor2(rgba);
  21544. };
  21545. TinyColor2.prototype.analogous = function(results, slices) {
  21546. if (results === void 0) {
  21547. results = 6;
  21548. }
  21549. if (slices === void 0) {
  21550. slices = 30;
  21551. }
  21552. var hsl = this.toHsl();
  21553. var part = 360 / slices;
  21554. var ret = [this];
  21555. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  21556. hsl.h = (hsl.h + part) % 360;
  21557. ret.push(new TinyColor2(hsl));
  21558. }
  21559. return ret;
  21560. };
  21561. TinyColor2.prototype.complement = function() {
  21562. var hsl = this.toHsl();
  21563. hsl.h = (hsl.h + 180) % 360;
  21564. return new TinyColor2(hsl);
  21565. };
  21566. TinyColor2.prototype.monochromatic = function(results) {
  21567. if (results === void 0) {
  21568. results = 6;
  21569. }
  21570. var hsv = this.toHsv();
  21571. var h2 = hsv.h;
  21572. var s = hsv.s;
  21573. var v = hsv.v;
  21574. var res = [];
  21575. var modification = 1 / results;
  21576. while (results--) {
  21577. res.push(new TinyColor2({ h: h2, s, v }));
  21578. v = (v + modification) % 1;
  21579. }
  21580. return res;
  21581. };
  21582. TinyColor2.prototype.splitcomplement = function() {
  21583. var hsl = this.toHsl();
  21584. var h2 = hsl.h;
  21585. return [
  21586. this,
  21587. new TinyColor2({ h: (h2 + 72) % 360, s: hsl.s, l: hsl.l }),
  21588. new TinyColor2({ h: (h2 + 216) % 360, s: hsl.s, l: hsl.l })
  21589. ];
  21590. };
  21591. TinyColor2.prototype.onBackground = function(background) {
  21592. var fg = this.toRgb();
  21593. var bg = new TinyColor2(background).toRgb();
  21594. var alpha = fg.a + bg.a * (1 - fg.a);
  21595. return new TinyColor2({
  21596. r: (fg.r * fg.a + bg.r * bg.a * (1 - fg.a)) / alpha,
  21597. g: (fg.g * fg.a + bg.g * bg.a * (1 - fg.a)) / alpha,
  21598. b: (fg.b * fg.a + bg.b * bg.a * (1 - fg.a)) / alpha,
  21599. a: alpha
  21600. });
  21601. };
  21602. TinyColor2.prototype.triad = function() {
  21603. return this.polyad(3);
  21604. };
  21605. TinyColor2.prototype.tetrad = function() {
  21606. return this.polyad(4);
  21607. };
  21608. TinyColor2.prototype.polyad = function(n) {
  21609. var hsl = this.toHsl();
  21610. var h2 = hsl.h;
  21611. var result = [this];
  21612. var increment = 360 / n;
  21613. for (var i2 = 1; i2 < n; i2++) {
  21614. result.push(new TinyColor2({ h: (h2 + i2 * increment) % 360, s: hsl.s, l: hsl.l }));
  21615. }
  21616. return result;
  21617. };
  21618. TinyColor2.prototype.equals = function(color2) {
  21619. return this.toRgbString() === new TinyColor2(color2).toRgbString();
  21620. };
  21621. return TinyColor2;
  21622. }();
  21623. function darken(color2, amount = 20) {
  21624. return color2.mix("#141414", amount).toString();
  21625. }
  21626. function useButtonCustomStyle(props) {
  21627. const _disabled = useFormDisabled();
  21628. const ns = useNamespace("button");
  21629. return computed$1(() => {
  21630. let styles = {};
  21631. const buttonColor = props.color;
  21632. if (buttonColor) {
  21633. const color2 = new TinyColor(buttonColor);
  21634. const activeBgColor = props.dark ? color2.tint(20).toString() : darken(color2, 20);
  21635. if (props.plain) {
  21636. styles = ns.cssVarBlock({
  21637. "bg-color": props.dark ? darken(color2, 90) : color2.tint(90).toString(),
  21638. "text-color": buttonColor,
  21639. "border-color": props.dark ? darken(color2, 50) : color2.tint(50).toString(),
  21640. "hover-text-color": `var(${ns.cssVarName("color-white")})`,
  21641. "hover-bg-color": buttonColor,
  21642. "hover-border-color": buttonColor,
  21643. "active-bg-color": activeBgColor,
  21644. "active-text-color": `var(${ns.cssVarName("color-white")})`,
  21645. "active-border-color": activeBgColor
  21646. });
  21647. if (_disabled.value) {
  21648. styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color2, 90) : color2.tint(90).toString();
  21649. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color2, 50) : color2.tint(50).toString();
  21650. styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color2, 80) : color2.tint(80).toString();
  21651. }
  21652. } else {
  21653. const hoverBgColor = props.dark ? darken(color2, 30) : color2.tint(30).toString();
  21654. const textColor = color2.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
  21655. styles = ns.cssVarBlock({
  21656. "bg-color": buttonColor,
  21657. "text-color": textColor,
  21658. "border-color": buttonColor,
  21659. "hover-bg-color": hoverBgColor,
  21660. "hover-text-color": textColor,
  21661. "hover-border-color": hoverBgColor,
  21662. "active-bg-color": activeBgColor,
  21663. "active-border-color": activeBgColor
  21664. });
  21665. if (_disabled.value) {
  21666. const disabledButtonColor = props.dark ? darken(color2, 50) : color2.tint(50).toString();
  21667. styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
  21668. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
  21669. styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
  21670. }
  21671. }
  21672. }
  21673. return styles;
  21674. });
  21675. }
  21676. const __default__$e = defineComponent({
  21677. name: "ElButton"
  21678. });
  21679. const _sfc_main$o = /* @__PURE__ */ defineComponent({
  21680. ...__default__$e,
  21681. props: buttonProps,
  21682. emits: buttonEmits,
  21683. setup(__props, { expose, emit }) {
  21684. const props = __props;
  21685. const buttonStyle = useButtonCustomStyle(props);
  21686. const ns = useNamespace("button");
  21687. const { _ref, _size, _type, _disabled, _props, shouldAddSpace, handleClick } = useButton(props, emit);
  21688. expose({
  21689. ref: _ref,
  21690. size: _size,
  21691. type: _type,
  21692. disabled: _disabled,
  21693. shouldAddSpace
  21694. });
  21695. return (_ctx, _cache) => {
  21696. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), mergeProps({
  21697. ref_key: "_ref",
  21698. ref: _ref
  21699. }, unref(_props), {
  21700. class: [
  21701. unref(ns).b(),
  21702. unref(ns).m(unref(_type)),
  21703. unref(ns).m(unref(_size)),
  21704. unref(ns).is("disabled", unref(_disabled)),
  21705. unref(ns).is("loading", _ctx.loading),
  21706. unref(ns).is("plain", _ctx.plain),
  21707. unref(ns).is("round", _ctx.round),
  21708. unref(ns).is("circle", _ctx.circle),
  21709. unref(ns).is("text", _ctx.text),
  21710. unref(ns).is("link", _ctx.link),
  21711. unref(ns).is("has-bg", _ctx.bg)
  21712. ],
  21713. style: unref(buttonStyle),
  21714. onClick: unref(handleClick)
  21715. }), {
  21716. default: withCtx(() => [
  21717. _ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  21718. _ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
  21719. key: 1,
  21720. class: normalizeClass(unref(ns).is("loading"))
  21721. }, {
  21722. default: withCtx(() => [
  21723. (openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
  21724. ]),
  21725. _: 1
  21726. }, 8, ["class"]))
  21727. ], 64)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  21728. default: withCtx(() => [
  21729. _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
  21730. ]),
  21731. _: 3
  21732. })) : createCommentVNode("v-if", true),
  21733. _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  21734. key: 2,
  21735. class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
  21736. }, [
  21737. renderSlot(_ctx.$slots, "default")
  21738. ], 2)) : createCommentVNode("v-if", true)
  21739. ]),
  21740. _: 3
  21741. }, 16, ["class", "style", "onClick"]);
  21742. };
  21743. }
  21744. });
  21745. var Button$2 = /* @__PURE__ */ _export_sfc$1(_sfc_main$o, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button.vue"]]);
  21746. const buttonGroupProps = {
  21747. size: buttonProps.size,
  21748. type: buttonProps.type
  21749. };
  21750. const __default__$d = defineComponent({
  21751. name: "ElButtonGroup"
  21752. });
  21753. const _sfc_main$n = /* @__PURE__ */ defineComponent({
  21754. ...__default__$d,
  21755. props: buttonGroupProps,
  21756. setup(__props) {
  21757. const props = __props;
  21758. provide(buttonGroupContextKey, reactive({
  21759. size: toRef(props, "size"),
  21760. type: toRef(props, "type")
  21761. }));
  21762. const ns = useNamespace("button");
  21763. return (_ctx, _cache) => {
  21764. return openBlock(), createElementBlock("div", {
  21765. class: normalizeClass(`${unref(ns).b("group")}`)
  21766. }, [
  21767. renderSlot(_ctx.$slots, "default")
  21768. ], 2);
  21769. };
  21770. }
  21771. });
  21772. var ButtonGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$n, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button-group.vue"]]);
  21773. const ElButton = withInstall(Button$2, {
  21774. ButtonGroup
  21775. });
  21776. const ElButtonGroup = withNoopInstall(ButtonGroup);
  21777. const nodeList = /* @__PURE__ */ new Map();
  21778. let startClick;
  21779. if (isClient) {
  21780. document.addEventListener("mousedown", (e) => startClick = e);
  21781. document.addEventListener("mouseup", (e) => {
  21782. for (const handlers of nodeList.values()) {
  21783. for (const { documentHandler } of handlers) {
  21784. documentHandler(e, startClick);
  21785. }
  21786. }
  21787. });
  21788. }
  21789. function createDocumentHandler(el, binding) {
  21790. let excludes = [];
  21791. if (Array.isArray(binding.arg)) {
  21792. excludes = binding.arg;
  21793. } else if (isElement(binding.arg)) {
  21794. excludes.push(binding.arg);
  21795. }
  21796. return function(mouseup, mousedown) {
  21797. const popperRef = binding.instance.popperRef;
  21798. const mouseUpTarget = mouseup.target;
  21799. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  21800. const isBound = !binding || !binding.instance;
  21801. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  21802. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  21803. const isSelf = el === mouseUpTarget;
  21804. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  21805. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  21806. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  21807. return;
  21808. }
  21809. binding.value(mouseup, mousedown);
  21810. };
  21811. }
  21812. const ClickOutside = {
  21813. beforeMount(el, binding) {
  21814. if (!nodeList.has(el)) {
  21815. nodeList.set(el, []);
  21816. }
  21817. nodeList.get(el).push({
  21818. documentHandler: createDocumentHandler(el, binding),
  21819. bindingFn: binding.value
  21820. });
  21821. },
  21822. updated(el, binding) {
  21823. if (!nodeList.has(el)) {
  21824. nodeList.set(el, []);
  21825. }
  21826. const handlers = nodeList.get(el);
  21827. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  21828. const newHandler = {
  21829. documentHandler: createDocumentHandler(el, binding),
  21830. bindingFn: binding.value
  21831. };
  21832. if (oldHandlerIndex >= 0) {
  21833. handlers.splice(oldHandlerIndex, 1, newHandler);
  21834. } else {
  21835. handlers.push(newHandler);
  21836. }
  21837. },
  21838. unmounted(el) {
  21839. nodeList.delete(el);
  21840. }
  21841. };
  21842. const REPEAT_INTERVAL = 100;
  21843. const REPEAT_DELAY = 600;
  21844. const vRepeatClick = {
  21845. beforeMount(el, binding) {
  21846. const value = binding.value;
  21847. const { interval = REPEAT_INTERVAL, delay = REPEAT_DELAY } = isFunction$3(value) ? {} : value;
  21848. let intervalId;
  21849. let delayId;
  21850. const handler = () => isFunction$3(value) ? value() : value.handler();
  21851. const clear = () => {
  21852. if (delayId) {
  21853. clearTimeout(delayId);
  21854. delayId = void 0;
  21855. }
  21856. if (intervalId) {
  21857. clearInterval(intervalId);
  21858. intervalId = void 0;
  21859. }
  21860. };
  21861. el.addEventListener("mousedown", (evt) => {
  21862. if (evt.button !== 0)
  21863. return;
  21864. clear();
  21865. handler();
  21866. document.addEventListener("mouseup", () => clear(), {
  21867. once: true
  21868. });
  21869. delayId = setTimeout(() => {
  21870. intervalId = setInterval(() => {
  21871. handler();
  21872. }, interval);
  21873. }, delay);
  21874. });
  21875. }
  21876. };
  21877. const radioPropsBase = buildProps({
  21878. size: useSizeProp,
  21879. disabled: Boolean,
  21880. label: {
  21881. type: [String, Number, Boolean],
  21882. default: ""
  21883. }
  21884. });
  21885. const radioProps = buildProps({
  21886. ...radioPropsBase,
  21887. modelValue: {
  21888. type: [String, Number, Boolean],
  21889. default: ""
  21890. },
  21891. name: {
  21892. type: String,
  21893. default: ""
  21894. },
  21895. border: Boolean
  21896. });
  21897. const radioEmits = {
  21898. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
  21899. [CHANGE_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val)
  21900. };
  21901. const radioGroupKey = Symbol("radioGroupKey");
  21902. const useRadio = (props, emit) => {
  21903. const radioRef = ref();
  21904. const radioGroup = inject(radioGroupKey, void 0);
  21905. const isGroup = computed$1(() => !!radioGroup);
  21906. const modelValue = computed$1({
  21907. get() {
  21908. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  21909. },
  21910. set(val) {
  21911. if (isGroup.value) {
  21912. radioGroup.changeEvent(val);
  21913. } else {
  21914. emit && emit(UPDATE_MODEL_EVENT, val);
  21915. }
  21916. radioRef.value.checked = props.modelValue === props.label;
  21917. }
  21918. });
  21919. const size = useFormSize(computed$1(() => radioGroup == null ? void 0 : radioGroup.size));
  21920. const disabled = useFormDisabled(computed$1(() => radioGroup == null ? void 0 : radioGroup.disabled));
  21921. const focus = ref(false);
  21922. const tabIndex = computed$1(() => {
  21923. return disabled.value || isGroup.value && modelValue.value !== props.label ? -1 : 0;
  21924. });
  21925. return {
  21926. radioRef,
  21927. isGroup,
  21928. radioGroup,
  21929. focus,
  21930. size,
  21931. disabled,
  21932. tabIndex,
  21933. modelValue
  21934. };
  21935. };
  21936. const _hoisted_1$e = ["value", "name", "disabled"];
  21937. const __default__$c = defineComponent({
  21938. name: "ElRadio"
  21939. });
  21940. const _sfc_main$m = /* @__PURE__ */ defineComponent({
  21941. ...__default__$c,
  21942. props: radioProps,
  21943. emits: radioEmits,
  21944. setup(__props, { emit }) {
  21945. const props = __props;
  21946. const ns = useNamespace("radio");
  21947. const { radioRef, radioGroup, focus, size, disabled, modelValue } = useRadio(props, emit);
  21948. function handleChange() {
  21949. nextTick(() => emit("change", modelValue.value));
  21950. }
  21951. return (_ctx, _cache) => {
  21952. var _a2;
  21953. return openBlock(), createElementBlock("label", {
  21954. class: normalizeClass([
  21955. unref(ns).b(),
  21956. unref(ns).is("disabled", unref(disabled)),
  21957. unref(ns).is("focus", unref(focus)),
  21958. unref(ns).is("bordered", _ctx.border),
  21959. unref(ns).is("checked", unref(modelValue) === _ctx.label),
  21960. unref(ns).m(unref(size))
  21961. ])
  21962. }, [
  21963. createElementVNode("span", {
  21964. class: normalizeClass([
  21965. unref(ns).e("input"),
  21966. unref(ns).is("disabled", unref(disabled)),
  21967. unref(ns).is("checked", unref(modelValue) === _ctx.label)
  21968. ])
  21969. }, [
  21970. withDirectives(createElementVNode("input", {
  21971. ref_key: "radioRef",
  21972. ref: radioRef,
  21973. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
  21974. class: normalizeClass(unref(ns).e("original")),
  21975. value: _ctx.label,
  21976. name: _ctx.name || ((_a2 = unref(radioGroup)) == null ? void 0 : _a2.name),
  21977. disabled: unref(disabled),
  21978. type: "radio",
  21979. onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
  21980. onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
  21981. onChange: handleChange
  21982. }, null, 42, _hoisted_1$e), [
  21983. [vModelRadio, unref(modelValue)]
  21984. ]),
  21985. createElementVNode("span", {
  21986. class: normalizeClass(unref(ns).e("inner"))
  21987. }, null, 2)
  21988. ], 2),
  21989. createElementVNode("span", {
  21990. class: normalizeClass(unref(ns).e("label")),
  21991. onKeydown: _cache[3] || (_cache[3] = withModifiers(() => {
  21992. }, ["stop"]))
  21993. }, [
  21994. renderSlot(_ctx.$slots, "default", {}, () => [
  21995. createTextVNode(toDisplayString(_ctx.label), 1)
  21996. ])
  21997. ], 34)
  21998. ], 2);
  21999. };
  22000. }
  22001. });
  22002. var Radio = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio.vue"]]);
  22003. const radioButtonProps = buildProps({
  22004. ...radioPropsBase,
  22005. name: {
  22006. type: String,
  22007. default: ""
  22008. }
  22009. });
  22010. const _hoisted_1$d = ["value", "name", "disabled"];
  22011. const __default__$b = defineComponent({
  22012. name: "ElRadioButton"
  22013. });
  22014. const _sfc_main$l = /* @__PURE__ */ defineComponent({
  22015. ...__default__$b,
  22016. props: radioButtonProps,
  22017. setup(__props) {
  22018. const props = __props;
  22019. const ns = useNamespace("radio");
  22020. const { radioRef, focus, size, disabled, modelValue, radioGroup } = useRadio(props);
  22021. const activeStyle = computed$1(() => {
  22022. return {
  22023. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  22024. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  22025. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  22026. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  22027. };
  22028. });
  22029. return (_ctx, _cache) => {
  22030. var _a2;
  22031. return openBlock(), createElementBlock("label", {
  22032. class: normalizeClass([
  22033. unref(ns).b("button"),
  22034. unref(ns).is("active", unref(modelValue) === _ctx.label),
  22035. unref(ns).is("disabled", unref(disabled)),
  22036. unref(ns).is("focus", unref(focus)),
  22037. unref(ns).bm("button", unref(size))
  22038. ])
  22039. }, [
  22040. withDirectives(createElementVNode("input", {
  22041. ref_key: "radioRef",
  22042. ref: radioRef,
  22043. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
  22044. class: normalizeClass(unref(ns).be("button", "original-radio")),
  22045. value: _ctx.label,
  22046. type: "radio",
  22047. name: _ctx.name || ((_a2 = unref(radioGroup)) == null ? void 0 : _a2.name),
  22048. disabled: unref(disabled),
  22049. onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
  22050. onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false)
  22051. }, null, 42, _hoisted_1$d), [
  22052. [vModelRadio, unref(modelValue)]
  22053. ]),
  22054. createElementVNode("span", {
  22055. class: normalizeClass(unref(ns).be("button", "inner")),
  22056. style: normalizeStyle(unref(modelValue) === _ctx.label ? unref(activeStyle) : {}),
  22057. onKeydown: _cache[3] || (_cache[3] = withModifiers(() => {
  22058. }, ["stop"]))
  22059. }, [
  22060. renderSlot(_ctx.$slots, "default", {}, () => [
  22061. createTextVNode(toDisplayString(_ctx.label), 1)
  22062. ])
  22063. ], 38)
  22064. ], 2);
  22065. };
  22066. }
  22067. });
  22068. var RadioButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-button.vue"]]);
  22069. const radioGroupProps = buildProps({
  22070. id: {
  22071. type: String,
  22072. default: void 0
  22073. },
  22074. size: useSizeProp,
  22075. disabled: Boolean,
  22076. modelValue: {
  22077. type: [String, Number, Boolean],
  22078. default: ""
  22079. },
  22080. fill: {
  22081. type: String,
  22082. default: ""
  22083. },
  22084. label: {
  22085. type: String,
  22086. default: void 0
  22087. },
  22088. textColor: {
  22089. type: String,
  22090. default: ""
  22091. },
  22092. name: {
  22093. type: String,
  22094. default: void 0
  22095. },
  22096. validateEvent: {
  22097. type: Boolean,
  22098. default: true
  22099. }
  22100. });
  22101. const radioGroupEmits = radioEmits;
  22102. const _hoisted_1$c = ["id", "aria-label", "aria-labelledby"];
  22103. const __default__$a = defineComponent({
  22104. name: "ElRadioGroup"
  22105. });
  22106. const _sfc_main$k = /* @__PURE__ */ defineComponent({
  22107. ...__default__$a,
  22108. props: radioGroupProps,
  22109. emits: radioGroupEmits,
  22110. setup(__props, { emit }) {
  22111. const props = __props;
  22112. const ns = useNamespace("radio");
  22113. const radioId = useId();
  22114. const radioGroupRef = ref();
  22115. const { formItem } = useFormItem();
  22116. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  22117. formItemContext: formItem
  22118. });
  22119. const changeEvent = (value) => {
  22120. emit(UPDATE_MODEL_EVENT, value);
  22121. nextTick(() => emit("change", value));
  22122. };
  22123. onMounted(() => {
  22124. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  22125. const firstLabel = radios[0];
  22126. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  22127. firstLabel.tabIndex = 0;
  22128. }
  22129. });
  22130. const name = computed$1(() => {
  22131. return props.name || radioId.value;
  22132. });
  22133. provide(radioGroupKey, reactive({
  22134. ...toRefs(props),
  22135. changeEvent,
  22136. name
  22137. }));
  22138. watch(() => props.modelValue, () => {
  22139. if (props.validateEvent) {
  22140. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  22141. }
  22142. });
  22143. return (_ctx, _cache) => {
  22144. return openBlock(), createElementBlock("div", {
  22145. id: unref(groupId),
  22146. ref_key: "radioGroupRef",
  22147. ref: radioGroupRef,
  22148. class: normalizeClass(unref(ns).b("group")),
  22149. role: "radiogroup",
  22150. "aria-label": !unref(isLabeledByFormItem) ? _ctx.label || "radio-group" : void 0,
  22151. "aria-labelledby": unref(isLabeledByFormItem) ? unref(formItem).labelId : void 0
  22152. }, [
  22153. renderSlot(_ctx.$slots, "default")
  22154. ], 10, _hoisted_1$c);
  22155. };
  22156. }
  22157. });
  22158. var RadioGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$k, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-group.vue"]]);
  22159. withInstall(Radio, {
  22160. RadioButton,
  22161. RadioGroup
  22162. });
  22163. const ElRadioGroup = withNoopInstall(RadioGroup);
  22164. const ElRadioButton = withNoopInstall(RadioButton);
  22165. const tagProps = buildProps({
  22166. closable: Boolean,
  22167. type: {
  22168. type: String,
  22169. values: ["success", "info", "warning", "danger", ""],
  22170. default: ""
  22171. },
  22172. hit: Boolean,
  22173. disableTransitions: Boolean,
  22174. color: {
  22175. type: String,
  22176. default: ""
  22177. },
  22178. size: {
  22179. type: String,
  22180. values: componentSizes,
  22181. default: ""
  22182. },
  22183. effect: {
  22184. type: String,
  22185. values: ["dark", "light", "plain"],
  22186. default: "light"
  22187. },
  22188. round: Boolean
  22189. });
  22190. const tagEmits = {
  22191. close: (evt) => evt instanceof MouseEvent,
  22192. click: (evt) => evt instanceof MouseEvent
  22193. };
  22194. const __default__$9 = defineComponent({
  22195. name: "ElTag"
  22196. });
  22197. const _sfc_main$j = /* @__PURE__ */ defineComponent({
  22198. ...__default__$9,
  22199. props: tagProps,
  22200. emits: tagEmits,
  22201. setup(__props, { emit }) {
  22202. const props = __props;
  22203. const tagSize = useFormSize();
  22204. const ns = useNamespace("tag");
  22205. const classes = computed$1(() => {
  22206. const { type: type2, hit, effect, closable, round: round2 } = props;
  22207. return [
  22208. ns.b(),
  22209. ns.is("closable", closable),
  22210. ns.m(type2),
  22211. ns.m(tagSize.value),
  22212. ns.m(effect),
  22213. ns.is("hit", hit),
  22214. ns.is("round", round2)
  22215. ];
  22216. });
  22217. const handleClose = (event2) => {
  22218. emit("close", event2);
  22219. };
  22220. const handleClick = (event2) => {
  22221. emit("click", event2);
  22222. };
  22223. return (_ctx, _cache) => {
  22224. return _ctx.disableTransitions ? (openBlock(), createElementBlock("span", {
  22225. key: 0,
  22226. class: normalizeClass(unref(classes)),
  22227. style: normalizeStyle({ backgroundColor: _ctx.color }),
  22228. onClick: handleClick
  22229. }, [
  22230. createElementVNode("span", {
  22231. class: normalizeClass(unref(ns).e("content"))
  22232. }, [
  22233. renderSlot(_ctx.$slots, "default")
  22234. ], 2),
  22235. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  22236. key: 0,
  22237. class: normalizeClass(unref(ns).e("close")),
  22238. onClick: withModifiers(handleClose, ["stop"])
  22239. }, {
  22240. default: withCtx(() => [
  22241. createVNode(unref(close_default))
  22242. ]),
  22243. _: 1
  22244. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  22245. ], 6)) : (openBlock(), createBlock(Transition, {
  22246. key: 1,
  22247. name: `${unref(ns).namespace.value}-zoom-in-center`,
  22248. appear: ""
  22249. }, {
  22250. default: withCtx(() => [
  22251. createElementVNode("span", {
  22252. class: normalizeClass(unref(classes)),
  22253. style: normalizeStyle({ backgroundColor: _ctx.color }),
  22254. onClick: handleClick
  22255. }, [
  22256. createElementVNode("span", {
  22257. class: normalizeClass(unref(ns).e("content"))
  22258. }, [
  22259. renderSlot(_ctx.$slots, "default")
  22260. ], 2),
  22261. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  22262. key: 0,
  22263. class: normalizeClass(unref(ns).e("close")),
  22264. onClick: withModifiers(handleClose, ["stop"])
  22265. }, {
  22266. default: withCtx(() => [
  22267. createVNode(unref(close_default))
  22268. ]),
  22269. _: 1
  22270. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  22271. ], 6)
  22272. ]),
  22273. _: 3
  22274. }, 8, ["name"]));
  22275. };
  22276. }
  22277. });
  22278. var Tag = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tag/src/tag.vue"]]);
  22279. const ElTag = withInstall(Tag);
  22280. const emitChangeFn = (value) => typeof isNumber(value);
  22281. const collapseProps = buildProps({
  22282. accordion: Boolean,
  22283. modelValue: {
  22284. type: definePropType([Array, String, Number]),
  22285. default: () => mutable([])
  22286. }
  22287. });
  22288. const collapseEmits = {
  22289. [UPDATE_MODEL_EVENT]: emitChangeFn,
  22290. [CHANGE_EVENT]: emitChangeFn
  22291. };
  22292. const collapseContextKey = Symbol("collapseContextKey");
  22293. const useCollapse = (props, emit) => {
  22294. const activeNames = ref(castArray(props.modelValue));
  22295. const setActiveNames = (_activeNames) => {
  22296. activeNames.value = _activeNames;
  22297. const value = props.accordion ? activeNames.value[0] : activeNames.value;
  22298. emit(UPDATE_MODEL_EVENT, value);
  22299. emit(CHANGE_EVENT, value);
  22300. };
  22301. const handleItemClick = (name) => {
  22302. if (props.accordion) {
  22303. setActiveNames([activeNames.value[0] === name ? "" : name]);
  22304. } else {
  22305. const _activeNames = [...activeNames.value];
  22306. const index2 = _activeNames.indexOf(name);
  22307. if (index2 > -1) {
  22308. _activeNames.splice(index2, 1);
  22309. } else {
  22310. _activeNames.push(name);
  22311. }
  22312. setActiveNames(_activeNames);
  22313. }
  22314. };
  22315. watch(() => props.modelValue, () => activeNames.value = castArray(props.modelValue), { deep: true });
  22316. provide(collapseContextKey, {
  22317. activeNames,
  22318. handleItemClick
  22319. });
  22320. return {
  22321. activeNames,
  22322. setActiveNames
  22323. };
  22324. };
  22325. const useCollapseDOM = () => {
  22326. const ns = useNamespace("collapse");
  22327. const rootKls = computed$1(() => ns.b());
  22328. return {
  22329. rootKls
  22330. };
  22331. };
  22332. const __default__$8 = defineComponent({
  22333. name: "ElCollapse"
  22334. });
  22335. const _sfc_main$i = /* @__PURE__ */ defineComponent({
  22336. ...__default__$8,
  22337. props: collapseProps,
  22338. emits: collapseEmits,
  22339. setup(__props, { expose, emit }) {
  22340. const props = __props;
  22341. const { activeNames, setActiveNames } = useCollapse(props, emit);
  22342. const { rootKls } = useCollapseDOM();
  22343. expose({
  22344. activeNames,
  22345. setActiveNames
  22346. });
  22347. return (_ctx, _cache) => {
  22348. return openBlock(), createElementBlock("div", {
  22349. class: normalizeClass(unref(rootKls)),
  22350. role: "tablist",
  22351. "aria-multiselectable": "true"
  22352. }, [
  22353. renderSlot(_ctx.$slots, "default")
  22354. ], 2);
  22355. };
  22356. }
  22357. });
  22358. var Collapse = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/collapse/src/collapse.vue"]]);
  22359. const __default__$7 = defineComponent({
  22360. name: "ElCollapseTransition"
  22361. });
  22362. const _sfc_main$h = /* @__PURE__ */ defineComponent({
  22363. ...__default__$7,
  22364. setup(__props) {
  22365. const ns = useNamespace("collapse-transition");
  22366. const on3 = {
  22367. beforeEnter(el) {
  22368. if (!el.dataset)
  22369. el.dataset = {};
  22370. el.dataset.oldPaddingTop = el.style.paddingTop;
  22371. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  22372. el.style.maxHeight = 0;
  22373. el.style.paddingTop = 0;
  22374. el.style.paddingBottom = 0;
  22375. },
  22376. enter(el) {
  22377. el.dataset.oldOverflow = el.style.overflow;
  22378. if (el.scrollHeight !== 0) {
  22379. el.style.maxHeight = `${el.scrollHeight}px`;
  22380. el.style.paddingTop = el.dataset.oldPaddingTop;
  22381. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  22382. } else {
  22383. el.style.maxHeight = 0;
  22384. el.style.paddingTop = el.dataset.oldPaddingTop;
  22385. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  22386. }
  22387. el.style.overflow = "hidden";
  22388. },
  22389. afterEnter(el) {
  22390. el.style.maxHeight = "";
  22391. el.style.overflow = el.dataset.oldOverflow;
  22392. },
  22393. beforeLeave(el) {
  22394. if (!el.dataset)
  22395. el.dataset = {};
  22396. el.dataset.oldPaddingTop = el.style.paddingTop;
  22397. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  22398. el.dataset.oldOverflow = el.style.overflow;
  22399. el.style.maxHeight = `${el.scrollHeight}px`;
  22400. el.style.overflow = "hidden";
  22401. },
  22402. leave(el) {
  22403. if (el.scrollHeight !== 0) {
  22404. el.style.maxHeight = 0;
  22405. el.style.paddingTop = 0;
  22406. el.style.paddingBottom = 0;
  22407. }
  22408. },
  22409. afterLeave(el) {
  22410. el.style.maxHeight = "";
  22411. el.style.overflow = el.dataset.oldOverflow;
  22412. el.style.paddingTop = el.dataset.oldPaddingTop;
  22413. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  22414. }
  22415. };
  22416. return (_ctx, _cache) => {
  22417. return openBlock(), createBlock(Transition, mergeProps({
  22418. name: unref(ns).b()
  22419. }, toHandlers(on3)), {
  22420. default: withCtx(() => [
  22421. renderSlot(_ctx.$slots, "default")
  22422. ]),
  22423. _: 3
  22424. }, 16, ["name"]);
  22425. };
  22426. }
  22427. });
  22428. var CollapseTransition = /* @__PURE__ */ _export_sfc$1(_sfc_main$h, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/collapse-transition/src/collapse-transition.vue"]]);
  22429. CollapseTransition.install = (app) => {
  22430. app.component(CollapseTransition.name, CollapseTransition);
  22431. };
  22432. const _CollapseTransition = CollapseTransition;
  22433. const collapseItemProps = buildProps({
  22434. title: {
  22435. type: String,
  22436. default: ""
  22437. },
  22438. name: {
  22439. type: definePropType([String, Number]),
  22440. default: () => generateId()
  22441. },
  22442. disabled: Boolean
  22443. });
  22444. const useCollapseItem = (props) => {
  22445. const collapse = inject(collapseContextKey);
  22446. const focusing = ref(false);
  22447. const isClick = ref(false);
  22448. const id = ref(generateId());
  22449. const isActive = computed$1(() => collapse == null ? void 0 : collapse.activeNames.value.includes(props.name));
  22450. const handleFocus = () => {
  22451. setTimeout(() => {
  22452. if (!isClick.value) {
  22453. focusing.value = true;
  22454. } else {
  22455. isClick.value = false;
  22456. }
  22457. }, 50);
  22458. };
  22459. const handleHeaderClick = () => {
  22460. if (props.disabled)
  22461. return;
  22462. collapse == null ? void 0 : collapse.handleItemClick(props.name);
  22463. focusing.value = false;
  22464. isClick.value = true;
  22465. };
  22466. const handleEnterClick = () => {
  22467. collapse == null ? void 0 : collapse.handleItemClick(props.name);
  22468. };
  22469. return {
  22470. focusing,
  22471. id,
  22472. isActive,
  22473. handleFocus,
  22474. handleHeaderClick,
  22475. handleEnterClick
  22476. };
  22477. };
  22478. const useCollapseItemDOM = (props, { focusing, isActive, id }) => {
  22479. const ns = useNamespace("collapse");
  22480. const rootKls = computed$1(() => [
  22481. ns.b("item"),
  22482. ns.is("active", unref(isActive)),
  22483. ns.is("disabled", props.disabled)
  22484. ]);
  22485. const headKls = computed$1(() => [
  22486. ns.be("item", "header"),
  22487. ns.is("active", unref(isActive)),
  22488. { focusing: unref(focusing) && !props.disabled }
  22489. ]);
  22490. const arrowKls = computed$1(() => [
  22491. ns.be("item", "arrow"),
  22492. ns.is("active", unref(isActive))
  22493. ]);
  22494. const itemWrapperKls = computed$1(() => ns.be("item", "wrap"));
  22495. const itemContentKls = computed$1(() => ns.be("item", "content"));
  22496. const scopedContentId = computed$1(() => ns.b(`content-${unref(id)}`));
  22497. const scopedHeadId = computed$1(() => ns.b(`head-${unref(id)}`));
  22498. return {
  22499. arrowKls,
  22500. headKls,
  22501. rootKls,
  22502. itemWrapperKls,
  22503. itemContentKls,
  22504. scopedContentId,
  22505. scopedHeadId
  22506. };
  22507. };
  22508. const _hoisted_1$b = ["aria-expanded", "aria-controls", "aria-describedby"];
  22509. const _hoisted_2$8 = ["id", "tabindex"];
  22510. const _hoisted_3$5 = ["id", "aria-hidden", "aria-labelledby"];
  22511. const __default__$6 = defineComponent({
  22512. name: "ElCollapseItem"
  22513. });
  22514. const _sfc_main$g = /* @__PURE__ */ defineComponent({
  22515. ...__default__$6,
  22516. props: collapseItemProps,
  22517. setup(__props, { expose }) {
  22518. const props = __props;
  22519. const {
  22520. focusing,
  22521. id,
  22522. isActive,
  22523. handleFocus,
  22524. handleHeaderClick,
  22525. handleEnterClick
  22526. } = useCollapseItem(props);
  22527. const {
  22528. arrowKls,
  22529. headKls,
  22530. rootKls,
  22531. itemWrapperKls,
  22532. itemContentKls,
  22533. scopedContentId,
  22534. scopedHeadId
  22535. } = useCollapseItemDOM(props, { focusing, isActive, id });
  22536. expose({
  22537. isActive
  22538. });
  22539. return (_ctx, _cache) => {
  22540. return openBlock(), createElementBlock("div", {
  22541. class: normalizeClass(unref(rootKls))
  22542. }, [
  22543. createElementVNode("div", {
  22544. role: "tab",
  22545. "aria-expanded": unref(isActive),
  22546. "aria-controls": unref(scopedContentId),
  22547. "aria-describedby": unref(scopedContentId)
  22548. }, [
  22549. createElementVNode("div", {
  22550. id: unref(scopedHeadId),
  22551. class: normalizeClass(unref(headKls)),
  22552. role: "button",
  22553. tabindex: _ctx.disabled ? -1 : 0,
  22554. onClick: _cache[0] || (_cache[0] = (...args) => unref(handleHeaderClick) && unref(handleHeaderClick)(...args)),
  22555. onKeypress: _cache[1] || (_cache[1] = withKeys(withModifiers((...args) => unref(handleEnterClick) && unref(handleEnterClick)(...args), ["stop", "prevent"]), ["space", "enter"])),
  22556. onFocus: _cache[2] || (_cache[2] = (...args) => unref(handleFocus) && unref(handleFocus)(...args)),
  22557. onBlur: _cache[3] || (_cache[3] = ($event) => focusing.value = false)
  22558. }, [
  22559. renderSlot(_ctx.$slots, "title", {}, () => [
  22560. createTextVNode(toDisplayString(_ctx.title), 1)
  22561. ]),
  22562. createVNode(unref(ElIcon), {
  22563. class: normalizeClass(unref(arrowKls))
  22564. }, {
  22565. default: withCtx(() => [
  22566. createVNode(unref(arrow_right_default))
  22567. ]),
  22568. _: 1
  22569. }, 8, ["class"])
  22570. ], 42, _hoisted_2$8)
  22571. ], 8, _hoisted_1$b),
  22572. createVNode(unref(_CollapseTransition), null, {
  22573. default: withCtx(() => [
  22574. withDirectives(createElementVNode("div", {
  22575. id: unref(scopedContentId),
  22576. class: normalizeClass(unref(itemWrapperKls)),
  22577. role: "tabpanel",
  22578. "aria-hidden": !unref(isActive),
  22579. "aria-labelledby": unref(scopedHeadId)
  22580. }, [
  22581. createElementVNode("div", {
  22582. class: normalizeClass(unref(itemContentKls))
  22583. }, [
  22584. renderSlot(_ctx.$slots, "default")
  22585. ], 2)
  22586. ], 10, _hoisted_3$5), [
  22587. [vShow, unref(isActive)]
  22588. ])
  22589. ]),
  22590. _: 3
  22591. })
  22592. ], 2);
  22593. };
  22594. }
  22595. });
  22596. var CollapseItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$g, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/collapse/src/collapse-item.vue"]]);
  22597. const ElCollapse = withInstall(Collapse, {
  22598. CollapseItem
  22599. });
  22600. const ElCollapseItem = withNoopInstall(CollapseItem);
  22601. const alphaSliderProps = buildProps({
  22602. color: {
  22603. type: definePropType(Object),
  22604. required: true
  22605. },
  22606. vertical: {
  22607. type: Boolean,
  22608. default: false
  22609. }
  22610. });
  22611. let isDragging = false;
  22612. function draggable(element, options2) {
  22613. if (!isClient)
  22614. return;
  22615. const moveFn = function(event2) {
  22616. var _a2;
  22617. (_a2 = options2.drag) == null ? void 0 : _a2.call(options2, event2);
  22618. };
  22619. const upFn = function(event2) {
  22620. var _a2;
  22621. document.removeEventListener("mousemove", moveFn);
  22622. document.removeEventListener("mouseup", upFn);
  22623. document.removeEventListener("touchmove", moveFn);
  22624. document.removeEventListener("touchend", upFn);
  22625. document.onselectstart = null;
  22626. document.ondragstart = null;
  22627. isDragging = false;
  22628. (_a2 = options2.end) == null ? void 0 : _a2.call(options2, event2);
  22629. };
  22630. const downFn = function(event2) {
  22631. var _a2;
  22632. if (isDragging)
  22633. return;
  22634. event2.preventDefault();
  22635. document.onselectstart = () => false;
  22636. document.ondragstart = () => false;
  22637. document.addEventListener("mousemove", moveFn);
  22638. document.addEventListener("mouseup", upFn);
  22639. document.addEventListener("touchmove", moveFn);
  22640. document.addEventListener("touchend", upFn);
  22641. isDragging = true;
  22642. (_a2 = options2.start) == null ? void 0 : _a2.call(options2, event2);
  22643. };
  22644. element.addEventListener("mousedown", downFn);
  22645. element.addEventListener("touchstart", downFn);
  22646. }
  22647. const useAlphaSlider = (props) => {
  22648. const instance = getCurrentInstance();
  22649. const thumb = shallowRef();
  22650. const bar = shallowRef();
  22651. function handleClick(event2) {
  22652. const target = event2.target;
  22653. if (target !== thumb.value) {
  22654. handleDrag(event2);
  22655. }
  22656. }
  22657. function handleDrag(event2) {
  22658. if (!bar.value || !thumb.value)
  22659. return;
  22660. const el = instance.vnode.el;
  22661. const rect = el.getBoundingClientRect();
  22662. const { clientX, clientY } = getClientXY(event2);
  22663. if (!props.vertical) {
  22664. let left = clientX - rect.left;
  22665. left = Math.max(thumb.value.offsetWidth / 2, left);
  22666. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  22667. props.color.set("alpha", Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 100));
  22668. } else {
  22669. let top = clientY - rect.top;
  22670. top = Math.max(thumb.value.offsetHeight / 2, top);
  22671. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  22672. props.color.set("alpha", Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 100));
  22673. }
  22674. }
  22675. return {
  22676. thumb,
  22677. bar,
  22678. handleDrag,
  22679. handleClick
  22680. };
  22681. };
  22682. const useAlphaSliderDOM = (props, {
  22683. bar,
  22684. thumb,
  22685. handleDrag
  22686. }) => {
  22687. const instance = getCurrentInstance();
  22688. const ns = useNamespace("color-alpha-slider");
  22689. const thumbLeft = ref(0);
  22690. const thumbTop = ref(0);
  22691. const background = ref();
  22692. function getThumbLeft() {
  22693. if (!thumb.value)
  22694. return 0;
  22695. if (props.vertical)
  22696. return 0;
  22697. const el = instance.vnode.el;
  22698. const alpha = props.color.get("alpha");
  22699. if (!el)
  22700. return 0;
  22701. return Math.round(alpha * (el.offsetWidth - thumb.value.offsetWidth / 2) / 100);
  22702. }
  22703. function getThumbTop() {
  22704. if (!thumb.value)
  22705. return 0;
  22706. const el = instance.vnode.el;
  22707. if (!props.vertical)
  22708. return 0;
  22709. const alpha = props.color.get("alpha");
  22710. if (!el)
  22711. return 0;
  22712. return Math.round(alpha * (el.offsetHeight - thumb.value.offsetHeight / 2) / 100);
  22713. }
  22714. function getBackground() {
  22715. if (props.color && props.color.value) {
  22716. const { r: r2, g, b } = props.color.toRgb();
  22717. return `linear-gradient(to right, rgba(${r2}, ${g}, ${b}, 0) 0%, rgba(${r2}, ${g}, ${b}, 1) 100%)`;
  22718. }
  22719. return "";
  22720. }
  22721. function update() {
  22722. thumbLeft.value = getThumbLeft();
  22723. thumbTop.value = getThumbTop();
  22724. background.value = getBackground();
  22725. }
  22726. onMounted(() => {
  22727. if (!bar.value || !thumb.value)
  22728. return;
  22729. const dragConfig = {
  22730. drag: (event2) => {
  22731. handleDrag(event2);
  22732. },
  22733. end: (event2) => {
  22734. handleDrag(event2);
  22735. }
  22736. };
  22737. draggable(bar.value, dragConfig);
  22738. draggable(thumb.value, dragConfig);
  22739. update();
  22740. });
  22741. watch(() => props.color.get("alpha"), () => update());
  22742. watch(() => props.color.value, () => update());
  22743. const rootKls = computed$1(() => [ns.b(), ns.is("vertical", props.vertical)]);
  22744. const barKls = computed$1(() => ns.e("bar"));
  22745. const thumbKls = computed$1(() => ns.e("thumb"));
  22746. const barStyle = computed$1(() => ({ background: background.value }));
  22747. const thumbStyle = computed$1(() => ({
  22748. left: addUnit(thumbLeft.value),
  22749. top: addUnit(thumbTop.value)
  22750. }));
  22751. return { rootKls, barKls, barStyle, thumbKls, thumbStyle, update };
  22752. };
  22753. const COMPONENT_NAME$2 = "ElColorAlphaSlider";
  22754. const __default__$5 = defineComponent({
  22755. name: COMPONENT_NAME$2
  22756. });
  22757. const _sfc_main$f = /* @__PURE__ */ defineComponent({
  22758. ...__default__$5,
  22759. props: alphaSliderProps,
  22760. setup(__props, { expose }) {
  22761. const props = __props;
  22762. const { bar, thumb, handleDrag, handleClick } = useAlphaSlider(props);
  22763. const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useAlphaSliderDOM(props, {
  22764. bar,
  22765. thumb,
  22766. handleDrag
  22767. });
  22768. expose({
  22769. update,
  22770. bar,
  22771. thumb
  22772. });
  22773. return (_ctx, _cache) => {
  22774. return openBlock(), createElementBlock("div", {
  22775. class: normalizeClass(unref(rootKls))
  22776. }, [
  22777. createElementVNode("div", {
  22778. ref_key: "bar",
  22779. ref: bar,
  22780. class: normalizeClass(unref(barKls)),
  22781. style: normalizeStyle(unref(barStyle)),
  22782. onClick: _cache[0] || (_cache[0] = (...args) => unref(handleClick) && unref(handleClick)(...args))
  22783. }, null, 6),
  22784. createElementVNode("div", {
  22785. ref_key: "thumb",
  22786. ref: thumb,
  22787. class: normalizeClass(unref(thumbKls)),
  22788. style: normalizeStyle(unref(thumbStyle))
  22789. }, null, 6)
  22790. ], 2);
  22791. };
  22792. }
  22793. });
  22794. var AlphaSlider = /* @__PURE__ */ _export_sfc$1(_sfc_main$f, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/components/alpha-slider.vue"]]);
  22795. const _sfc_main$e = defineComponent({
  22796. name: "ElColorHueSlider",
  22797. props: {
  22798. color: {
  22799. type: Object,
  22800. required: true
  22801. },
  22802. vertical: Boolean
  22803. },
  22804. setup(props) {
  22805. const ns = useNamespace("color-hue-slider");
  22806. const instance = getCurrentInstance();
  22807. const thumb = ref();
  22808. const bar = ref();
  22809. const thumbLeft = ref(0);
  22810. const thumbTop = ref(0);
  22811. const hueValue = computed$1(() => {
  22812. return props.color.get("hue");
  22813. });
  22814. watch(() => hueValue.value, () => {
  22815. update();
  22816. });
  22817. function handleClick(event2) {
  22818. const target = event2.target;
  22819. if (target !== thumb.value) {
  22820. handleDrag(event2);
  22821. }
  22822. }
  22823. function handleDrag(event2) {
  22824. if (!bar.value || !thumb.value)
  22825. return;
  22826. const el = instance.vnode.el;
  22827. const rect = el.getBoundingClientRect();
  22828. const { clientX, clientY } = getClientXY(event2);
  22829. let hue;
  22830. if (!props.vertical) {
  22831. let left = clientX - rect.left;
  22832. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  22833. left = Math.max(thumb.value.offsetWidth / 2, left);
  22834. hue = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 360);
  22835. } else {
  22836. let top = clientY - rect.top;
  22837. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  22838. top = Math.max(thumb.value.offsetHeight / 2, top);
  22839. hue = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 360);
  22840. }
  22841. props.color.set("hue", hue);
  22842. }
  22843. function getThumbLeft() {
  22844. if (!thumb.value)
  22845. return 0;
  22846. const el = instance.vnode.el;
  22847. if (props.vertical)
  22848. return 0;
  22849. const hue = props.color.get("hue");
  22850. if (!el)
  22851. return 0;
  22852. return Math.round(hue * (el.offsetWidth - thumb.value.offsetWidth / 2) / 360);
  22853. }
  22854. function getThumbTop() {
  22855. if (!thumb.value)
  22856. return 0;
  22857. const el = instance.vnode.el;
  22858. if (!props.vertical)
  22859. return 0;
  22860. const hue = props.color.get("hue");
  22861. if (!el)
  22862. return 0;
  22863. return Math.round(hue * (el.offsetHeight - thumb.value.offsetHeight / 2) / 360);
  22864. }
  22865. function update() {
  22866. thumbLeft.value = getThumbLeft();
  22867. thumbTop.value = getThumbTop();
  22868. }
  22869. onMounted(() => {
  22870. if (!bar.value || !thumb.value)
  22871. return;
  22872. const dragConfig = {
  22873. drag: (event2) => {
  22874. handleDrag(event2);
  22875. },
  22876. end: (event2) => {
  22877. handleDrag(event2);
  22878. }
  22879. };
  22880. draggable(bar.value, dragConfig);
  22881. draggable(thumb.value, dragConfig);
  22882. update();
  22883. });
  22884. return {
  22885. bar,
  22886. thumb,
  22887. thumbLeft,
  22888. thumbTop,
  22889. hueValue,
  22890. handleClick,
  22891. update,
  22892. ns
  22893. };
  22894. }
  22895. });
  22896. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  22897. return openBlock(), createElementBlock("div", {
  22898. class: normalizeClass([_ctx.ns.b(), _ctx.ns.is("vertical", _ctx.vertical)])
  22899. }, [
  22900. createElementVNode("div", {
  22901. ref: "bar",
  22902. class: normalizeClass(_ctx.ns.e("bar")),
  22903. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  22904. }, null, 2),
  22905. createElementVNode("div", {
  22906. ref: "thumb",
  22907. class: normalizeClass(_ctx.ns.e("thumb")),
  22908. style: normalizeStyle({
  22909. left: _ctx.thumbLeft + "px",
  22910. top: _ctx.thumbTop + "px"
  22911. })
  22912. }, null, 6)
  22913. ], 2);
  22914. }
  22915. var HueSlider = /* @__PURE__ */ _export_sfc$1(_sfc_main$e, [["render", _sfc_render$6], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/components/hue-slider.vue"]]);
  22916. const colorPickerProps = buildProps({
  22917. modelValue: String,
  22918. id: String,
  22919. showAlpha: Boolean,
  22920. colorFormat: String,
  22921. disabled: Boolean,
  22922. size: useSizeProp,
  22923. popperClass: {
  22924. type: String,
  22925. default: ""
  22926. },
  22927. label: {
  22928. type: String,
  22929. default: void 0
  22930. },
  22931. tabindex: {
  22932. type: [String, Number],
  22933. default: 0
  22934. },
  22935. predefine: {
  22936. type: definePropType(Array)
  22937. },
  22938. validateEvent: {
  22939. type: Boolean,
  22940. default: true
  22941. }
  22942. });
  22943. const colorPickerEmits = {
  22944. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNil(val),
  22945. [CHANGE_EVENT]: (val) => isString(val) || isNil(val),
  22946. activeChange: (val) => isString(val) || isNil(val)
  22947. };
  22948. const colorPickerContextKey = Symbol("colorPickerContextKey");
  22949. const hsv2hsl = function(hue, sat, val) {
  22950. return [
  22951. hue,
  22952. sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue) || 0,
  22953. hue / 2
  22954. ];
  22955. };
  22956. const isOnePointZero = function(n) {
  22957. return typeof n === "string" && n.includes(".") && Number.parseFloat(n) === 1;
  22958. };
  22959. const isPercentage = function(n) {
  22960. return typeof n === "string" && n.includes("%");
  22961. };
  22962. const bound01 = function(value, max2) {
  22963. if (isOnePointZero(value))
  22964. value = "100%";
  22965. const processPercent = isPercentage(value);
  22966. value = Math.min(max2, Math.max(0, Number.parseFloat(`${value}`)));
  22967. if (processPercent) {
  22968. value = Number.parseInt(`${value * max2}`, 10) / 100;
  22969. }
  22970. if (Math.abs(value - max2) < 1e-6) {
  22971. return 1;
  22972. }
  22973. return value % max2 / Number.parseFloat(max2);
  22974. };
  22975. const INT_HEX_MAP = {
  22976. 10: "A",
  22977. 11: "B",
  22978. 12: "C",
  22979. 13: "D",
  22980. 14: "E",
  22981. 15: "F"
  22982. };
  22983. const hexOne = (value) => {
  22984. value = Math.min(Math.round(value), 255);
  22985. const high = Math.floor(value / 16);
  22986. const low = value % 16;
  22987. return `${INT_HEX_MAP[high] || high}${INT_HEX_MAP[low] || low}`;
  22988. };
  22989. const toHex = function({ r: r2, g, b }) {
  22990. if (Number.isNaN(+r2) || Number.isNaN(+g) || Number.isNaN(+b))
  22991. return "";
  22992. return `#${hexOne(r2)}${hexOne(g)}${hexOne(b)}`;
  22993. };
  22994. const HEX_INT_MAP = {
  22995. A: 10,
  22996. B: 11,
  22997. C: 12,
  22998. D: 13,
  22999. E: 14,
  23000. F: 15
  23001. };
  23002. const parseHexChannel = function(hex) {
  23003. if (hex.length === 2) {
  23004. return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]);
  23005. }
  23006. return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
  23007. };
  23008. const hsl2hsv = function(hue, sat, light) {
  23009. sat = sat / 100;
  23010. light = light / 100;
  23011. let smin = sat;
  23012. const lmin = Math.max(light, 0.01);
  23013. light *= 2;
  23014. sat *= light <= 1 ? light : 2 - light;
  23015. smin *= lmin <= 1 ? lmin : 2 - lmin;
  23016. const v = (light + sat) / 2;
  23017. const sv = light === 0 ? 2 * smin / (lmin + smin) : 2 * sat / (light + sat);
  23018. return {
  23019. h: hue,
  23020. s: sv * 100,
  23021. v: v * 100
  23022. };
  23023. };
  23024. const rgb2hsv = (r2, g, b) => {
  23025. r2 = bound01(r2, 255);
  23026. g = bound01(g, 255);
  23027. b = bound01(b, 255);
  23028. const max2 = Math.max(r2, g, b);
  23029. const min2 = Math.min(r2, g, b);
  23030. let h2;
  23031. const v = max2;
  23032. const d2 = max2 - min2;
  23033. const s = max2 === 0 ? 0 : d2 / max2;
  23034. if (max2 === min2) {
  23035. h2 = 0;
  23036. } else {
  23037. switch (max2) {
  23038. case r2: {
  23039. h2 = (g - b) / d2 + (g < b ? 6 : 0);
  23040. break;
  23041. }
  23042. case g: {
  23043. h2 = (b - r2) / d2 + 2;
  23044. break;
  23045. }
  23046. case b: {
  23047. h2 = (r2 - g) / d2 + 4;
  23048. break;
  23049. }
  23050. }
  23051. h2 /= 6;
  23052. }
  23053. return { h: h2 * 360, s: s * 100, v: v * 100 };
  23054. };
  23055. const hsv2rgb = function(h2, s, v) {
  23056. h2 = bound01(h2, 360) * 6;
  23057. s = bound01(s, 100);
  23058. v = bound01(v, 100);
  23059. const i2 = Math.floor(h2);
  23060. const f = h2 - i2;
  23061. const p = v * (1 - s);
  23062. const q2 = v * (1 - f * s);
  23063. const t2 = v * (1 - (1 - f) * s);
  23064. const mod = i2 % 6;
  23065. const r2 = [v, q2, p, p, t2, v][mod];
  23066. const g = [t2, v, v, q2, p, p][mod];
  23067. const b = [p, p, t2, v, v, q2][mod];
  23068. return {
  23069. r: Math.round(r2 * 255),
  23070. g: Math.round(g * 255),
  23071. b: Math.round(b * 255)
  23072. };
  23073. };
  23074. class Color$1 {
  23075. constructor(options2 = {}) {
  23076. this._hue = 0;
  23077. this._saturation = 100;
  23078. this._value = 100;
  23079. this._alpha = 100;
  23080. this.enableAlpha = false;
  23081. this.format = "hex";
  23082. this.value = "";
  23083. for (const option in options2) {
  23084. if (hasOwn(options2, option)) {
  23085. this[option] = options2[option];
  23086. }
  23087. }
  23088. if (options2.value) {
  23089. this.fromString(options2.value);
  23090. } else {
  23091. this.doOnChange();
  23092. }
  23093. }
  23094. set(prop, value) {
  23095. if (arguments.length === 1 && typeof prop === "object") {
  23096. for (const p in prop) {
  23097. if (hasOwn(prop, p)) {
  23098. this.set(p, prop[p]);
  23099. }
  23100. }
  23101. return;
  23102. }
  23103. this[`_${prop}`] = value;
  23104. this.doOnChange();
  23105. }
  23106. get(prop) {
  23107. if (prop === "alpha") {
  23108. return Math.floor(this[`_${prop}`]);
  23109. }
  23110. return this[`_${prop}`];
  23111. }
  23112. toRgb() {
  23113. return hsv2rgb(this._hue, this._saturation, this._value);
  23114. }
  23115. fromString(value) {
  23116. if (!value) {
  23117. this._hue = 0;
  23118. this._saturation = 100;
  23119. this._value = 100;
  23120. this.doOnChange();
  23121. return;
  23122. }
  23123. const fromHSV = (h2, s, v) => {
  23124. this._hue = Math.max(0, Math.min(360, h2));
  23125. this._saturation = Math.max(0, Math.min(100, s));
  23126. this._value = Math.max(0, Math.min(100, v));
  23127. this.doOnChange();
  23128. };
  23129. if (value.includes("hsl")) {
  23130. const parts = value.replace(/hsla|hsl|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index2) => index2 > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  23131. if (parts.length === 4) {
  23132. this._alpha = Number.parseFloat(parts[3]) * 100;
  23133. } else if (parts.length === 3) {
  23134. this._alpha = 100;
  23135. }
  23136. if (parts.length >= 3) {
  23137. const { h: h2, s, v } = hsl2hsv(parts[0], parts[1], parts[2]);
  23138. fromHSV(h2, s, v);
  23139. }
  23140. } else if (value.includes("hsv")) {
  23141. const parts = value.replace(/hsva|hsv|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index2) => index2 > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  23142. if (parts.length === 4) {
  23143. this._alpha = Number.parseFloat(parts[3]) * 100;
  23144. } else if (parts.length === 3) {
  23145. this._alpha = 100;
  23146. }
  23147. if (parts.length >= 3) {
  23148. fromHSV(parts[0], parts[1], parts[2]);
  23149. }
  23150. } else if (value.includes("rgb")) {
  23151. const parts = value.replace(/rgba|rgb|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index2) => index2 > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  23152. if (parts.length === 4) {
  23153. this._alpha = Number.parseFloat(parts[3]) * 100;
  23154. } else if (parts.length === 3) {
  23155. this._alpha = 100;
  23156. }
  23157. if (parts.length >= 3) {
  23158. const { h: h2, s, v } = rgb2hsv(parts[0], parts[1], parts[2]);
  23159. fromHSV(h2, s, v);
  23160. }
  23161. } else if (value.includes("#")) {
  23162. const hex = value.replace("#", "").trim();
  23163. if (!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(hex))
  23164. return;
  23165. let r2, g, b;
  23166. if (hex.length === 3) {
  23167. r2 = parseHexChannel(hex[0] + hex[0]);
  23168. g = parseHexChannel(hex[1] + hex[1]);
  23169. b = parseHexChannel(hex[2] + hex[2]);
  23170. } else if (hex.length === 6 || hex.length === 8) {
  23171. r2 = parseHexChannel(hex.slice(0, 2));
  23172. g = parseHexChannel(hex.slice(2, 4));
  23173. b = parseHexChannel(hex.slice(4, 6));
  23174. }
  23175. if (hex.length === 8) {
  23176. this._alpha = parseHexChannel(hex.slice(6)) / 255 * 100;
  23177. } else if (hex.length === 3 || hex.length === 6) {
  23178. this._alpha = 100;
  23179. }
  23180. const { h: h2, s, v } = rgb2hsv(r2, g, b);
  23181. fromHSV(h2, s, v);
  23182. }
  23183. }
  23184. compare(color2) {
  23185. return Math.abs(color2._hue - this._hue) < 2 && Math.abs(color2._saturation - this._saturation) < 1 && Math.abs(color2._value - this._value) < 1 && Math.abs(color2._alpha - this._alpha) < 1;
  23186. }
  23187. doOnChange() {
  23188. const { _hue, _saturation, _value, _alpha, format } = this;
  23189. if (this.enableAlpha) {
  23190. switch (format) {
  23191. case "hsl": {
  23192. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  23193. this.value = `hsla(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%, ${this.get("alpha") / 100})`;
  23194. break;
  23195. }
  23196. case "hsv": {
  23197. this.value = `hsva(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%, ${this.get("alpha") / 100})`;
  23198. break;
  23199. }
  23200. case "hex": {
  23201. this.value = `${toHex(hsv2rgb(_hue, _saturation, _value))}${hexOne(_alpha * 255 / 100)}`;
  23202. break;
  23203. }
  23204. default: {
  23205. const { r: r2, g, b } = hsv2rgb(_hue, _saturation, _value);
  23206. this.value = `rgba(${r2}, ${g}, ${b}, ${this.get("alpha") / 100})`;
  23207. }
  23208. }
  23209. } else {
  23210. switch (format) {
  23211. case "hsl": {
  23212. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  23213. this.value = `hsl(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%)`;
  23214. break;
  23215. }
  23216. case "hsv": {
  23217. this.value = `hsv(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%)`;
  23218. break;
  23219. }
  23220. case "rgb": {
  23221. const { r: r2, g, b } = hsv2rgb(_hue, _saturation, _value);
  23222. this.value = `rgb(${r2}, ${g}, ${b})`;
  23223. break;
  23224. }
  23225. default: {
  23226. this.value = toHex(hsv2rgb(_hue, _saturation, _value));
  23227. }
  23228. }
  23229. }
  23230. }
  23231. }
  23232. const _sfc_main$d = defineComponent({
  23233. props: {
  23234. colors: {
  23235. type: Array,
  23236. required: true
  23237. },
  23238. color: {
  23239. type: Object,
  23240. required: true
  23241. }
  23242. },
  23243. setup(props) {
  23244. const ns = useNamespace("color-predefine");
  23245. const { currentColor } = inject(colorPickerContextKey);
  23246. const rgbaColors = ref(parseColors(props.colors, props.color));
  23247. watch(() => currentColor.value, (val) => {
  23248. const color2 = new Color$1();
  23249. color2.fromString(val);
  23250. rgbaColors.value.forEach((item) => {
  23251. item.selected = color2.compare(item);
  23252. });
  23253. });
  23254. watchEffect(() => {
  23255. rgbaColors.value = parseColors(props.colors, props.color);
  23256. });
  23257. function handleSelect(index2) {
  23258. props.color.fromString(props.colors[index2]);
  23259. }
  23260. function parseColors(colors, color2) {
  23261. return colors.map((value) => {
  23262. const c = new Color$1();
  23263. c.enableAlpha = true;
  23264. c.format = "rgba";
  23265. c.fromString(value);
  23266. c.selected = c.value === color2.value;
  23267. return c;
  23268. });
  23269. }
  23270. return {
  23271. rgbaColors,
  23272. handleSelect,
  23273. ns
  23274. };
  23275. }
  23276. });
  23277. const _hoisted_1$a = ["onClick"];
  23278. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  23279. return openBlock(), createElementBlock("div", {
  23280. class: normalizeClass(_ctx.ns.b())
  23281. }, [
  23282. createElementVNode("div", {
  23283. class: normalizeClass(_ctx.ns.e("colors"))
  23284. }, [
  23285. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rgbaColors, (item, index2) => {
  23286. return openBlock(), createElementBlock("div", {
  23287. key: _ctx.colors[index2],
  23288. class: normalizeClass([
  23289. _ctx.ns.e("color-selector"),
  23290. _ctx.ns.is("alpha", item._alpha < 100),
  23291. { selected: item.selected }
  23292. ]),
  23293. onClick: ($event) => _ctx.handleSelect(index2)
  23294. }, [
  23295. createElementVNode("div", {
  23296. style: normalizeStyle({ backgroundColor: item.value })
  23297. }, null, 4)
  23298. ], 10, _hoisted_1$a);
  23299. }), 128))
  23300. ], 2)
  23301. ], 2);
  23302. }
  23303. var Predefine = /* @__PURE__ */ _export_sfc$1(_sfc_main$d, [["render", _sfc_render$5], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/components/predefine.vue"]]);
  23304. const _sfc_main$c = defineComponent({
  23305. name: "ElSlPanel",
  23306. props: {
  23307. color: {
  23308. type: Object,
  23309. required: true
  23310. }
  23311. },
  23312. setup(props) {
  23313. const ns = useNamespace("color-svpanel");
  23314. const instance = getCurrentInstance();
  23315. const cursorTop = ref(0);
  23316. const cursorLeft = ref(0);
  23317. const background = ref("hsl(0, 100%, 50%)");
  23318. const colorValue = computed$1(() => {
  23319. const hue = props.color.get("hue");
  23320. const value = props.color.get("value");
  23321. return { hue, value };
  23322. });
  23323. function update() {
  23324. const saturation = props.color.get("saturation");
  23325. const value = props.color.get("value");
  23326. const el = instance.vnode.el;
  23327. const { clientWidth: width2, clientHeight: height2 } = el;
  23328. cursorLeft.value = saturation * width2 / 100;
  23329. cursorTop.value = (100 - value) * height2 / 100;
  23330. background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
  23331. }
  23332. function handleDrag(event2) {
  23333. const el = instance.vnode.el;
  23334. const rect = el.getBoundingClientRect();
  23335. const { clientX, clientY } = getClientXY(event2);
  23336. let left = clientX - rect.left;
  23337. let top = clientY - rect.top;
  23338. left = Math.max(0, left);
  23339. left = Math.min(left, rect.width);
  23340. top = Math.max(0, top);
  23341. top = Math.min(top, rect.height);
  23342. cursorLeft.value = left;
  23343. cursorTop.value = top;
  23344. props.color.set({
  23345. saturation: left / rect.width * 100,
  23346. value: 100 - top / rect.height * 100
  23347. });
  23348. }
  23349. watch(() => colorValue.value, () => {
  23350. update();
  23351. });
  23352. onMounted(() => {
  23353. draggable(instance.vnode.el, {
  23354. drag: (event2) => {
  23355. handleDrag(event2);
  23356. },
  23357. end: (event2) => {
  23358. handleDrag(event2);
  23359. }
  23360. });
  23361. update();
  23362. });
  23363. return {
  23364. cursorTop,
  23365. cursorLeft,
  23366. background,
  23367. colorValue,
  23368. handleDrag,
  23369. update,
  23370. ns
  23371. };
  23372. }
  23373. });
  23374. const _hoisted_1$9 = /* @__PURE__ */ createElementVNode("div", null, null, -1);
  23375. const _hoisted_2$7 = [
  23376. _hoisted_1$9
  23377. ];
  23378. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  23379. return openBlock(), createElementBlock("div", {
  23380. class: normalizeClass(_ctx.ns.b()),
  23381. style: normalizeStyle({
  23382. backgroundColor: _ctx.background
  23383. })
  23384. }, [
  23385. createElementVNode("div", {
  23386. class: normalizeClass(_ctx.ns.e("white"))
  23387. }, null, 2),
  23388. createElementVNode("div", {
  23389. class: normalizeClass(_ctx.ns.e("black"))
  23390. }, null, 2),
  23391. createElementVNode("div", {
  23392. class: normalizeClass(_ctx.ns.e("cursor")),
  23393. style: normalizeStyle({
  23394. top: _ctx.cursorTop + "px",
  23395. left: _ctx.cursorLeft + "px"
  23396. })
  23397. }, _hoisted_2$7, 6)
  23398. ], 6);
  23399. }
  23400. var SvPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["render", _sfc_render$4], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/components/sv-panel.vue"]]);
  23401. const _hoisted_1$8 = ["id", "aria-label", "aria-labelledby", "aria-description", "tabindex", "onKeydown"];
  23402. const __default__$4 = defineComponent({
  23403. name: "ElColorPicker"
  23404. });
  23405. const _sfc_main$b = /* @__PURE__ */ defineComponent({
  23406. ...__default__$4,
  23407. props: colorPickerProps,
  23408. emits: colorPickerEmits,
  23409. setup(__props, { expose, emit }) {
  23410. const props = __props;
  23411. const { t: t2 } = useLocale();
  23412. const ns = useNamespace("color");
  23413. const { formItem } = useFormItem();
  23414. const colorSize = useFormSize();
  23415. const colorDisabled = useFormDisabled();
  23416. const { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, {
  23417. formItemContext: formItem
  23418. });
  23419. const hue = ref();
  23420. const sv = ref();
  23421. const alpha = ref();
  23422. const popper = ref();
  23423. let shouldActiveChange = true;
  23424. const color2 = reactive(new Color$1({
  23425. enableAlpha: props.showAlpha,
  23426. format: props.colorFormat || "",
  23427. value: props.modelValue
  23428. }));
  23429. const showPicker = ref(false);
  23430. const showPanelColor = ref(false);
  23431. const customInput = ref("");
  23432. const displayedColor = computed$1(() => {
  23433. if (!props.modelValue && !showPanelColor.value) {
  23434. return "transparent";
  23435. }
  23436. return displayedRgb(color2, props.showAlpha);
  23437. });
  23438. const currentColor = computed$1(() => {
  23439. return !props.modelValue && !showPanelColor.value ? "" : color2.value;
  23440. });
  23441. const buttonAriaLabel = computed$1(() => {
  23442. return !isLabeledByFormItem.value ? props.label || t2("el.colorpicker.defaultLabel") : void 0;
  23443. });
  23444. const buttonAriaLabelledby = computed$1(() => {
  23445. return isLabeledByFormItem.value ? formItem == null ? void 0 : formItem.labelId : void 0;
  23446. });
  23447. const btnKls = computed$1(() => {
  23448. return [
  23449. ns.b("picker"),
  23450. ns.is("disabled", colorDisabled.value),
  23451. ns.bm("picker", colorSize.value)
  23452. ];
  23453. });
  23454. function displayedRgb(color22, showAlpha) {
  23455. if (!(color22 instanceof Color$1)) {
  23456. throw new TypeError("color should be instance of _color Class");
  23457. }
  23458. const { r: r2, g, b } = color22.toRgb();
  23459. return showAlpha ? `rgba(${r2}, ${g}, ${b}, ${color22.get("alpha") / 100})` : `rgb(${r2}, ${g}, ${b})`;
  23460. }
  23461. function setShowPicker(value) {
  23462. showPicker.value = value;
  23463. }
  23464. const debounceSetShowPicker = debounce$2(setShowPicker, 100);
  23465. function show() {
  23466. if (colorDisabled.value)
  23467. return;
  23468. setShowPicker(true);
  23469. }
  23470. function hide() {
  23471. debounceSetShowPicker(false);
  23472. resetColor();
  23473. }
  23474. function resetColor() {
  23475. nextTick(() => {
  23476. if (props.modelValue) {
  23477. color2.fromString(props.modelValue);
  23478. } else {
  23479. color2.value = "";
  23480. nextTick(() => {
  23481. showPanelColor.value = false;
  23482. });
  23483. }
  23484. });
  23485. }
  23486. function handleTrigger() {
  23487. if (colorDisabled.value)
  23488. return;
  23489. debounceSetShowPicker(!showPicker.value);
  23490. }
  23491. function handleConfirm() {
  23492. color2.fromString(customInput.value);
  23493. }
  23494. function confirmValue() {
  23495. const value = color2.value;
  23496. emit(UPDATE_MODEL_EVENT, value);
  23497. emit("change", value);
  23498. if (props.validateEvent) {
  23499. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  23500. }
  23501. debounceSetShowPicker(false);
  23502. nextTick(() => {
  23503. const newColor = new Color$1({
  23504. enableAlpha: props.showAlpha,
  23505. format: props.colorFormat || "",
  23506. value: props.modelValue
  23507. });
  23508. if (!color2.compare(newColor)) {
  23509. resetColor();
  23510. }
  23511. });
  23512. }
  23513. function clear() {
  23514. debounceSetShowPicker(false);
  23515. emit(UPDATE_MODEL_EVENT, null);
  23516. emit("change", null);
  23517. if (props.modelValue !== null && props.validateEvent) {
  23518. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  23519. }
  23520. resetColor();
  23521. }
  23522. onMounted(() => {
  23523. if (props.modelValue) {
  23524. customInput.value = currentColor.value;
  23525. }
  23526. });
  23527. watch(() => props.modelValue, (newVal) => {
  23528. if (!newVal) {
  23529. showPanelColor.value = false;
  23530. } else if (newVal && newVal !== color2.value) {
  23531. shouldActiveChange = false;
  23532. color2.fromString(newVal);
  23533. }
  23534. });
  23535. watch(() => currentColor.value, (val) => {
  23536. customInput.value = val;
  23537. shouldActiveChange && emit("activeChange", val);
  23538. shouldActiveChange = true;
  23539. });
  23540. watch(() => color2.value, () => {
  23541. if (!props.modelValue && !showPanelColor.value) {
  23542. showPanelColor.value = true;
  23543. }
  23544. });
  23545. watch(() => showPicker.value, () => {
  23546. nextTick(() => {
  23547. var _a2, _b, _c;
  23548. (_a2 = hue.value) == null ? void 0 : _a2.update();
  23549. (_b = sv.value) == null ? void 0 : _b.update();
  23550. (_c = alpha.value) == null ? void 0 : _c.update();
  23551. });
  23552. });
  23553. provide(colorPickerContextKey, {
  23554. currentColor
  23555. });
  23556. expose({
  23557. color: color2,
  23558. show,
  23559. hide
  23560. });
  23561. return (_ctx, _cache) => {
  23562. return openBlock(), createBlock(unref(ElTooltip), {
  23563. ref_key: "popper",
  23564. ref: popper,
  23565. visible: showPicker.value,
  23566. "show-arrow": false,
  23567. "fallback-placements": ["bottom", "top", "right", "left"],
  23568. offset: 0,
  23569. "gpu-acceleration": false,
  23570. "popper-class": [unref(ns).be("picker", "panel"), unref(ns).b("dropdown"), _ctx.popperClass],
  23571. "stop-popper-mouse-event": false,
  23572. effect: "light",
  23573. trigger: "click",
  23574. transition: `${unref(ns).namespace.value}-zoom-in-top`,
  23575. persistent: ""
  23576. }, {
  23577. content: withCtx(() => [
  23578. withDirectives((openBlock(), createElementBlock("div", null, [
  23579. createElementVNode("div", {
  23580. class: normalizeClass(unref(ns).be("dropdown", "main-wrapper"))
  23581. }, [
  23582. createVNode(HueSlider, {
  23583. ref_key: "hue",
  23584. ref: hue,
  23585. class: "hue-slider",
  23586. color: unref(color2),
  23587. vertical: ""
  23588. }, null, 8, ["color"]),
  23589. createVNode(SvPanel, {
  23590. ref: "svPanel",
  23591. color: unref(color2)
  23592. }, null, 8, ["color"])
  23593. ], 2),
  23594. _ctx.showAlpha ? (openBlock(), createBlock(AlphaSlider, {
  23595. key: 0,
  23596. ref_key: "alpha",
  23597. ref: alpha,
  23598. color: unref(color2)
  23599. }, null, 8, ["color"])) : createCommentVNode("v-if", true),
  23600. _ctx.predefine ? (openBlock(), createBlock(Predefine, {
  23601. key: 1,
  23602. ref: "predefine",
  23603. color: unref(color2),
  23604. colors: _ctx.predefine
  23605. }, null, 8, ["color", "colors"])) : createCommentVNode("v-if", true),
  23606. createElementVNode("div", {
  23607. class: normalizeClass(unref(ns).be("dropdown", "btns"))
  23608. }, [
  23609. createElementVNode("span", {
  23610. class: normalizeClass(unref(ns).be("dropdown", "value"))
  23611. }, [
  23612. createVNode(unref(ElInput), {
  23613. modelValue: customInput.value,
  23614. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => customInput.value = $event),
  23615. "validate-event": false,
  23616. size: "small",
  23617. onKeyup: withKeys(handleConfirm, ["enter"]),
  23618. onBlur: handleConfirm
  23619. }, null, 8, ["modelValue", "onKeyup"])
  23620. ], 2),
  23621. createVNode(unref(ElButton), {
  23622. class: normalizeClass(unref(ns).be("dropdown", "link-btn")),
  23623. text: "",
  23624. size: "small",
  23625. onClick: clear
  23626. }, {
  23627. default: withCtx(() => [
  23628. createTextVNode(toDisplayString(unref(t2)("el.colorpicker.clear")), 1)
  23629. ]),
  23630. _: 1
  23631. }, 8, ["class"]),
  23632. createVNode(unref(ElButton), {
  23633. plain: "",
  23634. size: "small",
  23635. class: normalizeClass(unref(ns).be("dropdown", "btn")),
  23636. onClick: confirmValue
  23637. }, {
  23638. default: withCtx(() => [
  23639. createTextVNode(toDisplayString(unref(t2)("el.colorpicker.confirm")), 1)
  23640. ]),
  23641. _: 1
  23642. }, 8, ["class"])
  23643. ], 2)
  23644. ])), [
  23645. [unref(ClickOutside), hide]
  23646. ])
  23647. ]),
  23648. default: withCtx(() => [
  23649. createElementVNode("div", {
  23650. id: unref(buttonId),
  23651. class: normalizeClass(unref(btnKls)),
  23652. role: "button",
  23653. "aria-label": unref(buttonAriaLabel),
  23654. "aria-labelledby": unref(buttonAriaLabelledby),
  23655. "aria-description": unref(t2)("el.colorpicker.description", { color: _ctx.modelValue || "" }),
  23656. tabindex: _ctx.tabindex,
  23657. onKeydown: withKeys(handleTrigger, ["enter"])
  23658. }, [
  23659. unref(colorDisabled) ? (openBlock(), createElementBlock("div", {
  23660. key: 0,
  23661. class: normalizeClass(unref(ns).be("picker", "mask"))
  23662. }, null, 2)) : createCommentVNode("v-if", true),
  23663. createElementVNode("div", {
  23664. class: normalizeClass(unref(ns).be("picker", "trigger")),
  23665. onClick: handleTrigger
  23666. }, [
  23667. createElementVNode("span", {
  23668. class: normalizeClass([unref(ns).be("picker", "color"), unref(ns).is("alpha", _ctx.showAlpha)])
  23669. }, [
  23670. createElementVNode("span", {
  23671. class: normalizeClass(unref(ns).be("picker", "color-inner")),
  23672. style: normalizeStyle({
  23673. backgroundColor: unref(displayedColor)
  23674. })
  23675. }, [
  23676. withDirectives(createVNode(unref(ElIcon), {
  23677. class: normalizeClass([unref(ns).be("picker", "icon"), unref(ns).is("icon-arrow-down")])
  23678. }, {
  23679. default: withCtx(() => [
  23680. createVNode(unref(arrow_down_default))
  23681. ]),
  23682. _: 1
  23683. }, 8, ["class"]), [
  23684. [vShow, _ctx.modelValue || showPanelColor.value]
  23685. ]),
  23686. !_ctx.modelValue && !showPanelColor.value ? (openBlock(), createBlock(unref(ElIcon), {
  23687. key: 0,
  23688. class: normalizeClass([unref(ns).be("picker", "empty"), unref(ns).is("icon-close")])
  23689. }, {
  23690. default: withCtx(() => [
  23691. createVNode(unref(close_default))
  23692. ]),
  23693. _: 1
  23694. }, 8, ["class"])) : createCommentVNode("v-if", true)
  23695. ], 6)
  23696. ], 2)
  23697. ], 2)
  23698. ], 42, _hoisted_1$8)
  23699. ]),
  23700. _: 1
  23701. }, 8, ["visible", "popper-class", "transition"]);
  23702. };
  23703. }
  23704. });
  23705. var ColorPicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/color-picker.vue"]]);
  23706. const ElColorPicker = withInstall(ColorPicker);
  23707. const overlayProps = buildProps({
  23708. mask: {
  23709. type: Boolean,
  23710. default: true
  23711. },
  23712. customMaskEvent: {
  23713. type: Boolean,
  23714. default: false
  23715. },
  23716. overlayClass: {
  23717. type: definePropType([
  23718. String,
  23719. Array,
  23720. Object
  23721. ])
  23722. },
  23723. zIndex: {
  23724. type: definePropType([String, Number])
  23725. }
  23726. });
  23727. const overlayEmits = {
  23728. click: (evt) => evt instanceof MouseEvent
  23729. };
  23730. const BLOCK = "overlay";
  23731. var Overlay = defineComponent({
  23732. name: "ElOverlay",
  23733. props: overlayProps,
  23734. emits: overlayEmits,
  23735. setup(props, { slots, emit }) {
  23736. const ns = useNamespace(BLOCK);
  23737. const onMaskClick = (e) => {
  23738. emit("click", e);
  23739. };
  23740. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  23741. return () => {
  23742. return props.mask ? createVNode("div", {
  23743. class: [ns.b(), props.overlayClass],
  23744. style: {
  23745. zIndex: props.zIndex
  23746. },
  23747. onClick,
  23748. onMousedown,
  23749. onMouseup
  23750. }, [renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : h("div", {
  23751. class: props.overlayClass,
  23752. style: {
  23753. zIndex: props.zIndex,
  23754. position: "fixed",
  23755. top: "0px",
  23756. right: "0px",
  23757. bottom: "0px",
  23758. left: "0px"
  23759. }
  23760. }, [renderSlot(slots, "default")]);
  23761. };
  23762. }
  23763. });
  23764. const ElOverlay = Overlay;
  23765. const dialogInjectionKey = Symbol("dialogInjectionKey");
  23766. const dialogContentProps = buildProps({
  23767. center: {
  23768. type: Boolean,
  23769. default: false
  23770. },
  23771. alignCenter: {
  23772. type: Boolean,
  23773. default: false
  23774. },
  23775. closeIcon: {
  23776. type: iconPropType
  23777. },
  23778. customClass: {
  23779. type: String,
  23780. default: ""
  23781. },
  23782. draggable: {
  23783. type: Boolean,
  23784. default: false
  23785. },
  23786. fullscreen: {
  23787. type: Boolean,
  23788. default: false
  23789. },
  23790. showClose: {
  23791. type: Boolean,
  23792. default: true
  23793. },
  23794. title: {
  23795. type: String,
  23796. default: ""
  23797. }
  23798. });
  23799. const dialogContentEmits = {
  23800. close: () => true
  23801. };
  23802. const _hoisted_1$7 = ["aria-label"];
  23803. const _hoisted_2$6 = ["id"];
  23804. const __default__$3 = defineComponent({ name: "ElDialogContent" });
  23805. const _sfc_main$a = /* @__PURE__ */ defineComponent({
  23806. ...__default__$3,
  23807. props: dialogContentProps,
  23808. emits: dialogContentEmits,
  23809. setup(__props) {
  23810. const props = __props;
  23811. const { t: t2 } = useLocale();
  23812. const { Close } = CloseComponents;
  23813. const { dialogRef, headerRef, bodyId, ns, style } = inject(dialogInjectionKey);
  23814. const { focusTrapRef } = inject(FOCUS_TRAP_INJECTION_KEY);
  23815. const composedDialogRef = composeRefs(focusTrapRef, dialogRef);
  23816. const draggable2 = computed$1(() => props.draggable);
  23817. useDraggable(dialogRef, headerRef, draggable2);
  23818. return (_ctx, _cache) => {
  23819. return openBlock(), createElementBlock("div", {
  23820. ref: unref(composedDialogRef),
  23821. class: normalizeClass([
  23822. unref(ns).b(),
  23823. unref(ns).is("fullscreen", _ctx.fullscreen),
  23824. unref(ns).is("draggable", unref(draggable2)),
  23825. unref(ns).is("align-center", _ctx.alignCenter),
  23826. { [unref(ns).m("center")]: _ctx.center },
  23827. _ctx.customClass
  23828. ]),
  23829. style: normalizeStyle(unref(style)),
  23830. tabindex: "-1"
  23831. }, [
  23832. createElementVNode("header", {
  23833. ref_key: "headerRef",
  23834. ref: headerRef,
  23835. class: normalizeClass(unref(ns).e("header"))
  23836. }, [
  23837. renderSlot(_ctx.$slots, "header", {}, () => [
  23838. createElementVNode("span", {
  23839. role: "heading",
  23840. class: normalizeClass(unref(ns).e("title"))
  23841. }, toDisplayString(_ctx.title), 3)
  23842. ]),
  23843. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  23844. key: 0,
  23845. "aria-label": unref(t2)("el.dialog.close"),
  23846. class: normalizeClass(unref(ns).e("headerbtn")),
  23847. type: "button",
  23848. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  23849. }, [
  23850. createVNode(unref(ElIcon), {
  23851. class: normalizeClass(unref(ns).e("close"))
  23852. }, {
  23853. default: withCtx(() => [
  23854. (openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || unref(Close))))
  23855. ]),
  23856. _: 1
  23857. }, 8, ["class"])
  23858. ], 10, _hoisted_1$7)) : createCommentVNode("v-if", true)
  23859. ], 2),
  23860. createElementVNode("div", {
  23861. id: unref(bodyId),
  23862. class: normalizeClass(unref(ns).e("body"))
  23863. }, [
  23864. renderSlot(_ctx.$slots, "default")
  23865. ], 10, _hoisted_2$6),
  23866. _ctx.$slots.footer ? (openBlock(), createElementBlock("footer", {
  23867. key: 0,
  23868. class: normalizeClass(unref(ns).e("footer"))
  23869. }, [
  23870. renderSlot(_ctx.$slots, "footer")
  23871. ], 2)) : createCommentVNode("v-if", true)
  23872. ], 6);
  23873. };
  23874. }
  23875. });
  23876. var ElDialogContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog-content.vue"]]);
  23877. const dialogProps = buildProps({
  23878. ...dialogContentProps,
  23879. appendToBody: {
  23880. type: Boolean,
  23881. default: false
  23882. },
  23883. beforeClose: {
  23884. type: definePropType(Function)
  23885. },
  23886. destroyOnClose: {
  23887. type: Boolean,
  23888. default: false
  23889. },
  23890. closeOnClickModal: {
  23891. type: Boolean,
  23892. default: true
  23893. },
  23894. closeOnPressEscape: {
  23895. type: Boolean,
  23896. default: true
  23897. },
  23898. lockScroll: {
  23899. type: Boolean,
  23900. default: true
  23901. },
  23902. modal: {
  23903. type: Boolean,
  23904. default: true
  23905. },
  23906. openDelay: {
  23907. type: Number,
  23908. default: 0
  23909. },
  23910. closeDelay: {
  23911. type: Number,
  23912. default: 0
  23913. },
  23914. top: {
  23915. type: String
  23916. },
  23917. modelValue: {
  23918. type: Boolean,
  23919. default: false
  23920. },
  23921. modalClass: String,
  23922. width: {
  23923. type: [String, Number]
  23924. },
  23925. zIndex: {
  23926. type: Number
  23927. },
  23928. trapFocus: {
  23929. type: Boolean,
  23930. default: false
  23931. }
  23932. });
  23933. const dialogEmits = {
  23934. open: () => true,
  23935. opened: () => true,
  23936. close: () => true,
  23937. closed: () => true,
  23938. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  23939. openAutoFocus: () => true,
  23940. closeAutoFocus: () => true
  23941. };
  23942. const useDialog = (props, targetRef) => {
  23943. const instance = getCurrentInstance();
  23944. const emit = instance.emit;
  23945. const { nextZIndex } = useZIndex();
  23946. let lastPosition = "";
  23947. const titleId = useId();
  23948. const bodyId = useId();
  23949. const visible = ref(false);
  23950. const closed = ref(false);
  23951. const rendered = ref(false);
  23952. const zIndex2 = ref(props.zIndex || nextZIndex());
  23953. let openTimer = void 0;
  23954. let closeTimer = void 0;
  23955. const namespace = useGlobalConfig("namespace", defaultNamespace);
  23956. const style = computed$1(() => {
  23957. const style2 = {};
  23958. const varPrefix = `--${namespace.value}-dialog`;
  23959. if (!props.fullscreen) {
  23960. if (props.top) {
  23961. style2[`${varPrefix}-margin-top`] = props.top;
  23962. }
  23963. if (props.width) {
  23964. style2[`${varPrefix}-width`] = addUnit(props.width);
  23965. }
  23966. }
  23967. return style2;
  23968. });
  23969. const overlayDialogStyle = computed$1(() => {
  23970. if (props.alignCenter) {
  23971. return { display: "flex" };
  23972. }
  23973. return {};
  23974. });
  23975. function afterEnter() {
  23976. emit("opened");
  23977. }
  23978. function afterLeave() {
  23979. emit("closed");
  23980. emit(UPDATE_MODEL_EVENT, false);
  23981. if (props.destroyOnClose) {
  23982. rendered.value = false;
  23983. }
  23984. }
  23985. function beforeLeave() {
  23986. emit("close");
  23987. }
  23988. function open() {
  23989. closeTimer == null ? void 0 : closeTimer();
  23990. openTimer == null ? void 0 : openTimer();
  23991. if (props.openDelay && props.openDelay > 0) {
  23992. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  23993. } else {
  23994. doOpen();
  23995. }
  23996. }
  23997. function close() {
  23998. openTimer == null ? void 0 : openTimer();
  23999. closeTimer == null ? void 0 : closeTimer();
  24000. if (props.closeDelay && props.closeDelay > 0) {
  24001. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  24002. } else {
  24003. doClose();
  24004. }
  24005. }
  24006. function handleClose() {
  24007. function hide(shouldCancel) {
  24008. if (shouldCancel)
  24009. return;
  24010. closed.value = true;
  24011. visible.value = false;
  24012. }
  24013. if (props.beforeClose) {
  24014. props.beforeClose(hide);
  24015. } else {
  24016. close();
  24017. }
  24018. }
  24019. function onModalClick() {
  24020. if (props.closeOnClickModal) {
  24021. handleClose();
  24022. }
  24023. }
  24024. function doOpen() {
  24025. if (!isClient)
  24026. return;
  24027. visible.value = true;
  24028. }
  24029. function doClose() {
  24030. visible.value = false;
  24031. }
  24032. function onOpenAutoFocus() {
  24033. emit("openAutoFocus");
  24034. }
  24035. function onCloseAutoFocus() {
  24036. emit("closeAutoFocus");
  24037. }
  24038. function onFocusoutPrevented(event2) {
  24039. var _a2;
  24040. if (((_a2 = event2.detail) == null ? void 0 : _a2.focusReason) === "pointer") {
  24041. event2.preventDefault();
  24042. }
  24043. }
  24044. if (props.lockScroll) {
  24045. useLockscreen(visible);
  24046. }
  24047. function onCloseRequested() {
  24048. if (props.closeOnPressEscape) {
  24049. handleClose();
  24050. }
  24051. }
  24052. watch(() => props.modelValue, (val) => {
  24053. if (val) {
  24054. closed.value = false;
  24055. open();
  24056. rendered.value = true;
  24057. zIndex2.value = props.zIndex ? zIndex2.value++ : nextZIndex();
  24058. nextTick(() => {
  24059. emit("open");
  24060. if (targetRef.value) {
  24061. targetRef.value.scrollTop = 0;
  24062. }
  24063. });
  24064. } else {
  24065. if (visible.value) {
  24066. close();
  24067. }
  24068. }
  24069. });
  24070. watch(() => props.fullscreen, (val) => {
  24071. if (!targetRef.value)
  24072. return;
  24073. if (val) {
  24074. lastPosition = targetRef.value.style.transform;
  24075. targetRef.value.style.transform = "";
  24076. } else {
  24077. targetRef.value.style.transform = lastPosition;
  24078. }
  24079. });
  24080. onMounted(() => {
  24081. if (props.modelValue) {
  24082. visible.value = true;
  24083. rendered.value = true;
  24084. open();
  24085. }
  24086. });
  24087. return {
  24088. afterEnter,
  24089. afterLeave,
  24090. beforeLeave,
  24091. handleClose,
  24092. onModalClick,
  24093. close,
  24094. doClose,
  24095. onOpenAutoFocus,
  24096. onCloseAutoFocus,
  24097. onCloseRequested,
  24098. onFocusoutPrevented,
  24099. titleId,
  24100. bodyId,
  24101. closed,
  24102. style,
  24103. overlayDialogStyle,
  24104. rendered,
  24105. visible,
  24106. zIndex: zIndex2
  24107. };
  24108. };
  24109. const _hoisted_1$6 = ["aria-label", "aria-labelledby", "aria-describedby"];
  24110. const __default__$2 = defineComponent({
  24111. name: "ElDialog",
  24112. inheritAttrs: false
  24113. });
  24114. const _sfc_main$9 = /* @__PURE__ */ defineComponent({
  24115. ...__default__$2,
  24116. props: dialogProps,
  24117. emits: dialogEmits,
  24118. setup(__props, { expose }) {
  24119. const props = __props;
  24120. const slots = useSlots();
  24121. useDeprecated({
  24122. scope: "el-dialog",
  24123. from: "the title slot",
  24124. replacement: "the header slot",
  24125. version: "3.0.0",
  24126. ref: "https://element-plus.org/en-US/component/dialog.html#slots"
  24127. }, computed$1(() => !!slots.title));
  24128. useDeprecated({
  24129. scope: "el-dialog",
  24130. from: "custom-class",
  24131. replacement: "class",
  24132. version: "2.3.0",
  24133. ref: "https://element-plus.org/en-US/component/dialog.html#attributes",
  24134. type: "Attribute"
  24135. }, computed$1(() => !!props.customClass));
  24136. const ns = useNamespace("dialog");
  24137. const dialogRef = ref();
  24138. const headerRef = ref();
  24139. const dialogContentRef = ref();
  24140. const {
  24141. visible,
  24142. titleId,
  24143. bodyId,
  24144. style,
  24145. overlayDialogStyle,
  24146. rendered,
  24147. zIndex: zIndex2,
  24148. afterEnter,
  24149. afterLeave,
  24150. beforeLeave,
  24151. handleClose,
  24152. onModalClick,
  24153. onOpenAutoFocus,
  24154. onCloseAutoFocus,
  24155. onCloseRequested,
  24156. onFocusoutPrevented
  24157. } = useDialog(props, dialogRef);
  24158. provide(dialogInjectionKey, {
  24159. dialogRef,
  24160. headerRef,
  24161. bodyId,
  24162. ns,
  24163. rendered,
  24164. style
  24165. });
  24166. const overlayEvent = useSameTarget(onModalClick);
  24167. const draggable2 = computed$1(() => props.draggable && !props.fullscreen);
  24168. expose({
  24169. visible,
  24170. dialogContentRef
  24171. });
  24172. return (_ctx, _cache) => {
  24173. return openBlock(), createBlock(Teleport, {
  24174. to: "body",
  24175. disabled: !_ctx.appendToBody
  24176. }, [
  24177. createVNode(Transition, {
  24178. name: "dialog-fade",
  24179. onAfterEnter: unref(afterEnter),
  24180. onAfterLeave: unref(afterLeave),
  24181. onBeforeLeave: unref(beforeLeave),
  24182. persisted: ""
  24183. }, {
  24184. default: withCtx(() => [
  24185. withDirectives(createVNode(unref(ElOverlay), {
  24186. "custom-mask-event": "",
  24187. mask: _ctx.modal,
  24188. "overlay-class": _ctx.modalClass,
  24189. "z-index": unref(zIndex2)
  24190. }, {
  24191. default: withCtx(() => [
  24192. createElementVNode("div", {
  24193. role: "dialog",
  24194. "aria-modal": "true",
  24195. "aria-label": _ctx.title || void 0,
  24196. "aria-labelledby": !_ctx.title ? unref(titleId) : void 0,
  24197. "aria-describedby": unref(bodyId),
  24198. class: normalizeClass(`${unref(ns).namespace.value}-overlay-dialog`),
  24199. style: normalizeStyle(unref(overlayDialogStyle)),
  24200. onClick: _cache[0] || (_cache[0] = (...args) => unref(overlayEvent).onClick && unref(overlayEvent).onClick(...args)),
  24201. onMousedown: _cache[1] || (_cache[1] = (...args) => unref(overlayEvent).onMousedown && unref(overlayEvent).onMousedown(...args)),
  24202. onMouseup: _cache[2] || (_cache[2] = (...args) => unref(overlayEvent).onMouseup && unref(overlayEvent).onMouseup(...args))
  24203. }, [
  24204. createVNode(unref(ElFocusTrap), {
  24205. loop: "",
  24206. trapped: unref(visible),
  24207. "focus-start-el": "container",
  24208. onFocusAfterTrapped: unref(onOpenAutoFocus),
  24209. onFocusAfterReleased: unref(onCloseAutoFocus),
  24210. onFocusoutPrevented: unref(onFocusoutPrevented),
  24211. onReleaseRequested: unref(onCloseRequested)
  24212. }, {
  24213. default: withCtx(() => [
  24214. unref(rendered) ? (openBlock(), createBlock(ElDialogContent, mergeProps({
  24215. key: 0,
  24216. ref_key: "dialogContentRef",
  24217. ref: dialogContentRef
  24218. }, _ctx.$attrs, {
  24219. "custom-class": _ctx.customClass,
  24220. center: _ctx.center,
  24221. "align-center": _ctx.alignCenter,
  24222. "close-icon": _ctx.closeIcon,
  24223. draggable: unref(draggable2),
  24224. fullscreen: _ctx.fullscreen,
  24225. "show-close": _ctx.showClose,
  24226. title: _ctx.title,
  24227. onClose: unref(handleClose)
  24228. }), createSlots({
  24229. header: withCtx(() => [
  24230. !_ctx.$slots.title ? renderSlot(_ctx.$slots, "header", {
  24231. key: 0,
  24232. close: unref(handleClose),
  24233. titleId: unref(titleId),
  24234. titleClass: unref(ns).e("title")
  24235. }) : renderSlot(_ctx.$slots, "title", { key: 1 })
  24236. ]),
  24237. default: withCtx(() => [
  24238. renderSlot(_ctx.$slots, "default")
  24239. ]),
  24240. _: 2
  24241. }, [
  24242. _ctx.$slots.footer ? {
  24243. name: "footer",
  24244. fn: withCtx(() => [
  24245. renderSlot(_ctx.$slots, "footer")
  24246. ])
  24247. } : void 0
  24248. ]), 1040, ["custom-class", "center", "align-center", "close-icon", "draggable", "fullscreen", "show-close", "title", "onClose"])) : createCommentVNode("v-if", true)
  24249. ]),
  24250. _: 3
  24251. }, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  24252. ], 46, _hoisted_1$6)
  24253. ]),
  24254. _: 3
  24255. }, 8, ["mask", "overlay-class", "z-index"]), [
  24256. [vShow, unref(visible)]
  24257. ])
  24258. ]),
  24259. _: 3
  24260. }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  24261. ], 8, ["disabled"]);
  24262. };
  24263. }
  24264. });
  24265. var Dialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog.vue"]]);
  24266. const ElDialog = withInstall(Dialog);
  24267. const inputNumberProps = buildProps({
  24268. id: {
  24269. type: String,
  24270. default: void 0
  24271. },
  24272. step: {
  24273. type: Number,
  24274. default: 1
  24275. },
  24276. stepStrictly: Boolean,
  24277. max: {
  24278. type: Number,
  24279. default: Number.POSITIVE_INFINITY
  24280. },
  24281. min: {
  24282. type: Number,
  24283. default: Number.NEGATIVE_INFINITY
  24284. },
  24285. modelValue: Number,
  24286. readonly: Boolean,
  24287. disabled: Boolean,
  24288. size: useSizeProp,
  24289. controls: {
  24290. type: Boolean,
  24291. default: true
  24292. },
  24293. controlsPosition: {
  24294. type: String,
  24295. default: "",
  24296. values: ["", "right"]
  24297. },
  24298. valueOnClear: {
  24299. type: [String, Number, null],
  24300. validator: (val) => val === null || isNumber(val) || ["min", "max"].includes(val),
  24301. default: null
  24302. },
  24303. name: String,
  24304. label: String,
  24305. placeholder: String,
  24306. precision: {
  24307. type: Number,
  24308. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  24309. },
  24310. validateEvent: {
  24311. type: Boolean,
  24312. default: true
  24313. }
  24314. });
  24315. const inputNumberEmits = {
  24316. [CHANGE_EVENT]: (cur, prev) => prev !== cur,
  24317. blur: (e) => e instanceof FocusEvent,
  24318. focus: (e) => e instanceof FocusEvent,
  24319. [INPUT_EVENT]: (val) => isNumber(val) || isNil(val),
  24320. [UPDATE_MODEL_EVENT]: (val) => isNumber(val) || isNil(val)
  24321. };
  24322. const _hoisted_1$5 = ["aria-label", "onKeydown"];
  24323. const _hoisted_2$5 = ["aria-label", "onKeydown"];
  24324. const __default__$1 = defineComponent({
  24325. name: "ElInputNumber"
  24326. });
  24327. const _sfc_main$8 = /* @__PURE__ */ defineComponent({
  24328. ...__default__$1,
  24329. props: inputNumberProps,
  24330. emits: inputNumberEmits,
  24331. setup(__props, { expose, emit }) {
  24332. const props = __props;
  24333. const { t: t2 } = useLocale();
  24334. const ns = useNamespace("input-number");
  24335. const input = ref();
  24336. const data = reactive({
  24337. currentValue: props.modelValue,
  24338. userInput: null
  24339. });
  24340. const { formItem } = useFormItem();
  24341. const minDisabled = computed$1(() => isNumber(props.modelValue) && props.modelValue <= props.min);
  24342. const maxDisabled = computed$1(() => isNumber(props.modelValue) && props.modelValue >= props.max);
  24343. const numPrecision = computed$1(() => {
  24344. const stepPrecision = getPrecision(props.step);
  24345. if (!isUndefined(props.precision)) {
  24346. if (stepPrecision > props.precision)
  24347. ;
  24348. return props.precision;
  24349. } else {
  24350. return Math.max(getPrecision(props.modelValue), stepPrecision);
  24351. }
  24352. });
  24353. const controlsAtRight = computed$1(() => {
  24354. return props.controls && props.controlsPosition === "right";
  24355. });
  24356. const inputNumberSize = useFormSize();
  24357. const inputNumberDisabled = useFormDisabled();
  24358. const displayValue = computed$1(() => {
  24359. if (data.userInput !== null) {
  24360. return data.userInput;
  24361. }
  24362. let currentValue = data.currentValue;
  24363. if (isNil(currentValue))
  24364. return "";
  24365. if (isNumber(currentValue)) {
  24366. if (Number.isNaN(currentValue))
  24367. return "";
  24368. if (!isUndefined(props.precision)) {
  24369. currentValue = currentValue.toFixed(props.precision);
  24370. }
  24371. }
  24372. return currentValue;
  24373. });
  24374. const toPrecision = (num, pre) => {
  24375. if (isUndefined(pre))
  24376. pre = numPrecision.value;
  24377. if (pre === 0)
  24378. return Math.round(num);
  24379. let snum = String(num);
  24380. const pointPos = snum.indexOf(".");
  24381. if (pointPos === -1)
  24382. return num;
  24383. const nums = snum.replace(".", "").split("");
  24384. const datum = nums[pointPos + pre];
  24385. if (!datum)
  24386. return num;
  24387. const length = snum.length;
  24388. if (snum.charAt(length - 1) === "5") {
  24389. snum = `${snum.slice(0, Math.max(0, length - 1))}6`;
  24390. }
  24391. return Number.parseFloat(Number(snum).toFixed(pre));
  24392. };
  24393. const getPrecision = (value) => {
  24394. if (isNil(value))
  24395. return 0;
  24396. const valueString = value.toString();
  24397. const dotPosition = valueString.indexOf(".");
  24398. let precision = 0;
  24399. if (dotPosition !== -1) {
  24400. precision = valueString.length - dotPosition - 1;
  24401. }
  24402. return precision;
  24403. };
  24404. const ensurePrecision = (val, coefficient = 1) => {
  24405. if (!isNumber(val))
  24406. return data.currentValue;
  24407. return toPrecision(val + props.step * coefficient);
  24408. };
  24409. const increase = () => {
  24410. if (props.readonly || inputNumberDisabled.value || maxDisabled.value)
  24411. return;
  24412. const value = Number(displayValue.value) || 0;
  24413. const newVal = ensurePrecision(value);
  24414. setCurrentValue(newVal);
  24415. emit(INPUT_EVENT, data.currentValue);
  24416. };
  24417. const decrease = () => {
  24418. if (props.readonly || inputNumberDisabled.value || minDisabled.value)
  24419. return;
  24420. const value = Number(displayValue.value) || 0;
  24421. const newVal = ensurePrecision(value, -1);
  24422. setCurrentValue(newVal);
  24423. emit(INPUT_EVENT, data.currentValue);
  24424. };
  24425. const verifyValue = (value, update) => {
  24426. const { max: max2, min: min2, step, precision, stepStrictly, valueOnClear } = props;
  24427. let newVal = Number(value);
  24428. if (isNil(value) || Number.isNaN(newVal)) {
  24429. return null;
  24430. }
  24431. if (value === "") {
  24432. if (valueOnClear === null) {
  24433. return null;
  24434. }
  24435. newVal = isString(valueOnClear) ? { min: min2, max: max2 }[valueOnClear] : valueOnClear;
  24436. }
  24437. if (stepStrictly) {
  24438. newVal = toPrecision(Math.round(newVal / step) * step, precision);
  24439. }
  24440. if (!isUndefined(precision)) {
  24441. newVal = toPrecision(newVal, precision);
  24442. }
  24443. if (newVal > max2 || newVal < min2) {
  24444. newVal = newVal > max2 ? max2 : min2;
  24445. update && emit(UPDATE_MODEL_EVENT, newVal);
  24446. }
  24447. return newVal;
  24448. };
  24449. const setCurrentValue = (value, emitChange = true) => {
  24450. var _a2;
  24451. const oldVal = data.currentValue;
  24452. const newVal = verifyValue(value);
  24453. if (!emitChange) {
  24454. emit(UPDATE_MODEL_EVENT, newVal);
  24455. return;
  24456. }
  24457. if (oldVal === newVal)
  24458. return;
  24459. data.userInput = null;
  24460. emit(UPDATE_MODEL_EVENT, newVal);
  24461. emit(CHANGE_EVENT, newVal, oldVal);
  24462. if (props.validateEvent) {
  24463. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  24464. }
  24465. data.currentValue = newVal;
  24466. };
  24467. const handleInput = (value) => {
  24468. data.userInput = value;
  24469. const newVal = value === "" ? null : Number(value);
  24470. emit(INPUT_EVENT, newVal);
  24471. setCurrentValue(newVal, false);
  24472. };
  24473. const handleInputChange = (value) => {
  24474. const newVal = value !== "" ? Number(value) : "";
  24475. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
  24476. setCurrentValue(newVal);
  24477. }
  24478. data.userInput = null;
  24479. };
  24480. const focus = () => {
  24481. var _a2, _b;
  24482. (_b = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2);
  24483. };
  24484. const blur = () => {
  24485. var _a2, _b;
  24486. (_b = (_a2 = input.value) == null ? void 0 : _a2.blur) == null ? void 0 : _b.call(_a2);
  24487. };
  24488. const handleFocus = (event2) => {
  24489. emit("focus", event2);
  24490. };
  24491. const handleBlur = (event2) => {
  24492. var _a2;
  24493. emit("blur", event2);
  24494. if (props.validateEvent) {
  24495. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
  24496. }
  24497. };
  24498. watch(() => props.modelValue, (value) => {
  24499. const userInput = verifyValue(data.userInput);
  24500. const newValue = verifyValue(value, true);
  24501. if (!isNumber(userInput) && (!userInput || userInput !== newValue)) {
  24502. data.currentValue = newValue;
  24503. data.userInput = null;
  24504. }
  24505. }, { immediate: true });
  24506. onMounted(() => {
  24507. var _a2;
  24508. const { min: min2, max: max2, modelValue } = props;
  24509. const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
  24510. innerInput.setAttribute("role", "spinbutton");
  24511. if (Number.isFinite(max2)) {
  24512. innerInput.setAttribute("aria-valuemax", String(max2));
  24513. } else {
  24514. innerInput.removeAttribute("aria-valuemax");
  24515. }
  24516. if (Number.isFinite(min2)) {
  24517. innerInput.setAttribute("aria-valuemin", String(min2));
  24518. } else {
  24519. innerInput.removeAttribute("aria-valuemin");
  24520. }
  24521. innerInput.setAttribute("aria-valuenow", String(data.currentValue));
  24522. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  24523. if (!isNumber(modelValue) && modelValue != null) {
  24524. let val = Number(modelValue);
  24525. if (Number.isNaN(val)) {
  24526. val = null;
  24527. }
  24528. emit(UPDATE_MODEL_EVENT, val);
  24529. }
  24530. });
  24531. onUpdated(() => {
  24532. var _a2;
  24533. const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
  24534. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", `${data.currentValue}`);
  24535. });
  24536. expose({
  24537. focus,
  24538. blur
  24539. });
  24540. return (_ctx, _cache) => {
  24541. return openBlock(), createElementBlock("div", {
  24542. class: normalizeClass([
  24543. unref(ns).b(),
  24544. unref(ns).m(unref(inputNumberSize)),
  24545. unref(ns).is("disabled", unref(inputNumberDisabled)),
  24546. unref(ns).is("without-controls", !_ctx.controls),
  24547. unref(ns).is("controls-right", unref(controlsAtRight))
  24548. ]),
  24549. onDragstart: _cache[1] || (_cache[1] = withModifiers(() => {
  24550. }, ["prevent"]))
  24551. }, [
  24552. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  24553. key: 0,
  24554. role: "button",
  24555. "aria-label": unref(t2)("el.inputNumber.decrease"),
  24556. class: normalizeClass([unref(ns).e("decrease"), unref(ns).is("disabled", unref(minDisabled))]),
  24557. onKeydown: withKeys(decrease, ["enter"])
  24558. }, [
  24559. createVNode(unref(ElIcon), null, {
  24560. default: withCtx(() => [
  24561. unref(controlsAtRight) ? (openBlock(), createBlock(unref(arrow_down_default), { key: 0 })) : (openBlock(), createBlock(unref(minus_default), { key: 1 }))
  24562. ]),
  24563. _: 1
  24564. })
  24565. ], 42, _hoisted_1$5)), [
  24566. [unref(vRepeatClick), decrease]
  24567. ]) : createCommentVNode("v-if", true),
  24568. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  24569. key: 1,
  24570. role: "button",
  24571. "aria-label": unref(t2)("el.inputNumber.increase"),
  24572. class: normalizeClass([unref(ns).e("increase"), unref(ns).is("disabled", unref(maxDisabled))]),
  24573. onKeydown: withKeys(increase, ["enter"])
  24574. }, [
  24575. createVNode(unref(ElIcon), null, {
  24576. default: withCtx(() => [
  24577. unref(controlsAtRight) ? (openBlock(), createBlock(unref(arrow_up_default), { key: 0 })) : (openBlock(), createBlock(unref(plus_default), { key: 1 }))
  24578. ]),
  24579. _: 1
  24580. })
  24581. ], 42, _hoisted_2$5)), [
  24582. [unref(vRepeatClick), increase]
  24583. ]) : createCommentVNode("v-if", true),
  24584. createVNode(unref(ElInput), {
  24585. id: _ctx.id,
  24586. ref_key: "input",
  24587. ref: input,
  24588. type: "number",
  24589. step: _ctx.step,
  24590. "model-value": unref(displayValue),
  24591. placeholder: _ctx.placeholder,
  24592. readonly: _ctx.readonly,
  24593. disabled: unref(inputNumberDisabled),
  24594. size: unref(inputNumberSize),
  24595. max: _ctx.max,
  24596. min: _ctx.min,
  24597. name: _ctx.name,
  24598. label: _ctx.label,
  24599. "validate-event": false,
  24600. onWheel: _cache[0] || (_cache[0] = withModifiers(() => {
  24601. }, ["prevent"])),
  24602. onKeydown: [
  24603. withKeys(withModifiers(increase, ["prevent"]), ["up"]),
  24604. withKeys(withModifiers(decrease, ["prevent"]), ["down"])
  24605. ],
  24606. onBlur: handleBlur,
  24607. onFocus: handleFocus,
  24608. onInput: handleInput,
  24609. onChange: handleInputChange
  24610. }, null, 8, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "label", "onKeydown"])
  24611. ], 34);
  24612. };
  24613. }
  24614. });
  24615. var InputNumber = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/input-number/src/input-number.vue"]]);
  24616. const ElInputNumber = withInstall(InputNumber);
  24617. const selectGroupKey = Symbol("ElSelectGroup");
  24618. const selectKey = Symbol("ElSelect");
  24619. function useOption(props, states) {
  24620. const select = inject(selectKey);
  24621. const selectGroup = inject(selectGroupKey, { disabled: false });
  24622. const isObject3 = computed$1(() => {
  24623. return Object.prototype.toString.call(props.value).toLowerCase() === "[object object]";
  24624. });
  24625. const itemSelected = computed$1(() => {
  24626. if (!select.props.multiple) {
  24627. return isEqual2(props.value, select.props.modelValue);
  24628. } else {
  24629. return contains(select.props.modelValue, props.value);
  24630. }
  24631. });
  24632. const limitReached = computed$1(() => {
  24633. if (select.props.multiple) {
  24634. const modelValue = select.props.modelValue || [];
  24635. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  24636. } else {
  24637. return false;
  24638. }
  24639. });
  24640. const currentLabel = computed$1(() => {
  24641. return props.label || (isObject3.value ? "" : props.value);
  24642. });
  24643. const currentValue = computed$1(() => {
  24644. return props.value || props.label || "";
  24645. });
  24646. const isDisabled3 = computed$1(() => {
  24647. return props.disabled || states.groupDisabled || limitReached.value;
  24648. });
  24649. const instance = getCurrentInstance();
  24650. const contains = (arr = [], target) => {
  24651. if (!isObject3.value) {
  24652. return arr && arr.includes(target);
  24653. } else {
  24654. const valueKey = select.props.valueKey;
  24655. return arr && arr.some((item) => {
  24656. return toRaw$1(get$2(item, valueKey)) === get$2(target, valueKey);
  24657. });
  24658. }
  24659. };
  24660. const isEqual2 = (a, b) => {
  24661. if (!isObject3.value) {
  24662. return a === b;
  24663. } else {
  24664. const { valueKey } = select.props;
  24665. return get$2(a, valueKey) === get$2(b, valueKey);
  24666. }
  24667. };
  24668. const hoverItem = () => {
  24669. if (!props.disabled && !selectGroup.disabled) {
  24670. select.hoverIndex = select.optionsArray.indexOf(instance.proxy);
  24671. }
  24672. };
  24673. watch(() => currentLabel.value, () => {
  24674. if (!props.created && !select.props.remote)
  24675. select.setSelected();
  24676. });
  24677. watch(() => props.value, (val, oldVal) => {
  24678. const { remote, valueKey } = select.props;
  24679. if (!Object.is(val, oldVal)) {
  24680. select.onOptionDestroy(oldVal, instance.proxy);
  24681. select.onOptionCreate(instance.proxy);
  24682. }
  24683. if (!props.created && !remote) {
  24684. if (valueKey && typeof val === "object" && typeof oldVal === "object" && val[valueKey] === oldVal[valueKey]) {
  24685. return;
  24686. }
  24687. select.setSelected();
  24688. }
  24689. });
  24690. watch(() => selectGroup.disabled, () => {
  24691. states.groupDisabled = selectGroup.disabled;
  24692. }, { immediate: true });
  24693. const { queryChange } = toRaw$1(select);
  24694. watch(queryChange, (changes) => {
  24695. const { query } = unref(changes);
  24696. const regexp = new RegExp(escapeStringRegexp(query), "i");
  24697. states.visible = regexp.test(currentLabel.value) || props.created;
  24698. if (!states.visible) {
  24699. select.filteredOptionsCount--;
  24700. }
  24701. }, { immediate: true });
  24702. return {
  24703. select,
  24704. currentLabel,
  24705. currentValue,
  24706. itemSelected,
  24707. isDisabled: isDisabled3,
  24708. hoverItem
  24709. };
  24710. }
  24711. const _sfc_main$7 = defineComponent({
  24712. name: "ElOption",
  24713. componentName: "ElOption",
  24714. props: {
  24715. value: {
  24716. required: true,
  24717. type: [String, Number, Boolean, Object]
  24718. },
  24719. label: [String, Number],
  24720. created: Boolean,
  24721. disabled: {
  24722. type: Boolean,
  24723. default: false
  24724. }
  24725. },
  24726. setup(props) {
  24727. const ns = useNamespace("select");
  24728. const states = reactive({
  24729. index: -1,
  24730. groupDisabled: false,
  24731. visible: true,
  24732. hitState: false,
  24733. hover: false
  24734. });
  24735. const { currentLabel, itemSelected, isDisabled: isDisabled3, select, hoverItem } = useOption(props, states);
  24736. const { visible, hover } = toRefs(states);
  24737. const vm = getCurrentInstance().proxy;
  24738. select.onOptionCreate(vm);
  24739. onBeforeUnmount(() => {
  24740. const key = vm.value;
  24741. const { selected } = select;
  24742. const selectedOptions = select.props.multiple ? selected : [selected];
  24743. const doesSelected = selectedOptions.some((item) => {
  24744. return item.value === vm.value;
  24745. });
  24746. nextTick(() => {
  24747. if (select.cachedOptions.get(key) === vm && !doesSelected) {
  24748. select.cachedOptions.delete(key);
  24749. }
  24750. });
  24751. select.onOptionDestroy(key, vm);
  24752. });
  24753. function selectOptionClick() {
  24754. if (props.disabled !== true && states.groupDisabled !== true) {
  24755. select.handleOptionSelect(vm, true);
  24756. }
  24757. }
  24758. return {
  24759. ns,
  24760. currentLabel,
  24761. itemSelected,
  24762. isDisabled: isDisabled3,
  24763. select,
  24764. hoverItem,
  24765. visible,
  24766. hover,
  24767. selectOptionClick,
  24768. states
  24769. };
  24770. }
  24771. });
  24772. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  24773. return withDirectives((openBlock(), createElementBlock("li", {
  24774. class: normalizeClass([
  24775. _ctx.ns.be("dropdown", "item"),
  24776. _ctx.ns.is("disabled", _ctx.isDisabled),
  24777. {
  24778. selected: _ctx.itemSelected,
  24779. hover: _ctx.hover
  24780. }
  24781. ]),
  24782. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  24783. onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  24784. }, [
  24785. renderSlot(_ctx.$slots, "default", {}, () => [
  24786. createElementVNode("span", null, toDisplayString(_ctx.currentLabel), 1)
  24787. ])
  24788. ], 34)), [
  24789. [vShow, _ctx.visible]
  24790. ]);
  24791. }
  24792. var Option = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["render", _sfc_render$3], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/option.vue"]]);
  24793. const _sfc_main$6 = defineComponent({
  24794. name: "ElSelectDropdown",
  24795. componentName: "ElSelectDropdown",
  24796. setup() {
  24797. const select = inject(selectKey);
  24798. const ns = useNamespace("select");
  24799. const popperClass = computed$1(() => select.props.popperClass);
  24800. const isMultiple = computed$1(() => select.props.multiple);
  24801. const isFitInputWidth = computed$1(() => select.props.fitInputWidth);
  24802. const minWidth = ref("");
  24803. function updateMinWidth() {
  24804. var _a2;
  24805. minWidth.value = `${(_a2 = select.selectWrapper) == null ? void 0 : _a2.offsetWidth}px`;
  24806. }
  24807. onMounted(() => {
  24808. updateMinWidth();
  24809. useResizeObserver(select.selectWrapper, updateMinWidth);
  24810. });
  24811. return {
  24812. ns,
  24813. minWidth,
  24814. popperClass,
  24815. isMultiple,
  24816. isFitInputWidth
  24817. };
  24818. }
  24819. });
  24820. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  24821. return openBlock(), createElementBlock("div", {
  24822. class: normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  24823. style: normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  24824. }, [
  24825. renderSlot(_ctx.$slots, "default")
  24826. ], 6);
  24827. }
  24828. var ElSelectMenu = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["render", _sfc_render$2], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/select-dropdown.vue"]]);
  24829. function useSelectStates(props) {
  24830. const { t: t2 } = useLocale();
  24831. return reactive({
  24832. options: /* @__PURE__ */ new Map(),
  24833. cachedOptions: /* @__PURE__ */ new Map(),
  24834. createdLabel: null,
  24835. createdSelected: false,
  24836. selected: props.multiple ? [] : {},
  24837. inputLength: 20,
  24838. inputWidth: 0,
  24839. optionsCount: 0,
  24840. filteredOptionsCount: 0,
  24841. visible: false,
  24842. softFocus: false,
  24843. selectedLabel: "",
  24844. hoverIndex: -1,
  24845. query: "",
  24846. previousQuery: null,
  24847. inputHovering: false,
  24848. cachedPlaceHolder: "",
  24849. currentPlaceholder: t2("el.select.placeholder"),
  24850. menuVisibleOnFocus: false,
  24851. isOnComposition: false,
  24852. isSilentBlur: false,
  24853. prefixWidth: 11,
  24854. tagInMultiLine: false,
  24855. mouseEnter: false
  24856. });
  24857. }
  24858. const useSelect = (props, states, ctx) => {
  24859. const { t: t2 } = useLocale();
  24860. const ns = useNamespace("select");
  24861. useDeprecated({
  24862. from: "suffixTransition",
  24863. replacement: "override style scheme",
  24864. version: "2.3.0",
  24865. scope: "props",
  24866. ref: "https://element-plus.org/en-US/component/select.html#select-attributes"
  24867. }, computed$1(() => props.suffixTransition === false));
  24868. const reference = ref(null);
  24869. const input = ref(null);
  24870. const iOSInput = ref(null);
  24871. const tooltipRef = ref(null);
  24872. const tags = ref(null);
  24873. const selectWrapper = ref(null);
  24874. const scrollbar = ref(null);
  24875. const hoverOption = ref(-1);
  24876. const queryChange = shallowRef({ query: "" });
  24877. const groupQueryChange = shallowRef("");
  24878. const optionList = ref([]);
  24879. let originClientHeight = 0;
  24880. const { form, formItem } = useFormItem();
  24881. const readonly2 = computed$1(() => !props.filterable || props.multiple || !states.visible);
  24882. const selectDisabled = computed$1(() => props.disabled || (form == null ? void 0 : form.disabled));
  24883. const showClose = computed$1(() => {
  24884. const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : props.modelValue !== void 0 && props.modelValue !== null && props.modelValue !== "";
  24885. const criteria = props.clearable && !selectDisabled.value && states.inputHovering && hasValue;
  24886. return criteria;
  24887. });
  24888. const iconComponent = computed$1(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
  24889. const iconReverse = computed$1(() => ns.is("reverse", iconComponent.value && states.visible && props.suffixTransition));
  24890. const debounce$12 = computed$1(() => props.remote ? 300 : 0);
  24891. const emptyText = computed$1(() => {
  24892. if (props.loading) {
  24893. return props.loadingText || t2("el.select.loading");
  24894. } else {
  24895. if (props.remote && states.query === "" && states.options.size === 0)
  24896. return false;
  24897. if (props.filterable && states.query && states.options.size > 0 && states.filteredOptionsCount === 0) {
  24898. return props.noMatchText || t2("el.select.noMatch");
  24899. }
  24900. if (states.options.size === 0) {
  24901. return props.noDataText || t2("el.select.noData");
  24902. }
  24903. }
  24904. return null;
  24905. });
  24906. const optionsArray = computed$1(() => {
  24907. const list = Array.from(states.options.values());
  24908. const newList = [];
  24909. optionList.value.forEach((item) => {
  24910. const index2 = list.findIndex((i2) => i2.currentLabel === item);
  24911. if (index2 > -1) {
  24912. newList.push(list[index2]);
  24913. }
  24914. });
  24915. return newList.length ? newList : list;
  24916. });
  24917. const cachedOptionsArray = computed$1(() => Array.from(states.cachedOptions.values()));
  24918. const showNewOption = computed$1(() => {
  24919. const hasExistingOption = optionsArray.value.filter((option) => {
  24920. return !option.created;
  24921. }).some((option) => {
  24922. return option.currentLabel === states.query;
  24923. });
  24924. return props.filterable && props.allowCreate && states.query !== "" && !hasExistingOption;
  24925. });
  24926. const selectSize = useFormSize();
  24927. const collapseTagSize = computed$1(() => ["small"].includes(selectSize.value) ? "small" : "default");
  24928. const dropMenuVisible = computed$1({
  24929. get() {
  24930. return states.visible && emptyText.value !== false;
  24931. },
  24932. set(val) {
  24933. states.visible = val;
  24934. }
  24935. });
  24936. watch([() => selectDisabled.value, () => selectSize.value, () => form == null ? void 0 : form.size], () => {
  24937. nextTick(() => {
  24938. resetInputHeight();
  24939. });
  24940. });
  24941. watch(() => props.placeholder, (val) => {
  24942. states.cachedPlaceHolder = states.currentPlaceholder = val;
  24943. });
  24944. watch(() => props.modelValue, (val, oldVal) => {
  24945. if (props.multiple) {
  24946. resetInputHeight();
  24947. if (val && val.length > 0 || input.value && states.query !== "") {
  24948. states.currentPlaceholder = "";
  24949. } else {
  24950. states.currentPlaceholder = states.cachedPlaceHolder;
  24951. }
  24952. if (props.filterable && !props.reserveKeyword) {
  24953. states.query = "";
  24954. handleQueryChange(states.query);
  24955. }
  24956. }
  24957. setSelected();
  24958. if (props.filterable && !props.multiple) {
  24959. states.inputLength = 20;
  24960. }
  24961. if (!isEqual(val, oldVal) && props.validateEvent) {
  24962. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  24963. }
  24964. }, {
  24965. flush: "post",
  24966. deep: true
  24967. });
  24968. watch(() => states.visible, (val) => {
  24969. var _a2, _b, _c, _d, _e;
  24970. if (!val) {
  24971. if (props.filterable) {
  24972. if (isFunction$3(props.filterMethod)) {
  24973. props.filterMethod("");
  24974. }
  24975. if (isFunction$3(props.remoteMethod)) {
  24976. props.remoteMethod("");
  24977. }
  24978. }
  24979. input.value && input.value.blur();
  24980. states.query = "";
  24981. states.previousQuery = null;
  24982. states.selectedLabel = "";
  24983. states.inputLength = 20;
  24984. states.menuVisibleOnFocus = false;
  24985. resetHoverIndex();
  24986. nextTick(() => {
  24987. if (input.value && input.value.value === "" && states.selected.length === 0) {
  24988. states.currentPlaceholder = states.cachedPlaceHolder;
  24989. }
  24990. });
  24991. if (!props.multiple) {
  24992. if (states.selected) {
  24993. if (props.filterable && props.allowCreate && states.createdSelected && states.createdLabel) {
  24994. states.selectedLabel = states.createdLabel;
  24995. } else {
  24996. states.selectedLabel = states.selected.currentLabel;
  24997. }
  24998. if (props.filterable)
  24999. states.query = states.selectedLabel;
  25000. }
  25001. if (props.filterable) {
  25002. states.currentPlaceholder = states.cachedPlaceHolder;
  25003. }
  25004. }
  25005. } else {
  25006. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  25007. if (props.filterable) {
  25008. states.filteredOptionsCount = states.optionsCount;
  25009. states.query = props.remote ? "" : states.selectedLabel;
  25010. (_d = (_c = iOSInput.value) == null ? void 0 : _c.focus) == null ? void 0 : _d.call(_c);
  25011. if (props.multiple) {
  25012. (_e = input.value) == null ? void 0 : _e.focus();
  25013. } else {
  25014. if (states.selectedLabel) {
  25015. states.currentPlaceholder = `${states.selectedLabel}`;
  25016. states.selectedLabel = "";
  25017. }
  25018. }
  25019. handleQueryChange(states.query);
  25020. if (!props.multiple && !props.remote) {
  25021. queryChange.value.query = "";
  25022. triggerRef(queryChange);
  25023. triggerRef(groupQueryChange);
  25024. }
  25025. }
  25026. }
  25027. ctx.emit("visible-change", val);
  25028. });
  25029. watch(() => states.options.entries(), () => {
  25030. var _a2, _b, _c;
  25031. if (!isClient)
  25032. return;
  25033. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  25034. if (props.multiple) {
  25035. resetInputHeight();
  25036. }
  25037. const inputs = ((_c = selectWrapper.value) == null ? void 0 : _c.querySelectorAll("input")) || [];
  25038. if (!Array.from(inputs).includes(document.activeElement)) {
  25039. setSelected();
  25040. }
  25041. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  25042. checkDefaultFirstOption();
  25043. }
  25044. }, {
  25045. flush: "post"
  25046. });
  25047. watch(() => states.hoverIndex, (val) => {
  25048. if (isNumber(val) && val > -1) {
  25049. hoverOption.value = optionsArray.value[val] || {};
  25050. } else {
  25051. hoverOption.value = {};
  25052. }
  25053. optionsArray.value.forEach((option) => {
  25054. option.hover = hoverOption.value === option;
  25055. });
  25056. });
  25057. const resetInputHeight = () => {
  25058. nextTick(() => {
  25059. var _a2, _b;
  25060. if (!reference.value)
  25061. return;
  25062. const input2 = reference.value.$el.querySelector("input");
  25063. originClientHeight = originClientHeight || (input2.clientHeight > 0 ? input2.clientHeight + 2 : 0);
  25064. const _tags = tags.value;
  25065. const gotSize = getComponentSize(selectSize.value || (form == null ? void 0 : form.size));
  25066. const sizeInMap = selectSize.value || gotSize === originClientHeight || originClientHeight <= 0 ? gotSize : originClientHeight;
  25067. const isElHidden = input2.offsetParent === null;
  25068. !isElHidden && (input2.style.height = `${(states.selected.length === 0 ? sizeInMap : Math.max(_tags ? _tags.clientHeight + (_tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap)) - 2}px`);
  25069. states.tagInMultiLine = Number.parseFloat(input2.style.height) >= sizeInMap;
  25070. if (states.visible && emptyText.value !== false) {
  25071. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  25072. }
  25073. });
  25074. };
  25075. const handleQueryChange = async (val) => {
  25076. if (states.previousQuery === val || states.isOnComposition)
  25077. return;
  25078. if (states.previousQuery === null && (isFunction$3(props.filterMethod) || isFunction$3(props.remoteMethod))) {
  25079. states.previousQuery = val;
  25080. return;
  25081. }
  25082. states.previousQuery = val;
  25083. nextTick(() => {
  25084. var _a2, _b;
  25085. if (states.visible)
  25086. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  25087. });
  25088. states.hoverIndex = -1;
  25089. if (props.multiple && props.filterable) {
  25090. nextTick(() => {
  25091. const length = input.value.value.length * 15 + 20;
  25092. states.inputLength = props.collapseTags ? Math.min(50, length) : length;
  25093. managePlaceholder();
  25094. resetInputHeight();
  25095. });
  25096. }
  25097. if (props.remote && isFunction$3(props.remoteMethod)) {
  25098. states.hoverIndex = -1;
  25099. props.remoteMethod(val);
  25100. } else if (isFunction$3(props.filterMethod)) {
  25101. props.filterMethod(val);
  25102. triggerRef(groupQueryChange);
  25103. } else {
  25104. states.filteredOptionsCount = states.optionsCount;
  25105. queryChange.value.query = val;
  25106. triggerRef(queryChange);
  25107. triggerRef(groupQueryChange);
  25108. }
  25109. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  25110. await nextTick();
  25111. checkDefaultFirstOption();
  25112. }
  25113. };
  25114. const managePlaceholder = () => {
  25115. if (states.currentPlaceholder !== "") {
  25116. states.currentPlaceholder = input.value.value ? "" : states.cachedPlaceHolder;
  25117. }
  25118. };
  25119. const checkDefaultFirstOption = () => {
  25120. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  25121. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  25122. const firstOriginOption = optionsInDropdown[0];
  25123. states.hoverIndex = getValueIndex(optionsArray.value, userCreatedOption || firstOriginOption);
  25124. };
  25125. const setSelected = () => {
  25126. var _a2;
  25127. if (!props.multiple) {
  25128. const option = getOption(props.modelValue);
  25129. if ((_a2 = option.props) == null ? void 0 : _a2.created) {
  25130. states.createdLabel = option.props.value;
  25131. states.createdSelected = true;
  25132. } else {
  25133. states.createdSelected = false;
  25134. }
  25135. states.selectedLabel = option.currentLabel;
  25136. states.selected = option;
  25137. if (props.filterable)
  25138. states.query = states.selectedLabel;
  25139. return;
  25140. } else {
  25141. states.selectedLabel = "";
  25142. }
  25143. const result = [];
  25144. if (Array.isArray(props.modelValue)) {
  25145. props.modelValue.forEach((value) => {
  25146. result.push(getOption(value));
  25147. });
  25148. }
  25149. states.selected = result;
  25150. nextTick(() => {
  25151. resetInputHeight();
  25152. });
  25153. };
  25154. const getOption = (value) => {
  25155. let option;
  25156. const isObjectValue = toRawType(value).toLowerCase() === "object";
  25157. const isNull = toRawType(value).toLowerCase() === "null";
  25158. const isUndefined2 = toRawType(value).toLowerCase() === "undefined";
  25159. for (let i2 = states.cachedOptions.size - 1; i2 >= 0; i2--) {
  25160. const cachedOption = cachedOptionsArray.value[i2];
  25161. const isEqualValue = isObjectValue ? get$2(cachedOption.value, props.valueKey) === get$2(value, props.valueKey) : cachedOption.value === value;
  25162. if (isEqualValue) {
  25163. option = {
  25164. value,
  25165. currentLabel: cachedOption.currentLabel,
  25166. isDisabled: cachedOption.isDisabled
  25167. };
  25168. break;
  25169. }
  25170. }
  25171. if (option)
  25172. return option;
  25173. const label2 = isObjectValue ? value.label : !isNull && !isUndefined2 ? value : "";
  25174. const newOption = {
  25175. value,
  25176. currentLabel: label2
  25177. };
  25178. if (props.multiple) {
  25179. newOption.hitState = false;
  25180. }
  25181. return newOption;
  25182. };
  25183. const resetHoverIndex = () => {
  25184. setTimeout(() => {
  25185. const valueKey = props.valueKey;
  25186. if (!props.multiple) {
  25187. states.hoverIndex = optionsArray.value.findIndex((item) => {
  25188. return getValueKey(item) === getValueKey(states.selected);
  25189. });
  25190. } else {
  25191. if (states.selected.length > 0) {
  25192. states.hoverIndex = Math.min.apply(null, states.selected.map((selected) => {
  25193. return optionsArray.value.findIndex((item) => {
  25194. return get$2(item, valueKey) === get$2(selected, valueKey);
  25195. });
  25196. }));
  25197. } else {
  25198. states.hoverIndex = -1;
  25199. }
  25200. }
  25201. }, 300);
  25202. };
  25203. const handleResize = () => {
  25204. var _a2, _b;
  25205. resetInputWidth();
  25206. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  25207. if (props.multiple)
  25208. resetInputHeight();
  25209. };
  25210. const resetInputWidth = () => {
  25211. var _a2;
  25212. states.inputWidth = (_a2 = reference.value) == null ? void 0 : _a2.$el.offsetWidth;
  25213. };
  25214. const onInputChange = () => {
  25215. if (props.filterable && states.query !== states.selectedLabel) {
  25216. states.query = states.selectedLabel;
  25217. handleQueryChange(states.query);
  25218. }
  25219. };
  25220. const debouncedOnInputChange = debounce$2(() => {
  25221. onInputChange();
  25222. }, debounce$12.value);
  25223. const debouncedQueryChange = debounce$2((e) => {
  25224. handleQueryChange(e.target.value);
  25225. }, debounce$12.value);
  25226. const emitChange = (val) => {
  25227. if (!isEqual(props.modelValue, val)) {
  25228. ctx.emit(CHANGE_EVENT, val);
  25229. }
  25230. };
  25231. const deletePrevTag = (e) => {
  25232. if (e.code === EVENT_CODE.delete)
  25233. return;
  25234. if (e.target.value.length <= 0 && !toggleLastOptionHitState()) {
  25235. const value = props.modelValue.slice();
  25236. value.pop();
  25237. ctx.emit(UPDATE_MODEL_EVENT, value);
  25238. emitChange(value);
  25239. }
  25240. if (e.target.value.length === 1 && props.modelValue.length === 0) {
  25241. states.currentPlaceholder = states.cachedPlaceHolder;
  25242. }
  25243. };
  25244. const deleteTag = (event2, tag) => {
  25245. const index2 = states.selected.indexOf(tag);
  25246. if (index2 > -1 && !selectDisabled.value) {
  25247. const value = props.modelValue.slice();
  25248. value.splice(index2, 1);
  25249. ctx.emit(UPDATE_MODEL_EVENT, value);
  25250. emitChange(value);
  25251. ctx.emit("remove-tag", tag.value);
  25252. }
  25253. event2.stopPropagation();
  25254. };
  25255. const deleteSelected = (event2) => {
  25256. event2.stopPropagation();
  25257. const value = props.multiple ? [] : "";
  25258. if (!isString(value)) {
  25259. for (const item of states.selected) {
  25260. if (item.isDisabled)
  25261. value.push(item.value);
  25262. }
  25263. }
  25264. ctx.emit(UPDATE_MODEL_EVENT, value);
  25265. emitChange(value);
  25266. states.hoverIndex = -1;
  25267. states.visible = false;
  25268. ctx.emit("clear");
  25269. };
  25270. const handleOptionSelect = (option, byClick) => {
  25271. var _a2;
  25272. if (props.multiple) {
  25273. const value = (props.modelValue || []).slice();
  25274. const optionIndex = getValueIndex(value, option.value);
  25275. if (optionIndex > -1) {
  25276. value.splice(optionIndex, 1);
  25277. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  25278. value.push(option.value);
  25279. }
  25280. ctx.emit(UPDATE_MODEL_EVENT, value);
  25281. emitChange(value);
  25282. if (option.created) {
  25283. states.query = "";
  25284. handleQueryChange("");
  25285. states.inputLength = 20;
  25286. }
  25287. if (props.filterable)
  25288. (_a2 = input.value) == null ? void 0 : _a2.focus();
  25289. } else {
  25290. ctx.emit(UPDATE_MODEL_EVENT, option.value);
  25291. emitChange(option.value);
  25292. states.visible = false;
  25293. }
  25294. states.isSilentBlur = byClick;
  25295. setSoftFocus();
  25296. if (states.visible)
  25297. return;
  25298. nextTick(() => {
  25299. scrollToOption(option);
  25300. });
  25301. };
  25302. const getValueIndex = (arr = [], value) => {
  25303. if (!isObject$5(value))
  25304. return arr.indexOf(value);
  25305. const valueKey = props.valueKey;
  25306. let index2 = -1;
  25307. arr.some((item, i2) => {
  25308. if (toRaw$1(get$2(item, valueKey)) === get$2(value, valueKey)) {
  25309. index2 = i2;
  25310. return true;
  25311. }
  25312. return false;
  25313. });
  25314. return index2;
  25315. };
  25316. const setSoftFocus = () => {
  25317. states.softFocus = true;
  25318. const _input = input.value || reference.value;
  25319. if (_input) {
  25320. _input == null ? void 0 : _input.focus();
  25321. }
  25322. };
  25323. const scrollToOption = (option) => {
  25324. var _a2, _b, _c, _d, _e;
  25325. const targetOption = Array.isArray(option) ? option[0] : option;
  25326. let target = null;
  25327. if (targetOption == null ? void 0 : targetOption.value) {
  25328. const options2 = optionsArray.value.filter((item) => item.value === targetOption.value);
  25329. if (options2.length > 0) {
  25330. target = options2[0].$el;
  25331. }
  25332. }
  25333. if (tooltipRef.value && target) {
  25334. const menu = (_d = (_c = (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b.contentRef) == null ? void 0 : _c.querySelector) == null ? void 0 : _d.call(_c, `.${ns.be("dropdown", "wrap")}`);
  25335. if (menu) {
  25336. scrollIntoView(menu, target);
  25337. }
  25338. }
  25339. (_e = scrollbar.value) == null ? void 0 : _e.handleScroll();
  25340. };
  25341. const onOptionCreate = (vm) => {
  25342. states.optionsCount++;
  25343. states.filteredOptionsCount++;
  25344. states.options.set(vm.value, vm);
  25345. states.cachedOptions.set(vm.value, vm);
  25346. };
  25347. const onOptionDestroy = (key, vm) => {
  25348. if (states.options.get(key) === vm) {
  25349. states.optionsCount--;
  25350. states.filteredOptionsCount--;
  25351. states.options.delete(key);
  25352. }
  25353. };
  25354. const resetInputState = (e) => {
  25355. if (e.code !== EVENT_CODE.backspace)
  25356. toggleLastOptionHitState(false);
  25357. states.inputLength = input.value.value.length * 15 + 20;
  25358. resetInputHeight();
  25359. };
  25360. const toggleLastOptionHitState = (hit) => {
  25361. if (!Array.isArray(states.selected))
  25362. return;
  25363. const option = states.selected[states.selected.length - 1];
  25364. if (!option)
  25365. return;
  25366. if (hit === true || hit === false) {
  25367. option.hitState = hit;
  25368. return hit;
  25369. }
  25370. option.hitState = !option.hitState;
  25371. return option.hitState;
  25372. };
  25373. const handleComposition = (event2) => {
  25374. const text = event2.target.value;
  25375. if (event2.type === "compositionend") {
  25376. states.isOnComposition = false;
  25377. nextTick(() => handleQueryChange(text));
  25378. } else {
  25379. const lastCharacter = text[text.length - 1] || "";
  25380. states.isOnComposition = !isKorean(lastCharacter);
  25381. }
  25382. };
  25383. const handleMenuEnter = () => {
  25384. nextTick(() => scrollToOption(states.selected));
  25385. };
  25386. const handleFocus = (event2) => {
  25387. if (!states.softFocus) {
  25388. if (props.automaticDropdown || props.filterable) {
  25389. if (props.filterable && !states.visible) {
  25390. states.menuVisibleOnFocus = true;
  25391. }
  25392. states.visible = true;
  25393. }
  25394. ctx.emit("focus", event2);
  25395. } else {
  25396. states.softFocus = false;
  25397. }
  25398. };
  25399. const blur = () => {
  25400. var _a2, _b, _c;
  25401. states.visible = false;
  25402. (_a2 = reference.value) == null ? void 0 : _a2.blur();
  25403. (_c = (_b = iOSInput.value) == null ? void 0 : _b.blur) == null ? void 0 : _c.call(_b);
  25404. };
  25405. const handleBlur = (event2) => {
  25406. nextTick(() => {
  25407. if (states.isSilentBlur) {
  25408. states.isSilentBlur = false;
  25409. } else {
  25410. ctx.emit("blur", event2);
  25411. }
  25412. });
  25413. states.softFocus = false;
  25414. };
  25415. const handleClearClick = (event2) => {
  25416. deleteSelected(event2);
  25417. };
  25418. const handleClose = () => {
  25419. states.visible = false;
  25420. };
  25421. const handleKeydownEscape = (event2) => {
  25422. if (states.visible) {
  25423. event2.preventDefault();
  25424. event2.stopPropagation();
  25425. states.visible = false;
  25426. }
  25427. };
  25428. const toggleMenu = (e) => {
  25429. var _a2;
  25430. if (e && !states.mouseEnter) {
  25431. return;
  25432. }
  25433. if (!selectDisabled.value) {
  25434. if (states.menuVisibleOnFocus) {
  25435. states.menuVisibleOnFocus = false;
  25436. } else {
  25437. if (!tooltipRef.value || !tooltipRef.value.isFocusInsideContent()) {
  25438. states.visible = !states.visible;
  25439. }
  25440. }
  25441. if (states.visible) {
  25442. (_a2 = input.value || reference.value) == null ? void 0 : _a2.focus();
  25443. }
  25444. }
  25445. };
  25446. const selectOption = () => {
  25447. if (!states.visible) {
  25448. toggleMenu();
  25449. } else {
  25450. if (optionsArray.value[states.hoverIndex]) {
  25451. handleOptionSelect(optionsArray.value[states.hoverIndex], void 0);
  25452. }
  25453. }
  25454. };
  25455. const getValueKey = (item) => {
  25456. return isObject$5(item.value) ? get$2(item.value, props.valueKey) : item.value;
  25457. };
  25458. const optionsAllDisabled = computed$1(() => optionsArray.value.filter((option) => option.visible).every((option) => option.disabled));
  25459. const showTagList = computed$1(() => states.selected.slice(0, props.maxCollapseTags));
  25460. const collapseTagList = computed$1(() => states.selected.slice(props.maxCollapseTags));
  25461. const navigateOptions = (direction) => {
  25462. if (!states.visible) {
  25463. states.visible = true;
  25464. return;
  25465. }
  25466. if (states.options.size === 0 || states.filteredOptionsCount === 0)
  25467. return;
  25468. if (states.isOnComposition)
  25469. return;
  25470. if (!optionsAllDisabled.value) {
  25471. if (direction === "next") {
  25472. states.hoverIndex++;
  25473. if (states.hoverIndex === states.options.size) {
  25474. states.hoverIndex = 0;
  25475. }
  25476. } else if (direction === "prev") {
  25477. states.hoverIndex--;
  25478. if (states.hoverIndex < 0) {
  25479. states.hoverIndex = states.options.size - 1;
  25480. }
  25481. }
  25482. const option = optionsArray.value[states.hoverIndex];
  25483. if (option.disabled === true || option.states.groupDisabled === true || !option.visible) {
  25484. navigateOptions(direction);
  25485. }
  25486. nextTick(() => scrollToOption(hoverOption.value));
  25487. }
  25488. };
  25489. const handleMouseEnter = () => {
  25490. states.mouseEnter = true;
  25491. };
  25492. const handleMouseLeave = () => {
  25493. states.mouseEnter = false;
  25494. };
  25495. return {
  25496. optionList,
  25497. optionsArray,
  25498. selectSize,
  25499. handleResize,
  25500. debouncedOnInputChange,
  25501. debouncedQueryChange,
  25502. deletePrevTag,
  25503. deleteTag,
  25504. deleteSelected,
  25505. handleOptionSelect,
  25506. scrollToOption,
  25507. readonly: readonly2,
  25508. resetInputHeight,
  25509. showClose,
  25510. iconComponent,
  25511. iconReverse,
  25512. showNewOption,
  25513. collapseTagSize,
  25514. setSelected,
  25515. managePlaceholder,
  25516. selectDisabled,
  25517. emptyText,
  25518. toggleLastOptionHitState,
  25519. resetInputState,
  25520. handleComposition,
  25521. onOptionCreate,
  25522. onOptionDestroy,
  25523. handleMenuEnter,
  25524. handleFocus,
  25525. blur,
  25526. handleBlur,
  25527. handleClearClick,
  25528. handleClose,
  25529. handleKeydownEscape,
  25530. toggleMenu,
  25531. selectOption,
  25532. getValueKey,
  25533. navigateOptions,
  25534. dropMenuVisible,
  25535. queryChange,
  25536. groupQueryChange,
  25537. showTagList,
  25538. collapseTagList,
  25539. reference,
  25540. input,
  25541. iOSInput,
  25542. tooltipRef,
  25543. tags,
  25544. selectWrapper,
  25545. scrollbar,
  25546. handleMouseEnter,
  25547. handleMouseLeave
  25548. };
  25549. };
  25550. var ElOptions = defineComponent({
  25551. name: "ElOptions",
  25552. emits: ["update-options"],
  25553. setup(_, { slots, emit }) {
  25554. let cachedOptions = [];
  25555. function isSameOptions(a, b) {
  25556. if (a.length !== b.length)
  25557. return false;
  25558. for (const [index2] of a.entries()) {
  25559. if (a[index2] != b[index2]) {
  25560. return false;
  25561. }
  25562. }
  25563. return true;
  25564. }
  25565. return () => {
  25566. var _a2, _b;
  25567. const children = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
  25568. const filteredOptions = [];
  25569. function filterOptions(children2) {
  25570. if (!Array.isArray(children2))
  25571. return;
  25572. children2.forEach((item) => {
  25573. var _a22, _b2, _c, _d;
  25574. const name = (_a22 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a22.name;
  25575. if (name === "ElOptionGroup") {
  25576. filterOptions(!isString(item.children) && !Array.isArray(item.children) && isFunction$3((_b2 = item.children) == null ? void 0 : _b2.default) ? (_c = item.children) == null ? void 0 : _c.default() : item.children);
  25577. } else if (name === "ElOption") {
  25578. filteredOptions.push((_d = item.props) == null ? void 0 : _d.label);
  25579. } else if (Array.isArray(item.children)) {
  25580. filterOptions(item.children);
  25581. }
  25582. });
  25583. }
  25584. if (children.length) {
  25585. filterOptions((_b = children[0]) == null ? void 0 : _b.children);
  25586. }
  25587. if (!isSameOptions(filteredOptions, cachedOptions)) {
  25588. cachedOptions = filteredOptions;
  25589. emit("update-options", filteredOptions);
  25590. }
  25591. return children;
  25592. };
  25593. }
  25594. });
  25595. const COMPONENT_NAME$1 = "ElSelect";
  25596. const _sfc_main$5 = defineComponent({
  25597. name: COMPONENT_NAME$1,
  25598. componentName: COMPONENT_NAME$1,
  25599. components: {
  25600. ElInput,
  25601. ElSelectMenu,
  25602. ElOption: Option,
  25603. ElOptions,
  25604. ElTag,
  25605. ElScrollbar,
  25606. ElTooltip,
  25607. ElIcon
  25608. },
  25609. directives: { ClickOutside },
  25610. props: {
  25611. name: String,
  25612. id: String,
  25613. modelValue: {
  25614. type: [Array, String, Number, Boolean, Object],
  25615. default: void 0
  25616. },
  25617. autocomplete: {
  25618. type: String,
  25619. default: "off"
  25620. },
  25621. automaticDropdown: Boolean,
  25622. size: {
  25623. type: String,
  25624. validator: isValidComponentSize
  25625. },
  25626. effect: {
  25627. type: String,
  25628. default: "light"
  25629. },
  25630. disabled: Boolean,
  25631. clearable: Boolean,
  25632. filterable: Boolean,
  25633. allowCreate: Boolean,
  25634. loading: Boolean,
  25635. popperClass: {
  25636. type: String,
  25637. default: ""
  25638. },
  25639. popperOptions: {
  25640. type: Object,
  25641. default: () => ({})
  25642. },
  25643. remote: Boolean,
  25644. loadingText: String,
  25645. noMatchText: String,
  25646. noDataText: String,
  25647. remoteMethod: Function,
  25648. filterMethod: Function,
  25649. multiple: Boolean,
  25650. multipleLimit: {
  25651. type: Number,
  25652. default: 0
  25653. },
  25654. placeholder: {
  25655. type: String
  25656. },
  25657. defaultFirstOption: Boolean,
  25658. reserveKeyword: {
  25659. type: Boolean,
  25660. default: true
  25661. },
  25662. valueKey: {
  25663. type: String,
  25664. default: "value"
  25665. },
  25666. collapseTags: Boolean,
  25667. collapseTagsTooltip: {
  25668. type: Boolean,
  25669. default: false
  25670. },
  25671. maxCollapseTags: {
  25672. type: Number,
  25673. default: 1
  25674. },
  25675. teleported: useTooltipContentProps.teleported,
  25676. persistent: {
  25677. type: Boolean,
  25678. default: true
  25679. },
  25680. clearIcon: {
  25681. type: iconPropType,
  25682. default: circle_close_default
  25683. },
  25684. fitInputWidth: {
  25685. type: Boolean,
  25686. default: false
  25687. },
  25688. suffixIcon: {
  25689. type: iconPropType,
  25690. default: arrow_down_default
  25691. },
  25692. tagType: { ...tagProps.type, default: "info" },
  25693. validateEvent: {
  25694. type: Boolean,
  25695. default: true
  25696. },
  25697. remoteShowSuffix: {
  25698. type: Boolean,
  25699. default: false
  25700. },
  25701. suffixTransition: {
  25702. type: Boolean,
  25703. default: true
  25704. },
  25705. placement: {
  25706. type: String,
  25707. values: Ee,
  25708. default: "bottom-start"
  25709. }
  25710. },
  25711. emits: [
  25712. UPDATE_MODEL_EVENT,
  25713. CHANGE_EVENT,
  25714. "remove-tag",
  25715. "clear",
  25716. "visible-change",
  25717. "focus",
  25718. "blur"
  25719. ],
  25720. setup(props, ctx) {
  25721. const nsSelect = useNamespace("select");
  25722. const nsInput = useNamespace("input");
  25723. const { t: t2 } = useLocale();
  25724. const states = useSelectStates(props);
  25725. const {
  25726. optionList,
  25727. optionsArray,
  25728. selectSize,
  25729. readonly: readonly2,
  25730. handleResize,
  25731. collapseTagSize,
  25732. debouncedOnInputChange,
  25733. debouncedQueryChange,
  25734. deletePrevTag,
  25735. deleteTag,
  25736. deleteSelected,
  25737. handleOptionSelect,
  25738. scrollToOption,
  25739. setSelected,
  25740. resetInputHeight,
  25741. managePlaceholder,
  25742. showClose,
  25743. selectDisabled,
  25744. iconComponent,
  25745. iconReverse,
  25746. showNewOption,
  25747. emptyText,
  25748. toggleLastOptionHitState,
  25749. resetInputState,
  25750. handleComposition,
  25751. onOptionCreate,
  25752. onOptionDestroy,
  25753. handleMenuEnter,
  25754. handleFocus,
  25755. blur,
  25756. handleBlur,
  25757. handleClearClick,
  25758. handleClose,
  25759. handleKeydownEscape,
  25760. toggleMenu,
  25761. selectOption,
  25762. getValueKey,
  25763. navigateOptions,
  25764. dropMenuVisible,
  25765. reference,
  25766. input,
  25767. iOSInput,
  25768. tooltipRef,
  25769. tags,
  25770. selectWrapper,
  25771. scrollbar,
  25772. queryChange,
  25773. groupQueryChange,
  25774. handleMouseEnter,
  25775. handleMouseLeave,
  25776. showTagList,
  25777. collapseTagList
  25778. } = useSelect(props, states, ctx);
  25779. const { focus } = useFocus(reference);
  25780. const {
  25781. inputWidth,
  25782. selected,
  25783. inputLength,
  25784. filteredOptionsCount,
  25785. visible,
  25786. softFocus,
  25787. selectedLabel,
  25788. hoverIndex,
  25789. query,
  25790. inputHovering,
  25791. currentPlaceholder,
  25792. menuVisibleOnFocus,
  25793. isOnComposition,
  25794. isSilentBlur,
  25795. options: options2,
  25796. cachedOptions,
  25797. optionsCount,
  25798. prefixWidth,
  25799. tagInMultiLine
  25800. } = toRefs(states);
  25801. const wrapperKls = computed$1(() => {
  25802. const classList = [nsSelect.b()];
  25803. const _selectSize = unref(selectSize);
  25804. if (_selectSize) {
  25805. classList.push(nsSelect.m(_selectSize));
  25806. }
  25807. if (props.disabled) {
  25808. classList.push(nsSelect.m("disabled"));
  25809. }
  25810. return classList;
  25811. });
  25812. const selectTagsStyle = computed$1(() => ({
  25813. maxWidth: `${unref(inputWidth) - 32}px`,
  25814. width: "100%"
  25815. }));
  25816. const tagTextStyle = computed$1(() => {
  25817. const maxWidth = unref(inputWidth) > 123 ? unref(inputWidth) - 123 : unref(inputWidth) - 75;
  25818. return { maxWidth: `${maxWidth}px` };
  25819. });
  25820. provide(selectKey, reactive({
  25821. props,
  25822. options: options2,
  25823. optionsArray,
  25824. cachedOptions,
  25825. optionsCount,
  25826. filteredOptionsCount,
  25827. hoverIndex,
  25828. handleOptionSelect,
  25829. onOptionCreate,
  25830. onOptionDestroy,
  25831. selectWrapper,
  25832. selected,
  25833. setSelected,
  25834. queryChange,
  25835. groupQueryChange
  25836. }));
  25837. onMounted(() => {
  25838. states.cachedPlaceHolder = currentPlaceholder.value = props.placeholder || (() => t2("el.select.placeholder"));
  25839. if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
  25840. currentPlaceholder.value = "";
  25841. }
  25842. useResizeObserver(selectWrapper, handleResize);
  25843. if (props.remote && props.multiple) {
  25844. resetInputHeight();
  25845. }
  25846. nextTick(() => {
  25847. const refEl = reference.value && reference.value.$el;
  25848. if (!refEl)
  25849. return;
  25850. inputWidth.value = refEl.getBoundingClientRect().width;
  25851. if (ctx.slots.prefix) {
  25852. const prefix = refEl.querySelector(`.${nsInput.e("prefix")}`);
  25853. prefixWidth.value = Math.max(prefix.getBoundingClientRect().width + 5, 30);
  25854. }
  25855. });
  25856. setSelected();
  25857. });
  25858. if (props.multiple && !Array.isArray(props.modelValue)) {
  25859. ctx.emit(UPDATE_MODEL_EVENT, []);
  25860. }
  25861. if (!props.multiple && Array.isArray(props.modelValue)) {
  25862. ctx.emit(UPDATE_MODEL_EVENT, "");
  25863. }
  25864. const popperPaneRef = computed$1(() => {
  25865. var _a2, _b;
  25866. return (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b.contentRef;
  25867. });
  25868. const onOptionsRendered = (v) => {
  25869. optionList.value = v;
  25870. };
  25871. return {
  25872. isIOS,
  25873. onOptionsRendered,
  25874. tagInMultiLine,
  25875. prefixWidth,
  25876. selectSize,
  25877. readonly: readonly2,
  25878. handleResize,
  25879. collapseTagSize,
  25880. debouncedOnInputChange,
  25881. debouncedQueryChange,
  25882. deletePrevTag,
  25883. deleteTag,
  25884. deleteSelected,
  25885. handleOptionSelect,
  25886. scrollToOption,
  25887. inputWidth,
  25888. selected,
  25889. inputLength,
  25890. filteredOptionsCount,
  25891. visible,
  25892. softFocus,
  25893. selectedLabel,
  25894. hoverIndex,
  25895. query,
  25896. inputHovering,
  25897. currentPlaceholder,
  25898. menuVisibleOnFocus,
  25899. isOnComposition,
  25900. isSilentBlur,
  25901. options: options2,
  25902. resetInputHeight,
  25903. managePlaceholder,
  25904. showClose,
  25905. selectDisabled,
  25906. iconComponent,
  25907. iconReverse,
  25908. showNewOption,
  25909. emptyText,
  25910. toggleLastOptionHitState,
  25911. resetInputState,
  25912. handleComposition,
  25913. handleMenuEnter,
  25914. handleFocus,
  25915. blur,
  25916. handleBlur,
  25917. handleClearClick,
  25918. handleClose,
  25919. handleKeydownEscape,
  25920. toggleMenu,
  25921. selectOption,
  25922. getValueKey,
  25923. navigateOptions,
  25924. dropMenuVisible,
  25925. focus,
  25926. reference,
  25927. input,
  25928. iOSInput,
  25929. tooltipRef,
  25930. popperPaneRef,
  25931. tags,
  25932. selectWrapper,
  25933. scrollbar,
  25934. wrapperKls,
  25935. selectTagsStyle,
  25936. nsSelect,
  25937. tagTextStyle,
  25938. handleMouseEnter,
  25939. handleMouseLeave,
  25940. showTagList,
  25941. collapseTagList
  25942. };
  25943. }
  25944. });
  25945. const _hoisted_1$4 = ["disabled", "autocomplete"];
  25946. const _hoisted_2$4 = ["disabled"];
  25947. const _hoisted_3$4 = { style: { "height": "100%", "display": "flex", "justify-content": "center", "align-items": "center" } };
  25948. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  25949. const _component_el_tag = resolveComponent("el-tag");
  25950. const _component_el_tooltip = resolveComponent("el-tooltip");
  25951. const _component_el_icon = resolveComponent("el-icon");
  25952. const _component_el_input = resolveComponent("el-input");
  25953. const _component_el_option = resolveComponent("el-option");
  25954. const _component_el_options = resolveComponent("el-options");
  25955. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  25956. const _component_el_select_menu = resolveComponent("el-select-menu");
  25957. const _directive_click_outside = resolveDirective("click-outside");
  25958. return withDirectives((openBlock(), createElementBlock("div", {
  25959. ref: "selectWrapper",
  25960. class: normalizeClass(_ctx.wrapperKls),
  25961. onMouseenter: _cache[21] || (_cache[21] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
  25962. onMouseleave: _cache[22] || (_cache[22] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
  25963. onClick: _cache[23] || (_cache[23] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
  25964. }, [
  25965. createVNode(_component_el_tooltip, {
  25966. ref: "tooltipRef",
  25967. visible: _ctx.dropMenuVisible,
  25968. placement: _ctx.placement,
  25969. teleported: _ctx.teleported,
  25970. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  25971. "popper-options": _ctx.popperOptions,
  25972. "fallback-placements": ["bottom-start", "top-start", "right", "left"],
  25973. effect: _ctx.effect,
  25974. pure: "",
  25975. trigger: "click",
  25976. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  25977. "stop-popper-mouse-event": false,
  25978. "gpu-acceleration": false,
  25979. persistent: _ctx.persistent,
  25980. onShow: _ctx.handleMenuEnter
  25981. }, {
  25982. default: withCtx(() => [
  25983. createElementVNode("div", {
  25984. class: "select-trigger",
  25985. onMouseenter: _cache[19] || (_cache[19] = ($event) => _ctx.inputHovering = true),
  25986. onMouseleave: _cache[20] || (_cache[20] = ($event) => _ctx.inputHovering = false)
  25987. }, [
  25988. _ctx.multiple ? (openBlock(), createElementBlock("div", {
  25989. key: 0,
  25990. ref: "tags",
  25991. class: normalizeClass([
  25992. _ctx.nsSelect.e("tags"),
  25993. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  25994. ]),
  25995. style: normalizeStyle(_ctx.selectTagsStyle)
  25996. }, [
  25997. _ctx.collapseTags && _ctx.selected.length ? (openBlock(), createBlock(Transition, {
  25998. key: 0,
  25999. onAfterLeave: _ctx.resetInputHeight
  26000. }, {
  26001. default: withCtx(() => [
  26002. createElementVNode("span", {
  26003. class: normalizeClass([
  26004. _ctx.nsSelect.b("tags-wrapper"),
  26005. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  26006. ])
  26007. }, [
  26008. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.showTagList, (item) => {
  26009. return openBlock(), createBlock(_component_el_tag, {
  26010. key: _ctx.getValueKey(item),
  26011. closable: !_ctx.selectDisabled && !item.isDisabled,
  26012. size: _ctx.collapseTagSize,
  26013. hit: item.hitState,
  26014. type: _ctx.tagType,
  26015. "disable-transitions": "",
  26016. onClose: ($event) => _ctx.deleteTag($event, item)
  26017. }, {
  26018. default: withCtx(() => [
  26019. createElementVNode("span", {
  26020. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  26021. style: normalizeStyle(_ctx.tagTextStyle)
  26022. }, toDisplayString(item.currentLabel), 7)
  26023. ]),
  26024. _: 2
  26025. }, 1032, ["closable", "size", "hit", "type", "onClose"]);
  26026. }), 128)),
  26027. _ctx.selected.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(_component_el_tag, {
  26028. key: 0,
  26029. closable: false,
  26030. size: _ctx.collapseTagSize,
  26031. type: _ctx.tagType,
  26032. "disable-transitions": ""
  26033. }, {
  26034. default: withCtx(() => [
  26035. _ctx.collapseTagsTooltip ? (openBlock(), createBlock(_component_el_tooltip, {
  26036. key: 0,
  26037. disabled: _ctx.dropMenuVisible,
  26038. "fallback-placements": ["bottom", "top", "right", "left"],
  26039. effect: _ctx.effect,
  26040. placement: "bottom",
  26041. teleported: _ctx.teleported
  26042. }, {
  26043. default: withCtx(() => [
  26044. createElementVNode("span", {
  26045. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  26046. }, "+ " + toDisplayString(_ctx.selected.length - _ctx.maxCollapseTags), 3)
  26047. ]),
  26048. content: withCtx(() => [
  26049. createElementVNode("div", {
  26050. class: normalizeClass(_ctx.nsSelect.e("collapse-tags"))
  26051. }, [
  26052. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.collapseTagList, (item) => {
  26053. return openBlock(), createElementBlock("div", {
  26054. key: _ctx.getValueKey(item),
  26055. class: normalizeClass(_ctx.nsSelect.e("collapse-tag"))
  26056. }, [
  26057. createVNode(_component_el_tag, {
  26058. class: "in-tooltip",
  26059. closable: !_ctx.selectDisabled && !item.isDisabled,
  26060. size: _ctx.collapseTagSize,
  26061. hit: item.hitState,
  26062. type: _ctx.tagType,
  26063. "disable-transitions": "",
  26064. style: { margin: "2px" },
  26065. onClose: ($event) => _ctx.deleteTag($event, item)
  26066. }, {
  26067. default: withCtx(() => [
  26068. createElementVNode("span", {
  26069. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  26070. style: normalizeStyle({
  26071. maxWidth: _ctx.inputWidth - 75 + "px"
  26072. })
  26073. }, toDisplayString(item.currentLabel), 7)
  26074. ]),
  26075. _: 2
  26076. }, 1032, ["closable", "size", "hit", "type", "onClose"])
  26077. ], 2);
  26078. }), 128))
  26079. ], 2)
  26080. ]),
  26081. _: 1
  26082. }, 8, ["disabled", "effect", "teleported"])) : (openBlock(), createElementBlock("span", {
  26083. key: 1,
  26084. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  26085. }, "+ " + toDisplayString(_ctx.selected.length - _ctx.maxCollapseTags), 3))
  26086. ]),
  26087. _: 1
  26088. }, 8, ["size", "type"])) : createCommentVNode("v-if", true)
  26089. ], 2)
  26090. ]),
  26091. _: 1
  26092. }, 8, ["onAfterLeave"])) : createCommentVNode("v-if", true),
  26093. !_ctx.collapseTags ? (openBlock(), createBlock(Transition, {
  26094. key: 1,
  26095. onAfterLeave: _ctx.resetInputHeight
  26096. }, {
  26097. default: withCtx(() => [
  26098. createElementVNode("span", {
  26099. class: normalizeClass([
  26100. _ctx.nsSelect.b("tags-wrapper"),
  26101. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  26102. ])
  26103. }, [
  26104. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selected, (item) => {
  26105. return openBlock(), createBlock(_component_el_tag, {
  26106. key: _ctx.getValueKey(item),
  26107. closable: !_ctx.selectDisabled && !item.isDisabled,
  26108. size: _ctx.collapseTagSize,
  26109. hit: item.hitState,
  26110. type: _ctx.tagType,
  26111. "disable-transitions": "",
  26112. onClose: ($event) => _ctx.deleteTag($event, item)
  26113. }, {
  26114. default: withCtx(() => [
  26115. createElementVNode("span", {
  26116. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  26117. style: normalizeStyle({ maxWidth: _ctx.inputWidth - 75 + "px" })
  26118. }, toDisplayString(item.currentLabel), 7)
  26119. ]),
  26120. _: 2
  26121. }, 1032, ["closable", "size", "hit", "type", "onClose"]);
  26122. }), 128))
  26123. ], 2)
  26124. ]),
  26125. _: 1
  26126. }, 8, ["onAfterLeave"])) : createCommentVNode("v-if", true),
  26127. _ctx.filterable ? withDirectives((openBlock(), createElementBlock("input", {
  26128. key: 2,
  26129. ref: "input",
  26130. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.query = $event),
  26131. type: "text",
  26132. class: normalizeClass([
  26133. _ctx.nsSelect.e("input"),
  26134. _ctx.nsSelect.is(_ctx.selectSize),
  26135. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  26136. ]),
  26137. disabled: _ctx.selectDisabled,
  26138. autocomplete: _ctx.autocomplete,
  26139. style: normalizeStyle({
  26140. marginLeft: _ctx.prefixWidth && !_ctx.selected.length || _ctx.tagInMultiLine ? `${_ctx.prefixWidth}px` : "",
  26141. flexGrow: 1,
  26142. width: `${_ctx.inputLength / (_ctx.inputWidth - 32)}%`,
  26143. maxWidth: `${_ctx.inputWidth - 42}px`
  26144. }),
  26145. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  26146. onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  26147. onKeyup: _cache[3] || (_cache[3] = (...args) => _ctx.managePlaceholder && _ctx.managePlaceholder(...args)),
  26148. onKeydown: [
  26149. _cache[4] || (_cache[4] = (...args) => _ctx.resetInputState && _ctx.resetInputState(...args)),
  26150. _cache[5] || (_cache[5] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["prevent"]), ["down"])),
  26151. _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["prevent"]), ["up"])),
  26152. _cache[7] || (_cache[7] = withKeys((...args) => _ctx.handleKeydownEscape && _ctx.handleKeydownEscape(...args), ["esc"])),
  26153. _cache[8] || (_cache[8] = withKeys(withModifiers((...args) => _ctx.selectOption && _ctx.selectOption(...args), ["stop", "prevent"]), ["enter"])),
  26154. _cache[9] || (_cache[9] = withKeys((...args) => _ctx.deletePrevTag && _ctx.deletePrevTag(...args), ["delete"])),
  26155. _cache[10] || (_cache[10] = withKeys(($event) => _ctx.visible = false, ["tab"]))
  26156. ],
  26157. onCompositionstart: _cache[11] || (_cache[11] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  26158. onCompositionupdate: _cache[12] || (_cache[12] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  26159. onCompositionend: _cache[13] || (_cache[13] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  26160. onInput: _cache[14] || (_cache[14] = (...args) => _ctx.debouncedQueryChange && _ctx.debouncedQueryChange(...args))
  26161. }, null, 46, _hoisted_1$4)), [
  26162. [vModelText, _ctx.query]
  26163. ]) : createCommentVNode("v-if", true)
  26164. ], 6)) : createCommentVNode("v-if", true),
  26165. createCommentVNode(" fix: https://github.com/element-plus/element-plus/issues/11415 "),
  26166. _ctx.isIOS && !_ctx.multiple && _ctx.filterable && _ctx.readonly ? (openBlock(), createElementBlock("input", {
  26167. key: 1,
  26168. ref: "iOSInput",
  26169. class: normalizeClass([
  26170. _ctx.nsSelect.e("input"),
  26171. _ctx.nsSelect.is(_ctx.selectSize),
  26172. _ctx.nsSelect.em("input", "iOS")
  26173. ]),
  26174. disabled: _ctx.selectDisabled,
  26175. type: "text"
  26176. }, null, 10, _hoisted_2$4)) : createCommentVNode("v-if", true),
  26177. createVNode(_component_el_input, {
  26178. id: _ctx.id,
  26179. ref: "reference",
  26180. modelValue: _ctx.selectedLabel,
  26181. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.selectedLabel = $event),
  26182. type: "text",
  26183. placeholder: typeof _ctx.currentPlaceholder === "function" ? _ctx.currentPlaceholder() : _ctx.currentPlaceholder,
  26184. name: _ctx.name,
  26185. autocomplete: _ctx.autocomplete,
  26186. size: _ctx.selectSize,
  26187. disabled: _ctx.selectDisabled,
  26188. readonly: _ctx.readonly,
  26189. "validate-event": false,
  26190. class: normalizeClass([_ctx.nsSelect.is("focus", _ctx.visible)]),
  26191. tabindex: _ctx.multiple && _ctx.filterable ? -1 : void 0,
  26192. onFocus: _ctx.handleFocus,
  26193. onBlur: _ctx.handleBlur,
  26194. onInput: _ctx.debouncedOnInputChange,
  26195. onPaste: _ctx.debouncedOnInputChange,
  26196. onCompositionstart: _ctx.handleComposition,
  26197. onCompositionupdate: _ctx.handleComposition,
  26198. onCompositionend: _ctx.handleComposition,
  26199. onKeydown: [
  26200. _cache[16] || (_cache[16] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"])),
  26201. _cache[17] || (_cache[17] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"])),
  26202. withKeys(withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]),
  26203. withKeys(_ctx.handleKeydownEscape, ["esc"]),
  26204. _cache[18] || (_cache[18] = withKeys(($event) => _ctx.visible = false, ["tab"]))
  26205. ]
  26206. }, createSlots({
  26207. suffix: withCtx(() => [
  26208. _ctx.iconComponent && !_ctx.showClose ? (openBlock(), createBlock(_component_el_icon, {
  26209. key: 0,
  26210. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  26211. }, {
  26212. default: withCtx(() => [
  26213. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  26214. ]),
  26215. _: 1
  26216. }, 8, ["class"])) : createCommentVNode("v-if", true),
  26217. _ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  26218. key: 1,
  26219. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon")]),
  26220. onClick: _ctx.handleClearClick
  26221. }, {
  26222. default: withCtx(() => [
  26223. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  26224. ]),
  26225. _: 1
  26226. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  26227. ]),
  26228. _: 2
  26229. }, [
  26230. _ctx.$slots.prefix ? {
  26231. name: "prefix",
  26232. fn: withCtx(() => [
  26233. createElementVNode("div", _hoisted_3$4, [
  26234. renderSlot(_ctx.$slots, "prefix")
  26235. ])
  26236. ])
  26237. } : void 0
  26238. ]), 1032, ["id", "modelValue", "placeholder", "name", "autocomplete", "size", "disabled", "readonly", "class", "tabindex", "onFocus", "onBlur", "onInput", "onPaste", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown"])
  26239. ], 32)
  26240. ]),
  26241. content: withCtx(() => [
  26242. createVNode(_component_el_select_menu, null, {
  26243. default: withCtx(() => [
  26244. withDirectives(createVNode(_component_el_scrollbar, {
  26245. ref: "scrollbar",
  26246. tag: "ul",
  26247. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  26248. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  26249. class: normalizeClass([
  26250. _ctx.nsSelect.is("empty", !_ctx.allowCreate && Boolean(_ctx.query) && _ctx.filteredOptionsCount === 0)
  26251. ])
  26252. }, {
  26253. default: withCtx(() => [
  26254. _ctx.showNewOption ? (openBlock(), createBlock(_component_el_option, {
  26255. key: 0,
  26256. value: _ctx.query,
  26257. created: true
  26258. }, null, 8, ["value"])) : createCommentVNode("v-if", true),
  26259. createVNode(_component_el_options, { onUpdateOptions: _ctx.onOptionsRendered }, {
  26260. default: withCtx(() => [
  26261. renderSlot(_ctx.$slots, "default")
  26262. ]),
  26263. _: 3
  26264. }, 8, ["onUpdateOptions"])
  26265. ]),
  26266. _: 3
  26267. }, 8, ["wrap-class", "view-class", "class"]), [
  26268. [vShow, _ctx.options.size > 0 && !_ctx.loading]
  26269. ]),
  26270. _ctx.emptyText && (!_ctx.allowCreate || _ctx.loading || _ctx.allowCreate && _ctx.options.size === 0) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  26271. _ctx.$slots.empty ? renderSlot(_ctx.$slots, "empty", { key: 0 }) : (openBlock(), createElementBlock("p", {
  26272. key: 1,
  26273. class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  26274. }, toDisplayString(_ctx.emptyText), 3))
  26275. ], 64)) : createCommentVNode("v-if", true)
  26276. ]),
  26277. _: 3
  26278. })
  26279. ]),
  26280. _: 3
  26281. }, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "effect", "transition", "persistent", "onShow"])
  26282. ], 34)), [
  26283. [_directive_click_outside, _ctx.handleClose, _ctx.popperPaneRef]
  26284. ]);
  26285. }
  26286. var Select = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["render", _sfc_render$1], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/select.vue"]]);
  26287. const _sfc_main$4 = defineComponent({
  26288. name: "ElOptionGroup",
  26289. componentName: "ElOptionGroup",
  26290. props: {
  26291. label: String,
  26292. disabled: {
  26293. type: Boolean,
  26294. default: false
  26295. }
  26296. },
  26297. setup(props) {
  26298. const ns = useNamespace("select");
  26299. const visible = ref(true);
  26300. const instance = getCurrentInstance();
  26301. const children = ref([]);
  26302. provide(selectGroupKey, reactive({
  26303. ...toRefs(props)
  26304. }));
  26305. const select = inject(selectKey);
  26306. onMounted(() => {
  26307. children.value = flattedChildren(instance.subTree);
  26308. });
  26309. const flattedChildren = (node) => {
  26310. const children2 = [];
  26311. if (Array.isArray(node.children)) {
  26312. node.children.forEach((child) => {
  26313. var _a2;
  26314. if (child.type && child.type.name === "ElOption" && child.component && child.component.proxy) {
  26315. children2.push(child.component.proxy);
  26316. } else if ((_a2 = child.children) == null ? void 0 : _a2.length) {
  26317. children2.push(...flattedChildren(child));
  26318. }
  26319. });
  26320. }
  26321. return children2;
  26322. };
  26323. const { groupQueryChange } = toRaw$1(select);
  26324. watch(groupQueryChange, () => {
  26325. visible.value = children.value.some((option) => option.visible === true);
  26326. }, { flush: "post" });
  26327. return {
  26328. visible,
  26329. ns
  26330. };
  26331. }
  26332. });
  26333. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  26334. return withDirectives((openBlock(), createElementBlock("ul", {
  26335. class: normalizeClass(_ctx.ns.be("group", "wrap"))
  26336. }, [
  26337. createElementVNode("li", {
  26338. class: normalizeClass(_ctx.ns.be("group", "title"))
  26339. }, toDisplayString(_ctx.label), 3),
  26340. createElementVNode("li", null, [
  26341. createElementVNode("ul", {
  26342. class: normalizeClass(_ctx.ns.b("group"))
  26343. }, [
  26344. renderSlot(_ctx.$slots, "default")
  26345. ], 2)
  26346. ])
  26347. ], 2)), [
  26348. [vShow, _ctx.visible]
  26349. ]);
  26350. }
  26351. var OptionGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$4, [["render", _sfc_render], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/option-group.vue"]]);
  26352. const ElSelect = withInstall(Select, {
  26353. Option,
  26354. OptionGroup
  26355. });
  26356. const ElOption = withNoopInstall(Option);
  26357. withNoopInstall(OptionGroup);
  26358. const switchProps = buildProps({
  26359. modelValue: {
  26360. type: [Boolean, String, Number],
  26361. default: false
  26362. },
  26363. value: {
  26364. type: [Boolean, String, Number],
  26365. default: false
  26366. },
  26367. disabled: {
  26368. type: Boolean,
  26369. default: false
  26370. },
  26371. width: {
  26372. type: [String, Number],
  26373. default: ""
  26374. },
  26375. inlinePrompt: {
  26376. type: Boolean,
  26377. default: false
  26378. },
  26379. activeIcon: {
  26380. type: iconPropType
  26381. },
  26382. inactiveIcon: {
  26383. type: iconPropType
  26384. },
  26385. activeText: {
  26386. type: String,
  26387. default: ""
  26388. },
  26389. inactiveText: {
  26390. type: String,
  26391. default: ""
  26392. },
  26393. activeColor: {
  26394. type: String,
  26395. default: ""
  26396. },
  26397. inactiveColor: {
  26398. type: String,
  26399. default: ""
  26400. },
  26401. borderColor: {
  26402. type: String,
  26403. default: ""
  26404. },
  26405. activeValue: {
  26406. type: [Boolean, String, Number],
  26407. default: true
  26408. },
  26409. inactiveValue: {
  26410. type: [Boolean, String, Number],
  26411. default: false
  26412. },
  26413. name: {
  26414. type: String,
  26415. default: ""
  26416. },
  26417. validateEvent: {
  26418. type: Boolean,
  26419. default: true
  26420. },
  26421. id: String,
  26422. loading: {
  26423. type: Boolean,
  26424. default: false
  26425. },
  26426. beforeChange: {
  26427. type: definePropType(Function)
  26428. },
  26429. size: {
  26430. type: String,
  26431. validator: isValidComponentSize
  26432. },
  26433. tabindex: {
  26434. type: [String, Number]
  26435. }
  26436. });
  26437. const switchEmits = {
  26438. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  26439. [CHANGE_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  26440. [INPUT_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val)
  26441. };
  26442. const _hoisted_1$3 = ["onClick"];
  26443. const _hoisted_2$3 = ["id", "aria-checked", "aria-disabled", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"];
  26444. const _hoisted_3$3 = ["aria-hidden"];
  26445. const _hoisted_4$3 = ["aria-hidden"];
  26446. const _hoisted_5$3 = ["aria-hidden"];
  26447. const COMPONENT_NAME = "ElSwitch";
  26448. const __default__ = defineComponent({
  26449. name: COMPONENT_NAME
  26450. });
  26451. const _sfc_main$3 = /* @__PURE__ */ defineComponent({
  26452. ...__default__,
  26453. props: switchProps,
  26454. emits: switchEmits,
  26455. setup(__props, { expose, emit }) {
  26456. const props = __props;
  26457. const vm = getCurrentInstance();
  26458. const { formItem } = useFormItem();
  26459. const switchSize = useFormSize();
  26460. const ns = useNamespace("switch");
  26461. useDeprecated({
  26462. from: '"value"',
  26463. replacement: '"model-value" or "v-model"',
  26464. scope: COMPONENT_NAME,
  26465. version: "2.3.0",
  26466. ref: "https://element-plus.org/en-US/component/switch.html#attributes",
  26467. type: "Attribute"
  26468. }, computed$1(() => {
  26469. var _a2;
  26470. return !!((_a2 = vm.vnode.props) == null ? void 0 : _a2.value);
  26471. }));
  26472. const { inputId } = useFormItemInputId(props, {
  26473. formItemContext: formItem
  26474. });
  26475. const switchDisabled = useFormDisabled(computed$1(() => props.loading));
  26476. const isControlled = ref(props.modelValue !== false);
  26477. const input = ref();
  26478. const core = ref();
  26479. const switchKls = computed$1(() => [
  26480. ns.b(),
  26481. ns.m(switchSize.value),
  26482. ns.is("disabled", switchDisabled.value),
  26483. ns.is("checked", checked.value)
  26484. ]);
  26485. const coreStyle = computed$1(() => ({
  26486. width: addUnit(props.width)
  26487. }));
  26488. watch(() => props.modelValue, () => {
  26489. isControlled.value = true;
  26490. });
  26491. watch(() => props.value, () => {
  26492. isControlled.value = false;
  26493. });
  26494. const actualValue = computed$1(() => {
  26495. return isControlled.value ? props.modelValue : props.value;
  26496. });
  26497. const checked = computed$1(() => actualValue.value === props.activeValue);
  26498. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  26499. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  26500. emit(CHANGE_EVENT, props.inactiveValue);
  26501. emit(INPUT_EVENT, props.inactiveValue);
  26502. }
  26503. watch(checked, (val) => {
  26504. var _a2;
  26505. input.value.checked = val;
  26506. if (props.validateEvent) {
  26507. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  26508. }
  26509. });
  26510. const handleChange = () => {
  26511. const val = checked.value ? props.inactiveValue : props.activeValue;
  26512. emit(UPDATE_MODEL_EVENT, val);
  26513. emit(CHANGE_EVENT, val);
  26514. emit(INPUT_EVENT, val);
  26515. nextTick(() => {
  26516. input.value.checked = checked.value;
  26517. });
  26518. };
  26519. const switchValue = () => {
  26520. if (switchDisabled.value)
  26521. return;
  26522. const { beforeChange } = props;
  26523. if (!beforeChange) {
  26524. handleChange();
  26525. return;
  26526. }
  26527. const shouldChange = beforeChange();
  26528. const isPromiseOrBool = [
  26529. isPromise$2(shouldChange),
  26530. isBoolean(shouldChange)
  26531. ].includes(true);
  26532. if (!isPromiseOrBool) {
  26533. throwError(COMPONENT_NAME, "beforeChange must return type `Promise<boolean>` or `boolean`");
  26534. }
  26535. if (isPromise$2(shouldChange)) {
  26536. shouldChange.then((result) => {
  26537. if (result) {
  26538. handleChange();
  26539. }
  26540. }).catch((e) => {
  26541. });
  26542. } else if (shouldChange) {
  26543. handleChange();
  26544. }
  26545. };
  26546. const styles = computed$1(() => {
  26547. return ns.cssVarBlock({
  26548. ...props.activeColor ? { "on-color": props.activeColor } : null,
  26549. ...props.inactiveColor ? { "off-color": props.inactiveColor } : null,
  26550. ...props.borderColor ? { "border-color": props.borderColor } : null
  26551. });
  26552. });
  26553. const focus = () => {
  26554. var _a2, _b;
  26555. (_b = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2);
  26556. };
  26557. onMounted(() => {
  26558. input.value.checked = checked.value;
  26559. });
  26560. expose({
  26561. focus,
  26562. checked
  26563. });
  26564. return (_ctx, _cache) => {
  26565. return openBlock(), createElementBlock("div", {
  26566. class: normalizeClass(unref(switchKls)),
  26567. style: normalizeStyle(unref(styles)),
  26568. onClick: withModifiers(switchValue, ["prevent"])
  26569. }, [
  26570. createElementVNode("input", {
  26571. id: unref(inputId),
  26572. ref_key: "input",
  26573. ref: input,
  26574. class: normalizeClass(unref(ns).e("input")),
  26575. type: "checkbox",
  26576. role: "switch",
  26577. "aria-checked": unref(checked),
  26578. "aria-disabled": unref(switchDisabled),
  26579. name: _ctx.name,
  26580. "true-value": _ctx.activeValue,
  26581. "false-value": _ctx.inactiveValue,
  26582. disabled: unref(switchDisabled),
  26583. tabindex: _ctx.tabindex,
  26584. onChange: handleChange,
  26585. onKeydown: withKeys(switchValue, ["enter"])
  26586. }, null, 42, _hoisted_2$3),
  26587. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (openBlock(), createElementBlock("span", {
  26588. key: 0,
  26589. class: normalizeClass([
  26590. unref(ns).e("label"),
  26591. unref(ns).em("label", "left"),
  26592. unref(ns).is("active", !unref(checked))
  26593. ])
  26594. }, [
  26595. _ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  26596. default: withCtx(() => [
  26597. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
  26598. ]),
  26599. _: 1
  26600. })) : createCommentVNode("v-if", true),
  26601. !_ctx.inactiveIcon && _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  26602. key: 1,
  26603. "aria-hidden": unref(checked)
  26604. }, toDisplayString(_ctx.inactiveText), 9, _hoisted_3$3)) : createCommentVNode("v-if", true)
  26605. ], 2)) : createCommentVNode("v-if", true),
  26606. createElementVNode("span", {
  26607. ref_key: "core",
  26608. ref: core,
  26609. class: normalizeClass(unref(ns).e("core")),
  26610. style: normalizeStyle(unref(coreStyle))
  26611. }, [
  26612. _ctx.inlinePrompt ? (openBlock(), createElementBlock("div", {
  26613. key: 0,
  26614. class: normalizeClass(unref(ns).e("inner"))
  26615. }, [
  26616. _ctx.activeIcon || _ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), {
  26617. key: 0,
  26618. class: normalizeClass(unref(ns).is("icon"))
  26619. }, {
  26620. default: withCtx(() => [
  26621. (openBlock(), createBlock(resolveDynamicComponent(unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon)))
  26622. ]),
  26623. _: 1
  26624. }, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  26625. key: 1,
  26626. class: normalizeClass(unref(ns).is("text")),
  26627. "aria-hidden": !unref(checked)
  26628. }, toDisplayString(unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, _hoisted_4$3)) : createCommentVNode("v-if", true)
  26629. ], 2)) : createCommentVNode("v-if", true),
  26630. createElementVNode("div", {
  26631. class: normalizeClass(unref(ns).e("action"))
  26632. }, [
  26633. _ctx.loading ? (openBlock(), createBlock(unref(ElIcon), {
  26634. key: 0,
  26635. class: normalizeClass(unref(ns).is("loading"))
  26636. }, {
  26637. default: withCtx(() => [
  26638. createVNode(unref(loading_default))
  26639. ]),
  26640. _: 1
  26641. }, 8, ["class"])) : createCommentVNode("v-if", true)
  26642. ], 2)
  26643. ], 6),
  26644. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (openBlock(), createElementBlock("span", {
  26645. key: 1,
  26646. class: normalizeClass([
  26647. unref(ns).e("label"),
  26648. unref(ns).em("label", "right"),
  26649. unref(ns).is("active", unref(checked))
  26650. ])
  26651. }, [
  26652. _ctx.activeIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  26653. default: withCtx(() => [
  26654. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
  26655. ]),
  26656. _: 1
  26657. })) : createCommentVNode("v-if", true),
  26658. !_ctx.activeIcon && _ctx.activeText ? (openBlock(), createElementBlock("span", {
  26659. key: 1,
  26660. "aria-hidden": !unref(checked)
  26661. }, toDisplayString(_ctx.activeText), 9, _hoisted_5$3)) : createCommentVNode("v-if", true)
  26662. ], 2)) : createCommentVNode("v-if", true)
  26663. ], 14, _hoisted_1$3);
  26664. };
  26665. }
  26666. });
  26667. var Switch = /* @__PURE__ */ _export_sfc$1(_sfc_main$3, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/switch/src/switch.vue"]]);
  26668. const ElSwitch = withInstall(Switch);
  26669. /*! Element Plus v2.3.4 */
  26670. var zhCn = {
  26671. name: "zh-cn",
  26672. el: {
  26673. colorpicker: {
  26674. confirm: "\u786E\u5B9A",
  26675. clear: "\u6E05\u7A7A"
  26676. },
  26677. datepicker: {
  26678. now: "\u6B64\u523B",
  26679. today: "\u4ECA\u5929",
  26680. cancel: "\u53D6\u6D88",
  26681. clear: "\u6E05\u7A7A",
  26682. confirm: "\u786E\u5B9A",
  26683. selectDate: "\u9009\u62E9\u65E5\u671F",
  26684. selectTime: "\u9009\u62E9\u65F6\u95F4",
  26685. startDate: "\u5F00\u59CB\u65E5\u671F",
  26686. startTime: "\u5F00\u59CB\u65F6\u95F4",
  26687. endDate: "\u7ED3\u675F\u65E5\u671F",
  26688. endTime: "\u7ED3\u675F\u65F6\u95F4",
  26689. prevYear: "\u524D\u4E00\u5E74",
  26690. nextYear: "\u540E\u4E00\u5E74",
  26691. prevMonth: "\u4E0A\u4E2A\u6708",
  26692. nextMonth: "\u4E0B\u4E2A\u6708",
  26693. year: "\u5E74",
  26694. month1: "1 \u6708",
  26695. month2: "2 \u6708",
  26696. month3: "3 \u6708",
  26697. month4: "4 \u6708",
  26698. month5: "5 \u6708",
  26699. month6: "6 \u6708",
  26700. month7: "7 \u6708",
  26701. month8: "8 \u6708",
  26702. month9: "9 \u6708",
  26703. month10: "10 \u6708",
  26704. month11: "11 \u6708",
  26705. month12: "12 \u6708",
  26706. weeks: {
  26707. sun: "\u65E5",
  26708. mon: "\u4E00",
  26709. tue: "\u4E8C",
  26710. wed: "\u4E09",
  26711. thu: "\u56DB",
  26712. fri: "\u4E94",
  26713. sat: "\u516D"
  26714. },
  26715. months: {
  26716. jan: "\u4E00\u6708",
  26717. feb: "\u4E8C\u6708",
  26718. mar: "\u4E09\u6708",
  26719. apr: "\u56DB\u6708",
  26720. may: "\u4E94\u6708",
  26721. jun: "\u516D\u6708",
  26722. jul: "\u4E03\u6708",
  26723. aug: "\u516B\u6708",
  26724. sep: "\u4E5D\u6708",
  26725. oct: "\u5341\u6708",
  26726. nov: "\u5341\u4E00\u6708",
  26727. dec: "\u5341\u4E8C\u6708"
  26728. }
  26729. },
  26730. select: {
  26731. loading: "\u52A0\u8F7D\u4E2D",
  26732. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  26733. noData: "\u65E0\u6570\u636E",
  26734. placeholder: "\u8BF7\u9009\u62E9"
  26735. },
  26736. cascader: {
  26737. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  26738. loading: "\u52A0\u8F7D\u4E2D",
  26739. placeholder: "\u8BF7\u9009\u62E9",
  26740. noData: "\u6682\u65E0\u6570\u636E"
  26741. },
  26742. pagination: {
  26743. goto: "\u524D\u5F80",
  26744. pagesize: "\u6761/\u9875",
  26745. total: "\u5171 {total} \u6761",
  26746. pageClassifier: "\u9875",
  26747. page: "\u9875",
  26748. prev: "\u4E0A\u4E00\u9875",
  26749. next: "\u4E0B\u4E00\u9875",
  26750. currentPage: "\u7B2C {pager} \u9875",
  26751. prevPages: "\u5411\u524D {pager} \u9875",
  26752. nextPages: "\u5411\u540E {pager} \u9875",
  26753. deprecationWarning: "\u4F60\u4F7F\u7528\u4E86\u4E00\u4E9B\u5DF2\u88AB\u5E9F\u5F03\u7684\u7528\u6CD5\uFF0C\u8BF7\u53C2\u8003 el-pagination \u7684\u5B98\u65B9\u6587\u6863"
  26754. },
  26755. messagebox: {
  26756. title: "\u63D0\u793A",
  26757. confirm: "\u786E\u5B9A",
  26758. cancel: "\u53D6\u6D88",
  26759. error: "\u8F93\u5165\u7684\u6570\u636E\u4E0D\u5408\u6CD5!"
  26760. },
  26761. upload: {
  26762. deleteTip: "\u6309 delete \u952E\u53EF\u5220\u9664",
  26763. delete: "\u5220\u9664",
  26764. preview: "\u67E5\u770B\u56FE\u7247",
  26765. continue: "\u7EE7\u7EED\u4E0A\u4F20"
  26766. },
  26767. table: {
  26768. emptyText: "\u6682\u65E0\u6570\u636E",
  26769. confirmFilter: "\u7B5B\u9009",
  26770. resetFilter: "\u91CD\u7F6E",
  26771. clearFilter: "\u5168\u90E8",
  26772. sumText: "\u5408\u8BA1"
  26773. },
  26774. tree: {
  26775. emptyText: "\u6682\u65E0\u6570\u636E"
  26776. },
  26777. transfer: {
  26778. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  26779. noData: "\u65E0\u6570\u636E",
  26780. titles: ["\u5217\u8868 1", "\u5217\u8868 2"],
  26781. filterPlaceholder: "\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",
  26782. noCheckedFormat: "\u5171 {total} \u9879",
  26783. hasCheckedFormat: "\u5DF2\u9009 {checked}/{total} \u9879"
  26784. },
  26785. image: {
  26786. error: "\u52A0\u8F7D\u5931\u8D25"
  26787. },
  26788. pageHeader: {
  26789. title: "\u8FD4\u56DE"
  26790. },
  26791. popconfirm: {
  26792. confirmButtonText: "\u786E\u5B9A",
  26793. cancelButtonText: "\u53D6\u6D88"
  26794. }
  26795. }
  26796. };
  26797. /*! Element Plus v2.3.4 */
  26798. var en = {
  26799. name: "en",
  26800. el: {
  26801. colorpicker: {
  26802. confirm: "OK",
  26803. clear: "Clear",
  26804. defaultLabel: "color picker",
  26805. description: "current color is {color}. press enter to select a new color."
  26806. },
  26807. datepicker: {
  26808. now: "Now",
  26809. today: "Today",
  26810. cancel: "Cancel",
  26811. clear: "Clear",
  26812. confirm: "OK",
  26813. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  26814. monthTablePrompt: "Use the arrow keys and enter to select the month",
  26815. yearTablePrompt: "Use the arrow keys and enter to select the year",
  26816. selectedDate: "Selected date",
  26817. selectDate: "Select date",
  26818. selectTime: "Select time",
  26819. startDate: "Start Date",
  26820. startTime: "Start Time",
  26821. endDate: "End Date",
  26822. endTime: "End Time",
  26823. prevYear: "Previous Year",
  26824. nextYear: "Next Year",
  26825. prevMonth: "Previous Month",
  26826. nextMonth: "Next Month",
  26827. year: "",
  26828. month1: "January",
  26829. month2: "February",
  26830. month3: "March",
  26831. month4: "April",
  26832. month5: "May",
  26833. month6: "June",
  26834. month7: "July",
  26835. month8: "August",
  26836. month9: "September",
  26837. month10: "October",
  26838. month11: "November",
  26839. month12: "December",
  26840. week: "week",
  26841. weeks: {
  26842. sun: "Sun",
  26843. mon: "Mon",
  26844. tue: "Tue",
  26845. wed: "Wed",
  26846. thu: "Thu",
  26847. fri: "Fri",
  26848. sat: "Sat"
  26849. },
  26850. weeksFull: {
  26851. sun: "Sunday",
  26852. mon: "Monday",
  26853. tue: "Tuesday",
  26854. wed: "Wednesday",
  26855. thu: "Thursday",
  26856. fri: "Friday",
  26857. sat: "Saturday"
  26858. },
  26859. months: {
  26860. jan: "Jan",
  26861. feb: "Feb",
  26862. mar: "Mar",
  26863. apr: "Apr",
  26864. may: "May",
  26865. jun: "Jun",
  26866. jul: "Jul",
  26867. aug: "Aug",
  26868. sep: "Sep",
  26869. oct: "Oct",
  26870. nov: "Nov",
  26871. dec: "Dec"
  26872. }
  26873. },
  26874. inputNumber: {
  26875. decrease: "decrease number",
  26876. increase: "increase number"
  26877. },
  26878. select: {
  26879. loading: "Loading",
  26880. noMatch: "No matching data",
  26881. noData: "No data",
  26882. placeholder: "Select"
  26883. },
  26884. dropdown: {
  26885. toggleDropdown: "Toggle Dropdown"
  26886. },
  26887. cascader: {
  26888. noMatch: "No matching data",
  26889. loading: "Loading",
  26890. placeholder: "Select",
  26891. noData: "No data"
  26892. },
  26893. pagination: {
  26894. goto: "Go to",
  26895. pagesize: "/page",
  26896. total: "Total {total}",
  26897. pageClassifier: "",
  26898. page: "Page",
  26899. prev: "Go to previous page",
  26900. next: "Go to next page",
  26901. currentPage: "page {pager}",
  26902. prevPages: "Previous {pager} pages",
  26903. nextPages: "Next {pager} pages",
  26904. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  26905. },
  26906. dialog: {
  26907. close: "Close this dialog"
  26908. },
  26909. drawer: {
  26910. close: "Close this dialog"
  26911. },
  26912. messagebox: {
  26913. title: "Message",
  26914. confirm: "OK",
  26915. cancel: "Cancel",
  26916. error: "Illegal input",
  26917. close: "Close this dialog"
  26918. },
  26919. upload: {
  26920. deleteTip: "press delete to remove",
  26921. delete: "Delete",
  26922. preview: "Preview",
  26923. continue: "Continue"
  26924. },
  26925. slider: {
  26926. defaultLabel: "slider between {min} and {max}",
  26927. defaultRangeStartLabel: "pick start value",
  26928. defaultRangeEndLabel: "pick end value"
  26929. },
  26930. table: {
  26931. emptyText: "No Data",
  26932. confirmFilter: "Confirm",
  26933. resetFilter: "Reset",
  26934. clearFilter: "All",
  26935. sumText: "Sum"
  26936. },
  26937. tree: {
  26938. emptyText: "No Data"
  26939. },
  26940. transfer: {
  26941. noMatch: "No matching data",
  26942. noData: "No data",
  26943. titles: ["List 1", "List 2"],
  26944. filterPlaceholder: "Enter keyword",
  26945. noCheckedFormat: "{total} items",
  26946. hasCheckedFormat: "{checked}/{total} checked"
  26947. },
  26948. image: {
  26949. error: "FAILED"
  26950. },
  26951. pageHeader: {
  26952. title: "Back"
  26953. },
  26954. popconfirm: {
  26955. confirmButtonText: "Yes",
  26956. cancelButtonText: "No"
  26957. }
  26958. }
  26959. };
  26960. var jquery = { exports: {} };
  26961. /*!
  26962. * jQuery JavaScript Library v3.7.0
  26963. * https://jquery.com/
  26964. *
  26965. * Copyright OpenJS Foundation and other contributors
  26966. * Released under the MIT license
  26967. * https://jquery.org/license
  26968. *
  26969. * Date: 2023-05-11T18:29Z
  26970. */
  26971. (function(module2) {
  26972. (function(global2, factory3) {
  26973. {
  26974. module2.exports = global2.document ? factory3(global2, true) : function(w) {
  26975. if (!w.document) {
  26976. throw new Error("jQuery requires a window with a document");
  26977. }
  26978. return factory3(w);
  26979. };
  26980. }
  26981. })(typeof window !== "undefined" ? window : commonjsGlobal, function(window2, noGlobal) {
  26982. var arr = [];
  26983. var getProto = Object.getPrototypeOf;
  26984. var slice = arr.slice;
  26985. var flat2 = arr.flat ? function(array) {
  26986. return arr.flat.call(array);
  26987. } : function(array) {
  26988. return arr.concat.apply([], array);
  26989. };
  26990. var push = arr.push;
  26991. var indexOf = arr.indexOf;
  26992. var class2type = {};
  26993. var toString2 = class2type.toString;
  26994. var hasOwn2 = class2type.hasOwnProperty;
  26995. var fnToString = hasOwn2.toString;
  26996. var ObjectFunctionString = fnToString.call(Object);
  26997. var support = {};
  26998. var isFunction2 = function isFunction3(obj) {
  26999. return typeof obj === "function" && typeof obj.nodeType !== "number" && typeof obj.item !== "function";
  27000. };
  27001. var isWindow = function isWindow2(obj) {
  27002. return obj != null && obj === obj.window;
  27003. };
  27004. var document2 = window2.document;
  27005. var preservedScriptAttributes = {
  27006. type: true,
  27007. src: true,
  27008. nonce: true,
  27009. noModule: true
  27010. };
  27011. function DOMEval(code, node, doc) {
  27012. doc = doc || document2;
  27013. var i2, val, script = doc.createElement("script");
  27014. script.text = code;
  27015. if (node) {
  27016. for (i2 in preservedScriptAttributes) {
  27017. val = node[i2] || node.getAttribute && node.getAttribute(i2);
  27018. if (val) {
  27019. script.setAttribute(i2, val);
  27020. }
  27021. }
  27022. }
  27023. doc.head.appendChild(script).parentNode.removeChild(script);
  27024. }
  27025. function toType(obj) {
  27026. if (obj == null) {
  27027. return obj + "";
  27028. }
  27029. return typeof obj === "object" || typeof obj === "function" ? class2type[toString2.call(obj)] || "object" : typeof obj;
  27030. }
  27031. var version2 = "3.7.0", rhtmlSuffix = /HTML$/i, jQuery = function(selector, context) {
  27032. return new jQuery.fn.init(selector, context);
  27033. };
  27034. jQuery.fn = jQuery.prototype = {
  27035. jquery: version2,
  27036. constructor: jQuery,
  27037. length: 0,
  27038. toArray: function() {
  27039. return slice.call(this);
  27040. },
  27041. get: function(num) {
  27042. if (num == null) {
  27043. return slice.call(this);
  27044. }
  27045. return num < 0 ? this[num + this.length] : this[num];
  27046. },
  27047. pushStack: function(elems) {
  27048. var ret = jQuery.merge(this.constructor(), elems);
  27049. ret.prevObject = this;
  27050. return ret;
  27051. },
  27052. each: function(callback2) {
  27053. return jQuery.each(this, callback2);
  27054. },
  27055. map: function(callback2) {
  27056. return this.pushStack(jQuery.map(this, function(elem, i2) {
  27057. return callback2.call(elem, i2, elem);
  27058. }));
  27059. },
  27060. slice: function() {
  27061. return this.pushStack(slice.apply(this, arguments));
  27062. },
  27063. first: function() {
  27064. return this.eq(0);
  27065. },
  27066. last: function() {
  27067. return this.eq(-1);
  27068. },
  27069. even: function() {
  27070. return this.pushStack(jQuery.grep(this, function(_elem, i2) {
  27071. return (i2 + 1) % 2;
  27072. }));
  27073. },
  27074. odd: function() {
  27075. return this.pushStack(jQuery.grep(this, function(_elem, i2) {
  27076. return i2 % 2;
  27077. }));
  27078. },
  27079. eq: function(i2) {
  27080. var len = this.length, j = +i2 + (i2 < 0 ? len : 0);
  27081. return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
  27082. },
  27083. end: function() {
  27084. return this.prevObject || this.constructor();
  27085. },
  27086. push,
  27087. sort: arr.sort,
  27088. splice: arr.splice
  27089. };
  27090. jQuery.extend = jQuery.fn.extend = function() {
  27091. var options2, name, src, copy2, copyIsArray, clone, target = arguments[0] || {}, i2 = 1, length = arguments.length, deep = false;
  27092. if (typeof target === "boolean") {
  27093. deep = target;
  27094. target = arguments[i2] || {};
  27095. i2++;
  27096. }
  27097. if (typeof target !== "object" && !isFunction2(target)) {
  27098. target = {};
  27099. }
  27100. if (i2 === length) {
  27101. target = this;
  27102. i2--;
  27103. }
  27104. for (; i2 < length; i2++) {
  27105. if ((options2 = arguments[i2]) != null) {
  27106. for (name in options2) {
  27107. copy2 = options2[name];
  27108. if (name === "__proto__" || target === copy2) {
  27109. continue;
  27110. }
  27111. if (deep && copy2 && (jQuery.isPlainObject(copy2) || (copyIsArray = Array.isArray(copy2)))) {
  27112. src = target[name];
  27113. if (copyIsArray && !Array.isArray(src)) {
  27114. clone = [];
  27115. } else if (!copyIsArray && !jQuery.isPlainObject(src)) {
  27116. clone = {};
  27117. } else {
  27118. clone = src;
  27119. }
  27120. copyIsArray = false;
  27121. target[name] = jQuery.extend(deep, clone, copy2);
  27122. } else if (copy2 !== void 0) {
  27123. target[name] = copy2;
  27124. }
  27125. }
  27126. }
  27127. }
  27128. return target;
  27129. };
  27130. jQuery.extend({
  27131. expando: "jQuery" + (version2 + Math.random()).replace(/\D/g, ""),
  27132. isReady: true,
  27133. error: function(msg) {
  27134. throw new Error(msg);
  27135. },
  27136. noop: function() {
  27137. },
  27138. isPlainObject: function(obj) {
  27139. var proto, Ctor;
  27140. if (!obj || toString2.call(obj) !== "[object Object]") {
  27141. return false;
  27142. }
  27143. proto = getProto(obj);
  27144. if (!proto) {
  27145. return true;
  27146. }
  27147. Ctor = hasOwn2.call(proto, "constructor") && proto.constructor;
  27148. return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
  27149. },
  27150. isEmptyObject: function(obj) {
  27151. var name;
  27152. for (name in obj) {
  27153. return false;
  27154. }
  27155. return true;
  27156. },
  27157. globalEval: function(code, options2, doc) {
  27158. DOMEval(code, { nonce: options2 && options2.nonce }, doc);
  27159. },
  27160. each: function(obj, callback2) {
  27161. var length, i2 = 0;
  27162. if (isArrayLike2(obj)) {
  27163. length = obj.length;
  27164. for (; i2 < length; i2++) {
  27165. if (callback2.call(obj[i2], i2, obj[i2]) === false) {
  27166. break;
  27167. }
  27168. }
  27169. } else {
  27170. for (i2 in obj) {
  27171. if (callback2.call(obj[i2], i2, obj[i2]) === false) {
  27172. break;
  27173. }
  27174. }
  27175. }
  27176. return obj;
  27177. },
  27178. text: function(elem) {
  27179. var node, ret = "", i2 = 0, nodeType = elem.nodeType;
  27180. if (!nodeType) {
  27181. while (node = elem[i2++]) {
  27182. ret += jQuery.text(node);
  27183. }
  27184. } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
  27185. return elem.textContent;
  27186. } else if (nodeType === 3 || nodeType === 4) {
  27187. return elem.nodeValue;
  27188. }
  27189. return ret;
  27190. },
  27191. makeArray: function(arr2, results) {
  27192. var ret = results || [];
  27193. if (arr2 != null) {
  27194. if (isArrayLike2(Object(arr2))) {
  27195. jQuery.merge(
  27196. ret,
  27197. typeof arr2 === "string" ? [arr2] : arr2
  27198. );
  27199. } else {
  27200. push.call(ret, arr2);
  27201. }
  27202. }
  27203. return ret;
  27204. },
  27205. inArray: function(elem, arr2, i2) {
  27206. return arr2 == null ? -1 : indexOf.call(arr2, elem, i2);
  27207. },
  27208. isXMLDoc: function(elem) {
  27209. var namespace = elem && elem.namespaceURI, docElem = elem && (elem.ownerDocument || elem).documentElement;
  27210. return !rhtmlSuffix.test(namespace || docElem && docElem.nodeName || "HTML");
  27211. },
  27212. merge: function(first, second) {
  27213. var len = +second.length, j = 0, i2 = first.length;
  27214. for (; j < len; j++) {
  27215. first[i2++] = second[j];
  27216. }
  27217. first.length = i2;
  27218. return first;
  27219. },
  27220. grep: function(elems, callback2, invert) {
  27221. var callbackInverse, matches = [], i2 = 0, length = elems.length, callbackExpect = !invert;
  27222. for (; i2 < length; i2++) {
  27223. callbackInverse = !callback2(elems[i2], i2);
  27224. if (callbackInverse !== callbackExpect) {
  27225. matches.push(elems[i2]);
  27226. }
  27227. }
  27228. return matches;
  27229. },
  27230. map: function(elems, callback2, arg) {
  27231. var length, value, i2 = 0, ret = [];
  27232. if (isArrayLike2(elems)) {
  27233. length = elems.length;
  27234. for (; i2 < length; i2++) {
  27235. value = callback2(elems[i2], i2, arg);
  27236. if (value != null) {
  27237. ret.push(value);
  27238. }
  27239. }
  27240. } else {
  27241. for (i2 in elems) {
  27242. value = callback2(elems[i2], i2, arg);
  27243. if (value != null) {
  27244. ret.push(value);
  27245. }
  27246. }
  27247. }
  27248. return flat2(ret);
  27249. },
  27250. guid: 1,
  27251. support
  27252. });
  27253. if (typeof Symbol === "function") {
  27254. jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
  27255. }
  27256. jQuery.each(
  27257. "Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),
  27258. function(_i, name) {
  27259. class2type["[object " + name + "]"] = name.toLowerCase();
  27260. }
  27261. );
  27262. function isArrayLike2(obj) {
  27263. var length = !!obj && "length" in obj && obj.length, type2 = toType(obj);
  27264. if (isFunction2(obj) || isWindow(obj)) {
  27265. return false;
  27266. }
  27267. return type2 === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
  27268. }
  27269. function nodeName(elem, name) {
  27270. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  27271. }
  27272. var pop = arr.pop;
  27273. var sort = arr.sort;
  27274. var splice2 = arr.splice;
  27275. var whitespace = "[\\x20\\t\\r\\n\\f]";
  27276. var rtrimCSS = new RegExp(
  27277. "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
  27278. "g"
  27279. );
  27280. jQuery.contains = function(a, b) {
  27281. var bup = b && b.parentNode;
  27282. return a === bup || !!(bup && bup.nodeType === 1 && (a.contains ? a.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
  27283. };
  27284. var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
  27285. function fcssescape(ch, asCodePoint) {
  27286. if (asCodePoint) {
  27287. if (ch === "\0") {
  27288. return "\uFFFD";
  27289. }
  27290. return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
  27291. }
  27292. return "\\" + ch;
  27293. }
  27294. jQuery.escapeSelector = function(sel) {
  27295. return (sel + "").replace(rcssescape, fcssescape);
  27296. };
  27297. var preferredDoc = document2, pushNative = push;
  27298. (function() {
  27299. var i2, Expr, outermostContext, sortInput, hasDuplicate, push2 = pushNative, document3, documentElement2, documentIsHTML, rbuggyQSA, matches, expando = jQuery.expando, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), nonnativeSelectorCache = createCache(), sortOrder = function(a, b) {
  27300. if (a === b) {
  27301. hasDuplicate = true;
  27302. }
  27303. return 0;
  27304. }, booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + "*([*^$|!~]?=)" + whitespace + `*(?:'((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)"|(` + identifier + "))|)" + whitespace + "*\\]", pseudos = ":(" + identifier + `)(?:\\((('((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|` + attributes + ")*)|.*)\\)|)", rwhitespace = new RegExp(whitespace + "+", "g"), rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"), rleadingCombinator = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"), rdescend = new RegExp(whitespace + "|>"), rpseudo = new RegExp(pseudos), ridentifier = new RegExp("^" + identifier + "$"), matchExpr = {
  27305. ID: new RegExp("^#(" + identifier + ")"),
  27306. CLASS: new RegExp("^\\.(" + identifier + ")"),
  27307. TAG: new RegExp("^(" + identifier + "|[*])"),
  27308. ATTR: new RegExp("^" + attributes),
  27309. PSEUDO: new RegExp("^" + pseudos),
  27310. CHILD: new RegExp(
  27311. "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)",
  27312. "i"
  27313. ),
  27314. bool: new RegExp("^(?:" + booleans + ")$", "i"),
  27315. needsContext: new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
  27316. }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rquickExpr2 = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, runescape = new RegExp("\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g"), funescape = function(escape2, nonHex) {
  27317. var high = "0x" + escape2.slice(1) - 65536;
  27318. if (nonHex) {
  27319. return nonHex;
  27320. }
  27321. return high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320);
  27322. }, unloadHandler = function() {
  27323. setDocument();
  27324. }, inDisabledFieldset = addCombinator(
  27325. function(elem) {
  27326. return elem.disabled === true && nodeName(elem, "fieldset");
  27327. },
  27328. { dir: "parentNode", next: "legend" }
  27329. );
  27330. function safeActiveElement() {
  27331. try {
  27332. return document3.activeElement;
  27333. } catch (err) {
  27334. }
  27335. }
  27336. try {
  27337. push2.apply(
  27338. arr = slice.call(preferredDoc.childNodes),
  27339. preferredDoc.childNodes
  27340. );
  27341. arr[preferredDoc.childNodes.length].nodeType;
  27342. } catch (e) {
  27343. push2 = {
  27344. apply: function(target, els) {
  27345. pushNative.apply(target, slice.call(els));
  27346. },
  27347. call: function(target) {
  27348. pushNative.apply(target, slice.call(arguments, 1));
  27349. }
  27350. };
  27351. }
  27352. function find2(selector, context, results, seed) {
  27353. var m, i3, elem, nid, match, groups, newSelector, newContext = context && context.ownerDocument, nodeType = context ? context.nodeType : 9;
  27354. results = results || [];
  27355. if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
  27356. return results;
  27357. }
  27358. if (!seed) {
  27359. setDocument(context);
  27360. context = context || document3;
  27361. if (documentIsHTML) {
  27362. if (nodeType !== 11 && (match = rquickExpr2.exec(selector))) {
  27363. if (m = match[1]) {
  27364. if (nodeType === 9) {
  27365. if (elem = context.getElementById(m)) {
  27366. if (elem.id === m) {
  27367. push2.call(results, elem);
  27368. return results;
  27369. }
  27370. } else {
  27371. return results;
  27372. }
  27373. } else {
  27374. if (newContext && (elem = newContext.getElementById(m)) && find2.contains(context, elem) && elem.id === m) {
  27375. push2.call(results, elem);
  27376. return results;
  27377. }
  27378. }
  27379. } else if (match[2]) {
  27380. push2.apply(results, context.getElementsByTagName(selector));
  27381. return results;
  27382. } else if ((m = match[3]) && context.getElementsByClassName) {
  27383. push2.apply(results, context.getElementsByClassName(m));
  27384. return results;
  27385. }
  27386. }
  27387. if (!nonnativeSelectorCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
  27388. newSelector = selector;
  27389. newContext = context;
  27390. if (nodeType === 1 && (rdescend.test(selector) || rleadingCombinator.test(selector))) {
  27391. newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
  27392. if (newContext != context || !support.scope) {
  27393. if (nid = context.getAttribute("id")) {
  27394. nid = jQuery.escapeSelector(nid);
  27395. } else {
  27396. context.setAttribute("id", nid = expando);
  27397. }
  27398. }
  27399. groups = tokenize(selector);
  27400. i3 = groups.length;
  27401. while (i3--) {
  27402. groups[i3] = (nid ? "#" + nid : ":scope") + " " + toSelector(groups[i3]);
  27403. }
  27404. newSelector = groups.join(",");
  27405. }
  27406. try {
  27407. push2.apply(
  27408. results,
  27409. newContext.querySelectorAll(newSelector)
  27410. );
  27411. return results;
  27412. } catch (qsaError) {
  27413. nonnativeSelectorCache(selector, true);
  27414. } finally {
  27415. if (nid === expando) {
  27416. context.removeAttribute("id");
  27417. }
  27418. }
  27419. }
  27420. }
  27421. }
  27422. return select(selector.replace(rtrimCSS, "$1"), context, results, seed);
  27423. }
  27424. function createCache() {
  27425. var keys3 = [];
  27426. function cache(key, value) {
  27427. if (keys3.push(key + " ") > Expr.cacheLength) {
  27428. delete cache[keys3.shift()];
  27429. }
  27430. return cache[key + " "] = value;
  27431. }
  27432. return cache;
  27433. }
  27434. function markFunction(fn2) {
  27435. fn2[expando] = true;
  27436. return fn2;
  27437. }
  27438. function assert(fn2) {
  27439. var el = document3.createElement("fieldset");
  27440. try {
  27441. return !!fn2(el);
  27442. } catch (e) {
  27443. return false;
  27444. } finally {
  27445. if (el.parentNode) {
  27446. el.parentNode.removeChild(el);
  27447. }
  27448. el = null;
  27449. }
  27450. }
  27451. function createInputPseudo(type2) {
  27452. return function(elem) {
  27453. return nodeName(elem, "input") && elem.type === type2;
  27454. };
  27455. }
  27456. function createButtonPseudo(type2) {
  27457. return function(elem) {
  27458. return (nodeName(elem, "input") || nodeName(elem, "button")) && elem.type === type2;
  27459. };
  27460. }
  27461. function createDisabledPseudo(disabled) {
  27462. return function(elem) {
  27463. if ("form" in elem) {
  27464. if (elem.parentNode && elem.disabled === false) {
  27465. if ("label" in elem) {
  27466. if ("label" in elem.parentNode) {
  27467. return elem.parentNode.disabled === disabled;
  27468. } else {
  27469. return elem.disabled === disabled;
  27470. }
  27471. }
  27472. return elem.isDisabled === disabled || elem.isDisabled !== !disabled && inDisabledFieldset(elem) === disabled;
  27473. }
  27474. return elem.disabled === disabled;
  27475. } else if ("label" in elem) {
  27476. return elem.disabled === disabled;
  27477. }
  27478. return false;
  27479. };
  27480. }
  27481. function createPositionalPseudo(fn2) {
  27482. return markFunction(function(argument) {
  27483. argument = +argument;
  27484. return markFunction(function(seed, matches2) {
  27485. var j, matchIndexes = fn2([], seed.length, argument), i3 = matchIndexes.length;
  27486. while (i3--) {
  27487. if (seed[j = matchIndexes[i3]]) {
  27488. seed[j] = !(matches2[j] = seed[j]);
  27489. }
  27490. }
  27491. });
  27492. });
  27493. }
  27494. function testContext(context) {
  27495. return context && typeof context.getElementsByTagName !== "undefined" && context;
  27496. }
  27497. function setDocument(node) {
  27498. var subWindow, doc = node ? node.ownerDocument || node : preferredDoc;
  27499. if (doc == document3 || doc.nodeType !== 9 || !doc.documentElement) {
  27500. return document3;
  27501. }
  27502. document3 = doc;
  27503. documentElement2 = document3.documentElement;
  27504. documentIsHTML = !jQuery.isXMLDoc(document3);
  27505. matches = documentElement2.matches || documentElement2.webkitMatchesSelector || documentElement2.msMatchesSelector;
  27506. if (preferredDoc != document3 && (subWindow = document3.defaultView) && subWindow.top !== subWindow) {
  27507. subWindow.addEventListener("unload", unloadHandler);
  27508. }
  27509. support.getById = assert(function(el) {
  27510. documentElement2.appendChild(el).id = jQuery.expando;
  27511. return !document3.getElementsByName || !document3.getElementsByName(jQuery.expando).length;
  27512. });
  27513. support.disconnectedMatch = assert(function(el) {
  27514. return matches.call(el, "*");
  27515. });
  27516. support.scope = assert(function() {
  27517. return document3.querySelectorAll(":scope");
  27518. });
  27519. support.cssHas = assert(function() {
  27520. try {
  27521. document3.querySelector(":has(*,:jqfake)");
  27522. return false;
  27523. } catch (e) {
  27524. return true;
  27525. }
  27526. });
  27527. if (support.getById) {
  27528. Expr.filter.ID = function(id) {
  27529. var attrId = id.replace(runescape, funescape);
  27530. return function(elem) {
  27531. return elem.getAttribute("id") === attrId;
  27532. };
  27533. };
  27534. Expr.find.ID = function(id, context) {
  27535. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  27536. var elem = context.getElementById(id);
  27537. return elem ? [elem] : [];
  27538. }
  27539. };
  27540. } else {
  27541. Expr.filter.ID = function(id) {
  27542. var attrId = id.replace(runescape, funescape);
  27543. return function(elem) {
  27544. var node2 = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  27545. return node2 && node2.value === attrId;
  27546. };
  27547. };
  27548. Expr.find.ID = function(id, context) {
  27549. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  27550. var node2, i3, elems, elem = context.getElementById(id);
  27551. if (elem) {
  27552. node2 = elem.getAttributeNode("id");
  27553. if (node2 && node2.value === id) {
  27554. return [elem];
  27555. }
  27556. elems = context.getElementsByName(id);
  27557. i3 = 0;
  27558. while (elem = elems[i3++]) {
  27559. node2 = elem.getAttributeNode("id");
  27560. if (node2 && node2.value === id) {
  27561. return [elem];
  27562. }
  27563. }
  27564. }
  27565. return [];
  27566. }
  27567. };
  27568. }
  27569. Expr.find.TAG = function(tag, context) {
  27570. if (typeof context.getElementsByTagName !== "undefined") {
  27571. return context.getElementsByTagName(tag);
  27572. } else {
  27573. return context.querySelectorAll(tag);
  27574. }
  27575. };
  27576. Expr.find.CLASS = function(className, context) {
  27577. if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
  27578. return context.getElementsByClassName(className);
  27579. }
  27580. };
  27581. rbuggyQSA = [];
  27582. assert(function(el) {
  27583. var input;
  27584. documentElement2.appendChild(el).innerHTML = "<a id='" + expando + "' href='' disabled='disabled'></a><select id='" + expando + "-\r\\' disabled='disabled'><option selected=''></option></select>";
  27585. if (!el.querySelectorAll("[selected]").length) {
  27586. rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
  27587. }
  27588. if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
  27589. rbuggyQSA.push("~=");
  27590. }
  27591. if (!el.querySelectorAll("a#" + expando + "+*").length) {
  27592. rbuggyQSA.push(".#.+[+~]");
  27593. }
  27594. if (!el.querySelectorAll(":checked").length) {
  27595. rbuggyQSA.push(":checked");
  27596. }
  27597. input = document3.createElement("input");
  27598. input.setAttribute("type", "hidden");
  27599. el.appendChild(input).setAttribute("name", "D");
  27600. documentElement2.appendChild(el).disabled = true;
  27601. if (el.querySelectorAll(":disabled").length !== 2) {
  27602. rbuggyQSA.push(":enabled", ":disabled");
  27603. }
  27604. input = document3.createElement("input");
  27605. input.setAttribute("name", "");
  27606. el.appendChild(input);
  27607. if (!el.querySelectorAll("[name='']").length) {
  27608. rbuggyQSA.push("\\[" + whitespace + "*name" + whitespace + "*=" + whitespace + `*(?:''|"")`);
  27609. }
  27610. });
  27611. if (!support.cssHas) {
  27612. rbuggyQSA.push(":has");
  27613. }
  27614. rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
  27615. sortOrder = function(a, b) {
  27616. if (a === b) {
  27617. hasDuplicate = true;
  27618. return 0;
  27619. }
  27620. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  27621. if (compare) {
  27622. return compare;
  27623. }
  27624. compare = (a.ownerDocument || a) == (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1;
  27625. if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
  27626. if (a === document3 || a.ownerDocument == preferredDoc && find2.contains(preferredDoc, a)) {
  27627. return -1;
  27628. }
  27629. if (b === document3 || b.ownerDocument == preferredDoc && find2.contains(preferredDoc, b)) {
  27630. return 1;
  27631. }
  27632. return sortInput ? indexOf.call(sortInput, a) - indexOf.call(sortInput, b) : 0;
  27633. }
  27634. return compare & 4 ? -1 : 1;
  27635. };
  27636. return document3;
  27637. }
  27638. find2.matches = function(expr, elements) {
  27639. return find2(expr, null, null, elements);
  27640. };
  27641. find2.matchesSelector = function(elem, expr) {
  27642. setDocument(elem);
  27643. if (documentIsHTML && !nonnativeSelectorCache[expr + " "] && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
  27644. try {
  27645. var ret = matches.call(elem, expr);
  27646. if (ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) {
  27647. return ret;
  27648. }
  27649. } catch (e) {
  27650. nonnativeSelectorCache(expr, true);
  27651. }
  27652. }
  27653. return find2(expr, document3, null, [elem]).length > 0;
  27654. };
  27655. find2.contains = function(context, elem) {
  27656. if ((context.ownerDocument || context) != document3) {
  27657. setDocument(context);
  27658. }
  27659. return jQuery.contains(context, elem);
  27660. };
  27661. find2.attr = function(elem, name) {
  27662. if ((elem.ownerDocument || elem) != document3) {
  27663. setDocument(elem);
  27664. }
  27665. var fn2 = Expr.attrHandle[name.toLowerCase()], val = fn2 && hasOwn2.call(Expr.attrHandle, name.toLowerCase()) ? fn2(elem, name, !documentIsHTML) : void 0;
  27666. if (val !== void 0) {
  27667. return val;
  27668. }
  27669. return elem.getAttribute(name);
  27670. };
  27671. find2.error = function(msg) {
  27672. throw new Error("Syntax error, unrecognized expression: " + msg);
  27673. };
  27674. jQuery.uniqueSort = function(results) {
  27675. var elem, duplicates = [], j = 0, i3 = 0;
  27676. hasDuplicate = !support.sortStable;
  27677. sortInput = !support.sortStable && slice.call(results, 0);
  27678. sort.call(results, sortOrder);
  27679. if (hasDuplicate) {
  27680. while (elem = results[i3++]) {
  27681. if (elem === results[i3]) {
  27682. j = duplicates.push(i3);
  27683. }
  27684. }
  27685. while (j--) {
  27686. splice2.call(results, duplicates[j], 1);
  27687. }
  27688. }
  27689. sortInput = null;
  27690. return results;
  27691. };
  27692. jQuery.fn.uniqueSort = function() {
  27693. return this.pushStack(jQuery.uniqueSort(slice.apply(this)));
  27694. };
  27695. Expr = jQuery.expr = {
  27696. cacheLength: 50,
  27697. createPseudo: markFunction,
  27698. match: matchExpr,
  27699. attrHandle: {},
  27700. find: {},
  27701. relative: {
  27702. ">": { dir: "parentNode", first: true },
  27703. " ": { dir: "parentNode" },
  27704. "+": { dir: "previousSibling", first: true },
  27705. "~": { dir: "previousSibling" }
  27706. },
  27707. preFilter: {
  27708. ATTR: function(match) {
  27709. match[1] = match[1].replace(runescape, funescape);
  27710. match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
  27711. if (match[2] === "~=") {
  27712. match[3] = " " + match[3] + " ";
  27713. }
  27714. return match.slice(0, 4);
  27715. },
  27716. CHILD: function(match) {
  27717. match[1] = match[1].toLowerCase();
  27718. if (match[1].slice(0, 3) === "nth") {
  27719. if (!match[3]) {
  27720. find2.error(match[0]);
  27721. }
  27722. match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
  27723. match[5] = +(match[7] + match[8] || match[3] === "odd");
  27724. } else if (match[3]) {
  27725. find2.error(match[0]);
  27726. }
  27727. return match;
  27728. },
  27729. PSEUDO: function(match) {
  27730. var excess, unquoted = !match[6] && match[2];
  27731. if (matchExpr.CHILD.test(match[0])) {
  27732. return null;
  27733. }
  27734. if (match[3]) {
  27735. match[2] = match[4] || match[5] || "";
  27736. } else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, true)) && (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
  27737. match[0] = match[0].slice(0, excess);
  27738. match[2] = unquoted.slice(0, excess);
  27739. }
  27740. return match.slice(0, 3);
  27741. }
  27742. },
  27743. filter: {
  27744. TAG: function(nodeNameSelector) {
  27745. var expectedNodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
  27746. return nodeNameSelector === "*" ? function() {
  27747. return true;
  27748. } : function(elem) {
  27749. return nodeName(elem, expectedNodeName);
  27750. };
  27751. },
  27752. CLASS: function(className) {
  27753. var pattern = classCache[className + " "];
  27754. return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function(elem) {
  27755. return pattern.test(
  27756. typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || ""
  27757. );
  27758. });
  27759. },
  27760. ATTR: function(name, operator, check) {
  27761. return function(elem) {
  27762. var result = find2.attr(elem, name);
  27763. if (result == null) {
  27764. return operator === "!=";
  27765. }
  27766. if (!operator) {
  27767. return true;
  27768. }
  27769. result += "";
  27770. if (operator === "=") {
  27771. return result === check;
  27772. }
  27773. if (operator === "!=") {
  27774. return result !== check;
  27775. }
  27776. if (operator === "^=") {
  27777. return check && result.indexOf(check) === 0;
  27778. }
  27779. if (operator === "*=") {
  27780. return check && result.indexOf(check) > -1;
  27781. }
  27782. if (operator === "$=") {
  27783. return check && result.slice(-check.length) === check;
  27784. }
  27785. if (operator === "~=") {
  27786. return (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1;
  27787. }
  27788. if (operator === "|=") {
  27789. return result === check || result.slice(0, check.length + 1) === check + "-";
  27790. }
  27791. return false;
  27792. };
  27793. },
  27794. CHILD: function(type2, what, _argument, first, last) {
  27795. var simple = type2.slice(0, 3) !== "nth", forward = type2.slice(-4) !== "last", ofType = what === "of-type";
  27796. return first === 1 && last === 0 ? function(elem) {
  27797. return !!elem.parentNode;
  27798. } : function(elem, _context, xml) {
  27799. var cache, outerCache, node, nodeIndex, start2, dir2 = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType, diff = false;
  27800. if (parent) {
  27801. if (simple) {
  27802. while (dir2) {
  27803. node = elem;
  27804. while (node = node[dir2]) {
  27805. if (ofType ? nodeName(node, name) : node.nodeType === 1) {
  27806. return false;
  27807. }
  27808. }
  27809. start2 = dir2 = type2 === "only" && !start2 && "nextSibling";
  27810. }
  27811. return true;
  27812. }
  27813. start2 = [forward ? parent.firstChild : parent.lastChild];
  27814. if (forward && useCache) {
  27815. outerCache = parent[expando] || (parent[expando] = {});
  27816. cache = outerCache[type2] || [];
  27817. nodeIndex = cache[0] === dirruns && cache[1];
  27818. diff = nodeIndex && cache[2];
  27819. node = nodeIndex && parent.childNodes[nodeIndex];
  27820. while (node = ++nodeIndex && node && node[dir2] || (diff = nodeIndex = 0) || start2.pop()) {
  27821. if (node.nodeType === 1 && ++diff && node === elem) {
  27822. outerCache[type2] = [dirruns, nodeIndex, diff];
  27823. break;
  27824. }
  27825. }
  27826. } else {
  27827. if (useCache) {
  27828. outerCache = elem[expando] || (elem[expando] = {});
  27829. cache = outerCache[type2] || [];
  27830. nodeIndex = cache[0] === dirruns && cache[1];
  27831. diff = nodeIndex;
  27832. }
  27833. if (diff === false) {
  27834. while (node = ++nodeIndex && node && node[dir2] || (diff = nodeIndex = 0) || start2.pop()) {
  27835. if ((ofType ? nodeName(node, name) : node.nodeType === 1) && ++diff) {
  27836. if (useCache) {
  27837. outerCache = node[expando] || (node[expando] = {});
  27838. outerCache[type2] = [dirruns, diff];
  27839. }
  27840. if (node === elem) {
  27841. break;
  27842. }
  27843. }
  27844. }
  27845. }
  27846. }
  27847. diff -= last;
  27848. return diff === first || diff % first === 0 && diff / first >= 0;
  27849. }
  27850. };
  27851. },
  27852. PSEUDO: function(pseudo, argument) {
  27853. var args, fn2 = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || find2.error("unsupported pseudo: " + pseudo);
  27854. if (fn2[expando]) {
  27855. return fn2(argument);
  27856. }
  27857. if (fn2.length > 1) {
  27858. args = [pseudo, pseudo, "", argument];
  27859. return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function(seed, matches2) {
  27860. var idx, matched = fn2(seed, argument), i3 = matched.length;
  27861. while (i3--) {
  27862. idx = indexOf.call(seed, matched[i3]);
  27863. seed[idx] = !(matches2[idx] = matched[i3]);
  27864. }
  27865. }) : function(elem) {
  27866. return fn2(elem, 0, args);
  27867. };
  27868. }
  27869. return fn2;
  27870. }
  27871. },
  27872. pseudos: {
  27873. not: markFunction(function(selector) {
  27874. var input = [], results = [], matcher = compile(selector.replace(rtrimCSS, "$1"));
  27875. return matcher[expando] ? markFunction(function(seed, matches2, _context, xml) {
  27876. var elem, unmatched = matcher(seed, null, xml, []), i3 = seed.length;
  27877. while (i3--) {
  27878. if (elem = unmatched[i3]) {
  27879. seed[i3] = !(matches2[i3] = elem);
  27880. }
  27881. }
  27882. }) : function(elem, _context, xml) {
  27883. input[0] = elem;
  27884. matcher(input, null, xml, results);
  27885. input[0] = null;
  27886. return !results.pop();
  27887. };
  27888. }),
  27889. has: markFunction(function(selector) {
  27890. return function(elem) {
  27891. return find2(selector, elem).length > 0;
  27892. };
  27893. }),
  27894. contains: markFunction(function(text) {
  27895. text = text.replace(runescape, funescape);
  27896. return function(elem) {
  27897. return (elem.textContent || jQuery.text(elem)).indexOf(text) > -1;
  27898. };
  27899. }),
  27900. lang: markFunction(function(lang) {
  27901. if (!ridentifier.test(lang || "")) {
  27902. find2.error("unsupported lang: " + lang);
  27903. }
  27904. lang = lang.replace(runescape, funescape).toLowerCase();
  27905. return function(elem) {
  27906. var elemLang;
  27907. do {
  27908. if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {
  27909. elemLang = elemLang.toLowerCase();
  27910. return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
  27911. }
  27912. } while ((elem = elem.parentNode) && elem.nodeType === 1);
  27913. return false;
  27914. };
  27915. }),
  27916. target: function(elem) {
  27917. var hash = window2.location && window2.location.hash;
  27918. return hash && hash.slice(1) === elem.id;
  27919. },
  27920. root: function(elem) {
  27921. return elem === documentElement2;
  27922. },
  27923. focus: function(elem) {
  27924. return elem === safeActiveElement() && document3.hasFocus() && !!(elem.type || elem.href || ~elem.tabIndex);
  27925. },
  27926. enabled: createDisabledPseudo(false),
  27927. disabled: createDisabledPseudo(true),
  27928. checked: function(elem) {
  27929. return nodeName(elem, "input") && !!elem.checked || nodeName(elem, "option") && !!elem.selected;
  27930. },
  27931. selected: function(elem) {
  27932. if (elem.parentNode) {
  27933. elem.parentNode.selectedIndex;
  27934. }
  27935. return elem.selected === true;
  27936. },
  27937. empty: function(elem) {
  27938. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  27939. if (elem.nodeType < 6) {
  27940. return false;
  27941. }
  27942. }
  27943. return true;
  27944. },
  27945. parent: function(elem) {
  27946. return !Expr.pseudos.empty(elem);
  27947. },
  27948. header: function(elem) {
  27949. return rheader.test(elem.nodeName);
  27950. },
  27951. input: function(elem) {
  27952. return rinputs.test(elem.nodeName);
  27953. },
  27954. button: function(elem) {
  27955. return nodeName(elem, "input") && elem.type === "button" || nodeName(elem, "button");
  27956. },
  27957. text: function(elem) {
  27958. var attr;
  27959. return nodeName(elem, "input") && elem.type === "text" && ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
  27960. },
  27961. first: createPositionalPseudo(function() {
  27962. return [0];
  27963. }),
  27964. last: createPositionalPseudo(function(_matchIndexes, length) {
  27965. return [length - 1];
  27966. }),
  27967. eq: createPositionalPseudo(function(_matchIndexes, length, argument) {
  27968. return [argument < 0 ? argument + length : argument];
  27969. }),
  27970. even: createPositionalPseudo(function(matchIndexes, length) {
  27971. var i3 = 0;
  27972. for (; i3 < length; i3 += 2) {
  27973. matchIndexes.push(i3);
  27974. }
  27975. return matchIndexes;
  27976. }),
  27977. odd: createPositionalPseudo(function(matchIndexes, length) {
  27978. var i3 = 1;
  27979. for (; i3 < length; i3 += 2) {
  27980. matchIndexes.push(i3);
  27981. }
  27982. return matchIndexes;
  27983. }),
  27984. lt: createPositionalPseudo(function(matchIndexes, length, argument) {
  27985. var i3;
  27986. if (argument < 0) {
  27987. i3 = argument + length;
  27988. } else if (argument > length) {
  27989. i3 = length;
  27990. } else {
  27991. i3 = argument;
  27992. }
  27993. for (; --i3 >= 0; ) {
  27994. matchIndexes.push(i3);
  27995. }
  27996. return matchIndexes;
  27997. }),
  27998. gt: createPositionalPseudo(function(matchIndexes, length, argument) {
  27999. var i3 = argument < 0 ? argument + length : argument;
  28000. for (; ++i3 < length; ) {
  28001. matchIndexes.push(i3);
  28002. }
  28003. return matchIndexes;
  28004. })
  28005. }
  28006. };
  28007. Expr.pseudos.nth = Expr.pseudos.eq;
  28008. for (i2 in { radio: true, checkbox: true, file: true, password: true, image: true }) {
  28009. Expr.pseudos[i2] = createInputPseudo(i2);
  28010. }
  28011. for (i2 in { submit: true, reset: true }) {
  28012. Expr.pseudos[i2] = createButtonPseudo(i2);
  28013. }
  28014. function setFilters() {
  28015. }
  28016. setFilters.prototype = Expr.filters = Expr.pseudos;
  28017. Expr.setFilters = new setFilters();
  28018. function tokenize(selector, parseOnly) {
  28019. var matched, match, tokens, type2, soFar, groups, preFilters, cached = tokenCache[selector + " "];
  28020. if (cached) {
  28021. return parseOnly ? 0 : cached.slice(0);
  28022. }
  28023. soFar = selector;
  28024. groups = [];
  28025. preFilters = Expr.preFilter;
  28026. while (soFar) {
  28027. if (!matched || (match = rcomma.exec(soFar))) {
  28028. if (match) {
  28029. soFar = soFar.slice(match[0].length) || soFar;
  28030. }
  28031. groups.push(tokens = []);
  28032. }
  28033. matched = false;
  28034. if (match = rleadingCombinator.exec(soFar)) {
  28035. matched = match.shift();
  28036. tokens.push({
  28037. value: matched,
  28038. type: match[0].replace(rtrimCSS, " ")
  28039. });
  28040. soFar = soFar.slice(matched.length);
  28041. }
  28042. for (type2 in Expr.filter) {
  28043. if ((match = matchExpr[type2].exec(soFar)) && (!preFilters[type2] || (match = preFilters[type2](match)))) {
  28044. matched = match.shift();
  28045. tokens.push({
  28046. value: matched,
  28047. type: type2,
  28048. matches: match
  28049. });
  28050. soFar = soFar.slice(matched.length);
  28051. }
  28052. }
  28053. if (!matched) {
  28054. break;
  28055. }
  28056. }
  28057. if (parseOnly) {
  28058. return soFar.length;
  28059. }
  28060. return soFar ? find2.error(selector) : tokenCache(selector, groups).slice(0);
  28061. }
  28062. function toSelector(tokens) {
  28063. var i3 = 0, len = tokens.length, selector = "";
  28064. for (; i3 < len; i3++) {
  28065. selector += tokens[i3].value;
  28066. }
  28067. return selector;
  28068. }
  28069. function addCombinator(matcher, combinator, base2) {
  28070. var dir2 = combinator.dir, skip = combinator.next, key = skip || dir2, checkNonElements = base2 && key === "parentNode", doneName = done++;
  28071. return combinator.first ? function(elem, context, xml) {
  28072. while (elem = elem[dir2]) {
  28073. if (elem.nodeType === 1 || checkNonElements) {
  28074. return matcher(elem, context, xml);
  28075. }
  28076. }
  28077. return false;
  28078. } : function(elem, context, xml) {
  28079. var oldCache, outerCache, newCache = [dirruns, doneName];
  28080. if (xml) {
  28081. while (elem = elem[dir2]) {
  28082. if (elem.nodeType === 1 || checkNonElements) {
  28083. if (matcher(elem, context, xml)) {
  28084. return true;
  28085. }
  28086. }
  28087. }
  28088. } else {
  28089. while (elem = elem[dir2]) {
  28090. if (elem.nodeType === 1 || checkNonElements) {
  28091. outerCache = elem[expando] || (elem[expando] = {});
  28092. if (skip && nodeName(elem, skip)) {
  28093. elem = elem[dir2] || elem;
  28094. } else if ((oldCache = outerCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
  28095. return newCache[2] = oldCache[2];
  28096. } else {
  28097. outerCache[key] = newCache;
  28098. if (newCache[2] = matcher(elem, context, xml)) {
  28099. return true;
  28100. }
  28101. }
  28102. }
  28103. }
  28104. }
  28105. return false;
  28106. };
  28107. }
  28108. function elementMatcher(matchers2) {
  28109. return matchers2.length > 1 ? function(elem, context, xml) {
  28110. var i3 = matchers2.length;
  28111. while (i3--) {
  28112. if (!matchers2[i3](elem, context, xml)) {
  28113. return false;
  28114. }
  28115. }
  28116. return true;
  28117. } : matchers2[0];
  28118. }
  28119. function multipleContexts(selector, contexts, results) {
  28120. var i3 = 0, len = contexts.length;
  28121. for (; i3 < len; i3++) {
  28122. find2(selector, contexts[i3], results);
  28123. }
  28124. return results;
  28125. }
  28126. function condense(unmatched, map, filter, context, xml) {
  28127. var elem, newUnmatched = [], i3 = 0, len = unmatched.length, mapped = map != null;
  28128. for (; i3 < len; i3++) {
  28129. if (elem = unmatched[i3]) {
  28130. if (!filter || filter(elem, context, xml)) {
  28131. newUnmatched.push(elem);
  28132. if (mapped) {
  28133. map.push(i3);
  28134. }
  28135. }
  28136. }
  28137. }
  28138. return newUnmatched;
  28139. }
  28140. function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
  28141. if (postFilter && !postFilter[expando]) {
  28142. postFilter = setMatcher(postFilter);
  28143. }
  28144. if (postFinder && !postFinder[expando]) {
  28145. postFinder = setMatcher(postFinder, postSelector);
  28146. }
  28147. return markFunction(function(seed, results, context, xml) {
  28148. var temp, i3, elem, matcherOut, preMap = [], postMap = [], preexisting = results.length, elems = seed || multipleContexts(
  28149. selector || "*",
  28150. context.nodeType ? [context] : context,
  28151. []
  28152. ), matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems;
  28153. if (matcher) {
  28154. matcherOut = postFinder || (seed ? preFilter : preexisting || postFilter) ? [] : results;
  28155. matcher(matcherIn, matcherOut, context, xml);
  28156. } else {
  28157. matcherOut = matcherIn;
  28158. }
  28159. if (postFilter) {
  28160. temp = condense(matcherOut, postMap);
  28161. postFilter(temp, [], context, xml);
  28162. i3 = temp.length;
  28163. while (i3--) {
  28164. if (elem = temp[i3]) {
  28165. matcherOut[postMap[i3]] = !(matcherIn[postMap[i3]] = elem);
  28166. }
  28167. }
  28168. }
  28169. if (seed) {
  28170. if (postFinder || preFilter) {
  28171. if (postFinder) {
  28172. temp = [];
  28173. i3 = matcherOut.length;
  28174. while (i3--) {
  28175. if (elem = matcherOut[i3]) {
  28176. temp.push(matcherIn[i3] = elem);
  28177. }
  28178. }
  28179. postFinder(null, matcherOut = [], temp, xml);
  28180. }
  28181. i3 = matcherOut.length;
  28182. while (i3--) {
  28183. if ((elem = matcherOut[i3]) && (temp = postFinder ? indexOf.call(seed, elem) : preMap[i3]) > -1) {
  28184. seed[temp] = !(results[temp] = elem);
  28185. }
  28186. }
  28187. }
  28188. } else {
  28189. matcherOut = condense(
  28190. matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut
  28191. );
  28192. if (postFinder) {
  28193. postFinder(null, results, matcherOut, xml);
  28194. } else {
  28195. push2.apply(results, matcherOut);
  28196. }
  28197. }
  28198. });
  28199. }
  28200. function matcherFromTokens(tokens) {
  28201. var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[tokens[0].type], implicitRelative = leadingRelative || Expr.relative[" "], i3 = leadingRelative ? 1 : 0, matchContext = addCombinator(function(elem) {
  28202. return elem === checkContext;
  28203. }, implicitRelative, true), matchAnyContext = addCombinator(function(elem) {
  28204. return indexOf.call(checkContext, elem) > -1;
  28205. }, implicitRelative, true), matchers2 = [function(elem, context, xml) {
  28206. var ret = !leadingRelative && (xml || context != outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
  28207. checkContext = null;
  28208. return ret;
  28209. }];
  28210. for (; i3 < len; i3++) {
  28211. if (matcher = Expr.relative[tokens[i3].type]) {
  28212. matchers2 = [addCombinator(elementMatcher(matchers2), matcher)];
  28213. } else {
  28214. matcher = Expr.filter[tokens[i3].type].apply(null, tokens[i3].matches);
  28215. if (matcher[expando]) {
  28216. j = ++i3;
  28217. for (; j < len; j++) {
  28218. if (Expr.relative[tokens[j].type]) {
  28219. break;
  28220. }
  28221. }
  28222. return setMatcher(
  28223. i3 > 1 && elementMatcher(matchers2),
  28224. i3 > 1 && toSelector(
  28225. tokens.slice(0, i3 - 1).concat({ value: tokens[i3 - 2].type === " " ? "*" : "" })
  28226. ).replace(rtrimCSS, "$1"),
  28227. matcher,
  28228. i3 < j && matcherFromTokens(tokens.slice(i3, j)),
  28229. j < len && matcherFromTokens(tokens = tokens.slice(j)),
  28230. j < len && toSelector(tokens)
  28231. );
  28232. }
  28233. matchers2.push(matcher);
  28234. }
  28235. }
  28236. return elementMatcher(matchers2);
  28237. }
  28238. function matcherFromGroupMatchers(elementMatchers, setMatchers) {
  28239. var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function(seed, context, xml, results, outermost) {
  28240. var elem, j, matcher, matchedCount = 0, i3 = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, elems = seed || byElement && Expr.find.TAG("*", outermost), dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1, len = elems.length;
  28241. if (outermost) {
  28242. outermostContext = context == document3 || context || outermost;
  28243. }
  28244. for (; i3 !== len && (elem = elems[i3]) != null; i3++) {
  28245. if (byElement && elem) {
  28246. j = 0;
  28247. if (!context && elem.ownerDocument != document3) {
  28248. setDocument(elem);
  28249. xml = !documentIsHTML;
  28250. }
  28251. while (matcher = elementMatchers[j++]) {
  28252. if (matcher(elem, context || document3, xml)) {
  28253. push2.call(results, elem);
  28254. break;
  28255. }
  28256. }
  28257. if (outermost) {
  28258. dirruns = dirrunsUnique;
  28259. }
  28260. }
  28261. if (bySet) {
  28262. if (elem = !matcher && elem) {
  28263. matchedCount--;
  28264. }
  28265. if (seed) {
  28266. unmatched.push(elem);
  28267. }
  28268. }
  28269. }
  28270. matchedCount += i3;
  28271. if (bySet && i3 !== matchedCount) {
  28272. j = 0;
  28273. while (matcher = setMatchers[j++]) {
  28274. matcher(unmatched, setMatched, context, xml);
  28275. }
  28276. if (seed) {
  28277. if (matchedCount > 0) {
  28278. while (i3--) {
  28279. if (!(unmatched[i3] || setMatched[i3])) {
  28280. setMatched[i3] = pop.call(results);
  28281. }
  28282. }
  28283. }
  28284. setMatched = condense(setMatched);
  28285. }
  28286. push2.apply(results, setMatched);
  28287. if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
  28288. jQuery.uniqueSort(results);
  28289. }
  28290. }
  28291. if (outermost) {
  28292. dirruns = dirrunsUnique;
  28293. outermostContext = contextBackup;
  28294. }
  28295. return unmatched;
  28296. };
  28297. return bySet ? markFunction(superMatcher) : superMatcher;
  28298. }
  28299. function compile(selector, match) {
  28300. var i3, setMatchers = [], elementMatchers = [], cached = compilerCache[selector + " "];
  28301. if (!cached) {
  28302. if (!match) {
  28303. match = tokenize(selector);
  28304. }
  28305. i3 = match.length;
  28306. while (i3--) {
  28307. cached = matcherFromTokens(match[i3]);
  28308. if (cached[expando]) {
  28309. setMatchers.push(cached);
  28310. } else {
  28311. elementMatchers.push(cached);
  28312. }
  28313. }
  28314. cached = compilerCache(
  28315. selector,
  28316. matcherFromGroupMatchers(elementMatchers, setMatchers)
  28317. );
  28318. cached.selector = selector;
  28319. }
  28320. return cached;
  28321. }
  28322. function select(selector, context, results, seed) {
  28323. var i3, tokens, token, type2, find3, compiled = typeof selector === "function" && selector, match = !seed && tokenize(selector = compiled.selector || selector);
  28324. results = results || [];
  28325. if (match.length === 1) {
  28326. tokens = match[0] = match[0].slice(0);
  28327. if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
  28328. context = (Expr.find.ID(
  28329. token.matches[0].replace(runescape, funescape),
  28330. context
  28331. ) || [])[0];
  28332. if (!context) {
  28333. return results;
  28334. } else if (compiled) {
  28335. context = context.parentNode;
  28336. }
  28337. selector = selector.slice(tokens.shift().value.length);
  28338. }
  28339. i3 = matchExpr.needsContext.test(selector) ? 0 : tokens.length;
  28340. while (i3--) {
  28341. token = tokens[i3];
  28342. if (Expr.relative[type2 = token.type]) {
  28343. break;
  28344. }
  28345. if (find3 = Expr.find[type2]) {
  28346. if (seed = find3(
  28347. token.matches[0].replace(runescape, funescape),
  28348. rsibling.test(tokens[0].type) && testContext(context.parentNode) || context
  28349. )) {
  28350. tokens.splice(i3, 1);
  28351. selector = seed.length && toSelector(tokens);
  28352. if (!selector) {
  28353. push2.apply(results, seed);
  28354. return results;
  28355. }
  28356. break;
  28357. }
  28358. }
  28359. }
  28360. }
  28361. (compiled || compile(selector, match))(
  28362. seed,
  28363. context,
  28364. !documentIsHTML,
  28365. results,
  28366. !context || rsibling.test(selector) && testContext(context.parentNode) || context
  28367. );
  28368. return results;
  28369. }
  28370. support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
  28371. setDocument();
  28372. support.sortDetached = assert(function(el) {
  28373. return el.compareDocumentPosition(document3.createElement("fieldset")) & 1;
  28374. });
  28375. jQuery.find = find2;
  28376. jQuery.expr[":"] = jQuery.expr.pseudos;
  28377. jQuery.unique = jQuery.uniqueSort;
  28378. find2.compile = compile;
  28379. find2.select = select;
  28380. find2.setDocument = setDocument;
  28381. find2.escape = jQuery.escapeSelector;
  28382. find2.getText = jQuery.text;
  28383. find2.isXML = jQuery.isXMLDoc;
  28384. find2.selectors = jQuery.expr;
  28385. find2.support = jQuery.support;
  28386. find2.uniqueSort = jQuery.uniqueSort;
  28387. })();
  28388. var dir = function(elem, dir2, until) {
  28389. var matched = [], truncate = until !== void 0;
  28390. while ((elem = elem[dir2]) && elem.nodeType !== 9) {
  28391. if (elem.nodeType === 1) {
  28392. if (truncate && jQuery(elem).is(until)) {
  28393. break;
  28394. }
  28395. matched.push(elem);
  28396. }
  28397. }
  28398. return matched;
  28399. };
  28400. var siblings = function(n, elem) {
  28401. var matched = [];
  28402. for (; n; n = n.nextSibling) {
  28403. if (n.nodeType === 1 && n !== elem) {
  28404. matched.push(n);
  28405. }
  28406. }
  28407. return matched;
  28408. };
  28409. var rneedsContext = jQuery.expr.match.needsContext;
  28410. var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;
  28411. function winnow(elements, qualifier, not) {
  28412. if (isFunction2(qualifier)) {
  28413. return jQuery.grep(elements, function(elem, i2) {
  28414. return !!qualifier.call(elem, i2, elem) !== not;
  28415. });
  28416. }
  28417. if (qualifier.nodeType) {
  28418. return jQuery.grep(elements, function(elem) {
  28419. return elem === qualifier !== not;
  28420. });
  28421. }
  28422. if (typeof qualifier !== "string") {
  28423. return jQuery.grep(elements, function(elem) {
  28424. return indexOf.call(qualifier, elem) > -1 !== not;
  28425. });
  28426. }
  28427. return jQuery.filter(qualifier, elements, not);
  28428. }
  28429. jQuery.filter = function(expr, elems, not) {
  28430. var elem = elems[0];
  28431. if (not) {
  28432. expr = ":not(" + expr + ")";
  28433. }
  28434. if (elems.length === 1 && elem.nodeType === 1) {
  28435. return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
  28436. }
  28437. return jQuery.find.matches(expr, jQuery.grep(elems, function(elem2) {
  28438. return elem2.nodeType === 1;
  28439. }));
  28440. };
  28441. jQuery.fn.extend({
  28442. find: function(selector) {
  28443. var i2, ret, len = this.length, self2 = this;
  28444. if (typeof selector !== "string") {
  28445. return this.pushStack(jQuery(selector).filter(function() {
  28446. for (i2 = 0; i2 < len; i2++) {
  28447. if (jQuery.contains(self2[i2], this)) {
  28448. return true;
  28449. }
  28450. }
  28451. }));
  28452. }
  28453. ret = this.pushStack([]);
  28454. for (i2 = 0; i2 < len; i2++) {
  28455. jQuery.find(selector, self2[i2], ret);
  28456. }
  28457. return len > 1 ? jQuery.uniqueSort(ret) : ret;
  28458. },
  28459. filter: function(selector) {
  28460. return this.pushStack(winnow(this, selector || [], false));
  28461. },
  28462. not: function(selector) {
  28463. return this.pushStack(winnow(this, selector || [], true));
  28464. },
  28465. is: function(selector) {
  28466. return !!winnow(
  28467. this,
  28468. typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [],
  28469. false
  28470. ).length;
  28471. }
  28472. });
  28473. var rootjQuery, rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, init = jQuery.fn.init = function(selector, context, root2) {
  28474. var match, elem;
  28475. if (!selector) {
  28476. return this;
  28477. }
  28478. root2 = root2 || rootjQuery;
  28479. if (typeof selector === "string") {
  28480. if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
  28481. match = [null, selector, null];
  28482. } else {
  28483. match = rquickExpr.exec(selector);
  28484. }
  28485. if (match && (match[1] || !context)) {
  28486. if (match[1]) {
  28487. context = context instanceof jQuery ? context[0] : context;
  28488. jQuery.merge(this, jQuery.parseHTML(
  28489. match[1],
  28490. context && context.nodeType ? context.ownerDocument || context : document2,
  28491. true
  28492. ));
  28493. if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
  28494. for (match in context) {
  28495. if (isFunction2(this[match])) {
  28496. this[match](context[match]);
  28497. } else {
  28498. this.attr(match, context[match]);
  28499. }
  28500. }
  28501. }
  28502. return this;
  28503. } else {
  28504. elem = document2.getElementById(match[2]);
  28505. if (elem) {
  28506. this[0] = elem;
  28507. this.length = 1;
  28508. }
  28509. return this;
  28510. }
  28511. } else if (!context || context.jquery) {
  28512. return (context || root2).find(selector);
  28513. } else {
  28514. return this.constructor(context).find(selector);
  28515. }
  28516. } else if (selector.nodeType) {
  28517. this[0] = selector;
  28518. this.length = 1;
  28519. return this;
  28520. } else if (isFunction2(selector)) {
  28521. return root2.ready !== void 0 ? root2.ready(selector) : selector(jQuery);
  28522. }
  28523. return jQuery.makeArray(selector, this);
  28524. };
  28525. init.prototype = jQuery.fn;
  28526. rootjQuery = jQuery(document2);
  28527. var rparentsprev = /^(?:parents|prev(?:Until|All))/, guaranteedUnique = {
  28528. children: true,
  28529. contents: true,
  28530. next: true,
  28531. prev: true
  28532. };
  28533. jQuery.fn.extend({
  28534. has: function(target) {
  28535. var targets = jQuery(target, this), l = targets.length;
  28536. return this.filter(function() {
  28537. var i2 = 0;
  28538. for (; i2 < l; i2++) {
  28539. if (jQuery.contains(this, targets[i2])) {
  28540. return true;
  28541. }
  28542. }
  28543. });
  28544. },
  28545. closest: function(selectors, context) {
  28546. var cur, i2 = 0, l = this.length, matched = [], targets = typeof selectors !== "string" && jQuery(selectors);
  28547. if (!rneedsContext.test(selectors)) {
  28548. for (; i2 < l; i2++) {
  28549. for (cur = this[i2]; cur && cur !== context; cur = cur.parentNode) {
  28550. if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 : cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
  28551. matched.push(cur);
  28552. break;
  28553. }
  28554. }
  28555. }
  28556. }
  28557. return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
  28558. },
  28559. index: function(elem) {
  28560. if (!elem) {
  28561. return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
  28562. }
  28563. if (typeof elem === "string") {
  28564. return indexOf.call(jQuery(elem), this[0]);
  28565. }
  28566. return indexOf.call(
  28567. this,
  28568. elem.jquery ? elem[0] : elem
  28569. );
  28570. },
  28571. add: function(selector, context) {
  28572. return this.pushStack(
  28573. jQuery.uniqueSort(
  28574. jQuery.merge(this.get(), jQuery(selector, context))
  28575. )
  28576. );
  28577. },
  28578. addBack: function(selector) {
  28579. return this.add(
  28580. selector == null ? this.prevObject : this.prevObject.filter(selector)
  28581. );
  28582. }
  28583. });
  28584. function sibling(cur, dir2) {
  28585. while ((cur = cur[dir2]) && cur.nodeType !== 1) {
  28586. }
  28587. return cur;
  28588. }
  28589. jQuery.each({
  28590. parent: function(elem) {
  28591. var parent = elem.parentNode;
  28592. return parent && parent.nodeType !== 11 ? parent : null;
  28593. },
  28594. parents: function(elem) {
  28595. return dir(elem, "parentNode");
  28596. },
  28597. parentsUntil: function(elem, _i, until) {
  28598. return dir(elem, "parentNode", until);
  28599. },
  28600. next: function(elem) {
  28601. return sibling(elem, "nextSibling");
  28602. },
  28603. prev: function(elem) {
  28604. return sibling(elem, "previousSibling");
  28605. },
  28606. nextAll: function(elem) {
  28607. return dir(elem, "nextSibling");
  28608. },
  28609. prevAll: function(elem) {
  28610. return dir(elem, "previousSibling");
  28611. },
  28612. nextUntil: function(elem, _i, until) {
  28613. return dir(elem, "nextSibling", until);
  28614. },
  28615. prevUntil: function(elem, _i, until) {
  28616. return dir(elem, "previousSibling", until);
  28617. },
  28618. siblings: function(elem) {
  28619. return siblings((elem.parentNode || {}).firstChild, elem);
  28620. },
  28621. children: function(elem) {
  28622. return siblings(elem.firstChild);
  28623. },
  28624. contents: function(elem) {
  28625. if (elem.contentDocument != null && getProto(elem.contentDocument)) {
  28626. return elem.contentDocument;
  28627. }
  28628. if (nodeName(elem, "template")) {
  28629. elem = elem.content || elem;
  28630. }
  28631. return jQuery.merge([], elem.childNodes);
  28632. }
  28633. }, function(name, fn2) {
  28634. jQuery.fn[name] = function(until, selector) {
  28635. var matched = jQuery.map(this, fn2, until);
  28636. if (name.slice(-5) !== "Until") {
  28637. selector = until;
  28638. }
  28639. if (selector && typeof selector === "string") {
  28640. matched = jQuery.filter(selector, matched);
  28641. }
  28642. if (this.length > 1) {
  28643. if (!guaranteedUnique[name]) {
  28644. jQuery.uniqueSort(matched);
  28645. }
  28646. if (rparentsprev.test(name)) {
  28647. matched.reverse();
  28648. }
  28649. }
  28650. return this.pushStack(matched);
  28651. };
  28652. });
  28653. var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
  28654. function createOptions(options2) {
  28655. var object = {};
  28656. jQuery.each(options2.match(rnothtmlwhite) || [], function(_, flag) {
  28657. object[flag] = true;
  28658. });
  28659. return object;
  28660. }
  28661. jQuery.Callbacks = function(options2) {
  28662. options2 = typeof options2 === "string" ? createOptions(options2) : jQuery.extend({}, options2);
  28663. var firing, memory, fired, locked, list = [], queue = [], firingIndex = -1, fire = function() {
  28664. locked = locked || options2.once;
  28665. fired = firing = true;
  28666. for (; queue.length; firingIndex = -1) {
  28667. memory = queue.shift();
  28668. while (++firingIndex < list.length) {
  28669. if (list[firingIndex].apply(memory[0], memory[1]) === false && options2.stopOnFalse) {
  28670. firingIndex = list.length;
  28671. memory = false;
  28672. }
  28673. }
  28674. }
  28675. if (!options2.memory) {
  28676. memory = false;
  28677. }
  28678. firing = false;
  28679. if (locked) {
  28680. if (memory) {
  28681. list = [];
  28682. } else {
  28683. list = "";
  28684. }
  28685. }
  28686. }, self2 = {
  28687. add: function() {
  28688. if (list) {
  28689. if (memory && !firing) {
  28690. firingIndex = list.length - 1;
  28691. queue.push(memory);
  28692. }
  28693. (function add(args) {
  28694. jQuery.each(args, function(_, arg) {
  28695. if (isFunction2(arg)) {
  28696. if (!options2.unique || !self2.has(arg)) {
  28697. list.push(arg);
  28698. }
  28699. } else if (arg && arg.length && toType(arg) !== "string") {
  28700. add(arg);
  28701. }
  28702. });
  28703. })(arguments);
  28704. if (memory && !firing) {
  28705. fire();
  28706. }
  28707. }
  28708. return this;
  28709. },
  28710. remove: function() {
  28711. jQuery.each(arguments, function(_, arg) {
  28712. var index2;
  28713. while ((index2 = jQuery.inArray(arg, list, index2)) > -1) {
  28714. list.splice(index2, 1);
  28715. if (index2 <= firingIndex) {
  28716. firingIndex--;
  28717. }
  28718. }
  28719. });
  28720. return this;
  28721. },
  28722. has: function(fn2) {
  28723. return fn2 ? jQuery.inArray(fn2, list) > -1 : list.length > 0;
  28724. },
  28725. empty: function() {
  28726. if (list) {
  28727. list = [];
  28728. }
  28729. return this;
  28730. },
  28731. disable: function() {
  28732. locked = queue = [];
  28733. list = memory = "";
  28734. return this;
  28735. },
  28736. disabled: function() {
  28737. return !list;
  28738. },
  28739. lock: function() {
  28740. locked = queue = [];
  28741. if (!memory && !firing) {
  28742. list = memory = "";
  28743. }
  28744. return this;
  28745. },
  28746. locked: function() {
  28747. return !!locked;
  28748. },
  28749. fireWith: function(context, args) {
  28750. if (!locked) {
  28751. args = args || [];
  28752. args = [context, args.slice ? args.slice() : args];
  28753. queue.push(args);
  28754. if (!firing) {
  28755. fire();
  28756. }
  28757. }
  28758. return this;
  28759. },
  28760. fire: function() {
  28761. self2.fireWith(this, arguments);
  28762. return this;
  28763. },
  28764. fired: function() {
  28765. return !!fired;
  28766. }
  28767. };
  28768. return self2;
  28769. };
  28770. function Identity(v) {
  28771. return v;
  28772. }
  28773. function Thrower(ex) {
  28774. throw ex;
  28775. }
  28776. function adoptValue(value, resolve2, reject2, noValue) {
  28777. var method;
  28778. try {
  28779. if (value && isFunction2(method = value.promise)) {
  28780. method.call(value).done(resolve2).fail(reject2);
  28781. } else if (value && isFunction2(method = value.then)) {
  28782. method.call(value, resolve2, reject2);
  28783. } else {
  28784. resolve2.apply(void 0, [value].slice(noValue));
  28785. }
  28786. } catch (value2) {
  28787. reject2.apply(void 0, [value2]);
  28788. }
  28789. }
  28790. jQuery.extend({
  28791. Deferred: function(func) {
  28792. var tuples = [
  28793. [
  28794. "notify",
  28795. "progress",
  28796. jQuery.Callbacks("memory"),
  28797. jQuery.Callbacks("memory"),
  28798. 2
  28799. ],
  28800. [
  28801. "resolve",
  28802. "done",
  28803. jQuery.Callbacks("once memory"),
  28804. jQuery.Callbacks("once memory"),
  28805. 0,
  28806. "resolved"
  28807. ],
  28808. [
  28809. "reject",
  28810. "fail",
  28811. jQuery.Callbacks("once memory"),
  28812. jQuery.Callbacks("once memory"),
  28813. 1,
  28814. "rejected"
  28815. ]
  28816. ], state = "pending", promise = {
  28817. state: function() {
  28818. return state;
  28819. },
  28820. always: function() {
  28821. deferred.done(arguments).fail(arguments);
  28822. return this;
  28823. },
  28824. "catch": function(fn2) {
  28825. return promise.then(null, fn2);
  28826. },
  28827. pipe: function() {
  28828. var fns = arguments;
  28829. return jQuery.Deferred(function(newDefer) {
  28830. jQuery.each(tuples, function(_i, tuple2) {
  28831. var fn2 = isFunction2(fns[tuple2[4]]) && fns[tuple2[4]];
  28832. deferred[tuple2[1]](function() {
  28833. var returned = fn2 && fn2.apply(this, arguments);
  28834. if (returned && isFunction2(returned.promise)) {
  28835. returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);
  28836. } else {
  28837. newDefer[tuple2[0] + "With"](
  28838. this,
  28839. fn2 ? [returned] : arguments
  28840. );
  28841. }
  28842. });
  28843. });
  28844. fns = null;
  28845. }).promise();
  28846. },
  28847. then: function(onFulfilled, onRejected, onProgress) {
  28848. var maxDepth = 0;
  28849. function resolve2(depth, deferred2, handler, special) {
  28850. return function() {
  28851. var that = this, args = arguments, mightThrow = function() {
  28852. var returned, then;
  28853. if (depth < maxDepth) {
  28854. return;
  28855. }
  28856. returned = handler.apply(that, args);
  28857. if (returned === deferred2.promise()) {
  28858. throw new TypeError("Thenable self-resolution");
  28859. }
  28860. then = returned && (typeof returned === "object" || typeof returned === "function") && returned.then;
  28861. if (isFunction2(then)) {
  28862. if (special) {
  28863. then.call(
  28864. returned,
  28865. resolve2(maxDepth, deferred2, Identity, special),
  28866. resolve2(maxDepth, deferred2, Thrower, special)
  28867. );
  28868. } else {
  28869. maxDepth++;
  28870. then.call(
  28871. returned,
  28872. resolve2(maxDepth, deferred2, Identity, special),
  28873. resolve2(maxDepth, deferred2, Thrower, special),
  28874. resolve2(
  28875. maxDepth,
  28876. deferred2,
  28877. Identity,
  28878. deferred2.notifyWith
  28879. )
  28880. );
  28881. }
  28882. } else {
  28883. if (handler !== Identity) {
  28884. that = void 0;
  28885. args = [returned];
  28886. }
  28887. (special || deferred2.resolveWith)(that, args);
  28888. }
  28889. }, process2 = special ? mightThrow : function() {
  28890. try {
  28891. mightThrow();
  28892. } catch (e) {
  28893. if (jQuery.Deferred.exceptionHook) {
  28894. jQuery.Deferred.exceptionHook(
  28895. e,
  28896. process2.error
  28897. );
  28898. }
  28899. if (depth + 1 >= maxDepth) {
  28900. if (handler !== Thrower) {
  28901. that = void 0;
  28902. args = [e];
  28903. }
  28904. deferred2.rejectWith(that, args);
  28905. }
  28906. }
  28907. };
  28908. if (depth) {
  28909. process2();
  28910. } else {
  28911. if (jQuery.Deferred.getErrorHook) {
  28912. process2.error = jQuery.Deferred.getErrorHook();
  28913. } else if (jQuery.Deferred.getStackHook) {
  28914. process2.error = jQuery.Deferred.getStackHook();
  28915. }
  28916. window2.setTimeout(process2);
  28917. }
  28918. };
  28919. }
  28920. return jQuery.Deferred(function(newDefer) {
  28921. tuples[0][3].add(
  28922. resolve2(
  28923. 0,
  28924. newDefer,
  28925. isFunction2(onProgress) ? onProgress : Identity,
  28926. newDefer.notifyWith
  28927. )
  28928. );
  28929. tuples[1][3].add(
  28930. resolve2(
  28931. 0,
  28932. newDefer,
  28933. isFunction2(onFulfilled) ? onFulfilled : Identity
  28934. )
  28935. );
  28936. tuples[2][3].add(
  28937. resolve2(
  28938. 0,
  28939. newDefer,
  28940. isFunction2(onRejected) ? onRejected : Thrower
  28941. )
  28942. );
  28943. }).promise();
  28944. },
  28945. promise: function(obj) {
  28946. return obj != null ? jQuery.extend(obj, promise) : promise;
  28947. }
  28948. }, deferred = {};
  28949. jQuery.each(tuples, function(i2, tuple2) {
  28950. var list = tuple2[2], stateString = tuple2[5];
  28951. promise[tuple2[1]] = list.add;
  28952. if (stateString) {
  28953. list.add(
  28954. function() {
  28955. state = stateString;
  28956. },
  28957. tuples[3 - i2][2].disable,
  28958. tuples[3 - i2][3].disable,
  28959. tuples[0][2].lock,
  28960. tuples[0][3].lock
  28961. );
  28962. }
  28963. list.add(tuple2[3].fire);
  28964. deferred[tuple2[0]] = function() {
  28965. deferred[tuple2[0] + "With"](this === deferred ? void 0 : this, arguments);
  28966. return this;
  28967. };
  28968. deferred[tuple2[0] + "With"] = list.fireWith;
  28969. });
  28970. promise.promise(deferred);
  28971. if (func) {
  28972. func.call(deferred, deferred);
  28973. }
  28974. return deferred;
  28975. },
  28976. when: function(singleValue) {
  28977. var remaining = arguments.length, i2 = remaining, resolveContexts = Array(i2), resolveValues = slice.call(arguments), primary = jQuery.Deferred(), updateFunc = function(i3) {
  28978. return function(value) {
  28979. resolveContexts[i3] = this;
  28980. resolveValues[i3] = arguments.length > 1 ? slice.call(arguments) : value;
  28981. if (!--remaining) {
  28982. primary.resolveWith(resolveContexts, resolveValues);
  28983. }
  28984. };
  28985. };
  28986. if (remaining <= 1) {
  28987. adoptValue(
  28988. singleValue,
  28989. primary.done(updateFunc(i2)).resolve,
  28990. primary.reject,
  28991. !remaining
  28992. );
  28993. if (primary.state() === "pending" || isFunction2(resolveValues[i2] && resolveValues[i2].then)) {
  28994. return primary.then();
  28995. }
  28996. }
  28997. while (i2--) {
  28998. adoptValue(resolveValues[i2], updateFunc(i2), primary.reject);
  28999. }
  29000. return primary.promise();
  29001. }
  29002. });
  29003. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  29004. jQuery.Deferred.exceptionHook = function(error, asyncError) {
  29005. if (window2.console && window2.console.warn && error && rerrorNames.test(error.name)) {
  29006. window2.console.warn(
  29007. "jQuery.Deferred exception: " + error.message,
  29008. error.stack,
  29009. asyncError
  29010. );
  29011. }
  29012. };
  29013. jQuery.readyException = function(error) {
  29014. window2.setTimeout(function() {
  29015. throw error;
  29016. });
  29017. };
  29018. var readyList = jQuery.Deferred();
  29019. jQuery.fn.ready = function(fn2) {
  29020. readyList.then(fn2).catch(function(error) {
  29021. jQuery.readyException(error);
  29022. });
  29023. return this;
  29024. };
  29025. jQuery.extend({
  29026. isReady: false,
  29027. readyWait: 1,
  29028. ready: function(wait) {
  29029. if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
  29030. return;
  29031. }
  29032. jQuery.isReady = true;
  29033. if (wait !== true && --jQuery.readyWait > 0) {
  29034. return;
  29035. }
  29036. readyList.resolveWith(document2, [jQuery]);
  29037. }
  29038. });
  29039. jQuery.ready.then = readyList.then;
  29040. function completed() {
  29041. document2.removeEventListener("DOMContentLoaded", completed);
  29042. window2.removeEventListener("load", completed);
  29043. jQuery.ready();
  29044. }
  29045. if (document2.readyState === "complete" || document2.readyState !== "loading" && !document2.documentElement.doScroll) {
  29046. window2.setTimeout(jQuery.ready);
  29047. } else {
  29048. document2.addEventListener("DOMContentLoaded", completed);
  29049. window2.addEventListener("load", completed);
  29050. }
  29051. var access = function(elems, fn2, key, value, chainable, emptyGet, raw) {
  29052. var i2 = 0, len = elems.length, bulk = key == null;
  29053. if (toType(key) === "object") {
  29054. chainable = true;
  29055. for (i2 in key) {
  29056. access(elems, fn2, i2, key[i2], true, emptyGet, raw);
  29057. }
  29058. } else if (value !== void 0) {
  29059. chainable = true;
  29060. if (!isFunction2(value)) {
  29061. raw = true;
  29062. }
  29063. if (bulk) {
  29064. if (raw) {
  29065. fn2.call(elems, value);
  29066. fn2 = null;
  29067. } else {
  29068. bulk = fn2;
  29069. fn2 = function(elem, _key, value2) {
  29070. return bulk.call(jQuery(elem), value2);
  29071. };
  29072. }
  29073. }
  29074. if (fn2) {
  29075. for (; i2 < len; i2++) {
  29076. fn2(
  29077. elems[i2],
  29078. key,
  29079. raw ? value : value.call(elems[i2], i2, fn2(elems[i2], key))
  29080. );
  29081. }
  29082. }
  29083. }
  29084. if (chainable) {
  29085. return elems;
  29086. }
  29087. if (bulk) {
  29088. return fn2.call(elems);
  29089. }
  29090. return len ? fn2(elems[0], key) : emptyGet;
  29091. };
  29092. var rmsPrefix = /^-ms-/, rdashAlpha = /-([a-z])/g;
  29093. function fcamelCase(_all, letter) {
  29094. return letter.toUpperCase();
  29095. }
  29096. function camelCase3(string) {
  29097. return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
  29098. }
  29099. var acceptData = function(owner) {
  29100. return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
  29101. };
  29102. function Data() {
  29103. this.expando = jQuery.expando + Data.uid++;
  29104. }
  29105. Data.uid = 1;
  29106. Data.prototype = {
  29107. cache: function(owner) {
  29108. var value = owner[this.expando];
  29109. if (!value) {
  29110. value = {};
  29111. if (acceptData(owner)) {
  29112. if (owner.nodeType) {
  29113. owner[this.expando] = value;
  29114. } else {
  29115. Object.defineProperty(owner, this.expando, {
  29116. value,
  29117. configurable: true
  29118. });
  29119. }
  29120. }
  29121. }
  29122. return value;
  29123. },
  29124. set: function(owner, data, value) {
  29125. var prop, cache = this.cache(owner);
  29126. if (typeof data === "string") {
  29127. cache[camelCase3(data)] = value;
  29128. } else {
  29129. for (prop in data) {
  29130. cache[camelCase3(prop)] = data[prop];
  29131. }
  29132. }
  29133. return cache;
  29134. },
  29135. get: function(owner, key) {
  29136. return key === void 0 ? this.cache(owner) : owner[this.expando] && owner[this.expando][camelCase3(key)];
  29137. },
  29138. access: function(owner, key, value) {
  29139. if (key === void 0 || key && typeof key === "string" && value === void 0) {
  29140. return this.get(owner, key);
  29141. }
  29142. this.set(owner, key, value);
  29143. return value !== void 0 ? value : key;
  29144. },
  29145. remove: function(owner, key) {
  29146. var i2, cache = owner[this.expando];
  29147. if (cache === void 0) {
  29148. return;
  29149. }
  29150. if (key !== void 0) {
  29151. if (Array.isArray(key)) {
  29152. key = key.map(camelCase3);
  29153. } else {
  29154. key = camelCase3(key);
  29155. key = key in cache ? [key] : key.match(rnothtmlwhite) || [];
  29156. }
  29157. i2 = key.length;
  29158. while (i2--) {
  29159. delete cache[key[i2]];
  29160. }
  29161. }
  29162. if (key === void 0 || jQuery.isEmptyObject(cache)) {
  29163. if (owner.nodeType) {
  29164. owner[this.expando] = void 0;
  29165. } else {
  29166. delete owner[this.expando];
  29167. }
  29168. }
  29169. },
  29170. hasData: function(owner) {
  29171. var cache = owner[this.expando];
  29172. return cache !== void 0 && !jQuery.isEmptyObject(cache);
  29173. }
  29174. };
  29175. var dataPriv = new Data();
  29176. var dataUser = new Data();
  29177. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /[A-Z]/g;
  29178. function getData(data) {
  29179. if (data === "true") {
  29180. return true;
  29181. }
  29182. if (data === "false") {
  29183. return false;
  29184. }
  29185. if (data === "null") {
  29186. return null;
  29187. }
  29188. if (data === +data + "") {
  29189. return +data;
  29190. }
  29191. if (rbrace.test(data)) {
  29192. return JSON.parse(data);
  29193. }
  29194. return data;
  29195. }
  29196. function dataAttr(elem, key, data) {
  29197. var name;
  29198. if (data === void 0 && elem.nodeType === 1) {
  29199. name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
  29200. data = elem.getAttribute(name);
  29201. if (typeof data === "string") {
  29202. try {
  29203. data = getData(data);
  29204. } catch (e) {
  29205. }
  29206. dataUser.set(elem, key, data);
  29207. } else {
  29208. data = void 0;
  29209. }
  29210. }
  29211. return data;
  29212. }
  29213. jQuery.extend({
  29214. hasData: function(elem) {
  29215. return dataUser.hasData(elem) || dataPriv.hasData(elem);
  29216. },
  29217. data: function(elem, name, data) {
  29218. return dataUser.access(elem, name, data);
  29219. },
  29220. removeData: function(elem, name) {
  29221. dataUser.remove(elem, name);
  29222. },
  29223. _data: function(elem, name, data) {
  29224. return dataPriv.access(elem, name, data);
  29225. },
  29226. _removeData: function(elem, name) {
  29227. dataPriv.remove(elem, name);
  29228. }
  29229. });
  29230. jQuery.fn.extend({
  29231. data: function(key, value) {
  29232. var i2, name, data, elem = this[0], attrs = elem && elem.attributes;
  29233. if (key === void 0) {
  29234. if (this.length) {
  29235. data = dataUser.get(elem);
  29236. if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
  29237. i2 = attrs.length;
  29238. while (i2--) {
  29239. if (attrs[i2]) {
  29240. name = attrs[i2].name;
  29241. if (name.indexOf("data-") === 0) {
  29242. name = camelCase3(name.slice(5));
  29243. dataAttr(elem, name, data[name]);
  29244. }
  29245. }
  29246. }
  29247. dataPriv.set(elem, "hasDataAttrs", true);
  29248. }
  29249. }
  29250. return data;
  29251. }
  29252. if (typeof key === "object") {
  29253. return this.each(function() {
  29254. dataUser.set(this, key);
  29255. });
  29256. }
  29257. return access(this, function(value2) {
  29258. var data2;
  29259. if (elem && value2 === void 0) {
  29260. data2 = dataUser.get(elem, key);
  29261. if (data2 !== void 0) {
  29262. return data2;
  29263. }
  29264. data2 = dataAttr(elem, key);
  29265. if (data2 !== void 0) {
  29266. return data2;
  29267. }
  29268. return;
  29269. }
  29270. this.each(function() {
  29271. dataUser.set(this, key, value2);
  29272. });
  29273. }, null, value, arguments.length > 1, null, true);
  29274. },
  29275. removeData: function(key) {
  29276. return this.each(function() {
  29277. dataUser.remove(this, key);
  29278. });
  29279. }
  29280. });
  29281. jQuery.extend({
  29282. queue: function(elem, type2, data) {
  29283. var queue;
  29284. if (elem) {
  29285. type2 = (type2 || "fx") + "queue";
  29286. queue = dataPriv.get(elem, type2);
  29287. if (data) {
  29288. if (!queue || Array.isArray(data)) {
  29289. queue = dataPriv.access(elem, type2, jQuery.makeArray(data));
  29290. } else {
  29291. queue.push(data);
  29292. }
  29293. }
  29294. return queue || [];
  29295. }
  29296. },
  29297. dequeue: function(elem, type2) {
  29298. type2 = type2 || "fx";
  29299. var queue = jQuery.queue(elem, type2), startLength = queue.length, fn2 = queue.shift(), hooks3 = jQuery._queueHooks(elem, type2), next = function() {
  29300. jQuery.dequeue(elem, type2);
  29301. };
  29302. if (fn2 === "inprogress") {
  29303. fn2 = queue.shift();
  29304. startLength--;
  29305. }
  29306. if (fn2) {
  29307. if (type2 === "fx") {
  29308. queue.unshift("inprogress");
  29309. }
  29310. delete hooks3.stop;
  29311. fn2.call(elem, next, hooks3);
  29312. }
  29313. if (!startLength && hooks3) {
  29314. hooks3.empty.fire();
  29315. }
  29316. },
  29317. _queueHooks: function(elem, type2) {
  29318. var key = type2 + "queueHooks";
  29319. return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
  29320. empty: jQuery.Callbacks("once memory").add(function() {
  29321. dataPriv.remove(elem, [type2 + "queue", key]);
  29322. })
  29323. });
  29324. }
  29325. });
  29326. jQuery.fn.extend({
  29327. queue: function(type2, data) {
  29328. var setter = 2;
  29329. if (typeof type2 !== "string") {
  29330. data = type2;
  29331. type2 = "fx";
  29332. setter--;
  29333. }
  29334. if (arguments.length < setter) {
  29335. return jQuery.queue(this[0], type2);
  29336. }
  29337. return data === void 0 ? this : this.each(function() {
  29338. var queue = jQuery.queue(this, type2, data);
  29339. jQuery._queueHooks(this, type2);
  29340. if (type2 === "fx" && queue[0] !== "inprogress") {
  29341. jQuery.dequeue(this, type2);
  29342. }
  29343. });
  29344. },
  29345. dequeue: function(type2) {
  29346. return this.each(function() {
  29347. jQuery.dequeue(this, type2);
  29348. });
  29349. },
  29350. clearQueue: function(type2) {
  29351. return this.queue(type2 || "fx", []);
  29352. },
  29353. promise: function(type2, obj) {
  29354. var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i2 = this.length, resolve2 = function() {
  29355. if (!--count) {
  29356. defer.resolveWith(elements, [elements]);
  29357. }
  29358. };
  29359. if (typeof type2 !== "string") {
  29360. obj = type2;
  29361. type2 = void 0;
  29362. }
  29363. type2 = type2 || "fx";
  29364. while (i2--) {
  29365. tmp = dataPriv.get(elements[i2], type2 + "queueHooks");
  29366. if (tmp && tmp.empty) {
  29367. count++;
  29368. tmp.empty.add(resolve2);
  29369. }
  29370. }
  29371. resolve2();
  29372. return defer.promise(obj);
  29373. }
  29374. });
  29375. var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
  29376. var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
  29377. var cssExpand = ["Top", "Right", "Bottom", "Left"];
  29378. var documentElement = document2.documentElement;
  29379. var isAttached = function(elem) {
  29380. return jQuery.contains(elem.ownerDocument, elem);
  29381. }, composed = { composed: true };
  29382. if (documentElement.getRootNode) {
  29383. isAttached = function(elem) {
  29384. return jQuery.contains(elem.ownerDocument, elem) || elem.getRootNode(composed) === elem.ownerDocument;
  29385. };
  29386. }
  29387. var isHiddenWithinTree = function(elem, el) {
  29388. elem = el || elem;
  29389. return elem.style.display === "none" || elem.style.display === "" && isAttached(elem) && jQuery.css(elem, "display") === "none";
  29390. };
  29391. function adjustCSS(elem, prop, valueParts, tween) {
  29392. var adjusted, scale, maxIterations = 20, currentValue = tween ? function() {
  29393. return tween.cur();
  29394. } : function() {
  29395. return jQuery.css(elem, prop, "");
  29396. }, initial = currentValue(), unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"), initialInUnit = elem.nodeType && (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop));
  29397. if (initialInUnit && initialInUnit[3] !== unit) {
  29398. initial = initial / 2;
  29399. unit = unit || initialInUnit[3];
  29400. initialInUnit = +initial || 1;
  29401. while (maxIterations--) {
  29402. jQuery.style(elem, prop, initialInUnit + unit);
  29403. if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
  29404. maxIterations = 0;
  29405. }
  29406. initialInUnit = initialInUnit / scale;
  29407. }
  29408. initialInUnit = initialInUnit * 2;
  29409. jQuery.style(elem, prop, initialInUnit + unit);
  29410. valueParts = valueParts || [];
  29411. }
  29412. if (valueParts) {
  29413. initialInUnit = +initialInUnit || +initial || 0;
  29414. adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];
  29415. if (tween) {
  29416. tween.unit = unit;
  29417. tween.start = initialInUnit;
  29418. tween.end = adjusted;
  29419. }
  29420. }
  29421. return adjusted;
  29422. }
  29423. var defaultDisplayMap = {};
  29424. function getDefaultDisplay(elem) {
  29425. var temp, doc = elem.ownerDocument, nodeName2 = elem.nodeName, display = defaultDisplayMap[nodeName2];
  29426. if (display) {
  29427. return display;
  29428. }
  29429. temp = doc.body.appendChild(doc.createElement(nodeName2));
  29430. display = jQuery.css(temp, "display");
  29431. temp.parentNode.removeChild(temp);
  29432. if (display === "none") {
  29433. display = "block";
  29434. }
  29435. defaultDisplayMap[nodeName2] = display;
  29436. return display;
  29437. }
  29438. function showHide(elements, show) {
  29439. var display, elem, values3 = [], index2 = 0, length = elements.length;
  29440. for (; index2 < length; index2++) {
  29441. elem = elements[index2];
  29442. if (!elem.style) {
  29443. continue;
  29444. }
  29445. display = elem.style.display;
  29446. if (show) {
  29447. if (display === "none") {
  29448. values3[index2] = dataPriv.get(elem, "display") || null;
  29449. if (!values3[index2]) {
  29450. elem.style.display = "";
  29451. }
  29452. }
  29453. if (elem.style.display === "" && isHiddenWithinTree(elem)) {
  29454. values3[index2] = getDefaultDisplay(elem);
  29455. }
  29456. } else {
  29457. if (display !== "none") {
  29458. values3[index2] = "none";
  29459. dataPriv.set(elem, "display", display);
  29460. }
  29461. }
  29462. }
  29463. for (index2 = 0; index2 < length; index2++) {
  29464. if (values3[index2] != null) {
  29465. elements[index2].style.display = values3[index2];
  29466. }
  29467. }
  29468. return elements;
  29469. }
  29470. jQuery.fn.extend({
  29471. show: function() {
  29472. return showHide(this, true);
  29473. },
  29474. hide: function() {
  29475. return showHide(this);
  29476. },
  29477. toggle: function(state) {
  29478. if (typeof state === "boolean") {
  29479. return state ? this.show() : this.hide();
  29480. }
  29481. return this.each(function() {
  29482. if (isHiddenWithinTree(this)) {
  29483. jQuery(this).show();
  29484. } else {
  29485. jQuery(this).hide();
  29486. }
  29487. });
  29488. }
  29489. });
  29490. var rcheckableType = /^(?:checkbox|radio)$/i;
  29491. var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]*)/i;
  29492. var rscriptType = /^$|^module$|\/(?:java|ecma)script/i;
  29493. (function() {
  29494. var fragment = document2.createDocumentFragment(), div = fragment.appendChild(document2.createElement("div")), input = document2.createElement("input");
  29495. input.setAttribute("type", "radio");
  29496. input.setAttribute("checked", "checked");
  29497. input.setAttribute("name", "t");
  29498. div.appendChild(input);
  29499. support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
  29500. div.innerHTML = "<textarea>x</textarea>";
  29501. support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
  29502. div.innerHTML = "<option></option>";
  29503. support.option = !!div.lastChild;
  29504. })();
  29505. var wrapMap = {
  29506. thead: [1, "<table>", "</table>"],
  29507. col: [2, "<table><colgroup>", "</colgroup></table>"],
  29508. tr: [2, "<table><tbody>", "</tbody></table>"],
  29509. td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
  29510. _default: [0, "", ""]
  29511. };
  29512. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  29513. wrapMap.th = wrapMap.td;
  29514. if (!support.option) {
  29515. wrapMap.optgroup = wrapMap.option = [1, "<select multiple='multiple'>", "</select>"];
  29516. }
  29517. function getAll(context, tag) {
  29518. var ret;
  29519. if (typeof context.getElementsByTagName !== "undefined") {
  29520. ret = context.getElementsByTagName(tag || "*");
  29521. } else if (typeof context.querySelectorAll !== "undefined") {
  29522. ret = context.querySelectorAll(tag || "*");
  29523. } else {
  29524. ret = [];
  29525. }
  29526. if (tag === void 0 || tag && nodeName(context, tag)) {
  29527. return jQuery.merge([context], ret);
  29528. }
  29529. return ret;
  29530. }
  29531. function setGlobalEval(elems, refElements) {
  29532. var i2 = 0, l = elems.length;
  29533. for (; i2 < l; i2++) {
  29534. dataPriv.set(
  29535. elems[i2],
  29536. "globalEval",
  29537. !refElements || dataPriv.get(refElements[i2], "globalEval")
  29538. );
  29539. }
  29540. }
  29541. var rhtml = /<|&#?\w+;/;
  29542. function buildFragment(elems, context, scripts, selection, ignored) {
  29543. var elem, tmp, tag, wrap, attached, j, fragment = context.createDocumentFragment(), nodes = [], i2 = 0, l = elems.length;
  29544. for (; i2 < l; i2++) {
  29545. elem = elems[i2];
  29546. if (elem || elem === 0) {
  29547. if (toType(elem) === "object") {
  29548. jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
  29549. } else if (!rhtml.test(elem)) {
  29550. nodes.push(context.createTextNode(elem));
  29551. } else {
  29552. tmp = tmp || fragment.appendChild(context.createElement("div"));
  29553. tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
  29554. wrap = wrapMap[tag] || wrapMap._default;
  29555. tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
  29556. j = wrap[0];
  29557. while (j--) {
  29558. tmp = tmp.lastChild;
  29559. }
  29560. jQuery.merge(nodes, tmp.childNodes);
  29561. tmp = fragment.firstChild;
  29562. tmp.textContent = "";
  29563. }
  29564. }
  29565. }
  29566. fragment.textContent = "";
  29567. i2 = 0;
  29568. while (elem = nodes[i2++]) {
  29569. if (selection && jQuery.inArray(elem, selection) > -1) {
  29570. if (ignored) {
  29571. ignored.push(elem);
  29572. }
  29573. continue;
  29574. }
  29575. attached = isAttached(elem);
  29576. tmp = getAll(fragment.appendChild(elem), "script");
  29577. if (attached) {
  29578. setGlobalEval(tmp);
  29579. }
  29580. if (scripts) {
  29581. j = 0;
  29582. while (elem = tmp[j++]) {
  29583. if (rscriptType.test(elem.type || "")) {
  29584. scripts.push(elem);
  29585. }
  29586. }
  29587. }
  29588. }
  29589. return fragment;
  29590. }
  29591. var rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  29592. function returnTrue() {
  29593. return true;
  29594. }
  29595. function returnFalse() {
  29596. return false;
  29597. }
  29598. function on3(elem, types, selector, data, fn2, one3) {
  29599. var origFn, type2;
  29600. if (typeof types === "object") {
  29601. if (typeof selector !== "string") {
  29602. data = data || selector;
  29603. selector = void 0;
  29604. }
  29605. for (type2 in types) {
  29606. on3(elem, type2, selector, data, types[type2], one3);
  29607. }
  29608. return elem;
  29609. }
  29610. if (data == null && fn2 == null) {
  29611. fn2 = selector;
  29612. data = selector = void 0;
  29613. } else if (fn2 == null) {
  29614. if (typeof selector === "string") {
  29615. fn2 = data;
  29616. data = void 0;
  29617. } else {
  29618. fn2 = data;
  29619. data = selector;
  29620. selector = void 0;
  29621. }
  29622. }
  29623. if (fn2 === false) {
  29624. fn2 = returnFalse;
  29625. } else if (!fn2) {
  29626. return elem;
  29627. }
  29628. if (one3 === 1) {
  29629. origFn = fn2;
  29630. fn2 = function(event2) {
  29631. jQuery().off(event2);
  29632. return origFn.apply(this, arguments);
  29633. };
  29634. fn2.guid = origFn.guid || (origFn.guid = jQuery.guid++);
  29635. }
  29636. return elem.each(function() {
  29637. jQuery.event.add(this, types, fn2, data, selector);
  29638. });
  29639. }
  29640. jQuery.event = {
  29641. global: {},
  29642. add: function(elem, types, handler, data, selector) {
  29643. var handleObjIn, eventHandle, tmp, events, t2, handleObj, special, handlers, type2, namespaces, origType, elemData = dataPriv.get(elem);
  29644. if (!acceptData(elem)) {
  29645. return;
  29646. }
  29647. if (handler.handler) {
  29648. handleObjIn = handler;
  29649. handler = handleObjIn.handler;
  29650. selector = handleObjIn.selector;
  29651. }
  29652. if (selector) {
  29653. jQuery.find.matchesSelector(documentElement, selector);
  29654. }
  29655. if (!handler.guid) {
  29656. handler.guid = jQuery.guid++;
  29657. }
  29658. if (!(events = elemData.events)) {
  29659. events = elemData.events = /* @__PURE__ */ Object.create(null);
  29660. }
  29661. if (!(eventHandle = elemData.handle)) {
  29662. eventHandle = elemData.handle = function(e) {
  29663. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : void 0;
  29664. };
  29665. }
  29666. types = (types || "").match(rnothtmlwhite) || [""];
  29667. t2 = types.length;
  29668. while (t2--) {
  29669. tmp = rtypenamespace.exec(types[t2]) || [];
  29670. type2 = origType = tmp[1];
  29671. namespaces = (tmp[2] || "").split(".").sort();
  29672. if (!type2) {
  29673. continue;
  29674. }
  29675. special = jQuery.event.special[type2] || {};
  29676. type2 = (selector ? special.delegateType : special.bindType) || type2;
  29677. special = jQuery.event.special[type2] || {};
  29678. handleObj = jQuery.extend({
  29679. type: type2,
  29680. origType,
  29681. data,
  29682. handler,
  29683. guid: handler.guid,
  29684. selector,
  29685. needsContext: selector && jQuery.expr.match.needsContext.test(selector),
  29686. namespace: namespaces.join(".")
  29687. }, handleObjIn);
  29688. if (!(handlers = events[type2])) {
  29689. handlers = events[type2] = [];
  29690. handlers.delegateCount = 0;
  29691. if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
  29692. if (elem.addEventListener) {
  29693. elem.addEventListener(type2, eventHandle);
  29694. }
  29695. }
  29696. }
  29697. if (special.add) {
  29698. special.add.call(elem, handleObj);
  29699. if (!handleObj.handler.guid) {
  29700. handleObj.handler.guid = handler.guid;
  29701. }
  29702. }
  29703. if (selector) {
  29704. handlers.splice(handlers.delegateCount++, 0, handleObj);
  29705. } else {
  29706. handlers.push(handleObj);
  29707. }
  29708. jQuery.event.global[type2] = true;
  29709. }
  29710. },
  29711. remove: function(elem, types, handler, selector, mappedTypes) {
  29712. var j, origCount, tmp, events, t2, handleObj, special, handlers, type2, namespaces, origType, elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
  29713. if (!elemData || !(events = elemData.events)) {
  29714. return;
  29715. }
  29716. types = (types || "").match(rnothtmlwhite) || [""];
  29717. t2 = types.length;
  29718. while (t2--) {
  29719. tmp = rtypenamespace.exec(types[t2]) || [];
  29720. type2 = origType = tmp[1];
  29721. namespaces = (tmp[2] || "").split(".").sort();
  29722. if (!type2) {
  29723. for (type2 in events) {
  29724. jQuery.event.remove(elem, type2 + types[t2], handler, selector, true);
  29725. }
  29726. continue;
  29727. }
  29728. special = jQuery.event.special[type2] || {};
  29729. type2 = (selector ? special.delegateType : special.bindType) || type2;
  29730. handlers = events[type2] || [];
  29731. tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
  29732. origCount = j = handlers.length;
  29733. while (j--) {
  29734. handleObj = handlers[j];
  29735. if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
  29736. handlers.splice(j, 1);
  29737. if (handleObj.selector) {
  29738. handlers.delegateCount--;
  29739. }
  29740. if (special.remove) {
  29741. special.remove.call(elem, handleObj);
  29742. }
  29743. }
  29744. }
  29745. if (origCount && !handlers.length) {
  29746. if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
  29747. jQuery.removeEvent(elem, type2, elemData.handle);
  29748. }
  29749. delete events[type2];
  29750. }
  29751. }
  29752. if (jQuery.isEmptyObject(events)) {
  29753. dataPriv.remove(elem, "handle events");
  29754. }
  29755. },
  29756. dispatch: function(nativeEvent) {
  29757. var i2, j, ret, matched, handleObj, handlerQueue, args = new Array(arguments.length), event2 = jQuery.event.fix(nativeEvent), handlers = (dataPriv.get(this, "events") || /* @__PURE__ */ Object.create(null))[event2.type] || [], special = jQuery.event.special[event2.type] || {};
  29758. args[0] = event2;
  29759. for (i2 = 1; i2 < arguments.length; i2++) {
  29760. args[i2] = arguments[i2];
  29761. }
  29762. event2.delegateTarget = this;
  29763. if (special.preDispatch && special.preDispatch.call(this, event2) === false) {
  29764. return;
  29765. }
  29766. handlerQueue = jQuery.event.handlers.call(this, event2, handlers);
  29767. i2 = 0;
  29768. while ((matched = handlerQueue[i2++]) && !event2.isPropagationStopped()) {
  29769. event2.currentTarget = matched.elem;
  29770. j = 0;
  29771. while ((handleObj = matched.handlers[j++]) && !event2.isImmediatePropagationStopped()) {
  29772. if (!event2.rnamespace || handleObj.namespace === false || event2.rnamespace.test(handleObj.namespace)) {
  29773. event2.handleObj = handleObj;
  29774. event2.data = handleObj.data;
  29775. ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
  29776. if (ret !== void 0) {
  29777. if ((event2.result = ret) === false) {
  29778. event2.preventDefault();
  29779. event2.stopPropagation();
  29780. }
  29781. }
  29782. }
  29783. }
  29784. }
  29785. if (special.postDispatch) {
  29786. special.postDispatch.call(this, event2);
  29787. }
  29788. return event2.result;
  29789. },
  29790. handlers: function(event2, handlers) {
  29791. var i2, handleObj, sel, matchedHandlers, matchedSelectors, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event2.target;
  29792. if (delegateCount && cur.nodeType && !(event2.type === "click" && event2.button >= 1)) {
  29793. for (; cur !== this; cur = cur.parentNode || this) {
  29794. if (cur.nodeType === 1 && !(event2.type === "click" && cur.disabled === true)) {
  29795. matchedHandlers = [];
  29796. matchedSelectors = {};
  29797. for (i2 = 0; i2 < delegateCount; i2++) {
  29798. handleObj = handlers[i2];
  29799. sel = handleObj.selector + " ";
  29800. if (matchedSelectors[sel] === void 0) {
  29801. matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;
  29802. }
  29803. if (matchedSelectors[sel]) {
  29804. matchedHandlers.push(handleObj);
  29805. }
  29806. }
  29807. if (matchedHandlers.length) {
  29808. handlerQueue.push({ elem: cur, handlers: matchedHandlers });
  29809. }
  29810. }
  29811. }
  29812. }
  29813. cur = this;
  29814. if (delegateCount < handlers.length) {
  29815. handlerQueue.push({ elem: cur, handlers: handlers.slice(delegateCount) });
  29816. }
  29817. return handlerQueue;
  29818. },
  29819. addProp: function(name, hook3) {
  29820. Object.defineProperty(jQuery.Event.prototype, name, {
  29821. enumerable: true,
  29822. configurable: true,
  29823. get: isFunction2(hook3) ? function() {
  29824. if (this.originalEvent) {
  29825. return hook3(this.originalEvent);
  29826. }
  29827. } : function() {
  29828. if (this.originalEvent) {
  29829. return this.originalEvent[name];
  29830. }
  29831. },
  29832. set: function(value) {
  29833. Object.defineProperty(this, name, {
  29834. enumerable: true,
  29835. configurable: true,
  29836. writable: true,
  29837. value
  29838. });
  29839. }
  29840. });
  29841. },
  29842. fix: function(originalEvent) {
  29843. return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);
  29844. },
  29845. special: {
  29846. load: {
  29847. noBubble: true
  29848. },
  29849. click: {
  29850. setup: function(data) {
  29851. var el = this || data;
  29852. if (rcheckableType.test(el.type) && el.click && nodeName(el, "input")) {
  29853. leverageNative(el, "click", true);
  29854. }
  29855. return false;
  29856. },
  29857. trigger: function(data) {
  29858. var el = this || data;
  29859. if (rcheckableType.test(el.type) && el.click && nodeName(el, "input")) {
  29860. leverageNative(el, "click");
  29861. }
  29862. return true;
  29863. },
  29864. _default: function(event2) {
  29865. var target = event2.target;
  29866. return rcheckableType.test(target.type) && target.click && nodeName(target, "input") && dataPriv.get(target, "click") || nodeName(target, "a");
  29867. }
  29868. },
  29869. beforeunload: {
  29870. postDispatch: function(event2) {
  29871. if (event2.result !== void 0 && event2.originalEvent) {
  29872. event2.originalEvent.returnValue = event2.result;
  29873. }
  29874. }
  29875. }
  29876. }
  29877. };
  29878. function leverageNative(el, type2, isSetup) {
  29879. if (!isSetup) {
  29880. if (dataPriv.get(el, type2) === void 0) {
  29881. jQuery.event.add(el, type2, returnTrue);
  29882. }
  29883. return;
  29884. }
  29885. dataPriv.set(el, type2, false);
  29886. jQuery.event.add(el, type2, {
  29887. namespace: false,
  29888. handler: function(event2) {
  29889. var result, saved = dataPriv.get(this, type2);
  29890. if (event2.isTrigger & 1 && this[type2]) {
  29891. if (!saved) {
  29892. saved = slice.call(arguments);
  29893. dataPriv.set(this, type2, saved);
  29894. this[type2]();
  29895. result = dataPriv.get(this, type2);
  29896. dataPriv.set(this, type2, false);
  29897. if (saved !== result) {
  29898. event2.stopImmediatePropagation();
  29899. event2.preventDefault();
  29900. return result;
  29901. }
  29902. } else if ((jQuery.event.special[type2] || {}).delegateType) {
  29903. event2.stopPropagation();
  29904. }
  29905. } else if (saved) {
  29906. dataPriv.set(this, type2, jQuery.event.trigger(
  29907. saved[0],
  29908. saved.slice(1),
  29909. this
  29910. ));
  29911. event2.stopPropagation();
  29912. event2.isImmediatePropagationStopped = returnTrue;
  29913. }
  29914. }
  29915. });
  29916. }
  29917. jQuery.removeEvent = function(elem, type2, handle) {
  29918. if (elem.removeEventListener) {
  29919. elem.removeEventListener(type2, handle);
  29920. }
  29921. };
  29922. jQuery.Event = function(src, props) {
  29923. if (!(this instanceof jQuery.Event)) {
  29924. return new jQuery.Event(src, props);
  29925. }
  29926. if (src && src.type) {
  29927. this.originalEvent = src;
  29928. this.type = src.type;
  29929. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === void 0 && src.returnValue === false ? returnTrue : returnFalse;
  29930. this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;
  29931. this.currentTarget = src.currentTarget;
  29932. this.relatedTarget = src.relatedTarget;
  29933. } else {
  29934. this.type = src;
  29935. }
  29936. if (props) {
  29937. jQuery.extend(this, props);
  29938. }
  29939. this.timeStamp = src && src.timeStamp || Date.now();
  29940. this[jQuery.expando] = true;
  29941. };
  29942. jQuery.Event.prototype = {
  29943. constructor: jQuery.Event,
  29944. isDefaultPrevented: returnFalse,
  29945. isPropagationStopped: returnFalse,
  29946. isImmediatePropagationStopped: returnFalse,
  29947. isSimulated: false,
  29948. preventDefault: function() {
  29949. var e = this.originalEvent;
  29950. this.isDefaultPrevented = returnTrue;
  29951. if (e && !this.isSimulated) {
  29952. e.preventDefault();
  29953. }
  29954. },
  29955. stopPropagation: function() {
  29956. var e = this.originalEvent;
  29957. this.isPropagationStopped = returnTrue;
  29958. if (e && !this.isSimulated) {
  29959. e.stopPropagation();
  29960. }
  29961. },
  29962. stopImmediatePropagation: function() {
  29963. var e = this.originalEvent;
  29964. this.isImmediatePropagationStopped = returnTrue;
  29965. if (e && !this.isSimulated) {
  29966. e.stopImmediatePropagation();
  29967. }
  29968. this.stopPropagation();
  29969. }
  29970. };
  29971. jQuery.each({
  29972. altKey: true,
  29973. bubbles: true,
  29974. cancelable: true,
  29975. changedTouches: true,
  29976. ctrlKey: true,
  29977. detail: true,
  29978. eventPhase: true,
  29979. metaKey: true,
  29980. pageX: true,
  29981. pageY: true,
  29982. shiftKey: true,
  29983. view: true,
  29984. "char": true,
  29985. code: true,
  29986. charCode: true,
  29987. key: true,
  29988. keyCode: true,
  29989. button: true,
  29990. buttons: true,
  29991. clientX: true,
  29992. clientY: true,
  29993. offsetX: true,
  29994. offsetY: true,
  29995. pointerId: true,
  29996. pointerType: true,
  29997. screenX: true,
  29998. screenY: true,
  29999. targetTouches: true,
  30000. toElement: true,
  30001. touches: true,
  30002. which: true
  30003. }, jQuery.event.addProp);
  30004. jQuery.each({ focus: "focusin", blur: "focusout" }, function(type2, delegateType) {
  30005. function focusMappedHandler(nativeEvent) {
  30006. if (document2.documentMode) {
  30007. var handle = dataPriv.get(this, "handle"), event2 = jQuery.event.fix(nativeEvent);
  30008. event2.type = nativeEvent.type === "focusin" ? "focus" : "blur";
  30009. event2.isSimulated = true;
  30010. handle(nativeEvent);
  30011. if (event2.target === event2.currentTarget) {
  30012. handle(event2);
  30013. }
  30014. } else {
  30015. jQuery.event.simulate(
  30016. delegateType,
  30017. nativeEvent.target,
  30018. jQuery.event.fix(nativeEvent)
  30019. );
  30020. }
  30021. }
  30022. jQuery.event.special[type2] = {
  30023. setup: function() {
  30024. var attaches;
  30025. leverageNative(this, type2, true);
  30026. if (document2.documentMode) {
  30027. attaches = dataPriv.get(this, delegateType);
  30028. if (!attaches) {
  30029. this.addEventListener(delegateType, focusMappedHandler);
  30030. }
  30031. dataPriv.set(this, delegateType, (attaches || 0) + 1);
  30032. } else {
  30033. return false;
  30034. }
  30035. },
  30036. trigger: function() {
  30037. leverageNative(this, type2);
  30038. return true;
  30039. },
  30040. teardown: function() {
  30041. var attaches;
  30042. if (document2.documentMode) {
  30043. attaches = dataPriv.get(this, delegateType) - 1;
  30044. if (!attaches) {
  30045. this.removeEventListener(delegateType, focusMappedHandler);
  30046. dataPriv.remove(this, delegateType);
  30047. } else {
  30048. dataPriv.set(this, delegateType, attaches);
  30049. }
  30050. } else {
  30051. return false;
  30052. }
  30053. },
  30054. _default: function(event2) {
  30055. return dataPriv.get(event2.target, type2);
  30056. },
  30057. delegateType
  30058. };
  30059. jQuery.event.special[delegateType] = {
  30060. setup: function() {
  30061. var doc = this.ownerDocument || this.document || this, dataHolder = document2.documentMode ? this : doc, attaches = dataPriv.get(dataHolder, delegateType);
  30062. if (!attaches) {
  30063. if (document2.documentMode) {
  30064. this.addEventListener(delegateType, focusMappedHandler);
  30065. } else {
  30066. doc.addEventListener(type2, focusMappedHandler, true);
  30067. }
  30068. }
  30069. dataPriv.set(dataHolder, delegateType, (attaches || 0) + 1);
  30070. },
  30071. teardown: function() {
  30072. var doc = this.ownerDocument || this.document || this, dataHolder = document2.documentMode ? this : doc, attaches = dataPriv.get(dataHolder, delegateType) - 1;
  30073. if (!attaches) {
  30074. if (document2.documentMode) {
  30075. this.removeEventListener(delegateType, focusMappedHandler);
  30076. } else {
  30077. doc.removeEventListener(type2, focusMappedHandler, true);
  30078. }
  30079. dataPriv.remove(dataHolder, delegateType);
  30080. } else {
  30081. dataPriv.set(dataHolder, delegateType, attaches);
  30082. }
  30083. }
  30084. };
  30085. });
  30086. jQuery.each({
  30087. mouseenter: "mouseover",
  30088. mouseleave: "mouseout",
  30089. pointerenter: "pointerover",
  30090. pointerleave: "pointerout"
  30091. }, function(orig, fix) {
  30092. jQuery.event.special[orig] = {
  30093. delegateType: fix,
  30094. bindType: fix,
  30095. handle: function(event2) {
  30096. var ret, target = this, related = event2.relatedTarget, handleObj = event2.handleObj;
  30097. if (!related || related !== target && !jQuery.contains(target, related)) {
  30098. event2.type = handleObj.origType;
  30099. ret = handleObj.handler.apply(this, arguments);
  30100. event2.type = fix;
  30101. }
  30102. return ret;
  30103. }
  30104. };
  30105. });
  30106. jQuery.fn.extend({
  30107. on: function(types, selector, data, fn2) {
  30108. return on3(this, types, selector, data, fn2);
  30109. },
  30110. one: function(types, selector, data, fn2) {
  30111. return on3(this, types, selector, data, fn2, 1);
  30112. },
  30113. off: function(types, selector, fn2) {
  30114. var handleObj, type2;
  30115. if (types && types.preventDefault && types.handleObj) {
  30116. handleObj = types.handleObj;
  30117. jQuery(types.delegateTarget).off(
  30118. handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
  30119. handleObj.selector,
  30120. handleObj.handler
  30121. );
  30122. return this;
  30123. }
  30124. if (typeof types === "object") {
  30125. for (type2 in types) {
  30126. this.off(type2, selector, types[type2]);
  30127. }
  30128. return this;
  30129. }
  30130. if (selector === false || typeof selector === "function") {
  30131. fn2 = selector;
  30132. selector = void 0;
  30133. }
  30134. if (fn2 === false) {
  30135. fn2 = returnFalse;
  30136. }
  30137. return this.each(function() {
  30138. jQuery.event.remove(this, types, fn2, selector);
  30139. });
  30140. }
  30141. });
  30142. var rnoInnerhtml = /<script|<style|<link/i, rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g;
  30143. function manipulationTarget(elem, content) {
  30144. if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) {
  30145. return jQuery(elem).children("tbody")[0] || elem;
  30146. }
  30147. return elem;
  30148. }
  30149. function disableScript(elem) {
  30150. elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
  30151. return elem;
  30152. }
  30153. function restoreScript(elem) {
  30154. if ((elem.type || "").slice(0, 5) === "true/") {
  30155. elem.type = elem.type.slice(5);
  30156. } else {
  30157. elem.removeAttribute("type");
  30158. }
  30159. return elem;
  30160. }
  30161. function cloneCopyEvent(src, dest) {
  30162. var i2, l, type2, pdataOld, udataOld, udataCur, events;
  30163. if (dest.nodeType !== 1) {
  30164. return;
  30165. }
  30166. if (dataPriv.hasData(src)) {
  30167. pdataOld = dataPriv.get(src);
  30168. events = pdataOld.events;
  30169. if (events) {
  30170. dataPriv.remove(dest, "handle events");
  30171. for (type2 in events) {
  30172. for (i2 = 0, l = events[type2].length; i2 < l; i2++) {
  30173. jQuery.event.add(dest, type2, events[type2][i2]);
  30174. }
  30175. }
  30176. }
  30177. }
  30178. if (dataUser.hasData(src)) {
  30179. udataOld = dataUser.access(src);
  30180. udataCur = jQuery.extend({}, udataOld);
  30181. dataUser.set(dest, udataCur);
  30182. }
  30183. }
  30184. function fixInput(src, dest) {
  30185. var nodeName2 = dest.nodeName.toLowerCase();
  30186. if (nodeName2 === "input" && rcheckableType.test(src.type)) {
  30187. dest.checked = src.checked;
  30188. } else if (nodeName2 === "input" || nodeName2 === "textarea") {
  30189. dest.defaultValue = src.defaultValue;
  30190. }
  30191. }
  30192. function domManip(collection, args, callback2, ignored) {
  30193. args = flat2(args);
  30194. var fragment, first, scripts, hasScripts, node, doc, i2 = 0, l = collection.length, iNoClone = l - 1, value = args[0], valueIsFunction = isFunction2(value);
  30195. if (valueIsFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) {
  30196. return collection.each(function(index2) {
  30197. var self2 = collection.eq(index2);
  30198. if (valueIsFunction) {
  30199. args[0] = value.call(this, index2, self2.html());
  30200. }
  30201. domManip(self2, args, callback2, ignored);
  30202. });
  30203. }
  30204. if (l) {
  30205. fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
  30206. first = fragment.firstChild;
  30207. if (fragment.childNodes.length === 1) {
  30208. fragment = first;
  30209. }
  30210. if (first || ignored) {
  30211. scripts = jQuery.map(getAll(fragment, "script"), disableScript);
  30212. hasScripts = scripts.length;
  30213. for (; i2 < l; i2++) {
  30214. node = fragment;
  30215. if (i2 !== iNoClone) {
  30216. node = jQuery.clone(node, true, true);
  30217. if (hasScripts) {
  30218. jQuery.merge(scripts, getAll(node, "script"));
  30219. }
  30220. }
  30221. callback2.call(collection[i2], node, i2);
  30222. }
  30223. if (hasScripts) {
  30224. doc = scripts[scripts.length - 1].ownerDocument;
  30225. jQuery.map(scripts, restoreScript);
  30226. for (i2 = 0; i2 < hasScripts; i2++) {
  30227. node = scripts[i2];
  30228. if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc, node)) {
  30229. if (node.src && (node.type || "").toLowerCase() !== "module") {
  30230. if (jQuery._evalUrl && !node.noModule) {
  30231. jQuery._evalUrl(node.src, {
  30232. nonce: node.nonce || node.getAttribute("nonce")
  30233. }, doc);
  30234. }
  30235. } else {
  30236. DOMEval(node.textContent.replace(rcleanScript, ""), node, doc);
  30237. }
  30238. }
  30239. }
  30240. }
  30241. }
  30242. }
  30243. return collection;
  30244. }
  30245. function remove2(elem, selector, keepData) {
  30246. var node, nodes = selector ? jQuery.filter(selector, elem) : elem, i2 = 0;
  30247. for (; (node = nodes[i2]) != null; i2++) {
  30248. if (!keepData && node.nodeType === 1) {
  30249. jQuery.cleanData(getAll(node));
  30250. }
  30251. if (node.parentNode) {
  30252. if (keepData && isAttached(node)) {
  30253. setGlobalEval(getAll(node, "script"));
  30254. }
  30255. node.parentNode.removeChild(node);
  30256. }
  30257. }
  30258. return elem;
  30259. }
  30260. jQuery.extend({
  30261. htmlPrefilter: function(html) {
  30262. return html;
  30263. },
  30264. clone: function(elem, dataAndEvents, deepDataAndEvents) {
  30265. var i2, l, srcElements, destElements, clone = elem.cloneNode(true), inPage = isAttached(elem);
  30266. if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
  30267. destElements = getAll(clone);
  30268. srcElements = getAll(elem);
  30269. for (i2 = 0, l = srcElements.length; i2 < l; i2++) {
  30270. fixInput(srcElements[i2], destElements[i2]);
  30271. }
  30272. }
  30273. if (dataAndEvents) {
  30274. if (deepDataAndEvents) {
  30275. srcElements = srcElements || getAll(elem);
  30276. destElements = destElements || getAll(clone);
  30277. for (i2 = 0, l = srcElements.length; i2 < l; i2++) {
  30278. cloneCopyEvent(srcElements[i2], destElements[i2]);
  30279. }
  30280. } else {
  30281. cloneCopyEvent(elem, clone);
  30282. }
  30283. }
  30284. destElements = getAll(clone, "script");
  30285. if (destElements.length > 0) {
  30286. setGlobalEval(destElements, !inPage && getAll(elem, "script"));
  30287. }
  30288. return clone;
  30289. },
  30290. cleanData: function(elems) {
  30291. var data, elem, type2, special = jQuery.event.special, i2 = 0;
  30292. for (; (elem = elems[i2]) !== void 0; i2++) {
  30293. if (acceptData(elem)) {
  30294. if (data = elem[dataPriv.expando]) {
  30295. if (data.events) {
  30296. for (type2 in data.events) {
  30297. if (special[type2]) {
  30298. jQuery.event.remove(elem, type2);
  30299. } else {
  30300. jQuery.removeEvent(elem, type2, data.handle);
  30301. }
  30302. }
  30303. }
  30304. elem[dataPriv.expando] = void 0;
  30305. }
  30306. if (elem[dataUser.expando]) {
  30307. elem[dataUser.expando] = void 0;
  30308. }
  30309. }
  30310. }
  30311. }
  30312. });
  30313. jQuery.fn.extend({
  30314. detach: function(selector) {
  30315. return remove2(this, selector, true);
  30316. },
  30317. remove: function(selector) {
  30318. return remove2(this, selector);
  30319. },
  30320. text: function(value) {
  30321. return access(this, function(value2) {
  30322. return value2 === void 0 ? jQuery.text(this) : this.empty().each(function() {
  30323. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  30324. this.textContent = value2;
  30325. }
  30326. });
  30327. }, null, value, arguments.length);
  30328. },
  30329. append: function() {
  30330. return domManip(this, arguments, function(elem) {
  30331. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  30332. var target = manipulationTarget(this, elem);
  30333. target.appendChild(elem);
  30334. }
  30335. });
  30336. },
  30337. prepend: function() {
  30338. return domManip(this, arguments, function(elem) {
  30339. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  30340. var target = manipulationTarget(this, elem);
  30341. target.insertBefore(elem, target.firstChild);
  30342. }
  30343. });
  30344. },
  30345. before: function() {
  30346. return domManip(this, arguments, function(elem) {
  30347. if (this.parentNode) {
  30348. this.parentNode.insertBefore(elem, this);
  30349. }
  30350. });
  30351. },
  30352. after: function() {
  30353. return domManip(this, arguments, function(elem) {
  30354. if (this.parentNode) {
  30355. this.parentNode.insertBefore(elem, this.nextSibling);
  30356. }
  30357. });
  30358. },
  30359. empty: function() {
  30360. var elem, i2 = 0;
  30361. for (; (elem = this[i2]) != null; i2++) {
  30362. if (elem.nodeType === 1) {
  30363. jQuery.cleanData(getAll(elem, false));
  30364. elem.textContent = "";
  30365. }
  30366. }
  30367. return this;
  30368. },
  30369. clone: function(dataAndEvents, deepDataAndEvents) {
  30370. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  30371. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  30372. return this.map(function() {
  30373. return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
  30374. });
  30375. },
  30376. html: function(value) {
  30377. return access(this, function(value2) {
  30378. var elem = this[0] || {}, i2 = 0, l = this.length;
  30379. if (value2 === void 0 && elem.nodeType === 1) {
  30380. return elem.innerHTML;
  30381. }
  30382. if (typeof value2 === "string" && !rnoInnerhtml.test(value2) && !wrapMap[(rtagName.exec(value2) || ["", ""])[1].toLowerCase()]) {
  30383. value2 = jQuery.htmlPrefilter(value2);
  30384. try {
  30385. for (; i2 < l; i2++) {
  30386. elem = this[i2] || {};
  30387. if (elem.nodeType === 1) {
  30388. jQuery.cleanData(getAll(elem, false));
  30389. elem.innerHTML = value2;
  30390. }
  30391. }
  30392. elem = 0;
  30393. } catch (e) {
  30394. }
  30395. }
  30396. if (elem) {
  30397. this.empty().append(value2);
  30398. }
  30399. }, null, value, arguments.length);
  30400. },
  30401. replaceWith: function() {
  30402. var ignored = [];
  30403. return domManip(this, arguments, function(elem) {
  30404. var parent = this.parentNode;
  30405. if (jQuery.inArray(this, ignored) < 0) {
  30406. jQuery.cleanData(getAll(this));
  30407. if (parent) {
  30408. parent.replaceChild(elem, this);
  30409. }
  30410. }
  30411. }, ignored);
  30412. }
  30413. });
  30414. jQuery.each({
  30415. appendTo: "append",
  30416. prependTo: "prepend",
  30417. insertBefore: "before",
  30418. insertAfter: "after",
  30419. replaceAll: "replaceWith"
  30420. }, function(name, original) {
  30421. jQuery.fn[name] = function(selector) {
  30422. var elems, ret = [], insert = jQuery(selector), last = insert.length - 1, i2 = 0;
  30423. for (; i2 <= last; i2++) {
  30424. elems = i2 === last ? this : this.clone(true);
  30425. jQuery(insert[i2])[original](elems);
  30426. push.apply(ret, elems.get());
  30427. }
  30428. return this.pushStack(ret);
  30429. };
  30430. });
  30431. var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
  30432. var rcustomProp = /^--/;
  30433. var getStyles = function(elem) {
  30434. var view = elem.ownerDocument.defaultView;
  30435. if (!view || !view.opener) {
  30436. view = window2;
  30437. }
  30438. return view.getComputedStyle(elem);
  30439. };
  30440. var swap = function(elem, options2, callback2) {
  30441. var ret, name, old = {};
  30442. for (name in options2) {
  30443. old[name] = elem.style[name];
  30444. elem.style[name] = options2[name];
  30445. }
  30446. ret = callback2.call(elem);
  30447. for (name in options2) {
  30448. elem.style[name] = old[name];
  30449. }
  30450. return ret;
  30451. };
  30452. var rboxStyle = new RegExp(cssExpand.join("|"), "i");
  30453. (function() {
  30454. function computeStyleTests() {
  30455. if (!div) {
  30456. return;
  30457. }
  30458. container.style.cssText = "position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0";
  30459. div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%";
  30460. documentElement.appendChild(container).appendChild(div);
  30461. var divStyle = window2.getComputedStyle(div);
  30462. pixelPositionVal = divStyle.top !== "1%";
  30463. reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;
  30464. div.style.right = "60%";
  30465. pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;
  30466. boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;
  30467. div.style.position = "absolute";
  30468. scrollboxSizeVal = roundPixelMeasures(div.offsetWidth / 3) === 12;
  30469. documentElement.removeChild(container);
  30470. div = null;
  30471. }
  30472. function roundPixelMeasures(measure) {
  30473. return Math.round(parseFloat(measure));
  30474. }
  30475. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, reliableTrDimensionsVal, reliableMarginLeftVal, container = document2.createElement("div"), div = document2.createElement("div");
  30476. if (!div.style) {
  30477. return;
  30478. }
  30479. div.style.backgroundClip = "content-box";
  30480. div.cloneNode(true).style.backgroundClip = "";
  30481. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  30482. jQuery.extend(support, {
  30483. boxSizingReliable: function() {
  30484. computeStyleTests();
  30485. return boxSizingReliableVal;
  30486. },
  30487. pixelBoxStyles: function() {
  30488. computeStyleTests();
  30489. return pixelBoxStylesVal;
  30490. },
  30491. pixelPosition: function() {
  30492. computeStyleTests();
  30493. return pixelPositionVal;
  30494. },
  30495. reliableMarginLeft: function() {
  30496. computeStyleTests();
  30497. return reliableMarginLeftVal;
  30498. },
  30499. scrollboxSize: function() {
  30500. computeStyleTests();
  30501. return scrollboxSizeVal;
  30502. },
  30503. reliableTrDimensions: function() {
  30504. var table, tr, trChild, trStyle;
  30505. if (reliableTrDimensionsVal == null) {
  30506. table = document2.createElement("table");
  30507. tr = document2.createElement("tr");
  30508. trChild = document2.createElement("div");
  30509. table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";
  30510. tr.style.cssText = "border:1px solid";
  30511. tr.style.height = "1px";
  30512. trChild.style.height = "9px";
  30513. trChild.style.display = "block";
  30514. documentElement.appendChild(table).appendChild(tr).appendChild(trChild);
  30515. trStyle = window2.getComputedStyle(tr);
  30516. reliableTrDimensionsVal = parseInt(trStyle.height, 10) + parseInt(trStyle.borderTopWidth, 10) + parseInt(trStyle.borderBottomWidth, 10) === tr.offsetHeight;
  30517. documentElement.removeChild(table);
  30518. }
  30519. return reliableTrDimensionsVal;
  30520. }
  30521. });
  30522. })();
  30523. function curCSS(elem, name, computed2) {
  30524. var width2, minWidth, maxWidth, ret, isCustomProp = rcustomProp.test(name), style = elem.style;
  30525. computed2 = computed2 || getStyles(elem);
  30526. if (computed2) {
  30527. ret = computed2.getPropertyValue(name) || computed2[name];
  30528. if (isCustomProp && ret) {
  30529. ret = ret.replace(rtrimCSS, "$1") || void 0;
  30530. }
  30531. if (ret === "" && !isAttached(elem)) {
  30532. ret = jQuery.style(elem, name);
  30533. }
  30534. if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {
  30535. width2 = style.width;
  30536. minWidth = style.minWidth;
  30537. maxWidth = style.maxWidth;
  30538. style.minWidth = style.maxWidth = style.width = ret;
  30539. ret = computed2.width;
  30540. style.width = width2;
  30541. style.minWidth = minWidth;
  30542. style.maxWidth = maxWidth;
  30543. }
  30544. }
  30545. return ret !== void 0 ? ret + "" : ret;
  30546. }
  30547. function addGetHookIf(conditionFn, hookFn) {
  30548. return {
  30549. get: function() {
  30550. if (conditionFn()) {
  30551. delete this.get;
  30552. return;
  30553. }
  30554. return (this.get = hookFn).apply(this, arguments);
  30555. }
  30556. };
  30557. }
  30558. var cssPrefixes = ["Webkit", "Moz", "ms"], emptyStyle = document2.createElement("div").style, vendorProps = {};
  30559. function vendorPropName(name) {
  30560. var capName = name[0].toUpperCase() + name.slice(1), i2 = cssPrefixes.length;
  30561. while (i2--) {
  30562. name = cssPrefixes[i2] + capName;
  30563. if (name in emptyStyle) {
  30564. return name;
  30565. }
  30566. }
  30567. }
  30568. function finalPropName(name) {
  30569. var final = jQuery.cssProps[name] || vendorProps[name];
  30570. if (final) {
  30571. return final;
  30572. }
  30573. if (name in emptyStyle) {
  30574. return name;
  30575. }
  30576. return vendorProps[name] = vendorPropName(name) || name;
  30577. }
  30578. var rdisplayswap = /^(none|table(?!-c[ea]).+)/, cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssNormalTransform = {
  30579. letterSpacing: "0",
  30580. fontWeight: "400"
  30581. };
  30582. function setPositiveNumber(_elem, value, subtract) {
  30583. var matches = rcssNum.exec(value);
  30584. return matches ? Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value;
  30585. }
  30586. function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
  30587. var i2 = dimension === "width" ? 1 : 0, extra = 0, delta = 0, marginDelta = 0;
  30588. if (box === (isBorderBox ? "border" : "content")) {
  30589. return 0;
  30590. }
  30591. for (; i2 < 4; i2 += 2) {
  30592. if (box === "margin") {
  30593. marginDelta += jQuery.css(elem, box + cssExpand[i2], true, styles);
  30594. }
  30595. if (!isBorderBox) {
  30596. delta += jQuery.css(elem, "padding" + cssExpand[i2], true, styles);
  30597. if (box !== "padding") {
  30598. delta += jQuery.css(elem, "border" + cssExpand[i2] + "Width", true, styles);
  30599. } else {
  30600. extra += jQuery.css(elem, "border" + cssExpand[i2] + "Width", true, styles);
  30601. }
  30602. } else {
  30603. if (box === "content") {
  30604. delta -= jQuery.css(elem, "padding" + cssExpand[i2], true, styles);
  30605. }
  30606. if (box !== "margin") {
  30607. delta -= jQuery.css(elem, "border" + cssExpand[i2] + "Width", true, styles);
  30608. }
  30609. }
  30610. }
  30611. if (!isBorderBox && computedVal >= 0) {
  30612. delta += Math.max(0, Math.ceil(
  30613. elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5
  30614. )) || 0;
  30615. }
  30616. return delta + marginDelta;
  30617. }
  30618. function getWidthOrHeight(elem, dimension, extra) {
  30619. var styles = getStyles(elem), boxSizingNeeded = !support.boxSizingReliable() || extra, isBorderBox = boxSizingNeeded && jQuery.css(elem, "boxSizing", false, styles) === "border-box", valueIsBorderBox = isBorderBox, val = curCSS(elem, dimension, styles), offsetProp = "offset" + dimension[0].toUpperCase() + dimension.slice(1);
  30620. if (rnumnonpx.test(val)) {
  30621. if (!extra) {
  30622. return val;
  30623. }
  30624. val = "auto";
  30625. }
  30626. if ((!support.boxSizingReliable() && isBorderBox || !support.reliableTrDimensions() && nodeName(elem, "tr") || val === "auto" || !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") && elem.getClientRects().length) {
  30627. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box";
  30628. valueIsBorderBox = offsetProp in elem;
  30629. if (valueIsBorderBox) {
  30630. val = elem[offsetProp];
  30631. }
  30632. }
  30633. val = parseFloat(val) || 0;
  30634. return val + boxModelAdjustment(
  30635. elem,
  30636. dimension,
  30637. extra || (isBorderBox ? "border" : "content"),
  30638. valueIsBorderBox,
  30639. styles,
  30640. val
  30641. ) + "px";
  30642. }
  30643. jQuery.extend({
  30644. cssHooks: {
  30645. opacity: {
  30646. get: function(elem, computed2) {
  30647. if (computed2) {
  30648. var ret = curCSS(elem, "opacity");
  30649. return ret === "" ? "1" : ret;
  30650. }
  30651. }
  30652. }
  30653. },
  30654. cssNumber: {
  30655. animationIterationCount: true,
  30656. aspectRatio: true,
  30657. borderImageSlice: true,
  30658. columnCount: true,
  30659. flexGrow: true,
  30660. flexShrink: true,
  30661. fontWeight: true,
  30662. gridArea: true,
  30663. gridColumn: true,
  30664. gridColumnEnd: true,
  30665. gridColumnStart: true,
  30666. gridRow: true,
  30667. gridRowEnd: true,
  30668. gridRowStart: true,
  30669. lineHeight: true,
  30670. opacity: true,
  30671. order: true,
  30672. orphans: true,
  30673. scale: true,
  30674. widows: true,
  30675. zIndex: true,
  30676. zoom: true,
  30677. fillOpacity: true,
  30678. floodOpacity: true,
  30679. stopOpacity: true,
  30680. strokeMiterlimit: true,
  30681. strokeOpacity: true
  30682. },
  30683. cssProps: {},
  30684. style: function(elem, name, value, extra) {
  30685. if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
  30686. return;
  30687. }
  30688. var ret, type2, hooks3, origName = camelCase3(name), isCustomProp = rcustomProp.test(name), style = elem.style;
  30689. if (!isCustomProp) {
  30690. name = finalPropName(origName);
  30691. }
  30692. hooks3 = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  30693. if (value !== void 0) {
  30694. type2 = typeof value;
  30695. if (type2 === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
  30696. value = adjustCSS(elem, name, ret);
  30697. type2 = "number";
  30698. }
  30699. if (value == null || value !== value) {
  30700. return;
  30701. }
  30702. if (type2 === "number" && !isCustomProp) {
  30703. value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px");
  30704. }
  30705. if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
  30706. style[name] = "inherit";
  30707. }
  30708. if (!hooks3 || !("set" in hooks3) || (value = hooks3.set(elem, value, extra)) !== void 0) {
  30709. if (isCustomProp) {
  30710. style.setProperty(name, value);
  30711. } else {
  30712. style[name] = value;
  30713. }
  30714. }
  30715. } else {
  30716. if (hooks3 && "get" in hooks3 && (ret = hooks3.get(elem, false, extra)) !== void 0) {
  30717. return ret;
  30718. }
  30719. return style[name];
  30720. }
  30721. },
  30722. css: function(elem, name, extra, styles) {
  30723. var val, num, hooks3, origName = camelCase3(name), isCustomProp = rcustomProp.test(name);
  30724. if (!isCustomProp) {
  30725. name = finalPropName(origName);
  30726. }
  30727. hooks3 = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  30728. if (hooks3 && "get" in hooks3) {
  30729. val = hooks3.get(elem, true, extra);
  30730. }
  30731. if (val === void 0) {
  30732. val = curCSS(elem, name, styles);
  30733. }
  30734. if (val === "normal" && name in cssNormalTransform) {
  30735. val = cssNormalTransform[name];
  30736. }
  30737. if (extra === "" || extra) {
  30738. num = parseFloat(val);
  30739. return extra === true || isFinite(num) ? num || 0 : val;
  30740. }
  30741. return val;
  30742. }
  30743. });
  30744. jQuery.each(["height", "width"], function(_i, dimension) {
  30745. jQuery.cssHooks[dimension] = {
  30746. get: function(elem, computed2, extra) {
  30747. if (computed2) {
  30748. return rdisplayswap.test(jQuery.css(elem, "display")) && (!elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function() {
  30749. return getWidthOrHeight(elem, dimension, extra);
  30750. }) : getWidthOrHeight(elem, dimension, extra);
  30751. }
  30752. },
  30753. set: function(elem, value, extra) {
  30754. var matches, styles = getStyles(elem), scrollboxSizeBuggy = !support.scrollboxSize() && styles.position === "absolute", boxSizingNeeded = scrollboxSizeBuggy || extra, isBorderBox = boxSizingNeeded && jQuery.css(elem, "boxSizing", false, styles) === "border-box", subtract = extra ? boxModelAdjustment(
  30755. elem,
  30756. dimension,
  30757. extra,
  30758. isBorderBox,
  30759. styles
  30760. ) : 0;
  30761. if (isBorderBox && scrollboxSizeBuggy) {
  30762. subtract -= Math.ceil(
  30763. elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5
  30764. );
  30765. }
  30766. if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") {
  30767. elem.style[dimension] = value;
  30768. value = jQuery.css(elem, dimension);
  30769. }
  30770. return setPositiveNumber(elem, value, subtract);
  30771. }
  30772. };
  30773. });
  30774. jQuery.cssHooks.marginLeft = addGetHookIf(
  30775. support.reliableMarginLeft,
  30776. function(elem, computed2) {
  30777. if (computed2) {
  30778. return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function() {
  30779. return elem.getBoundingClientRect().left;
  30780. })) + "px";
  30781. }
  30782. }
  30783. );
  30784. jQuery.each({
  30785. margin: "",
  30786. padding: "",
  30787. border: "Width"
  30788. }, function(prefix, suffix) {
  30789. jQuery.cssHooks[prefix + suffix] = {
  30790. expand: function(value) {
  30791. var i2 = 0, expanded = {}, parts = typeof value === "string" ? value.split(" ") : [value];
  30792. for (; i2 < 4; i2++) {
  30793. expanded[prefix + cssExpand[i2] + suffix] = parts[i2] || parts[i2 - 2] || parts[0];
  30794. }
  30795. return expanded;
  30796. }
  30797. };
  30798. if (prefix !== "margin") {
  30799. jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
  30800. }
  30801. });
  30802. jQuery.fn.extend({
  30803. css: function(name, value) {
  30804. return access(this, function(elem, name2, value2) {
  30805. var styles, len, map = {}, i2 = 0;
  30806. if (Array.isArray(name2)) {
  30807. styles = getStyles(elem);
  30808. len = name2.length;
  30809. for (; i2 < len; i2++) {
  30810. map[name2[i2]] = jQuery.css(elem, name2[i2], false, styles);
  30811. }
  30812. return map;
  30813. }
  30814. return value2 !== void 0 ? jQuery.style(elem, name2, value2) : jQuery.css(elem, name2);
  30815. }, name, value, arguments.length > 1);
  30816. }
  30817. });
  30818. function Tween(elem, options2, prop, end, easing) {
  30819. return new Tween.prototype.init(elem, options2, prop, end, easing);
  30820. }
  30821. jQuery.Tween = Tween;
  30822. Tween.prototype = {
  30823. constructor: Tween,
  30824. init: function(elem, options2, prop, end, easing, unit) {
  30825. this.elem = elem;
  30826. this.prop = prop;
  30827. this.easing = easing || jQuery.easing._default;
  30828. this.options = options2;
  30829. this.start = this.now = this.cur();
  30830. this.end = end;
  30831. this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
  30832. },
  30833. cur: function() {
  30834. var hooks3 = Tween.propHooks[this.prop];
  30835. return hooks3 && hooks3.get ? hooks3.get(this) : Tween.propHooks._default.get(this);
  30836. },
  30837. run: function(percent) {
  30838. var eased, hooks3 = Tween.propHooks[this.prop];
  30839. if (this.options.duration) {
  30840. this.pos = eased = jQuery.easing[this.easing](
  30841. percent,
  30842. this.options.duration * percent,
  30843. 0,
  30844. 1,
  30845. this.options.duration
  30846. );
  30847. } else {
  30848. this.pos = eased = percent;
  30849. }
  30850. this.now = (this.end - this.start) * eased + this.start;
  30851. if (this.options.step) {
  30852. this.options.step.call(this.elem, this.now, this);
  30853. }
  30854. if (hooks3 && hooks3.set) {
  30855. hooks3.set(this);
  30856. } else {
  30857. Tween.propHooks._default.set(this);
  30858. }
  30859. return this;
  30860. }
  30861. };
  30862. Tween.prototype.init.prototype = Tween.prototype;
  30863. Tween.propHooks = {
  30864. _default: {
  30865. get: function(tween) {
  30866. var result;
  30867. if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
  30868. return tween.elem[tween.prop];
  30869. }
  30870. result = jQuery.css(tween.elem, tween.prop, "");
  30871. return !result || result === "auto" ? 0 : result;
  30872. },
  30873. set: function(tween) {
  30874. if (jQuery.fx.step[tween.prop]) {
  30875. jQuery.fx.step[tween.prop](tween);
  30876. } else if (tween.elem.nodeType === 1 && (jQuery.cssHooks[tween.prop] || tween.elem.style[finalPropName(tween.prop)] != null)) {
  30877. jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
  30878. } else {
  30879. tween.elem[tween.prop] = tween.now;
  30880. }
  30881. }
  30882. }
  30883. };
  30884. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  30885. set: function(tween) {
  30886. if (tween.elem.nodeType && tween.elem.parentNode) {
  30887. tween.elem[tween.prop] = tween.now;
  30888. }
  30889. }
  30890. };
  30891. jQuery.easing = {
  30892. linear: function(p) {
  30893. return p;
  30894. },
  30895. swing: function(p) {
  30896. return 0.5 - Math.cos(p * Math.PI) / 2;
  30897. },
  30898. _default: "swing"
  30899. };
  30900. jQuery.fx = Tween.prototype.init;
  30901. jQuery.fx.step = {};
  30902. var fxNow, inProgress, rfxtypes = /^(?:toggle|show|hide)$/, rrun = /queueHooks$/;
  30903. function schedule() {
  30904. if (inProgress) {
  30905. if (document2.hidden === false && window2.requestAnimationFrame) {
  30906. window2.requestAnimationFrame(schedule);
  30907. } else {
  30908. window2.setTimeout(schedule, jQuery.fx.interval);
  30909. }
  30910. jQuery.fx.tick();
  30911. }
  30912. }
  30913. function createFxNow() {
  30914. window2.setTimeout(function() {
  30915. fxNow = void 0;
  30916. });
  30917. return fxNow = Date.now();
  30918. }
  30919. function genFx(type2, includeWidth) {
  30920. var which, i2 = 0, attrs = { height: type2 };
  30921. includeWidth = includeWidth ? 1 : 0;
  30922. for (; i2 < 4; i2 += 2 - includeWidth) {
  30923. which = cssExpand[i2];
  30924. attrs["margin" + which] = attrs["padding" + which] = type2;
  30925. }
  30926. if (includeWidth) {
  30927. attrs.opacity = attrs.width = type2;
  30928. }
  30929. return attrs;
  30930. }
  30931. function createTween(value, prop, animation) {
  30932. var tween, collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]), index2 = 0, length = collection.length;
  30933. for (; index2 < length; index2++) {
  30934. if (tween = collection[index2].call(animation, prop, value)) {
  30935. return tween;
  30936. }
  30937. }
  30938. }
  30939. function defaultPrefilter(elem, props, opts) {
  30940. var prop, value, toggle, hooks3, oldfire, propTween, restoreDisplay, display, isBox = "width" in props || "height" in props, anim = this, orig = {}, style = elem.style, hidden = elem.nodeType && isHiddenWithinTree(elem), dataShow = dataPriv.get(elem, "fxshow");
  30941. if (!opts.queue) {
  30942. hooks3 = jQuery._queueHooks(elem, "fx");
  30943. if (hooks3.unqueued == null) {
  30944. hooks3.unqueued = 0;
  30945. oldfire = hooks3.empty.fire;
  30946. hooks3.empty.fire = function() {
  30947. if (!hooks3.unqueued) {
  30948. oldfire();
  30949. }
  30950. };
  30951. }
  30952. hooks3.unqueued++;
  30953. anim.always(function() {
  30954. anim.always(function() {
  30955. hooks3.unqueued--;
  30956. if (!jQuery.queue(elem, "fx").length) {
  30957. hooks3.empty.fire();
  30958. }
  30959. });
  30960. });
  30961. }
  30962. for (prop in props) {
  30963. value = props[prop];
  30964. if (rfxtypes.test(value)) {
  30965. delete props[prop];
  30966. toggle = toggle || value === "toggle";
  30967. if (value === (hidden ? "hide" : "show")) {
  30968. if (value === "show" && dataShow && dataShow[prop] !== void 0) {
  30969. hidden = true;
  30970. } else {
  30971. continue;
  30972. }
  30973. }
  30974. orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
  30975. }
  30976. }
  30977. propTween = !jQuery.isEmptyObject(props);
  30978. if (!propTween && jQuery.isEmptyObject(orig)) {
  30979. return;
  30980. }
  30981. if (isBox && elem.nodeType === 1) {
  30982. opts.overflow = [style.overflow, style.overflowX, style.overflowY];
  30983. restoreDisplay = dataShow && dataShow.display;
  30984. if (restoreDisplay == null) {
  30985. restoreDisplay = dataPriv.get(elem, "display");
  30986. }
  30987. display = jQuery.css(elem, "display");
  30988. if (display === "none") {
  30989. if (restoreDisplay) {
  30990. display = restoreDisplay;
  30991. } else {
  30992. showHide([elem], true);
  30993. restoreDisplay = elem.style.display || restoreDisplay;
  30994. display = jQuery.css(elem, "display");
  30995. showHide([elem]);
  30996. }
  30997. }
  30998. if (display === "inline" || display === "inline-block" && restoreDisplay != null) {
  30999. if (jQuery.css(elem, "float") === "none") {
  31000. if (!propTween) {
  31001. anim.done(function() {
  31002. style.display = restoreDisplay;
  31003. });
  31004. if (restoreDisplay == null) {
  31005. display = style.display;
  31006. restoreDisplay = display === "none" ? "" : display;
  31007. }
  31008. }
  31009. style.display = "inline-block";
  31010. }
  31011. }
  31012. }
  31013. if (opts.overflow) {
  31014. style.overflow = "hidden";
  31015. anim.always(function() {
  31016. style.overflow = opts.overflow[0];
  31017. style.overflowX = opts.overflow[1];
  31018. style.overflowY = opts.overflow[2];
  31019. });
  31020. }
  31021. propTween = false;
  31022. for (prop in orig) {
  31023. if (!propTween) {
  31024. if (dataShow) {
  31025. if ("hidden" in dataShow) {
  31026. hidden = dataShow.hidden;
  31027. }
  31028. } else {
  31029. dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay });
  31030. }
  31031. if (toggle) {
  31032. dataShow.hidden = !hidden;
  31033. }
  31034. if (hidden) {
  31035. showHide([elem], true);
  31036. }
  31037. anim.done(function() {
  31038. if (!hidden) {
  31039. showHide([elem]);
  31040. }
  31041. dataPriv.remove(elem, "fxshow");
  31042. for (prop in orig) {
  31043. jQuery.style(elem, prop, orig[prop]);
  31044. }
  31045. });
  31046. }
  31047. propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
  31048. if (!(prop in dataShow)) {
  31049. dataShow[prop] = propTween.start;
  31050. if (hidden) {
  31051. propTween.end = propTween.start;
  31052. propTween.start = 0;
  31053. }
  31054. }
  31055. }
  31056. }
  31057. function propFilter(props, specialEasing) {
  31058. var index2, name, easing, value, hooks3;
  31059. for (index2 in props) {
  31060. name = camelCase3(index2);
  31061. easing = specialEasing[name];
  31062. value = props[index2];
  31063. if (Array.isArray(value)) {
  31064. easing = value[1];
  31065. value = props[index2] = value[0];
  31066. }
  31067. if (index2 !== name) {
  31068. props[name] = value;
  31069. delete props[index2];
  31070. }
  31071. hooks3 = jQuery.cssHooks[name];
  31072. if (hooks3 && "expand" in hooks3) {
  31073. value = hooks3.expand(value);
  31074. delete props[name];
  31075. for (index2 in value) {
  31076. if (!(index2 in props)) {
  31077. props[index2] = value[index2];
  31078. specialEasing[index2] = easing;
  31079. }
  31080. }
  31081. } else {
  31082. specialEasing[name] = easing;
  31083. }
  31084. }
  31085. }
  31086. function Animation(elem, properties, options2) {
  31087. var result, stopped, index2 = 0, length = Animation.prefilters.length, deferred = jQuery.Deferred().always(function() {
  31088. delete tick.elem;
  31089. }), tick = function() {
  31090. if (stopped) {
  31091. return false;
  31092. }
  31093. var currentTime = fxNow || createFxNow(), remaining = Math.max(0, animation.startTime + animation.duration - currentTime), temp = remaining / animation.duration || 0, percent = 1 - temp, index3 = 0, length2 = animation.tweens.length;
  31094. for (; index3 < length2; index3++) {
  31095. animation.tweens[index3].run(percent);
  31096. }
  31097. deferred.notifyWith(elem, [animation, percent, remaining]);
  31098. if (percent < 1 && length2) {
  31099. return remaining;
  31100. }
  31101. if (!length2) {
  31102. deferred.notifyWith(elem, [animation, 1, 0]);
  31103. }
  31104. deferred.resolveWith(elem, [animation]);
  31105. return false;
  31106. }, animation = deferred.promise({
  31107. elem,
  31108. props: jQuery.extend({}, properties),
  31109. opts: jQuery.extend(true, {
  31110. specialEasing: {},
  31111. easing: jQuery.easing._default
  31112. }, options2),
  31113. originalProperties: properties,
  31114. originalOptions: options2,
  31115. startTime: fxNow || createFxNow(),
  31116. duration: options2.duration,
  31117. tweens: [],
  31118. createTween: function(prop, end) {
  31119. var tween = jQuery.Tween(
  31120. elem,
  31121. animation.opts,
  31122. prop,
  31123. end,
  31124. animation.opts.specialEasing[prop] || animation.opts.easing
  31125. );
  31126. animation.tweens.push(tween);
  31127. return tween;
  31128. },
  31129. stop: function(gotoEnd) {
  31130. var index3 = 0, length2 = gotoEnd ? animation.tweens.length : 0;
  31131. if (stopped) {
  31132. return this;
  31133. }
  31134. stopped = true;
  31135. for (; index3 < length2; index3++) {
  31136. animation.tweens[index3].run(1);
  31137. }
  31138. if (gotoEnd) {
  31139. deferred.notifyWith(elem, [animation, 1, 0]);
  31140. deferred.resolveWith(elem, [animation, gotoEnd]);
  31141. } else {
  31142. deferred.rejectWith(elem, [animation, gotoEnd]);
  31143. }
  31144. return this;
  31145. }
  31146. }), props = animation.props;
  31147. propFilter(props, animation.opts.specialEasing);
  31148. for (; index2 < length; index2++) {
  31149. result = Animation.prefilters[index2].call(animation, elem, props, animation.opts);
  31150. if (result) {
  31151. if (isFunction2(result.stop)) {
  31152. jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result);
  31153. }
  31154. return result;
  31155. }
  31156. }
  31157. jQuery.map(props, createTween, animation);
  31158. if (isFunction2(animation.opts.start)) {
  31159. animation.opts.start.call(elem, animation);
  31160. }
  31161. animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);
  31162. jQuery.fx.timer(
  31163. jQuery.extend(tick, {
  31164. elem,
  31165. anim: animation,
  31166. queue: animation.opts.queue
  31167. })
  31168. );
  31169. return animation;
  31170. }
  31171. jQuery.Animation = jQuery.extend(Animation, {
  31172. tweeners: {
  31173. "*": [function(prop, value) {
  31174. var tween = this.createTween(prop, value);
  31175. adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
  31176. return tween;
  31177. }]
  31178. },
  31179. tweener: function(props, callback2) {
  31180. if (isFunction2(props)) {
  31181. callback2 = props;
  31182. props = ["*"];
  31183. } else {
  31184. props = props.match(rnothtmlwhite);
  31185. }
  31186. var prop, index2 = 0, length = props.length;
  31187. for (; index2 < length; index2++) {
  31188. prop = props[index2];
  31189. Animation.tweeners[prop] = Animation.tweeners[prop] || [];
  31190. Animation.tweeners[prop].unshift(callback2);
  31191. }
  31192. },
  31193. prefilters: [defaultPrefilter],
  31194. prefilter: function(callback2, prepend) {
  31195. if (prepend) {
  31196. Animation.prefilters.unshift(callback2);
  31197. } else {
  31198. Animation.prefilters.push(callback2);
  31199. }
  31200. }
  31201. });
  31202. jQuery.speed = function(speed, easing, fn2) {
  31203. var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
  31204. complete: fn2 || !fn2 && easing || isFunction2(speed) && speed,
  31205. duration: speed,
  31206. easing: fn2 && easing || easing && !isFunction2(easing) && easing
  31207. };
  31208. if (jQuery.fx.off) {
  31209. opt.duration = 0;
  31210. } else {
  31211. if (typeof opt.duration !== "number") {
  31212. if (opt.duration in jQuery.fx.speeds) {
  31213. opt.duration = jQuery.fx.speeds[opt.duration];
  31214. } else {
  31215. opt.duration = jQuery.fx.speeds._default;
  31216. }
  31217. }
  31218. }
  31219. if (opt.queue == null || opt.queue === true) {
  31220. opt.queue = "fx";
  31221. }
  31222. opt.old = opt.complete;
  31223. opt.complete = function() {
  31224. if (isFunction2(opt.old)) {
  31225. opt.old.call(this);
  31226. }
  31227. if (opt.queue) {
  31228. jQuery.dequeue(this, opt.queue);
  31229. }
  31230. };
  31231. return opt;
  31232. };
  31233. jQuery.fn.extend({
  31234. fadeTo: function(speed, to, easing, callback2) {
  31235. return this.filter(isHiddenWithinTree).css("opacity", 0).show().end().animate({ opacity: to }, speed, easing, callback2);
  31236. },
  31237. animate: function(prop, speed, easing, callback2) {
  31238. var empty = jQuery.isEmptyObject(prop), optall = jQuery.speed(speed, easing, callback2), doAnimation = function() {
  31239. var anim = Animation(this, jQuery.extend({}, prop), optall);
  31240. if (empty || dataPriv.get(this, "finish")) {
  31241. anim.stop(true);
  31242. }
  31243. };
  31244. doAnimation.finish = doAnimation;
  31245. return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);
  31246. },
  31247. stop: function(type2, clearQueue, gotoEnd) {
  31248. var stopQueue = function(hooks3) {
  31249. var stop = hooks3.stop;
  31250. delete hooks3.stop;
  31251. stop(gotoEnd);
  31252. };
  31253. if (typeof type2 !== "string") {
  31254. gotoEnd = clearQueue;
  31255. clearQueue = type2;
  31256. type2 = void 0;
  31257. }
  31258. if (clearQueue) {
  31259. this.queue(type2 || "fx", []);
  31260. }
  31261. return this.each(function() {
  31262. var dequeue3 = true, index2 = type2 != null && type2 + "queueHooks", timers = jQuery.timers, data = dataPriv.get(this);
  31263. if (index2) {
  31264. if (data[index2] && data[index2].stop) {
  31265. stopQueue(data[index2]);
  31266. }
  31267. } else {
  31268. for (index2 in data) {
  31269. if (data[index2] && data[index2].stop && rrun.test(index2)) {
  31270. stopQueue(data[index2]);
  31271. }
  31272. }
  31273. }
  31274. for (index2 = timers.length; index2--; ) {
  31275. if (timers[index2].elem === this && (type2 == null || timers[index2].queue === type2)) {
  31276. timers[index2].anim.stop(gotoEnd);
  31277. dequeue3 = false;
  31278. timers.splice(index2, 1);
  31279. }
  31280. }
  31281. if (dequeue3 || !gotoEnd) {
  31282. jQuery.dequeue(this, type2);
  31283. }
  31284. });
  31285. },
  31286. finish: function(type2) {
  31287. if (type2 !== false) {
  31288. type2 = type2 || "fx";
  31289. }
  31290. return this.each(function() {
  31291. var index2, data = dataPriv.get(this), queue = data[type2 + "queue"], hooks3 = data[type2 + "queueHooks"], timers = jQuery.timers, length = queue ? queue.length : 0;
  31292. data.finish = true;
  31293. jQuery.queue(this, type2, []);
  31294. if (hooks3 && hooks3.stop) {
  31295. hooks3.stop.call(this, true);
  31296. }
  31297. for (index2 = timers.length; index2--; ) {
  31298. if (timers[index2].elem === this && timers[index2].queue === type2) {
  31299. timers[index2].anim.stop(true);
  31300. timers.splice(index2, 1);
  31301. }
  31302. }
  31303. for (index2 = 0; index2 < length; index2++) {
  31304. if (queue[index2] && queue[index2].finish) {
  31305. queue[index2].finish.call(this);
  31306. }
  31307. }
  31308. delete data.finish;
  31309. });
  31310. }
  31311. });
  31312. jQuery.each(["toggle", "show", "hide"], function(_i, name) {
  31313. var cssFn = jQuery.fn[name];
  31314. jQuery.fn[name] = function(speed, easing, callback2) {
  31315. return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback2);
  31316. };
  31317. });
  31318. jQuery.each({
  31319. slideDown: genFx("show"),
  31320. slideUp: genFx("hide"),
  31321. slideToggle: genFx("toggle"),
  31322. fadeIn: { opacity: "show" },
  31323. fadeOut: { opacity: "hide" },
  31324. fadeToggle: { opacity: "toggle" }
  31325. }, function(name, props) {
  31326. jQuery.fn[name] = function(speed, easing, callback2) {
  31327. return this.animate(props, speed, easing, callback2);
  31328. };
  31329. });
  31330. jQuery.timers = [];
  31331. jQuery.fx.tick = function() {
  31332. var timer, i2 = 0, timers = jQuery.timers;
  31333. fxNow = Date.now();
  31334. for (; i2 < timers.length; i2++) {
  31335. timer = timers[i2];
  31336. if (!timer() && timers[i2] === timer) {
  31337. timers.splice(i2--, 1);
  31338. }
  31339. }
  31340. if (!timers.length) {
  31341. jQuery.fx.stop();
  31342. }
  31343. fxNow = void 0;
  31344. };
  31345. jQuery.fx.timer = function(timer) {
  31346. jQuery.timers.push(timer);
  31347. jQuery.fx.start();
  31348. };
  31349. jQuery.fx.interval = 13;
  31350. jQuery.fx.start = function() {
  31351. if (inProgress) {
  31352. return;
  31353. }
  31354. inProgress = true;
  31355. schedule();
  31356. };
  31357. jQuery.fx.stop = function() {
  31358. inProgress = null;
  31359. };
  31360. jQuery.fx.speeds = {
  31361. slow: 600,
  31362. fast: 200,
  31363. _default: 400
  31364. };
  31365. jQuery.fn.delay = function(time, type2) {
  31366. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  31367. type2 = type2 || "fx";
  31368. return this.queue(type2, function(next, hooks3) {
  31369. var timeout = window2.setTimeout(next, time);
  31370. hooks3.stop = function() {
  31371. window2.clearTimeout(timeout);
  31372. };
  31373. });
  31374. };
  31375. (function() {
  31376. var input = document2.createElement("input"), select = document2.createElement("select"), opt = select.appendChild(document2.createElement("option"));
  31377. input.type = "checkbox";
  31378. support.checkOn = input.value !== "";
  31379. support.optSelected = opt.selected;
  31380. input = document2.createElement("input");
  31381. input.value = "t";
  31382. input.type = "radio";
  31383. support.radioValue = input.value === "t";
  31384. })();
  31385. var boolHook, attrHandle = jQuery.expr.attrHandle;
  31386. jQuery.fn.extend({
  31387. attr: function(name, value) {
  31388. return access(this, jQuery.attr, name, value, arguments.length > 1);
  31389. },
  31390. removeAttr: function(name) {
  31391. return this.each(function() {
  31392. jQuery.removeAttr(this, name);
  31393. });
  31394. }
  31395. });
  31396. jQuery.extend({
  31397. attr: function(elem, name, value) {
  31398. var ret, hooks3, nType = elem.nodeType;
  31399. if (nType === 3 || nType === 8 || nType === 2) {
  31400. return;
  31401. }
  31402. if (typeof elem.getAttribute === "undefined") {
  31403. return jQuery.prop(elem, name, value);
  31404. }
  31405. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  31406. hooks3 = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : void 0);
  31407. }
  31408. if (value !== void 0) {
  31409. if (value === null) {
  31410. jQuery.removeAttr(elem, name);
  31411. return;
  31412. }
  31413. if (hooks3 && "set" in hooks3 && (ret = hooks3.set(elem, value, name)) !== void 0) {
  31414. return ret;
  31415. }
  31416. elem.setAttribute(name, value + "");
  31417. return value;
  31418. }
  31419. if (hooks3 && "get" in hooks3 && (ret = hooks3.get(elem, name)) !== null) {
  31420. return ret;
  31421. }
  31422. ret = jQuery.find.attr(elem, name);
  31423. return ret == null ? void 0 : ret;
  31424. },
  31425. attrHooks: {
  31426. type: {
  31427. set: function(elem, value) {
  31428. if (!support.radioValue && value === "radio" && nodeName(elem, "input")) {
  31429. var val = elem.value;
  31430. elem.setAttribute("type", value);
  31431. if (val) {
  31432. elem.value = val;
  31433. }
  31434. return value;
  31435. }
  31436. }
  31437. }
  31438. },
  31439. removeAttr: function(elem, value) {
  31440. var name, i2 = 0, attrNames = value && value.match(rnothtmlwhite);
  31441. if (attrNames && elem.nodeType === 1) {
  31442. while (name = attrNames[i2++]) {
  31443. elem.removeAttribute(name);
  31444. }
  31445. }
  31446. }
  31447. });
  31448. boolHook = {
  31449. set: function(elem, value, name) {
  31450. if (value === false) {
  31451. jQuery.removeAttr(elem, name);
  31452. } else {
  31453. elem.setAttribute(name, name);
  31454. }
  31455. return name;
  31456. }
  31457. };
  31458. jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function(_i, name) {
  31459. var getter = attrHandle[name] || jQuery.find.attr;
  31460. attrHandle[name] = function(elem, name2, isXML) {
  31461. var ret, handle, lowercaseName = name2.toLowerCase();
  31462. if (!isXML) {
  31463. handle = attrHandle[lowercaseName];
  31464. attrHandle[lowercaseName] = ret;
  31465. ret = getter(elem, name2, isXML) != null ? lowercaseName : null;
  31466. attrHandle[lowercaseName] = handle;
  31467. }
  31468. return ret;
  31469. };
  31470. });
  31471. var rfocusable = /^(?:input|select|textarea|button)$/i, rclickable = /^(?:a|area)$/i;
  31472. jQuery.fn.extend({
  31473. prop: function(name, value) {
  31474. return access(this, jQuery.prop, name, value, arguments.length > 1);
  31475. },
  31476. removeProp: function(name) {
  31477. return this.each(function() {
  31478. delete this[jQuery.propFix[name] || name];
  31479. });
  31480. }
  31481. });
  31482. jQuery.extend({
  31483. prop: function(elem, name, value) {
  31484. var ret, hooks3, nType = elem.nodeType;
  31485. if (nType === 3 || nType === 8 || nType === 2) {
  31486. return;
  31487. }
  31488. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  31489. name = jQuery.propFix[name] || name;
  31490. hooks3 = jQuery.propHooks[name];
  31491. }
  31492. if (value !== void 0) {
  31493. if (hooks3 && "set" in hooks3 && (ret = hooks3.set(elem, value, name)) !== void 0) {
  31494. return ret;
  31495. }
  31496. return elem[name] = value;
  31497. }
  31498. if (hooks3 && "get" in hooks3 && (ret = hooks3.get(elem, name)) !== null) {
  31499. return ret;
  31500. }
  31501. return elem[name];
  31502. },
  31503. propHooks: {
  31504. tabIndex: {
  31505. get: function(elem) {
  31506. var tabindex = jQuery.find.attr(elem, "tabindex");
  31507. if (tabindex) {
  31508. return parseInt(tabindex, 10);
  31509. }
  31510. if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) {
  31511. return 0;
  31512. }
  31513. return -1;
  31514. }
  31515. }
  31516. },
  31517. propFix: {
  31518. "for": "htmlFor",
  31519. "class": "className"
  31520. }
  31521. });
  31522. if (!support.optSelected) {
  31523. jQuery.propHooks.selected = {
  31524. get: function(elem) {
  31525. var parent = elem.parentNode;
  31526. if (parent && parent.parentNode) {
  31527. parent.parentNode.selectedIndex;
  31528. }
  31529. return null;
  31530. },
  31531. set: function(elem) {
  31532. var parent = elem.parentNode;
  31533. if (parent) {
  31534. parent.selectedIndex;
  31535. if (parent.parentNode) {
  31536. parent.parentNode.selectedIndex;
  31537. }
  31538. }
  31539. }
  31540. };
  31541. }
  31542. jQuery.each([
  31543. "tabIndex",
  31544. "readOnly",
  31545. "maxLength",
  31546. "cellSpacing",
  31547. "cellPadding",
  31548. "rowSpan",
  31549. "colSpan",
  31550. "useMap",
  31551. "frameBorder",
  31552. "contentEditable"
  31553. ], function() {
  31554. jQuery.propFix[this.toLowerCase()] = this;
  31555. });
  31556. function stripAndCollapse(value) {
  31557. var tokens = value.match(rnothtmlwhite) || [];
  31558. return tokens.join(" ");
  31559. }
  31560. function getClass2(elem) {
  31561. return elem.getAttribute && elem.getAttribute("class") || "";
  31562. }
  31563. function classesToArray(value) {
  31564. if (Array.isArray(value)) {
  31565. return value;
  31566. }
  31567. if (typeof value === "string") {
  31568. return value.match(rnothtmlwhite) || [];
  31569. }
  31570. return [];
  31571. }
  31572. jQuery.fn.extend({
  31573. addClass: function(value) {
  31574. var classNames, cur, curValue, className, i2, finalValue;
  31575. if (isFunction2(value)) {
  31576. return this.each(function(j) {
  31577. jQuery(this).addClass(value.call(this, j, getClass2(this)));
  31578. });
  31579. }
  31580. classNames = classesToArray(value);
  31581. if (classNames.length) {
  31582. return this.each(function() {
  31583. curValue = getClass2(this);
  31584. cur = this.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  31585. if (cur) {
  31586. for (i2 = 0; i2 < classNames.length; i2++) {
  31587. className = classNames[i2];
  31588. if (cur.indexOf(" " + className + " ") < 0) {
  31589. cur += className + " ";
  31590. }
  31591. }
  31592. finalValue = stripAndCollapse(cur);
  31593. if (curValue !== finalValue) {
  31594. this.setAttribute("class", finalValue);
  31595. }
  31596. }
  31597. });
  31598. }
  31599. return this;
  31600. },
  31601. removeClass: function(value) {
  31602. var classNames, cur, curValue, className, i2, finalValue;
  31603. if (isFunction2(value)) {
  31604. return this.each(function(j) {
  31605. jQuery(this).removeClass(value.call(this, j, getClass2(this)));
  31606. });
  31607. }
  31608. if (!arguments.length) {
  31609. return this.attr("class", "");
  31610. }
  31611. classNames = classesToArray(value);
  31612. if (classNames.length) {
  31613. return this.each(function() {
  31614. curValue = getClass2(this);
  31615. cur = this.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  31616. if (cur) {
  31617. for (i2 = 0; i2 < classNames.length; i2++) {
  31618. className = classNames[i2];
  31619. while (cur.indexOf(" " + className + " ") > -1) {
  31620. cur = cur.replace(" " + className + " ", " ");
  31621. }
  31622. }
  31623. finalValue = stripAndCollapse(cur);
  31624. if (curValue !== finalValue) {
  31625. this.setAttribute("class", finalValue);
  31626. }
  31627. }
  31628. });
  31629. }
  31630. return this;
  31631. },
  31632. toggleClass: function(value, stateVal) {
  31633. var classNames, className, i2, self2, type2 = typeof value, isValidValue = type2 === "string" || Array.isArray(value);
  31634. if (isFunction2(value)) {
  31635. return this.each(function(i3) {
  31636. jQuery(this).toggleClass(
  31637. value.call(this, i3, getClass2(this), stateVal),
  31638. stateVal
  31639. );
  31640. });
  31641. }
  31642. if (typeof stateVal === "boolean" && isValidValue) {
  31643. return stateVal ? this.addClass(value) : this.removeClass(value);
  31644. }
  31645. classNames = classesToArray(value);
  31646. return this.each(function() {
  31647. if (isValidValue) {
  31648. self2 = jQuery(this);
  31649. for (i2 = 0; i2 < classNames.length; i2++) {
  31650. className = classNames[i2];
  31651. if (self2.hasClass(className)) {
  31652. self2.removeClass(className);
  31653. } else {
  31654. self2.addClass(className);
  31655. }
  31656. }
  31657. } else if (value === void 0 || type2 === "boolean") {
  31658. className = getClass2(this);
  31659. if (className) {
  31660. dataPriv.set(this, "__className__", className);
  31661. }
  31662. if (this.setAttribute) {
  31663. this.setAttribute(
  31664. "class",
  31665. className || value === false ? "" : dataPriv.get(this, "__className__") || ""
  31666. );
  31667. }
  31668. }
  31669. });
  31670. },
  31671. hasClass: function(selector) {
  31672. var className, elem, i2 = 0;
  31673. className = " " + selector + " ";
  31674. while (elem = this[i2++]) {
  31675. if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass2(elem)) + " ").indexOf(className) > -1) {
  31676. return true;
  31677. }
  31678. }
  31679. return false;
  31680. }
  31681. });
  31682. var rreturn = /\r/g;
  31683. jQuery.fn.extend({
  31684. val: function(value) {
  31685. var hooks3, ret, valueIsFunction, elem = this[0];
  31686. if (!arguments.length) {
  31687. if (elem) {
  31688. hooks3 = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
  31689. if (hooks3 && "get" in hooks3 && (ret = hooks3.get(elem, "value")) !== void 0) {
  31690. return ret;
  31691. }
  31692. ret = elem.value;
  31693. if (typeof ret === "string") {
  31694. return ret.replace(rreturn, "");
  31695. }
  31696. return ret == null ? "" : ret;
  31697. }
  31698. return;
  31699. }
  31700. valueIsFunction = isFunction2(value);
  31701. return this.each(function(i2) {
  31702. var val;
  31703. if (this.nodeType !== 1) {
  31704. return;
  31705. }
  31706. if (valueIsFunction) {
  31707. val = value.call(this, i2, jQuery(this).val());
  31708. } else {
  31709. val = value;
  31710. }
  31711. if (val == null) {
  31712. val = "";
  31713. } else if (typeof val === "number") {
  31714. val += "";
  31715. } else if (Array.isArray(val)) {
  31716. val = jQuery.map(val, function(value2) {
  31717. return value2 == null ? "" : value2 + "";
  31718. });
  31719. }
  31720. hooks3 = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
  31721. if (!hooks3 || !("set" in hooks3) || hooks3.set(this, val, "value") === void 0) {
  31722. this.value = val;
  31723. }
  31724. });
  31725. }
  31726. });
  31727. jQuery.extend({
  31728. valHooks: {
  31729. option: {
  31730. get: function(elem) {
  31731. var val = jQuery.find.attr(elem, "value");
  31732. return val != null ? val : stripAndCollapse(jQuery.text(elem));
  31733. }
  31734. },
  31735. select: {
  31736. get: function(elem) {
  31737. var value, option, i2, options2 = elem.options, index2 = elem.selectedIndex, one3 = elem.type === "select-one", values3 = one3 ? null : [], max2 = one3 ? index2 + 1 : options2.length;
  31738. if (index2 < 0) {
  31739. i2 = max2;
  31740. } else {
  31741. i2 = one3 ? index2 : 0;
  31742. }
  31743. for (; i2 < max2; i2++) {
  31744. option = options2[i2];
  31745. if ((option.selected || i2 === index2) && !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) {
  31746. value = jQuery(option).val();
  31747. if (one3) {
  31748. return value;
  31749. }
  31750. values3.push(value);
  31751. }
  31752. }
  31753. return values3;
  31754. },
  31755. set: function(elem, value) {
  31756. var optionSet, option, options2 = elem.options, values3 = jQuery.makeArray(value), i2 = options2.length;
  31757. while (i2--) {
  31758. option = options2[i2];
  31759. if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values3) > -1) {
  31760. optionSet = true;
  31761. }
  31762. }
  31763. if (!optionSet) {
  31764. elem.selectedIndex = -1;
  31765. }
  31766. return values3;
  31767. }
  31768. }
  31769. }
  31770. });
  31771. jQuery.each(["radio", "checkbox"], function() {
  31772. jQuery.valHooks[this] = {
  31773. set: function(elem, value) {
  31774. if (Array.isArray(value)) {
  31775. return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;
  31776. }
  31777. }
  31778. };
  31779. if (!support.checkOn) {
  31780. jQuery.valHooks[this].get = function(elem) {
  31781. return elem.getAttribute("value") === null ? "on" : elem.value;
  31782. };
  31783. }
  31784. });
  31785. var location = window2.location;
  31786. var nonce = { guid: Date.now() };
  31787. var rquery = /\?/;
  31788. jQuery.parseXML = function(data) {
  31789. var xml, parserErrorElem;
  31790. if (!data || typeof data !== "string") {
  31791. return null;
  31792. }
  31793. try {
  31794. xml = new window2.DOMParser().parseFromString(data, "text/xml");
  31795. } catch (e) {
  31796. }
  31797. parserErrorElem = xml && xml.getElementsByTagName("parsererror")[0];
  31798. if (!xml || parserErrorElem) {
  31799. jQuery.error("Invalid XML: " + (parserErrorElem ? jQuery.map(parserErrorElem.childNodes, function(el) {
  31800. return el.textContent;
  31801. }).join("\n") : data));
  31802. }
  31803. return xml;
  31804. };
  31805. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, stopPropagationCallback = function(e) {
  31806. e.stopPropagation();
  31807. };
  31808. jQuery.extend(jQuery.event, {
  31809. trigger: function(event2, data, elem, onlyHandlers) {
  31810. var i2, cur, tmp, bubbleType, ontype, handle, special, lastElement, eventPath = [elem || document2], type2 = hasOwn2.call(event2, "type") ? event2.type : event2, namespaces = hasOwn2.call(event2, "namespace") ? event2.namespace.split(".") : [];
  31811. cur = lastElement = tmp = elem = elem || document2;
  31812. if (elem.nodeType === 3 || elem.nodeType === 8) {
  31813. return;
  31814. }
  31815. if (rfocusMorph.test(type2 + jQuery.event.triggered)) {
  31816. return;
  31817. }
  31818. if (type2.indexOf(".") > -1) {
  31819. namespaces = type2.split(".");
  31820. type2 = namespaces.shift();
  31821. namespaces.sort();
  31822. }
  31823. ontype = type2.indexOf(":") < 0 && "on" + type2;
  31824. event2 = event2[jQuery.expando] ? event2 : new jQuery.Event(type2, typeof event2 === "object" && event2);
  31825. event2.isTrigger = onlyHandlers ? 2 : 3;
  31826. event2.namespace = namespaces.join(".");
  31827. event2.rnamespace = event2.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
  31828. event2.result = void 0;
  31829. if (!event2.target) {
  31830. event2.target = elem;
  31831. }
  31832. data = data == null ? [event2] : jQuery.makeArray(data, [event2]);
  31833. special = jQuery.event.special[type2] || {};
  31834. if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
  31835. return;
  31836. }
  31837. if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
  31838. bubbleType = special.delegateType || type2;
  31839. if (!rfocusMorph.test(bubbleType + type2)) {
  31840. cur = cur.parentNode;
  31841. }
  31842. for (; cur; cur = cur.parentNode) {
  31843. eventPath.push(cur);
  31844. tmp = cur;
  31845. }
  31846. if (tmp === (elem.ownerDocument || document2)) {
  31847. eventPath.push(tmp.defaultView || tmp.parentWindow || window2);
  31848. }
  31849. }
  31850. i2 = 0;
  31851. while ((cur = eventPath[i2++]) && !event2.isPropagationStopped()) {
  31852. lastElement = cur;
  31853. event2.type = i2 > 1 ? bubbleType : special.bindType || type2;
  31854. handle = (dataPriv.get(cur, "events") || /* @__PURE__ */ Object.create(null))[event2.type] && dataPriv.get(cur, "handle");
  31855. if (handle) {
  31856. handle.apply(cur, data);
  31857. }
  31858. handle = ontype && cur[ontype];
  31859. if (handle && handle.apply && acceptData(cur)) {
  31860. event2.result = handle.apply(cur, data);
  31861. if (event2.result === false) {
  31862. event2.preventDefault();
  31863. }
  31864. }
  31865. }
  31866. event2.type = type2;
  31867. if (!onlyHandlers && !event2.isDefaultPrevented()) {
  31868. if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {
  31869. if (ontype && isFunction2(elem[type2]) && !isWindow(elem)) {
  31870. tmp = elem[ontype];
  31871. if (tmp) {
  31872. elem[ontype] = null;
  31873. }
  31874. jQuery.event.triggered = type2;
  31875. if (event2.isPropagationStopped()) {
  31876. lastElement.addEventListener(type2, stopPropagationCallback);
  31877. }
  31878. elem[type2]();
  31879. if (event2.isPropagationStopped()) {
  31880. lastElement.removeEventListener(type2, stopPropagationCallback);
  31881. }
  31882. jQuery.event.triggered = void 0;
  31883. if (tmp) {
  31884. elem[ontype] = tmp;
  31885. }
  31886. }
  31887. }
  31888. }
  31889. return event2.result;
  31890. },
  31891. simulate: function(type2, elem, event2) {
  31892. var e = jQuery.extend(
  31893. new jQuery.Event(),
  31894. event2,
  31895. {
  31896. type: type2,
  31897. isSimulated: true
  31898. }
  31899. );
  31900. jQuery.event.trigger(e, null, elem);
  31901. }
  31902. });
  31903. jQuery.fn.extend({
  31904. trigger: function(type2, data) {
  31905. return this.each(function() {
  31906. jQuery.event.trigger(type2, data, this);
  31907. });
  31908. },
  31909. triggerHandler: function(type2, data) {
  31910. var elem = this[0];
  31911. if (elem) {
  31912. return jQuery.event.trigger(type2, data, elem, true);
  31913. }
  31914. }
  31915. });
  31916. var rbracket = /\[\]$/, rCRLF = /\r?\n/g, rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, rsubmittable = /^(?:input|select|textarea|keygen)/i;
  31917. function buildParams(prefix, obj, traditional, add) {
  31918. var name;
  31919. if (Array.isArray(obj)) {
  31920. jQuery.each(obj, function(i2, v) {
  31921. if (traditional || rbracket.test(prefix)) {
  31922. add(prefix, v);
  31923. } else {
  31924. buildParams(
  31925. prefix + "[" + (typeof v === "object" && v != null ? i2 : "") + "]",
  31926. v,
  31927. traditional,
  31928. add
  31929. );
  31930. }
  31931. });
  31932. } else if (!traditional && toType(obj) === "object") {
  31933. for (name in obj) {
  31934. buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
  31935. }
  31936. } else {
  31937. add(prefix, obj);
  31938. }
  31939. }
  31940. jQuery.param = function(a, traditional) {
  31941. var prefix, s = [], add = function(key, valueOrFunction) {
  31942. var value = isFunction2(valueOrFunction) ? valueOrFunction() : valueOrFunction;
  31943. s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value);
  31944. };
  31945. if (a == null) {
  31946. return "";
  31947. }
  31948. if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {
  31949. jQuery.each(a, function() {
  31950. add(this.name, this.value);
  31951. });
  31952. } else {
  31953. for (prefix in a) {
  31954. buildParams(prefix, a[prefix], traditional, add);
  31955. }
  31956. }
  31957. return s.join("&");
  31958. };
  31959. jQuery.fn.extend({
  31960. serialize: function() {
  31961. return jQuery.param(this.serializeArray());
  31962. },
  31963. serializeArray: function() {
  31964. return this.map(function() {
  31965. var elements = jQuery.prop(this, "elements");
  31966. return elements ? jQuery.makeArray(elements) : this;
  31967. }).filter(function() {
  31968. var type2 = this.type;
  31969. return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type2) && (this.checked || !rcheckableType.test(type2));
  31970. }).map(function(_i, elem) {
  31971. var val = jQuery(this).val();
  31972. if (val == null) {
  31973. return null;
  31974. }
  31975. if (Array.isArray(val)) {
  31976. return jQuery.map(val, function(val2) {
  31977. return { name: elem.name, value: val2.replace(rCRLF, "\r\n") };
  31978. });
  31979. }
  31980. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  31981. }).get();
  31982. }
  31983. });
  31984. var r20 = /%20/g, rhash = /#.*$/, rantiCache = /([?&])_=[^&]*/, rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, prefilters = {}, transports = {}, allTypes = "*/".concat("*"), originAnchor = document2.createElement("a");
  31985. originAnchor.href = location.href;
  31986. function addToPrefiltersOrTransports(structure) {
  31987. return function(dataTypeExpression, func) {
  31988. if (typeof dataTypeExpression !== "string") {
  31989. func = dataTypeExpression;
  31990. dataTypeExpression = "*";
  31991. }
  31992. var dataType, i2 = 0, dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];
  31993. if (isFunction2(func)) {
  31994. while (dataType = dataTypes[i2++]) {
  31995. if (dataType[0] === "+") {
  31996. dataType = dataType.slice(1) || "*";
  31997. (structure[dataType] = structure[dataType] || []).unshift(func);
  31998. } else {
  31999. (structure[dataType] = structure[dataType] || []).push(func);
  32000. }
  32001. }
  32002. }
  32003. };
  32004. }
  32005. function inspectPrefiltersOrTransports(structure, options2, originalOptions, jqXHR) {
  32006. var inspected = {}, seekingTransport = structure === transports;
  32007. function inspect(dataType) {
  32008. var selected;
  32009. inspected[dataType] = true;
  32010. jQuery.each(structure[dataType] || [], function(_, prefilterOrFactory) {
  32011. var dataTypeOrTransport = prefilterOrFactory(options2, originalOptions, jqXHR);
  32012. if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
  32013. options2.dataTypes.unshift(dataTypeOrTransport);
  32014. inspect(dataTypeOrTransport);
  32015. return false;
  32016. } else if (seekingTransport) {
  32017. return !(selected = dataTypeOrTransport);
  32018. }
  32019. });
  32020. return selected;
  32021. }
  32022. return inspect(options2.dataTypes[0]) || !inspected["*"] && inspect("*");
  32023. }
  32024. function ajaxExtend(target, src) {
  32025. var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {};
  32026. for (key in src) {
  32027. if (src[key] !== void 0) {
  32028. (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];
  32029. }
  32030. }
  32031. if (deep) {
  32032. jQuery.extend(true, target, deep);
  32033. }
  32034. return target;
  32035. }
  32036. function ajaxHandleResponses(s, jqXHR, responses) {
  32037. var ct2, type2, finalDataType, firstDataType, contents = s.contents, dataTypes = s.dataTypes;
  32038. while (dataTypes[0] === "*") {
  32039. dataTypes.shift();
  32040. if (ct2 === void 0) {
  32041. ct2 = s.mimeType || jqXHR.getResponseHeader("Content-Type");
  32042. }
  32043. }
  32044. if (ct2) {
  32045. for (type2 in contents) {
  32046. if (contents[type2] && contents[type2].test(ct2)) {
  32047. dataTypes.unshift(type2);
  32048. break;
  32049. }
  32050. }
  32051. }
  32052. if (dataTypes[0] in responses) {
  32053. finalDataType = dataTypes[0];
  32054. } else {
  32055. for (type2 in responses) {
  32056. if (!dataTypes[0] || s.converters[type2 + " " + dataTypes[0]]) {
  32057. finalDataType = type2;
  32058. break;
  32059. }
  32060. if (!firstDataType) {
  32061. firstDataType = type2;
  32062. }
  32063. }
  32064. finalDataType = finalDataType || firstDataType;
  32065. }
  32066. if (finalDataType) {
  32067. if (finalDataType !== dataTypes[0]) {
  32068. dataTypes.unshift(finalDataType);
  32069. }
  32070. return responses[finalDataType];
  32071. }
  32072. }
  32073. function ajaxConvert(s, response, jqXHR, isSuccess) {
  32074. var conv2, current, conv, tmp, prev, converters = {}, dataTypes = s.dataTypes.slice();
  32075. if (dataTypes[1]) {
  32076. for (conv in s.converters) {
  32077. converters[conv.toLowerCase()] = s.converters[conv];
  32078. }
  32079. }
  32080. current = dataTypes.shift();
  32081. while (current) {
  32082. if (s.responseFields[current]) {
  32083. jqXHR[s.responseFields[current]] = response;
  32084. }
  32085. if (!prev && isSuccess && s.dataFilter) {
  32086. response = s.dataFilter(response, s.dataType);
  32087. }
  32088. prev = current;
  32089. current = dataTypes.shift();
  32090. if (current) {
  32091. if (current === "*") {
  32092. current = prev;
  32093. } else if (prev !== "*" && prev !== current) {
  32094. conv = converters[prev + " " + current] || converters["* " + current];
  32095. if (!conv) {
  32096. for (conv2 in converters) {
  32097. tmp = conv2.split(" ");
  32098. if (tmp[1] === current) {
  32099. conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
  32100. if (conv) {
  32101. if (conv === true) {
  32102. conv = converters[conv2];
  32103. } else if (converters[conv2] !== true) {
  32104. current = tmp[0];
  32105. dataTypes.unshift(tmp[1]);
  32106. }
  32107. break;
  32108. }
  32109. }
  32110. }
  32111. }
  32112. if (conv !== true) {
  32113. if (conv && s.throws) {
  32114. response = conv(response);
  32115. } else {
  32116. try {
  32117. response = conv(response);
  32118. } catch (e) {
  32119. return {
  32120. state: "parsererror",
  32121. error: conv ? e : "No conversion from " + prev + " to " + current
  32122. };
  32123. }
  32124. }
  32125. }
  32126. }
  32127. }
  32128. }
  32129. return { state: "success", data: response };
  32130. }
  32131. jQuery.extend({
  32132. active: 0,
  32133. lastModified: {},
  32134. etag: {},
  32135. ajaxSettings: {
  32136. url: location.href,
  32137. type: "GET",
  32138. isLocal: rlocalProtocol.test(location.protocol),
  32139. global: true,
  32140. processData: true,
  32141. async: true,
  32142. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  32143. accepts: {
  32144. "*": allTypes,
  32145. text: "text/plain",
  32146. html: "text/html",
  32147. xml: "application/xml, text/xml",
  32148. json: "application/json, text/javascript"
  32149. },
  32150. contents: {
  32151. xml: /\bxml\b/,
  32152. html: /\bhtml/,
  32153. json: /\bjson\b/
  32154. },
  32155. responseFields: {
  32156. xml: "responseXML",
  32157. text: "responseText",
  32158. json: "responseJSON"
  32159. },
  32160. converters: {
  32161. "* text": String,
  32162. "text html": true,
  32163. "text json": JSON.parse,
  32164. "text xml": jQuery.parseXML
  32165. },
  32166. flatOptions: {
  32167. url: true,
  32168. context: true
  32169. }
  32170. },
  32171. ajaxSetup: function(target, settings) {
  32172. return settings ? ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) : ajaxExtend(jQuery.ajaxSettings, target);
  32173. },
  32174. ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
  32175. ajaxTransport: addToPrefiltersOrTransports(transports),
  32176. ajax: function(url, options2) {
  32177. if (typeof url === "object") {
  32178. options2 = url;
  32179. url = void 0;
  32180. }
  32181. options2 = options2 || {};
  32182. var transport, cacheURL, responseHeadersString, responseHeaders, timeoutTimer, urlAnchor, completed2, fireGlobals, i2, uncached, s = jQuery.ajaxSetup({}, options2), callbackContext = s.context || s, globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event, deferred = jQuery.Deferred(), completeDeferred = jQuery.Callbacks("once memory"), statusCode = s.statusCode || {}, requestHeaders = {}, requestHeadersNames = {}, strAbort = "canceled", jqXHR = {
  32183. readyState: 0,
  32184. getResponseHeader: function(key) {
  32185. var match;
  32186. if (completed2) {
  32187. if (!responseHeaders) {
  32188. responseHeaders = {};
  32189. while (match = rheaders.exec(responseHeadersString)) {
  32190. responseHeaders[match[1].toLowerCase() + " "] = (responseHeaders[match[1].toLowerCase() + " "] || []).concat(match[2]);
  32191. }
  32192. }
  32193. match = responseHeaders[key.toLowerCase() + " "];
  32194. }
  32195. return match == null ? null : match.join(", ");
  32196. },
  32197. getAllResponseHeaders: function() {
  32198. return completed2 ? responseHeadersString : null;
  32199. },
  32200. setRequestHeader: function(name, value) {
  32201. if (completed2 == null) {
  32202. name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name;
  32203. requestHeaders[name] = value;
  32204. }
  32205. return this;
  32206. },
  32207. overrideMimeType: function(type2) {
  32208. if (completed2 == null) {
  32209. s.mimeType = type2;
  32210. }
  32211. return this;
  32212. },
  32213. statusCode: function(map) {
  32214. var code;
  32215. if (map) {
  32216. if (completed2) {
  32217. jqXHR.always(map[jqXHR.status]);
  32218. } else {
  32219. for (code in map) {
  32220. statusCode[code] = [statusCode[code], map[code]];
  32221. }
  32222. }
  32223. }
  32224. return this;
  32225. },
  32226. abort: function(statusText) {
  32227. var finalText = statusText || strAbort;
  32228. if (transport) {
  32229. transport.abort(finalText);
  32230. }
  32231. done(0, finalText);
  32232. return this;
  32233. }
  32234. };
  32235. deferred.promise(jqXHR);
  32236. s.url = ((url || s.url || location.href) + "").replace(rprotocol, location.protocol + "//");
  32237. s.type = options2.method || options2.type || s.method || s.type;
  32238. s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""];
  32239. if (s.crossDomain == null) {
  32240. urlAnchor = document2.createElement("a");
  32241. try {
  32242. urlAnchor.href = s.url;
  32243. urlAnchor.href = urlAnchor.href;
  32244. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host;
  32245. } catch (e) {
  32246. s.crossDomain = true;
  32247. }
  32248. }
  32249. if (s.data && s.processData && typeof s.data !== "string") {
  32250. s.data = jQuery.param(s.data, s.traditional);
  32251. }
  32252. inspectPrefiltersOrTransports(prefilters, s, options2, jqXHR);
  32253. if (completed2) {
  32254. return jqXHR;
  32255. }
  32256. fireGlobals = jQuery.event && s.global;
  32257. if (fireGlobals && jQuery.active++ === 0) {
  32258. jQuery.event.trigger("ajaxStart");
  32259. }
  32260. s.type = s.type.toUpperCase();
  32261. s.hasContent = !rnoContent.test(s.type);
  32262. cacheURL = s.url.replace(rhash, "");
  32263. if (!s.hasContent) {
  32264. uncached = s.url.slice(cacheURL.length);
  32265. if (s.data && (s.processData || typeof s.data === "string")) {
  32266. cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;
  32267. delete s.data;
  32268. }
  32269. if (s.cache === false) {
  32270. cacheURL = cacheURL.replace(rantiCache, "$1");
  32271. uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce.guid++ + uncached;
  32272. }
  32273. s.url = cacheURL + uncached;
  32274. } else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) {
  32275. s.data = s.data.replace(r20, "+");
  32276. }
  32277. if (s.ifModified) {
  32278. if (jQuery.lastModified[cacheURL]) {
  32279. jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
  32280. }
  32281. if (jQuery.etag[cacheURL]) {
  32282. jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
  32283. }
  32284. }
  32285. if (s.data && s.hasContent && s.contentType !== false || options2.contentType) {
  32286. jqXHR.setRequestHeader("Content-Type", s.contentType);
  32287. }
  32288. jqXHR.setRequestHeader(
  32289. "Accept",
  32290. s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s.accepts["*"]
  32291. );
  32292. for (i2 in s.headers) {
  32293. jqXHR.setRequestHeader(i2, s.headers[i2]);
  32294. }
  32295. if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed2)) {
  32296. return jqXHR.abort();
  32297. }
  32298. strAbort = "abort";
  32299. completeDeferred.add(s.complete);
  32300. jqXHR.done(s.success);
  32301. jqXHR.fail(s.error);
  32302. transport = inspectPrefiltersOrTransports(transports, s, options2, jqXHR);
  32303. if (!transport) {
  32304. done(-1, "No Transport");
  32305. } else {
  32306. jqXHR.readyState = 1;
  32307. if (fireGlobals) {
  32308. globalEventContext.trigger("ajaxSend", [jqXHR, s]);
  32309. }
  32310. if (completed2) {
  32311. return jqXHR;
  32312. }
  32313. if (s.async && s.timeout > 0) {
  32314. timeoutTimer = window2.setTimeout(function() {
  32315. jqXHR.abort("timeout");
  32316. }, s.timeout);
  32317. }
  32318. try {
  32319. completed2 = false;
  32320. transport.send(requestHeaders, done);
  32321. } catch (e) {
  32322. if (completed2) {
  32323. throw e;
  32324. }
  32325. done(-1, e);
  32326. }
  32327. }
  32328. function done(status, nativeStatusText, responses, headers) {
  32329. var isSuccess, success, error, response, modified, statusText = nativeStatusText;
  32330. if (completed2) {
  32331. return;
  32332. }
  32333. completed2 = true;
  32334. if (timeoutTimer) {
  32335. window2.clearTimeout(timeoutTimer);
  32336. }
  32337. transport = void 0;
  32338. responseHeadersString = headers || "";
  32339. jqXHR.readyState = status > 0 ? 4 : 0;
  32340. isSuccess = status >= 200 && status < 300 || status === 304;
  32341. if (responses) {
  32342. response = ajaxHandleResponses(s, jqXHR, responses);
  32343. }
  32344. if (!isSuccess && jQuery.inArray("script", s.dataTypes) > -1 && jQuery.inArray("json", s.dataTypes) < 0) {
  32345. s.converters["text script"] = function() {
  32346. };
  32347. }
  32348. response = ajaxConvert(s, response, jqXHR, isSuccess);
  32349. if (isSuccess) {
  32350. if (s.ifModified) {
  32351. modified = jqXHR.getResponseHeader("Last-Modified");
  32352. if (modified) {
  32353. jQuery.lastModified[cacheURL] = modified;
  32354. }
  32355. modified = jqXHR.getResponseHeader("etag");
  32356. if (modified) {
  32357. jQuery.etag[cacheURL] = modified;
  32358. }
  32359. }
  32360. if (status === 204 || s.type === "HEAD") {
  32361. statusText = "nocontent";
  32362. } else if (status === 304) {
  32363. statusText = "notmodified";
  32364. } else {
  32365. statusText = response.state;
  32366. success = response.data;
  32367. error = response.error;
  32368. isSuccess = !error;
  32369. }
  32370. } else {
  32371. error = statusText;
  32372. if (status || !statusText) {
  32373. statusText = "error";
  32374. if (status < 0) {
  32375. status = 0;
  32376. }
  32377. }
  32378. }
  32379. jqXHR.status = status;
  32380. jqXHR.statusText = (nativeStatusText || statusText) + "";
  32381. if (isSuccess) {
  32382. deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
  32383. } else {
  32384. deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
  32385. }
  32386. jqXHR.statusCode(statusCode);
  32387. statusCode = void 0;
  32388. if (fireGlobals) {
  32389. globalEventContext.trigger(
  32390. isSuccess ? "ajaxSuccess" : "ajaxError",
  32391. [jqXHR, s, isSuccess ? success : error]
  32392. );
  32393. }
  32394. completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
  32395. if (fireGlobals) {
  32396. globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
  32397. if (!--jQuery.active) {
  32398. jQuery.event.trigger("ajaxStop");
  32399. }
  32400. }
  32401. }
  32402. return jqXHR;
  32403. },
  32404. getJSON: function(url, data, callback2) {
  32405. return jQuery.get(url, data, callback2, "json");
  32406. },
  32407. getScript: function(url, callback2) {
  32408. return jQuery.get(url, void 0, callback2, "script");
  32409. }
  32410. });
  32411. jQuery.each(["get", "post"], function(_i, method) {
  32412. jQuery[method] = function(url, data, callback2, type2) {
  32413. if (isFunction2(data)) {
  32414. type2 = type2 || callback2;
  32415. callback2 = data;
  32416. data = void 0;
  32417. }
  32418. return jQuery.ajax(jQuery.extend({
  32419. url,
  32420. type: method,
  32421. dataType: type2,
  32422. data,
  32423. success: callback2
  32424. }, jQuery.isPlainObject(url) && url));
  32425. };
  32426. });
  32427. jQuery.ajaxPrefilter(function(s) {
  32428. var i2;
  32429. for (i2 in s.headers) {
  32430. if (i2.toLowerCase() === "content-type") {
  32431. s.contentType = s.headers[i2] || "";
  32432. }
  32433. }
  32434. });
  32435. jQuery._evalUrl = function(url, options2, doc) {
  32436. return jQuery.ajax({
  32437. url,
  32438. type: "GET",
  32439. dataType: "script",
  32440. cache: true,
  32441. async: false,
  32442. global: false,
  32443. converters: {
  32444. "text script": function() {
  32445. }
  32446. },
  32447. dataFilter: function(response) {
  32448. jQuery.globalEval(response, options2, doc);
  32449. }
  32450. });
  32451. };
  32452. jQuery.fn.extend({
  32453. wrapAll: function(html) {
  32454. var wrap;
  32455. if (this[0]) {
  32456. if (isFunction2(html)) {
  32457. html = html.call(this[0]);
  32458. }
  32459. wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
  32460. if (this[0].parentNode) {
  32461. wrap.insertBefore(this[0]);
  32462. }
  32463. wrap.map(function() {
  32464. var elem = this;
  32465. while (elem.firstElementChild) {
  32466. elem = elem.firstElementChild;
  32467. }
  32468. return elem;
  32469. }).append(this);
  32470. }
  32471. return this;
  32472. },
  32473. wrapInner: function(html) {
  32474. if (isFunction2(html)) {
  32475. return this.each(function(i2) {
  32476. jQuery(this).wrapInner(html.call(this, i2));
  32477. });
  32478. }
  32479. return this.each(function() {
  32480. var self2 = jQuery(this), contents = self2.contents();
  32481. if (contents.length) {
  32482. contents.wrapAll(html);
  32483. } else {
  32484. self2.append(html);
  32485. }
  32486. });
  32487. },
  32488. wrap: function(html) {
  32489. var htmlIsFunction = isFunction2(html);
  32490. return this.each(function(i2) {
  32491. jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i2) : html);
  32492. });
  32493. },
  32494. unwrap: function(selector) {
  32495. this.parent(selector).not("body").each(function() {
  32496. jQuery(this).replaceWith(this.childNodes);
  32497. });
  32498. return this;
  32499. }
  32500. });
  32501. jQuery.expr.pseudos.hidden = function(elem) {
  32502. return !jQuery.expr.pseudos.visible(elem);
  32503. };
  32504. jQuery.expr.pseudos.visible = function(elem) {
  32505. return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
  32506. };
  32507. jQuery.ajaxSettings.xhr = function() {
  32508. try {
  32509. return new window2.XMLHttpRequest();
  32510. } catch (e) {
  32511. }
  32512. };
  32513. var xhrSuccessStatus = {
  32514. 0: 200,
  32515. 1223: 204
  32516. }, xhrSupported = jQuery.ajaxSettings.xhr();
  32517. support.cors = !!xhrSupported && "withCredentials" in xhrSupported;
  32518. support.ajax = xhrSupported = !!xhrSupported;
  32519. jQuery.ajaxTransport(function(options2) {
  32520. var callback2, errorCallback;
  32521. if (support.cors || xhrSupported && !options2.crossDomain) {
  32522. return {
  32523. send: function(headers, complete) {
  32524. var i2, xhr = options2.xhr();
  32525. xhr.open(
  32526. options2.type,
  32527. options2.url,
  32528. options2.async,
  32529. options2.username,
  32530. options2.password
  32531. );
  32532. if (options2.xhrFields) {
  32533. for (i2 in options2.xhrFields) {
  32534. xhr[i2] = options2.xhrFields[i2];
  32535. }
  32536. }
  32537. if (options2.mimeType && xhr.overrideMimeType) {
  32538. xhr.overrideMimeType(options2.mimeType);
  32539. }
  32540. if (!options2.crossDomain && !headers["X-Requested-With"]) {
  32541. headers["X-Requested-With"] = "XMLHttpRequest";
  32542. }
  32543. for (i2 in headers) {
  32544. xhr.setRequestHeader(i2, headers[i2]);
  32545. }
  32546. callback2 = function(type2) {
  32547. return function() {
  32548. if (callback2) {
  32549. callback2 = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;
  32550. if (type2 === "abort") {
  32551. xhr.abort();
  32552. } else if (type2 === "error") {
  32553. if (typeof xhr.status !== "number") {
  32554. complete(0, "error");
  32555. } else {
  32556. complete(
  32557. xhr.status,
  32558. xhr.statusText
  32559. );
  32560. }
  32561. } else {
  32562. complete(
  32563. xhrSuccessStatus[xhr.status] || xhr.status,
  32564. xhr.statusText,
  32565. (xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText },
  32566. xhr.getAllResponseHeaders()
  32567. );
  32568. }
  32569. }
  32570. };
  32571. };
  32572. xhr.onload = callback2();
  32573. errorCallback = xhr.onerror = xhr.ontimeout = callback2("error");
  32574. if (xhr.onabort !== void 0) {
  32575. xhr.onabort = errorCallback;
  32576. } else {
  32577. xhr.onreadystatechange = function() {
  32578. if (xhr.readyState === 4) {
  32579. window2.setTimeout(function() {
  32580. if (callback2) {
  32581. errorCallback();
  32582. }
  32583. });
  32584. }
  32585. };
  32586. }
  32587. callback2 = callback2("abort");
  32588. try {
  32589. xhr.send(options2.hasContent && options2.data || null);
  32590. } catch (e) {
  32591. if (callback2) {
  32592. throw e;
  32593. }
  32594. }
  32595. },
  32596. abort: function() {
  32597. if (callback2) {
  32598. callback2();
  32599. }
  32600. }
  32601. };
  32602. }
  32603. });
  32604. jQuery.ajaxPrefilter(function(s) {
  32605. if (s.crossDomain) {
  32606. s.contents.script = false;
  32607. }
  32608. });
  32609. jQuery.ajaxSetup({
  32610. accepts: {
  32611. script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
  32612. },
  32613. contents: {
  32614. script: /\b(?:java|ecma)script\b/
  32615. },
  32616. converters: {
  32617. "text script": function(text) {
  32618. jQuery.globalEval(text);
  32619. return text;
  32620. }
  32621. }
  32622. });
  32623. jQuery.ajaxPrefilter("script", function(s) {
  32624. if (s.cache === void 0) {
  32625. s.cache = false;
  32626. }
  32627. if (s.crossDomain) {
  32628. s.type = "GET";
  32629. }
  32630. });
  32631. jQuery.ajaxTransport("script", function(s) {
  32632. if (s.crossDomain || s.scriptAttrs) {
  32633. var script, callback2;
  32634. return {
  32635. send: function(_, complete) {
  32636. script = jQuery("<script>").attr(s.scriptAttrs || {}).prop({ charset: s.scriptCharset, src: s.url }).on("load error", callback2 = function(evt) {
  32637. script.remove();
  32638. callback2 = null;
  32639. if (evt) {
  32640. complete(evt.type === "error" ? 404 : 200, evt.type);
  32641. }
  32642. });
  32643. document2.head.appendChild(script[0]);
  32644. },
  32645. abort: function() {
  32646. if (callback2) {
  32647. callback2();
  32648. }
  32649. }
  32650. };
  32651. }
  32652. });
  32653. var oldCallbacks = [], rjsonp = /(=)\?(?=&|$)|\?\?/;
  32654. jQuery.ajaxSetup({
  32655. jsonp: "callback",
  32656. jsonpCallback: function() {
  32657. var callback2 = oldCallbacks.pop() || jQuery.expando + "_" + nonce.guid++;
  32658. this[callback2] = true;
  32659. return callback2;
  32660. }
  32661. });
  32662. jQuery.ajaxPrefilter("json jsonp", function(s, originalSettings, jqXHR) {
  32663. var callbackName, overwritten, responseContainer, jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ? "url" : typeof s.data === "string" && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0 && rjsonp.test(s.data) && "data");
  32664. if (jsonProp || s.dataTypes[0] === "jsonp") {
  32665. callbackName = s.jsonpCallback = isFunction2(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
  32666. if (jsonProp) {
  32667. s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
  32668. } else if (s.jsonp !== false) {
  32669. s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
  32670. }
  32671. s.converters["script json"] = function() {
  32672. if (!responseContainer) {
  32673. jQuery.error(callbackName + " was not called");
  32674. }
  32675. return responseContainer[0];
  32676. };
  32677. s.dataTypes[0] = "json";
  32678. overwritten = window2[callbackName];
  32679. window2[callbackName] = function() {
  32680. responseContainer = arguments;
  32681. };
  32682. jqXHR.always(function() {
  32683. if (overwritten === void 0) {
  32684. jQuery(window2).removeProp(callbackName);
  32685. } else {
  32686. window2[callbackName] = overwritten;
  32687. }
  32688. if (s[callbackName]) {
  32689. s.jsonpCallback = originalSettings.jsonpCallback;
  32690. oldCallbacks.push(callbackName);
  32691. }
  32692. if (responseContainer && isFunction2(overwritten)) {
  32693. overwritten(responseContainer[0]);
  32694. }
  32695. responseContainer = overwritten = void 0;
  32696. });
  32697. return "script";
  32698. }
  32699. });
  32700. support.createHTMLDocument = function() {
  32701. var body = document2.implementation.createHTMLDocument("").body;
  32702. body.innerHTML = "<form></form><form></form>";
  32703. return body.childNodes.length === 2;
  32704. }();
  32705. jQuery.parseHTML = function(data, context, keepScripts) {
  32706. if (typeof data !== "string") {
  32707. return [];
  32708. }
  32709. if (typeof context === "boolean") {
  32710. keepScripts = context;
  32711. context = false;
  32712. }
  32713. var base2, parsed, scripts;
  32714. if (!context) {
  32715. if (support.createHTMLDocument) {
  32716. context = document2.implementation.createHTMLDocument("");
  32717. base2 = context.createElement("base");
  32718. base2.href = document2.location.href;
  32719. context.head.appendChild(base2);
  32720. } else {
  32721. context = document2;
  32722. }
  32723. }
  32724. parsed = rsingleTag.exec(data);
  32725. scripts = !keepScripts && [];
  32726. if (parsed) {
  32727. return [context.createElement(parsed[1])];
  32728. }
  32729. parsed = buildFragment([data], context, scripts);
  32730. if (scripts && scripts.length) {
  32731. jQuery(scripts).remove();
  32732. }
  32733. return jQuery.merge([], parsed.childNodes);
  32734. };
  32735. jQuery.fn.load = function(url, params, callback2) {
  32736. var selector, type2, response, self2 = this, off2 = url.indexOf(" ");
  32737. if (off2 > -1) {
  32738. selector = stripAndCollapse(url.slice(off2));
  32739. url = url.slice(0, off2);
  32740. }
  32741. if (isFunction2(params)) {
  32742. callback2 = params;
  32743. params = void 0;
  32744. } else if (params && typeof params === "object") {
  32745. type2 = "POST";
  32746. }
  32747. if (self2.length > 0) {
  32748. jQuery.ajax({
  32749. url,
  32750. type: type2 || "GET",
  32751. dataType: "html",
  32752. data: params
  32753. }).done(function(responseText) {
  32754. response = arguments;
  32755. self2.html(selector ? jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) : responseText);
  32756. }).always(callback2 && function(jqXHR, status) {
  32757. self2.each(function() {
  32758. callback2.apply(this, response || [jqXHR.responseText, status, jqXHR]);
  32759. });
  32760. });
  32761. }
  32762. return this;
  32763. };
  32764. jQuery.expr.pseudos.animated = function(elem) {
  32765. return jQuery.grep(jQuery.timers, function(fn2) {
  32766. return elem === fn2.elem;
  32767. }).length;
  32768. };
  32769. jQuery.offset = {
  32770. setOffset: function(elem, options2, i2) {
  32771. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position2 = jQuery.css(elem, "position"), curElem = jQuery(elem), props = {};
  32772. if (position2 === "static") {
  32773. elem.style.position = "relative";
  32774. }
  32775. curOffset = curElem.offset();
  32776. curCSSTop = jQuery.css(elem, "top");
  32777. curCSSLeft = jQuery.css(elem, "left");
  32778. calculatePosition = (position2 === "absolute" || position2 === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1;
  32779. if (calculatePosition) {
  32780. curPosition = curElem.position();
  32781. curTop = curPosition.top;
  32782. curLeft = curPosition.left;
  32783. } else {
  32784. curTop = parseFloat(curCSSTop) || 0;
  32785. curLeft = parseFloat(curCSSLeft) || 0;
  32786. }
  32787. if (isFunction2(options2)) {
  32788. options2 = options2.call(elem, i2, jQuery.extend({}, curOffset));
  32789. }
  32790. if (options2.top != null) {
  32791. props.top = options2.top - curOffset.top + curTop;
  32792. }
  32793. if (options2.left != null) {
  32794. props.left = options2.left - curOffset.left + curLeft;
  32795. }
  32796. if ("using" in options2) {
  32797. options2.using.call(elem, props);
  32798. } else {
  32799. curElem.css(props);
  32800. }
  32801. }
  32802. };
  32803. jQuery.fn.extend({
  32804. offset: function(options2) {
  32805. if (arguments.length) {
  32806. return options2 === void 0 ? this : this.each(function(i2) {
  32807. jQuery.offset.setOffset(this, options2, i2);
  32808. });
  32809. }
  32810. var rect, win2, elem = this[0];
  32811. if (!elem) {
  32812. return;
  32813. }
  32814. if (!elem.getClientRects().length) {
  32815. return { top: 0, left: 0 };
  32816. }
  32817. rect = elem.getBoundingClientRect();
  32818. win2 = elem.ownerDocument.defaultView;
  32819. return {
  32820. top: rect.top + win2.pageYOffset,
  32821. left: rect.left + win2.pageXOffset
  32822. };
  32823. },
  32824. position: function() {
  32825. if (!this[0]) {
  32826. return;
  32827. }
  32828. var offsetParent, offset, doc, elem = this[0], parentOffset = { top: 0, left: 0 };
  32829. if (jQuery.css(elem, "position") === "fixed") {
  32830. offset = elem.getBoundingClientRect();
  32831. } else {
  32832. offset = this.offset();
  32833. doc = elem.ownerDocument;
  32834. offsetParent = elem.offsetParent || doc.documentElement;
  32835. while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && jQuery.css(offsetParent, "position") === "static") {
  32836. offsetParent = offsetParent.parentNode;
  32837. }
  32838. if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
  32839. parentOffset = jQuery(offsetParent).offset();
  32840. parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
  32841. parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true);
  32842. }
  32843. }
  32844. return {
  32845. top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
  32846. left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
  32847. };
  32848. },
  32849. offsetParent: function() {
  32850. return this.map(function() {
  32851. var offsetParent = this.offsetParent;
  32852. while (offsetParent && jQuery.css(offsetParent, "position") === "static") {
  32853. offsetParent = offsetParent.offsetParent;
  32854. }
  32855. return offsetParent || documentElement;
  32856. });
  32857. }
  32858. });
  32859. jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(method, prop) {
  32860. var top = "pageYOffset" === prop;
  32861. jQuery.fn[method] = function(val) {
  32862. return access(this, function(elem, method2, val2) {
  32863. var win2;
  32864. if (isWindow(elem)) {
  32865. win2 = elem;
  32866. } else if (elem.nodeType === 9) {
  32867. win2 = elem.defaultView;
  32868. }
  32869. if (val2 === void 0) {
  32870. return win2 ? win2[prop] : elem[method2];
  32871. }
  32872. if (win2) {
  32873. win2.scrollTo(
  32874. !top ? val2 : win2.pageXOffset,
  32875. top ? val2 : win2.pageYOffset
  32876. );
  32877. } else {
  32878. elem[method2] = val2;
  32879. }
  32880. }, method, val, arguments.length);
  32881. };
  32882. });
  32883. jQuery.each(["top", "left"], function(_i, prop) {
  32884. jQuery.cssHooks[prop] = addGetHookIf(
  32885. support.pixelPosition,
  32886. function(elem, computed2) {
  32887. if (computed2) {
  32888. computed2 = curCSS(elem, prop);
  32889. return rnumnonpx.test(computed2) ? jQuery(elem).position()[prop] + "px" : computed2;
  32890. }
  32891. }
  32892. );
  32893. });
  32894. jQuery.each({ Height: "height", Width: "width" }, function(name, type2) {
  32895. jQuery.each({
  32896. padding: "inner" + name,
  32897. content: type2,
  32898. "": "outer" + name
  32899. }, function(defaultExtra, funcName) {
  32900. jQuery.fn[funcName] = function(margin, value) {
  32901. var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"), extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
  32902. return access(this, function(elem, type3, value2) {
  32903. var doc;
  32904. if (isWindow(elem)) {
  32905. return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name];
  32906. }
  32907. if (elem.nodeType === 9) {
  32908. doc = elem.documentElement;
  32909. return Math.max(
  32910. elem.body["scroll" + name],
  32911. doc["scroll" + name],
  32912. elem.body["offset" + name],
  32913. doc["offset" + name],
  32914. doc["client" + name]
  32915. );
  32916. }
  32917. return value2 === void 0 ? jQuery.css(elem, type3, extra) : jQuery.style(elem, type3, value2, extra);
  32918. }, type2, chainable ? margin : void 0, chainable);
  32919. };
  32920. });
  32921. });
  32922. jQuery.each([
  32923. "ajaxStart",
  32924. "ajaxStop",
  32925. "ajaxComplete",
  32926. "ajaxError",
  32927. "ajaxSuccess",
  32928. "ajaxSend"
  32929. ], function(_i, type2) {
  32930. jQuery.fn[type2] = function(fn2) {
  32931. return this.on(type2, fn2);
  32932. };
  32933. });
  32934. jQuery.fn.extend({
  32935. bind: function(types, data, fn2) {
  32936. return this.on(types, null, data, fn2);
  32937. },
  32938. unbind: function(types, fn2) {
  32939. return this.off(types, null, fn2);
  32940. },
  32941. delegate: function(selector, types, data, fn2) {
  32942. return this.on(types, selector, data, fn2);
  32943. },
  32944. undelegate: function(selector, types, fn2) {
  32945. return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn2);
  32946. },
  32947. hover: function(fnOver, fnOut) {
  32948. return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
  32949. }
  32950. });
  32951. jQuery.each(
  32952. "blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),
  32953. function(_i, name) {
  32954. jQuery.fn[name] = function(data, fn2) {
  32955. return arguments.length > 0 ? this.on(name, null, data, fn2) : this.trigger(name);
  32956. };
  32957. }
  32958. );
  32959. var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;
  32960. jQuery.proxy = function(fn2, context) {
  32961. var tmp, args, proxy;
  32962. if (typeof context === "string") {
  32963. tmp = fn2[context];
  32964. context = fn2;
  32965. fn2 = tmp;
  32966. }
  32967. if (!isFunction2(fn2)) {
  32968. return void 0;
  32969. }
  32970. args = slice.call(arguments, 2);
  32971. proxy = function() {
  32972. return fn2.apply(context || this, args.concat(slice.call(arguments)));
  32973. };
  32974. proxy.guid = fn2.guid = fn2.guid || jQuery.guid++;
  32975. return proxy;
  32976. };
  32977. jQuery.holdReady = function(hold) {
  32978. if (hold) {
  32979. jQuery.readyWait++;
  32980. } else {
  32981. jQuery.ready(true);
  32982. }
  32983. };
  32984. jQuery.isArray = Array.isArray;
  32985. jQuery.parseJSON = JSON.parse;
  32986. jQuery.nodeName = nodeName;
  32987. jQuery.isFunction = isFunction2;
  32988. jQuery.isWindow = isWindow;
  32989. jQuery.camelCase = camelCase3;
  32990. jQuery.type = toType;
  32991. jQuery.now = Date.now;
  32992. jQuery.isNumeric = function(obj) {
  32993. var type2 = jQuery.type(obj);
  32994. return (type2 === "number" || type2 === "string") && !isNaN(obj - parseFloat(obj));
  32995. };
  32996. jQuery.trim = function(text) {
  32997. return text == null ? "" : (text + "").replace(rtrim, "$1");
  32998. };
  32999. var _jQuery = window2.jQuery, _$ = window2.$;
  33000. jQuery.noConflict = function(deep) {
  33001. if (window2.$ === jQuery) {
  33002. window2.$ = _$;
  33003. }
  33004. if (deep && window2.jQuery === jQuery) {
  33005. window2.jQuery = _jQuery;
  33006. }
  33007. return jQuery;
  33008. };
  33009. if (typeof noGlobal === "undefined") {
  33010. window2.jQuery = window2.$ = jQuery;
  33011. }
  33012. return jQuery;
  33013. });
  33014. })(jquery);
  33015. var _style_0$2 = `@charset "UTF-8";:root{--el-color-white:#ffffff;--el-color-black:#000000;--el-color-primary-rgb:64,158,255;--el-color-success-rgb:103,194,58;--el-color-warning-rgb:230,162,60;--el-color-danger-rgb:245,108,108;--el-color-error-rgb:245,108,108;--el-color-info-rgb:144,147,153;--el-font-size-extra-large:20px;--el-font-size-large:18px;--el-font-size-medium:16px;--el-font-size-base:14px;--el-font-size-small:13px;--el-font-size-extra-small:12px;--el-font-family:"Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","\\5fae\\8f6f\\96c5\\9ed1",Arial,sans-serif;--el-font-weight-primary:500;--el-font-line-height-primary:24px;--el-index-normal:1;--el-index-top:1000;--el-index-popper:2000;--el-border-radius-base:4px;--el-border-radius-small:2px;--el-border-radius-round:20px;--el-border-radius-circle:100%;--el-transition-duration:.3s;--el-transition-duration-fast:.2s;--el-transition-function-ease-in-out-bezier:cubic-bezier(.645, .045, .355, 1);--el-transition-function-fast-bezier:cubic-bezier(.23, 1, .32, 1);--el-transition-all:all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);--el-transition-fade:opacity var(--el-transition-duration) var(--el-transition-function-fast-bezier);--el-transition-md-fade:transform var(--el-transition-duration) var(--el-transition-function-fast-bezier),opacity var(--el-transition-duration) var(--el-transition-function-fast-bezier);--el-transition-fade-linear:opacity var(--el-transition-duration-fast) linear;--el-transition-border:border-color var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-transition-box-shadow:box-shadow var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-transition-color:color var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-component-size-large:40px;--el-component-size:32px;--el-component-size-small:24px}:root{color-scheme:light;--el-color-white:#ffffff;--el-color-black:#000000;--el-color-primary:#409eff;--el-color-primary-light-3:#79bbff;--el-color-primary-light-5:#a0cfff;--el-color-primary-light-7:#c6e2ff;--el-color-primary-light-8:#d9ecff;--el-color-primary-light-9:#ecf5ff;--el-color-primary-dark-2:#337ecc;--el-color-success:#67c23a;--el-color-success-light-3:#95d475;--el-color-success-light-5:#b3e19d;--el-color-success-light-7:#d1edc4;--el-color-success-light-8:#e1f3d8;--el-color-success-light-9:#f0f9eb;--el-color-success-dark-2:#529b2e;--el-color-warning:#e6a23c;--el-color-warning-light-3:#eebe77;--el-color-warning-light-5:#f3d19e;--el-color-warning-light-7:#f8e3c5;--el-color-warning-light-8:#faecd8;--el-color-warning-light-9:#fdf6ec;--el-color-warning-dark-2:#b88230;--el-color-danger:#f56c6c;--el-color-danger-light-3:#f89898;--el-color-danger-light-5:#fab6b6;--el-color-danger-light-7:#fcd3d3;--el-color-danger-light-8:#fde2e2;--el-color-danger-light-9:#fef0f0;--el-color-danger-dark-2:#c45656;--el-color-error:#f56c6c;--el-color-error-light-3:#f89898;--el-color-error-light-5:#fab6b6;--el-color-error-light-7:#fcd3d3;--el-color-error-light-8:#fde2e2;--el-color-error-light-9:#fef0f0;--el-color-error-dark-2:#c45656;--el-color-info:#909399;--el-color-info-light-3:#b1b3b8;--el-color-info-light-5:#c8c9cc;--el-color-info-light-7:#dedfe0;--el-color-info-light-8:#e9e9eb;--el-color-info-light-9:#f4f4f5;--el-color-info-dark-2:#73767a;--el-bg-color:#ffffff;--el-bg-color-page:#f2f3f5;--el-bg-color-overlay:#ffffff;--el-text-color-primary:#303133;--el-text-color-regular:#606266;--el-text-color-secondary:#909399;--el-text-color-placeholder:#a8abb2;--el-text-color-disabled:#c0c4cc;--el-border-color:#dcdfe6;--el-border-color-light:#e4e7ed;--el-border-color-lighter:#ebeef5;--el-border-color-extra-light:#f2f6fc;--el-border-color-dark:#d4d7de;--el-border-color-darker:#cdd0d6;--el-fill-color:#f0f2f5;--el-fill-color-light:#f5f7fa;--el-fill-color-lighter:#fafafa;--el-fill-color-extra-light:#fafcff;--el-fill-color-dark:#ebedf0;--el-fill-color-darker:#e6e8eb;--el-fill-color-blank:#ffffff;--el-box-shadow:0px 12px 32px 4px rgba(0, 0, 0, .04),0px 8px 20px rgba(0, 0, 0, .08);--el-box-shadow-light:0px 0px 12px rgba(0, 0, 0, .12);--el-box-shadow-lighter:0px 0px 6px rgba(0, 0, 0, .12);--el-box-shadow-dark:0px 16px 48px 16px rgba(0, 0, 0, .08),0px 12px 32px rgba(0, 0, 0, .12),0px 8px 16px -8px rgba(0, 0, 0, .16);--el-disabled-bg-color:var(--el-fill-color-light);--el-disabled-text-color:var(--el-text-color-placeholder);--el-disabled-border-color:var(--el-border-color-light);--el-overlay-color:rgba(0, 0, 0, .8);--el-overlay-color-light:rgba(0, 0, 0, .7);--el-overlay-color-lighter:rgba(0, 0, 0, .5);--el-mask-color:rgba(255, 255, 255, .9);--el-mask-color-extra-light:rgba(255, 255, 255, .3);--el-border-width:1px;--el-border-style:solid;--el-border-color-hover:var(--el-text-color-disabled);--el-border:var(--el-border-width) var(--el-border-style) var(--el-border-color);--el-svg-monochrome-grey:var(--el-border-color)}.fade-in-linear-enter-active,.fade-in-linear-leave-active{transition:var(--el-transition-fade-linear)}.fade-in-linear-enter-from,.fade-in-linear-leave-to{opacity:0}.el-fade-in-linear-enter-active,.el-fade-in-linear-leave-active{transition:var(--el-transition-fade-linear)}.el-fade-in-linear-enter-from,.el-fade-in-linear-leave-to{opacity:0}.el-fade-in-enter-active,.el-fade-in-leave-active{transition:all var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-fade-in-enter-from,.el-fade-in-leave-active{opacity:0}.el-zoom-in-center-enter-active,.el-zoom-in-center-leave-active{transition:all var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-zoom-in-center-enter-from,.el-zoom-in-center-leave-active{opacity:0;transform:scaleX(0)}.el-zoom-in-top-enter-active,.el-zoom-in-top-leave-active{opacity:1;transform:scaleY(1);transition:var(--el-transition-md-fade);transform-origin:center top}.el-zoom-in-top-enter-active[data-popper-placement^=top],.el-zoom-in-top-leave-active[data-popper-placement^=top]{transform-origin:center bottom}.el-zoom-in-top-enter-from,.el-zoom-in-top-leave-active{opacity:0;transform:scaleY(0)}.el-zoom-in-bottom-enter-active,.el-zoom-in-bottom-leave-active{opacity:1;transform:scaleY(1);transition:var(--el-transition-md-fade);transform-origin:center bottom}.el-zoom-in-bottom-enter-from,.el-zoom-in-bottom-leave-active{opacity:0;transform:scaleY(0)}.el-zoom-in-left-enter-active,.el-zoom-in-left-leave-active{opacity:1;transform:scale(1);transition:var(--el-transition-md-fade);transform-origin:top left}.el-zoom-in-left-enter-from,.el-zoom-in-left-leave-active{opacity:0;transform:scale(.45)}.collapse-transition{transition:var(--el-transition-duration) height ease-in-out,var(--el-transition-duration) padding-top ease-in-out,var(--el-transition-duration) padding-bottom ease-in-out}.el-collapse-transition-enter-active,.el-collapse-transition-leave-active{transition:var(--el-transition-duration) max-height ease-in-out,var(--el-transition-duration) padding-top ease-in-out,var(--el-transition-duration) padding-bottom ease-in-out}.horizontal-collapse-transition{transition:var(--el-transition-duration) width ease-in-out,var(--el-transition-duration) padding-left ease-in-out,var(--el-transition-duration) padding-right ease-in-out}.el-list-enter-active,.el-list-leave-active{transition:all 1s}.el-list-enter-from,.el-list-leave-to{opacity:0;transform:translateY(-30px)}.el-list-leave-active{position:absolute!important}.el-opacity-transition{transition:opacity var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-icon-loading{-webkit-animation:rotating 2s linear infinite;animation:rotating 2s linear infinite}.el-icon--right{margin-left:5px}.el-icon--left{margin-right:5px}@-webkit-keyframes rotating{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes rotating{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.el-icon{--color:inherit;height:1em;width:1em;line-height:1em;display:inline-flex;justify-content:center;align-items:center;position:relative;fill:currentColor;color:var(--color);font-size:inherit}.el-icon.is-loading{-webkit-animation:rotating 2s linear infinite;animation:rotating 2s linear infinite}.el-icon svg{height:1em;width:1em}.el-affix--fixed{position:fixed}.el-alert{--el-alert-padding:8px 16px;--el-alert-border-radius-base:var(--el-border-radius-base);--el-alert-title-font-size:13px;--el-alert-description-font-size:12px;--el-alert-close-font-size:12px;--el-alert-close-customed-font-size:13px;--el-alert-icon-size:16px;--el-alert-icon-large-size:28px;width:100%;padding:var(--el-alert-padding);margin:0;box-sizing:border-box;border-radius:var(--el-alert-border-radius-base);position:relative;background-color:var(--el-color-white);overflow:hidden;opacity:1;display:flex;align-items:center;transition:opacity var(--el-transition-duration-fast)}.el-alert.is-light .el-alert__close-btn{color:var(--el-text-color-placeholder)}.el-alert.is-dark .el-alert__close-btn,.el-alert.is-dark .el-alert__description{color:var(--el-color-white)}.el-alert.is-center{justify-content:center}.el-alert--success{--el-alert-bg-color:var(--el-color-success-light-9)}.el-alert--success.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-success)}.el-alert--success.is-light .el-alert__description{color:var(--el-color-success)}.el-alert--success.is-dark{background-color:var(--el-color-success);color:var(--el-color-white)}.el-alert--info{--el-alert-bg-color:var(--el-color-info-light-9)}.el-alert--info.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-info)}.el-alert--info.is-light .el-alert__description{color:var(--el-color-info)}.el-alert--info.is-dark{background-color:var(--el-color-info);color:var(--el-color-white)}.el-alert--warning{--el-alert-bg-color:var(--el-color-warning-light-9)}.el-alert--warning.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-warning)}.el-alert--warning.is-light .el-alert__description{color:var(--el-color-warning)}.el-alert--warning.is-dark{background-color:var(--el-color-warning);color:var(--el-color-white)}.el-alert--error{--el-alert-bg-color:var(--el-color-error-light-9)}.el-alert--error.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-error)}.el-alert--error.is-light .el-alert__description{color:var(--el-color-error)}.el-alert--error.is-dark{background-color:var(--el-color-error);color:var(--el-color-white)}.el-alert__content{display:table-cell;padding:0 8px}.el-alert .el-alert__icon{font-size:var(--el-alert-icon-size);width:var(--el-alert-icon-size)}.el-alert .el-alert__icon.is-big{font-size:var(--el-alert-icon-large-size);width:var(--el-alert-icon-large-size)}.el-alert__title{font-size:var(--el-alert-title-font-size);line-height:18px;vertical-align:text-top}.el-alert__title.is-bold{font-weight:700}.el-alert .el-alert__description{font-size:var(--el-alert-description-font-size);margin:5px 0 0}.el-alert .el-alert__close-btn{font-size:var(--el-alert-close-font-size);opacity:1;position:absolute;top:12px;right:15px;cursor:pointer}.el-alert .el-alert__close-btn.is-customed{font-style:normal;font-size:var(--el-alert-close-customed-font-size);top:9px}.el-alert-fade-enter-from,.el-alert-fade-leave-active{opacity:0}.el-aside{overflow:auto;box-sizing:border-box;flex-shrink:0;width:var(--el-aside-width,300px)}.el-autocomplete{position:relative;display:inline-block}.el-autocomplete__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-box-shadow-light)}.el-autocomplete__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-autocomplete__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-autocomplete__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-autocomplete__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-autocomplete__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-autocomplete-suggestion{border-radius:var(--el-border-radius-base);box-sizing:border-box}.el-autocomplete-suggestion__wrap{max-height:280px;padding:10px 0;box-sizing:border-box}.el-autocomplete-suggestion__list{margin:0;padding:0}.el-autocomplete-suggestion li{padding:0 20px;margin:0;line-height:34px;cursor:pointer;color:var(--el-text-color-regular);font-size:var(--el-font-size-base);list-style:none;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.el-autocomplete-suggestion li:hover,.el-autocomplete-suggestion li.highlighted{background-color:var(--el-fill-color-light)}.el-autocomplete-suggestion li.divider{margin-top:6px;border-top:1px solid var(--el-color-black)}.el-autocomplete-suggestion li.divider:last-child{margin-bottom:-6px}.el-autocomplete-suggestion.is-loading li{text-align:center;height:100px;line-height:100px;font-size:20px;color:var(--el-text-color-secondary)}.el-autocomplete-suggestion.is-loading li:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-autocomplete-suggestion.is-loading li:hover{background-color:var(--el-bg-color-overlay)}.el-autocomplete-suggestion.is-loading .el-icon-loading{vertical-align:middle}.el-avatar{--el-avatar-text-color:var(--el-color-white);--el-avatar-bg-color:var(--el-text-color-disabled);--el-avatar-text-size:14px;--el-avatar-icon-size:18px;--el-avatar-border-radius:var(--el-border-radius-base);--el-avatar-size-large:56px;--el-avatar-size-small:24px;--el-avatar-size:40px;display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;text-align:center;overflow:hidden;color:var(--el-avatar-text-color);background:var(--el-avatar-bg-color);width:var(--el-avatar-size);height:var(--el-avatar-size);font-size:var(--el-avatar-text-size)}.el-avatar>img{display:block;height:100%}.el-avatar--circle{border-radius:50%}.el-avatar--square{border-radius:var(--el-avatar-border-radius)}.el-avatar--icon{font-size:var(--el-avatar-icon-size)}.el-avatar--small{--el-avatar-size:24px}.el-avatar--large{--el-avatar-size:56px}.el-backtop{--el-backtop-bg-color:var(--el-bg-color-overlay);--el-backtop-text-color:var(--el-color-primary);--el-backtop-hover-bg-color:var(--el-border-color-extra-light);position:fixed;background-color:var(--el-backtop-bg-color);width:40px;height:40px;border-radius:50%;color:var(--el-backtop-text-color);display:flex;align-items:center;justify-content:center;font-size:20px;box-shadow:var(--el-box-shadow-lighter);cursor:pointer;z-index:5}.el-backtop:hover{background-color:var(--el-backtop-hover-bg-color)}.el-backtop__icon{font-size:20px}.el-badge{--el-badge-bg-color:var(--el-color-danger);--el-badge-radius:10px;--el-badge-font-size:12px;--el-badge-padding:6px;--el-badge-size:18px;position:relative;vertical-align:middle;display:inline-block;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.el-badge__content{background-color:var(--el-badge-bg-color);border-radius:var(--el-badge-radius);color:var(--el-color-white);display:inline-flex;justify-content:center;align-items:center;font-size:var(--el-badge-font-size);height:var(--el-badge-size);padding:0 var(--el-badge-padding);white-space:nowrap;border:1px solid var(--el-bg-color)}.el-badge__content.is-fixed{position:absolute;top:0;right:calc(1px + var(--el-badge-size)/ 2);transform:translateY(-50%) translate(100%);z-index:var(--el-index-normal)}.el-badge__content.is-fixed.is-dot{right:5px}.el-badge__content.is-dot{height:8px;width:8px;padding:0;right:0;border-radius:50%}.el-badge__content--primary{background-color:var(--el-color-primary)}.el-badge__content--success{background-color:var(--el-color-success)}.el-badge__content--warning{background-color:var(--el-color-warning)}.el-badge__content--info{background-color:var(--el-color-info)}.el-badge__content--danger{background-color:var(--el-color-danger)}.el-breadcrumb{font-size:14px;line-height:1}.el-breadcrumb:after,.el-breadcrumb:before{display:table;content:""}.el-breadcrumb:after{clear:both}.el-breadcrumb__separator{margin:0 9px;font-weight:700;color:var(--el-text-color-placeholder)}.el-breadcrumb__separator.el-icon{margin:0 6px;font-weight:400}.el-breadcrumb__separator.el-icon svg{vertical-align:middle}.el-breadcrumb__item{float:left;display:inline-flex;align-items:center}.el-breadcrumb__inner{color:var(--el-text-color-regular)}.el-breadcrumb__inner a,.el-breadcrumb__inner.is-link{font-weight:700;text-decoration:none;transition:var(--el-transition-color);color:var(--el-text-color-primary)}.el-breadcrumb__inner a:hover,.el-breadcrumb__inner.is-link:hover{color:var(--el-color-primary);cursor:pointer}.el-breadcrumb__item:last-child .el-breadcrumb__inner,.el-breadcrumb__item:last-child .el-breadcrumb__inner a,.el-breadcrumb__item:last-child .el-breadcrumb__inner a:hover,.el-breadcrumb__item:last-child .el-breadcrumb__inner:hover{font-weight:400;color:var(--el-text-color-regular);cursor:text}.el-breadcrumb__item:last-child .el-breadcrumb__separator{display:none}.el-button-group{display:inline-block;vertical-align:middle}.el-button-group:after,.el-button-group:before{display:table;content:""}.el-button-group:after{clear:both}.el-button-group>.el-button{float:left;position:relative}.el-button-group>.el-button+.el-button{margin-left:0}.el-button-group>.el-button:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.el-button-group>.el-button:last-child{border-top-left-radius:0;border-bottom-left-radius:0}.el-button-group>.el-button:first-child:last-child{border-top-right-radius:var(--el-border-radius-base);border-bottom-right-radius:var(--el-border-radius-base);border-top-left-radius:var(--el-border-radius-base);border-bottom-left-radius:var(--el-border-radius-base)}.el-button-group>.el-button:first-child:last-child.is-round{border-radius:var(--el-border-radius-round)}.el-button-group>.el-button:first-child:last-child.is-circle{border-radius:50%}.el-button-group>.el-button:not(:first-child):not(:last-child){border-radius:0}.el-button-group>.el-button:not(:last-child){margin-right:-1px}.el-button-group>.el-button:active,.el-button-group>.el-button:focus,.el-button-group>.el-button:hover{z-index:1}.el-button-group>.el-button.is-active{z-index:1}.el-button-group>.el-dropdown>.el-button{border-top-left-radius:0;border-bottom-left-radius:0;border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--primary:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--primary:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--primary:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--success:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--success:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--success:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--warning:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--warning:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--warning:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--danger:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--danger:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--danger:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--info:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--info:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--info:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button{--el-button-font-weight:var(--el-font-weight-primary);--el-button-border-color:var(--el-border-color);--el-button-bg-color:var(--el-fill-color-blank);--el-button-text-color:var(--el-text-color-regular);--el-button-disabled-text-color:var(--el-disabled-text-color);--el-button-disabled-bg-color:var(--el-fill-color-blank);--el-button-disabled-border-color:var(--el-border-color-light);--el-button-divide-border-color:rgba(255, 255, 255, .5);--el-button-hover-text-color:var(--el-color-primary);--el-button-hover-bg-color:var(--el-color-primary-light-9);--el-button-hover-border-color:var(--el-color-primary-light-7);--el-button-active-text-color:var(--el-button-hover-text-color);--el-button-active-border-color:var(--el-color-primary);--el-button-active-bg-color:var(--el-button-hover-bg-color);--el-button-outline-color:var(--el-color-primary-light-5);--el-button-hover-link-text-color:var(--el-color-info);--el-button-active-color:var(--el-text-color-primary)}.el-button{display:inline-flex;justify-content:center;align-items:center;line-height:1;height:32px;white-space:nowrap;cursor:pointer;color:var(--el-button-text-color);text-align:center;box-sizing:border-box;outline:0;transition:.1s;font-weight:var(--el-button-font-weight);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;-webkit-appearance:none;background-color:var(--el-button-bg-color);border:var(--el-border);border-color:var(--el-button-border-color);padding:8px 15px;font-size:var(--el-font-size-base);border-radius:var(--el-border-radius-base)}.el-button:focus,.el-button:hover{color:var(--el-button-hover-text-color);border-color:var(--el-button-hover-border-color);background-color:var(--el-button-hover-bg-color);outline:0}.el-button:active{color:var(--el-button-active-text-color);border-color:var(--el-button-active-border-color);background-color:var(--el-button-active-bg-color);outline:0}.el-button:focus-visible{outline:2px solid var(--el-button-outline-color);outline-offset:1px}.el-button>span{display:inline-flex;align-items:center}.el-button+.el-button{margin-left:12px}.el-button.is-round{padding:8px 15px}.el-button::-moz-focus-inner{border:0}.el-button [class*=el-icon]+span{margin-left:6px}.el-button [class*=el-icon] svg{vertical-align:bottom}.el-button.is-plain{--el-button-hover-text-color:var(--el-color-primary);--el-button-hover-bg-color:var(--el-fill-color-blank);--el-button-hover-border-color:var(--el-color-primary)}.el-button.is-active{color:var(--el-button-active-text-color);border-color:var(--el-button-active-border-color);background-color:var(--el-button-active-bg-color);outline:0}.el-button.is-disabled,.el-button.is-disabled:focus,.el-button.is-disabled:hover{color:var(--el-button-disabled-text-color);cursor:not-allowed;background-image:none;background-color:var(--el-button-disabled-bg-color);border-color:var(--el-button-disabled-border-color)}.el-button.is-loading{position:relative;pointer-events:none}.el-button.is-loading:before{z-index:1;pointer-events:none;content:"";position:absolute;left:-1px;top:-1px;right:-1px;bottom:-1px;border-radius:inherit;background-color:var(--el-mask-color-extra-light)}.el-button.is-round{border-radius:var(--el-border-radius-round)}.el-button.is-circle{border-radius:50%;padding:8px}.el-button.is-text{color:var(--el-button-text-color);border:0 solid transparent;background-color:transparent}.el-button.is-text.is-disabled{color:var(--el-button-disabled-text-color);background-color:transparent!important}.el-button.is-text:not(.is-disabled):focus,.el-button.is-text:not(.is-disabled):hover{background-color:var(--el-fill-color-light)}.el-button.is-text:not(.is-disabled):focus-visible{outline:2px solid var(--el-button-outline-color);outline-offset:1px}.el-button.is-text:not(.is-disabled):active{background-color:var(--el-fill-color)}.el-button.is-text:not(.is-disabled).is-has-bg{background-color:var(--el-fill-color-light)}.el-button.is-text:not(.is-disabled).is-has-bg:focus,.el-button.is-text:not(.is-disabled).is-has-bg:hover{background-color:var(--el-fill-color)}.el-button.is-text:not(.is-disabled).is-has-bg:active{background-color:var(--el-fill-color-dark)}.el-button__text--expand{letter-spacing:.3em;margin-right:-.3em}.el-button.is-link{border-color:transparent;color:var(--el-button-text-color);background:0 0;padding:2px;height:auto}.el-button.is-link:focus,.el-button.is-link:hover{color:var(--el-button-hover-link-text-color)}.el-button.is-link.is-disabled{color:var(--el-button-disabled-text-color);background-color:transparent!important;border-color:transparent!important}.el-button.is-link:not(.is-disabled):focus,.el-button.is-link:not(.is-disabled):hover{border-color:transparent;background-color:transparent}.el-button.is-link:not(.is-disabled):active{color:var(--el-button-active-color);border-color:transparent;background-color:transparent}.el-button--text{border-color:transparent;background:0 0;color:var(--el-color-primary);padding-left:0;padding-right:0}.el-button--text.is-disabled{color:var(--el-button-disabled-text-color);background-color:transparent!important;border-color:transparent!important}.el-button--text:not(.is-disabled):focus,.el-button--text:not(.is-disabled):hover{color:var(--el-color-primary-light-3);border-color:transparent;background-color:transparent}.el-button--text:not(.is-disabled):active{color:var(--el-color-primary-dark-2);border-color:transparent;background-color:transparent}.el-button__link--expand{letter-spacing:.3em;margin-right:-.3em}.el-button--primary{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-primary);--el-button-border-color:var(--el-color-primary);--el-button-outline-color:var(--el-color-primary-light-5);--el-button-active-color:var(--el-color-primary-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-primary-light-5);--el-button-hover-bg-color:var(--el-color-primary-light-3);--el-button-hover-border-color:var(--el-color-primary-light-3);--el-button-active-bg-color:var(--el-color-primary-dark-2);--el-button-active-border-color:var(--el-color-primary-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-primary-light-5);--el-button-disabled-border-color:var(--el-color-primary-light-5)}.el-button--primary.is-link,.el-button--primary.is-plain,.el-button--primary.is-text{--el-button-text-color:var(--el-color-primary);--el-button-bg-color:var(--el-color-primary-light-9);--el-button-border-color:var(--el-color-primary-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-primary);--el-button-hover-border-color:var(--el-color-primary);--el-button-active-text-color:var(--el-color-white)}.el-button--primary.is-link.is-disabled,.el-button--primary.is-link.is-disabled:active,.el-button--primary.is-link.is-disabled:focus,.el-button--primary.is-link.is-disabled:hover,.el-button--primary.is-plain.is-disabled,.el-button--primary.is-plain.is-disabled:active,.el-button--primary.is-plain.is-disabled:focus,.el-button--primary.is-plain.is-disabled:hover,.el-button--primary.is-text.is-disabled,.el-button--primary.is-text.is-disabled:active,.el-button--primary.is-text.is-disabled:focus,.el-button--primary.is-text.is-disabled:hover{color:var(--el-color-primary-light-5);background-color:var(--el-color-primary-light-9);border-color:var(--el-color-primary-light-8)}.el-button--success{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-success);--el-button-border-color:var(--el-color-success);--el-button-outline-color:var(--el-color-success-light-5);--el-button-active-color:var(--el-color-success-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-success-light-5);--el-button-hover-bg-color:var(--el-color-success-light-3);--el-button-hover-border-color:var(--el-color-success-light-3);--el-button-active-bg-color:var(--el-color-success-dark-2);--el-button-active-border-color:var(--el-color-success-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-success-light-5);--el-button-disabled-border-color:var(--el-color-success-light-5)}.el-button--success.is-link,.el-button--success.is-plain,.el-button--success.is-text{--el-button-text-color:var(--el-color-success);--el-button-bg-color:var(--el-color-success-light-9);--el-button-border-color:var(--el-color-success-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-success);--el-button-hover-border-color:var(--el-color-success);--el-button-active-text-color:var(--el-color-white)}.el-button--success.is-link.is-disabled,.el-button--success.is-link.is-disabled:active,.el-button--success.is-link.is-disabled:focus,.el-button--success.is-link.is-disabled:hover,.el-button--success.is-plain.is-disabled,.el-button--success.is-plain.is-disabled:active,.el-button--success.is-plain.is-disabled:focus,.el-button--success.is-plain.is-disabled:hover,.el-button--success.is-text.is-disabled,.el-button--success.is-text.is-disabled:active,.el-button--success.is-text.is-disabled:focus,.el-button--success.is-text.is-disabled:hover{color:var(--el-color-success-light-5);background-color:var(--el-color-success-light-9);border-color:var(--el-color-success-light-8)}.el-button--warning{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-warning);--el-button-border-color:var(--el-color-warning);--el-button-outline-color:var(--el-color-warning-light-5);--el-button-active-color:var(--el-color-warning-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-warning-light-5);--el-button-hover-bg-color:var(--el-color-warning-light-3);--el-button-hover-border-color:var(--el-color-warning-light-3);--el-button-active-bg-color:var(--el-color-warning-dark-2);--el-button-active-border-color:var(--el-color-warning-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-warning-light-5);--el-button-disabled-border-color:var(--el-color-warning-light-5)}.el-button--warning.is-link,.el-button--warning.is-plain,.el-button--warning.is-text{--el-button-text-color:var(--el-color-warning);--el-button-bg-color:var(--el-color-warning-light-9);--el-button-border-color:var(--el-color-warning-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-warning);--el-button-hover-border-color:var(--el-color-warning);--el-button-active-text-color:var(--el-color-white)}.el-button--warning.is-link.is-disabled,.el-button--warning.is-link.is-disabled:active,.el-button--warning.is-link.is-disabled:focus,.el-button--warning.is-link.is-disabled:hover,.el-button--warning.is-plain.is-disabled,.el-button--warning.is-plain.is-disabled:active,.el-button--warning.is-plain.is-disabled:focus,.el-button--warning.is-plain.is-disabled:hover,.el-button--warning.is-text.is-disabled,.el-button--warning.is-text.is-disabled:active,.el-button--warning.is-text.is-disabled:focus,.el-button--warning.is-text.is-disabled:hover{color:var(--el-color-warning-light-5);background-color:var(--el-color-warning-light-9);border-color:var(--el-color-warning-light-8)}.el-button--danger{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-danger);--el-button-border-color:var(--el-color-danger);--el-button-outline-color:var(--el-color-danger-light-5);--el-button-active-color:var(--el-color-danger-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-danger-light-5);--el-button-hover-bg-color:var(--el-color-danger-light-3);--el-button-hover-border-color:var(--el-color-danger-light-3);--el-button-active-bg-color:var(--el-color-danger-dark-2);--el-button-active-border-color:var(--el-color-danger-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-danger-light-5);--el-button-disabled-border-color:var(--el-color-danger-light-5)}.el-button--danger.is-link,.el-button--danger.is-plain,.el-button--danger.is-text{--el-button-text-color:var(--el-color-danger);--el-button-bg-color:var(--el-color-danger-light-9);--el-button-border-color:var(--el-color-danger-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-danger);--el-button-hover-border-color:var(--el-color-danger);--el-button-active-text-color:var(--el-color-white)}.el-button--danger.is-link.is-disabled,.el-button--danger.is-link.is-disabled:active,.el-button--danger.is-link.is-disabled:focus,.el-button--danger.is-link.is-disabled:hover,.el-button--danger.is-plain.is-disabled,.el-button--danger.is-plain.is-disabled:active,.el-button--danger.is-plain.is-disabled:focus,.el-button--danger.is-plain.is-disabled:hover,.el-button--danger.is-text.is-disabled,.el-button--danger.is-text.is-disabled:active,.el-button--danger.is-text.is-disabled:focus,.el-button--danger.is-text.is-disabled:hover{color:var(--el-color-danger-light-5);background-color:var(--el-color-danger-light-9);border-color:var(--el-color-danger-light-8)}.el-button--info{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-info);--el-button-border-color:var(--el-color-info);--el-button-outline-color:var(--el-color-info-light-5);--el-button-active-color:var(--el-color-info-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-info-light-5);--el-button-hover-bg-color:var(--el-color-info-light-3);--el-button-hover-border-color:var(--el-color-info-light-3);--el-button-active-bg-color:var(--el-color-info-dark-2);--el-button-active-border-color:var(--el-color-info-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-info-light-5);--el-button-disabled-border-color:var(--el-color-info-light-5)}.el-button--info.is-link,.el-button--info.is-plain,.el-button--info.is-text{--el-button-text-color:var(--el-color-info);--el-button-bg-color:var(--el-color-info-light-9);--el-button-border-color:var(--el-color-info-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-info);--el-button-hover-border-color:var(--el-color-info);--el-button-active-text-color:var(--el-color-white)}.el-button--info.is-link.is-disabled,.el-button--info.is-link.is-disabled:active,.el-button--info.is-link.is-disabled:focus,.el-button--info.is-link.is-disabled:hover,.el-button--info.is-plain.is-disabled,.el-button--info.is-plain.is-disabled:active,.el-button--info.is-plain.is-disabled:focus,.el-button--info.is-plain.is-disabled:hover,.el-button--info.is-text.is-disabled,.el-button--info.is-text.is-disabled:active,.el-button--info.is-text.is-disabled:focus,.el-button--info.is-text.is-disabled:hover{color:var(--el-color-info-light-5);background-color:var(--el-color-info-light-9);border-color:var(--el-color-info-light-8)}.el-button--large{--el-button-size:40px;height:var(--el-button-size);padding:12px 19px;font-size:var(--el-font-size-base);border-radius:var(--el-border-radius-base)}.el-button--large [class*=el-icon]+span{margin-left:8px}.el-button--large.is-round{padding:12px 19px}.el-button--large.is-circle{width:var(--el-button-size);padding:12px}.el-button--small{--el-button-size:24px;height:var(--el-button-size);padding:5px 11px;font-size:12px;border-radius:calc(var(--el-border-radius-base) - 1px)}.el-button--small [class*=el-icon]+span{margin-left:4px}.el-button--small.is-round{padding:5px 11px}.el-button--small.is-circle{width:var(--el-button-size);padding:5px}.el-calendar{--el-calendar-border:var(--el-table-border, 1px solid var(--el-border-color-lighter));--el-calendar-header-border-bottom:var(--el-calendar-border);--el-calendar-selected-bg-color:var(--el-color-primary-light-9);--el-calendar-cell-width:85px;background-color:var(--el-fill-color-blank)}.el-calendar__header{display:flex;justify-content:space-between;padding:12px 20px;border-bottom:var(--el-calendar-header-border-bottom)}.el-calendar__title{color:var(--el-text-color);align-self:center}.el-calendar__body{padding:12px 20px 35px}.el-calendar-table{table-layout:fixed;width:100%}.el-calendar-table thead th{padding:12px 0;color:var(--el-text-color-regular);font-weight:400}.el-calendar-table:not(.is-range) td.next,.el-calendar-table:not(.is-range) td.prev{color:var(--el-text-color-placeholder)}.el-calendar-table td{border-bottom:var(--el-calendar-border);border-right:var(--el-calendar-border);vertical-align:top;transition:background-color var(--el-transition-duration-fast) ease}.el-calendar-table td.is-selected{background-color:var(--el-calendar-selected-bg-color)}.el-calendar-table td.is-today{color:var(--el-color-primary)}.el-calendar-table tr:first-child td{border-top:var(--el-calendar-border)}.el-calendar-table tr td:first-child{border-left:var(--el-calendar-border)}.el-calendar-table tr.el-calendar-table__row--hide-border td{border-top:none}.el-calendar-table .el-calendar-day{box-sizing:border-box;padding:8px;height:var(--el-calendar-cell-width)}.el-calendar-table .el-calendar-day:hover{cursor:pointer;background-color:var(--el-calendar-selected-bg-color)}.el-card{--el-card-border-color:var(--el-border-color-light);--el-card-border-radius:4px;--el-card-padding:20px;--el-card-bg-color:var(--el-fill-color-blank)}.el-card{border-radius:var(--el-card-border-radius);border:1px solid var(--el-card-border-color);background-color:var(--el-card-bg-color);overflow:hidden;color:var(--el-text-color-primary);transition:var(--el-transition-duration)}.el-card.is-always-shadow{box-shadow:var(--el-box-shadow-light)}.el-card.is-hover-shadow:focus,.el-card.is-hover-shadow:hover{box-shadow:var(--el-box-shadow-light)}.el-card__header{padding:calc(var(--el-card-padding) - 2px) var(--el-card-padding);border-bottom:1px solid var(--el-card-border-color);box-sizing:border-box}.el-card__body{padding:var(--el-card-padding)}.el-carousel__item{position:absolute;top:0;left:0;width:100%;height:100%;display:inline-block;overflow:hidden;z-index:calc(var(--el-index-normal) - 1)}.el-carousel__item.is-active{z-index:calc(var(--el-index-normal) - 1)}.el-carousel__item.is-animating{transition:transform .4s ease-in-out}.el-carousel__item--card{width:50%;transition:transform .4s ease-in-out}.el-carousel__item--card.is-in-stage{cursor:pointer;z-index:var(--el-index-normal)}.el-carousel__item--card.is-in-stage.is-hover .el-carousel__mask,.el-carousel__item--card.is-in-stage:hover .el-carousel__mask{opacity:.12}.el-carousel__item--card.is-active{z-index:calc(var(--el-index-normal) + 1)}.el-carousel__mask{position:absolute;width:100%;height:100%;top:0;left:0;background-color:var(--el-color-white);opacity:.24;transition:var(--el-transition-duration-fast)}.el-carousel{--el-carousel-arrow-font-size:12px;--el-carousel-arrow-size:36px;--el-carousel-arrow-background:rgba(31, 45, 61, .11);--el-carousel-arrow-hover-background:rgba(31, 45, 61, .23);--el-carousel-indicator-width:30px;--el-carousel-indicator-height:2px;--el-carousel-indicator-padding-horizontal:4px;--el-carousel-indicator-padding-vertical:12px;--el-carousel-indicator-out-color:var(--el-border-color-hover);position:relative}.el-carousel--horizontal{overflow-x:hidden}.el-carousel--vertical{overflow-y:hidden}.el-carousel__container{position:relative;height:300px}.el-carousel__arrow{border:none;outline:0;padding:0;margin:0;height:var(--el-carousel-arrow-size);width:var(--el-carousel-arrow-size);cursor:pointer;transition:var(--el-transition-duration);border-radius:50%;background-color:var(--el-carousel-arrow-background);color:#fff;position:absolute;top:50%;z-index:10;transform:translateY(-50%);text-align:center;font-size:var(--el-carousel-arrow-font-size);display:inline-flex;justify-content:center;align-items:center}.el-carousel__arrow--left{left:16px}.el-carousel__arrow--right{right:16px}.el-carousel__arrow:hover{background-color:var(--el-carousel-arrow-hover-background)}.el-carousel__arrow i{cursor:pointer}.el-carousel__indicators{position:absolute;list-style:none;margin:0;padding:0;z-index:calc(var(--el-index-normal) + 1)}.el-carousel__indicators--horizontal{bottom:0;left:50%;transform:translate(-50%)}.el-carousel__indicators--vertical{right:0;top:50%;transform:translateY(-50%)}.el-carousel__indicators--outside{bottom:calc(var(--el-carousel-indicator-height) + var(--el-carousel-indicator-padding-vertical) * 2);text-align:center;position:static;transform:none}.el-carousel__indicators--outside .el-carousel__indicator:hover button{opacity:.64}.el-carousel__indicators--outside button{background-color:var(--el-carousel-indicator-out-color);opacity:.24}.el-carousel__indicators--labels{left:0;right:0;transform:none;text-align:center}.el-carousel__indicators--labels .el-carousel__button{height:auto;width:auto;padding:2px 18px;font-size:12px;color:#000}.el-carousel__indicators--labels .el-carousel__indicator{padding:6px 4px}.el-carousel__indicator{background-color:transparent;cursor:pointer}.el-carousel__indicator:hover button{opacity:.72}.el-carousel__indicator--horizontal{display:inline-block;padding:var(--el-carousel-indicator-padding-vertical) var(--el-carousel-indicator-padding-horizontal)}.el-carousel__indicator--vertical{padding:var(--el-carousel-indicator-padding-horizontal) var(--el-carousel-indicator-padding-vertical)}.el-carousel__indicator--vertical .el-carousel__button{width:var(--el-carousel-indicator-height);height:calc(var(--el-carousel-indicator-width)/ 2)}.el-carousel__indicator.is-active button{opacity:1}.el-carousel__button{display:block;opacity:.48;width:var(--el-carousel-indicator-width);height:var(--el-carousel-indicator-height);background-color:#fff;border:none;outline:0;padding:0;margin:0;cursor:pointer;transition:var(--el-transition-duration)}.carousel-arrow-left-enter-from,.carousel-arrow-left-leave-active{transform:translateY(-50%) translate(-10px);opacity:0}.carousel-arrow-right-enter-from,.carousel-arrow-right-leave-active{transform:translateY(-50%) translate(10px);opacity:0}.el-cascader-panel{--el-cascader-menu-text-color:var(--el-text-color-regular);--el-cascader-menu-selected-text-color:var(--el-color-primary);--el-cascader-menu-fill:var(--el-bg-color-overlay);--el-cascader-menu-font-size:var(--el-font-size-base);--el-cascader-menu-radius:var(--el-border-radius-base);--el-cascader-menu-border:solid 1px var(--el-border-color-light);--el-cascader-menu-shadow:var(--el-box-shadow-light);--el-cascader-node-background-hover:var(--el-fill-color-light);--el-cascader-node-color-disabled:var(--el-text-color-placeholder);--el-cascader-color-empty:var(--el-text-color-placeholder);--el-cascader-tag-background:var(--el-fill-color)}.el-cascader-panel{display:flex;border-radius:var(--el-cascader-menu-radius);font-size:var(--el-cascader-menu-font-size)}.el-cascader-panel.is-bordered{border:var(--el-cascader-menu-border);border-radius:var(--el-cascader-menu-radius)}.el-cascader-menu{min-width:180px;box-sizing:border-box;color:var(--el-cascader-menu-text-color);border-right:var(--el-cascader-menu-border)}.el-cascader-menu:last-child{border-right:none}.el-cascader-menu:last-child .el-cascader-node{padding-right:20px}.el-cascader-menu__wrap.el-scrollbar__wrap{height:204px}.el-cascader-menu__list{position:relative;min-height:100%;margin:0;padding:6px 0;list-style:none;box-sizing:border-box}.el-cascader-menu__hover-zone{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none}.el-cascader-menu__empty-text{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);display:flex;align-items:center;color:var(--el-cascader-color-empty)}.el-cascader-menu__empty-text .is-loading{margin-right:2px}.el-cascader-node{position:relative;display:flex;align-items:center;padding:0 30px 0 20px;height:34px;line-height:34px;outline:0}.el-cascader-node.is-selectable.in-active-path{color:var(--el-cascader-menu-text-color)}.el-cascader-node.in-active-path,.el-cascader-node.is-active,.el-cascader-node.is-selectable.in-checked-path{color:var(--el-cascader-menu-selected-text-color);font-weight:700}.el-cascader-node:not(.is-disabled){cursor:pointer}.el-cascader-node:not(.is-disabled):focus,.el-cascader-node:not(.is-disabled):hover{background:var(--el-cascader-node-background-hover)}.el-cascader-node.is-disabled{color:var(--el-cascader-node-color-disabled);cursor:not-allowed}.el-cascader-node__prefix{position:absolute;left:10px}.el-cascader-node__postfix{position:absolute;right:10px}.el-cascader-node__label{flex:1;text-align:left;padding:0 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.el-cascader-node>.el-checkbox{margin-right:0}.el-cascader-node>.el-radio{margin-right:0}.el-cascader-node>.el-radio .el-radio__label{padding-left:0}.el-cascader{--el-cascader-menu-text-color:var(--el-text-color-regular);--el-cascader-menu-selected-text-color:var(--el-color-primary);--el-cascader-menu-fill:var(--el-bg-color-overlay);--el-cascader-menu-font-size:var(--el-font-size-base);--el-cascader-menu-radius:var(--el-border-radius-base);--el-cascader-menu-border:solid 1px var(--el-border-color-light);--el-cascader-menu-shadow:var(--el-box-shadow-light);--el-cascader-node-background-hover:var(--el-fill-color-light);--el-cascader-node-color-disabled:var(--el-text-color-placeholder);--el-cascader-color-empty:var(--el-text-color-placeholder);--el-cascader-tag-background:var(--el-fill-color);display:inline-block;vertical-align:middle;position:relative;font-size:var(--el-font-size-base);line-height:32px;outline:0}.el-cascader:not(.is-disabled):hover .el-input__wrapper{cursor:pointer;box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-cascader .el-input{display:flex;cursor:pointer}.el-cascader .el-input .el-input__inner{text-overflow:ellipsis;cursor:pointer}.el-cascader .el-input .el-input__suffix-inner .el-icon{height:calc(100% - 2px)}.el-cascader .el-input .el-input__suffix-inner .el-icon svg{vertical-align:middle}.el-cascader .el-input .icon-arrow-down{transition:transform var(--el-transition-duration);font-size:14px}.el-cascader .el-input .icon-arrow-down.is-reverse{transform:rotate(180deg)}.el-cascader .el-input .icon-circle-close:hover{color:var(--el-input-clear-hover-color,var(--el-text-color-secondary))}.el-cascader .el-input.is-focus .el-input__wrapper{box-shadow:0 0 0 1px var(--el-input-focus-border-color,var(--el-color-primary)) inset}.el-cascader--large{font-size:14px;line-height:40px}.el-cascader--small{font-size:12px;line-height:24px}.el-cascader.is-disabled .el-cascader__label{z-index:calc(var(--el-index-normal) + 1);color:var(--el-disabled-text-color)}.el-cascader__dropdown{--el-cascader-menu-text-color:var(--el-text-color-regular);--el-cascader-menu-selected-text-color:var(--el-color-primary);--el-cascader-menu-fill:var(--el-bg-color-overlay);--el-cascader-menu-font-size:var(--el-font-size-base);--el-cascader-menu-radius:var(--el-border-radius-base);--el-cascader-menu-border:solid 1px var(--el-border-color-light);--el-cascader-menu-shadow:var(--el-box-shadow-light);--el-cascader-node-background-hover:var(--el-fill-color-light);--el-cascader-node-color-disabled:var(--el-text-color-placeholder);--el-cascader-color-empty:var(--el-text-color-placeholder);--el-cascader-tag-background:var(--el-fill-color)}.el-cascader__dropdown{font-size:var(--el-cascader-menu-font-size);border-radius:var(--el-cascader-menu-radius)}.el-cascader__dropdown.el-popper{background:var(--el-cascader-menu-fill);border:var(--el-cascader-menu-border);box-shadow:var(--el-cascader-menu-shadow)}.el-cascader__dropdown.el-popper .el-popper__arrow:before{border:var(--el-cascader-menu-border)}.el-cascader__dropdown.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-cascader__dropdown.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-cascader__dropdown.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-cascader__dropdown.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-cascader__dropdown.el-popper{box-shadow:var(--el-cascader-menu-shadow)}.el-cascader__tags{position:absolute;left:0;right:30px;top:50%;transform:translateY(-50%);display:flex;flex-wrap:wrap;line-height:normal;text-align:left;box-sizing:border-box}.el-cascader__tags .el-tag{display:inline-flex;align-items:center;max-width:100%;margin:2px 0 2px 6px;text-overflow:ellipsis;background:var(--el-cascader-tag-background)}.el-cascader__tags .el-tag:not(.is-hit){border-color:transparent}.el-cascader__tags .el-tag>span{flex:1;overflow:hidden;text-overflow:ellipsis}.el-cascader__tags .el-tag .el-icon-close{flex:none;background-color:var(--el-text-color-placeholder);color:var(--el-color-white)}.el-cascader__tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-cascader__collapse-tags{white-space:normal;z-index:var(--el-index-normal)}.el-cascader__collapse-tags .el-tag{display:inline-flex;align-items:center;max-width:100%;margin:2px 0 2px 6px;text-overflow:ellipsis;background:var(--el-fill-color)}.el-cascader__collapse-tags .el-tag:not(.is-hit){border-color:transparent}.el-cascader__collapse-tags .el-tag>span{flex:1;overflow:hidden;text-overflow:ellipsis}.el-cascader__collapse-tags .el-tag .el-icon-close{flex:none;background-color:var(--el-text-color-placeholder);color:var(--el-color-white)}.el-cascader__collapse-tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-cascader__suggestion-panel{border-radius:var(--el-cascader-menu-radius)}.el-cascader__suggestion-list{max-height:204px;margin:0;padding:6px 0;font-size:var(--el-font-size-base);color:var(--el-cascader-menu-text-color);text-align:center}.el-cascader__suggestion-item{display:flex;justify-content:space-between;align-items:center;height:34px;padding:0 15px;text-align:left;outline:0;cursor:pointer}.el-cascader__suggestion-item:focus,.el-cascader__suggestion-item:hover{background:var(--el-cascader-node-background-hover)}.el-cascader__suggestion-item.is-checked{color:var(--el-cascader-menu-selected-text-color);font-weight:700}.el-cascader__suggestion-item>span{margin-right:10px}.el-cascader__empty-text{margin:10px 0;color:var(--el-cascader-color-empty)}.el-cascader__search-input{flex:1;height:24px;min-width:60px;margin:2px 0 2px 11px;padding:0;color:var(--el-cascader-menu-text-color);border:none;outline:0;box-sizing:border-box;background:0 0}.el-cascader__search-input::-moz-placeholder{color:transparent}.el-cascader__search-input:-ms-input-placeholder{color:transparent}.el-cascader__search-input::placeholder{color:transparent}.el-check-tag{background-color:var(--el-color-info-light-9);border-radius:var(--el-border-radius-base);color:var(--el-color-info);cursor:pointer;display:inline-block;font-size:var(--el-font-size-base);line-height:var(--el-font-size-base);padding:7px 15px;transition:var(--el-transition-all);font-weight:700}.el-check-tag:hover{background-color:var(--el-color-info-light-7)}.el-check-tag.is-checked{background-color:var(--el-color-primary-light-8);color:var(--el-color-primary)}.el-check-tag.is-checked:hover{background-color:var(--el-color-primary-light-7)}.el-checkbox-button{--el-checkbox-button-checked-bg-color:var(--el-color-primary);--el-checkbox-button-checked-text-color:var(--el-color-white);--el-checkbox-button-checked-border-color:var(--el-color-primary)}.el-checkbox-button{position:relative;display:inline-block}.el-checkbox-button__inner{display:inline-block;line-height:1;font-weight:var(--el-checkbox-font-weight);white-space:nowrap;vertical-align:middle;cursor:pointer;background:var(--el-button-bg-color,var(--el-fill-color-blank));border:var(--el-border);border-left:0;color:var(--el-button-text-color,var(--el-text-color-regular));-webkit-appearance:none;text-align:center;box-sizing:border-box;outline:0;margin:0;position:relative;transition:var(--el-transition-all);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:8px 15px;font-size:var(--el-font-size-base);border-radius:0}.el-checkbox-button__inner.is-round{padding:8px 15px}.el-checkbox-button__inner:hover{color:var(--el-color-primary)}.el-checkbox-button__inner [class*=el-icon-]{line-height:.9}.el-checkbox-button__inner [class*=el-icon-]+span{margin-left:5px}.el-checkbox-button__original{opacity:0;outline:0;position:absolute;margin:0;z-index:-1}.el-checkbox-button.is-checked .el-checkbox-button__inner{color:var(--el-checkbox-button-checked-text-color);background-color:var(--el-checkbox-button-checked-bg-color);border-color:var(--el-checkbox-button-checked-border-color);box-shadow:-1px 0 0 0 var(--el-color-primary-light-7)}.el-checkbox-button.is-checked:first-child .el-checkbox-button__inner{border-left-color:var(--el-checkbox-button-checked-border-color)}.el-checkbox-button.is-disabled .el-checkbox-button__inner{color:var(--el-disabled-text-color);cursor:not-allowed;background-image:none;background-color:var(--el-button-disabled-bg-color,var(--el-fill-color-blank));border-color:var(--el-button-disabled-border-color,var(--el-border-color-light));box-shadow:none}.el-checkbox-button.is-disabled:first-child .el-checkbox-button__inner{border-left-color:var(--el-button-disabled-border-color,var(--el-border-color-light))}.el-checkbox-button:first-child .el-checkbox-button__inner{border-left:var(--el-border);border-top-left-radius:var(--el-border-radius-base);border-bottom-left-radius:var(--el-border-radius-base);box-shadow:none!important}.el-checkbox-button.is-focus .el-checkbox-button__inner{border-color:var(--el-checkbox-button-checked-border-color)}.el-checkbox-button:last-child .el-checkbox-button__inner{border-top-right-radius:var(--el-border-radius-base);border-bottom-right-radius:var(--el-border-radius-base)}.el-checkbox-button--large .el-checkbox-button__inner{padding:12px 19px;font-size:var(--el-font-size-base);border-radius:0}.el-checkbox-button--large .el-checkbox-button__inner.is-round{padding:12px 19px}.el-checkbox-button--small .el-checkbox-button__inner{padding:5px 11px;font-size:12px;border-radius:0}.el-checkbox-button--small .el-checkbox-button__inner.is-round{padding:5px 11px}.el-checkbox-group{font-size:0;line-height:0}.el-checkbox{--el-checkbox-font-size:14px;--el-checkbox-font-weight:var(--el-font-weight-primary);--el-checkbox-text-color:var(--el-text-color-regular);--el-checkbox-input-height:14px;--el-checkbox-input-width:14px;--el-checkbox-border-radius:var(--el-border-radius-small);--el-checkbox-bg-color:var(--el-fill-color-blank);--el-checkbox-input-border:var(--el-border);--el-checkbox-disabled-border-color:var(--el-border-color);--el-checkbox-disabled-input-fill:var(--el-fill-color-light);--el-checkbox-disabled-icon-color:var(--el-text-color-placeholder);--el-checkbox-disabled-checked-input-fill:var(--el-border-color-extra-light);--el-checkbox-disabled-checked-input-border-color:var(--el-border-color);--el-checkbox-disabled-checked-icon-color:var(--el-text-color-placeholder);--el-checkbox-checked-text-color:var(--el-color-primary);--el-checkbox-checked-input-border-color:var(--el-color-primary);--el-checkbox-checked-bg-color:var(--el-color-primary);--el-checkbox-checked-icon-color:var(--el-color-white);--el-checkbox-input-border-color-hover:var(--el-color-primary)}.el-checkbox{color:var(--el-checkbox-text-color);font-weight:var(--el-checkbox-font-weight);font-size:var(--el-font-size-base);position:relative;cursor:pointer;display:inline-flex;align-items:center;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;margin-right:30px;height:32px}.el-checkbox.is-disabled{cursor:not-allowed}.el-checkbox.is-bordered{padding:0 15px 0 9px;border-radius:var(--el-border-radius-base);border:var(--el-border);box-sizing:border-box}.el-checkbox.is-bordered.is-checked{border-color:var(--el-color-primary)}.el-checkbox.is-bordered.is-disabled{border-color:var(--el-border-color-lighter)}.el-checkbox.is-bordered.el-checkbox--large{padding:0 19px 0 11px;border-radius:var(--el-border-radius-base)}.el-checkbox.is-bordered.el-checkbox--large .el-checkbox__label{font-size:var(--el-font-size-base)}.el-checkbox.is-bordered.el-checkbox--large .el-checkbox__inner{height:14px;width:14px}.el-checkbox.is-bordered.el-checkbox--small{padding:0 11px 0 7px;border-radius:calc(var(--el-border-radius-base) - 1px)}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__label{font-size:12px}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__inner{height:12px;width:12px}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__inner:after{height:6px;width:2px}.el-checkbox input:focus-visible+.el-checkbox__inner{outline:2px solid var(--el-checkbox-input-border-color-hover);outline-offset:1px;border-radius:var(--el-checkbox-border-radius)}.el-checkbox__input{white-space:nowrap;cursor:pointer;outline:0;display:inline-flex;position:relative}.el-checkbox__input.is-disabled .el-checkbox__inner{background-color:var(--el-checkbox-disabled-input-fill);border-color:var(--el-checkbox-disabled-border-color);cursor:not-allowed}.el-checkbox__input.is-disabled .el-checkbox__inner:after{cursor:not-allowed;border-color:var(--el-checkbox-disabled-icon-color)}.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner{background-color:var(--el-checkbox-disabled-checked-input-fill);border-color:var(--el-checkbox-disabled-checked-input-border-color)}.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner:after{border-color:var(--el-checkbox-disabled-checked-icon-color)}.el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner{background-color:var(--el-checkbox-disabled-checked-input-fill);border-color:var(--el-checkbox-disabled-checked-input-border-color)}.el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner:before{background-color:var(--el-checkbox-disabled-checked-icon-color);border-color:var(--el-checkbox-disabled-checked-icon-color)}.el-checkbox__input.is-disabled+span.el-checkbox__label{color:var(--el-disabled-text-color);cursor:not-allowed}.el-checkbox__input.is-checked .el-checkbox__inner{background-color:var(--el-checkbox-checked-bg-color);border-color:var(--el-checkbox-checked-input-border-color)}.el-checkbox__input.is-checked .el-checkbox__inner:after{transform:rotate(45deg) scaleY(1)}.el-checkbox__input.is-checked+.el-checkbox__label{color:var(--el-checkbox-checked-text-color)}.el-checkbox__input.is-focus:not(.is-checked) .el-checkbox__original:not(:focus-visible){border-color:var(--el-checkbox-input-border-color-hover)}.el-checkbox__input.is-indeterminate .el-checkbox__inner{background-color:var(--el-checkbox-checked-bg-color);border-color:var(--el-checkbox-checked-input-border-color)}.el-checkbox__input.is-indeterminate .el-checkbox__inner:before{content:"";position:absolute;display:block;background-color:var(--el-checkbox-checked-icon-color);height:2px;transform:scale(.5);left:0;right:0;top:5px}.el-checkbox__input.is-indeterminate .el-checkbox__inner:after{display:none}.el-checkbox__inner{display:inline-block;position:relative;border:var(--el-checkbox-input-border);border-radius:var(--el-checkbox-border-radius);box-sizing:border-box;width:var(--el-checkbox-input-width);height:var(--el-checkbox-input-height);background-color:var(--el-checkbox-bg-color);z-index:var(--el-index-normal);transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46),outline .25s cubic-bezier(.71,-.46,.29,1.46)}.el-checkbox__inner:hover{border-color:var(--el-checkbox-input-border-color-hover)}.el-checkbox__inner:after{box-sizing:content-box;content:"";border:1px solid var(--el-checkbox-checked-icon-color);border-left:0;border-top:0;height:7px;left:4px;position:absolute;top:1px;transform:rotate(45deg) scaleY(0);width:3px;transition:transform .15s ease-in 50ms;transform-origin:center}.el-checkbox__original{opacity:0;outline:0;position:absolute;margin:0;width:0;height:0;z-index:-1}.el-checkbox__label{display:inline-block;padding-left:8px;line-height:1;font-size:var(--el-checkbox-font-size)}.el-checkbox.el-checkbox--large{height:40px}.el-checkbox.el-checkbox--large .el-checkbox__label{font-size:14px}.el-checkbox.el-checkbox--large .el-checkbox__inner{width:14px;height:14px}.el-checkbox.el-checkbox--small{height:24px}.el-checkbox.el-checkbox--small .el-checkbox__label{font-size:12px}.el-checkbox.el-checkbox--small .el-checkbox__inner{width:12px;height:12px}.el-checkbox.el-checkbox--small .el-checkbox__input.is-indeterminate .el-checkbox__inner:before{top:4px}.el-checkbox.el-checkbox--small .el-checkbox__inner:after{width:2px;height:6px}.el-checkbox:last-of-type{margin-right:0}[class*=el-col-]{box-sizing:border-box}[class*=el-col-].is-guttered{display:block;min-height:1px}.el-col-0,.el-col-0.is-guttered{display:none}.el-col-0{max-width:0%;flex:0 0 0%}.el-col-offset-0{margin-left:0}.el-col-pull-0{position:relative;right:0}.el-col-push-0{position:relative;left:0}.el-col-1{max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-offset-1{margin-left:4.1666666667%}.el-col-pull-1{position:relative;right:4.1666666667%}.el-col-push-1{position:relative;left:4.1666666667%}.el-col-2{max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-offset-2{margin-left:8.3333333333%}.el-col-pull-2{position:relative;right:8.3333333333%}.el-col-push-2{position:relative;left:8.3333333333%}.el-col-3{max-width:12.5%;flex:0 0 12.5%}.el-col-offset-3{margin-left:12.5%}.el-col-pull-3{position:relative;right:12.5%}.el-col-push-3{position:relative;left:12.5%}.el-col-4{max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-offset-4{margin-left:16.6666666667%}.el-col-pull-4{position:relative;right:16.6666666667%}.el-col-push-4{position:relative;left:16.6666666667%}.el-col-5{max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-offset-5{margin-left:20.8333333333%}.el-col-pull-5{position:relative;right:20.8333333333%}.el-col-push-5{position:relative;left:20.8333333333%}.el-col-6{max-width:25%;flex:0 0 25%}.el-col-offset-6{margin-left:25%}.el-col-pull-6{position:relative;right:25%}.el-col-push-6{position:relative;left:25%}.el-col-7{max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-offset-7{margin-left:29.1666666667%}.el-col-pull-7{position:relative;right:29.1666666667%}.el-col-push-7{position:relative;left:29.1666666667%}.el-col-8{max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-offset-8{margin-left:33.3333333333%}.el-col-pull-8{position:relative;right:33.3333333333%}.el-col-push-8{position:relative;left:33.3333333333%}.el-col-9{max-width:37.5%;flex:0 0 37.5%}.el-col-offset-9{margin-left:37.5%}.el-col-pull-9{position:relative;right:37.5%}.el-col-push-9{position:relative;left:37.5%}.el-col-10{max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-offset-10{margin-left:41.6666666667%}.el-col-pull-10{position:relative;right:41.6666666667%}.el-col-push-10{position:relative;left:41.6666666667%}.el-col-11{max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-offset-11{margin-left:45.8333333333%}.el-col-pull-11{position:relative;right:45.8333333333%}.el-col-push-11{position:relative;left:45.8333333333%}.el-col-12{max-width:50%;flex:0 0 50%}.el-col-offset-12{margin-left:50%}.el-col-pull-12{position:relative;right:50%}.el-col-push-12{position:relative;left:50%}.el-col-13{max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-offset-13{margin-left:54.1666666667%}.el-col-pull-13{position:relative;right:54.1666666667%}.el-col-push-13{position:relative;left:54.1666666667%}.el-col-14{max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-offset-14{margin-left:58.3333333333%}.el-col-pull-14{position:relative;right:58.3333333333%}.el-col-push-14{position:relative;left:58.3333333333%}.el-col-15{max-width:62.5%;flex:0 0 62.5%}.el-col-offset-15{margin-left:62.5%}.el-col-pull-15{position:relative;right:62.5%}.el-col-push-15{position:relative;left:62.5%}.el-col-16{max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-offset-16{margin-left:66.6666666667%}.el-col-pull-16{position:relative;right:66.6666666667%}.el-col-push-16{position:relative;left:66.6666666667%}.el-col-17{max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-offset-17{margin-left:70.8333333333%}.el-col-pull-17{position:relative;right:70.8333333333%}.el-col-push-17{position:relative;left:70.8333333333%}.el-col-18{max-width:75%;flex:0 0 75%}.el-col-offset-18{margin-left:75%}.el-col-pull-18{position:relative;right:75%}.el-col-push-18{position:relative;left:75%}.el-col-19{max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-offset-19{margin-left:79.1666666667%}.el-col-pull-19{position:relative;right:79.1666666667%}.el-col-push-19{position:relative;left:79.1666666667%}.el-col-20{max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-offset-20{margin-left:83.3333333333%}.el-col-pull-20{position:relative;right:83.3333333333%}.el-col-push-20{position:relative;left:83.3333333333%}.el-col-21{max-width:87.5%;flex:0 0 87.5%}.el-col-offset-21{margin-left:87.5%}.el-col-pull-21{position:relative;right:87.5%}.el-col-push-21{position:relative;left:87.5%}.el-col-22{max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-offset-22{margin-left:91.6666666667%}.el-col-pull-22{position:relative;right:91.6666666667%}.el-col-push-22{position:relative;left:91.6666666667%}.el-col-23{max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-offset-23{margin-left:95.8333333333%}.el-col-pull-23{position:relative;right:95.8333333333%}.el-col-push-23{position:relative;left:95.8333333333%}.el-col-24{max-width:100%;flex:0 0 100%}.el-col-offset-24{margin-left:100%}.el-col-pull-24{position:relative;right:100%}.el-col-push-24{position:relative;left:100%}@media only screen and (max-width:768px){.el-col-xs-0,.el-col-xs-0.is-guttered{display:none}.el-col-xs-0{max-width:0%;flex:0 0 0%}.el-col-xs-offset-0{margin-left:0}.el-col-xs-pull-0{position:relative;right:0}.el-col-xs-push-0{position:relative;left:0}.el-col-xs-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-xs-offset-1{margin-left:4.1666666667%}.el-col-xs-pull-1{position:relative;right:4.1666666667%}.el-col-xs-push-1{position:relative;left:4.1666666667%}.el-col-xs-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-xs-offset-2{margin-left:8.3333333333%}.el-col-xs-pull-2{position:relative;right:8.3333333333%}.el-col-xs-push-2{position:relative;left:8.3333333333%}.el-col-xs-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-xs-offset-3{margin-left:12.5%}.el-col-xs-pull-3{position:relative;right:12.5%}.el-col-xs-push-3{position:relative;left:12.5%}.el-col-xs-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-xs-offset-4{margin-left:16.6666666667%}.el-col-xs-pull-4{position:relative;right:16.6666666667%}.el-col-xs-push-4{position:relative;left:16.6666666667%}.el-col-xs-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-xs-offset-5{margin-left:20.8333333333%}.el-col-xs-pull-5{position:relative;right:20.8333333333%}.el-col-xs-push-5{position:relative;left:20.8333333333%}.el-col-xs-6{display:block;max-width:25%;flex:0 0 25%}.el-col-xs-offset-6{margin-left:25%}.el-col-xs-pull-6{position:relative;right:25%}.el-col-xs-push-6{position:relative;left:25%}.el-col-xs-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-xs-offset-7{margin-left:29.1666666667%}.el-col-xs-pull-7{position:relative;right:29.1666666667%}.el-col-xs-push-7{position:relative;left:29.1666666667%}.el-col-xs-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-xs-offset-8{margin-left:33.3333333333%}.el-col-xs-pull-8{position:relative;right:33.3333333333%}.el-col-xs-push-8{position:relative;left:33.3333333333%}.el-col-xs-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-xs-offset-9{margin-left:37.5%}.el-col-xs-pull-9{position:relative;right:37.5%}.el-col-xs-push-9{position:relative;left:37.5%}.el-col-xs-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-xs-offset-10{margin-left:41.6666666667%}.el-col-xs-pull-10{position:relative;right:41.6666666667%}.el-col-xs-push-10{position:relative;left:41.6666666667%}.el-col-xs-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-xs-offset-11{margin-left:45.8333333333%}.el-col-xs-pull-11{position:relative;right:45.8333333333%}.el-col-xs-push-11{position:relative;left:45.8333333333%}.el-col-xs-12{display:block;max-width:50%;flex:0 0 50%}.el-col-xs-offset-12{margin-left:50%}.el-col-xs-pull-12{position:relative;right:50%}.el-col-xs-push-12{position:relative;left:50%}.el-col-xs-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-xs-offset-13{margin-left:54.1666666667%}.el-col-xs-pull-13{position:relative;right:54.1666666667%}.el-col-xs-push-13{position:relative;left:54.1666666667%}.el-col-xs-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-xs-offset-14{margin-left:58.3333333333%}.el-col-xs-pull-14{position:relative;right:58.3333333333%}.el-col-xs-push-14{position:relative;left:58.3333333333%}.el-col-xs-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-xs-offset-15{margin-left:62.5%}.el-col-xs-pull-15{position:relative;right:62.5%}.el-col-xs-push-15{position:relative;left:62.5%}.el-col-xs-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-xs-offset-16{margin-left:66.6666666667%}.el-col-xs-pull-16{position:relative;right:66.6666666667%}.el-col-xs-push-16{position:relative;left:66.6666666667%}.el-col-xs-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-xs-offset-17{margin-left:70.8333333333%}.el-col-xs-pull-17{position:relative;right:70.8333333333%}.el-col-xs-push-17{position:relative;left:70.8333333333%}.el-col-xs-18{display:block;max-width:75%;flex:0 0 75%}.el-col-xs-offset-18{margin-left:75%}.el-col-xs-pull-18{position:relative;right:75%}.el-col-xs-push-18{position:relative;left:75%}.el-col-xs-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-xs-offset-19{margin-left:79.1666666667%}.el-col-xs-pull-19{position:relative;right:79.1666666667%}.el-col-xs-push-19{position:relative;left:79.1666666667%}.el-col-xs-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-xs-offset-20{margin-left:83.3333333333%}.el-col-xs-pull-20{position:relative;right:83.3333333333%}.el-col-xs-push-20{position:relative;left:83.3333333333%}.el-col-xs-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-xs-offset-21{margin-left:87.5%}.el-col-xs-pull-21{position:relative;right:87.5%}.el-col-xs-push-21{position:relative;left:87.5%}.el-col-xs-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-xs-offset-22{margin-left:91.6666666667%}.el-col-xs-pull-22{position:relative;right:91.6666666667%}.el-col-xs-push-22{position:relative;left:91.6666666667%}.el-col-xs-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-xs-offset-23{margin-left:95.8333333333%}.el-col-xs-pull-23{position:relative;right:95.8333333333%}.el-col-xs-push-23{position:relative;left:95.8333333333%}.el-col-xs-24{display:block;max-width:100%;flex:0 0 100%}.el-col-xs-offset-24{margin-left:100%}.el-col-xs-pull-24{position:relative;right:100%}.el-col-xs-push-24{position:relative;left:100%}}@media only screen and (min-width:768px){.el-col-sm-0,.el-col-sm-0.is-guttered{display:none}.el-col-sm-0{max-width:0%;flex:0 0 0%}.el-col-sm-offset-0{margin-left:0}.el-col-sm-pull-0{position:relative;right:0}.el-col-sm-push-0{position:relative;left:0}.el-col-sm-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-sm-offset-1{margin-left:4.1666666667%}.el-col-sm-pull-1{position:relative;right:4.1666666667%}.el-col-sm-push-1{position:relative;left:4.1666666667%}.el-col-sm-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-sm-offset-2{margin-left:8.3333333333%}.el-col-sm-pull-2{position:relative;right:8.3333333333%}.el-col-sm-push-2{position:relative;left:8.3333333333%}.el-col-sm-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-sm-offset-3{margin-left:12.5%}.el-col-sm-pull-3{position:relative;right:12.5%}.el-col-sm-push-3{position:relative;left:12.5%}.el-col-sm-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-sm-offset-4{margin-left:16.6666666667%}.el-col-sm-pull-4{position:relative;right:16.6666666667%}.el-col-sm-push-4{position:relative;left:16.6666666667%}.el-col-sm-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-sm-offset-5{margin-left:20.8333333333%}.el-col-sm-pull-5{position:relative;right:20.8333333333%}.el-col-sm-push-5{position:relative;left:20.8333333333%}.el-col-sm-6{display:block;max-width:25%;flex:0 0 25%}.el-col-sm-offset-6{margin-left:25%}.el-col-sm-pull-6{position:relative;right:25%}.el-col-sm-push-6{position:relative;left:25%}.el-col-sm-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-sm-offset-7{margin-left:29.1666666667%}.el-col-sm-pull-7{position:relative;right:29.1666666667%}.el-col-sm-push-7{position:relative;left:29.1666666667%}.el-col-sm-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-sm-offset-8{margin-left:33.3333333333%}.el-col-sm-pull-8{position:relative;right:33.3333333333%}.el-col-sm-push-8{position:relative;left:33.3333333333%}.el-col-sm-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-sm-offset-9{margin-left:37.5%}.el-col-sm-pull-9{position:relative;right:37.5%}.el-col-sm-push-9{position:relative;left:37.5%}.el-col-sm-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-sm-offset-10{margin-left:41.6666666667%}.el-col-sm-pull-10{position:relative;right:41.6666666667%}.el-col-sm-push-10{position:relative;left:41.6666666667%}.el-col-sm-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-sm-offset-11{margin-left:45.8333333333%}.el-col-sm-pull-11{position:relative;right:45.8333333333%}.el-col-sm-push-11{position:relative;left:45.8333333333%}.el-col-sm-12{display:block;max-width:50%;flex:0 0 50%}.el-col-sm-offset-12{margin-left:50%}.el-col-sm-pull-12{position:relative;right:50%}.el-col-sm-push-12{position:relative;left:50%}.el-col-sm-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-sm-offset-13{margin-left:54.1666666667%}.el-col-sm-pull-13{position:relative;right:54.1666666667%}.el-col-sm-push-13{position:relative;left:54.1666666667%}.el-col-sm-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-sm-offset-14{margin-left:58.3333333333%}.el-col-sm-pull-14{position:relative;right:58.3333333333%}.el-col-sm-push-14{position:relative;left:58.3333333333%}.el-col-sm-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-sm-offset-15{margin-left:62.5%}.el-col-sm-pull-15{position:relative;right:62.5%}.el-col-sm-push-15{position:relative;left:62.5%}.el-col-sm-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-sm-offset-16{margin-left:66.6666666667%}.el-col-sm-pull-16{position:relative;right:66.6666666667%}.el-col-sm-push-16{position:relative;left:66.6666666667%}.el-col-sm-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-sm-offset-17{margin-left:70.8333333333%}.el-col-sm-pull-17{position:relative;right:70.8333333333%}.el-col-sm-push-17{position:relative;left:70.8333333333%}.el-col-sm-18{display:block;max-width:75%;flex:0 0 75%}.el-col-sm-offset-18{margin-left:75%}.el-col-sm-pull-18{position:relative;right:75%}.el-col-sm-push-18{position:relative;left:75%}.el-col-sm-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-sm-offset-19{margin-left:79.1666666667%}.el-col-sm-pull-19{position:relative;right:79.1666666667%}.el-col-sm-push-19{position:relative;left:79.1666666667%}.el-col-sm-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-sm-offset-20{margin-left:83.3333333333%}.el-col-sm-pull-20{position:relative;right:83.3333333333%}.el-col-sm-push-20{position:relative;left:83.3333333333%}.el-col-sm-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-sm-offset-21{margin-left:87.5%}.el-col-sm-pull-21{position:relative;right:87.5%}.el-col-sm-push-21{position:relative;left:87.5%}.el-col-sm-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-sm-offset-22{margin-left:91.6666666667%}.el-col-sm-pull-22{position:relative;right:91.6666666667%}.el-col-sm-push-22{position:relative;left:91.6666666667%}.el-col-sm-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-sm-offset-23{margin-left:95.8333333333%}.el-col-sm-pull-23{position:relative;right:95.8333333333%}.el-col-sm-push-23{position:relative;left:95.8333333333%}.el-col-sm-24{display:block;max-width:100%;flex:0 0 100%}.el-col-sm-offset-24{margin-left:100%}.el-col-sm-pull-24{position:relative;right:100%}.el-col-sm-push-24{position:relative;left:100%}}@media only screen and (min-width:992px){.el-col-md-0,.el-col-md-0.is-guttered{display:none}.el-col-md-0{max-width:0%;flex:0 0 0%}.el-col-md-offset-0{margin-left:0}.el-col-md-pull-0{position:relative;right:0}.el-col-md-push-0{position:relative;left:0}.el-col-md-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-md-offset-1{margin-left:4.1666666667%}.el-col-md-pull-1{position:relative;right:4.1666666667%}.el-col-md-push-1{position:relative;left:4.1666666667%}.el-col-md-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-md-offset-2{margin-left:8.3333333333%}.el-col-md-pull-2{position:relative;right:8.3333333333%}.el-col-md-push-2{position:relative;left:8.3333333333%}.el-col-md-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-md-offset-3{margin-left:12.5%}.el-col-md-pull-3{position:relative;right:12.5%}.el-col-md-push-3{position:relative;left:12.5%}.el-col-md-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-md-offset-4{margin-left:16.6666666667%}.el-col-md-pull-4{position:relative;right:16.6666666667%}.el-col-md-push-4{position:relative;left:16.6666666667%}.el-col-md-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-md-offset-5{margin-left:20.8333333333%}.el-col-md-pull-5{position:relative;right:20.8333333333%}.el-col-md-push-5{position:relative;left:20.8333333333%}.el-col-md-6{display:block;max-width:25%;flex:0 0 25%}.el-col-md-offset-6{margin-left:25%}.el-col-md-pull-6{position:relative;right:25%}.el-col-md-push-6{position:relative;left:25%}.el-col-md-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-md-offset-7{margin-left:29.1666666667%}.el-col-md-pull-7{position:relative;right:29.1666666667%}.el-col-md-push-7{position:relative;left:29.1666666667%}.el-col-md-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-md-offset-8{margin-left:33.3333333333%}.el-col-md-pull-8{position:relative;right:33.3333333333%}.el-col-md-push-8{position:relative;left:33.3333333333%}.el-col-md-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-md-offset-9{margin-left:37.5%}.el-col-md-pull-9{position:relative;right:37.5%}.el-col-md-push-9{position:relative;left:37.5%}.el-col-md-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-md-offset-10{margin-left:41.6666666667%}.el-col-md-pull-10{position:relative;right:41.6666666667%}.el-col-md-push-10{position:relative;left:41.6666666667%}.el-col-md-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-md-offset-11{margin-left:45.8333333333%}.el-col-md-pull-11{position:relative;right:45.8333333333%}.el-col-md-push-11{position:relative;left:45.8333333333%}.el-col-md-12{display:block;max-width:50%;flex:0 0 50%}.el-col-md-offset-12{margin-left:50%}.el-col-md-pull-12{position:relative;right:50%}.el-col-md-push-12{position:relative;left:50%}.el-col-md-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-md-offset-13{margin-left:54.1666666667%}.el-col-md-pull-13{position:relative;right:54.1666666667%}.el-col-md-push-13{position:relative;left:54.1666666667%}.el-col-md-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-md-offset-14{margin-left:58.3333333333%}.el-col-md-pull-14{position:relative;right:58.3333333333%}.el-col-md-push-14{position:relative;left:58.3333333333%}.el-col-md-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-md-offset-15{margin-left:62.5%}.el-col-md-pull-15{position:relative;right:62.5%}.el-col-md-push-15{position:relative;left:62.5%}.el-col-md-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-md-offset-16{margin-left:66.6666666667%}.el-col-md-pull-16{position:relative;right:66.6666666667%}.el-col-md-push-16{position:relative;left:66.6666666667%}.el-col-md-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-md-offset-17{margin-left:70.8333333333%}.el-col-md-pull-17{position:relative;right:70.8333333333%}.el-col-md-push-17{position:relative;left:70.8333333333%}.el-col-md-18{display:block;max-width:75%;flex:0 0 75%}.el-col-md-offset-18{margin-left:75%}.el-col-md-pull-18{position:relative;right:75%}.el-col-md-push-18{position:relative;left:75%}.el-col-md-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-md-offset-19{margin-left:79.1666666667%}.el-col-md-pull-19{position:relative;right:79.1666666667%}.el-col-md-push-19{position:relative;left:79.1666666667%}.el-col-md-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-md-offset-20{margin-left:83.3333333333%}.el-col-md-pull-20{position:relative;right:83.3333333333%}.el-col-md-push-20{position:relative;left:83.3333333333%}.el-col-md-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-md-offset-21{margin-left:87.5%}.el-col-md-pull-21{position:relative;right:87.5%}.el-col-md-push-21{position:relative;left:87.5%}.el-col-md-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-md-offset-22{margin-left:91.6666666667%}.el-col-md-pull-22{position:relative;right:91.6666666667%}.el-col-md-push-22{position:relative;left:91.6666666667%}.el-col-md-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-md-offset-23{margin-left:95.8333333333%}.el-col-md-pull-23{position:relative;right:95.8333333333%}.el-col-md-push-23{position:relative;left:95.8333333333%}.el-col-md-24{display:block;max-width:100%;flex:0 0 100%}.el-col-md-offset-24{margin-left:100%}.el-col-md-pull-24{position:relative;right:100%}.el-col-md-push-24{position:relative;left:100%}}@media only screen and (min-width:1200px){.el-col-lg-0,.el-col-lg-0.is-guttered{display:none}.el-col-lg-0{max-width:0%;flex:0 0 0%}.el-col-lg-offset-0{margin-left:0}.el-col-lg-pull-0{position:relative;right:0}.el-col-lg-push-0{position:relative;left:0}.el-col-lg-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-lg-offset-1{margin-left:4.1666666667%}.el-col-lg-pull-1{position:relative;right:4.1666666667%}.el-col-lg-push-1{position:relative;left:4.1666666667%}.el-col-lg-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-lg-offset-2{margin-left:8.3333333333%}.el-col-lg-pull-2{position:relative;right:8.3333333333%}.el-col-lg-push-2{position:relative;left:8.3333333333%}.el-col-lg-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-lg-offset-3{margin-left:12.5%}.el-col-lg-pull-3{position:relative;right:12.5%}.el-col-lg-push-3{position:relative;left:12.5%}.el-col-lg-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-lg-offset-4{margin-left:16.6666666667%}.el-col-lg-pull-4{position:relative;right:16.6666666667%}.el-col-lg-push-4{position:relative;left:16.6666666667%}.el-col-lg-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-lg-offset-5{margin-left:20.8333333333%}.el-col-lg-pull-5{position:relative;right:20.8333333333%}.el-col-lg-push-5{position:relative;left:20.8333333333%}.el-col-lg-6{display:block;max-width:25%;flex:0 0 25%}.el-col-lg-offset-6{margin-left:25%}.el-col-lg-pull-6{position:relative;right:25%}.el-col-lg-push-6{position:relative;left:25%}.el-col-lg-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-lg-offset-7{margin-left:29.1666666667%}.el-col-lg-pull-7{position:relative;right:29.1666666667%}.el-col-lg-push-7{position:relative;left:29.1666666667%}.el-col-lg-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-lg-offset-8{margin-left:33.3333333333%}.el-col-lg-pull-8{position:relative;right:33.3333333333%}.el-col-lg-push-8{position:relative;left:33.3333333333%}.el-col-lg-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-lg-offset-9{margin-left:37.5%}.el-col-lg-pull-9{position:relative;right:37.5%}.el-col-lg-push-9{position:relative;left:37.5%}.el-col-lg-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-lg-offset-10{margin-left:41.6666666667%}.el-col-lg-pull-10{position:relative;right:41.6666666667%}.el-col-lg-push-10{position:relative;left:41.6666666667%}.el-col-lg-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-lg-offset-11{margin-left:45.8333333333%}.el-col-lg-pull-11{position:relative;right:45.8333333333%}.el-col-lg-push-11{position:relative;left:45.8333333333%}.el-col-lg-12{display:block;max-width:50%;flex:0 0 50%}.el-col-lg-offset-12{margin-left:50%}.el-col-lg-pull-12{position:relative;right:50%}.el-col-lg-push-12{position:relative;left:50%}.el-col-lg-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-lg-offset-13{margin-left:54.1666666667%}.el-col-lg-pull-13{position:relative;right:54.1666666667%}.el-col-lg-push-13{position:relative;left:54.1666666667%}.el-col-lg-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-lg-offset-14{margin-left:58.3333333333%}.el-col-lg-pull-14{position:relative;right:58.3333333333%}.el-col-lg-push-14{position:relative;left:58.3333333333%}.el-col-lg-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-lg-offset-15{margin-left:62.5%}.el-col-lg-pull-15{position:relative;right:62.5%}.el-col-lg-push-15{position:relative;left:62.5%}.el-col-lg-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-lg-offset-16{margin-left:66.6666666667%}.el-col-lg-pull-16{position:relative;right:66.6666666667%}.el-col-lg-push-16{position:relative;left:66.6666666667%}.el-col-lg-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-lg-offset-17{margin-left:70.8333333333%}.el-col-lg-pull-17{position:relative;right:70.8333333333%}.el-col-lg-push-17{position:relative;left:70.8333333333%}.el-col-lg-18{display:block;max-width:75%;flex:0 0 75%}.el-col-lg-offset-18{margin-left:75%}.el-col-lg-pull-18{position:relative;right:75%}.el-col-lg-push-18{position:relative;left:75%}.el-col-lg-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-lg-offset-19{margin-left:79.1666666667%}.el-col-lg-pull-19{position:relative;right:79.1666666667%}.el-col-lg-push-19{position:relative;left:79.1666666667%}.el-col-lg-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-lg-offset-20{margin-left:83.3333333333%}.el-col-lg-pull-20{position:relative;right:83.3333333333%}.el-col-lg-push-20{position:relative;left:83.3333333333%}.el-col-lg-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-lg-offset-21{margin-left:87.5%}.el-col-lg-pull-21{position:relative;right:87.5%}.el-col-lg-push-21{position:relative;left:87.5%}.el-col-lg-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-lg-offset-22{margin-left:91.6666666667%}.el-col-lg-pull-22{position:relative;right:91.6666666667%}.el-col-lg-push-22{position:relative;left:91.6666666667%}.el-col-lg-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-lg-offset-23{margin-left:95.8333333333%}.el-col-lg-pull-23{position:relative;right:95.8333333333%}.el-col-lg-push-23{position:relative;left:95.8333333333%}.el-col-lg-24{display:block;max-width:100%;flex:0 0 100%}.el-col-lg-offset-24{margin-left:100%}.el-col-lg-pull-24{position:relative;right:100%}.el-col-lg-push-24{position:relative;left:100%}}@media only screen and (min-width:1920px){.el-col-xl-0,.el-col-xl-0.is-guttered{display:none}.el-col-xl-0{max-width:0%;flex:0 0 0%}.el-col-xl-offset-0{margin-left:0}.el-col-xl-pull-0{position:relative;right:0}.el-col-xl-push-0{position:relative;left:0}.el-col-xl-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-xl-offset-1{margin-left:4.1666666667%}.el-col-xl-pull-1{position:relative;right:4.1666666667%}.el-col-xl-push-1{position:relative;left:4.1666666667%}.el-col-xl-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-xl-offset-2{margin-left:8.3333333333%}.el-col-xl-pull-2{position:relative;right:8.3333333333%}.el-col-xl-push-2{position:relative;left:8.3333333333%}.el-col-xl-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-xl-offset-3{margin-left:12.5%}.el-col-xl-pull-3{position:relative;right:12.5%}.el-col-xl-push-3{position:relative;left:12.5%}.el-col-xl-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-xl-offset-4{margin-left:16.6666666667%}.el-col-xl-pull-4{position:relative;right:16.6666666667%}.el-col-xl-push-4{position:relative;left:16.6666666667%}.el-col-xl-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-xl-offset-5{margin-left:20.8333333333%}.el-col-xl-pull-5{position:relative;right:20.8333333333%}.el-col-xl-push-5{position:relative;left:20.8333333333%}.el-col-xl-6{display:block;max-width:25%;flex:0 0 25%}.el-col-xl-offset-6{margin-left:25%}.el-col-xl-pull-6{position:relative;right:25%}.el-col-xl-push-6{position:relative;left:25%}.el-col-xl-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-xl-offset-7{margin-left:29.1666666667%}.el-col-xl-pull-7{position:relative;right:29.1666666667%}.el-col-xl-push-7{position:relative;left:29.1666666667%}.el-col-xl-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-xl-offset-8{margin-left:33.3333333333%}.el-col-xl-pull-8{position:relative;right:33.3333333333%}.el-col-xl-push-8{position:relative;left:33.3333333333%}.el-col-xl-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-xl-offset-9{margin-left:37.5%}.el-col-xl-pull-9{position:relative;right:37.5%}.el-col-xl-push-9{position:relative;left:37.5%}.el-col-xl-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-xl-offset-10{margin-left:41.6666666667%}.el-col-xl-pull-10{position:relative;right:41.6666666667%}.el-col-xl-push-10{position:relative;left:41.6666666667%}.el-col-xl-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-xl-offset-11{margin-left:45.8333333333%}.el-col-xl-pull-11{position:relative;right:45.8333333333%}.el-col-xl-push-11{position:relative;left:45.8333333333%}.el-col-xl-12{display:block;max-width:50%;flex:0 0 50%}.el-col-xl-offset-12{margin-left:50%}.el-col-xl-pull-12{position:relative;right:50%}.el-col-xl-push-12{position:relative;left:50%}.el-col-xl-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-xl-offset-13{margin-left:54.1666666667%}.el-col-xl-pull-13{position:relative;right:54.1666666667%}.el-col-xl-push-13{position:relative;left:54.1666666667%}.el-col-xl-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-xl-offset-14{margin-left:58.3333333333%}.el-col-xl-pull-14{position:relative;right:58.3333333333%}.el-col-xl-push-14{position:relative;left:58.3333333333%}.el-col-xl-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-xl-offset-15{margin-left:62.5%}.el-col-xl-pull-15{position:relative;right:62.5%}.el-col-xl-push-15{position:relative;left:62.5%}.el-col-xl-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-xl-offset-16{margin-left:66.6666666667%}.el-col-xl-pull-16{position:relative;right:66.6666666667%}.el-col-xl-push-16{position:relative;left:66.6666666667%}.el-col-xl-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-xl-offset-17{margin-left:70.8333333333%}.el-col-xl-pull-17{position:relative;right:70.8333333333%}.el-col-xl-push-17{position:relative;left:70.8333333333%}.el-col-xl-18{display:block;max-width:75%;flex:0 0 75%}.el-col-xl-offset-18{margin-left:75%}.el-col-xl-pull-18{position:relative;right:75%}.el-col-xl-push-18{position:relative;left:75%}.el-col-xl-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-xl-offset-19{margin-left:79.1666666667%}.el-col-xl-pull-19{position:relative;right:79.1666666667%}.el-col-xl-push-19{position:relative;left:79.1666666667%}.el-col-xl-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-xl-offset-20{margin-left:83.3333333333%}.el-col-xl-pull-20{position:relative;right:83.3333333333%}.el-col-xl-push-20{position:relative;left:83.3333333333%}.el-col-xl-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-xl-offset-21{margin-left:87.5%}.el-col-xl-pull-21{position:relative;right:87.5%}.el-col-xl-push-21{position:relative;left:87.5%}.el-col-xl-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-xl-offset-22{margin-left:91.6666666667%}.el-col-xl-pull-22{position:relative;right:91.6666666667%}.el-col-xl-push-22{position:relative;left:91.6666666667%}.el-col-xl-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-xl-offset-23{margin-left:95.8333333333%}.el-col-xl-pull-23{position:relative;right:95.8333333333%}.el-col-xl-push-23{position:relative;left:95.8333333333%}.el-col-xl-24{display:block;max-width:100%;flex:0 0 100%}.el-col-xl-offset-24{margin-left:100%}.el-col-xl-pull-24{position:relative;right:100%}.el-col-xl-push-24{position:relative;left:100%}}.el-collapse{--el-collapse-border-color:var(--el-border-color-lighter);--el-collapse-header-height:48px;--el-collapse-header-bg-color:var(--el-fill-color-blank);--el-collapse-header-text-color:var(--el-text-color-primary);--el-collapse-header-font-size:13px;--el-collapse-content-bg-color:var(--el-fill-color-blank);--el-collapse-content-font-size:13px;--el-collapse-content-text-color:var(--el-text-color-primary);border-top:1px solid var(--el-collapse-border-color);border-bottom:1px solid var(--el-collapse-border-color)}.el-collapse-item.is-disabled .el-collapse-item__header{color:var(--el-text-color-disabled);cursor:not-allowed}.el-collapse-item__header{display:flex;align-items:center;height:var(--el-collapse-header-height);line-height:var(--el-collapse-header-height);background-color:var(--el-collapse-header-bg-color);color:var(--el-collapse-header-text-color);cursor:pointer;border-bottom:1px solid var(--el-collapse-border-color);font-size:var(--el-collapse-header-font-size);font-weight:500;transition:border-bottom-color var(--el-transition-duration);outline:0}.el-collapse-item__arrow{margin:0 8px 0 auto;transition:transform var(--el-transition-duration);font-weight:300}.el-collapse-item__arrow.is-active{transform:rotate(90deg)}.el-collapse-item__header.focusing:focus:not(:hover){color:var(--el-color-primary)}.el-collapse-item__header.is-active{border-bottom-color:transparent}.el-collapse-item__wrap{will-change:height;background-color:var(--el-collapse-content-bg-color);overflow:hidden;box-sizing:border-box;border-bottom:1px solid var(--el-collapse-border-color)}.el-collapse-item__content{padding-bottom:25px;font-size:var(--el-collapse-content-font-size);color:var(--el-collapse-content-text-color);line-height:1.7692307692}.el-collapse-item:last-child{margin-bottom:-1px}.el-color-predefine{display:flex;font-size:12px;margin-top:8px;width:280px}.el-color-predefine__colors{display:flex;flex:1;flex-wrap:wrap}.el-color-predefine__color-selector{margin:0 0 8px 8px;width:20px;height:20px;border-radius:4px;cursor:pointer}.el-color-predefine__color-selector:nth-child(10n+1){margin-left:0}.el-color-predefine__color-selector.selected{box-shadow:0 0 3px 2px var(--el-color-primary)}.el-color-predefine__color-selector>div{display:flex;height:100%;border-radius:3px}.el-color-predefine__color-selector.is-alpha{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.el-color-hue-slider{position:relative;box-sizing:border-box;width:280px;height:12px;background-color:red;padding:0 2px;float:right}.el-color-hue-slider__bar{position:relative;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%);height:100%}.el-color-hue-slider__thumb{position:absolute;cursor:pointer;box-sizing:border-box;left:0;top:0;width:4px;height:100%;border-radius:1px;background:#fff;border:1px solid var(--el-border-color-lighter);box-shadow:0 0 2px #0009;z-index:1}.el-color-hue-slider.is-vertical{width:12px;height:180px;padding:2px 0}.el-color-hue-slider.is-vertical .el-color-hue-slider__bar{background:linear-gradient(to bottom,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}.el-color-hue-slider.is-vertical .el-color-hue-slider__thumb{left:0;top:0;width:100%;height:4px}.el-color-svpanel{position:relative;width:280px;height:180px}.el-color-svpanel__black,.el-color-svpanel__white{position:absolute;top:0;left:0;right:0;bottom:0}.el-color-svpanel__white{background:linear-gradient(to right,#fff,rgba(255,255,255,0))}.el-color-svpanel__black{background:linear-gradient(to top,#000,rgba(0,0,0,0))}.el-color-svpanel__cursor{position:absolute}.el-color-svpanel__cursor>div{cursor:head;width:4px;height:4px;box-shadow:0 0 0 1.5px #fff,inset 0 0 1px 1px #0000004d,0 0 1px 2px #0006;border-radius:50%;transform:translate(-2px,-2px)}.el-color-alpha-slider{position:relative;box-sizing:border-box;width:280px;height:12px;background-image:linear-gradient(45deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(45deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%);background-size:12px 12px;background-position:0 0,6px 0,6px -6px,0 6px}.el-color-alpha-slider__bar{position:relative;background:linear-gradient(to right,rgba(255,255,255,0) 0,var(--el-bg-color) 100%);height:100%}.el-color-alpha-slider__thumb{position:absolute;cursor:pointer;box-sizing:border-box;left:0;top:0;width:4px;height:100%;border-radius:1px;background:#fff;border:1px solid var(--el-border-color-lighter);box-shadow:0 0 2px #0009;z-index:1}.el-color-alpha-slider.is-vertical{width:20px;height:180px}.el-color-alpha-slider.is-vertical .el-color-alpha-slider__bar{background:linear-gradient(to bottom,rgba(255,255,255,0) 0,#fff 100%)}.el-color-alpha-slider.is-vertical .el-color-alpha-slider__thumb{left:0;top:0;width:100%;height:4px}.el-color-dropdown{width:300px}.el-color-dropdown__main-wrapper{margin-bottom:6px}.el-color-dropdown__main-wrapper:after{content:"";display:table;clear:both}.el-color-dropdown__btns{margin-top:12px;text-align:right}.el-color-dropdown__value{float:left;line-height:26px;font-size:12px;color:#000;width:160px}.el-color-picker{display:inline-block;position:relative;line-height:normal;outline:0}.el-color-picker:hover:not(.is-disabled) .el-color-picker__trigger{border:1px solid var(--el-border-color-hover)}.el-color-picker:focus-visible:not(.is-disabled) .el-color-picker__trigger{outline:2px solid var(--el-color-primary);outline-offset:1px}.el-color-picker.is-disabled .el-color-picker__trigger{cursor:not-allowed}.el-color-picker--large{height:40px}.el-color-picker--large .el-color-picker__trigger{height:40px;width:40px}.el-color-picker--large .el-color-picker__mask{height:38px;width:38px}.el-color-picker--small{height:24px}.el-color-picker--small .el-color-picker__trigger{height:24px;width:24px}.el-color-picker--small .el-color-picker__mask{height:22px;width:22px}.el-color-picker--small .el-color-picker__empty,.el-color-picker--small .el-color-picker__icon{transform:scale(.8)}.el-color-picker__mask{height:30px;width:30px;border-radius:4px;position:absolute;top:1px;left:1px;z-index:1;cursor:not-allowed;background-color:#ffffffb3}.el-color-picker__trigger{display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;height:32px;width:32px;padding:4px;border:1px solid var(--el-border-color);border-radius:4px;font-size:0;position:relative;cursor:pointer}.el-color-picker__color{position:relative;display:block;box-sizing:border-box;border:1px solid var(--el-text-color-secondary);border-radius:var(--el-border-radius-small);width:100%;height:100%;text-align:center}.el-color-picker__color.is-alpha{background-image:linear-gradient(45deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(45deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%);background-size:12px 12px;background-position:0 0,6px 0,6px -6px,0 6px}.el-color-picker__color-inner{display:inline-flex;justify-content:center;align-items:center;width:100%;height:100%}.el-color-picker .el-color-picker__empty{font-size:12px;color:var(--el-text-color-secondary)}.el-color-picker .el-color-picker__icon{display:inline-flex;justify-content:center;align-items:center;color:#fff;font-size:12px}.el-color-picker__panel{position:absolute;z-index:10;padding:6px;box-sizing:content-box;background-color:#fff;border-radius:var(--el-border-radius-base);box-shadow:var(--el-box-shadow-light)}.el-color-picker__panel.el-popper{border:1px solid var(--el-border-color-lighter)}.el-color-picker,.el-color-picker__panel{--el-color-picker-alpha-bg-a:#ccc;--el-color-picker-alpha-bg-b:transparent}.dark .el-color-picker,.dark .el-color-picker__panel{--el-color-picker-alpha-bg-a:#333333}.el-container{display:flex;flex-direction:row;flex:1;flex-basis:auto;box-sizing:border-box;min-width:0}.el-container.is-vertical{flex-direction:column}.el-date-table{font-size:12px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-date-table.is-week-mode .el-date-table__row:hover .el-date-table-cell{background-color:var(--el-datepicker-inrange-bg-color)}.el-date-table.is-week-mode .el-date-table__row:hover td.available:hover{color:var(--el-datepicker-text-color)}.el-date-table.is-week-mode .el-date-table__row:hover td:first-child .el-date-table-cell{margin-left:5px;border-top-left-radius:15px;border-bottom-left-radius:15px}.el-date-table.is-week-mode .el-date-table__row:hover td:last-child .el-date-table-cell{margin-right:5px;border-top-right-radius:15px;border-bottom-right-radius:15px}.el-date-table.is-week-mode .el-date-table__row.current .el-date-table-cell{background-color:var(--el-datepicker-inrange-bg-color)}.el-date-table td{width:32px;height:30px;padding:4px 0;box-sizing:border-box;text-align:center;cursor:pointer;position:relative}.el-date-table td .el-date-table-cell{height:30px;padding:3px 0;box-sizing:border-box}.el-date-table td .el-date-table-cell .el-date-table-cell__text{width:24px;height:24px;display:block;margin:0 auto;line-height:24px;position:absolute;left:50%;transform:translate(-50%);border-radius:50%}.el-date-table td.next-month,.el-date-table td.prev-month{color:var(--el-datepicker-off-text-color)}.el-date-table td.today{position:relative}.el-date-table td.today .el-date-table-cell__text{color:var(--el-color-primary);font-weight:700}.el-date-table td.today.end-date .el-date-table-cell__text,.el-date-table td.today.start-date .el-date-table-cell__text{color:#fff}.el-date-table td.available:hover{color:var(--el-datepicker-hover-text-color)}.el-date-table td.in-range .el-date-table-cell{background-color:var(--el-datepicker-inrange-bg-color)}.el-date-table td.in-range .el-date-table-cell:hover{background-color:var(--el-datepicker-inrange-hover-bg-color)}.el-date-table td.current:not(.disabled) .el-date-table-cell__text{color:#fff;background-color:var(--el-datepicker-active-color)}.el-date-table td.current:not(.disabled):focus-visible .el-date-table-cell__text{outline:2px solid var(--el-datepicker-active-color);outline-offset:1px}.el-date-table td.end-date .el-date-table-cell,.el-date-table td.start-date .el-date-table-cell{color:#fff}.el-date-table td.end-date .el-date-table-cell__text,.el-date-table td.start-date .el-date-table-cell__text{background-color:var(--el-datepicker-active-color)}.el-date-table td.start-date .el-date-table-cell{margin-left:5px;border-top-left-radius:15px;border-bottom-left-radius:15px}.el-date-table td.end-date .el-date-table-cell{margin-right:5px;border-top-right-radius:15px;border-bottom-right-radius:15px}.el-date-table td.disabled .el-date-table-cell{background-color:var(--el-fill-color-light);opacity:1;cursor:not-allowed;color:var(--el-text-color-placeholder)}.el-date-table td.selected .el-date-table-cell{margin-left:5px;margin-right:5px;background-color:var(--el-datepicker-inrange-bg-color);border-radius:15px}.el-date-table td.selected .el-date-table-cell:hover{background-color:var(--el-datepicker-inrange-hover-bg-color)}.el-date-table td.selected .el-date-table-cell__text{background-color:var(--el-datepicker-active-color);color:#fff;border-radius:15px}.el-date-table td.week{font-size:80%;color:var(--el-datepicker-header-text-color)}.el-date-table td:focus{outline:0}.el-date-table th{padding:5px;color:var(--el-datepicker-header-text-color);font-weight:400;border-bottom:solid 1px var(--el-border-color-lighter)}.el-month-table{font-size:12px;margin:-1px;border-collapse:collapse}.el-month-table td{text-align:center;padding:8px 0;cursor:pointer}.el-month-table td div{height:48px;padding:6px 0;box-sizing:border-box}.el-month-table td.today .cell{color:var(--el-color-primary);font-weight:700}.el-month-table td.today.end-date .cell,.el-month-table td.today.start-date .cell{color:#fff}.el-month-table td.disabled .cell{background-color:var(--el-fill-color-light);cursor:not-allowed;color:var(--el-text-color-placeholder)}.el-month-table td.disabled .cell:hover{color:var(--el-text-color-placeholder)}.el-month-table td .cell{width:60px;height:36px;display:block;line-height:36px;color:var(--el-datepicker-text-color);margin:0 auto;border-radius:18px}.el-month-table td .cell:hover{color:var(--el-datepicker-hover-text-color)}.el-month-table td.in-range div{background-color:var(--el-datepicker-inrange-bg-color)}.el-month-table td.in-range div:hover{background-color:var(--el-datepicker-inrange-hover-bg-color)}.el-month-table td.end-date div,.el-month-table td.start-date div{color:#fff}.el-month-table td.end-date .cell,.el-month-table td.start-date .cell{color:#fff;background-color:var(--el-datepicker-active-color)}.el-month-table td.start-date div{border-top-left-radius:24px;border-bottom-left-radius:24px}.el-month-table td.end-date div{border-top-right-radius:24px;border-bottom-right-radius:24px}.el-month-table td.current:not(.disabled) .cell{color:var(--el-datepicker-active-color)}.el-month-table td:focus-visible{outline:0}.el-month-table td:focus-visible .cell{outline:2px solid var(--el-datepicker-active-color)}.el-year-table{font-size:12px;margin:-1px;border-collapse:collapse}.el-year-table .el-icon{color:var(--el-datepicker-icon-color)}.el-year-table td{text-align:center;padding:20px 3px;cursor:pointer}.el-year-table td.today .cell{color:var(--el-color-primary);font-weight:700}.el-year-table td.disabled .cell{background-color:var(--el-fill-color-light);cursor:not-allowed;color:var(--el-text-color-placeholder)}.el-year-table td.disabled .cell:hover{color:var(--el-text-color-placeholder)}.el-year-table td .cell{width:48px;height:36px;display:block;line-height:36px;color:var(--el-datepicker-text-color);border-radius:18px;margin:0 auto}.el-year-table td .cell:hover{color:var(--el-datepicker-hover-text-color)}.el-year-table td.current:not(.disabled) .cell{color:var(--el-datepicker-active-color)}.el-year-table td:focus-visible{outline:0}.el-year-table td:focus-visible .cell{outline:2px solid var(--el-datepicker-active-color)}.el-time-spinner.has-seconds .el-time-spinner__wrapper{width:33.3%}.el-time-spinner__wrapper{max-height:192px;overflow:auto;display:inline-block;width:50%;vertical-align:top;position:relative}.el-time-spinner__wrapper.el-scrollbar__wrap:not(.el-scrollbar__wrap--hidden-default){padding-bottom:15px}.el-time-spinner__wrapper.is-arrow{box-sizing:border-box;text-align:center;overflow:hidden}.el-time-spinner__wrapper.is-arrow .el-time-spinner__list{transform:translateY(-32px)}.el-time-spinner__wrapper.is-arrow .el-time-spinner__item:hover:not(.is-disabled):not(.is-active){background:var(--el-fill-color-light);cursor:default}.el-time-spinner__arrow{font-size:12px;color:var(--el-text-color-secondary);position:absolute;left:0;width:100%;z-index:var(--el-index-normal);text-align:center;height:30px;line-height:30px;cursor:pointer}.el-time-spinner__arrow:hover{color:var(--el-color-primary)}.el-time-spinner__arrow.arrow-up{top:10px}.el-time-spinner__arrow.arrow-down{bottom:10px}.el-time-spinner__input.el-input{width:70%}.el-time-spinner__input.el-input .el-input__inner{padding:0;text-align:center}.el-time-spinner__list{padding:0;margin:0;list-style:none;text-align:center}.el-time-spinner__list:after,.el-time-spinner__list:before{content:"";display:block;width:100%;height:80px}.el-time-spinner__item{height:32px;line-height:32px;font-size:12px;color:var(--el-text-color-regular)}.el-time-spinner__item:hover:not(.is-disabled):not(.is-active){background:var(--el-fill-color-light);cursor:pointer}.el-time-spinner__item.is-active:not(.is-disabled){color:var(--el-text-color-primary);font-weight:700}.el-time-spinner__item.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-picker__popper{--el-datepicker-border-color:var(--el-disabled-border-color)}.el-picker__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-datepicker-border-color);box-shadow:var(--el-box-shadow-light)}.el-picker__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-datepicker-border-color)}.el-picker__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-picker__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-picker__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-picker__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-date-editor{--el-date-editor-width:220px;--el-date-editor-monthrange-width:300px;--el-date-editor-daterange-width:350px;--el-date-editor-datetimerange-width:400px;--el-input-text-color:var(--el-text-color-regular);--el-input-border:var(--el-border);--el-input-hover-border:var(--el-border-color-hover);--el-input-focus-border:var(--el-color-primary);--el-input-transparent-border:0 0 0 1px transparent inset;--el-input-border-color:var(--el-border-color);--el-input-border-radius:var(--el-border-radius-base);--el-input-bg-color:var(--el-fill-color-blank);--el-input-icon-color:var(--el-text-color-placeholder);--el-input-placeholder-color:var(--el-text-color-placeholder);--el-input-hover-border-color:var(--el-border-color-hover);--el-input-clear-hover-color:var(--el-text-color-secondary);--el-input-focus-border-color:var(--el-color-primary);position:relative;display:inline-block;text-align:left}.el-date-editor.el-input__wrapper{box-shadow:0 0 0 1px var(--el-input-border-color,var(--el-border-color)) inset}.el-date-editor.el-input__wrapper:hover{box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-date-editor.el-input,.el-date-editor.el-input__wrapper{width:var(--el-date-editor-width);height:var(--el-input-height,var(--el-component-size))}.el-date-editor--monthrange{--el-date-editor-width:var(--el-date-editor-monthrange-width)}.el-date-editor--daterange,.el-date-editor--timerange{--el-date-editor-width:var(--el-date-editor-daterange-width)}.el-date-editor--datetimerange{--el-date-editor-width:var(--el-date-editor-datetimerange-width)}.el-date-editor--dates .el-input__wrapper{text-overflow:ellipsis;white-space:nowrap}.el-date-editor .close-icon,.el-date-editor .clear-icon{cursor:pointer}.el-date-editor .clear-icon:hover{color:var(--el-text-color-secondary)}.el-date-editor .el-range__icon{height:inherit;font-size:14px;color:var(--el-text-color-placeholder);float:left}.el-date-editor .el-range__icon svg{vertical-align:middle}.el-date-editor .el-range-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;outline:0;display:inline-block;height:30px;line-height:30px;margin:0;padding:0;width:39%;text-align:center;font-size:var(--el-font-size-base);color:var(--el-text-color-regular);background-color:transparent}.el-date-editor .el-range-input::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-date-editor .el-range-input:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-date-editor .el-range-input::placeholder{color:var(--el-text-color-placeholder)}.el-date-editor .el-range-separator{flex:1;display:inline-flex;justify-content:center;align-items:center;height:100%;padding:0 5px;margin:0;font-size:14px;word-break:keep-all;color:var(--el-text-color-primary)}.el-date-editor .el-range__close-icon{font-size:14px;color:var(--el-text-color-placeholder);height:inherit;width:unset;cursor:pointer}.el-date-editor .el-range__close-icon:hover{color:var(--el-text-color-secondary)}.el-date-editor .el-range__close-icon svg{vertical-align:middle}.el-date-editor .el-range__close-icon--hidden{opacity:0;visibility:hidden}.el-range-editor.el-input__wrapper{display:inline-flex;align-items:center;padding:0 10px}.el-range-editor.is-active,.el-range-editor.is-active:hover{box-shadow:0 0 0 1px var(--el-input-focus-border-color) inset}.el-range-editor--large{line-height:var(--el-component-size-large)}.el-range-editor--large.el-input__wrapper{height:var(--el-component-size-large)}.el-range-editor--large .el-range-separator{line-height:40px;font-size:14px}.el-range-editor--large .el-range-input{height:38px;line-height:38px;font-size:14px}.el-range-editor--small{line-height:var(--el-component-size-small)}.el-range-editor--small.el-input__wrapper{height:var(--el-component-size-small)}.el-range-editor--small .el-range-separator{line-height:24px;font-size:12px}.el-range-editor--small .el-range-input{height:22px;line-height:22px;font-size:12px}.el-range-editor.is-disabled{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color);color:var(--el-disabled-text-color);cursor:not-allowed}.el-range-editor.is-disabled:focus,.el-range-editor.is-disabled:hover{border-color:var(--el-disabled-border-color)}.el-range-editor.is-disabled input{background-color:var(--el-disabled-bg-color);color:var(--el-disabled-text-color);cursor:not-allowed}.el-range-editor.is-disabled input::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-range-editor.is-disabled input:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-range-editor.is-disabled input::placeholder{color:var(--el-text-color-placeholder)}.el-range-editor.is-disabled .el-range-separator{color:var(--el-disabled-text-color)}.el-picker-panel{color:var(--el-text-color-regular);background:var(--el-bg-color-overlay);border-radius:var(--el-border-radius-base);line-height:30px}.el-picker-panel .el-time-panel{margin:5px 0;border:solid 1px var(--el-datepicker-border-color);background-color:var(--el-bg-color-overlay);box-shadow:var(--el-box-shadow-light)}.el-picker-panel__body-wrapper:after,.el-picker-panel__body:after{content:"";display:table;clear:both}.el-picker-panel__content{position:relative;margin:15px}.el-picker-panel__footer{border-top:1px solid var(--el-datepicker-inner-border-color);padding:4px 12px;text-align:right;background-color:var(--el-bg-color-overlay);position:relative;font-size:0}.el-picker-panel__shortcut{display:block;width:100%;border:0;background-color:transparent;line-height:28px;font-size:14px;color:var(--el-datepicker-text-color);padding-left:12px;text-align:left;outline:0;cursor:pointer}.el-picker-panel__shortcut:hover{color:var(--el-datepicker-hover-text-color)}.el-picker-panel__shortcut.active{background-color:#e6f1fe;color:var(--el-datepicker-active-color)}.el-picker-panel__btn{border:1px solid var(--el-fill-color-darker);color:var(--el-text-color-primary);line-height:24px;border-radius:2px;padding:0 20px;cursor:pointer;background-color:transparent;outline:0;font-size:12px}.el-picker-panel__btn[disabled]{color:var(--el-text-color-disabled);cursor:not-allowed}.el-picker-panel__icon-btn{font-size:12px;color:var(--el-datepicker-icon-color);border:0;background:0 0;cursor:pointer;outline:0;margin-top:8px}.el-picker-panel__icon-btn:hover{color:var(--el-datepicker-hover-text-color)}.el-picker-panel__icon-btn:focus-visible{color:var(--el-datepicker-hover-text-color)}.el-picker-panel__icon-btn.is-disabled{color:var(--el-text-color-disabled)}.el-picker-panel__icon-btn.is-disabled:hover{cursor:not-allowed}.el-picker-panel__icon-btn .el-icon{cursor:pointer;font-size:inherit}.el-picker-panel__link-btn{vertical-align:middle}.el-picker-panel [slot=sidebar],.el-picker-panel__sidebar{position:absolute;top:0;bottom:0;width:110px;border-right:1px solid var(--el-datepicker-inner-border-color);box-sizing:border-box;padding-top:6px;background-color:var(--el-bg-color-overlay);overflow:auto}.el-picker-panel [slot=sidebar]+.el-picker-panel__body,.el-picker-panel__sidebar+.el-picker-panel__body{margin-left:110px}.el-date-picker{--el-datepicker-text-color:var(--el-text-color-regular);--el-datepicker-off-text-color:var(--el-text-color-placeholder);--el-datepicker-header-text-color:var(--el-text-color-regular);--el-datepicker-icon-color:var(--el-text-color-primary);--el-datepicker-border-color:var(--el-disabled-border-color);--el-datepicker-inner-border-color:var(--el-border-color-light);--el-datepicker-inrange-bg-color:var(--el-border-color-extra-light);--el-datepicker-inrange-hover-bg-color:var(--el-border-color-extra-light);--el-datepicker-active-color:var(--el-color-primary);--el-datepicker-hover-text-color:var(--el-color-primary)}.el-date-picker{width:322px}.el-date-picker.has-sidebar.has-time{width:434px}.el-date-picker.has-sidebar{width:438px}.el-date-picker.has-time .el-picker-panel__body-wrapper{position:relative}.el-date-picker .el-picker-panel__content{width:292px}.el-date-picker table{table-layout:fixed;width:100%}.el-date-picker__editor-wrap{position:relative;display:table-cell;padding:0 5px}.el-date-picker__time-header{position:relative;border-bottom:1px solid var(--el-datepicker-inner-border-color);font-size:12px;padding:8px 5px 5px;display:table;width:100%;box-sizing:border-box}.el-date-picker__header{margin:12px;text-align:center}.el-date-picker__header--bordered{margin-bottom:0;padding-bottom:12px;border-bottom:solid 1px var(--el-border-color-lighter)}.el-date-picker__header--bordered+.el-picker-panel__content{margin-top:0}.el-date-picker__header-label{font-size:16px;font-weight:500;padding:0 5px;line-height:22px;text-align:center;cursor:pointer;color:var(--el-text-color-regular)}.el-date-picker__header-label:hover{color:var(--el-datepicker-hover-text-color)}.el-date-picker__header-label:focus-visible{outline:0;color:var(--el-datepicker-hover-text-color)}.el-date-picker__header-label.active{color:var(--el-datepicker-active-color)}.el-date-picker__prev-btn{float:left}.el-date-picker__next-btn{float:right}.el-date-picker__time-wrap{padding:10px;text-align:center}.el-date-picker__time-label{float:left;cursor:pointer;line-height:30px;margin-left:10px}.el-date-picker .el-time-panel{position:absolute}.el-date-range-picker{--el-datepicker-text-color:var(--el-text-color-regular);--el-datepicker-off-text-color:var(--el-text-color-placeholder);--el-datepicker-header-text-color:var(--el-text-color-regular);--el-datepicker-icon-color:var(--el-text-color-primary);--el-datepicker-border-color:var(--el-disabled-border-color);--el-datepicker-inner-border-color:var(--el-border-color-light);--el-datepicker-inrange-bg-color:var(--el-border-color-extra-light);--el-datepicker-inrange-hover-bg-color:var(--el-border-color-extra-light);--el-datepicker-active-color:var(--el-color-primary);--el-datepicker-hover-text-color:var(--el-color-primary)}.el-date-range-picker{width:646px}.el-date-range-picker.has-sidebar{width:756px}.el-date-range-picker.has-time .el-picker-panel__body-wrapper{position:relative}.el-date-range-picker table{table-layout:fixed;width:100%}.el-date-range-picker .el-picker-panel__body{min-width:513px}.el-date-range-picker .el-picker-panel__content{margin:0}.el-date-range-picker__header{position:relative;text-align:center;height:28px}.el-date-range-picker__header [class*=arrow-left]{float:left}.el-date-range-picker__header [class*=arrow-right]{float:right}.el-date-range-picker__header div{font-size:16px;font-weight:500;margin-right:50px}.el-date-range-picker__content{float:left;width:50%;box-sizing:border-box;margin:0;padding:16px}.el-date-range-picker__content.is-left{border-right:1px solid var(--el-datepicker-inner-border-color)}.el-date-range-picker__content .el-date-range-picker__header div{margin-left:50px;margin-right:50px}.el-date-range-picker__editors-wrap{box-sizing:border-box;display:table-cell}.el-date-range-picker__editors-wrap.is-right{text-align:right}.el-date-range-picker__time-header{position:relative;border-bottom:1px solid var(--el-datepicker-inner-border-color);font-size:12px;padding:8px 5px 5px;display:table;width:100%;box-sizing:border-box}.el-date-range-picker__time-header>.el-icon-arrow-right{font-size:20px;vertical-align:middle;display:table-cell;color:var(--el-datepicker-icon-color)}.el-date-range-picker__time-picker-wrap{position:relative;display:table-cell;padding:0 5px}.el-date-range-picker__time-picker-wrap .el-picker-panel{position:absolute;top:13px;right:0;z-index:1;background:#fff}.el-date-range-picker__time-picker-wrap .el-time-panel{position:absolute}.el-time-range-picker{width:354px;overflow:visible}.el-time-range-picker__content{position:relative;text-align:center;padding:10px;z-index:1}.el-time-range-picker__cell{box-sizing:border-box;margin:0;padding:4px 7px 7px;width:50%;display:inline-block}.el-time-range-picker__header{margin-bottom:5px;text-align:center;font-size:14px}.el-time-range-picker__body{border-radius:2px;border:1px solid var(--el-datepicker-border-color)}.el-time-panel{border-radius:2px;position:relative;width:180px;left:0;z-index:var(--el-index-top);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:content-box}.el-time-panel__content{font-size:0;position:relative;overflow:hidden}.el-time-panel__content:after,.el-time-panel__content:before{content:"";top:50%;position:absolute;margin-top:-16px;height:32px;z-index:-1;left:0;right:0;box-sizing:border-box;padding-top:6px;text-align:left}.el-time-panel__content:after{left:50%;margin-left:12%;margin-right:12%}.el-time-panel__content:before{padding-left:50%;margin-right:12%;margin-left:12%;border-top:1px solid var(--el-border-color-light);border-bottom:1px solid var(--el-border-color-light)}.el-time-panel__content.has-seconds:after{left:66.6666666667%}.el-time-panel__content.has-seconds:before{padding-left:33.3333333333%}.el-time-panel__footer{border-top:1px solid var(--el-timepicker-inner-border-color,var(--el-border-color-light));padding:4px;height:36px;line-height:25px;text-align:right;box-sizing:border-box}.el-time-panel__btn{border:none;line-height:28px;padding:0 5px;margin:0 5px;cursor:pointer;background-color:transparent;outline:0;font-size:12px;color:var(--el-text-color-primary)}.el-time-panel__btn.confirm{font-weight:800;color:var(--el-timepicker-active-color,var(--el-color-primary))}.el-descriptions{--el-descriptions-table-border:1px solid var(--el-border-color-lighter);--el-descriptions-item-bordered-label-background:var(--el-fill-color-light);box-sizing:border-box;font-size:var(--el-font-size-base);color:var(--el-text-color-primary)}.el-descriptions__header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.el-descriptions__title{color:var(--el-text-color-primary);font-size:16px;font-weight:700}.el-descriptions__body{background-color:var(--el-fill-color-blank)}.el-descriptions__body .el-descriptions__table{border-collapse:collapse;width:100%}.el-descriptions__body .el-descriptions__table .el-descriptions__cell{box-sizing:border-box;text-align:left;font-weight:400;line-height:23px;font-size:14px}.el-descriptions__body .el-descriptions__table .el-descriptions__cell.is-left{text-align:left}.el-descriptions__body .el-descriptions__table .el-descriptions__cell.is-center{text-align:center}.el-descriptions__body .el-descriptions__table .el-descriptions__cell.is-right{text-align:right}.el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell{border:var(--el-descriptions-table-border);padding:8px 11px}.el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell{padding-bottom:12px}.el-descriptions--large{font-size:14px}.el-descriptions--large .el-descriptions__header{margin-bottom:20px}.el-descriptions--large .el-descriptions__header .el-descriptions__title{font-size:16px}.el-descriptions--large .el-descriptions__body .el-descriptions__table .el-descriptions__cell{font-size:14px}.el-descriptions--large .el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell{padding:12px 15px}.el-descriptions--large .el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell{padding-bottom:16px}.el-descriptions--small{font-size:12px}.el-descriptions--small .el-descriptions__header{margin-bottom:12px}.el-descriptions--small .el-descriptions__header .el-descriptions__title{font-size:14px}.el-descriptions--small .el-descriptions__body .el-descriptions__table .el-descriptions__cell{font-size:12px}.el-descriptions--small .el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell{padding:4px 7px}.el-descriptions--small .el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell{padding-bottom:8px}.el-descriptions__label.el-descriptions__cell.is-bordered-label{font-weight:700;color:var(--el-text-color-regular);background:var(--el-descriptions-item-bordered-label-background)}.el-descriptions__label:not(.is-bordered-label){color:var(--el-text-color-primary);margin-right:16px}.el-descriptions__label.el-descriptions__cell:not(.is-bordered-label).is-vertical-label{padding-bottom:6px}.el-descriptions__content.el-descriptions__cell.is-bordered-content{color:var(--el-text-color-primary)}.el-descriptions__content:not(.is-bordered-label){color:var(--el-text-color-regular)}.el-descriptions--large .el-descriptions__label:not(.is-bordered-label){margin-right:16px}.el-descriptions--large .el-descriptions__label.el-descriptions__cell:not(.is-bordered-label).is-vertical-label{padding-bottom:8px}.el-descriptions--small .el-descriptions__label:not(.is-bordered-label){margin-right:12px}.el-descriptions--small .el-descriptions__label.el-descriptions__cell:not(.is-bordered-label).is-vertical-label{padding-bottom:4px}:root{--el-popup-modal-bg-color:var(--el-color-black);--el-popup-modal-opacity:.5}.v-modal-enter{-webkit-animation:v-modal-in var(--el-transition-duration-fast) ease;animation:v-modal-in var(--el-transition-duration-fast) ease}.v-modal-leave{-webkit-animation:v-modal-out var(--el-transition-duration-fast) ease forwards;animation:v-modal-out var(--el-transition-duration-fast) ease forwards}@-webkit-keyframes v-modal-in{0%{opacity:0}}@keyframes v-modal-in{0%{opacity:0}}@-webkit-keyframes v-modal-out{to{opacity:0}}@keyframes v-modal-out{to{opacity:0}}.v-modal{position:fixed;left:0;top:0;width:100%;height:100%;opacity:var(--el-popup-modal-opacity);background:var(--el-popup-modal-bg-color)}.el-popup-parent--hidden{overflow:hidden}.el-dialog{--el-dialog-width:50%;--el-dialog-margin-top:15vh;--el-dialog-bg-color:var(--el-bg-color);--el-dialog-box-shadow:var(--el-box-shadow);--el-dialog-title-font-size:var(--el-font-size-large);--el-dialog-content-font-size:14px;--el-dialog-font-line-height:var(--el-font-line-height-primary);--el-dialog-padding-primary:20px;--el-dialog-border-radius:var(--el-border-radius-small);position:relative;margin:var(--el-dialog-margin-top,15vh) auto 50px;background:var(--el-dialog-bg-color);border-radius:var(--el-dialog-border-radius);box-shadow:var(--el-dialog-box-shadow);box-sizing:border-box;width:var(--el-dialog-width,50%)}.el-dialog:focus{outline:0!important}.el-dialog.is-align-center{margin:auto}.el-dialog.is-fullscreen{--el-dialog-width:100%;--el-dialog-margin-top:0;margin-bottom:0;height:100%;overflow:auto}.el-dialog__wrapper{position:fixed;top:0;right:0;bottom:0;left:0;overflow:auto;margin:0}.el-dialog.is-draggable .el-dialog__header{cursor:move;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-dialog__header{padding:var(--el-dialog-padding-primary);padding-bottom:10px;margin-right:16px}.el-dialog__headerbtn{position:absolute;top:6px;right:0;padding:0;width:54px;height:54px;background:0 0;border:none;outline:0;cursor:pointer;font-size:var(--el-message-close-size,16px)}.el-dialog__headerbtn .el-dialog__close{color:var(--el-color-info);font-size:inherit}.el-dialog__headerbtn:focus .el-dialog__close,.el-dialog__headerbtn:hover .el-dialog__close{color:var(--el-color-primary)}.el-dialog__title{line-height:var(--el-dialog-font-line-height);font-size:var(--el-dialog-title-font-size);color:var(--el-text-color-primary)}.el-dialog__body{padding:calc(var(--el-dialog-padding-primary) + 10px) var(--el-dialog-padding-primary);color:var(--el-text-color-regular);font-size:var(--el-dialog-content-font-size)}.el-dialog__footer{padding:var(--el-dialog-padding-primary);padding-top:10px;text-align:right;box-sizing:border-box}.el-dialog--center{text-align:center}.el-dialog--center .el-dialog__body{text-align:initial;padding:25px calc(var(--el-dialog-padding-primary) + 5px) 30px}.el-dialog--center .el-dialog__footer{text-align:inherit}.el-overlay-dialog{position:fixed;top:0;right:0;bottom:0;left:0;overflow:auto}.dialog-fade-enter-active{-webkit-animation:modal-fade-in var(--el-transition-duration);animation:modal-fade-in var(--el-transition-duration)}.dialog-fade-enter-active .el-overlay-dialog{-webkit-animation:dialog-fade-in var(--el-transition-duration);animation:dialog-fade-in var(--el-transition-duration)}.dialog-fade-leave-active{-webkit-animation:modal-fade-out var(--el-transition-duration);animation:modal-fade-out var(--el-transition-duration)}.dialog-fade-leave-active .el-overlay-dialog{-webkit-animation:dialog-fade-out var(--el-transition-duration);animation:dialog-fade-out var(--el-transition-duration)}@-webkit-keyframes dialog-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@keyframes dialog-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@-webkit-keyframes dialog-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@keyframes dialog-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@-webkit-keyframes modal-fade-in{0%{opacity:0}to{opacity:1}}@keyframes modal-fade-in{0%{opacity:0}to{opacity:1}}@-webkit-keyframes modal-fade-out{0%{opacity:1}to{opacity:0}}@keyframes modal-fade-out{0%{opacity:1}to{opacity:0}}.el-divider{position:relative}.el-divider--horizontal{display:block;height:1px;width:100%;margin:24px 0;border-top:1px var(--el-border-color) var(--el-border-style)}.el-divider--vertical{display:inline-block;width:1px;height:1em;margin:0 8px;vertical-align:middle;position:relative;border-left:1px var(--el-border-color) var(--el-border-style)}.el-divider__text{position:absolute;background-color:var(--el-bg-color);padding:0 20px;font-weight:500;color:var(--el-text-color-primary);font-size:14px}.el-divider__text.is-left{left:20px;transform:translateY(-50%)}.el-divider__text.is-center{left:50%;transform:translate(-50%) translateY(-50%)}.el-divider__text.is-right{right:20px;transform:translateY(-50%)}.el-drawer{--el-drawer-bg-color:var(--el-dialog-bg-color, var(--el-bg-color));--el-drawer-padding-primary:var(--el-dialog-padding-primary, 20px)}.el-drawer{position:absolute;box-sizing:border-box;background-color:var(--el-drawer-bg-color);display:flex;flex-direction:column;box-shadow:var(--el-box-shadow-dark);overflow:hidden;transition:all var(--el-transition-duration)}.el-drawer .rtl,.el-drawer .ltr,.el-drawer .ttb,.el-drawer .btt{transform:translate(0)}.el-drawer__sr-focus:focus{outline:0!important}.el-drawer__header{align-items:center;color:#72767b;display:flex;margin-bottom:32px;padding:var(--el-drawer-padding-primary);padding-bottom:0}.el-drawer__header>:first-child{flex:1}.el-drawer__title{margin:0;flex:1;line-height:inherit;font-size:1rem}.el-drawer__footer{padding:var(--el-drawer-padding-primary);padding-top:10px;text-align:right}.el-drawer__close-btn{display:inline-flex;border:none;cursor:pointer;font-size:var(--el-font-size-extra-large);color:inherit;background-color:transparent;outline:0}.el-drawer__close-btn:focus i,.el-drawer__close-btn:hover i{color:var(--el-color-primary)}.el-drawer__body{flex:1;padding:var(--el-drawer-padding-primary);overflow:auto}.el-drawer__body>*{box-sizing:border-box}.el-drawer.ltr,.el-drawer.rtl{height:100%;top:0;bottom:0}.el-drawer.btt,.el-drawer.ttb{width:100%;left:0;right:0}.el-drawer.ltr{left:0}.el-drawer.rtl{right:0}.el-drawer.ttb{top:0}.el-drawer.btt{bottom:0}.el-drawer-fade-enter-active,.el-drawer-fade-leave-active{transition:all var(--el-transition-duration)}.el-drawer-fade-enter-active,.el-drawer-fade-enter-from,.el-drawer-fade-enter-to,.el-drawer-fade-leave-active,.el-drawer-fade-leave-from,.el-drawer-fade-leave-to{overflow:hidden!important}.el-drawer-fade-enter-from,.el-drawer-fade-leave-to{opacity:0}.el-drawer-fade-enter-to,.el-drawer-fade-leave-from{opacity:1}.el-drawer-fade-enter-from .rtl,.el-drawer-fade-leave-to .rtl{transform:translate(100%)}.el-drawer-fade-enter-from .ltr,.el-drawer-fade-leave-to .ltr{transform:translate(-100%)}.el-drawer-fade-enter-from .ttb,.el-drawer-fade-leave-to .ttb{transform:translateY(-100%)}.el-drawer-fade-enter-from .btt,.el-drawer-fade-leave-to .btt{transform:translateY(100%)}.el-dropdown{--el-dropdown-menu-box-shadow:var(--el-box-shadow-light);--el-dropdown-menuItem-hover-fill:var(--el-color-primary-light-9);--el-dropdown-menuItem-hover-color:var(--el-color-primary);--el-dropdown-menu-index:10;display:inline-flex;position:relative;color:var(--el-text-color-regular);font-size:var(--el-font-size-base);line-height:1;vertical-align:top}.el-dropdown.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-dropdown__popper{--el-dropdown-menu-box-shadow:var(--el-box-shadow-light);--el-dropdown-menuItem-hover-fill:var(--el-color-primary-light-9);--el-dropdown-menuItem-hover-color:var(--el-color-primary);--el-dropdown-menu-index:10}.el-dropdown__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-dropdown-menu-box-shadow)}.el-dropdown__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-dropdown__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-dropdown__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-dropdown__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-dropdown__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-dropdown__popper .el-dropdown-menu{border:none}.el-dropdown__popper .el-dropdown__popper-selfdefine{outline:0}.el-dropdown__popper .el-scrollbar__bar{z-index:calc(var(--el-dropdown-menu-index) + 1)}.el-dropdown__popper .el-dropdown__list{list-style:none;padding:0;margin:0;box-sizing:border-box}.el-dropdown .el-dropdown__caret-button{padding-left:0;padding-right:0;display:inline-flex;justify-content:center;align-items:center;width:32px;border-left:none}.el-dropdown .el-dropdown__caret-button>span{display:inline-flex}.el-dropdown .el-dropdown__caret-button:before{content:"";position:absolute;display:block;width:1px;top:-1px;bottom:-1px;left:0;background:var(--el-overlay-color-lighter)}.el-dropdown .el-dropdown__caret-button.el-button:before{background:var(--el-border-color);opacity:.5}.el-dropdown .el-dropdown__caret-button .el-dropdown__icon{font-size:inherit;padding-left:0}.el-dropdown .el-dropdown-selfdefine{outline:0}.el-dropdown--large .el-dropdown__caret-button{width:40px}.el-dropdown--small .el-dropdown__caret-button{width:24px}.el-dropdown-menu{position:relative;top:0;left:0;z-index:var(--el-dropdown-menu-index);padding:5px 0;margin:0;background-color:var(--el-bg-color-overlay);border:none;border-radius:var(--el-border-radius-base);box-shadow:none;list-style:none}.el-dropdown-menu__item{display:flex;align-items:center;white-space:nowrap;list-style:none;line-height:22px;padding:5px 16px;margin:0;font-size:var(--el-font-size-base);color:var(--el-text-color-regular);cursor:pointer;outline:0}.el-dropdown-menu__item:not(.is-disabled):focus{background-color:var(--el-dropdown-menuItem-hover-fill);color:var(--el-dropdown-menuItem-hover-color)}.el-dropdown-menu__item i{margin-right:5px}.el-dropdown-menu__item--divided{margin:6px 0;border-top:1px solid var(--el-border-color-lighter)}.el-dropdown-menu__item.is-disabled{cursor:not-allowed;color:var(--el-text-color-disabled)}.el-dropdown-menu--large{padding:7px 0}.el-dropdown-menu--large .el-dropdown-menu__item{padding:7px 20px;line-height:22px;font-size:14px}.el-dropdown-menu--large .el-dropdown-menu__item--divided{margin:8px 0}.el-dropdown-menu--small{padding:3px 0}.el-dropdown-menu--small .el-dropdown-menu__item{padding:2px 12px;line-height:20px;font-size:12px}.el-dropdown-menu--small .el-dropdown-menu__item--divided{margin:4px 0}.el-empty{--el-empty-padding:40px 0;--el-empty-image-width:160px;--el-empty-description-margin-top:20px;--el-empty-bottom-margin-top:20px;--el-empty-fill-color-0:var(--el-color-white);--el-empty-fill-color-1:#fcfcfd;--el-empty-fill-color-2:#f8f9fb;--el-empty-fill-color-3:#f7f8fc;--el-empty-fill-color-4:#eeeff3;--el-empty-fill-color-5:#edeef2;--el-empty-fill-color-6:#e9ebef;--el-empty-fill-color-7:#e5e7e9;--el-empty-fill-color-8:#e0e3e9;--el-empty-fill-color-9:#d5d7de;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;box-sizing:border-box;padding:var(--el-empty-padding)}.el-empty__image{width:var(--el-empty-image-width)}.el-empty__image img{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%;height:100%;vertical-align:top;-o-object-fit:contain;object-fit:contain}.el-empty__image svg{color:var(--el-svg-monochrome-grey);fill:currentColor;width:100%;height:100%;vertical-align:top}.el-empty__description{margin-top:var(--el-empty-description-margin-top)}.el-empty__description p{margin:0;font-size:var(--el-font-size-base);color:var(--el-text-color-secondary)}.el-empty__bottom{margin-top:var(--el-empty-bottom-margin-top)}.el-footer{--el-footer-padding:0 20px;--el-footer-height:60px;padding:var(--el-footer-padding);box-sizing:border-box;flex-shrink:0;height:var(--el-footer-height)}.el-form{--el-form-label-font-size:var(--el-font-size-base)}.el-form--label-left .el-form-item__label{justify-content:flex-start}.el-form--label-top .el-form-item{display:block}.el-form--label-top .el-form-item .el-form-item__label{display:block;height:auto;text-align:left;margin-bottom:8px;line-height:22px}.el-form--inline .el-form-item{display:inline-flex;vertical-align:middle;margin-right:32px}.el-form--inline.el-form--label-top{display:flex;flex-wrap:wrap}.el-form--inline.el-form--label-top .el-form-item{display:block}.el-form--large.el-form--label-top .el-form-item .el-form-item__label{margin-bottom:12px;line-height:22px}.el-form--default.el-form--label-top .el-form-item .el-form-item__label{margin-bottom:8px;line-height:22px}.el-form--small.el-form--label-top .el-form-item .el-form-item__label{margin-bottom:4px;line-height:20px}.el-form-item{display:flex;--font-size:14px;margin-bottom:18px}.el-form-item .el-form-item{margin-bottom:0}.el-form-item .el-input__validateIcon{display:none}.el-form-item--large{--font-size:14px;--el-form-label-font-size:var(--font-size);margin-bottom:22px}.el-form-item--large .el-form-item__label{height:40px;line-height:40px}.el-form-item--large .el-form-item__content{line-height:40px}.el-form-item--large .el-form-item__error{padding-top:4px}.el-form-item--default{--font-size:14px;--el-form-label-font-size:var(--font-size);margin-bottom:18px}.el-form-item--default .el-form-item__label{height:32px;line-height:32px}.el-form-item--default .el-form-item__content{line-height:32px}.el-form-item--default .el-form-item__error{padding-top:2px}.el-form-item--small{--font-size:12px;--el-form-label-font-size:var(--font-size);margin-bottom:18px}.el-form-item--small .el-form-item__label{height:24px;line-height:24px}.el-form-item--small .el-form-item__content{line-height:24px}.el-form-item--small .el-form-item__error{padding-top:2px}.el-form-item__label-wrap{display:flex}.el-form-item__label{display:inline-flex;justify-content:flex-end;align-items:flex-start;flex:0 0 auto;font-size:var(--el-form-label-font-size);color:var(--el-text-color-regular);height:32px;line-height:32px;padding:0 12px 0 0;box-sizing:border-box}.el-form-item__content{display:flex;flex-wrap:wrap;align-items:center;flex:1;line-height:32px;position:relative;font-size:var(--font-size);min-width:0}.el-form-item__content .el-input-group{vertical-align:top}.el-form-item__error{color:var(--el-color-danger);font-size:12px;line-height:1;padding-top:2px;position:absolute;top:100%;left:0}.el-form-item__error--inline{position:relative;top:auto;left:auto;display:inline-block;margin-left:10px}.el-form-item.is-required:not(.is-no-asterisk).asterisk-left>.el-form-item__label-wrap>.el-form-item__label:before,.el-form-item.is-required:not(.is-no-asterisk).asterisk-left>.el-form-item__label:before{content:"*";color:var(--el-color-danger);margin-right:4px}.el-form-item.is-required:not(.is-no-asterisk).asterisk-right>.el-form-item__label-wrap>.el-form-item__label:after,.el-form-item.is-required:not(.is-no-asterisk).asterisk-right>.el-form-item__label:after{content:"*";color:var(--el-color-danger);margin-left:4px}.el-form-item.is-error .el-select-v2__wrapper,.el-form-item.is-error .el-select-v2__wrapper:focus,.el-form-item.is-error .el-textarea__inner,.el-form-item.is-error .el-textarea__inner:focus{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-form-item.is-error .el-input__wrapper{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-form-item.is-error .el-input-group__append .el-input__wrapper,.el-form-item.is-error .el-input-group__prepend .el-input__wrapper{box-shadow:0 0 0 1px transparent inset}.el-form-item.is-error .el-input__validateIcon{color:var(--el-color-danger)}.el-form-item--feedback .el-input__validateIcon{display:inline-flex}.el-header{--el-header-padding:0 20px;--el-header-height:60px;padding:var(--el-header-padding);box-sizing:border-box;flex-shrink:0;height:var(--el-header-height)}.el-image-viewer__wrapper{position:fixed;top:0;right:0;bottom:0;left:0}.el-image-viewer__btn{position:absolute;z-index:1;display:flex;align-items:center;justify-content:center;border-radius:50%;opacity:.8;cursor:pointer;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-image-viewer__btn .el-icon{font-size:inherit;cursor:pointer}.el-image-viewer__close{top:40px;right:40px;width:40px;height:40px;font-size:40px}.el-image-viewer__canvas{position:static;width:100%;height:100%;display:flex;justify-content:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-image-viewer__actions{left:50%;bottom:30px;transform:translate(-50%);width:282px;height:44px;padding:0 23px;background-color:var(--el-text-color-regular);border-color:#fff;border-radius:22px}.el-image-viewer__actions__inner{width:100%;height:100%;text-align:justify;cursor:default;font-size:23px;color:#fff;display:flex;align-items:center;justify-content:space-around}.el-image-viewer__prev{top:50%;transform:translateY(-50%);left:40px;width:44px;height:44px;font-size:24px;color:#fff;background-color:var(--el-text-color-regular);border-color:#fff}.el-image-viewer__next{top:50%;transform:translateY(-50%);right:40px;text-indent:2px;width:44px;height:44px;font-size:24px;color:#fff;background-color:var(--el-text-color-regular);border-color:#fff}.el-image-viewer__close{width:44px;height:44px;font-size:24px;color:#fff;background-color:var(--el-text-color-regular);border-color:#fff}.el-image-viewer__mask{position:absolute;width:100%;height:100%;top:0;left:0;opacity:.5;background:#000}.viewer-fade-enter-active{-webkit-animation:viewer-fade-in var(--el-transition-duration);animation:viewer-fade-in var(--el-transition-duration)}.viewer-fade-leave-active{-webkit-animation:viewer-fade-out var(--el-transition-duration);animation:viewer-fade-out var(--el-transition-duration)}@-webkit-keyframes viewer-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@keyframes viewer-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@-webkit-keyframes viewer-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@keyframes viewer-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}.el-image__error,.el-image__inner,.el-image__placeholder,.el-image__wrapper{width:100%;height:100%}.el-image{position:relative;display:inline-block;overflow:hidden}.el-image__inner{vertical-align:top;opacity:1}.el-image__inner.is-loading{opacity:0}.el-image__wrapper{position:absolute;top:0;left:0}.el-image__placeholder{background:var(--el-fill-color-light)}.el-image__error{display:flex;justify-content:center;align-items:center;font-size:14px;background:var(--el-fill-color-light);color:var(--el-text-color-placeholder);vertical-align:middle}.el-image__preview{cursor:pointer}.el-input-number{position:relative;display:inline-flex;width:150px;line-height:30px}.el-input-number .el-input__wrapper{padding-left:42px;padding-right:42px}.el-input-number .el-input__inner{-webkit-appearance:none;-moz-appearance:textfield;text-align:center;line-height:1}.el-input-number .el-input__inner::-webkit-inner-spin-button,.el-input-number .el-input__inner::-webkit-outer-spin-button{margin:0;-webkit-appearance:none}.el-input-number__decrease,.el-input-number__increase{display:flex;justify-content:center;align-items:center;height:auto;position:absolute;z-index:1;top:1px;bottom:1px;width:32px;background:var(--el-fill-color-light);color:var(--el-text-color-regular);cursor:pointer;font-size:13px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-input-number__decrease:hover,.el-input-number__increase:hover{color:var(--el-color-primary)}.el-input-number__decrease:hover~.el-input:not(.is-disabled) .el-input_wrapper,.el-input-number__increase:hover~.el-input:not(.is-disabled) .el-input_wrapper{box-shadow:0 0 0 1px var(--el-input-focus-border-color,var(--el-color-primary)) inset}.el-input-number__decrease.is-disabled,.el-input-number__increase.is-disabled{color:var(--el-disabled-text-color);cursor:not-allowed}.el-input-number__increase{right:1px;border-radius:0 var(--el-border-radius-base) var(--el-border-radius-base) 0;border-left:var(--el-border)}.el-input-number__decrease{left:1px;border-radius:var(--el-border-radius-base) 0 0 var(--el-border-radius-base);border-right:var(--el-border)}.el-input-number.is-disabled .el-input-number__decrease,.el-input-number.is-disabled .el-input-number__increase{border-color:var(--el-disabled-border-color);color:var(--el-disabled-border-color)}.el-input-number.is-disabled .el-input-number__decrease:hover,.el-input-number.is-disabled .el-input-number__increase:hover{color:var(--el-disabled-border-color);cursor:not-allowed}.el-input-number--large{width:180px;line-height:38px}.el-input-number--large .el-input-number__decrease,.el-input-number--large .el-input-number__increase{width:40px;font-size:14px}.el-input-number--large .el-input__wrapper{padding-left:47px;padding-right:47px}.el-input-number--small{width:120px;line-height:22px}.el-input-number--small .el-input-number__decrease,.el-input-number--small .el-input-number__increase{width:24px;font-size:12px}.el-input-number--small .el-input__wrapper{padding-left:31px;padding-right:31px}.el-input-number--small .el-input-number__decrease [class*=el-icon],.el-input-number--small .el-input-number__increase [class*=el-icon]{transform:scale(.9)}.el-input-number.is-without-controls .el-input__wrapper{padding-left:15px;padding-right:15px}.el-input-number.is-controls-right .el-input__wrapper{padding-left:15px;padding-right:42px}.el-input-number.is-controls-right .el-input-number__decrease,.el-input-number.is-controls-right .el-input-number__increase{--el-input-number-controls-height:15px;height:var(--el-input-number-controls-height);line-height:var(--el-input-number-controls-height)}.el-input-number.is-controls-right .el-input-number__decrease [class*=el-icon],.el-input-number.is-controls-right .el-input-number__increase [class*=el-icon]{transform:scale(.8)}.el-input-number.is-controls-right .el-input-number__increase{bottom:auto;left:auto;border-radius:0 var(--el-border-radius-base) 0 0;border-bottom:var(--el-border)}.el-input-number.is-controls-right .el-input-number__decrease{right:1px;top:auto;left:auto;border-right:none;border-left:var(--el-border);border-radius:0 0 var(--el-border-radius-base) 0}.el-input-number.is-controls-right[class*=large] [class*=decrease],.el-input-number.is-controls-right[class*=large] [class*=increase]{--el-input-number-controls-height:19px}.el-input-number.is-controls-right[class*=small] [class*=decrease],.el-input-number.is-controls-right[class*=small] [class*=increase]{--el-input-number-controls-height:11px}.el-textarea{--el-input-text-color:var(--el-text-color-regular);--el-input-border:var(--el-border);--el-input-hover-border:var(--el-border-color-hover);--el-input-focus-border:var(--el-color-primary);--el-input-transparent-border:0 0 0 1px transparent inset;--el-input-border-color:var(--el-border-color);--el-input-border-radius:var(--el-border-radius-base);--el-input-bg-color:var(--el-fill-color-blank);--el-input-icon-color:var(--el-text-color-placeholder);--el-input-placeholder-color:var(--el-text-color-placeholder);--el-input-hover-border-color:var(--el-border-color-hover);--el-input-clear-hover-color:var(--el-text-color-secondary);--el-input-focus-border-color:var(--el-color-primary)}.el-textarea{position:relative;display:inline-block;width:100%;vertical-align:bottom;font-size:var(--el-font-size-base)}.el-textarea__inner{position:relative;display:block;resize:vertical;padding:5px 11px;line-height:1.5;box-sizing:border-box;width:100%;font-size:inherit;font-family:inherit;color:var(--el-input-text-color,var(--el-text-color-regular));background-color:var(--el-input-bg-color,var(--el-fill-color-blank));background-image:none;-webkit-appearance:none;box-shadow:0 0 0 1px var(--el-input-border-color,var(--el-border-color)) inset;border-radius:var(--el-input-border-radius,var(--el-border-radius-base));transition:var(--el-transition-box-shadow);border:none}.el-textarea__inner::-moz-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-textarea__inner:-ms-input-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-textarea__inner::placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-textarea__inner:hover{box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-textarea__inner:focus{outline:0;box-shadow:0 0 0 1px var(--el-input-focus-border-color) inset}.el-textarea .el-input__count{color:var(--el-color-info);background:var(--el-fill-color-blank);position:absolute;font-size:12px;line-height:14px;bottom:5px;right:10px}.el-textarea.is-disabled .el-textarea__inner{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color);color:var(--el-disabled-text-color);cursor:not-allowed}.el-textarea.is-disabled .el-textarea__inner::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-textarea.is-disabled .el-textarea__inner:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-textarea.is-disabled .el-textarea__inner::placeholder{color:var(--el-text-color-placeholder)}.el-textarea.is-exceed .el-textarea__inner{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-textarea.is-exceed .el-input__count{color:var(--el-color-danger)}.el-input{--el-input-text-color:var(--el-text-color-regular);--el-input-border:var(--el-border);--el-input-hover-border:var(--el-border-color-hover);--el-input-focus-border:var(--el-color-primary);--el-input-transparent-border:0 0 0 1px transparent inset;--el-input-border-color:var(--el-border-color);--el-input-border-radius:var(--el-border-radius-base);--el-input-bg-color:var(--el-fill-color-blank);--el-input-icon-color:var(--el-text-color-placeholder);--el-input-placeholder-color:var(--el-text-color-placeholder);--el-input-hover-border-color:var(--el-border-color-hover);--el-input-clear-hover-color:var(--el-text-color-secondary);--el-input-focus-border-color:var(--el-color-primary)}.el-input{--el-input-height:var(--el-component-size);position:relative;font-size:var(--el-font-size-base);display:inline-flex;width:100%;line-height:var(--el-input-height);box-sizing:border-box;vertical-align:middle}.el-input::-webkit-scrollbar{z-index:11;width:6px}.el-input::-webkit-scrollbar:horizontal{height:6px}.el-input::-webkit-scrollbar-thumb{border-radius:5px;width:6px;background:var(--el-text-color-disabled)}.el-input::-webkit-scrollbar-corner{background:var(--el-fill-color-blank)}.el-input::-webkit-scrollbar-track{background:var(--el-fill-color-blank)}.el-input::-webkit-scrollbar-track-piece{background:var(--el-fill-color-blank);width:6px}.el-input .el-input__clear,.el-input .el-input__password{color:var(--el-input-icon-color);font-size:14px;cursor:pointer}.el-input .el-input__clear:hover,.el-input .el-input__password:hover{color:var(--el-input-clear-hover-color)}.el-input .el-input__count{height:100%;display:inline-flex;align-items:center;color:var(--el-color-info);font-size:12px}.el-input .el-input__count .el-input__count-inner{background:var(--el-fill-color-blank);line-height:initial;display:inline-block;padding-left:8px}.el-input__wrapper{display:inline-flex;flex-grow:1;align-items:center;justify-content:center;padding:1px 11px;background-color:var(--el-input-bg-color,var(--el-fill-color-blank));background-image:none;border-radius:var(--el-input-border-radius,var(--el-border-radius-base));transition:var(--el-transition-box-shadow);transform:translateZ(0);box-shadow:0 0 0 1px var(--el-input-border-color,var(--el-border-color)) inset}.el-input__wrapper:hover{box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-input__wrapper.is-focus{box-shadow:0 0 0 1px var(--el-input-focus-border-color) inset}.el-input__inner{--el-input-inner-height:calc(var(--el-input-height, 32px) - 2px);width:100%;flex-grow:1;-webkit-appearance:none;color:var(--el-input-text-color,var(--el-text-color-regular));font-size:inherit;height:var(--el-input-inner-height);line-height:var(--el-input-inner-height);padding:0;outline:0;border:none;background:0 0;box-sizing:border-box}.el-input__inner:focus{outline:0}.el-input__inner::-moz-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-input__inner:-ms-input-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-input__inner::placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-input__inner[type=password]::-ms-reveal{display:none}.el-input__prefix{display:inline-flex;white-space:nowrap;flex-shrink:0;flex-wrap:nowrap;height:100%;text-align:center;color:var(--el-input-icon-color,var(--el-text-color-placeholder));transition:all var(--el-transition-duration);pointer-events:none}.el-input__prefix-inner{pointer-events:all;display:inline-flex;align-items:center;justify-content:center}.el-input__prefix-inner>:last-child{margin-right:8px}.el-input__prefix-inner>:first-child,.el-input__prefix-inner>:first-child.el-input__icon{margin-left:0}.el-input__suffix{display:inline-flex;white-space:nowrap;flex-shrink:0;flex-wrap:nowrap;height:100%;text-align:center;color:var(--el-input-icon-color,var(--el-text-color-placeholder));transition:all var(--el-transition-duration);pointer-events:none}.el-input__suffix-inner{pointer-events:all;display:inline-flex;align-items:center;justify-content:center}.el-input__suffix-inner>:first-child{margin-left:8px}.el-input .el-input__icon{height:inherit;line-height:inherit;display:flex;justify-content:center;align-items:center;transition:all var(--el-transition-duration);margin-left:8px}.el-input__validateIcon{pointer-events:none}.el-input.is-active .el-input__wrapper{box-shadow:0 0 0 1px var(--el-input-focus-color,) inset}.el-input.is-disabled{cursor:not-allowed}.el-input.is-disabled .el-input__wrapper{background-color:var(--el-disabled-bg-color);box-shadow:0 0 0 1px var(--el-disabled-border-color) inset}.el-input.is-disabled .el-input__inner{color:var(--el-disabled-text-color);-webkit-text-fill-color:var(--el-disabled-text-color);cursor:not-allowed}.el-input.is-disabled .el-input__inner::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-input.is-disabled .el-input__inner:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-input.is-disabled .el-input__inner::placeholder{color:var(--el-text-color-placeholder)}.el-input.is-disabled .el-input__icon{cursor:not-allowed}.el-input.is-exceed .el-input__wrapper{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-input.is-exceed .el-input__suffix .el-input__count{color:var(--el-color-danger)}.el-input--large{--el-input-height:var(--el-component-size-large);font-size:14px}.el-input--large .el-input__wrapper{padding:1px 15px}.el-input--large .el-input__inner{--el-input-inner-height:calc(var(--el-input-height, 40px) - 2px)}.el-input--small{--el-input-height:var(--el-component-size-small);font-size:12px}.el-input--small .el-input__wrapper{padding:1px 7px}.el-input--small .el-input__inner{--el-input-inner-height:calc(var(--el-input-height, 24px) - 2px)}.el-input-group{display:inline-flex;width:100%;align-items:stretch}.el-input-group__append,.el-input-group__prepend{background-color:var(--el-fill-color-light);color:var(--el-color-info);position:relative;display:inline-flex;align-items:center;justify-content:center;min-height:100%;border-radius:var(--el-input-border-radius);padding:0 20px;white-space:nowrap}.el-input-group__append:focus,.el-input-group__prepend:focus{outline:0}.el-input-group__append .el-button,.el-input-group__append .el-select,.el-input-group__prepend .el-button,.el-input-group__prepend .el-select{display:inline-block;margin:0 -20px}.el-input-group__append button.el-button,.el-input-group__append button.el-button:hover,.el-input-group__append div.el-select .el-input__wrapper,.el-input-group__append div.el-select:hover .el-input__wrapper,.el-input-group__prepend button.el-button,.el-input-group__prepend button.el-button:hover,.el-input-group__prepend div.el-select .el-input__wrapper,.el-input-group__prepend div.el-select:hover .el-input__wrapper{border-color:transparent;background-color:transparent;color:inherit}.el-input-group__append .el-button,.el-input-group__append .el-input,.el-input-group__prepend .el-button,.el-input-group__prepend .el-input{font-size:inherit}.el-input-group__prepend{border-right:0;border-top-right-radius:0;border-bottom-right-radius:0;box-shadow:1px 0 0 0 var(--el-input-border-color) inset,0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset}.el-input-group__append{border-left:0;border-top-left-radius:0;border-bottom-left-radius:0;box-shadow:0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset,-1px 0 0 0 var(--el-input-border-color) inset}.el-input-group--prepend>.el-input__wrapper{border-top-left-radius:0;border-bottom-left-radius:0}.el-input-group--prepend .el-input-group__prepend .el-select .el-input .el-input__inner{box-shadow:none!important}.el-input-group--prepend .el-input-group__prepend .el-select .el-input .el-input__wrapper{border-top-right-radius:0;border-bottom-right-radius:0;box-shadow:1px 0 0 0 var(--el-input-border-color) inset,0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset}.el-input-group--prepend .el-input-group__prepend .el-select .el-input.is-focus .el-input__inner{box-shadow:none!important}.el-input-group--prepend .el-input-group__prepend .el-select .el-input.is-focus .el-input__wrapper{box-shadow:1px 0 0 0 var(--el-input-focus-border-color) inset,1px 0 0 0 var(--el-input-focus-border-color),0 1px 0 0 var(--el-input-focus-border-color) inset,0 -1px 0 0 var(--el-input-focus-border-color) inset!important;z-index:2}.el-input-group--prepend .el-input-group__prepend .el-select .el-input.is-focus .el-input__wrapper:focus{outline:0;z-index:2;box-shadow:1px 0 0 0 var(--el-input-focus-border-color) inset,1px 0 0 0 var(--el-input-focus-border-color),0 1px 0 0 var(--el-input-focus-border-color) inset,0 -1px 0 0 var(--el-input-focus-border-color) inset!important}.el-input-group--prepend .el-input-group__prepend .el-select:hover .el-input__inner{box-shadow:none!important}.el-input-group--prepend .el-input-group__prepend .el-select:hover .el-input__wrapper{z-index:1;box-shadow:1px 0 0 0 var(--el-input-hover-border-color) inset,1px 0 0 0 var(--el-input-hover-border-color),0 1px 0 0 var(--el-input-hover-border-color) inset,0 -1px 0 0 var(--el-input-hover-border-color) inset!important}.el-input-group--append>.el-input__wrapper{border-top-right-radius:0;border-bottom-right-radius:0}.el-input-group--append .el-input-group__append .el-select .el-input .el-input__inner{box-shadow:none!important}.el-input-group--append .el-input-group__append .el-select .el-input .el-input__wrapper{border-top-left-radius:0;border-bottom-left-radius:0;box-shadow:0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset,-1px 0 0 0 var(--el-input-border-color) inset}.el-input-group--append .el-input-group__append .el-select .el-input.is-focus .el-input__inner{box-shadow:none!important}.el-input-group--append .el-input-group__append .el-select .el-input.is-focus .el-input__wrapper{z-index:2;box-shadow:-1px 0 0 0 var(--el-input-focus-border-color),-1px 0 0 0 var(--el-input-focus-border-color) inset,0 1px 0 0 var(--el-input-focus-border-color) inset,0 -1px 0 0 var(--el-input-focus-border-color) inset!important}.el-input-group--append .el-input-group__append .el-select:hover .el-input__inner{box-shadow:none!important}.el-input-group--append .el-input-group__append .el-select:hover .el-input__wrapper{z-index:1;box-shadow:-1px 0 0 0 var(--el-input-hover-border-color),-1px 0 0 0 var(--el-input-hover-border-color) inset,0 1px 0 0 var(--el-input-hover-border-color) inset,0 -1px 0 0 var(--el-input-hover-border-color) inset!important}.el-link{--el-link-font-size:var(--el-font-size-base);--el-link-font-weight:var(--el-font-weight-primary);--el-link-text-color:var(--el-text-color-regular);--el-link-hover-text-color:var(--el-color-primary);--el-link-disabled-text-color:var(--el-text-color-placeholder)}.el-link{display:inline-flex;flex-direction:row;align-items:center;justify-content:center;vertical-align:middle;position:relative;text-decoration:none;outline:0;cursor:pointer;padding:0;font-size:var(--el-link-font-size);font-weight:var(--el-link-font-weight);color:var(--el-link-text-color)}.el-link:hover{color:var(--el-link-hover-text-color)}.el-link.is-underline:hover:after{content:"";position:absolute;left:0;right:0;height:0;bottom:0;border-bottom:1px solid var(--el-link-hover-text-color)}.el-link.is-disabled{color:var(--el-link-disabled-text-color);cursor:not-allowed}.el-link [class*=el-icon-]+span{margin-left:5px}.el-link.el-link--default:after{border-color:var(--el-link-hover-text-color)}.el-link__inner{display:inline-flex;justify-content:center;align-items:center}.el-link.el-link--primary{--el-link-text-color:var(--el-color-primary);--el-link-hover-text-color:var(--el-color-primary-light-3);--el-link-disabled-text-color:var(--el-color-primary-light-5)}.el-link.el-link--primary:after{border-color:var(--el-link-text-color)}.el-link.el-link--primary.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--success{--el-link-text-color:var(--el-color-success);--el-link-hover-text-color:var(--el-color-success-light-3);--el-link-disabled-text-color:var(--el-color-success-light-5)}.el-link.el-link--success:after{border-color:var(--el-link-text-color)}.el-link.el-link--success.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--warning{--el-link-text-color:var(--el-color-warning);--el-link-hover-text-color:var(--el-color-warning-light-3);--el-link-disabled-text-color:var(--el-color-warning-light-5)}.el-link.el-link--warning:after{border-color:var(--el-link-text-color)}.el-link.el-link--warning.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--danger{--el-link-text-color:var(--el-color-danger);--el-link-hover-text-color:var(--el-color-danger-light-3);--el-link-disabled-text-color:var(--el-color-danger-light-5)}.el-link.el-link--danger:after{border-color:var(--el-link-text-color)}.el-link.el-link--danger.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--error{--el-link-text-color:var(--el-color-error);--el-link-hover-text-color:var(--el-color-error-light-3);--el-link-disabled-text-color:var(--el-color-error-light-5)}.el-link.el-link--error:after{border-color:var(--el-link-text-color)}.el-link.el-link--error.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--info{--el-link-text-color:var(--el-color-info);--el-link-hover-text-color:var(--el-color-info-light-3);--el-link-disabled-text-color:var(--el-color-info-light-5)}.el-link.el-link--info:after{border-color:var(--el-link-text-color)}.el-link.el-link--info.is-underline:hover:after{border-color:var(--el-link-text-color)}:root{--el-loading-spinner-size:42px;--el-loading-fullscreen-spinner-size:50px}.el-loading-parent--relative{position:relative!important}.el-loading-parent--hidden{overflow:hidden!important}.el-loading-mask{position:absolute;z-index:2000;background-color:var(--el-mask-color);margin:0;top:0;right:0;bottom:0;left:0;transition:opacity var(--el-transition-duration)}.el-loading-mask.is-fullscreen{position:fixed}.el-loading-mask.is-fullscreen .el-loading-spinner{margin-top:calc((0px - var(--el-loading-fullscreen-spinner-size))/ 2)}.el-loading-mask.is-fullscreen .el-loading-spinner .circular{height:var(--el-loading-fullscreen-spinner-size);width:var(--el-loading-fullscreen-spinner-size)}.el-loading-spinner{top:50%;margin-top:calc((0px - var(--el-loading-spinner-size))/ 2);width:100%;text-align:center;position:absolute}.el-loading-spinner .el-loading-text{color:var(--el-color-primary);margin:3px 0;font-size:14px}.el-loading-spinner .circular{display:inline;height:var(--el-loading-spinner-size);width:var(--el-loading-spinner-size);-webkit-animation:loading-rotate 2s linear infinite;animation:loading-rotate 2s linear infinite}.el-loading-spinner .path{-webkit-animation:loading-dash 1.5s ease-in-out infinite;animation:loading-dash 1.5s ease-in-out infinite;stroke-dasharray:90,150;stroke-dashoffset:0;stroke-width:2;stroke:var(--el-color-primary);stroke-linecap:round}.el-loading-spinner i{color:var(--el-color-primary)}.el-loading-fade-enter-from,.el-loading-fade-leave-to{opacity:0}@-webkit-keyframes loading-rotate{to{transform:rotate(360deg)}}@keyframes loading-rotate{to{transform:rotate(360deg)}}@-webkit-keyframes loading-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40px}to{stroke-dasharray:90,150;stroke-dashoffset:-120px}}@keyframes loading-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40px}to{stroke-dasharray:90,150;stroke-dashoffset:-120px}}.el-main{--el-main-padding:20px;display:block;flex:1;flex-basis:auto;overflow:auto;box-sizing:border-box;padding:var(--el-main-padding)}:root{--el-menu-active-color:var(--el-color-primary);--el-menu-text-color:var(--el-text-color-primary);--el-menu-hover-text-color:var(--el-color-primary);--el-menu-bg-color:var(--el-fill-color-blank);--el-menu-hover-bg-color:var(--el-color-primary-light-9);--el-menu-item-height:56px;--el-menu-sub-item-height:calc(var(--el-menu-item-height) - 6px);--el-menu-horizontal-sub-item-height:36px;--el-menu-item-font-size:var(--el-font-size-base);--el-menu-item-hover-fill:var(--el-color-primary-light-9);--el-menu-border-color:var(--el-border-color);--el-menu-base-level-padding:20px;--el-menu-level-padding:20px;--el-menu-icon-width:24px}.el-menu{border-right:solid 1px var(--el-menu-border-color);list-style:none;position:relative;margin:0;padding-left:0;background-color:var(--el-menu-bg-color);box-sizing:border-box}.el-menu--vertical:not(.el-menu--collapse):not(.el-menu--popup-container) .el-menu-item,.el-menu--vertical:not(.el-menu--collapse):not(.el-menu--popup-container) .el-menu-item-group__title,.el-menu--vertical:not(.el-menu--collapse):not(.el-menu--popup-container) .el-sub-menu__title{white-space:nowrap;padding-left:calc(var(--el-menu-base-level-padding) + var(--el-menu-level) * var(--el-menu-level-padding))}.el-menu--horizontal{display:flex;flex-wrap:nowrap;border-bottom:solid 1px var(--el-menu-border-color);border-right:none}.el-menu--horizontal>.el-menu-item{display:inline-flex;justify-content:center;align-items:center;height:100%;margin:0;border-bottom:2px solid transparent;color:var(--el-menu-text-color)}.el-menu--horizontal>.el-menu-item a,.el-menu--horizontal>.el-menu-item a:hover{color:inherit}.el-menu--horizontal>.el-menu-item:not(.is-disabled):focus,.el-menu--horizontal>.el-menu-item:not(.is-disabled):hover{background-color:#fff}.el-menu--horizontal>.el-sub-menu:focus,.el-menu--horizontal>.el-sub-menu:hover{outline:0}.el-menu--horizontal>.el-sub-menu:hover .el-sub-menu__title{color:var(--el-menu-hover-text-color)}.el-menu--horizontal>.el-sub-menu.is-active .el-sub-menu__title{border-bottom:2px solid var(--el-menu-active-color);color:var(--el-menu-active-color)}.el-menu--horizontal>.el-sub-menu .el-sub-menu__title{height:100%;border-bottom:2px solid transparent;color:var(--el-menu-text-color)}.el-menu--horizontal>.el-sub-menu .el-sub-menu__title:hover{background-color:var(--el-bg-color-overlay)}.el-menu--horizontal .el-menu .el-menu-item,.el-menu--horizontal .el-menu .el-sub-menu__title{background-color:var(--el-menu-bg-color);display:flex;align-items:center;height:var(--el-menu-horizontal-sub-item-height);line-height:var(--el-menu-horizontal-sub-item-height);padding:0 10px;color:var(--el-menu-text-color)}.el-menu--horizontal .el-menu .el-sub-menu__title{padding-right:40px}.el-menu--horizontal .el-menu .el-menu-item.is-active,.el-menu--horizontal .el-menu .el-sub-menu.is-active>.el-sub-menu__title{color:var(--el-menu-active-color)}.el-menu--horizontal .el-menu-item:not(.is-disabled):focus,.el-menu--horizontal .el-menu-item:not(.is-disabled):hover{outline:0;color:var(--el-menu-hover-text-color);background-color:var(--el-menu-hover-bg-color)}.el-menu--horizontal>.el-menu-item.is-active{border-bottom:2px solid var(--el-menu-active-color);color:var(--el-menu-active-color)!important}.el-menu--collapse{width:calc(var(--el-menu-icon-width) + var(--el-menu-base-level-padding) * 2)}.el-menu--collapse>.el-menu-item [class^=el-icon],.el-menu--collapse>.el-menu-item-group>ul>.el-sub-menu>.el-sub-menu__title [class^=el-icon],.el-menu--collapse>.el-sub-menu>.el-sub-menu__title [class^=el-icon]{margin:0;vertical-align:middle;width:var(--el-menu-icon-width);text-align:center}.el-menu--collapse>.el-menu-item .el-sub-menu__icon-arrow,.el-menu--collapse>.el-menu-item-group>ul>.el-sub-menu>.el-sub-menu__title .el-sub-menu__icon-arrow,.el-menu--collapse>.el-sub-menu>.el-sub-menu__title .el-sub-menu__icon-arrow{display:none}.el-menu--collapse>.el-menu-item-group>ul>.el-sub-menu>.el-sub-menu__title>span,.el-menu--collapse>.el-menu-item>span,.el-menu--collapse>.el-sub-menu>.el-sub-menu__title>span{height:0;width:0;overflow:hidden;visibility:hidden;display:inline-block}.el-menu--collapse>.el-menu-item.is-active i{color:inherit}.el-menu--collapse .el-menu .el-sub-menu{min-width:200px}.el-menu--popup{z-index:100;min-width:200px;border:none;padding:5px 0;border-radius:var(--el-border-radius-small);box-shadow:var(--el-box-shadow-light)}.el-menu .el-icon{flex-shrink:0}.el-menu-item{display:flex;align-items:center;height:var(--el-menu-item-height);line-height:var(--el-menu-item-height);font-size:var(--el-menu-item-font-size);color:var(--el-menu-text-color);padding:0 var(--el-menu-base-level-padding);list-style:none;cursor:pointer;position:relative;transition:border-color var(--el-transition-duration),background-color var(--el-transition-duration),color var(--el-transition-duration);box-sizing:border-box;white-space:nowrap}.el-menu-item *{vertical-align:bottom}.el-menu-item i{color:inherit}.el-menu-item:focus,.el-menu-item:hover{outline:0}.el-menu-item:hover{background-color:var(--el-menu-hover-bg-color)}.el-menu-item.is-disabled{opacity:.25;cursor:not-allowed;background:0 0!important}.el-menu-item [class^=el-icon]{margin-right:5px;width:var(--el-menu-icon-width);text-align:center;font-size:18px;vertical-align:middle}.el-menu-item.is-active{color:var(--el-menu-active-color)}.el-menu-item.is-active i{color:inherit}.el-menu-item .el-menu-tooltip__trigger{position:absolute;left:0;top:0;height:100%;width:100%;display:inline-flex;align-items:center;box-sizing:border-box;padding:0 var(--el-menu-base-level-padding)}.el-sub-menu{list-style:none;margin:0;padding-left:0}.el-sub-menu__title{display:flex;align-items:center;height:var(--el-menu-item-height);line-height:var(--el-menu-item-height);font-size:var(--el-menu-item-font-size);color:var(--el-menu-text-color);padding:0 var(--el-menu-base-level-padding);list-style:none;cursor:pointer;position:relative;transition:border-color var(--el-transition-duration),background-color var(--el-transition-duration),color var(--el-transition-duration);box-sizing:border-box;white-space:nowrap;padding-right:calc(var(--el-menu-base-level-padding) + var(--el-menu-icon-width))}.el-sub-menu__title *{vertical-align:bottom}.el-sub-menu__title i{color:inherit}.el-sub-menu__title:focus,.el-sub-menu__title:hover{outline:0}.el-sub-menu__title.is-disabled{opacity:.25;cursor:not-allowed;background:0 0!important}.el-sub-menu__title:hover{background-color:var(--el-menu-hover-bg-color)}.el-sub-menu .el-menu{border:none}.el-sub-menu .el-menu-item{height:var(--el-menu-sub-item-height);line-height:var(--el-menu-sub-item-height)}.el-sub-menu__hide-arrow .el-sub-menu__icon-arrow{display:none!important}.el-sub-menu.is-active .el-sub-menu__title{border-bottom-color:var(--el-menu-active-color)}.el-sub-menu.is-disabled .el-menu-item,.el-sub-menu.is-disabled .el-sub-menu__title{opacity:.25;cursor:not-allowed;background:0 0!important}.el-sub-menu .el-icon{vertical-align:middle;margin-right:5px;width:var(--el-menu-icon-width);text-align:center;font-size:18px}.el-sub-menu .el-icon.el-sub-menu__icon-more{margin-right:0!important}.el-sub-menu .el-sub-menu__icon-arrow{position:absolute;top:50%;right:var(--el-menu-base-level-padding);margin-top:-6px;transition:transform var(--el-transition-duration);font-size:12px;margin-right:0;width:inherit}.el-menu-item-group>ul{padding:0}.el-menu-item-group__title{padding:7px 0 7px var(--el-menu-base-level-padding);line-height:normal;font-size:12px;color:var(--el-text-color-secondary)}.horizontal-collapse-transition .el-sub-menu__title .el-sub-menu__icon-arrow{transition:var(--el-transition-duration-fast);opacity:0}.el-message-box{--el-messagebox-title-color:var(--el-text-color-primary);--el-messagebox-width:420px;--el-messagebox-border-radius:4px;--el-messagebox-font-size:var(--el-font-size-large);--el-messagebox-content-font-size:var(--el-font-size-base);--el-messagebox-content-color:var(--el-text-color-regular);--el-messagebox-error-font-size:12px;--el-messagebox-padding-primary:15px}.el-message-box{display:inline-block;max-width:var(--el-messagebox-width);width:100%;padding-bottom:10px;vertical-align:middle;background-color:var(--el-bg-color);border-radius:var(--el-messagebox-border-radius);border:1px solid var(--el-border-color-lighter);font-size:var(--el-messagebox-font-size);box-shadow:var(--el-box-shadow-light);text-align:left;overflow:hidden;-webkit-backface-visibility:hidden;backface-visibility:hidden;box-sizing:border-box}.el-message-box:focus{outline:0!important}.el-overlay.is-message-box .el-overlay-message-box{text-align:center;position:fixed;top:0;right:0;bottom:0;left:0;padding:16px;overflow:auto}.el-overlay.is-message-box .el-overlay-message-box:after{content:"";display:inline-block;height:100%;width:0;vertical-align:middle}.el-message-box.is-draggable .el-message-box__header{cursor:move;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-message-box__header{position:relative;padding:var(--el-messagebox-padding-primary);padding-bottom:10px}.el-message-box__title{padding-left:0;margin-bottom:0;font-size:var(--el-messagebox-font-size);line-height:1;color:var(--el-messagebox-title-color)}.el-message-box__headerbtn{position:absolute;top:var(--el-messagebox-padding-primary);right:var(--el-messagebox-padding-primary);padding:0;border:none;outline:0;background:0 0;font-size:var(--el-message-close-size,16px);cursor:pointer}.el-message-box__headerbtn .el-message-box__close{color:var(--el-color-info);font-size:inherit}.el-message-box__headerbtn:focus .el-message-box__close,.el-message-box__headerbtn:hover .el-message-box__close{color:var(--el-color-primary)}.el-message-box__content{padding:10px var(--el-messagebox-padding-primary);color:var(--el-messagebox-content-color);font-size:var(--el-messagebox-content-font-size)}.el-message-box__container{position:relative}.el-message-box__input{padding-top:15px}.el-message-box__input div.invalid>input{border-color:var(--el-color-error)}.el-message-box__input div.invalid>input:focus{border-color:var(--el-color-error)}.el-message-box__status{position:absolute;top:50%;transform:translateY(-50%);font-size:24px!important}.el-message-box__status:before{padding-left:1px}.el-message-box__status.el-icon{position:absolute}.el-message-box__status+.el-message-box__message{padding-left:36px;padding-right:12px;word-break:break-word}.el-message-box__status.el-message-box-icon--success{--el-messagebox-color:var(--el-color-success);color:var(--el-messagebox-color)}.el-message-box__status.el-message-box-icon--info{--el-messagebox-color:var(--el-color-info);color:var(--el-messagebox-color)}.el-message-box__status.el-message-box-icon--warning{--el-messagebox-color:var(--el-color-warning);color:var(--el-messagebox-color)}.el-message-box__status.el-message-box-icon--error{--el-messagebox-color:var(--el-color-error);color:var(--el-messagebox-color)}.el-message-box__message{margin:0}.el-message-box__message p{margin:0;line-height:24px}.el-message-box__errormsg{color:var(--el-color-error);font-size:var(--el-messagebox-error-font-size);min-height:18px;margin-top:2px}.el-message-box__btns{padding:5px 15px 0;display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center}.el-message-box__btns button:nth-child(2){margin-left:10px}.el-message-box__btns-reverse{flex-direction:row-reverse}.el-message-box--center .el-message-box__title{position:relative;display:flex;align-items:center;justify-content:center}.el-message-box--center .el-message-box__status{position:relative;top:auto;padding-right:5px;text-align:center;transform:translateY(-1px)}.el-message-box--center .el-message-box__message{margin-left:0}.el-message-box--center .el-message-box__btns{justify-content:center}.el-message-box--center .el-message-box__content{padding-left:calc(var(--el-messagebox-padding-primary) + 12px);padding-right:calc(var(--el-messagebox-padding-primary) + 12px);text-align:center}.fade-in-linear-enter-active .el-overlay-message-box{-webkit-animation:msgbox-fade-in var(--el-transition-duration);animation:msgbox-fade-in var(--el-transition-duration)}.fade-in-linear-leave-active .el-overlay-message-box{animation:msgbox-fade-in var(--el-transition-duration) reverse}@-webkit-keyframes msgbox-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@keyframes msgbox-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@-webkit-keyframes msgbox-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@keyframes msgbox-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}.el-message{--el-message-bg-color:var(--el-color-info-light-9);--el-message-border-color:var(--el-border-color-lighter);--el-message-padding:15px 19px;--el-message-close-size:16px;--el-message-close-icon-color:var(--el-text-color-placeholder);--el-message-close-hover-color:var(--el-text-color-secondary)}.el-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;max-width:calc(100% - 32px);box-sizing:border-box;border-radius:var(--el-border-radius-base);border-width:var(--el-border-width);border-style:var(--el-border-style);border-color:var(--el-message-border-color);position:fixed;left:50%;top:20px;transform:translate(-50%);background-color:var(--el-message-bg-color);transition:opacity var(--el-transition-duration),transform .4s,top .4s;padding:var(--el-message-padding);display:flex;align-items:center}.el-message.is-center{justify-content:center}.el-message.is-closable .el-message__content{padding-right:31px}.el-message p{margin:0}.el-message--success{--el-message-bg-color:var(--el-color-success-light-9);--el-message-border-color:var(--el-color-success-light-8);--el-message-text-color:var(--el-color-success)}.el-message--success .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--success{color:var(--el-message-text-color)}.el-message--info{--el-message-bg-color:var(--el-color-info-light-9);--el-message-border-color:var(--el-color-info-light-8);--el-message-text-color:var(--el-color-info)}.el-message--info .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--info{color:var(--el-message-text-color)}.el-message--warning{--el-message-bg-color:var(--el-color-warning-light-9);--el-message-border-color:var(--el-color-warning-light-8);--el-message-text-color:var(--el-color-warning)}.el-message--warning .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--warning{color:var(--el-message-text-color)}.el-message--error{--el-message-bg-color:var(--el-color-error-light-9);--el-message-border-color:var(--el-color-error-light-8);--el-message-text-color:var(--el-color-error)}.el-message--error .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--error{color:var(--el-message-text-color)}.el-message__icon{margin-right:10px}.el-message .el-message__badge{position:absolute;top:-8px;right:-8px}.el-message__content{padding:0;font-size:14px;line-height:1}.el-message__content:focus{outline-width:0}.el-message .el-message__closeBtn{position:absolute;top:50%;right:19px;transform:translateY(-50%);cursor:pointer;color:var(--el-message-close-icon-color);font-size:var(--el-message-close-size)}.el-message .el-message__closeBtn:focus{outline-width:0}.el-message .el-message__closeBtn:hover{color:var(--el-message-close-hover-color)}.el-message-fade-enter-from,.el-message-fade-leave-to{opacity:0;transform:translate(-50%,-100%)}.el-notification{--el-notification-width:330px;--el-notification-padding:14px 26px 14px 13px;--el-notification-radius:8px;--el-notification-shadow:var(--el-box-shadow-light);--el-notification-border-color:var(--el-border-color-lighter);--el-notification-icon-size:24px;--el-notification-close-font-size:var(--el-message-close-size, 16px);--el-notification-group-margin-left:13px;--el-notification-group-margin-right:8px;--el-notification-content-font-size:var(--el-font-size-base);--el-notification-content-color:var(--el-text-color-regular);--el-notification-title-font-size:16px;--el-notification-title-color:var(--el-text-color-primary);--el-notification-close-color:var(--el-text-color-secondary);--el-notification-close-hover-color:var(--el-text-color-regular)}.el-notification{display:flex;width:var(--el-notification-width);padding:var(--el-notification-padding);border-radius:var(--el-notification-radius);box-sizing:border-box;border:1px solid var(--el-notification-border-color);position:fixed;background-color:var(--el-bg-color-overlay);box-shadow:var(--el-notification-shadow);transition:opacity var(--el-transition-duration),transform var(--el-transition-duration),left var(--el-transition-duration),right var(--el-transition-duration),top .4s,bottom var(--el-transition-duration);overflow-wrap:anywhere;overflow:hidden;z-index:9999}.el-notification.right{right:16px}.el-notification.left{left:16px}.el-notification__group{margin-left:var(--el-notification-group-margin-left);margin-right:var(--el-notification-group-margin-right)}.el-notification__title{font-weight:700;font-size:var(--el-notification-title-font-size);line-height:var(--el-notification-icon-size);color:var(--el-notification-title-color);margin:0}.el-notification__content{font-size:var(--el-notification-content-font-size);line-height:24px;margin:6px 0 0;color:var(--el-notification-content-color);text-align:justify}.el-notification__content p{margin:0}.el-notification .el-notification__icon{height:var(--el-notification-icon-size);width:var(--el-notification-icon-size);font-size:var(--el-notification-icon-size)}.el-notification .el-notification__closeBtn{position:absolute;top:18px;right:15px;cursor:pointer;color:var(--el-notification-close-color);font-size:var(--el-notification-close-font-size)}.el-notification .el-notification__closeBtn:hover{color:var(--el-notification-close-hover-color)}.el-notification .el-notification--success{--el-notification-icon-color:var(--el-color-success);color:var(--el-notification-icon-color)}.el-notification .el-notification--info{--el-notification-icon-color:var(--el-color-info);color:var(--el-notification-icon-color)}.el-notification .el-notification--warning{--el-notification-icon-color:var(--el-color-warning);color:var(--el-notification-icon-color)}.el-notification .el-notification--error{--el-notification-icon-color:var(--el-color-error);color:var(--el-notification-icon-color)}.el-notification-fade-enter-from.right{right:0;transform:translate(100%)}.el-notification-fade-enter-from.left{left:0;transform:translate(-100%)}.el-notification-fade-leave-to{opacity:0}.el-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;height:100%;background-color:var(--el-overlay-color-lighter);overflow:auto}.el-overlay .el-overlay-root{height:0}.el-page-header.is-contentful .el-page-header__main{border-top:1px solid var(--el-border-color-light);margin-top:16px}.el-page-header__header{display:flex;align-items:center;justify-content:space-between;line-height:24px}.el-page-header__left{display:flex;align-items:center;margin-right:40px;position:relative}.el-page-header__back{display:flex;align-items:center;cursor:pointer}.el-page-header__left .el-divider--vertical{margin:0 16px}.el-page-header__icon{font-size:16px;margin-right:10px;display:flex;align-items:center}.el-page-header__icon .el-icon{font-size:inherit}.el-page-header__title{font-size:14px;font-weight:500}.el-page-header__content{font-size:18px;color:var(--el-text-color-primary)}.el-page-header__breadcrumb{margin-bottom:16px}.el-pagination{--el-pagination-font-size:14px;--el-pagination-bg-color:var(--el-fill-color-blank);--el-pagination-text-color:var(--el-text-color-primary);--el-pagination-border-radius:2px;--el-pagination-button-color:var(--el-text-color-primary);--el-pagination-button-width:32px;--el-pagination-button-height:32px;--el-pagination-button-disabled-color:var(--el-text-color-placeholder);--el-pagination-button-disabled-bg-color:var(--el-fill-color-blank);--el-pagination-button-bg-color:var(--el-fill-color);--el-pagination-hover-color:var(--el-color-primary);--el-pagination-font-size-small:12px;--el-pagination-button-width-small:24px;--el-pagination-button-height-small:24px;--el-pagination-item-gap:16px;white-space:nowrap;color:var(--el-pagination-text-color);font-size:var(--el-pagination-font-size);font-weight:400;display:flex;align-items:center}.el-pagination .el-input__inner{text-align:center;-moz-appearance:textfield}.el-pagination .el-select .el-input{width:128px}.el-pagination button{display:flex;justify-content:center;align-items:center;font-size:var(--el-pagination-font-size);min-width:var(--el-pagination-button-width);height:var(--el-pagination-button-height);line-height:var(--el-pagination-button-height);color:var(--el-pagination-button-color);background:var(--el-pagination-bg-color);padding:0 4px;border:none;border-radius:var(--el-pagination-border-radius);cursor:pointer;text-align:center;box-sizing:border-box}.el-pagination button *{pointer-events:none}.el-pagination button:focus{outline:0}.el-pagination button:hover{color:var(--el-pagination-hover-color)}.el-pagination button.is-active{color:var(--el-pagination-hover-color);cursor:default;font-weight:700}.el-pagination button.is-active.is-disabled{font-weight:700;color:var(--el-text-color-secondary)}.el-pagination button.is-disabled,.el-pagination button:disabled{color:var(--el-pagination-button-disabled-color);background-color:var(--el-pagination-button-disabled-bg-color);cursor:not-allowed}.el-pagination button:focus-visible{outline:1px solid var(--el-pagination-hover-color);outline-offset:-1px}.el-pagination .btn-next .el-icon,.el-pagination .btn-prev .el-icon{display:block;font-size:12px;font-weight:700;width:inherit}.el-pagination>.is-first{margin-left:0!important}.el-pagination>.is-last{margin-right:0!important}.el-pagination .btn-prev{margin-left:var(--el-pagination-item-gap)}.el-pagination__sizes,.el-pagination__total{margin-left:var(--el-pagination-item-gap);font-weight:400;color:var(--el-text-color-regular)}.el-pagination__total[disabled=true]{color:var(--el-text-color-placeholder)}.el-pagination__jump{display:flex;align-items:center;margin-left:var(--el-pagination-item-gap);font-weight:400;color:var(--el-text-color-regular)}.el-pagination__jump[disabled=true]{color:var(--el-text-color-placeholder)}.el-pagination__goto{margin-right:8px}.el-pagination__editor{text-align:center;box-sizing:border-box}.el-pagination__editor.el-input{width:56px}.el-pagination__editor .el-input__inner::-webkit-inner-spin-button,.el-pagination__editor .el-input__inner::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.el-pagination__classifier{margin-left:8px}.el-pagination__rightwrapper{flex:1;display:flex;align-items:center;justify-content:flex-end}.el-pagination.is-background .btn-next,.el-pagination.is-background .btn-prev,.el-pagination.is-background .el-pager li{margin:0 4px;background-color:var(--el-pagination-button-bg-color)}.el-pagination.is-background .btn-next.is-active,.el-pagination.is-background .btn-prev.is-active,.el-pagination.is-background .el-pager li.is-active{background-color:var(--el-color-primary);color:var(--el-color-white)}.el-pagination.is-background .btn-next.is-disabled,.el-pagination.is-background .btn-next:disabled,.el-pagination.is-background .btn-prev.is-disabled,.el-pagination.is-background .btn-prev:disabled,.el-pagination.is-background .el-pager li.is-disabled,.el-pagination.is-background .el-pager li:disabled{color:var(--el-text-color-placeholder);background-color:var(--el-disabled-bg-color)}.el-pagination.is-background .btn-next.is-disabled.is-active,.el-pagination.is-background .btn-next:disabled.is-active,.el-pagination.is-background .btn-prev.is-disabled.is-active,.el-pagination.is-background .btn-prev:disabled.is-active,.el-pagination.is-background .el-pager li.is-disabled.is-active,.el-pagination.is-background .el-pager li:disabled.is-active{color:var(--el-text-color-secondary);background-color:var(--el-fill-color-dark)}.el-pagination.is-background .btn-prev{margin-left:var(--el-pagination-item-gap)}.el-pagination--small .btn-next,.el-pagination--small .btn-prev,.el-pagination--small .el-pager li{height:var(--el-pagination-button-height-small);line-height:var(--el-pagination-button-height-small);font-size:var(--el-pagination-font-size-small);min-width:var(--el-pagination-button-width-small)}.el-pagination--small button,.el-pagination--small span:not([class*=suffix]){font-size:var(--el-pagination-font-size-small)}.el-pagination--small .el-select .el-input{width:100px}.el-pager{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;list-style:none;font-size:0;padding:0;margin:0;display:flex;align-items:center}.el-pager li{display:flex;justify-content:center;align-items:center;font-size:var(--el-pagination-font-size);min-width:var(--el-pagination-button-width);height:var(--el-pagination-button-height);line-height:var(--el-pagination-button-height);color:var(--el-pagination-button-color);background:var(--el-pagination-bg-color);padding:0 4px;border:none;border-radius:var(--el-pagination-border-radius);cursor:pointer;text-align:center;box-sizing:border-box}.el-pager li *{pointer-events:none}.el-pager li:focus{outline:0}.el-pager li:hover{color:var(--el-pagination-hover-color)}.el-pager li.is-active{color:var(--el-pagination-hover-color);cursor:default;font-weight:700}.el-pager li.is-active.is-disabled{font-weight:700;color:var(--el-text-color-secondary)}.el-pager li.is-disabled,.el-pager li:disabled{color:var(--el-pagination-button-disabled-color);background-color:var(--el-pagination-button-disabled-bg-color);cursor:not-allowed}.el-pager li:focus-visible{outline:1px solid var(--el-pagination-hover-color);outline-offset:-1px}.el-popconfirm__main{display:flex;align-items:center}.el-popconfirm__icon{margin-right:5px}.el-popconfirm__action{text-align:right;margin-top:8px}.el-popover{--el-popover-bg-color:var(--el-bg-color-overlay);--el-popover-font-size:var(--el-font-size-base);--el-popover-border-color:var(--el-border-color-lighter);--el-popover-padding:12px;--el-popover-padding-large:18px 20px;--el-popover-title-font-size:16px;--el-popover-title-text-color:var(--el-text-color-primary);--el-popover-border-radius:4px}.el-popover.el-popper{background:var(--el-popover-bg-color);min-width:150px;border-radius:var(--el-popover-border-radius);border:1px solid var(--el-popover-border-color);padding:var(--el-popover-padding);z-index:var(--el-index-popper);color:var(--el-text-color-regular);line-height:1.4;text-align:justify;font-size:var(--el-popover-font-size);box-shadow:var(--el-box-shadow-light);word-break:break-all;box-sizing:border-box}.el-popover.el-popper--plain{padding:var(--el-popover-padding-large)}.el-popover__title{color:var(--el-popover-title-text-color);font-size:var(--el-popover-title-font-size);line-height:1;margin-bottom:12px}.el-popover__reference:focus:hover,.el-popover__reference:focus:not(.focusing){outline-width:0}.el-popover.el-popper.is-dark{--el-popover-bg-color:var(--el-text-color-primary);--el-popover-border-color:var(--el-text-color-primary);--el-popover-title-text-color:var(--el-bg-color);color:var(--el-bg-color)}.el-popover.el-popper:focus,.el-popover.el-popper:focus:active{outline-width:0}.el-progress{position:relative;line-height:1;display:flex;align-items:center}.el-progress__text{font-size:14px;color:var(--el-text-color-regular);margin-left:5px;min-width:50px;line-height:1}.el-progress__text i{vertical-align:middle;display:block}.el-progress--circle,.el-progress--dashboard{display:inline-block}.el-progress--circle .el-progress__text,.el-progress--dashboard .el-progress__text{position:absolute;top:50%;left:0;width:100%;text-align:center;margin:0;transform:translateY(-50%)}.el-progress--circle .el-progress__text i,.el-progress--dashboard .el-progress__text i{vertical-align:middle;display:inline-block}.el-progress--without-text .el-progress__text{display:none}.el-progress--without-text .el-progress-bar{padding-right:0;margin-right:0;display:block}.el-progress--text-inside .el-progress-bar{padding-right:0;margin-right:0}.el-progress.is-success .el-progress-bar__inner{background-color:var(--el-color-success)}.el-progress.is-success .el-progress__text{color:var(--el-color-success)}.el-progress.is-warning .el-progress-bar__inner{background-color:var(--el-color-warning)}.el-progress.is-warning .el-progress__text{color:var(--el-color-warning)}.el-progress.is-exception .el-progress-bar__inner{background-color:var(--el-color-danger)}.el-progress.is-exception .el-progress__text{color:var(--el-color-danger)}.el-progress-bar{flex-grow:1;box-sizing:border-box}.el-progress-bar__outer{height:6px;border-radius:100px;background-color:var(--el-border-color-lighter);overflow:hidden;position:relative;vertical-align:middle}.el-progress-bar__inner{position:absolute;left:0;top:0;height:100%;background-color:var(--el-color-primary);text-align:right;border-radius:100px;line-height:1;white-space:nowrap;transition:width .6s ease}.el-progress-bar__inner:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-progress-bar__inner--indeterminate{transform:translateZ(0);-webkit-animation:indeterminate 3s infinite;animation:indeterminate 3s infinite}.el-progress-bar__inner--striped{background-image:linear-gradient(45deg,rgba(0,0,0,.1) 25%,transparent 25%,transparent 50%,rgba(0,0,0,.1) 50%,rgba(0,0,0,.1) 75%,transparent 75%,transparent);background-size:1.25em 1.25em}.el-progress-bar__inner--striped.el-progress-bar__inner--striped-flow{-webkit-animation:striped-flow 3s linear infinite;animation:striped-flow 3s linear infinite}.el-progress-bar__innerText{display:inline-block;vertical-align:middle;color:#fff;font-size:12px;margin:0 5px}@-webkit-keyframes progress{0%{background-position:0 0}to{background-position:32px 0}}@keyframes progress{0%{background-position:0 0}to{background-position:32px 0}}@-webkit-keyframes indeterminate{0%{left:-100%}to{left:100%}}@keyframes indeterminate{0%{left:-100%}to{left:100%}}@-webkit-keyframes striped-flow{0%{background-position:-100%}to{background-position:100%}}@keyframes striped-flow{0%{background-position:-100%}to{background-position:100%}}.el-radio-button{--el-radio-button-checked-bg-color:var(--el-color-primary);--el-radio-button-checked-text-color:var(--el-color-white);--el-radio-button-checked-border-color:var(--el-color-primary);--el-radio-button-disabled-checked-fill:var(--el-border-color-extra-light)}.el-radio-button{position:relative;display:inline-block;outline:0}.el-radio-button__inner{display:inline-block;line-height:1;white-space:nowrap;vertical-align:middle;background:var(--el-button-bg-color,var(--el-fill-color-blank));border:var(--el-border);font-weight:var(--el-button-font-weight,var(--el-font-weight-primary));border-left:0;color:var(--el-button-text-color,var(--el-text-color-regular));-webkit-appearance:none;text-align:center;box-sizing:border-box;outline:0;margin:0;position:relative;cursor:pointer;transition:var(--el-transition-all);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:8px 15px;font-size:var(--el-font-size-base);border-radius:0}.el-radio-button__inner.is-round{padding:8px 15px}.el-radio-button__inner:hover{color:var(--el-color-primary)}.el-radio-button__inner [class*=el-icon-]{line-height:.9}.el-radio-button__inner [class*=el-icon-]+span{margin-left:5px}.el-radio-button:first-child .el-radio-button__inner{border-left:var(--el-border);border-radius:var(--el-border-radius-base) 0 0 var(--el-border-radius-base);box-shadow:none!important}.el-radio-button__original-radio{opacity:0;outline:0;position:absolute;z-index:-1}.el-radio-button__original-radio:checked+.el-radio-button__inner{color:var(--el-radio-button-checked-text-color,var(--el-color-white));background-color:var(--el-radio-button-checked-bg-color,var(--el-color-primary));border-color:var(--el-radio-button-checked-border-color,var(--el-color-primary));box-shadow:-1px 0 0 0 var(--el-radio-button-checked-border-color,var(--el-color-primary))}.el-radio-button__original-radio:focus-visible+.el-radio-button__inner{border-left:var(--el-border);border-left-color:var(--el-radio-button-checked-border-color,var(--el-color-primary));outline:2px solid var(--el-radio-button-checked-border-color);outline-offset:1px;z-index:2;border-radius:var(--el-border-radius-base);box-shadow:none}.el-radio-button__original-radio:disabled+.el-radio-button__inner{color:var(--el-disabled-text-color);cursor:not-allowed;background-image:none;background-color:var(--el-button-disabled-bg-color,var(--el-fill-color-blank));border-color:var(--el-button-disabled-border-color,var(--el-border-color-light));box-shadow:none}.el-radio-button__original-radio:disabled:checked+.el-radio-button__inner{background-color:var(--el-radio-button-disabled-checked-fill)}.el-radio-button:last-child .el-radio-button__inner{border-radius:0 var(--el-border-radius-base) var(--el-border-radius-base) 0}.el-radio-button:first-child:last-child .el-radio-button__inner{border-radius:var(--el-border-radius-base)}.el-radio-button--large .el-radio-button__inner{padding:12px 19px;font-size:var(--el-font-size-base);border-radius:0}.el-radio-button--large .el-radio-button__inner.is-round{padding:12px 19px}.el-radio-button--small .el-radio-button__inner{padding:5px 11px;font-size:12px;border-radius:0}.el-radio-button--small .el-radio-button__inner.is-round{padding:5px 11px}.el-radio-group{display:inline-flex;align-items:center;flex-wrap:wrap;font-size:0}.el-radio{--el-radio-font-size:var(--el-font-size-base);--el-radio-text-color:var(--el-text-color-regular);--el-radio-font-weight:var(--el-font-weight-primary);--el-radio-input-height:14px;--el-radio-input-width:14px;--el-radio-input-border-radius:var(--el-border-radius-circle);--el-radio-input-bg-color:var(--el-fill-color-blank);--el-radio-input-border:var(--el-border);--el-radio-input-border-color:var(--el-border-color);--el-radio-input-border-color-hover:var(--el-color-primary)}.el-radio{color:var(--el-radio-text-color);font-weight:var(--el-radio-font-weight);position:relative;cursor:pointer;display:inline-flex;align-items:center;white-space:nowrap;outline:0;font-size:var(--el-font-size-base);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;margin-right:32px;height:32px}.el-radio.el-radio--large{height:40px}.el-radio.el-radio--small{height:24px}.el-radio.is-bordered{padding:0 15px 0 9px;border-radius:var(--el-border-radius-base);border:var(--el-border);box-sizing:border-box}.el-radio.is-bordered.is-checked{border-color:var(--el-color-primary)}.el-radio.is-bordered.is-disabled{cursor:not-allowed;border-color:var(--el-border-color-lighter)}.el-radio.is-bordered.el-radio--large{padding:0 19px 0 11px;border-radius:var(--el-border-radius-base)}.el-radio.is-bordered.el-radio--large .el-radio__label{font-size:var(--el-font-size-base)}.el-radio.is-bordered.el-radio--large .el-radio__inner{height:14px;width:14px}.el-radio.is-bordered.el-radio--small{padding:0 11px 0 7px;border-radius:var(--el-border-radius-base)}.el-radio.is-bordered.el-radio--small .el-radio__label{font-size:12px}.el-radio.is-bordered.el-radio--small .el-radio__inner{height:12px;width:12px}.el-radio:last-child{margin-right:0}.el-radio__input{white-space:nowrap;cursor:pointer;outline:0;display:inline-flex;position:relative;vertical-align:middle}.el-radio__input.is-disabled .el-radio__inner{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color);cursor:not-allowed}.el-radio__input.is-disabled .el-radio__inner:after{cursor:not-allowed;background-color:var(--el-disabled-bg-color)}.el-radio__input.is-disabled .el-radio__inner+.el-radio__label{cursor:not-allowed}.el-radio__input.is-disabled.is-checked .el-radio__inner{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color)}.el-radio__input.is-disabled.is-checked .el-radio__inner:after{background-color:var(--el-text-color-placeholder)}.el-radio__input.is-disabled+span.el-radio__label{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-radio__input.is-checked .el-radio__inner{border-color:var(--el-color-primary);background:var(--el-color-primary)}.el-radio__input.is-checked .el-radio__inner:after{transform:translate(-50%,-50%) scale(1)}.el-radio__input.is-checked+.el-radio__label{color:var(--el-color-primary)}.el-radio__input.is-focus .el-radio__inner{border-color:var(--el-radio-input-border-color-hover)}.el-radio__inner{border:var(--el-radio-input-border);border-radius:var(--el-radio-input-border-radius);width:var(--el-radio-input-width);height:var(--el-radio-input-height);background-color:var(--el-radio-input-bg-color);position:relative;cursor:pointer;display:inline-block;box-sizing:border-box}.el-radio__inner:hover{border-color:var(--el-radio-input-border-color-hover)}.el-radio__inner:after{width:4px;height:4px;border-radius:var(--el-radio-input-border-radius);background-color:var(--el-color-white);content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%) scale(0);transition:transform .15s ease-in}.el-radio__original{opacity:0;outline:0;position:absolute;z-index:-1;top:0;left:0;right:0;bottom:0;margin:0}.el-radio__original:focus-visible+.el-radio__inner{outline:2px solid var(--el-radio-input-border-color-hover);outline-offset:1px;border-radius:var(--el-radio-input-border-radius)}.el-radio:focus:not(:focus-visible):not(.is-focus):not(:active):not(.is-disabled) .el-radio__inner{box-shadow:0 0 2px 2px var(--el-radio-input-border-color-hover)}.el-radio__label{font-size:var(--el-radio-font-size);padding-left:8px}.el-radio.el-radio--large .el-radio__label{font-size:14px}.el-radio.el-radio--large .el-radio__inner{width:14px;height:14px}.el-radio.el-radio--small .el-radio__label{font-size:12px}.el-radio.el-radio--small .el-radio__inner{width:12px;height:12px}.el-rate{--el-rate-height:20px;--el-rate-font-size:var(--el-font-size-base);--el-rate-icon-size:18px;--el-rate-icon-margin:6px;--el-rate-void-color:var(--el-border-color-darker);--el-rate-fill-color:#f7ba2a;--el-rate-disabled-void-color:var(--el-fill-color);--el-rate-text-color:var(--el-text-color-primary)}.el-rate{display:inline-flex;align-items:center;height:32px}.el-rate:active,.el-rate:focus{outline:0}.el-rate__item{cursor:pointer;display:inline-block;position:relative;font-size:0;vertical-align:middle;color:var(--el-rate-void-color);line-height:normal}.el-rate .el-rate__icon{position:relative;display:inline-block;font-size:var(--el-rate-icon-size);margin-right:var(--el-rate-icon-margin);transition:var(--el-transition-duration)}.el-rate .el-rate__icon.hover{transform:scale(1.15)}.el-rate .el-rate__icon .path2{position:absolute;left:0;top:0}.el-rate .el-rate__icon.is-active{color:var(--el-rate-fill-color)}.el-rate__decimal{position:absolute;top:0;left:0;display:inline-block;overflow:hidden;color:var(--el-rate-fill-color)}.el-rate__text{font-size:var(--el-rate-font-size);vertical-align:middle;color:var(--el-rate-text-color)}.el-rate--large{height:40px}.el-rate--small{height:24px}.el-rate--small .el-rate__icon{font-size:14px}.el-rate.is-disabled .el-rate__item{cursor:auto;color:var(--el-rate-disabled-void-color)}.el-result{--el-result-padding:40px 30px;--el-result-icon-font-size:64px;--el-result-title-font-size:20px;--el-result-title-margin-top:20px;--el-result-subtitle-margin-top:10px;--el-result-extra-margin-top:30px}.el-result{display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;box-sizing:border-box;padding:var(--el-result-padding)}.el-result__icon svg{width:var(--el-result-icon-font-size);height:var(--el-result-icon-font-size)}.el-result__title{margin-top:var(--el-result-title-margin-top)}.el-result__title p{margin:0;font-size:var(--el-result-title-font-size);color:var(--el-text-color-primary);line-height:1.3}.el-result__subtitle{margin-top:var(--el-result-subtitle-margin-top)}.el-result__subtitle p{margin:0;font-size:var(--el-font-size-base);color:var(--el-text-color-regular);line-height:1.3}.el-result__extra{margin-top:var(--el-result-extra-margin-top)}.el-result .icon-primary{--el-result-color:var(--el-color-primary);color:var(--el-result-color)}.el-result .icon-success{--el-result-color:var(--el-color-success);color:var(--el-result-color)}.el-result .icon-warning{--el-result-color:var(--el-color-warning);color:var(--el-result-color)}.el-result .icon-danger{--el-result-color:var(--el-color-danger);color:var(--el-result-color)}.el-result .icon-error{--el-result-color:var(--el-color-error);color:var(--el-result-color)}.el-result .icon-info{--el-result-color:var(--el-color-info);color:var(--el-result-color)}.el-row{display:flex;flex-wrap:wrap;position:relative;box-sizing:border-box}.el-row.is-justify-center{justify-content:center}.el-row.is-justify-end{justify-content:flex-end}.el-row.is-justify-space-between{justify-content:space-between}.el-row.is-justify-space-around{justify-content:space-around}.el-row.is-justify-space-evenly{justify-content:space-evenly}.el-row.is-align-middle{align-items:center}.el-row.is-align-bottom{align-items:flex-end}.el-scrollbar{--el-scrollbar-opacity:.3;--el-scrollbar-bg-color:var(--el-text-color-secondary);--el-scrollbar-hover-opacity:.5;--el-scrollbar-hover-bg-color:var(--el-text-color-secondary)}.el-scrollbar{overflow:hidden;position:relative;height:100%}.el-scrollbar__wrap{overflow:auto;height:100%}.el-scrollbar__wrap--hidden-default{scrollbar-width:none}.el-scrollbar__wrap--hidden-default::-webkit-scrollbar{display:none}.el-scrollbar__thumb{position:relative;display:block;width:0;height:0;cursor:pointer;border-radius:inherit;background-color:var(--el-scrollbar-bg-color,var(--el-text-color-secondary));transition:var(--el-transition-duration) background-color;opacity:var(--el-scrollbar-opacity,.3)}.el-scrollbar__thumb:hover{background-color:var(--el-scrollbar-hover-bg-color,var(--el-text-color-secondary));opacity:var(--el-scrollbar-hover-opacity,.5)}.el-scrollbar__bar{position:absolute;right:2px;bottom:2px;z-index:1;border-radius:4px}.el-scrollbar__bar.is-vertical{width:6px;top:2px}.el-scrollbar__bar.is-vertical>div{width:100%}.el-scrollbar__bar.is-horizontal{height:6px;left:2px}.el-scrollbar__bar.is-horizontal>div{height:100%}.el-scrollbar-fade-enter-active{transition:opacity .34s ease-out}.el-scrollbar-fade-leave-active{transition:opacity .12s ease-out}.el-scrollbar-fade-enter-from,.el-scrollbar-fade-leave-active{opacity:0}.el-select-dropdown{z-index:calc(var(--el-index-top) + 1);border-radius:var(--el-border-radius-base);box-sizing:border-box}.el-select-dropdown .el-scrollbar.is-empty .el-select-dropdown__list{padding:0}.el-select-dropdown__option-item.is-selected:not(.is-multiple).is-disabled{color:var(--el-text-color-disabled)}.el-select-dropdown__option-item.is-selected:not(.is-multiple).is-disabled:after{background-color:var(--el-text-color-disabled)}.el-select-dropdown__option-item:hover:not(.hover){background-color:transparent}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-disabled.is-selected{color:var(--el-text-color-disabled)}.el-select-dropdown__empty{padding:10px 0;margin:0;text-align:center;color:var(--el-text-color-secondary);font-size:var(--el-select-font-size)}.el-select-dropdown__wrap{max-height:274px}.el-select-dropdown__list{list-style:none;margin:6px 0!important;padding:0!important;box-sizing:border-box}.el-select-dropdown__option-item{font-size:var(--el-select-font-size);padding:0 32px 0 20px;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--el-text-color-regular);height:34px;line-height:34px;box-sizing:border-box;cursor:pointer}.el-select-dropdown__option-item.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-select-dropdown__option-item.is-disabled:hover{background-color:var(--el-bg-color)}.el-select-dropdown__option-item.is-selected{background-color:var(--el-fill-color-light);font-weight:700}.el-select-dropdown__option-item.is-selected:not(.is-multiple){color:var(--el-color-primary)}.el-select-dropdown__option-item.hover{background-color:var(--el-fill-color-light)!important}.el-select-dropdown__option-item:hover{background-color:var(--el-fill-color-light)}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-selected{color:var(--el-color-primary);background-color:var(--el-bg-color-overlay)}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-selected .el-icon{position:absolute;right:20px;top:0;height:inherit;font-size:12px}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-selected .el-icon svg{height:inherit;vertical-align:middle}.el-select-group{margin:0;padding:0}.el-select-group__wrap{position:relative;list-style:none;margin:0;padding:0}.el-select-group__wrap:not(:last-of-type){padding-bottom:24px}.el-select-group__wrap:not(:last-of-type):after{content:"";position:absolute;display:block;left:20px;right:20px;bottom:12px;height:1px;background:var(--el-border-color-light)}.el-select-group__split-dash{position:absolute;left:20px;right:20px;height:1px;background:var(--el-border-color-light)}.el-select-group__title{padding-left:20px;font-size:12px;color:var(--el-color-info);line-height:30px}.el-select-group .el-select-dropdown__item{padding-left:20px}.el-select-v2{--el-select-border-color-hover:var(--el-border-color-hover);--el-select-disabled-border:var(--el-disabled-border-color);--el-select-font-size:var(--el-font-size-base);--el-select-close-hover-color:var(--el-text-color-secondary);--el-select-input-color:var(--el-text-color-placeholder);--el-select-multiple-input-color:var(--el-text-color-regular);--el-select-input-focus-border-color:var(--el-color-primary);--el-select-input-font-size:14px}.el-select-v2{display:inline-block;position:relative;vertical-align:middle;font-size:14px}.el-select-v2__wrapper{display:flex;align-items:center;flex-wrap:wrap;position:relative;box-sizing:border-box;cursor:pointer;padding:1px 30px 1px 0;border:1px solid var(--el-border-color);border-radius:var(--el-border-radius-base);background-color:var(--el-fill-color-blank);transition:var(--el-transition-duration)}.el-select-v2__wrapper:hover{border-color:var(--el-text-color-placeholder)}.el-select-v2__wrapper.is-filterable{cursor:text}.el-select-v2__wrapper.is-focused{border-color:var(--el-color-primary)}.el-select-v2__wrapper.is-hovering:not(.is-focused){border-color:var(--el-border-color-hover)}.el-select-v2__wrapper.is-disabled{cursor:not-allowed;background-color:var(--el-fill-color-light);color:var(--el-text-color-placeholder);border-color:var(--el-select-disabled-border)}.el-select-v2__wrapper.is-disabled:hover{border-color:var(--el-select-disabled-border)}.el-select-v2__wrapper.is-disabled.is-focus{border-color:var(--el-input-focus-border-color)}.el-select-v2__wrapper.is-disabled .is-transparent{opacity:1;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-select-v2__wrapper.is-disabled .el-select-v2__caret,.el-select-v2__wrapper.is-disabled .el-select-v2__combobox-input{cursor:not-allowed}.el-select-v2__wrapper .el-select-v2__input-wrapper{box-sizing:border-box;position:relative;-webkit-margin-start:12px;margin-inline-start:12px;max-width:100%;overflow:hidden}.el-select-v2__wrapper,.el-select-v2__wrapper .el-select-v2__input-wrapper{line-height:32px}.el-select-v2__wrapper .el-select-v2__input-wrapper input{--el-input-inner-height:calc(var(--el-component-size, 32px) - 8px);height:var(--el-input-inner-height);line-height:var(--el-input-inner-height);min-width:4px;width:100%;background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:0 0;border:none;margin:2px 0;outline:0;padding:0}.el-select-v2 .el-select-v2__tags-text{display:inline-block;line-height:normal;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-select-v2__empty{padding:10px 0;margin:0;text-align:center;color:var(--el-text-color-secondary);font-size:14px}.el-select-v2__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-box-shadow-light)}.el-select-v2__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-select-v2__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-select-v2__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-select-v2__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-select-v2__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-select-v2--large .el-select-v2__wrapper .el-select-v2__combobox-input{height:32px}.el-select-v2--large .el-select-v2__caret,.el-select-v2--large .el-select-v2__suffix{height:40px}.el-select-v2--large .el-select-v2__placeholder{font-size:14px;line-height:40px}.el-select-v2--small .el-select-v2__wrapper .el-select-v2__combobox-input{height:16px}.el-select-v2--small .el-select-v2__caret,.el-select-v2--small .el-select-v2__suffix{height:24px}.el-select-v2--small .el-select-v2__placeholder{font-size:12px;line-height:24px}.el-select-v2 .el-select-v2__selection>span{display:inline-block}.el-select-v2:hover .el-select-v2__combobox-input{border-color:var(--el-select-border-color-hover)}.el-select-v2 .el-select__selection-text{text-overflow:ellipsis;display:inline-block;overflow-x:hidden;vertical-align:bottom}.el-select-v2 .el-select-v2__combobox-input{padding-right:35px;display:block;color:var(--el-text-color-regular)}.el-select-v2 .el-select-v2__combobox-input:focus{border-color:var(--el-select-input-focus-border-color)}.el-select-v2__input{border:none;outline:0;padding:0;margin-left:15px;color:var(--el-select-multiple-input-color);font-size:var(--el-select-font-size);-webkit-appearance:none;-moz-appearance:none;appearance:none;height:28px}.el-select-v2__input.is-small{height:14px}.el-select-v2__close{cursor:pointer;position:absolute;top:8px;z-index:var(--el-index-top);right:25px;color:var(--el-select-input-color);line-height:18px;font-size:var(--el-select-input-font-size)}.el-select-v2__close:hover{color:var(--el-select-close-hover-color)}.el-select-v2__suffix{display:inline-flex;position:absolute;right:12px;height:32px;top:50%;transform:translateY(-50%);color:var(--el-input-icon-color,var(--el-text-color-placeholder))}.el-select-v2__suffix .el-input__icon{height:inherit}.el-select-v2__suffix .el-input__icon:not(:first-child){margin-left:8px}.el-select-v2__caret{color:var(--el-select-input-color);font-size:var(--el-select-input-font-size);transition:var(--el-transition-duration);transform:rotate(180deg);cursor:pointer}.el-select-v2__caret.is-reverse{transform:rotate(0)}.el-select-v2__caret.is-show-close{font-size:var(--el-select-font-size);text-align:center;transform:rotate(180deg);border-radius:var(--el-border-radius-circle);color:var(--el-select-input-color);transition:var(--el-transition-color)}.el-select-v2__caret.is-show-close:hover{color:var(--el-select-close-hover-color)}.el-select-v2__caret.el-icon{height:inherit}.el-select-v2__caret.el-icon svg{vertical-align:middle}.el-select-v2__selection{white-space:normal;z-index:var(--el-index-normal);display:flex;align-items:center;flex-wrap:wrap;width:100%}.el-select-v2__input-calculator{left:0;position:absolute;top:0;visibility:hidden;white-space:pre;z-index:999}.el-select-v2__selected-item{line-height:inherit;height:inherit;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-wrap:wrap}.el-select-v2__placeholder{position:absolute;top:50%;transform:translateY(-50%);-webkit-margin-start:12px;margin-inline-start:12px;width:calc(100% - 52px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--el-input-text-color,var(--el-text-color-regular))}.el-select-v2__placeholder.is-transparent{color:var(--el-text-color-placeholder)}.el-select-v2 .el-select-v2__selection .el-tag{box-sizing:border-box;border-color:transparent;margin:2px 0 2px 6px;background-color:var(--el-fill-color)}.el-select-v2 .el-select-v2__selection .el-tag .el-icon-close{background-color:var(--el-text-color-placeholder);right:-7px;color:var(--el-color-white)}.el-select-v2 .el-select-v2__selection .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-select-v2 .el-select-v2__selection .el-tag .el-icon-close:before{display:block;transform:translateY(.5px)}.el-select-v2.el-select-v2--small .el-select-v2__selection .el-tag{margin:1px 0 1px 6px;height:18px}.el-select-dropdown{z-index:calc(var(--el-index-top) + 1);border-radius:var(--el-border-radius-base);box-sizing:border-box}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected{color:var(--el-color-primary);background-color:var(--el-bg-color-overlay)}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected.hover{background-color:var(--el-fill-color-light)}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected:after{content:"";position:absolute;top:50%;right:20px;border-top:none;border-right:none;background-repeat:no-repeat;background-position:center;background-color:var(--el-color-primary);-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask-size:100% 100%;-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;-webkit-mask-size:100% 100%;transform:translateY(-50%);width:12px;height:12px}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected.is-disabled:after{background-color:var(--el-text-color-disabled)}.el-select-dropdown .el-select-dropdown__option-item.is-selected:after{content:"";position:absolute;top:50%;right:20px;border-top:none;border-right:none;background-repeat:no-repeat;background-position:center;background-color:var(--el-color-primary);-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask-size:100% 100%;-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;-webkit-mask-size:100% 100%;transform:translateY(-50%);width:12px;height:12px}.el-select-dropdown .el-scrollbar.is-empty .el-select-dropdown__list{padding:0}.el-select-dropdown .el-select-dropdown__item.is-disabled:hover{background-color:unset}.el-select-dropdown .el-select-dropdown__item.is-disabled.selected{color:var(--el-text-color-disabled)}.el-select-dropdown__empty{padding:10px 0;margin:0;text-align:center;color:var(--el-text-color-secondary);font-size:var(--el-select-font-size)}.el-select-dropdown__wrap{max-height:274px}.el-select-dropdown__list{list-style:none;padding:6px 0;margin:0;box-sizing:border-box}.el-select{--el-select-border-color-hover:var(--el-border-color-hover);--el-select-disabled-border:var(--el-disabled-border-color);--el-select-font-size:var(--el-font-size-base);--el-select-close-hover-color:var(--el-text-color-secondary);--el-select-input-color:var(--el-text-color-placeholder);--el-select-multiple-input-color:var(--el-text-color-regular);--el-select-input-focus-border-color:var(--el-color-primary);--el-select-input-font-size:14px}.el-select{display:inline-block;position:relative;vertical-align:middle;line-height:32px}.el-select__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-box-shadow-light)}.el-select__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-select__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-select__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-select__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-select__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-select .el-select-tags-wrapper.has-prefix{margin-left:6px}.el-select--large{line-height:40px}.el-select--large .el-select-tags-wrapper.has-prefix{margin-left:8px}.el-select--small{line-height:24px}.el-select--small .el-select-tags-wrapper.has-prefix{margin-left:4px}.el-select .el-select__tags>span{display:inline-block}.el-select:hover:not(.el-select--disabled) .el-input__wrapper{box-shadow:0 0 0 1px var(--el-select-border-color-hover) inset}.el-select .el-select__tags-text{display:inline-block;line-height:normal;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-select .el-input__wrapper{cursor:pointer}.el-select .el-input__wrapper.is-focus{box-shadow:0 0 0 1px var(--el-select-input-focus-border-color) inset!important}.el-select .el-input__inner{cursor:pointer}.el-select .el-input{display:flex}.el-select .el-input .el-select__caret{color:var(--el-select-input-color);font-size:var(--el-select-input-font-size);transition:transform var(--el-transition-duration);transform:rotate(0);cursor:pointer}.el-select .el-input .el-select__caret.is-reverse{transform:rotate(-180deg)}.el-select .el-input .el-select__caret.is-show-close{font-size:var(--el-select-font-size);text-align:center;transform:rotate(0);border-radius:var(--el-border-radius-circle);color:var(--el-select-input-color);transition:var(--el-transition-color)}.el-select .el-input .el-select__caret.is-show-close:hover{color:var(--el-select-close-hover-color)}.el-select .el-input .el-select__caret.el-icon{position:relative;height:inherit;z-index:2}.el-select .el-input.is-disabled .el-input__wrapper{cursor:not-allowed}.el-select .el-input.is-disabled .el-input__wrapper:hover{box-shadow:0 0 0 1px var(--el-select-disabled-border) inset}.el-select .el-input.is-disabled .el-input__inner,.el-select .el-input.is-disabled .el-select__caret{cursor:not-allowed}.el-select .el-input.is-focus .el-input__wrapper{box-shadow:0 0 0 1px var(--el-select-input-focus-border-color) inset!important}.el-select__input{border:none;outline:0;padding:0;margin-left:15px;color:var(--el-select-multiple-input-color);font-size:var(--el-select-font-size);-webkit-appearance:none;-moz-appearance:none;appearance:none;height:28px;background-color:transparent}.el-select__input.is-disabled{cursor:not-allowed}.el-select__input--iOS{position:absolute;left:0;top:0;z-index:6}.el-select__input.is-small{height:14px}.el-select__close{cursor:pointer;position:absolute;top:8px;z-index:var(--el-index-top);right:25px;color:var(--el-select-input-color);line-height:18px;font-size:var(--el-select-input-font-size)}.el-select__close:hover{color:var(--el-select-close-hover-color)}.el-select__tags{position:absolute;line-height:normal;top:50%;transform:translateY(-50%);white-space:normal;z-index:var(--el-index-normal);display:flex;align-items:center;flex-wrap:wrap;cursor:pointer}.el-select__tags .el-tag{box-sizing:border-box;border-color:transparent;margin:2px 6px 2px 0}.el-select__tags .el-tag:last-child{margin-right:0}.el-select__tags .el-tag .el-icon-close{background-color:var(--el-text-color-placeholder);right:-7px;top:0;color:#fff}.el-select__tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-select__tags .el-tag .el-icon-close:before{display:block;transform:translateY(.5px)}.el-select__tags .el-tag--info{background-color:var(--el-fill-color)}.el-select__tags.is-disabled{cursor:not-allowed}.el-select__collapse-tags{white-space:normal;z-index:var(--el-index-normal);display:flex;align-items:center;flex-wrap:wrap;cursor:pointer}.el-select__collapse-tags .el-tag{box-sizing:border-box;border-color:transparent;margin:2px 6px 2px 0}.el-select__collapse-tags .el-tag:last-child{margin-right:0}.el-select__collapse-tags .el-tag .el-icon-close{background-color:var(--el-text-color-placeholder);right:-7px;top:0;color:#fff}.el-select__collapse-tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-select__collapse-tags .el-tag .el-icon-close:before{display:block;transform:translateY(.5px)}.el-select__collapse-tags .el-tag--info{background-color:var(--el-fill-color)}.el-select__collapse-tag{line-height:inherit;height:inherit;display:flex}.el-skeleton{--el-skeleton-circle-size:var(--el-avatar-size)}.el-skeleton__item{background:var(--el-skeleton-color);display:inline-block;height:16px;border-radius:var(--el-border-radius-base);width:100%}.el-skeleton__circle{border-radius:50%;width:var(--el-skeleton-circle-size);height:var(--el-skeleton-circle-size);line-height:var(--el-skeleton-circle-size)}.el-skeleton__button{height:40px;width:64px;border-radius:4px}.el-skeleton__p{width:100%}.el-skeleton__p.is-last{width:61%}.el-skeleton__p.is-first{width:33%}.el-skeleton__text{width:100%;height:var(--el-font-size-small)}.el-skeleton__caption{height:var(--el-font-size-extra-small)}.el-skeleton__h1{height:var(--el-font-size-extra-large)}.el-skeleton__h3{height:var(--el-font-size-large)}.el-skeleton__h5{height:var(--el-font-size-medium)}.el-skeleton__image{width:unset;display:flex;align-items:center;justify-content:center;border-radius:0}.el-skeleton__image svg{color:var(--el-svg-monochrome-grey);fill:currentColor;width:22%;height:22%}.el-skeleton{--el-skeleton-color:var(--el-fill-color);--el-skeleton-to-color:var(--el-fill-color-darker)}@-webkit-keyframes el-skeleton-loading{0%{background-position:100% 50%}to{background-position:0 50%}}@keyframes el-skeleton-loading{0%{background-position:100% 50%}to{background-position:0 50%}}.el-skeleton{width:100%}.el-skeleton__first-line,.el-skeleton__paragraph{height:16px;margin-top:16px;background:var(--el-skeleton-color)}.el-skeleton.is-animated .el-skeleton__item{background:linear-gradient(90deg,var(--el-skeleton-color) 25%,var(--el-skeleton-to-color) 37%,var(--el-skeleton-color) 63%);background-size:400% 100%;-webkit-animation:el-skeleton-loading 1.4s ease infinite;animation:el-skeleton-loading 1.4s ease infinite}.el-slider{--el-slider-main-bg-color:var(--el-color-primary);--el-slider-runway-bg-color:var(--el-border-color-light);--el-slider-stop-bg-color:var(--el-color-white);--el-slider-disabled-color:var(--el-text-color-placeholder);--el-slider-border-radius:3px;--el-slider-height:6px;--el-slider-button-size:20px;--el-slider-button-wrapper-size:36px;--el-slider-button-wrapper-offset:-15px}.el-slider{width:100%;height:32px;display:flex;align-items:center}.el-slider__runway{flex:1;height:var(--el-slider-height);background-color:var(--el-slider-runway-bg-color);border-radius:var(--el-slider-border-radius);position:relative;cursor:pointer}.el-slider__runway.show-input{margin-right:30px;width:auto}.el-slider__runway.is-disabled{cursor:default}.el-slider__runway.is-disabled .el-slider__bar{background-color:var(--el-slider-disabled-color)}.el-slider__runway.is-disabled .el-slider__button{border-color:var(--el-slider-disabled-color)}.el-slider__runway.is-disabled .el-slider__button-wrapper.hover,.el-slider__runway.is-disabled .el-slider__button-wrapper:hover,.el-slider__runway.is-disabled .el-slider__button-wrapper.dragging{cursor:not-allowed}.el-slider__runway.is-disabled .el-slider__button.dragging,.el-slider__runway.is-disabled .el-slider__button.hover,.el-slider__runway.is-disabled .el-slider__button:hover{transform:scale(1)}.el-slider__runway.is-disabled .el-slider__button.hover,.el-slider__runway.is-disabled .el-slider__button:hover,.el-slider__runway.is-disabled .el-slider__button.dragging{cursor:not-allowed}.el-slider__input{flex-shrink:0;width:130px}.el-slider__bar{height:var(--el-slider-height);background-color:var(--el-slider-main-bg-color);border-top-left-radius:var(--el-slider-border-radius);border-bottom-left-radius:var(--el-slider-border-radius);position:absolute}.el-slider__button-wrapper{height:var(--el-slider-button-wrapper-size);width:var(--el-slider-button-wrapper-size);position:absolute;z-index:1;top:var(--el-slider-button-wrapper-offset);transform:translate(-50%);background-color:transparent;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;line-height:normal;outline:0}.el-slider__button-wrapper:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-slider__button-wrapper.hover,.el-slider__button-wrapper:hover{cursor:-webkit-grab;cursor:grab}.el-slider__button-wrapper.dragging{cursor:-webkit-grabbing;cursor:grabbing}.el-slider__button{display:inline-block;width:var(--el-slider-button-size);height:var(--el-slider-button-size);vertical-align:middle;border:solid 2px var(--el-slider-main-bg-color);background-color:var(--el-color-white);border-radius:50%;box-sizing:border-box;transition:var(--el-transition-duration-fast);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-slider__button.dragging,.el-slider__button.hover,.el-slider__button:hover{transform:scale(1.2)}.el-slider__button.hover,.el-slider__button:hover{cursor:-webkit-grab;cursor:grab}.el-slider__button.dragging{cursor:-webkit-grabbing;cursor:grabbing}.el-slider__stop{position:absolute;height:var(--el-slider-height);width:var(--el-slider-height);border-radius:var(--el-border-radius-circle);background-color:var(--el-slider-stop-bg-color);transform:translate(-50%)}.el-slider__marks{top:0;left:12px;width:18px;height:100%}.el-slider__marks-text{position:absolute;transform:translate(-50%);font-size:14px;color:var(--el-color-info);margin-top:15px;white-space:pre}.el-slider.is-vertical{position:relative;display:inline-flex;width:auto;height:100%;flex:0}.el-slider.is-vertical .el-slider__runway{width:var(--el-slider-height);height:100%;margin:0 16px}.el-slider.is-vertical .el-slider__bar{width:var(--el-slider-height);height:auto;border-radius:0 0 3px 3px}.el-slider.is-vertical .el-slider__button-wrapper{top:auto;left:var(--el-slider-button-wrapper-offset);transform:translateY(50%)}.el-slider.is-vertical .el-slider__stop{transform:translateY(50%)}.el-slider.is-vertical .el-slider__marks-text{margin-top:0;left:15px;transform:translateY(50%)}.el-slider--large{height:40px}.el-slider--small{height:24px}.el-space{display:inline-flex;vertical-align:top}.el-space__item{display:flex;flex-wrap:wrap}.el-space__item>*{flex:1}.el-space--vertical{flex-direction:column}.el-time-spinner{width:100%;white-space:nowrap}.el-spinner{display:inline-block;vertical-align:middle}.el-spinner-inner{-webkit-animation:rotate 2s linear infinite;animation:rotate 2s linear infinite;width:50px;height:50px}.el-spinner-inner .path{stroke:var(--el-border-color-lighter);stroke-linecap:round;-webkit-animation:dash 1.5s ease-in-out infinite;animation:dash 1.5s ease-in-out infinite}@-webkit-keyframes rotate{to{transform:rotate(360deg)}}@keyframes rotate{to{transform:rotate(360deg)}}@-webkit-keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}.el-step{position:relative;flex-shrink:1}.el-step:last-of-type .el-step__line{display:none}.el-step:last-of-type.is-flex{flex-basis:auto!important;flex-shrink:0;flex-grow:0}.el-step:last-of-type .el-step__description,.el-step:last-of-type .el-step__main{padding-right:0}.el-step__head{position:relative;width:100%}.el-step__head.is-process{color:var(--el-text-color-primary);border-color:var(--el-text-color-primary)}.el-step__head.is-wait{color:var(--el-text-color-placeholder);border-color:var(--el-text-color-placeholder)}.el-step__head.is-success{color:var(--el-color-success);border-color:var(--el-color-success)}.el-step__head.is-error{color:var(--el-color-danger);border-color:var(--el-color-danger)}.el-step__head.is-finish{color:var(--el-color-primary);border-color:var(--el-color-primary)}.el-step__icon{position:relative;z-index:1;display:inline-flex;justify-content:center;align-items:center;width:24px;height:24px;font-size:14px;box-sizing:border-box;background:var(--el-bg-color);transition:.15s ease-out}.el-step__icon.is-text{border-radius:50%;border:2px solid;border-color:inherit}.el-step__icon.is-icon{width:40px}.el-step__icon-inner{display:inline-block;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-align:center;font-weight:700;line-height:1;color:inherit}.el-step__icon-inner[class*=el-icon]:not(.is-status){font-size:25px;font-weight:400}.el-step__icon-inner.is-status{transform:translateY(1px)}.el-step__line{position:absolute;border-color:inherit;background-color:var(--el-text-color-placeholder)}.el-step__line-inner{display:block;border-width:1px;border-style:solid;border-color:inherit;transition:.15s ease-out;box-sizing:border-box;width:0;height:0}.el-step__main{white-space:normal;text-align:left}.el-step__title{font-size:16px;line-height:38px}.el-step__title.is-process{font-weight:700;color:var(--el-text-color-primary)}.el-step__title.is-wait{color:var(--el-text-color-placeholder)}.el-step__title.is-success{color:var(--el-color-success)}.el-step__title.is-error{color:var(--el-color-danger)}.el-step__title.is-finish{color:var(--el-color-primary)}.el-step__description{padding-right:10%;margin-top:-5px;font-size:12px;line-height:20px;font-weight:400}.el-step__description.is-process{color:var(--el-text-color-primary)}.el-step__description.is-wait{color:var(--el-text-color-placeholder)}.el-step__description.is-success{color:var(--el-color-success)}.el-step__description.is-error{color:var(--el-color-danger)}.el-step__description.is-finish{color:var(--el-color-primary)}.el-step.is-horizontal{display:inline-block}.el-step.is-horizontal .el-step__line{height:2px;top:11px;left:0;right:0}.el-step.is-vertical{display:flex}.el-step.is-vertical .el-step__head{flex-grow:0;width:24px}.el-step.is-vertical .el-step__main{padding-left:10px;flex-grow:1}.el-step.is-vertical .el-step__title{line-height:24px;padding-bottom:8px}.el-step.is-vertical .el-step__line{width:2px;top:0;bottom:0;left:11px}.el-step.is-vertical .el-step__icon.is-icon{width:24px}.el-step.is-center .el-step__head,.el-step.is-center .el-step__main{text-align:center}.el-step.is-center .el-step__description{padding-left:20%;padding-right:20%}.el-step.is-center .el-step__line{left:50%;right:-50%}.el-step.is-simple{display:flex;align-items:center}.el-step.is-simple .el-step__head{width:auto;font-size:0;padding-right:10px}.el-step.is-simple .el-step__icon{background:0 0;width:16px;height:16px;font-size:12px}.el-step.is-simple .el-step__icon-inner[class*=el-icon]:not(.is-status){font-size:18px}.el-step.is-simple .el-step__icon-inner.is-status{transform:scale(.8) translateY(1px)}.el-step.is-simple .el-step__main{position:relative;display:flex;align-items:stretch;flex-grow:1}.el-step.is-simple .el-step__title{font-size:16px;line-height:20px}.el-step.is-simple:not(:last-of-type) .el-step__title{max-width:50%;word-break:break-all}.el-step.is-simple .el-step__arrow{flex-grow:1;display:flex;align-items:center;justify-content:center}.el-step.is-simple .el-step__arrow:after,.el-step.is-simple .el-step__arrow:before{content:"";display:inline-block;position:absolute;height:15px;width:1px;background:var(--el-text-color-placeholder)}.el-step.is-simple .el-step__arrow:before{transform:rotate(-45deg) translateY(-4px);transform-origin:0 0}.el-step.is-simple .el-step__arrow:after{transform:rotate(45deg) translateY(4px);transform-origin:100% 100%}.el-step.is-simple:last-of-type .el-step__arrow{display:none}.el-steps{display:flex}.el-steps--simple{padding:13px 8%;border-radius:4px;background:var(--el-fill-color-light)}.el-steps--horizontal{white-space:nowrap}.el-steps--vertical{height:100%;flex-flow:column}.el-switch{--el-switch-on-color:var(--el-color-primary);--el-switch-off-color:var(--el-border-color)}.el-switch{display:inline-flex;align-items:center;position:relative;font-size:14px;line-height:20px;height:32px;vertical-align:middle}.el-switch.is-disabled .el-switch__core,.el-switch.is-disabled .el-switch__label{cursor:not-allowed}.el-switch__label{transition:var(--el-transition-duration-fast);height:20px;display:inline-block;font-size:14px;font-weight:500;cursor:pointer;vertical-align:middle;color:var(--el-text-color-primary)}.el-switch__label.is-active{color:var(--el-color-primary)}.el-switch__label--left{margin-right:10px}.el-switch__label--right{margin-left:10px}.el-switch__label *{line-height:1;font-size:14px;display:inline-block}.el-switch__label .el-icon{height:inherit}.el-switch__label .el-icon svg{vertical-align:middle}.el-switch__input{position:absolute;width:0;height:0;opacity:0;margin:0}.el-switch__input:focus-visible~.el-switch__core{outline:2px solid var(--el-switch-on-color);outline-offset:1px}.el-switch__core{display:inline-flex;position:relative;align-items:center;min-width:40px;height:20px;border:1px solid var(--el-switch-border-color,var(--el-switch-off-color));outline:0;border-radius:10px;box-sizing:border-box;background:var(--el-switch-off-color);cursor:pointer;transition:border-color var(--el-transition-duration),background-color var(--el-transition-duration)}.el-switch__core .el-switch__inner{width:100%;transition:all var(--el-transition-duration);height:16px;display:flex;justify-content:center;align-items:center;overflow:hidden;padding:0 4px 0 18px}.el-switch__core .el-switch__inner .is-icon,.el-switch__core .el-switch__inner .is-text{font-size:12px;color:var(--el-color-white);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-switch__core .el-switch__action{position:absolute;left:1px;border-radius:var(--el-border-radius-circle);transition:all var(--el-transition-duration);width:16px;height:16px;background-color:var(--el-color-white);display:flex;justify-content:center;align-items:center;color:var(--el-switch-off-color)}.el-switch.is-checked .el-switch__core{border-color:var(--el-switch-border-color,var(--el-switch-on-color));background-color:var(--el-switch-on-color)}.el-switch.is-checked .el-switch__core .el-switch__action{left:calc(100% - 17px);color:var(--el-switch-on-color)}.el-switch.is-checked .el-switch__core .el-switch__inner{padding:0 18px 0 4px}.el-switch.is-disabled{opacity:.6}.el-switch--wide .el-switch__label.el-switch__label--left span{left:10px}.el-switch--wide .el-switch__label.el-switch__label--right span{right:10px}.el-switch .label-fade-enter-from,.el-switch .label-fade-leave-active{opacity:0}.el-switch--large{font-size:14px;line-height:24px;height:40px}.el-switch--large .el-switch__label{height:24px;font-size:14px}.el-switch--large .el-switch__label *{font-size:14px}.el-switch--large .el-switch__core{min-width:50px;height:24px;border-radius:12px}.el-switch--large .el-switch__core .el-switch__inner{height:20px;padding:0 6px 0 22px}.el-switch--large .el-switch__core .el-switch__action{width:20px;height:20px}.el-switch--large.is-checked .el-switch__core .el-switch__action{left:calc(100% - 21px)}.el-switch--large.is-checked .el-switch__core .el-switch__inner{padding:0 22px 0 6px}.el-switch--small{font-size:12px;line-height:16px;height:24px}.el-switch--small .el-switch__label{height:16px;font-size:12px}.el-switch--small .el-switch__label *{font-size:12px}.el-switch--small .el-switch__core{min-width:30px;height:16px;border-radius:8px}.el-switch--small .el-switch__core .el-switch__inner{height:12px;padding:0 2px 0 14px}.el-switch--small .el-switch__core .el-switch__action{width:12px;height:12px}.el-switch--small.is-checked .el-switch__core .el-switch__action{left:calc(100% - 13px)}.el-switch--small.is-checked .el-switch__core .el-switch__inner{padding:0 14px 0 2px}.el-table-column--selection .cell{padding-left:14px;padding-right:14px}.el-table-filter{border:solid 1px var(--el-border-color-lighter);border-radius:2px;background-color:#fff;box-shadow:var(--el-box-shadow-light);box-sizing:border-box}.el-table-filter__list{padding:5px 0;margin:0;list-style:none;min-width:100px}.el-table-filter__list-item{line-height:36px;padding:0 10px;cursor:pointer;font-size:var(--el-font-size-base)}.el-table-filter__list-item:hover{background-color:var(--el-color-primary-light-9);color:var(--el-color-primary)}.el-table-filter__list-item.is-active{background-color:var(--el-color-primary);color:#fff}.el-table-filter__content{min-width:100px}.el-table-filter__bottom{border-top:1px solid var(--el-border-color-lighter);padding:8px}.el-table-filter__bottom button{background:0 0;border:none;color:var(--el-text-color-regular);cursor:pointer;font-size:var(--el-font-size-small);padding:0 3px}.el-table-filter__bottom button:hover{color:var(--el-color-primary)}.el-table-filter__bottom button:focus{outline:0}.el-table-filter__bottom button.is-disabled{color:var(--el-disabled-text-color);cursor:not-allowed}.el-table-filter__wrap{max-height:280px}.el-table-filter__checkbox-group{padding:10px}.el-table-filter__checkbox-group label.el-checkbox{display:flex;align-items:center;margin-right:5px;margin-bottom:12px;margin-left:5px;height:unset}.el-table-filter__checkbox-group .el-checkbox:last-child{margin-bottom:0}.el-table{--el-table-border-color:var(--el-border-color-lighter);--el-table-border:1px solid var(--el-table-border-color);--el-table-text-color:var(--el-text-color-regular);--el-table-header-text-color:var(--el-text-color-secondary);--el-table-row-hover-bg-color:var(--el-fill-color-light);--el-table-current-row-bg-color:var(--el-color-primary-light-9);--el-table-header-bg-color:var(--el-bg-color);--el-table-fixed-box-shadow:var(--el-box-shadow-light);--el-table-bg-color:var(--el-fill-color-blank);--el-table-tr-bg-color:var(--el-fill-color-blank);--el-table-expanded-cell-bg-color:var(--el-fill-color-blank);--el-table-fixed-left-column:inset 10px 0 10px -10px rgba(0, 0, 0, .15);--el-table-fixed-right-column:inset -10px 0 10px -10px rgba(0, 0, 0, .15)}.el-table{position:relative;overflow:hidden;box-sizing:border-box;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:100%;max-width:100%;background-color:var(--el-table-bg-color);font-size:14px;color:var(--el-table-text-color)}.el-table__inner-wrapper{position:relative;display:flex;flex-direction:column;height:100%}.el-table__inner-wrapper:before{left:0;bottom:0;width:100%;height:1px}.el-table.has-footer.el-table--fluid-height tr:last-child td.el-table__cell,.el-table.has-footer.el-table--scrollable-y tr:last-child td.el-table__cell{border-bottom-color:transparent}.el-table__empty-block{position:-webkit-sticky;position:sticky;left:0;min-height:60px;text-align:center;width:100%;display:flex;justify-content:center;align-items:center}.el-table__empty-text{line-height:60px;width:50%;color:var(--el-text-color-secondary)}.el-table__expand-column .cell{padding:0;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-table__expand-icon{position:relative;cursor:pointer;color:var(--el-text-color-regular);font-size:12px;transition:transform var(--el-transition-duration-fast) ease-in-out;height:20px}.el-table__expand-icon--expanded{transform:rotate(90deg)}.el-table__expand-icon>.el-icon{font-size:12px}.el-table__expanded-cell{background-color:var(--el-table-expanded-cell-bg-color)}.el-table__expanded-cell[class*=cell]{padding:20px 50px}.el-table__expanded-cell:hover{background-color:transparent!important}.el-table__placeholder{display:inline-block;width:20px}.el-table__append-wrapper{overflow:hidden}.el-table--fit{border-right:0;border-bottom:0}.el-table--fit .el-table__cell.gutter{border-right-width:1px}.el-table thead{color:var(--el-table-header-text-color);font-weight:500}.el-table thead.is-group th.el-table__cell{background:var(--el-fill-color-light)}.el-table .el-table__cell{padding:8px 0;min-width:0;box-sizing:border-box;text-overflow:ellipsis;vertical-align:middle;position:relative;text-align:left;z-index:1}.el-table .el-table__cell.is-center{text-align:center}.el-table .el-table__cell.is-right{text-align:right}.el-table .el-table__cell.gutter{width:15px;border-right-width:0;border-bottom-width:0;padding:0}.el-table .el-table__cell.is-hidden>*{visibility:hidden}.el-table .cell{box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:normal;word-break:break-all;line-height:23px;padding:0 12px}.el-table .cell.el-tooltip{white-space:nowrap;min-width:50px}.el-table--large{font-size:var(--el-font-size-base)}.el-table--large .el-table__cell{padding:12px 0}.el-table--large .cell{padding:0 16px}.el-table--default{font-size:14px}.el-table--default .el-table__cell{padding:8px 0}.el-table--default .cell{padding:0 12px}.el-table--small{font-size:12px}.el-table--small .el-table__cell{padding:4px 0}.el-table--small .cell{padding:0 8px}.el-table tr{background-color:var(--el-table-tr-bg-color)}.el-table tr input[type=checkbox]{margin:0}.el-table td.el-table__cell,.el-table th.el-table__cell.is-leaf{border-bottom:var(--el-table-border)}.el-table th.el-table__cell.is-sortable{cursor:pointer}.el-table th.el-table__cell{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:var(--el-table-header-bg-color)}.el-table th.el-table__cell>.cell.highlight{color:var(--el-color-primary)}.el-table th.el-table__cell.required>div:before{display:inline-block;content:"";width:8px;height:8px;border-radius:50%;background:#ff4d51;margin-right:5px;vertical-align:middle}.el-table td.el-table__cell div{box-sizing:border-box}.el-table td.el-table__cell.gutter{width:0}.el-table__footer-wrapper{border-top:var(--el-table-border)}.el-table--border .el-table__inner-wrapper:after,.el-table--border:after,.el-table--border:before,.el-table__inner-wrapper:before{content:"";position:absolute;background-color:var(--el-table-border-color);z-index:3}.el-table--border .el-table__inner-wrapper:after{left:0;top:0;width:100%;height:1px}.el-table--border:before{top:-1px;left:0;width:1px;height:100%}.el-table--border:after{top:-1px;right:0;width:1px;height:100%}.el-table--border .el-table__inner-wrapper{border-right:none;border-bottom:none}.el-table--border .el-table__footer-wrapper{position:relative;flex-shrink:0}.el-table--border .el-table__cell{border-right:var(--el-table-border)}.el-table--border th.el-table__cell.gutter:last-of-type{border-bottom:var(--el-table-border);border-bottom-width:1px}.el-table--border th.el-table__cell{border-bottom:var(--el-table-border)}.el-table--hidden{visibility:hidden}.el-table__body-wrapper,.el-table__footer-wrapper,.el-table__header-wrapper{width:100%}.el-table__body-wrapper tr td.el-table-fixed-column--left,.el-table__body-wrapper tr td.el-table-fixed-column--right,.el-table__body-wrapper tr th.el-table-fixed-column--left,.el-table__body-wrapper tr th.el-table-fixed-column--right,.el-table__footer-wrapper tr td.el-table-fixed-column--left,.el-table__footer-wrapper tr td.el-table-fixed-column--right,.el-table__footer-wrapper tr th.el-table-fixed-column--left,.el-table__footer-wrapper tr th.el-table-fixed-column--right,.el-table__header-wrapper tr td.el-table-fixed-column--left,.el-table__header-wrapper tr td.el-table-fixed-column--right,.el-table__header-wrapper tr th.el-table-fixed-column--left,.el-table__header-wrapper tr th.el-table-fixed-column--right{position:-webkit-sticky!important;position:sticky!important;z-index:2;background:var(--el-bg-color)}.el-table__body-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-last-column:before{content:"";position:absolute;top:0;width:10px;bottom:-1px;overflow-x:hidden;overflow-y:hidden;box-shadow:none;touch-action:none;pointer-events:none}.el-table__body-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-first-column:before{left:-10px}.el-table__body-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-last-column:before{right:-10px;box-shadow:none}.el-table__body-wrapper tr td.el-table__fixed-right-patch,.el-table__body-wrapper tr th.el-table__fixed-right-patch,.el-table__footer-wrapper tr td.el-table__fixed-right-patch,.el-table__footer-wrapper tr th.el-table__fixed-right-patch,.el-table__header-wrapper tr td.el-table__fixed-right-patch,.el-table__header-wrapper tr th.el-table__fixed-right-patch{position:-webkit-sticky!important;position:sticky!important;z-index:2;background:#fff;right:0}.el-table__header-wrapper{flex-shrink:0}.el-table__header-wrapper tr th.el-table-fixed-column--left,.el-table__header-wrapper tr th.el-table-fixed-column--right{background-color:var(--el-table-header-bg-color)}.el-table__body,.el-table__footer,.el-table__header{table-layout:fixed;border-collapse:separate}.el-table__footer-wrapper,.el-table__header-wrapper{overflow:hidden}.el-table__footer-wrapper tbody td.el-table__cell,.el-table__header-wrapper tbody td.el-table__cell{background-color:var(--el-table-row-hover-bg-color);color:var(--el-table-text-color)}.el-table__body-wrapper .el-table-column--selection>.cell,.el-table__header-wrapper .el-table-column--selection>.cell{display:inline-flex;align-items:center;height:23px}.el-table__body-wrapper .el-table-column--selection .el-checkbox,.el-table__header-wrapper .el-table-column--selection .el-checkbox{height:unset}.el-table.is-scrolling-left .el-table-fixed-column--right.is-first-column:before{box-shadow:var(--el-table-fixed-right-column)}.el-table.is-scrolling-left.el-table--border .el-table-fixed-column--left.is-last-column.el-table__cell{border-right:var(--el-table-border)}.el-table.is-scrolling-left th.el-table-fixed-column--left{background-color:var(--el-table-header-bg-color)}.el-table.is-scrolling-right .el-table-fixed-column--left.is-last-column:before{box-shadow:var(--el-table-fixed-left-column)}.el-table.is-scrolling-right .el-table-fixed-column--left.is-last-column.el-table__cell{border-right:none}.el-table.is-scrolling-right th.el-table-fixed-column--right{background-color:var(--el-table-header-bg-color)}.el-table.is-scrolling-middle .el-table-fixed-column--left.is-last-column.el-table__cell{border-right:none}.el-table.is-scrolling-middle .el-table-fixed-column--right.is-first-column:before{box-shadow:var(--el-table-fixed-right-column)}.el-table.is-scrolling-middle .el-table-fixed-column--left.is-last-column:before{box-shadow:var(--el-table-fixed-left-column)}.el-table.is-scrolling-none .el-table-fixed-column--left.is-first-column:before,.el-table.is-scrolling-none .el-table-fixed-column--left.is-last-column:before,.el-table.is-scrolling-none .el-table-fixed-column--right.is-first-column:before,.el-table.is-scrolling-none .el-table-fixed-column--right.is-last-column:before{box-shadow:none}.el-table.is-scrolling-none th.el-table-fixed-column--left,.el-table.is-scrolling-none th.el-table-fixed-column--right{background-color:var(--el-table-header-bg-color)}.el-table__body-wrapper{overflow:hidden;position:relative;flex:1}.el-table__body-wrapper .el-scrollbar__bar{z-index:2}.el-table .caret-wrapper{display:inline-flex;flex-direction:column;align-items:center;height:14px;width:24px;vertical-align:middle;cursor:pointer;overflow:initial;position:relative}.el-table .sort-caret{width:0;height:0;border:solid 5px transparent;position:absolute;left:7px}.el-table .sort-caret.ascending{border-bottom-color:var(--el-text-color-placeholder);top:-5px}.el-table .sort-caret.descending{border-top-color:var(--el-text-color-placeholder);bottom:-3px}.el-table .ascending .sort-caret.ascending{border-bottom-color:var(--el-color-primary)}.el-table .descending .sort-caret.descending{border-top-color:var(--el-color-primary)}.el-table .hidden-columns{visibility:hidden;position:absolute;z-index:-1}.el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell{background:var(--el-fill-color-lighter)}.el-table--striped .el-table__body tr.el-table__row--striped.current-row td.el-table__cell{background-color:var(--el-table-current-row-bg-color)}.el-table__body tr.hover-row.current-row>td.el-table__cell,.el-table__body tr.hover-row.el-table__row--striped.current-row>td.el-table__cell,.el-table__body tr.hover-row.el-table__row--striped>td.el-table__cell,.el-table__body tr.hover-row>td.el-table__cell{background-color:var(--el-table-row-hover-bg-color)}.el-table__body tr.current-row>td.el-table__cell{background-color:var(--el-table-current-row-bg-color)}.el-table__column-resize-proxy{position:absolute;left:200px;top:0;bottom:0;width:0;border-left:var(--el-table-border);z-index:10}.el-table__column-filter-trigger{display:inline-block;cursor:pointer}.el-table__column-filter-trigger i{color:var(--el-color-info);font-size:14px;vertical-align:middle}.el-table__border-left-patch{top:0;left:0;width:1px;height:100%;z-index:3;position:absolute;background-color:var(--el-table-border-color)}.el-table__border-bottom-patch{left:0;height:1px;z-index:3;position:absolute;background-color:var(--el-table-border-color)}.el-table__border-right-patch{top:0;height:100%;width:1px;z-index:3;position:absolute;background-color:var(--el-table-border-color)}.el-table--enable-row-transition .el-table__body td.el-table__cell{transition:background-color .25s ease}.el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell{background-color:var(--el-table-row-hover-bg-color)}.el-table [class*=el-table__row--level] .el-table__expand-icon{display:inline-block;width:12px;line-height:12px;height:12px;text-align:center;margin-right:8px}.el-table .el-table.el-table--border .el-table__cell{border-right:var(--el-table-border)}.el-table:not(.el-table--border) .el-table__cell{border-right:none}.el-table:not(.el-table--border)>.el-table__inner-wrapper:after{content:none}.el-table-v2{--el-table-border-color:var(--el-border-color-lighter);--el-table-border:1px solid var(--el-table-border-color);--el-table-text-color:var(--el-text-color-regular);--el-table-header-text-color:var(--el-text-color-secondary);--el-table-row-hover-bg-color:var(--el-fill-color-light);--el-table-current-row-bg-color:var(--el-color-primary-light-9);--el-table-header-bg-color:var(--el-bg-color);--el-table-fixed-box-shadow:var(--el-box-shadow-light);--el-table-bg-color:var(--el-fill-color-blank);--el-table-tr-bg-color:var(--el-fill-color-blank);--el-table-expanded-cell-bg-color:var(--el-fill-color-blank);--el-table-fixed-left-column:inset 10px 0 10px -10px rgba(0, 0, 0, .15);--el-table-fixed-right-column:inset -10px 0 10px -10px rgba(0, 0, 0, .15)}.el-table-v2{font-size:14px}.el-table-v2 *{box-sizing:border-box}.el-table-v2__root{position:relative}.el-table-v2__root:hover .el-table-v2__main .el-virtual-scrollbar{opacity:1}.el-table-v2__main{display:flex;flex-direction:column-reverse;position:absolute;overflow:hidden;top:0;background-color:var(--el-bg-color);left:0}.el-table-v2__main .el-vl__horizontal,.el-table-v2__main .el-vl__vertical{z-index:2}.el-table-v2__left{display:flex;flex-direction:column-reverse;position:absolute;overflow:hidden;top:0;background-color:var(--el-bg-color);left:0;box-shadow:2px 0 4px #0000000f}.el-table-v2__left .el-virtual-scrollbar{opacity:0}.el-table-v2__left .el-vl__horizontal,.el-table-v2__left .el-vl__vertical{z-index:-1}.el-table-v2__right{display:flex;flex-direction:column-reverse;position:absolute;overflow:hidden;top:0;background-color:var(--el-bg-color);right:0;box-shadow:-2px 0 4px #0000000f}.el-table-v2__right .el-virtual-scrollbar{opacity:0}.el-table-v2__right .el-vl__horizontal,.el-table-v2__right .el-vl__vertical{z-index:-1}.el-table-v2__header-row,.el-table-v2__row{-webkit-padding-end:var(--el-table-scrollbar-size);padding-inline-end:var(--el-table-scrollbar-size)}.el-table-v2__header-wrapper{overflow:hidden}.el-table-v2__header{position:relative;overflow:hidden}.el-table-v2__footer{position:absolute;left:0;right:0;bottom:0;overflow:hidden}.el-table-v2__empty{position:absolute;left:0}.el-table-v2__overlay{position:absolute;left:0;right:0;top:0;bottom:0;z-index:9999}.el-table-v2__header-row{display:flex;border-bottom:var(--el-table-border)}.el-table-v2__header-cell{display:flex;align-items:center;padding:0 8px;height:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;background-color:var(--el-table-header-bg-color);color:var(--el-table-header-text-color);font-weight:700}.el-table-v2__header-cell.is-align-center{justify-content:center;text-align:center}.el-table-v2__header-cell.is-align-right{justify-content:flex-end;text-align:right}.el-table-v2__header-cell.is-sortable{cursor:pointer}.el-table-v2__header-cell:hover .el-icon{display:block}.el-table-v2__sort-icon{transition:opacity,display var(--el-transition-duration);opacity:.6;display:none}.el-table-v2__sort-icon.is-sorting{display:block;opacity:1}.el-table-v2__row{border-bottom:var(--el-table-border);display:flex;align-items:center;transition:background-color var(--el-transition-duration)}.el-table-v2__row.is-hovered,.el-table-v2__row:hover{background-color:var(--el-table-row-hover-bg-color)}.el-table-v2__row-cell{height:100%;overflow:hidden;display:flex;align-items:center;padding:0 8px}.el-table-v2__row-cell.is-align-center{justify-content:center;text-align:center}.el-table-v2__row-cell.is-align-right{justify-content:flex-end;text-align:right}.el-table-v2__expand-icon{margin:0 4px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-table-v2__expand-icon svg{transition:transform var(--el-transition-duration)}.el-table-v2__expand-icon.is-expanded svg{transform:rotate(90deg)}.el-table-v2:not(.is-dynamic) .el-table-v2__cell-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-table-v2.is-dynamic .el-table-v2__row{overflow:hidden;align-items:stretch}.el-table-v2.is-dynamic .el-table-v2__row .el-table-v2__row-cell{word-break:break-all}.el-tabs{--el-tabs-header-height:40px}.el-tabs__header{padding:0;position:relative;margin:0 0 15px}.el-tabs__active-bar{position:absolute;bottom:0;left:0;height:2px;background-color:var(--el-color-primary);z-index:1;transition:width var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier),transform var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);list-style:none}.el-tabs__new-tab{display:flex;align-items:center;justify-content:center;float:right;border:1px solid var(--el-border-color);height:20px;width:20px;line-height:20px;margin:10px 0 10px 10px;border-radius:3px;text-align:center;font-size:12px;color:var(--el-text-color-primary);cursor:pointer;transition:all .15s}.el-tabs__new-tab .is-icon-plus{height:inherit;width:inherit;transform:scale(.8)}.el-tabs__new-tab .is-icon-plus svg{vertical-align:middle}.el-tabs__new-tab:hover{color:var(--el-color-primary)}.el-tabs__nav-wrap{overflow:hidden;margin-bottom:-1px;position:relative}.el-tabs__nav-wrap:after{content:"";position:absolute;left:0;bottom:0;width:100%;height:2px;background-color:var(--el-border-color-light);z-index:var(--el-index-normal)}.el-tabs__nav-wrap.is-scrollable{padding:0 20px;box-sizing:border-box}.el-tabs__nav-scroll{overflow:hidden}.el-tabs__nav-next,.el-tabs__nav-prev{position:absolute;cursor:pointer;line-height:44px;font-size:12px;color:var(--el-text-color-secondary);width:20px;text-align:center}.el-tabs__nav-next{right:0}.el-tabs__nav-prev{left:0}.el-tabs__nav{display:flex;white-space:nowrap;position:relative;transition:transform var(--el-transition-duration);float:left;z-index:calc(var(--el-index-normal) + 1)}.el-tabs__nav.is-stretch{min-width:100%;display:flex}.el-tabs__nav.is-stretch>*{flex:1;text-align:center}.el-tabs__item{padding:0 20px;height:var(--el-tabs-header-height);box-sizing:border-box;display:flex;align-items:center;justify-content:center;list-style:none;font-size:var(--el-font-size-base);font-weight:500;color:var(--el-text-color-primary);position:relative}.el-tabs__item:focus,.el-tabs__item:focus:active{outline:0}.el-tabs__item:focus-visible{box-shadow:0 0 2px 2px var(--el-color-primary) inset;border-radius:3px}.el-tabs__item .is-icon-close{border-radius:50%;text-align:center;transition:all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);margin-left:5px}.el-tabs__item .is-icon-close:before{transform:scale(.9);display:inline-block}.el-tabs__item .is-icon-close:hover{background-color:var(--el-text-color-placeholder);color:#fff}.el-tabs__item.is-active{color:var(--el-color-primary)}.el-tabs__item:hover{color:var(--el-color-primary);cursor:pointer}.el-tabs__item.is-disabled{color:var(--el-disabled-text-color);cursor:not-allowed}.el-tabs__content{overflow:hidden;position:relative}.el-tabs--card>.el-tabs__header{border-bottom:1px solid var(--el-border-color-light);height:var(--el-tabs-header-height)}.el-tabs--card>.el-tabs__header .el-tabs__nav-wrap:after{content:none}.el-tabs--card>.el-tabs__header .el-tabs__nav{border:1px solid var(--el-border-color-light);border-bottom:none;border-radius:4px 4px 0 0;box-sizing:border-box}.el-tabs--card>.el-tabs__header .el-tabs__active-bar{display:none}.el-tabs--card>.el-tabs__header .el-tabs__item .is-icon-close{position:relative;font-size:12px;width:0;height:14px;overflow:hidden;right:-2px;transform-origin:100% 50%}.el-tabs--card>.el-tabs__header .el-tabs__item{border-bottom:1px solid transparent;border-left:1px solid var(--el-border-color-light);transition:color var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier),padding var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier)}.el-tabs--card>.el-tabs__header .el-tabs__item:first-child{border-left:none}.el-tabs--card>.el-tabs__header .el-tabs__item.is-closable:hover{padding-left:13px;padding-right:13px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-closable:hover .is-icon-close{width:14px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active{border-bottom-color:var(--el-bg-color)}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active.is-closable{padding-left:20px;padding-right:20px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active.is-closable .is-icon-close{width:14px}.el-tabs--border-card{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color)}.el-tabs--border-card>.el-tabs__content{padding:15px}.el-tabs--border-card>.el-tabs__header{background-color:var(--el-fill-color-light);border-bottom:1px solid var(--el-border-color-light);margin:0}.el-tabs--border-card>.el-tabs__header .el-tabs__nav-wrap:after{content:none}.el-tabs--border-card>.el-tabs__header .el-tabs__item{transition:all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);border:1px solid transparent;margin-top:-1px;color:var(--el-text-color-secondary)}.el-tabs--border-card>.el-tabs__header .el-tabs__item:first-child{margin-left:-1px}.el-tabs--border-card>.el-tabs__header .el-tabs__item+.el-tabs__item{margin-left:-1px}.el-tabs--border-card>.el-tabs__header .el-tabs__item.is-active{color:var(--el-color-primary);background-color:var(--el-bg-color-overlay);border-right-color:var(--el-border-color);border-left-color:var(--el-border-color)}.el-tabs--border-card>.el-tabs__header .el-tabs__item:not(.is-disabled):hover{color:var(--el-color-primary)}.el-tabs--border-card>.el-tabs__header .el-tabs__item.is-disabled{color:var(--el-disabled-text-color)}.el-tabs--border-card>.el-tabs__header .is-scrollable .el-tabs__item:first-child{margin-left:0}.el-tabs--bottom .el-tabs__item.is-bottom:nth-child(2),.el-tabs--bottom .el-tabs__item.is-top:nth-child(2),.el-tabs--top .el-tabs__item.is-bottom:nth-child(2),.el-tabs--top .el-tabs__item.is-top:nth-child(2){padding-left:0}.el-tabs--bottom .el-tabs__item.is-bottom:last-child,.el-tabs--bottom .el-tabs__item.is-top:last-child,.el-tabs--top .el-tabs__item.is-bottom:last-child,.el-tabs--top .el-tabs__item.is-top:last-child{padding-right:0}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2){padding-left:20px}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover{padding-left:13px}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:last-child{padding-right:20px}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover{padding-right:13px}.el-tabs--bottom .el-tabs__header.is-bottom{margin-bottom:0;margin-top:10px}.el-tabs--bottom.el-tabs--border-card .el-tabs__header.is-bottom{border-bottom:0;border-top:1px solid var(--el-border-color)}.el-tabs--bottom.el-tabs--border-card .el-tabs__nav-wrap.is-bottom{margin-top:-1px;margin-bottom:0}.el-tabs--bottom.el-tabs--border-card .el-tabs__item.is-bottom:not(.is-active){border:1px solid transparent}.el-tabs--bottom.el-tabs--border-card .el-tabs__item.is-bottom{margin:0 -1px -1px}.el-tabs--left,.el-tabs--right{overflow:hidden}.el-tabs--left .el-tabs__header.is-left,.el-tabs--left .el-tabs__header.is-right,.el-tabs--left .el-tabs__nav-scroll,.el-tabs--left .el-tabs__nav-wrap.is-left,.el-tabs--left .el-tabs__nav-wrap.is-right,.el-tabs--right .el-tabs__header.is-left,.el-tabs--right .el-tabs__header.is-right,.el-tabs--right .el-tabs__nav-scroll,.el-tabs--right .el-tabs__nav-wrap.is-left,.el-tabs--right .el-tabs__nav-wrap.is-right{height:100%}.el-tabs--left .el-tabs__active-bar.is-left,.el-tabs--left .el-tabs__active-bar.is-right,.el-tabs--right .el-tabs__active-bar.is-left,.el-tabs--right .el-tabs__active-bar.is-right{top:0;bottom:auto;width:2px;height:auto}.el-tabs--left .el-tabs__nav-wrap.is-left,.el-tabs--left .el-tabs__nav-wrap.is-right,.el-tabs--right .el-tabs__nav-wrap.is-left,.el-tabs--right .el-tabs__nav-wrap.is-right{margin-bottom:0}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev{height:30px;line-height:30px;width:100%;text-align:center;cursor:pointer}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next i,.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev i,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next i,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev i,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next i,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev i,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next i,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev i{transform:rotate(90deg)}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev{left:auto;top:0}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next{right:auto;bottom:0}.el-tabs--left .el-tabs__nav-wrap.is-left.is-scrollable,.el-tabs--left .el-tabs__nav-wrap.is-right.is-scrollable,.el-tabs--right .el-tabs__nav-wrap.is-left.is-scrollable,.el-tabs--right .el-tabs__nav-wrap.is-right.is-scrollable{padding:30px 0}.el-tabs--left .el-tabs__nav-wrap.is-left:after,.el-tabs--left .el-tabs__nav-wrap.is-right:after,.el-tabs--right .el-tabs__nav-wrap.is-left:after,.el-tabs--right .el-tabs__nav-wrap.is-right:after{height:100%;width:2px;bottom:auto;top:0}.el-tabs--left .el-tabs__nav.is-left,.el-tabs--left .el-tabs__nav.is-right,.el-tabs--right .el-tabs__nav.is-left,.el-tabs--right .el-tabs__nav.is-right{flex-direction:column}.el-tabs--left .el-tabs__item.is-left,.el-tabs--right .el-tabs__item.is-left{justify-content:flex-end}.el-tabs--left .el-tabs__item.is-right,.el-tabs--right .el-tabs__item.is-right{justify-content:flex-start}.el-tabs--left .el-tabs__header.is-left{float:left;margin-bottom:0;margin-right:10px}.el-tabs--left .el-tabs__nav-wrap.is-left{margin-right:-1px}.el-tabs--left .el-tabs__nav-wrap.is-left:after{left:auto;right:0}.el-tabs--left .el-tabs__active-bar.is-left{right:0;left:auto}.el-tabs--left .el-tabs__item.is-left{text-align:right}.el-tabs--left.el-tabs--card .el-tabs__active-bar.is-left{display:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left{border-left:none;border-right:1px solid var(--el-border-color-light);border-bottom:none;border-top:1px solid var(--el-border-color-light);text-align:left}.el-tabs--left.el-tabs--card .el-tabs__item.is-left:first-child{border-right:1px solid var(--el-border-color-light);border-top:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active{border:1px solid var(--el-border-color-light);border-right-color:#fff;border-left:none;border-bottom:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active:first-child{border-top:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active:last-child{border-bottom:none}.el-tabs--left.el-tabs--card .el-tabs__nav{border-radius:4px 0 0 4px;border-bottom:1px solid var(--el-border-color-light);border-right:none}.el-tabs--left.el-tabs--card .el-tabs__new-tab{float:none}.el-tabs--left.el-tabs--border-card .el-tabs__header.is-left{border-right:1px solid var(--el-border-color)}.el-tabs--left.el-tabs--border-card .el-tabs__item.is-left{border:1px solid transparent;margin:-1px 0 -1px -1px}.el-tabs--left.el-tabs--border-card .el-tabs__item.is-left.is-active{border-color:transparent;border-top-color:#d1dbe5;border-bottom-color:#d1dbe5}.el-tabs--right .el-tabs__header.is-right{float:right;margin-bottom:0;margin-left:10px}.el-tabs--right .el-tabs__nav-wrap.is-right{margin-left:-1px}.el-tabs--right .el-tabs__nav-wrap.is-right:after{left:0;right:auto}.el-tabs--right .el-tabs__active-bar.is-right{left:0}.el-tabs--right.el-tabs--card .el-tabs__active-bar.is-right{display:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right{border-bottom:none;border-top:1px solid var(--el-border-color-light)}.el-tabs--right.el-tabs--card .el-tabs__item.is-right:first-child{border-left:1px solid var(--el-border-color-light);border-top:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active{border:1px solid var(--el-border-color-light);border-left-color:#fff;border-right:none;border-bottom:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active:first-child{border-top:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active:last-child{border-bottom:none}.el-tabs--right.el-tabs--card .el-tabs__nav{border-radius:0 4px 4px 0;border-bottom:1px solid var(--el-border-color-light);border-left:none}.el-tabs--right.el-tabs--border-card .el-tabs__header.is-right{border-left:1px solid var(--el-border-color)}.el-tabs--right.el-tabs--border-card .el-tabs__item.is-right{border:1px solid transparent;margin:-1px -1px -1px 0}.el-tabs--right.el-tabs--border-card .el-tabs__item.is-right.is-active{border-color:transparent;border-top-color:#d1dbe5;border-bottom-color:#d1dbe5}.slideInLeft-transition,.slideInRight-transition{display:inline-block}.slideInRight-enter{-webkit-animation:slideInRight-enter var(--el-transition-duration);animation:slideInRight-enter var(--el-transition-duration)}.slideInRight-leave{position:absolute;left:0;right:0;-webkit-animation:slideInRight-leave var(--el-transition-duration);animation:slideInRight-leave var(--el-transition-duration)}.slideInLeft-enter{-webkit-animation:slideInLeft-enter var(--el-transition-duration);animation:slideInLeft-enter var(--el-transition-duration)}.slideInLeft-leave{position:absolute;left:0;right:0;-webkit-animation:slideInLeft-leave var(--el-transition-duration);animation:slideInLeft-leave var(--el-transition-duration)}@-webkit-keyframes slideInRight-enter{0%{opacity:0;transform-origin:0 0;transform:translate(100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@keyframes slideInRight-enter{0%{opacity:0;transform-origin:0 0;transform:translate(100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@-webkit-keyframes slideInRight-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(100%);opacity:0}}@keyframes slideInRight-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(100%);opacity:0}}@-webkit-keyframes slideInLeft-enter{0%{opacity:0;transform-origin:0 0;transform:translate(-100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@keyframes slideInLeft-enter{0%{opacity:0;transform-origin:0 0;transform:translate(-100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@-webkit-keyframes slideInLeft-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(-100%);opacity:0}}@keyframes slideInLeft-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(-100%);opacity:0}}.el-tag{--el-tag-font-size:12px;--el-tag-border-radius:4px;--el-tag-border-radius-rounded:9999px}.el-tag{--el-tag-bg-color:var(--el-color-primary-light-9);--el-tag-border-color:var(--el-color-primary-light-8);--el-tag-hover-color:var(--el-color-primary);--el-tag-text-color:var(--el-color-primary);background-color:var(--el-tag-bg-color);border-color:var(--el-tag-border-color);color:var(--el-tag-text-color);display:inline-flex;justify-content:center;align-items:center;height:24px;padding:0 9px;font-size:var(--el-tag-font-size);line-height:1;border-width:1px;border-style:solid;border-radius:var(--el-tag-border-radius);box-sizing:border-box;white-space:nowrap;--el-icon-size:14px}.el-tag.el-tag--primary{--el-tag-bg-color:var(--el-color-primary-light-9);--el-tag-border-color:var(--el-color-primary-light-8);--el-tag-hover-color:var(--el-color-primary)}.el-tag.el-tag--success{--el-tag-bg-color:var(--el-color-success-light-9);--el-tag-border-color:var(--el-color-success-light-8);--el-tag-hover-color:var(--el-color-success)}.el-tag.el-tag--warning{--el-tag-bg-color:var(--el-color-warning-light-9);--el-tag-border-color:var(--el-color-warning-light-8);--el-tag-hover-color:var(--el-color-warning)}.el-tag.el-tag--danger{--el-tag-bg-color:var(--el-color-danger-light-9);--el-tag-border-color:var(--el-color-danger-light-8);--el-tag-hover-color:var(--el-color-danger)}.el-tag.el-tag--error{--el-tag-bg-color:var(--el-color-error-light-9);--el-tag-border-color:var(--el-color-error-light-8);--el-tag-hover-color:var(--el-color-error)}.el-tag.el-tag--info{--el-tag-bg-color:var(--el-color-info-light-9);--el-tag-border-color:var(--el-color-info-light-8);--el-tag-hover-color:var(--el-color-info)}.el-tag.el-tag--primary{--el-tag-text-color:var(--el-color-primary)}.el-tag.el-tag--success{--el-tag-text-color:var(--el-color-success)}.el-tag.el-tag--warning{--el-tag-text-color:var(--el-color-warning)}.el-tag.el-tag--danger{--el-tag-text-color:var(--el-color-danger)}.el-tag.el-tag--error{--el-tag-text-color:var(--el-color-error)}.el-tag.el-tag--info{--el-tag-text-color:var(--el-color-info)}.el-tag.is-hit{border-color:var(--el-color-primary)}.el-tag.is-round{border-radius:var(--el-tag-border-radius-rounded)}.el-tag .el-tag__close{color:var(--el-tag-text-color)}.el-tag .el-tag__close:hover{color:var(--el-color-white);background-color:var(--el-tag-hover-color)}.el-tag .el-icon{border-radius:50%;cursor:pointer;font-size:calc(var(--el-icon-size) - 2px);height:var(--el-icon-size);width:var(--el-icon-size)}.el-tag .el-tag__close{margin-left:6px}.el-tag--dark{--el-tag-bg-color:var(--el-color-primary);--el-tag-border-color:var(--el-color-primary);--el-tag-hover-color:var(--el-color-primary-light-3);--el-tag-text-color:var(--el-color-white)}.el-tag--dark.el-tag--primary{--el-tag-bg-color:var(--el-color-primary);--el-tag-border-color:var(--el-color-primary);--el-tag-hover-color:var(--el-color-primary-light-3)}.el-tag--dark.el-tag--success{--el-tag-bg-color:var(--el-color-success);--el-tag-border-color:var(--el-color-success);--el-tag-hover-color:var(--el-color-success-light-3)}.el-tag--dark.el-tag--warning{--el-tag-bg-color:var(--el-color-warning);--el-tag-border-color:var(--el-color-warning);--el-tag-hover-color:var(--el-color-warning-light-3)}.el-tag--dark.el-tag--danger{--el-tag-bg-color:var(--el-color-danger);--el-tag-border-color:var(--el-color-danger);--el-tag-hover-color:var(--el-color-danger-light-3)}.el-tag--dark.el-tag--error{--el-tag-bg-color:var(--el-color-error);--el-tag-border-color:var(--el-color-error);--el-tag-hover-color:var(--el-color-error-light-3)}.el-tag--dark.el-tag--info{--el-tag-bg-color:var(--el-color-info);--el-tag-border-color:var(--el-color-info);--el-tag-hover-color:var(--el-color-info-light-3)}.el-tag--dark.el-tag--primary,.el-tag--dark.el-tag--success,.el-tag--dark.el-tag--warning,.el-tag--dark.el-tag--danger,.el-tag--dark.el-tag--error,.el-tag--dark.el-tag--info{--el-tag-text-color:var(--el-color-white)}.el-tag--plain{--el-tag-border-color:var(--el-color-primary-light-5);--el-tag-hover-color:var(--el-color-primary);--el-tag-bg-color:var(--el-fill-color-blank)}.el-tag--plain.el-tag--primary{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-primary-light-5);--el-tag-hover-color:var(--el-color-primary)}.el-tag--plain.el-tag--success{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-success-light-5);--el-tag-hover-color:var(--el-color-success)}.el-tag--plain.el-tag--warning{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-warning-light-5);--el-tag-hover-color:var(--el-color-warning)}.el-tag--plain.el-tag--danger{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-danger-light-5);--el-tag-hover-color:var(--el-color-danger)}.el-tag--plain.el-tag--error{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-error-light-5);--el-tag-hover-color:var(--el-color-error)}.el-tag--plain.el-tag--info{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-info-light-5);--el-tag-hover-color:var(--el-color-info)}.el-tag.is-closable{padding-right:5px}.el-tag--large{padding:0 11px;height:32px;--el-icon-size:16px}.el-tag--large .el-tag__close{margin-left:8px}.el-tag--large.is-closable{padding-right:7px}.el-tag--small{padding:0 7px;height:20px;--el-icon-size:12px}.el-tag--small .el-tag__close{margin-left:4px}.el-tag--small.is-closable{padding-right:3px}.el-tag--small .el-icon-close{transform:scale(.8)}.el-tag.el-tag--primary.is-hit{border-color:var(--el-color-primary)}.el-tag.el-tag--success.is-hit{border-color:var(--el-color-success)}.el-tag.el-tag--warning.is-hit{border-color:var(--el-color-warning)}.el-tag.el-tag--danger.is-hit{border-color:var(--el-color-danger)}.el-tag.el-tag--error.is-hit{border-color:var(--el-color-error)}.el-tag.el-tag--info.is-hit{border-color:var(--el-color-info)}.el-text{--el-text-font-size:var(--el-font-size-base);--el-text-color:var(--el-text-color-regular)}.el-text{align-self:center;margin:0;padding:0;font-size:var(--el-text-font-size);color:var(--el-text-color);word-break:break-all}.el-text.is-truncated{display:inline-block;max-width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.el-text--large{--el-text-font-size:var(--el-font-size-medium)}.el-text--default{--el-text-font-size:var(--el-font-size-base)}.el-text--small{--el-text-font-size:var(--el-font-size-extra-small)}.el-text.el-text--primary{--el-text-color:var(--el-color-primary)}.el-text.el-text--success{--el-text-color:var(--el-color-success)}.el-text.el-text--warning{--el-text-color:var(--el-color-warning)}.el-text.el-text--danger{--el-text-color:var(--el-color-danger)}.el-text.el-text--error{--el-text-color:var(--el-color-error)}.el-text.el-text--info{--el-text-color:var(--el-color-info)}.el-text>.el-icon{vertical-align:-2px}.time-select{margin:5px 0;min-width:0}.time-select .el-picker-panel__content{max-height:200px;margin:0}.time-select-item{padding:8px 10px;font-size:14px;line-height:20px}.time-select-item.disabled{color:var(--el-datepicker-border-color);cursor:not-allowed}.time-select-item:hover{background-color:var(--el-fill-color-light);font-weight:700;cursor:pointer}.time-select .time-select-item.selected:not(.disabled){color:var(--el-color-primary);font-weight:700}.el-timeline-item{position:relative;padding-bottom:20px}.el-timeline-item__wrapper{position:relative;padding-left:28px;top:-3px}.el-timeline-item__tail{position:absolute;left:4px;height:100%;border-left:2px solid var(--el-timeline-node-color)}.el-timeline-item .el-timeline-item__icon{color:var(--el-color-white);font-size:var(--el-font-size-small)}.el-timeline-item__node{position:absolute;background-color:var(--el-timeline-node-color);border-color:var(--el-timeline-node-color);border-radius:50%;box-sizing:border-box;display:flex;justify-content:center;align-items:center}.el-timeline-item__node--normal{left:-1px;width:var(--el-timeline-node-size-normal);height:var(--el-timeline-node-size-normal)}.el-timeline-item__node--large{left:-2px;width:var(--el-timeline-node-size-large);height:var(--el-timeline-node-size-large)}.el-timeline-item__node.is-hollow{background:var(--el-color-white);border-style:solid;border-width:2px}.el-timeline-item__node--primary{background-color:var(--el-color-primary);border-color:var(--el-color-primary)}.el-timeline-item__node--success{background-color:var(--el-color-success);border-color:var(--el-color-success)}.el-timeline-item__node--warning{background-color:var(--el-color-warning);border-color:var(--el-color-warning)}.el-timeline-item__node--danger{background-color:var(--el-color-danger);border-color:var(--el-color-danger)}.el-timeline-item__node--info{background-color:var(--el-color-info);border-color:var(--el-color-info)}.el-timeline-item__dot{position:absolute;display:flex;justify-content:center;align-items:center}.el-timeline-item__content{color:var(--el-text-color-primary)}.el-timeline-item__timestamp{color:var(--el-text-color-secondary);line-height:1;font-size:var(--el-font-size-small)}.el-timeline-item__timestamp.is-top{margin-bottom:8px;padding-top:4px}.el-timeline-item__timestamp.is-bottom{margin-top:8px}.el-timeline{--el-timeline-node-size-normal:12px;--el-timeline-node-size-large:14px;--el-timeline-node-color:var(--el-border-color-light)}.el-timeline{margin:0;font-size:var(--el-font-size-base);list-style:none}.el-timeline .el-timeline-item:last-child .el-timeline-item__tail{display:none}.el-timeline .el-timeline-item__center{display:flex;align-items:center}.el-timeline .el-timeline-item__center .el-timeline-item__wrapper{width:100%}.el-timeline .el-timeline-item__center .el-timeline-item__tail{top:0}.el-timeline .el-timeline-item__center:first-child .el-timeline-item__tail{height:calc(50% + 10px);top:calc(50% - 10px)}.el-timeline .el-timeline-item__center:last-child .el-timeline-item__tail{display:block;height:calc(50% - 10px)}.el-tooltip-v2__content{--el-tooltip-v2-padding:5px 10px;--el-tooltip-v2-border-radius:4px;--el-tooltip-v2-border-color:var(--el-border-color);border-radius:var(--el-tooltip-v2-border-radius);color:var(--el-color-black);background-color:var(--el-color-white);padding:var(--el-tooltip-v2-padding);border:1px solid var(--el-border-color)}.el-tooltip-v2__arrow{position:absolute;color:var(--el-color-white);width:var(--el-tooltip-v2-arrow-width);height:var(--el-tooltip-v2-arrow-height);pointer-events:none;left:var(--el-tooltip-v2-arrow-x);top:var(--el-tooltip-v2-arrow-y)}.el-tooltip-v2__arrow:before{content:"";width:0;height:0;border:var(--el-tooltip-v2-arrow-border-width) solid transparent;position:absolute}.el-tooltip-v2__arrow:after{content:"";width:0;height:0;border:var(--el-tooltip-v2-arrow-border-width) solid transparent;position:absolute}.el-tooltip-v2__content[data-side^=top] .el-tooltip-v2__arrow{bottom:0}.el-tooltip-v2__content[data-side^=top] .el-tooltip-v2__arrow:before{border-top-color:var(--el-color-white);border-top-width:var(--el-tooltip-v2-arrow-border-width);border-bottom:0;top:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=top] .el-tooltip-v2__arrow:after{border-top-color:var(--el-border-color);border-top-width:var(--el-tooltip-v2-arrow-border-width);border-bottom:0;top:100%;z-index:-1}.el-tooltip-v2__content[data-side^=bottom] .el-tooltip-v2__arrow{top:0}.el-tooltip-v2__content[data-side^=bottom] .el-tooltip-v2__arrow:before{border-bottom-color:var(--el-color-white);border-bottom-width:var(--el-tooltip-v2-arrow-border-width);border-top:0;bottom:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=bottom] .el-tooltip-v2__arrow:after{border-bottom-color:var(--el-border-color);border-bottom-width:var(--el-tooltip-v2-arrow-border-width);border-top:0;bottom:100%;z-index:-1}.el-tooltip-v2__content[data-side^=left] .el-tooltip-v2__arrow{right:0}.el-tooltip-v2__content[data-side^=left] .el-tooltip-v2__arrow:before{border-left-color:var(--el-color-white);border-left-width:var(--el-tooltip-v2-arrow-border-width);border-right:0;left:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=left] .el-tooltip-v2__arrow:after{border-left-color:var(--el-border-color);border-left-width:var(--el-tooltip-v2-arrow-border-width);border-right:0;left:100%;z-index:-1}.el-tooltip-v2__content[data-side^=right] .el-tooltip-v2__arrow{left:0}.el-tooltip-v2__content[data-side^=right] .el-tooltip-v2__arrow:before{border-right-color:var(--el-color-white);border-right-width:var(--el-tooltip-v2-arrow-border-width);border-left:0;right:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=right] .el-tooltip-v2__arrow:after{border-right-color:var(--el-border-color);border-right-width:var(--el-tooltip-v2-arrow-border-width);border-left:0;right:100%;z-index:-1}.el-tooltip-v2__content.is-dark{--el-tooltip-v2-border-color:transparent;background-color:var(--el-color-black);color:var(--el-color-white);border-color:transparent}.el-tooltip-v2__content.is-dark .el-tooltip-v2__arrow{background-color:var(--el-color-black);border-color:transparent}.el-transfer{--el-transfer-border-color:var(--el-border-color-lighter);--el-transfer-border-radius:var(--el-border-radius-base);--el-transfer-panel-width:200px;--el-transfer-panel-header-height:40px;--el-transfer-panel-header-bg-color:var(--el-fill-color-light);--el-transfer-panel-footer-height:40px;--el-transfer-panel-body-height:278px;--el-transfer-item-height:30px;--el-transfer-filter-height:32px}.el-transfer{font-size:var(--el-font-size-base)}.el-transfer__buttons{display:inline-block;vertical-align:middle;padding:0 30px}.el-transfer__button{vertical-align:top}.el-transfer__button:nth-child(2){margin:0 0 0 10px}.el-transfer__button i,.el-transfer__button span{font-size:14px}.el-transfer__button .el-icon+span{margin-left:0}.el-transfer-panel{overflow:hidden;background:var(--el-bg-color-overlay);display:inline-block;text-align:left;vertical-align:middle;width:var(--el-transfer-panel-width);max-height:100%;box-sizing:border-box;position:relative}.el-transfer-panel__body{height:var(--el-transfer-panel-body-height);border-left:1px solid var(--el-transfer-border-color);border-right:1px solid var(--el-transfer-border-color);border-bottom:1px solid var(--el-transfer-border-color);border-bottom-left-radius:var(--el-transfer-border-radius);border-bottom-right-radius:var(--el-transfer-border-radius);overflow:hidden}.el-transfer-panel__body.is-with-footer{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.el-transfer-panel__list{margin:0;padding:6px 0;list-style:none;height:var(--el-transfer-panel-body-height);overflow:auto;box-sizing:border-box}.el-transfer-panel__list.is-filterable{height:calc(100% - var(--el-transfer-filter-height) - 30px);padding-top:0}.el-transfer-panel__item{height:var(--el-transfer-item-height);line-height:var(--el-transfer-item-height);padding-left:15px;display:block!important}.el-transfer-panel__item+.el-transfer-panel__item{margin-left:0}.el-transfer-panel__item.el-checkbox{color:var(--el-text-color-regular)}.el-transfer-panel__item:hover{color:var(--el-color-primary)}.el-transfer-panel__item.el-checkbox .el-checkbox__label{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;box-sizing:border-box;padding-left:22px;line-height:var(--el-transfer-item-height)}.el-transfer-panel__item .el-checkbox__input{position:absolute;top:8px}.el-transfer-panel__filter{text-align:center;padding:15px;box-sizing:border-box}.el-transfer-panel__filter .el-input__inner{height:var(--el-transfer-filter-height);width:100%;font-size:12px;display:inline-block;box-sizing:border-box;border-radius:calc(var(--el-transfer-filter-height)/ 2)}.el-transfer-panel__filter .el-icon-circle-close{cursor:pointer}.el-transfer-panel .el-transfer-panel__header{display:flex;align-items:center;height:var(--el-transfer-panel-header-height);background:var(--el-transfer-panel-header-bg-color);margin:0;padding-left:15px;border:1px solid var(--el-transfer-border-color);border-top-left-radius:var(--el-transfer-border-radius);border-top-right-radius:var(--el-transfer-border-radius);box-sizing:border-box;color:var(--el-color-black)}.el-transfer-panel .el-transfer-panel__header .el-checkbox{position:relative;display:flex;width:100%;align-items:center}.el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label{font-size:16px;color:var(--el-text-color-primary);font-weight:400}.el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label span{position:absolute;right:15px;top:50%;transform:translate3d(0,-50%,0);color:var(--el-text-color-secondary);font-size:12px;font-weight:400}.el-transfer-panel .el-transfer-panel__footer{height:var(--el-transfer-panel-footer-height);background:var(--el-bg-color-overlay);margin:0;padding:0;border:1px solid var(--el-transfer-border-color);border-bottom-left-radius:var(--el-transfer-border-radius);border-bottom-right-radius:var(--el-transfer-border-radius)}.el-transfer-panel .el-transfer-panel__footer:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-transfer-panel .el-transfer-panel__footer .el-checkbox{padding-left:20px;color:var(--el-text-color-regular)}.el-transfer-panel .el-transfer-panel__empty{margin:0;height:var(--el-transfer-item-height);line-height:var(--el-transfer-item-height);padding:6px 15px 0;color:var(--el-text-color-secondary);text-align:center}.el-transfer-panel .el-checkbox__label{padding-left:8px}.el-transfer-panel .el-checkbox__inner{height:14px;width:14px;border-radius:3px}.el-transfer-panel .el-checkbox__inner:after{height:6px;width:3px;left:4px}.el-tree{--el-tree-node-hover-bg-color:var(--el-fill-color-light);--el-tree-text-color:var(--el-text-color-regular);--el-tree-expand-icon-color:var(--el-text-color-placeholder)}.el-tree{position:relative;cursor:default;background:var(--el-fill-color-blank);color:var(--el-tree-text-color);font-size:var(--el-font-size-base)}.el-tree__empty-block{position:relative;min-height:60px;text-align:center;width:100%;height:100%}.el-tree__empty-text{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);color:var(--el-text-color-secondary);font-size:var(--el-font-size-base)}.el-tree__drop-indicator{position:absolute;left:0;right:0;height:1px;background-color:var(--el-color-primary)}.el-tree-node{white-space:nowrap;outline:0}.el-tree-node:focus>.el-tree-node__content{background-color:var(--el-tree-node-hover-bg-color)}.el-tree-node.is-drop-inner>.el-tree-node__content .el-tree-node__label{background-color:var(--el-color-primary);color:#fff}.el-tree-node__content{display:flex;align-items:center;height:26px;cursor:pointer}.el-tree-node__content>.el-tree-node__expand-icon{padding:6px;box-sizing:content-box}.el-tree-node__content>label.el-checkbox{margin-right:8px}.el-tree-node__content:hover{background-color:var(--el-tree-node-hover-bg-color)}.el-tree.is-dragging .el-tree-node__content{cursor:move}.el-tree.is-dragging .el-tree-node__content *{pointer-events:none}.el-tree.is-dragging.is-drop-not-allow .el-tree-node__content{cursor:not-allowed}.el-tree-node__expand-icon{cursor:pointer;color:var(--el-tree-expand-icon-color);font-size:12px;transform:rotate(0);transition:transform var(--el-transition-duration) ease-in-out}.el-tree-node__expand-icon.expanded{transform:rotate(90deg)}.el-tree-node__expand-icon.is-leaf{color:transparent;cursor:default}.el-tree-node__expand-icon.is-hidden{visibility:hidden}.el-tree-node__loading-icon{margin-right:8px;font-size:var(--el-font-size-base);color:var(--el-tree-expand-icon-color)}.el-tree-node>.el-tree-node__children{overflow:hidden;background-color:transparent}.el-tree-node.is-expanded>.el-tree-node__children{display:block}.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content{background-color:var(--el-color-primary-light-9)}.el-tree-select{--el-tree-node-hover-bg-color:var(--el-fill-color-light);--el-tree-text-color:var(--el-text-color-regular);--el-tree-expand-icon-color:var(--el-text-color-placeholder)}.el-tree-select__popper .el-tree-node__expand-icon{margin-left:8px}.el-tree-select__popper .el-tree-node.is-checked>.el-tree-node__content .el-select-dropdown__item.selected:after{content:none}.el-tree-select__popper .el-select-dropdown__item{flex:1;background:0 0!important;padding-left:0;height:20px;line-height:20px}.el-upload{--el-upload-dragger-padding-horizontal:40px;--el-upload-dragger-padding-vertical:10px}.el-upload{display:inline-flex;justify-content:center;align-items:center;cursor:pointer;outline:0}.el-upload__input{display:none}.el-upload__tip{font-size:12px;color:var(--el-text-color-regular);margin-top:7px}.el-upload iframe{position:absolute;z-index:-1;top:0;left:0;opacity:0}.el-upload--picture-card{--el-upload-picture-card-size:148px;background-color:var(--el-fill-color-lighter);border:1px dashed var(--el-border-color-darker);border-radius:6px;box-sizing:border-box;width:var(--el-upload-picture-card-size);height:var(--el-upload-picture-card-size);cursor:pointer;vertical-align:top;display:inline-flex;justify-content:center;align-items:center}.el-upload--picture-card i{font-size:28px;color:var(--el-text-color-secondary)}.el-upload--picture-card:hover{border-color:var(--el-color-primary);color:var(--el-color-primary)}.el-upload.is-drag{display:block}.el-upload:focus{border-color:var(--el-color-primary);color:var(--el-color-primary)}.el-upload:focus .el-upload-dragger{border-color:var(--el-color-primary)}.el-upload-dragger{padding:var(--el-upload-dragger-padding-horizontal) var(--el-upload-dragger-padding-vertical);background-color:var(--el-fill-color-blank);border:1px dashed var(--el-border-color);border-radius:6px;box-sizing:border-box;text-align:center;cursor:pointer;position:relative;overflow:hidden}.el-upload-dragger .el-icon--upload{font-size:67px;color:var(--el-text-color-placeholder);margin-bottom:16px;line-height:50px}.el-upload-dragger+.el-upload__tip{text-align:center}.el-upload-dragger~.el-upload__files{border-top:var(--el-border);margin-top:7px;padding-top:5px}.el-upload-dragger .el-upload__text{color:var(--el-text-color-regular);font-size:14px;text-align:center}.el-upload-dragger .el-upload__text em{color:var(--el-color-primary);font-style:normal}.el-upload-dragger:hover{border-color:var(--el-color-primary)}.el-upload-dragger.is-dragover{padding:calc(var(--el-upload-dragger-padding-horizontal) - 1px) calc(var(--el-upload-dragger-padding-vertical) - 1px);background-color:var(--el-color-primary-light-9);border:2px dashed var(--el-color-primary)}.el-upload-list{margin:10px 0 0;padding:0;list-style:none;position:relative}.el-upload-list__item{transition:all .5s cubic-bezier(.55,0,.1,1);font-size:14px;color:var(--el-text-color-regular);margin-bottom:5px;position:relative;box-sizing:border-box;border-radius:4px;width:100%}.el-upload-list__item .el-progress{position:absolute;top:20px;width:100%}.el-upload-list__item .el-progress__text{position:absolute;right:0;top:-13px}.el-upload-list__item .el-progress-bar{margin-right:0;padding-right:0}.el-upload-list__item .el-icon--upload-success{color:var(--el-color-success)}.el-upload-list__item .el-icon--close{display:none;position:absolute;right:5px;top:50%;cursor:pointer;opacity:.75;color:var(--el-text-color-regular);transition:opacity var(--el-transition-duration);transform:translateY(-50%)}.el-upload-list__item .el-icon--close:hover{opacity:1;color:var(--el-color-primary)}.el-upload-list__item .el-icon--close-tip{display:none;position:absolute;top:1px;right:5px;font-size:12px;cursor:pointer;opacity:1;color:var(--el-color-primary);font-style:normal}.el-upload-list__item:hover{background-color:var(--el-fill-color-light)}.el-upload-list__item:hover .el-icon--close{display:inline-flex}.el-upload-list__item:hover .el-progress__text{display:none}.el-upload-list__item .el-upload-list__item-info{display:inline-flex;justify-content:center;flex-direction:column;width:calc(100% - 30px);margin-left:4px}.el-upload-list__item.is-success .el-upload-list__item-status-label{display:inline-flex}.el-upload-list__item.is-success .el-upload-list__item-name:focus,.el-upload-list__item.is-success .el-upload-list__item-name:hover{color:var(--el-color-primary);cursor:pointer}.el-upload-list__item.is-success:focus:not(:hover) .el-icon--close-tip{display:inline-block}.el-upload-list__item.is-success:active,.el-upload-list__item.is-success:not(.focusing):focus{outline-width:0}.el-upload-list__item.is-success:active .el-icon--close-tip,.el-upload-list__item.is-success:not(.focusing):focus .el-icon--close-tip{display:none}.el-upload-list__item.is-success:focus .el-upload-list__item-status-label,.el-upload-list__item.is-success:hover .el-upload-list__item-status-label{display:none;opacity:0}.el-upload-list__item-name{color:var(--el-text-color-regular);display:inline-flex;text-align:center;align-items:center;padding:0 4px;transition:color var(--el-transition-duration);font-size:var(--el-font-size-base)}.el-upload-list__item-name .el-icon{margin-right:6px;color:var(--el-text-color-secondary)}.el-upload-list__item-file-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-upload-list__item-status-label{position:absolute;right:5px;top:0;line-height:inherit;display:none;height:100%;justify-content:center;align-items:center;transition:opacity var(--el-transition-duration)}.el-upload-list__item-delete{position:absolute;right:10px;top:0;font-size:12px;color:var(--el-text-color-regular);display:none}.el-upload-list__item-delete:hover{color:var(--el-color-primary)}.el-upload-list--picture-card{--el-upload-list-picture-card-size:148px;display:inline-flex;flex-wrap:wrap;margin:0}.el-upload-list--picture-card .el-upload-list__item{overflow:hidden;background-color:var(--el-fill-color-blank);border:1px solid var(--el-border-color);border-radius:6px;box-sizing:border-box;width:var(--el-upload-list-picture-card-size);height:var(--el-upload-list-picture-card-size);margin:0 8px 8px 0;padding:0;display:inline-flex}.el-upload-list--picture-card .el-upload-list__item .el-icon--check,.el-upload-list--picture-card .el-upload-list__item .el-icon--circle-check{color:#fff}.el-upload-list--picture-card .el-upload-list__item .el-icon--close{display:none}.el-upload-list--picture-card .el-upload-list__item:hover .el-upload-list__item-status-label{opacity:0;display:block}.el-upload-list--picture-card .el-upload-list__item:hover .el-progress__text{display:block}.el-upload-list--picture-card .el-upload-list__item .el-upload-list__item-name{display:none}.el-upload-list--picture-card .el-upload-list__item-thumbnail{width:100%;height:100%;-o-object-fit:contain;object-fit:contain}.el-upload-list--picture-card .el-upload-list__item-status-label{right:-15px;top:-6px;width:40px;height:24px;background:var(--el-color-success);text-align:center;transform:rotate(45deg)}.el-upload-list--picture-card .el-upload-list__item-status-label i{font-size:12px;margin-top:11px;transform:rotate(-45deg)}.el-upload-list--picture-card .el-upload-list__item-actions{position:absolute;width:100%;height:100%;left:0;top:0;cursor:default;display:inline-flex;justify-content:center;align-items:center;color:#fff;opacity:0;font-size:20px;background-color:var(--el-overlay-color-lighter);transition:opacity var(--el-transition-duration)}.el-upload-list--picture-card .el-upload-list__item-actions span{display:none;cursor:pointer}.el-upload-list--picture-card .el-upload-list__item-actions span+span{margin-left:1rem}.el-upload-list--picture-card .el-upload-list__item-actions .el-upload-list__item-delete{position:static;font-size:inherit;color:inherit}.el-upload-list--picture-card .el-upload-list__item-actions:hover{opacity:1}.el-upload-list--picture-card .el-upload-list__item-actions:hover span{display:inline-flex}.el-upload-list--picture-card .el-progress{top:50%;left:50%;transform:translate(-50%,-50%);bottom:auto;width:126px}.el-upload-list--picture-card .el-progress .el-progress__text{top:50%}.el-upload-list--picture .el-upload-list__item{overflow:hidden;z-index:0;background-color:var(--el-fill-color-blank);border:1px solid var(--el-border-color);border-radius:6px;box-sizing:border-box;margin-top:10px;padding:10px;display:flex;align-items:center}.el-upload-list--picture .el-upload-list__item .el-icon--check,.el-upload-list--picture .el-upload-list__item .el-icon--circle-check{color:#fff}.el-upload-list--picture .el-upload-list__item:hover .el-upload-list__item-status-label{opacity:0;display:inline-flex}.el-upload-list--picture .el-upload-list__item:hover .el-progress__text{display:block}.el-upload-list--picture .el-upload-list__item.is-success .el-upload-list__item-name i{display:none}.el-upload-list--picture .el-upload-list__item .el-icon--close{top:5px;transform:translateY(0)}.el-upload-list--picture .el-upload-list__item-thumbnail{display:inline-flex;justify-content:center;align-items:center;width:70px;height:70px;-o-object-fit:contain;object-fit:contain;position:relative;z-index:1;background-color:var(--el-color-white)}.el-upload-list--picture .el-upload-list__item-status-label{position:absolute;right:-17px;top:-7px;width:46px;height:26px;background:var(--el-color-success);text-align:center;transform:rotate(45deg)}.el-upload-list--picture .el-upload-list__item-status-label i{font-size:12px;margin-top:12px;transform:rotate(-45deg)}.el-upload-list--picture .el-progress{position:relative;top:-7px}.el-upload-cover{position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden;z-index:10;cursor:default}.el-upload-cover:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-upload-cover img{display:block;width:100%;height:100%}.el-upload-cover__label{right:-15px;top:-6px;width:40px;height:24px;background:var(--el-color-success);text-align:center;transform:rotate(45deg)}.el-upload-cover__label i{font-size:12px;margin-top:11px;transform:rotate(-45deg);color:#fff}.el-upload-cover__progress{display:inline-block;vertical-align:middle;position:static;width:243px}.el-upload-cover__progress+.el-upload__inner{opacity:0}.el-upload-cover__content{position:absolute;top:0;left:0;width:100%;height:100%}.el-upload-cover__interact{position:absolute;bottom:0;left:0;width:100%;height:100%;background-color:var(--el-overlay-color-light);text-align:center}.el-upload-cover__interact .btn{display:inline-block;color:#fff;font-size:14px;cursor:pointer;vertical-align:middle;transition:var(--el-transition-md-fade);margin-top:60px}.el-upload-cover__interact .btn i{margin-top:0}.el-upload-cover__interact .btn span{opacity:0;transition:opacity .15s linear}.el-upload-cover__interact .btn:not(:first-child){margin-left:35px}.el-upload-cover__interact .btn:hover{transform:translateY(-13px)}.el-upload-cover__interact .btn:hover span{opacity:1}.el-upload-cover__interact .btn i{color:#fff;display:block;font-size:24px;line-height:inherit;margin:0 auto 5px}.el-upload-cover__title{position:absolute;bottom:0;left:0;background-color:#fff;height:36px;width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:400;text-align:left;padding:0 10px;margin:0;line-height:36px;font-size:14px;color:var(--el-text-color-primary)}.el-upload-cover+.el-upload__inner{opacity:0;position:relative;z-index:1}.el-vl__wrapper{position:relative}.el-vl__wrapper:hover .el-virtual-scrollbar,.el-vl__wrapper.always-on .el-virtual-scrollbar{opacity:1}.el-vl__window{scrollbar-width:none}.el-vl__window::-webkit-scrollbar{display:none}.el-virtual-scrollbar{opacity:0;transition:opacity .34s ease-out}.el-virtual-scrollbar.always-on{opacity:1}.el-vg__wrapper{position:relative}.el-popper{--el-popper-border-radius:var(--el-popover-border-radius, 4px)}.el-popper{position:absolute;border-radius:var(--el-popper-border-radius);padding:5px 11px;z-index:2000;font-size:12px;line-height:20px;min-width:10px;word-wrap:break-word;visibility:visible}.el-popper.is-dark{color:var(--el-bg-color);background:var(--el-text-color-primary);border:1px solid var(--el-text-color-primary)}.el-popper.is-dark .el-popper__arrow:before{border:1px solid var(--el-text-color-primary);background:var(--el-text-color-primary);right:0}.el-popper.is-light{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light)}.el-popper.is-light .el-popper__arrow:before{border:1px solid var(--el-border-color-light);background:var(--el-bg-color-overlay);right:0}.el-popper.is-pure{padding:0}.el-popper__arrow{position:absolute;width:10px;height:10px;z-index:-1}.el-popper__arrow:before{position:absolute;width:10px;height:10px;z-index:-1;content:" ";transform:rotate(45deg);background:var(--el-text-color-primary);box-sizing:border-box}.el-popper[data-popper-placement^=top]>.el-popper__arrow{bottom:-5px}.el-popper[data-popper-placement^=top]>.el-popper__arrow:before{border-bottom-right-radius:2px}.el-popper[data-popper-placement^=bottom]>.el-popper__arrow{top:-5px}.el-popper[data-popper-placement^=bottom]>.el-popper__arrow:before{border-top-left-radius:2px}.el-popper[data-popper-placement^=left]>.el-popper__arrow{right:-5px}.el-popper[data-popper-placement^=left]>.el-popper__arrow:before{border-top-right-radius:2px}.el-popper[data-popper-placement^=right]>.el-popper__arrow{left:-5px}.el-popper[data-popper-placement^=right]>.el-popper__arrow:before{border-bottom-left-radius:2px}.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent!important;border-left-color:transparent!important}.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent!important;border-right-color:transparent!important}.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent!important;border-bottom-color:transparent!important}.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent!important;border-top-color:transparent!important}.el-select-dropdown__item{font-size:var(--el-font-size-base);padding:0 32px 0 20px;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--el-text-color-regular);height:34px;line-height:34px;box-sizing:border-box;cursor:pointer}.el-select-dropdown__item.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-select-dropdown__item.hover,.el-select-dropdown__item:hover{background-color:var(--el-fill-color-light)}.el-select-dropdown__item.selected{color:var(--el-color-primary);font-weight:700}.el-statistic{--el-statistic-title-font-weight:400;--el-statistic-title-font-size:var(--el-font-size-extra-small);--el-statistic-title-color:var(--el-text-color-regular);--el-statistic-content-font-weight:400;--el-statistic-content-font-size:var(--el-font-size-extra-large);--el-statistic-content-color:var(--el-text-color-primary)}.el-statistic__head{font-weight:var(--el-statistic-title-font-weight);font-size:var(--el-statistic-title-font-size);color:var(--el-statistic-title-color);line-height:20px;margin-bottom:4px}.el-statistic__content{font-weight:var(--el-statistic-content-font-weight);font-size:var(--el-statistic-content-font-size);color:var(--el-statistic-content-color)}.el-statistic__value{display:inline-block}.el-statistic__prefix{margin-right:4px;display:inline-block}.el-statistic__suffix{margin-left:4px;display:inline-block}.el-button{height:32rem!important;padding:8rem 15rem!important;font-size:14rem!important}.el-input__wrapper{padding:1rem 11rem!important}.el-input{height:32rem!important;font-size:14rem!important}.jt-wall-row .col-left{font-size:14rem!important}.el-color-picker__trigger{height:32rem!important;padding:4rem!important}.el-radio-button__inner{padding:8rem 15rem!important;font-size:14rem}.el-textarea__inner{padding:5rem 11rem!important;font-size:14rem}.el-input__inner{height:32rem!important;font-size:14rem!important}.jt-wall-row{display:flex;flex-direction:row;height:40rem;align-items:center}.jt-wall-row .col-left{display:flex;align-items:center;justify-content:right;width:60rem;font-family:Alimama_ShuHeiTi_Bold;font-weight:700;margin-right:8rem}.jt-wall-row .col-main{flex:1;display:flex;flex-direction:row}.jt-wall-row .col-main .el-input--suffix{background-color:#fff0}.jt-wall-row .col-main .el-input--suffix *{background-color:#fff0;color:#fff}.jt-wall-row .col-main .el-input-number__decrease,.jt-wall-row .col-main .el-input-number__increase{background-color:#3489ff;color:#fff}.jt-wall-dialog{pointer-events:none}.jt-wall-dialog .el-dialog{pointer-events:auto;position:absolute!important;background:rgba(5,45,155,.7);min-width:280rem;overflow:hidden;margin-top:0rem}.jt-wall-dialog .el-dialog .el-dialog__header{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyCAIAAAD9fhrKAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo4NTc1YTY2Yi1hY2U5LTUyNDctODM5MS01MGJjMjM4MDkxMDkiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RDY4MTUxMzk2RDM1MTFFRDkzM0JDNEQ5N0IwQTIxRjYiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RDY4MTUxMzg2RDM1MTFFRDkzM0JDNEQ5N0IwQTIxRjYiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6YjZlNTUzODYtMzRjZC02NDQyLWI4OTktODY4YTdiYTNkMzgyIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjg1NzVhNjZiLWFjZTktNTI0Ny04MzkxLTUwYmMyMzgwOTEwOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Po+VQtwAACdUSURBVHja7H1bluM4kiUMfEjuHpFZtY4+/TGLmQ3MmTMbnf1MdUX6QyIJ2MAAAjC8+JB7ZHZXh7LKQ6IoECSBy2sXFwb4/X/+X2FfEqDv5dh35mXeC+k2CzD/+XfxL72BeVbv04KI7uP6ByD7pZTy6ToMnUTwv3f7rgWG/cNXrhz7AcVtUfOiwP/kOg6mLGRVoq1JUewjsAoLWJQ2RdlTg7CD+y+eJW3MziVU1dfK/wV2LIhXJpQJ/nQhOUFWWxDJRYjnwnfItkB2Z8w/yC7sr9fnXpj8Y/9d27hw/2D4zm/0/4V92EcRtq+bMP9J+AX98UdadxN8oy/D/tXdBeWAvsBQM7/FvwklxzemJ0xyfrflu6JG1T+Hc1mrhKEA/wfTQ9BfAD119x9Ca2R1ZjuEqwdq/Kb7C9vO3oQzZJ9AKdAzqDuoGVC5r3r3j8Gp62XoJaT9g3WBDK3crwwIdfB+mxUmyJP0HXNGAj/uM1zNQWTs8MChMOvJEQYMuDxdepBAQGM7810t2MHIioItnEqwbOx66GBadMSXHHQiCgBHFmDV8h+rJcQPEUaLk+WIFi5YDnyQXPoUs0R+oyTfEWvdkKFaskPYju0t1RLCDrxM/luoHejIm+0qbZ9g6+P2/snOBWDRQVPAggLOgMEBFRh7PoY+DPaJvUIYIvjeb3eG9b39tH6zFoL0Q9eHzVt6A1qOKMdYE7cD+lsBDCtdya7B2QINBEj1YZqMxSAwIKL7J3DVdI0WHbWgY4HdyIp2Z7d+lvreTa+hfHep/M/ZhZS9Gr7pbthqXsmtsdXpepS9MHXTi5xf5XIzX3XXf/tfBkmer2MHkPKdGr0SOckyXGzoO60IYIGBUcEdYFZKSuikFMBLT7pxQprYwXrifAZwtfto3pi9bVEcXVKSVcKtPYT5lSnMlOAaQMKKUobEv2UXF9a7kx4vbkRWnGsxAKxnAIRnrPAtg9FFYM8l93Pg/YA9A31zZCeJfOOBv3znykOv2KG6W/YVpu+xtlHUjlvWXGzu3Dqd6rflx/ZRkH+0vEFofssYCXAbtSNB7O6gxylGfNhRGFFJOdT6jbbFR4jEcHa4EqKrlkOsD2LKs2J9AlGKdVtucv4I9TdQpftrrH88BUSO3QVHI7RaboRWiJW7zy+zoW/jd4Ie0b472y+Q2F+AwHXuXv79f39/GiHr3pCgXQpSxaMeYOx7cxYGBHIKkHIKQhxJ6MOimxQI25jVdWBCy0Up941DSE4JAfKQtUURDcqawrT21YUUnVHkUVoJfByheE0DCGLysIiwkiEX6zwZctkHb3JHofU0ivee7aJx/QoxOTT6b2OVMCmE/0RU0SctOfsqnOz6rS9KszI5Umh2dJHWNjsFXSsw+7nIcCEtKuys2VfILxcWwIf8TdGrI3wxQpQHU/zi5JEjD8HWclhMxX4ecMHgi4ZesOgyBGsZWokCrWD5kPM9otXwbOLK9OphesYiOWvWFA3qddNbivHFc81iq7r8ZrrvJ2Jz/zjuRqnuvQm46rtmsFO0Yaql4w7U4fH5YuJD+JiWsB3Dj9HRYdp0J81LGE7nySMmPZfxflbAemw6wGW42RLMj+bZHEtcL1145NmiPEMWGKmNAwOMkYchZyaenRYiWmgpLx0xcGfXrjwXdMw5xSG/3ZJ/5LKXa0D++I4+R9gKVwwtuVrpNzj6HS7syt/Fuj+E5ghJAAblHeFxG2rhzyWNfgRrZ2HPNDDCVjQm2P4ltPk9kZUfRRmssXRMgzGIhftL7zdCpBuClYxYi02LC7KWwK+JSH4Yj5tEhZiyjLwfBaiq4lSKGonKgzUBK5xdQr5C9wfT/5HCfx5vJhcRkQtYKVrN77BMnjtJPT5pGHK4LCCKHSBidDe/rzQt2S+7CEINL4bBsX7XiNURcTdot5/18NIPXVfiFK8GNB/tGZYhiWBSvt/n8gnN7+9kEccCJSSH4Ai4fsG+stU3BzDI+OEPMS/K7GXgz0foAf6wgVkiYIkJMk2F7/NimBayADDClrZIJDCHLUQBGTdCcKAsPXcKWqODsqABuJPFJApGpx+sskHE20jmINK6KFuAbxvgmR2cCoTE3le5KAoeODNymG7ZKP/IcbdjNrEZTmzVfzMaySEojcE3QeokTnEoYVCFCSxGAT4e3uCU7i/oxMokDCzQKq8MFeTRyv1OquEZoU/pURFgisp1oFhnfiWaxgYCkkEGH8SZMJDi1kBadlvEEcol+x6q4tQ2TwMGw8ClHzF2snu6vN0nFx4mwOUAyILQNNPY4tN1WKUeKDAr/Cj/Cg3QPBnMmhxm4bKoD1PUSML8SmcCZmCmC+dUCwizumlWobYFbEWUs3o8psoXijTeElqsCBeCVE+4wFcEIQsVg9IZNC3hyZhgI7AY1LUVv9KWFJhM/SZioY23iHN1O6bsJGd2lS1VZra/AzY0/HatTsQXG6Vl75MOhoySNjhIHlCzvq6xxMEmVCXH4sSms9wKMmLFeA0bHMxEK9Nl5jehZrEerTM8BUHmaIU5WvHzCvWW06u0NC2pJSZohXJQw3eUXfOZggX1wYMwhn1xU2EfqjZfHYhv1/F9MhGbZjw9xIkrAM0GJG6zoUs5ZhUHRR+PhWCKMGscDDlaNPUUgzcf9+V6IUVLJFSLUSp+ahC3m/9f+v6+UHDoQ9EYCAewWu81rILXyrY4cYMkdHfEyjNNYONMPOLDVd3L1MqVeWGmSqVgiyJ1j2AYptSYtACA2Haz94jN1gOprhSLFbEThhIAErkEIO7TIkOhwPA3+6EQ9cNhUUnEdAvW+0A4SnYdmCiZGhdwHfZCkTMpjlDZD9t8KtlFp+4ATNSuyJjcc1T2KC/rOGQmtIs04uc7uC+0MtxK6GVFFei14VY0QFiEfZipdpiVCajl/RXU1Azi7DaS2HoCRNzlVOmFzTt949XvwlMlKqzoWYnqZIDjZRxvcrkZJiWYkuUwa90NDUi836fn67h2X4dZWHKi+JMANJIMWf1tMphlbj4obTFr7GjokGNSEo95LMIUtgAvfTct2haFERQgYAF6FuMxCDzaoR+rDvQOfIQc+6Af0XaCFPjWYDvV+pEPVmCizfvxv3DqfqgA07sb9sRjARdgfVS/UoLHR31svBBwn/aHa8WPlf8Q07rh1pM6KZBHytXSMB1cx1z+YnQoFYOygQjMhB6RGaZ4ed6jkIRgmuNUihYrWg0erdoxYM7+AlotFAnqZQUxOej+2QNfDa0QK5aOiFZ/gKVp6eGTM9Xjt5UJihpdrYfsFbjKHxWHAAtqStYeyUKv0Zj+dB36DoCcpVHAQd+DV2xaFnz7mEyIZ5AmpeWV2DCQHS8rCcOzDGaZkI7uDmEW6Vl2FBIjI8mU+IxFetgiRZ94n2LUA1Cu5peAm8IjUgA17nnx7qqIXLGXeG0fU9sHYm5eozMNJg9kmldiOsn516qC4TGjS/JgwEQWxYY0iqWqDbVYK2tnpddKJPeCl4O1nbG0TImKmSyOdWJxUuXZ8aFMVp9Ej6/7G3MWUIv4ivFELH7H+UsyIBf0b3qZzt8NmPC1TaiKLlZBZkuDVqjWAcFuxP4pRSseyWJlWNAfjmxQ0ysQTcvFdX6t1OW3fMyxQZ8OhO/YstLtM6xtLEuCAshgEkcDWXbo0KBJMnDDBHIb0M3Xceh7mQwacg0+CEAx1lsDNYN1Xn2nb2/3ZRz70WEWRHaUR4jZaVgY6SU5/KdZRRjSvDH7wUR/wyCQJe/bWI9WQ66oka8RIUMAiD67YDFksV6ira3UD6E+BhLHBDBvIomCE4Ij1vigaFbY3hh/y0+zRLBsH5Ect8nUjo0MZKcTY3NMj4gN8QsTXplrzFgPUhKvQC42p0JVWVobpxjbWiFNWrOVzmkIYhEAZo4EZw1dPhC1R6sLmv8hVAc9c90qPTUTA8r5DbQSVZP/GjF1epXYGSVtaZen4WsHsA4oVbgl0kc6Zv8MUkrrRZiUghSzwqGUJiv8FXuac4NxxKuCWVl4aPe72LlE93mxCIP3aca+uww976xHYMsAUkeeMhMeLkyLYtw1nUyUMAQdmVGIFpPBO0g4R2YchsTXtQ5HYsmngY0JZJxLeDK4WiYgC+fdxvVvwTggMW/7UNmF6aLYjuxYfh+Moj/E5p55rzBy8Ky1MLkwfw85ugh+UrGqaRzBL0V5IhBHNzBUOF6ZFmxhJU5JFHRRM3ChyKV0kUlOLFa0rZogBvpV6joCVWzqDCw3WO4GrcRqtnrScvScvDaMkGIU307AZ2mawIo1awW6/qJ6O+aYjH4WV6+lTNQC9w0w6wvqdHjcBWqerHwECq0MDzS9ZobJYgp3ZoEnSuZBcrPB42iBJlItZM5xfmUhkhZYA7r+Ns3OFzUtNPPIY9YGbHE6sApMvZ1UeafpRrhq2SH049okePiARMLw4lIAL2+CwGAYxSihQxwKTQbbgJ011EZTEmoAcVQxzo7wY4eiFo1gHtIhYh7YAVblTxRYcehAnYwgYJPwM+kzfx/tEsmbvLbpr4oZfuifDeysoer+wvwnDfE3g5u8f2Y6OvPclsyljPKCkkWRoOhyt0DFXZXSGdcXlg+DVqFwsi/IIYw9J7/dGBB0bUfdOppvqEVuTGWiVfesB6ptKwKsq1e1GL3p0jrAsKLWzW9wLmPhASeE35nG9WiqItzmmd/LBLNMQDfRCRPQ+EaZ+rASfYYNLNJbwiwraaEdXnHOCRNpMmBKzYIJT0oIlzWoyvuiHacOdxWCuB4mzMTJW4nOFWLGCF7pYBRzKXD+hWGnAsICPEM6oue9W7w34THCvTHf5SxZx5PbDz5Rsb3bkXrioYd2qz6lnbIYjShoVKmgi9b0acyIp30nSbSGrjL8V8BNIue75mDYkJoCoBDxkSNW5nLvo5UkT/yHcEpO6hwL2K/6b6K/rA6JClDhgYaHVVfABnj1BzlU3XNQkqzcDRBVGYrdCFTgY55pvJYZHSJh0po8oQ5ooPSOlkJLgAp6axDxeumtFZ5uyETWCXwaRyjHgJyzPM4ByglXJ+DSy7stAeIMU4xhIvg5oOEmQp6IghEBhBBCCREjx/wWOgTiJ4pMiq8RaEgTNZz1JW37m6pTnOEMhMGmEWx746PGmkdk2WzAZ2e0HUuUryBUVfAqQS3wF9nbSLDjc4MqlIr7DxjsyOkN1OIIEUppw7Qh82okgSd/yKVfyflNqpufv5Wq7KsPVSJNZh7Z3Kl8TAL3BpMfe/WfuvEbnsAc19ZJ3yOZ4ccPa9bkGBSAyZIjUtBX/3qCSpXRw2yH3lK526Jc+cus3jWNQoJzfmKpH6/IVRAuh1n95CxagkndGI0O6wgiJBHOqnuDV6OK0EzkdlAGupzeBh7lpHRZPLggxqxRAn+AFlV9KgcF8W0sOGhiP96yP9no8djVEJsUoKQPmDHcAqRSllZKQuQ5IPtCJ1JOk5ujcs+XC9A0KU1q9o/VTnWJqFSyqhaxstbQN7ncc6s741ZU1eEbTWbG2nAg7t2kDXp1GrCSYReoh4TbjyYW9jByxNUW4kHP43BfFhqP416H4KhEpOk7Gp+crbROtZpsy7C4a9/d7Pij2dcAzjtSUVIyACiTiTCsCFFXZxX9SSwmvgRgNIrxRwZegXn5CxbAy2teXCjn/IsBNwsMRRxQDUOWaazPGJmom+MqTKe1s6i5FHaHXDAxdjSfZAefbdtjO9sqRHV/qPgudmgjxqmKUNGxMm6CdUcRZrQMc5BiGKENBHQOrbASVWFuSk06vFYWrRYvufc2Euwy2wH3WGEWikZzAxVl0UpkM28i3HVXbcvPoRMrcWc9Kj/+9Dnnwzry5IQ2Zomq+LXyF8KUwZAheZ/mKOMB8PDQORWeiJJBMhWw9D2kwz8UgUthMOtu0MoG4d450TtbaUKpMoWLcS53LHPwsTO332b+g6hkIRTBMpefgcdqq8GCtTsoc/ghcNMApn6FypjgCvIC6mmudjnLKennBCU5ecQjT1k8+ZOW4HWcNmI+Oo9lbFUFstT/WTHxYq4cYTcSt0KZKWIlXytN8zZRFFlDPfe5rBK4LghdVgBmDIuK6pwEJnJraMA7pMnMV+2n9TTQCnG/gT3Ok0+EhFsToUVNzCoHiZidU4LBLJK0bjQrMEkesMIWwEqOKAuqDIbPQoxnT1X2OLVW+O4+WS+ozWxDVvih7zvws5UxyWNTm0kQQjea9oNioudYbpVKfVJ8XF9wR3Uy5TKQMiZrMU9DRClg4335nYYGSgFUmkU546r8Nkxtyaa5ZGUC7Nz96v6t7aIyKbV+lPIn6cDpVgnVw7X2wdzqpetDXylyYdkVOWyl7CiOsl3IyM5mHdVxKnMMrKN4s1wMWik/zc9wn6sFvtKBgQW3S6bjmKI6MlstCUtMJHZJLvZ+jLkLt9Fq+/nBc5N8FrCwkavveGBYbC80+FWutvP4ZCfHt/uEGvPgyB5LUeIr7CqD+QXbKgY3zR+DiQagboasadPs1IfWhmcNfZdoWJlchKkRwu9mqJ6JESfL+9bWHow/btoKBPk+72+BOsYLBd51EHP9CZ6lETMuloBYDIErwyDVprDdPrI5vVgkOWq9P/IIPVjO9semovRogYjtjRW2VSFVWCN+WAwL5mN03BNwNWhFG3RuW03izAwf3SieJoeUWHO6CdU/CWlzOeRDmY0AUGS2We2Cyhx2HHEzR7v8roNoVUrseKxl7KpX+ABgcR4koFQNEsxqznfnuVFCT8x+yNKzZVZk5hd9smb5vDLMLs/dAbnt3v4ldjarkAQFsOEVcbmrWrTL/mS0ye7vk4rPniwNRGqPggihMXrlwI18HDAHKEhd2lAMswtRptvHhgiFNcnpSBIF3EztUOYthk0hbEM/2tCnWukcoK277Ra7e5VEKyVKYbMSMQNaBZ5SM0FoDXp4sjmOM3cw1jTskrqhz4bqDi0RHPepCVVZYIiVM6P8CuPzmuU9y7EVjG8t/MdCad/RCo6hFZ4OCc8PIO8NG5eYdZvUnXIuhPAoWpjJDHXpx76LFwViGJVJrPlIov/e8CE7P9qlVKYg0TCudlDJ8CZNehXwC8Is1liLkGwP02uHmIOsiIlmipCk9HGJIidpYV/AChAkOUiTjIgs711mCYN0lLNIQ1oLlwW3rSTWxNp2URwUoTEqB7VsL1D0lXTkBCE95W37FbsgmOUmbJAsgaK0QebyFFZOByu2hyhKlOGeaKf6ZMRHw4D9C9lEcTE8S06vujcIOKSzeEoZqyqHU0NE+YSDpDmD2WIZ1K5VN/3Q3RNl46tEvXhC2dyXT/FhDasJPznuiE2exakWwywT6H3cab5OktvXN8K+k7Q6Tj4jmvdkyJNGBsnMZz2YFj3Ns7K4YOK5y2BFdxS5vsZM862Hc8gX6JKUQvZcTrCWJXthaQCAz5CJxApZsIciW0YIc7isdKZKVFjLebCT/a6aL6GWGXd3GgXUdJzyPWw0zloNoWa5Fzmgi329t9WxzgUplVwCmOdbqIANf5Dod+gvdtLMBkhhbXzAcy8YoAfKdaUXsUw03a9/CtOPMZsSVD/v5DsNF4NZ3fSHsGJWUn2tpDIHUoRZ0InD8nqJ4J/0pRxjWHjU0d4IHDDDLEN8XJaFJE+m7+WDW8JnYzA7S7fHx/j80/U2zwawHFEywHexqSO22l8ZWjKVyZRzV2omHwYKkSZ9BagkFUe+gg3E7HcpdeISdAWReQIErmQlEnLE3Gya3iMv/MS3x/cR5+1U+BPK3H7I46Z81p6+k/OxQujxd3ghkVsqaxaVB0Eqe2Bo0RHPwndKqqdMgW+yWwwVQoBK1dpQxeynvRq/Ww/qvWCUKOcPA4uqt8FsKwzcGhHG/cv+IGDt+WgSHf3Qz6O6ZEiKiQSVc/1DYByr/D0OPVkZoKmF1YplUAVonjS3ZVkIXOzSXkN3GX1i1Wpa8SQzShYJWkVT4X1Wi8s8k156nhVUlOv1IE+7VxqF0gm5KVEFwGRr1jSgblKqDMtycnTKCYXHrOdiM4dnS9jaaGDbrvcjVqwjRxENh1ruvMIkC01xZXErCMIKVPGWa5q+fpdEW+J0nJyLYK3HJ8I5YRaSt/2D0vVpO25oMCtbpWYTp/hhNPQ4fpMTgLpVfrvcpV7IimXqvE2jTyVmOOxceSQkPB0bhmtheMq83OcF+SoyEH95HbqrAxcshr22YCsSk2XBm4nc1LryoCnQzabO5ihB3gqbwa8piuA1DCqloniZHymP5yCBLpHYqlBUkoqKQn7HjTpCNjdxe07fWSfU2TmJu213e4mn4673I/U5mPm9PtbHODSyYBObqCU2+EbT1uCm/N0Is9zKXfVflzJ/VhqgzczXLR/W9X4HpZUT9RvCXAlVKcBKZTBr7uJiq5we6MWEjdrAljkEdIemamJtXtmW2vDJkPAx3T0Fl0Vpw1MmZ78sVFiyTQ09raZTldghs97Uqzk5CV+vdIfQqu8SjZytiZPKQ9kzdd3bxICGrPFlXIJ7NZtIA4xUlY2YLQ+RZrKCjWud5bfL3sY1Lb4+KPr1arCPkvI0o5qG36IeFS0zmIDOhFrdRbQTrOLm0hhIijjYbDAa1NQh6U0GB7cEsupEGj+mQY55w9+Wd9TlUdFimbKu92FniAPxAUf7YwyrETqJzdiwHCo2UKJMGOgn5XGvlX3XSfl06Ya+q1A2n4evrulCSMsviLstyolWPZBoZTX7QqHHVB1PleCgYZmazospcEGsqeDFslIY85pm05DrRIyFnGno1zDBQf4M2EjP8cCz5fO9G35m+X8BWNXPBkUtrKqB3J7PO0cKraV+050yoda6jncp7Vdni7LPWl7FADC909ChWqR+FR3BFgpZ54QNW1l4q4dn4hKL85TmR5XLjXyS4zMdt41Wpy82PgBYZ6bLb9vfHZTcbLKXPGSyb/uOsmX1UlbCTN4OIGUUTJNSdIh5nZloE4f6RMkF2c2MEal2HhoIha6TmgMZLBJyYmEyh4L05USswqegGjnklzcTs1p3B44/sHiEA5sL11eZelWmqu5/ZK345orxj76gfeiNyYQHw0aWB34/LK3pXFk3jhEomKck6HehFeUyZpLWIe+431XDKAbZza+gZ1vgm9XI7OzCwzjFi9X9BcDZHWZRRA9mY3f/Q/SuzrIJzQcHOg60gv44MLW+qpMsu4lWxpkWytvX8JTaAUGPVjG/diW3ZKbVBPVn1vo+LbNPwWxiwKdxoOmH22pXJtUzVFpIYrcqmEi9YZgDZco+sSRighsgdtOmQyaOQ1yTFFpaSQZtojqvqJiXgmxjdVXBZHSKz9sJBB8gtka2Q2Uwvz2T50S2qnLWULtwTGtbXTMxmdBbu0QHKMF2KpVKYFjrnLEeIafVTSpF4Vg3tPVEbFaHWkuvhu9SvIKdxgzzh8EsNbxg1MiwyYGwgriUV/7yrfNDh8U56lXS6l+i0i+OORjw6ODgkZDwXARQMqN50WsamYokj26yyxNN0gOBVb26mNaTA6JBFn2b5yBaDUP/vGr2KAAqFxfaiqmFuHnSVgXLGBmnL1AfWhJ1CzqKRk2iEgk5LysXXqjhWnEfYGM2S2aPxWxNp222EYxumoVFNYnmgUlBTQ5X3DinJCazTnGr8Gq1N/bE0hNbUiRo3sdC1cYd6G3zOJrZp/6gUIskLWhL+yV8+V1BquGbFNKuz2xiECdpvawZrNp8qv7coL49WLuDlMtH9daa7WCo3PBijWAHiBUbADuFWUcWoajj04aehda78GHgJNONg2nIoNXQPV+GZtNOO3nJuQykGGL1MS1hcayL9UM0L3uJGmn9tc3DdbNJnKHiVQ2F5E0tXdXmKJAxRoQbD+forirjTcECT8RzefV2Ap9jfOin6UWHdI1Thi98qFolHOoDkCRaeYLZt43RRr4GDS2r1S+pAlU3SDTwizALSYanoUOhlFR/iOHJurTkgcGFgsFBZzCLlkxf3vMUo+tk7KnTCw7fRHfRZXh4JBh8XMP6xEtR1lCS2JM6MBphut86ILg1fQxbQGPAS9tI826Xt6GpmTZpHy2fkyQ2SDt5uawmbx2UnXmenQoGdcjn+dmrpyYKrYy5w6pcCXfVQww+1a2ui4fUzUPyT4KPWJH095+HrX2SpSK+6JWtT5EVDnztyXz1sc9VBvER2N0FiLRYks8NBHQ81MJ2eZVy7EKE0i57o0mUn96sDP9sC9yoRusj0JLOVOA7CFXjerq7/9DDM5Dj4euxZQ+wiuG8xrfxtVjX0ryoFiOTkhZtNvRquxwhapqXAxdafpXSgLrfdlIaptb3sBHrVfwB7GLPBH8+dG3oDlUU8ws0ayhWOcuJD1ak5nwAYaOVAx7puzvi44EYP1mlAo49Dzf2Sd2bmKX4hXOaQ6N1NNa/SD+2ltIol7eoD0VUq3cojT3iQcirajqmdvNdmqZpuJKVtHD7oVWNU8nZAHJ6FZp6JSzW9jW+RNvXSdg1oSUtezC/0lhkRfgSNkWXUiNTzeoaIB5F+UcZViM29AIQpa8yYaBuNva+k08XP0Nwo6OCaA032MWi55CfyBT4fLVzbtLHbHuIh0MYwYC13S+6EbXBtk4BqbyYS0pBs2jEKNC8SblJO2eLmyu+PUZfHo65Ho7IPj8N6EvqeTz7YO74PXB8bPbJ0k5fy6jlJS39TxPf6f4iBGzDU7XZazni+BuN9Nn8fLTU4E0Jg1mmQISj15P7J8iaL+X0B+i53oDVvbstNoXWRZTDcY+ilXl1f/8f/+fQo7uJJS60x2kitEJs7mxw6sUm/dwOglrfart41/stHsKU9Xwdu2q0DBUqlNeZbPcktCFurrN4dBvDISzoVmNqFWD726zc/6KWpn/JF+7lLMd16cA85MS2nrWj5KAd8gM78bg+utLy2fuZ0pI4GhkdLM8y4aG6U5sysSHA+cCWfPVCjiZidQXW+og5xI26nuxESFL6uQcPoDobZ1biN7cManQtFVWg8bu+f74OsL1OQftbskcEp5WdczN23ZMpsFS7anythHMT0X9MNDs616NKqo9Qj4ZbQNZSlPJhr4biDq1blYW3B7D+1+vLEOpAXFwfIdWPcMSGhEQ5ZPSC/bOQ/S5C1YLNTo2/CfFKsw4tdJKkZYf2cr3piOuV3O4dXn43PIsvWpH92ESOAhfdf3My3Ofly/7Q5awjEdgw0MRok9bYCusMulyG7skPCDYDt3ZU6MJA5Z1WNk9p/3Tpd5577eeGKertvkTRih0RK1DUQKeaAoV7UAK7T+m6hgWNFAK/wOunw9ODPOtIqZtTqutaLrm0KNQK8hCeOwtSzUnSIncCtX/rVl/U5TdaE0wcwqm0E0h1+V3AD1OOKNF5lbToEHr8rkiGg58PWO1TuM+LgZKNLiMNWo1+hmBDmm3mXLZ/5sVFmhgKvI6DHRDc66hY84zbRXTephmx6kwvbnViJoQWfxQbcJaVcyYchlN949c8wv9UyIbtBz9ugtg2sKGVtG7/VG15aLcyZHcgBeqN1qAn3jH3t3+o4beiQDzYuAxxQ+i6+U20GKVe5O0fOH5HK379fMAqerehVB/TdPcpXCrhonMbXNIBwRZXrSEXUk6r5WOKgNjR+mDjMMidltFAAeu0IutWGcU14WKbaycCaGvZLAH7I0rH0O0Xk/oLkQmOjR5ud/At/wmeePCg6u7/BPWih+fcVAWHRjN090wJv0k1t92B7Aj/Afgtc2kdfwiauJLmBJsCUbVmi6+G+PEFoXv4Qds/cO9MMPV2CzFarmqtKUMNuDiJ/fgQNUMujWiIVZgeKOyA4MuVkqrvx0Glux1dgtPZ5oqAY0/JDZ0bjksHtWRKsF3j3Zw+p3EL/nT+Be2nAB77yfbHLyz50PXBnbykR4ZNTtPhHdGAco3ioofvO/2/UQwlDrx0BviEXjkBTK/QKcwA5ThmUYYs2U0/nN2hqunZZX4mikDlg+HhOcBy67+/TxPiltA1kNvAgstDUsuiVHRa2V/0fWfQSsIBbKrdYFLBDMLyyR01negw48cDJwJnpIttgBON9RK+WpT5E4Kl40s6f2YtQnGyKPyiM8SvukxHi5LLfVWgilTLW304TAQ1+HT5m7z/sHYHl4Dhw3Audflet1Dt1Ra7UV3/1q0FNhq4XvqPf5hDGDb3AGYdsDUEBEVhSArFaLglKhta9e3pIuWBqtQggjSmSN/sgODQPz8NUC5ceuxKzrZAvfEQ3C0Pzj8K4Iv3+/X6VxK4HgG4RgMGJIOCgRo7DAe7vy3GwIHyMZh/9ZIUCJ1N8ACn6k9eDvJPXIJ/onWSZKqgSSrDqc51wtagNL7ZjFZ5XdOEwmPfv1yHo1ZlzMWg+7x8cBUf8DoOmWZfzrHYuMW3UOCGnWo/1sDTcIYPNesvgK9treVsOAQNEotbttctblhmkoF2lpvqQbEotrry9cEz/dLkNp9nsrsOr/p2bSM7ZdNXPZDREdZJgiG/KGlk/yHwe1lgC6dSEHRDh3/YqddNKmoN8bMaf09yPHw+JAwkBbGd2Mx2WwMuT2N/JlqL+66L6Ni5x2FlwKeLHRA8pnyVtz5RwfCEHHTunuNJV+fGI+ULYjc8GZKd9ZufNdTjsXL2AkKopk/HM+e1a4v8OZHzTxjhrfq27OQb63h4SIFyQ4edKcRXuLOSfCwQT/Q+KnAFwbfqLBGPlHN/+39qLAYoHwYscwjDULKZzOVOkiT2YV1DsFlSs0KLxne7LkVS4MXEgg+OgCbzDc83lyPmg0+kJv6ijgH/ncLJv9C0keXi+vk1x0eLIlOVVqcVqKD59M800nf/4ewOlgRZSWv8LSvwoP/TgmDfTT/EhoHWDVDqFzV+O4JZWxqWpjAwGaqrXyYJ3wy56rozcU3cycSZbx+TinmjaT7zt6dLZRJPK85IX4YPvt5mrfVfoBnBA/X9RB8+wjAOrb/0ic6En/7JLh3ELzovPEDpML28eIC2HrsAcNa39VgDjApU/0AtDb5gdwE1gYeYtUDZafkIcbMFDrBMsIn1JjaUlJdiFJsuLVrStQVY86JfOetpMbSuDS4HOqjhbm+3iZ/KYDX7TsJDV4eSZL3f5p+COn8F0ok9XefX68+hd3AcVfBPq1TzK5rEBwI3nOXtBTpJNe+vJJmjih1ruQk3G/GBChr07A0IzrA5UcmAEc2XlP0G1DZF948pEb9bL0OrXi4jwIFLCnWN6e5EK7/rZbBTDh+6gYaivVNSK/VpFMIvw5gvPSb+Jf3i1+vPu9rngHEn7pleBU2I+W3XWV7JvQNyuf7eTa8kw4e4Z/pheJAev+8UiHWepa5/l5OdwbNNoG7/EON3sqG2GFK5JI9hKNOidq8IgctlAHjksUPB5n3KNKansb9eBmhGyFsAobNBzPI3B1dmgD+hDVeHun69/lWZGZ4Zf8RzrW+zYC9p/a7lA1owOFGJZi/HAp1L63e3pMU5LyBITVOvIUmyXFWpbNYaC7WVAcr/L8AA+dSd3OMf2BsAAAAASUVORK5CYII=) no-repeat;background-size:100%;margin-right:0rem;padding:6rem;text-align:center}.jt-wall-dialog .el-dialog .el-dialog__headerbtn{height:34rem}.jt-wall-dialog .el-dialog .el-dialog__body{padding:10rem;color:#fff}.jt-wall-dialog .el-dialog .el-color-picker__trigger{width:120rem}.jt-wall-dialog .el-dialog .el-body-foot{position:absolute;bottom:8rem;right:8rem;width:calc(100% - 16rem)}.jt-wall-dialog .el-dialog .el-body-foot .el-button-group{display:flex}.jt-wall-dialog .el-dialog .el-body-foot .el-button-group .el-button{border:solid 0rem rgb(255,0,0);flex:1}
  33016. `;
  33017. var _export_sfc = (sfc, props) => {
  33018. const target = sfc.__vccOpts || sfc;
  33019. for (const [key, val] of props) {
  33020. target[key] = val;
  33021. }
  33022. return target;
  33023. };
  33024. const _hoisted_1$2 = { class: "jt-wall-dialog" };
  33025. const _hoisted_2$2 = {
  33026. slot: "title",
  33027. class: "header-title"
  33028. };
  33029. const _hoisted_3$2 = { style: { "line-height": "24rem", "font-size": "16rem", "color": "#fff", "font-family": "'Alimama_ShuHeiTi_Bold'" } };
  33030. const _hoisted_4$2 = { class: "odin-dialog__content" };
  33031. const _hoisted_5$2 = { class: "jt-wall-row" };
  33032. const _hoisted_6$2 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u9AD8\u5EA6", -1);
  33033. const _hoisted_7$2 = { class: "col-main" };
  33034. const _hoisted_8$2 = { class: "jt-wall-row" };
  33035. const _hoisted_9$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u5F2F\u66F2\u5EA6", -1);
  33036. const _hoisted_10$1 = { class: "col-main" };
  33037. const _hoisted_11$1 = { class: "jt-wall-row" };
  33038. const _hoisted_12$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u7EBF\u5BBD", -1);
  33039. const _hoisted_13$1 = { class: "col-main" };
  33040. const _hoisted_14$1 = { class: "jt-wall-row" };
  33041. const _hoisted_15$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u53D1\u5149\u5F3A\u5EA6", -1);
  33042. const _hoisted_16$1 = { class: "col-main" };
  33043. const _hoisted_17$1 = { class: "jt-wall-row" };
  33044. const _hoisted_18$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u989C\u8272", -1);
  33045. const _hoisted_19$1 = { class: "col-main" };
  33046. const _hoisted_20$1 = { class: "jt-wall-row" };
  33047. const _hoisted_21$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6D41\u52A8\u65B9\u5411", -1);
  33048. const _hoisted_22$1 = { class: "col-main" };
  33049. const _hoisted_23$1 = { class: "jt-wall-row" };
  33050. const _hoisted_24$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6D41\u52A8\u987A\u5E8F", -1);
  33051. const _hoisted_25$1 = { class: "col-main" };
  33052. const _hoisted_26$1 = { class: "jt-wall-row" };
  33053. const _hoisted_27$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6D41\u52A8\u65F6\u95F4", -1);
  33054. const _hoisted_28$1 = { class: "col-main" };
  33055. const _hoisted_29$1 = { class: "col-main" };
  33056. const _hoisted_30$1 = { class: "jt-wall-row" };
  33057. const _hoisted_31$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u91CD\u590D\u6570\u91CF", -1);
  33058. const _hoisted_32$1 = { class: "col-main" };
  33059. const _hoisted_33$1 = {
  33060. class: "jt-wall-row",
  33061. style: { "height": "60rem" }
  33062. };
  33063. const _hoisted_34$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6587\u5B57\u5185\u5BB9", -1);
  33064. const _hoisted_35$1 = { class: "col-main" };
  33065. const _hoisted_36$1 = { class: "jt-wall-row" };
  33066. const _hoisted_37$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u63CF\u8FB9\u5BBD\u5EA6", -1);
  33067. const _hoisted_38$1 = { class: "col-main" };
  33068. const _hoisted_39$1 = { class: "jt-wall-row" };
  33069. const _hoisted_40$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u63CF\u8FB9\u989C\u8272", -1);
  33070. const _hoisted_41$1 = { class: "col-main" };
  33071. const _hoisted_42$1 = {
  33072. class: "jt-wall-row",
  33073. style: { "height": "100rem" }
  33074. };
  33075. const _hoisted_43$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u89C6\u9891\u5730\u5740", -1);
  33076. const _hoisted_44$1 = { class: "col-main" };
  33077. const _hoisted_45$1 = { class: "jt-wall-row" };
  33078. const _hoisted_46$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "X\u8F74\u5E73\u79FB", -1);
  33079. const _hoisted_47$1 = { class: "col-main" };
  33080. const _hoisted_48$1 = { class: "jt-wall-row" };
  33081. const _hoisted_49$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "Y\u8F74\u5E73\u79FB", -1);
  33082. const _hoisted_50$1 = { class: "col-main" };
  33083. const _hoisted_51$1 = { class: "jt-wall-row" };
  33084. const _hoisted_52$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "Z\u8F74\u5E73\u79FB", -1);
  33085. const _hoisted_53$1 = { class: "col-main" };
  33086. const _hoisted_54$1 = { class: "el-body-foot" };
  33087. const _sfc_main$2 = {
  33088. __name: "CrEditProperty.ce",
  33089. props: {
  33090. params: {
  33091. id: {
  33092. type: String,
  33093. default: () => void 0
  33094. },
  33095. height: {
  33096. type: Number,
  33097. default: () => 13
  33098. },
  33099. bottomHeight: {
  33100. type: Number,
  33101. default: () => 0
  33102. },
  33103. color: {
  33104. type: String,
  33105. default: () => "255,255,0,0.9"
  33106. },
  33107. direction: {
  33108. type: String,
  33109. default: () => "horizontal"
  33110. },
  33111. order: {
  33112. type: String,
  33113. default: () => "+"
  33114. },
  33115. count: {
  33116. type: Number,
  33117. default: () => 2
  33118. },
  33119. text: {
  33120. type: String,
  33121. default: () => ""
  33122. },
  33123. lineWidth: {
  33124. type: Number,
  33125. default: () => 2
  33126. },
  33127. glowPower: {
  33128. type: Number,
  33129. default: () => 0.25
  33130. },
  33131. outlineWidth: {
  33132. type: Number,
  33133. default: () => 0
  33134. },
  33135. outlineColor: {
  33136. type: String,
  33137. default: () => "255,255,0,0.9"
  33138. },
  33139. speed: {
  33140. type: Number,
  33141. default: () => 1.5
  33142. },
  33143. videoUrl: {
  33144. type: String,
  33145. default: () => ""
  33146. },
  33147. arcHeight: {
  33148. type: Number,
  33149. default: () => 1e3
  33150. },
  33151. axisX: {
  33152. type: Number,
  33153. default: () => 0
  33154. },
  33155. axisY: {
  33156. type: Number,
  33157. default: () => 0
  33158. },
  33159. axisZ: {
  33160. type: Number,
  33161. default: () => 0
  33162. }
  33163. },
  33164. showDialog: {
  33165. type: Boolean,
  33166. default: () => false
  33167. }
  33168. },
  33169. emits: ["submit", "update:showDialog", "update:params", "remove"],
  33170. setup(__props, { expose: __expose, emit }) {
  33171. const props = __props;
  33172. const language = ref("zh-cn");
  33173. const locale = computed$1(() => language.value === "zh-cn" ? zhCn : en);
  33174. const {
  33175. proxy
  33176. } = getCurrentInstance();
  33177. const predefineColors = ref([
  33178. "#ff4500",
  33179. "#ff8c00",
  33180. "#ffd700",
  33181. "#90ee90",
  33182. "#00ced1",
  33183. "#1e90ff",
  33184. "#c71585",
  33185. "rgba(255, 69, 0, 0.68)",
  33186. "rgb(255, 120, 0)",
  33187. "hsv(51, 100, 98)",
  33188. "hsva(120, 40, 94, 0.5)",
  33189. "hsl(181, 100%, 37%)",
  33190. "hsla(209, 100%, 56%, 0.73)",
  33191. "#c7158577"
  33192. ]);
  33193. const isShowColor = ref(false);
  33194. const isShowText = ref(false);
  33195. const isShowHeight = ref(false);
  33196. const isShowDirection = ref(false);
  33197. const isShowOrder = ref(false);
  33198. const isShowCount = ref(false);
  33199. ref(false);
  33200. const isShowLineWidth = ref(false);
  33201. const isShowGlowpower = ref(false);
  33202. const isShowOutlineWidth = ref(false);
  33203. const isShowOutlineColor = ref(false);
  33204. const isShowSpeed = ref(false);
  33205. const isShowVideoUrl = ref(false);
  33206. const isShowArcHeight = ref(false);
  33207. const isShowAxis = ref(false);
  33208. const color2 = ref(props.params.color);
  33209. const title = ref("\u5C5E\u6027\u7F16\u8F91");
  33210. const dialogVisible = ref(props.showDialog);
  33211. const directions = reactive([{
  33212. key: "\u5DE6\u53F3",
  33213. value: "horizontal"
  33214. }, {
  33215. key: "\u4E0A\u4E0B",
  33216. value: "vertical"
  33217. }]);
  33218. const orders = reactive([]);
  33219. const radioDirection = ref("");
  33220. const radioOrder = ref("");
  33221. const wallHeight = ref(0);
  33222. const yCount = ref(0);
  33223. const txtContent = ref("");
  33224. const lineWidth = ref(0);
  33225. const glowPower = ref(0.25);
  33226. const outlineWidth = ref(0);
  33227. const outlineColor = ref(props.params.outlineColor);
  33228. const speed = ref(1.5);
  33229. const txtVideoUrl = ref("");
  33230. const arcHeight = ref(1e3);
  33231. const axisX = ref(0);
  33232. const axisY = ref(0);
  33233. const axisZ = ref(0);
  33234. updateParams(props.params);
  33235. function updateParams(params) {
  33236. proxy._params = params;
  33237. _setShowControls(false);
  33238. if (params.id === DrawTools.DrawType.TextWall) {
  33239. title.value = "\u5E7F\u544A\u724C\u7F16\u8F91";
  33240. isShowColor.value = true;
  33241. isShowText.value = true;
  33242. isShowHeight.value = true;
  33243. } else if (params.id === DrawTools.DrawType.DynamicWall) {
  33244. title.value = "\u52A8\u6001\u56F4\u680F\u7F16\u8F91";
  33245. isShowColor.value = true;
  33246. isShowDirection.value = true;
  33247. isShowOrder.value = true;
  33248. isShowCount.value = true;
  33249. isShowHeight.value = true;
  33250. isShowSpeed.value = true;
  33251. } else if (params.id === DrawTools.DrawType.NormalWall) {
  33252. title.value = "\u666E\u901A\u56F4\u680F\u7F16\u8F91";
  33253. isShowColor.value = true;
  33254. isShowHeight.value = true;
  33255. } else if (params.id === DrawTools.DrawType.Circle) {
  33256. title.value = "\u8D34\u5730\u5706\u7F16\u8F91";
  33257. isShowColor.value = true;
  33258. isShowOutlineColor.value = true;
  33259. isShowOutlineWidth.value = true;
  33260. } else if (params.id === DrawTools.DrawType.DynamicCircle) {
  33261. title.value = "\u6269\u6563\u5706\u7F16\u8F91";
  33262. isShowColor.value = true;
  33263. isShowCount.value = true;
  33264. isShowSpeed.value = true;
  33265. } else if (params.id === DrawTools.DrawType.House) {
  33266. title.value = "\u623F\u5C4B\u7F16\u8F91";
  33267. isShowColor.value = true;
  33268. isShowHeight.value = true;
  33269. } else if (params.id === DrawTools.DrawType.VideoWall) {
  33270. title.value = "\u89C6\u9891\u5899\u7F16\u8F91";
  33271. isShowHeight.value = true;
  33272. isShowVideoUrl.value = true;
  33273. isShowAxis.value = true;
  33274. } else if (params.id === DrawTools.DrawType.Polyline) {
  33275. title.value = "\u8D34\u5730\u7EBF\u7F16\u8F91";
  33276. isShowColor.value = true;
  33277. isShowLineWidth.value = true;
  33278. } else if (params.id === DrawTools.DrawType.ArrowPolyline) {
  33279. title.value = "\u7BAD\u5934\u7EBF\u7F16\u8F91";
  33280. isShowColor.value = true;
  33281. isShowLineWidth.value = true;
  33282. } else if (params.id === DrawTools.DrawType.DynamicPolyline) {
  33283. title.value = "\u52A8\u6001\u7EBF\u7F16\u8F91";
  33284. isShowColor.value = true;
  33285. isShowOrder.value = true;
  33286. isShowCount.value = true;
  33287. isShowLineWidth.value = true;
  33288. isShowSpeed.value = true;
  33289. } else if (params.id === DrawTools.DrawType.GrowPolyline) {
  33290. title.value = "\u53D1\u5149\u7EBF\u7F16\u8F91";
  33291. isShowColor.value = true;
  33292. isShowLineWidth.value = true;
  33293. isShowGlowpower.value = true;
  33294. } else if (params.id === DrawTools.DrawType.OutlinePolyline) {
  33295. title.value = "\u63CF\u8FB9\u7EBF\u7F16\u8F91";
  33296. isShowColor.value = true;
  33297. isShowLineWidth.value = true;
  33298. isShowOutlineColor.value = true;
  33299. isShowOutlineWidth.value = true;
  33300. } else if (params.id === DrawTools.DrawType.Polygon) {
  33301. title.value = "\u8D34\u5730\u9762\u7F16\u8F91";
  33302. isShowColor.value = true;
  33303. isShowOutlineColor.value = true;
  33304. isShowOutlineWidth.value = true;
  33305. } else if (params.id === DrawTools.DrawType.Rectangle) {
  33306. title.value = "\u77E9\u5F62\u7F16\u8F91";
  33307. isShowColor.value = true;
  33308. isShowOutlineColor.value = true;
  33309. isShowOutlineWidth.value = true;
  33310. } else if (params.id === DrawTools.DrawType.SpatialLine) {
  33311. title.value = "\u7A7A\u95F4\u7EBF\u7F16\u8F91";
  33312. isShowColor.value = true;
  33313. isShowLineWidth.value = true;
  33314. } else if (params.id === DrawTools.DrawType.OdLine) {
  33315. title.value = "OD\u7EBF\u7F16\u8F91";
  33316. isShowSpeed.value = true;
  33317. isShowColor.value = true;
  33318. isShowLineWidth.value = true;
  33319. isShowOrder.value = true;
  33320. isShowArcHeight.value = true;
  33321. } else {
  33322. _setShowControls(false);
  33323. }
  33324. color2.value = params.color;
  33325. if (params.direction === "horizontal") {
  33326. radioDirection.value = directions[0].key;
  33327. Object.assign(orders, [{
  33328. key: "\u81EA\u5DE6\u81F3\u53F3",
  33329. value: "-"
  33330. }, {
  33331. key: "\u81EA\u53F3\u81F3\u5DE6",
  33332. value: "+"
  33333. }]);
  33334. if (params.order === "-") {
  33335. radioOrder.value = orders[0].key;
  33336. } else {
  33337. radioOrder.value = orders[1].key;
  33338. }
  33339. } else {
  33340. radioDirection.value = directions[1].key;
  33341. Object.assign(orders, [{
  33342. key: "\u81EA\u4E0A\u81F3\u4E0B",
  33343. value: "+"
  33344. }, {
  33345. key: "\u81EA\u4E0B\u81F3\u4E0A",
  33346. value: "-"
  33347. }]);
  33348. if (params.order === "+") {
  33349. radioOrder.value = orders[0].key;
  33350. } else {
  33351. radioOrder.value = orders[1].key;
  33352. }
  33353. }
  33354. if (params.id === DrawTools.DrawType.OdLine) {
  33355. Object.assign(orders, [{
  33356. key: "\u6C47\u805A",
  33357. value: "+"
  33358. }, {
  33359. key: "\u6269\u6563",
  33360. value: "-"
  33361. }]);
  33362. if (params.order === "+") {
  33363. radioOrder.value = orders[0].key;
  33364. } else {
  33365. radioOrder.value = orders[1].key;
  33366. }
  33367. }
  33368. wallHeight.value = parseFloat(params.height).toFixed(2);
  33369. yCount.value = params.count;
  33370. txtContent.value = params.text;
  33371. lineWidth.value = params.lineWidth;
  33372. glowPower.value = params.power;
  33373. outlineColor.value = params.outlineColor;
  33374. outlineWidth.value = params.outlineWidth;
  33375. speed.value = (parseFloat(params.duration) / 1e3).toFixed(2);
  33376. txtVideoUrl.value = params.videoUrl;
  33377. arcHeight.value = params.odlineHeight;
  33378. axisX.value = params.axisX;
  33379. axisY.value = params.axisY;
  33380. axisZ.value = params.axisZ;
  33381. }
  33382. function _setShowControls(isShow) {
  33383. isShowColor.value = isShow;
  33384. isShowText.value = isShow;
  33385. isShowDirection.value = isShow;
  33386. isShowOrder.value = isShow;
  33387. isShowCount.value = isShow;
  33388. isShowHeight.value = isShow;
  33389. isShowLineWidth.value = isShow;
  33390. isShowGlowpower.value = isShow;
  33391. isShowOutlineColor.value = isShow;
  33392. isShowOutlineWidth.value = isShow;
  33393. isShowSpeed.value = isShow;
  33394. isShowVideoUrl.value = isShow;
  33395. isShowArcHeight.value = isShow;
  33396. isShowAxis.value = isShow;
  33397. }
  33398. __expose({});
  33399. function submit() {
  33400. let outParam = proxy._params;
  33401. outParam.height = wallHeight.value;
  33402. outParam.color = color2.value;
  33403. outParam.direction = directions.filter((item) => {
  33404. return item.key === radioDirection.value;
  33405. })[0].value;
  33406. outParam.order = orders.filter((item) => {
  33407. return item.key === radioOrder.value;
  33408. })[0].value;
  33409. outParam.count = yCount.value;
  33410. outParam.text = txtContent.value;
  33411. outParam.lineWidth = lineWidth.value;
  33412. outParam.power = glowPower.value;
  33413. outParam.outlineColor = outlineColor.value;
  33414. outParam.outlineWidth = outlineWidth.value;
  33415. outParam.duration = speed.value * 1e3;
  33416. outParam.videoUrl = txtVideoUrl.value;
  33417. outParam.odlineHeight = arcHeight.value;
  33418. outParam.bottomHeight = props.params.bottomHeight;
  33419. outParam.axisX = axisX.value;
  33420. outParam.axisY = axisY.value;
  33421. outParam.axisZ = axisZ.value;
  33422. emit("submit", outParam);
  33423. axisX.value = axisY.value = axisZ.value = 0;
  33424. }
  33425. function close() {
  33426. dialogVisible.value = false;
  33427. }
  33428. function remove2() {
  33429. emit("remove", {});
  33430. dialogVisible.value = false;
  33431. }
  33432. function directionChange(e) {
  33433. if (e.target.value === directions[0].key) {
  33434. Object.assign(orders, [{
  33435. key: "\u81EA\u5DE6\u81F3\u53F3",
  33436. value: "-"
  33437. }, {
  33438. key: "\u81EA\u53F3\u81F3\u5DE6",
  33439. value: "+"
  33440. }]);
  33441. radioOrder.value = orders[0].key;
  33442. } else if (e.target.value === directions[1].key) {
  33443. Object.assign(orders, [{
  33444. key: "\u81EA\u4E0A\u81F3\u4E0B",
  33445. value: "-"
  33446. }, {
  33447. key: "\u81EA\u4E0B\u81F3\u4E0A",
  33448. value: "+"
  33449. }]);
  33450. radioOrder.value = orders[0].key;
  33451. }
  33452. }
  33453. function closeDialog() {
  33454. emit("update:showDialog", false);
  33455. }
  33456. function openDialog() {
  33457. updateParams(props.params);
  33458. }
  33459. return (_ctx, _cache) => {
  33460. return openBlock(), createElementBlock("div", _hoisted_1$2, [
  33461. createVNode(unref(ElDialog), {
  33462. modal: false,
  33463. "destroy-on-close": false,
  33464. modelValue: dialogVisible.value,
  33465. "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => dialogVisible.value = $event),
  33466. title: title.value,
  33467. style: normalizeStyle({ left: "10rem", background: "rgb(0 44 126 / 68%)", height: "calc(100% - 175rem)", width: "180rem", top: "125rem" }),
  33468. onClose: closeDialog,
  33469. onOpen: openDialog,
  33470. "show-close": false
  33471. }, {
  33472. header: withCtx(() => [
  33473. createElementVNode("div", _hoisted_2$2, [
  33474. createElementVNode("span", _hoisted_3$2, toDisplayString(title.value), 1)
  33475. ])
  33476. ]),
  33477. default: withCtx(() => [
  33478. createElementVNode("div", _hoisted_4$2, [
  33479. withDirectives(createElementVNode("div", _hoisted_5$2, [
  33480. _hoisted_6$2,
  33481. createElementVNode("div", _hoisted_7$2, [
  33482. createVNode(unref(ElInput), {
  33483. modelValue: wallHeight.value,
  33484. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => wallHeight.value = $event),
  33485. placeholder: "\u8F93\u5165\u9AD8\u5EA6\u503C",
  33486. clearable: ""
  33487. }, null, 8, ["modelValue"])
  33488. ])
  33489. ], 512), [
  33490. [vShow, isShowHeight.value]
  33491. ]),
  33492. withDirectives(createElementVNode("div", _hoisted_8$2, [
  33493. _hoisted_9$1,
  33494. createElementVNode("div", _hoisted_10$1, [
  33495. createVNode(unref(ElInput), {
  33496. modelValue: arcHeight.value,
  33497. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => arcHeight.value = $event),
  33498. placeholder: "\u8F93\u5165\u5F2F\u66F2\u5EA60\uFF5E9000",
  33499. clearable: ""
  33500. }, null, 8, ["modelValue"])
  33501. ])
  33502. ], 512), [
  33503. [vShow, isShowArcHeight.value]
  33504. ]),
  33505. withDirectives(createElementVNode("div", _hoisted_11$1, [
  33506. _hoisted_12$1,
  33507. createElementVNode("div", _hoisted_13$1, [
  33508. createVNode(unref(ElInput), {
  33509. modelValue: lineWidth.value,
  33510. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => lineWidth.value = $event),
  33511. placeholder: "\u8F93\u5165\u5BBD\u5EA6\u503C",
  33512. clearable: ""
  33513. }, null, 8, ["modelValue"])
  33514. ])
  33515. ], 512), [
  33516. [vShow, isShowLineWidth.value]
  33517. ]),
  33518. withDirectives(createElementVNode("div", _hoisted_14$1, [
  33519. _hoisted_15$1,
  33520. createElementVNode("div", _hoisted_16$1, [
  33521. createVNode(unref(ElInput), {
  33522. modelValue: glowPower.value,
  33523. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => glowPower.value = $event),
  33524. placeholder: "\u8F93\u5165\u53D1\u5149\u5F3A\u5EA60\uFF5E1",
  33525. clearable: ""
  33526. }, null, 8, ["modelValue"])
  33527. ])
  33528. ], 512), [
  33529. [vShow, isShowGlowpower.value]
  33530. ]),
  33531. withDirectives(createElementVNode("div", _hoisted_17$1, [
  33532. _hoisted_18$1,
  33533. createElementVNode("div", _hoisted_19$1, [
  33534. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  33535. default: withCtx(() => [
  33536. createVNode(unref(ElColorPicker), {
  33537. modelValue: color2.value,
  33538. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => color2.value = $event),
  33539. "show-alpha": "",
  33540. predefine: predefineColors.value,
  33541. label: "12"
  33542. }, null, 8, ["modelValue", "predefine"])
  33543. ]),
  33544. _: 1
  33545. }, 8, ["locale"])
  33546. ])
  33547. ], 512), [
  33548. [vShow, isShowColor.value]
  33549. ]),
  33550. withDirectives(createElementVNode("div", _hoisted_20$1, [
  33551. _hoisted_21$1,
  33552. createElementVNode("div", _hoisted_22$1, [
  33553. createVNode(unref(ElRadioGroup), {
  33554. modelValue: radioDirection.value,
  33555. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => radioDirection.value = $event)
  33556. }, {
  33557. default: withCtx(() => [
  33558. (openBlock(true), createElementBlock(Fragment, null, renderList(directions, (item, index2) => {
  33559. return openBlock(), createBlock(unref(ElRadioButton), {
  33560. label: item.key,
  33561. modelValue: item.value,
  33562. "onUpdate:modelValue": ($event) => item.value = $event,
  33563. onChange: directionChange
  33564. }, null, 8, ["label", "modelValue", "onUpdate:modelValue"]);
  33565. }), 256))
  33566. ]),
  33567. _: 1
  33568. }, 8, ["modelValue"])
  33569. ])
  33570. ], 512), [
  33571. [vShow, isShowDirection.value]
  33572. ]),
  33573. withDirectives(createElementVNode("div", _hoisted_23$1, [
  33574. _hoisted_24$1,
  33575. createElementVNode("div", _hoisted_25$1, [
  33576. createVNode(unref(ElRadioGroup), {
  33577. modelValue: radioOrder.value,
  33578. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => radioOrder.value = $event)
  33579. }, {
  33580. default: withCtx(() => [
  33581. (openBlock(true), createElementBlock(Fragment, null, renderList(orders, (item, index2) => {
  33582. return openBlock(), createBlock(unref(ElRadioButton), {
  33583. label: item.key,
  33584. modelValue: item.value,
  33585. "onUpdate:modelValue": ($event) => item.value = $event
  33586. }, null, 8, ["label", "modelValue", "onUpdate:modelValue"]);
  33587. }), 256))
  33588. ]),
  33589. _: 1
  33590. }, 8, ["modelValue"])
  33591. ])
  33592. ], 512), [
  33593. [vShow, isShowOrder.value]
  33594. ]),
  33595. withDirectives(createElementVNode("div", _hoisted_26$1, [
  33596. _hoisted_27$1,
  33597. createElementVNode("div", _hoisted_28$1, [
  33598. createElementVNode("div", _hoisted_29$1, [
  33599. createVNode(unref(ElInput), {
  33600. modelValue: speed.value,
  33601. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => speed.value = $event),
  33602. placeholder: "\u8F93\u5165\u6D41\u52A8\u65F6\u95F40\uFF5E10",
  33603. clearable: ""
  33604. }, null, 8, ["modelValue"])
  33605. ])
  33606. ])
  33607. ], 512), [
  33608. [vShow, isShowSpeed.value]
  33609. ]),
  33610. withDirectives(createElementVNode("div", _hoisted_30$1, [
  33611. _hoisted_31$1,
  33612. createElementVNode("div", _hoisted_32$1, [
  33613. createVNode(unref(ElInput), {
  33614. modelValue: yCount.value,
  33615. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => yCount.value = $event),
  33616. placeholder: "\u8F93\u51651\uFF5E100",
  33617. clearable: ""
  33618. }, null, 8, ["modelValue"])
  33619. ])
  33620. ], 512), [
  33621. [vShow, isShowCount.value]
  33622. ]),
  33623. withDirectives(createElementVNode("div", _hoisted_33$1, [
  33624. _hoisted_34$1,
  33625. createElementVNode("div", _hoisted_35$1, [
  33626. createVNode(unref(ElInput), {
  33627. modelValue: txtContent.value,
  33628. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => txtContent.value = $event),
  33629. placeholder: "\u8F93\u5165\u663E\u793A\u7684\u6587\u5B57\u5185\u5BB9",
  33630. clearable: "",
  33631. type: "textarea",
  33632. rows: 2
  33633. }, null, 8, ["modelValue"])
  33634. ])
  33635. ], 512), [
  33636. [vShow, isShowText.value]
  33637. ]),
  33638. withDirectives(createElementVNode("div", _hoisted_36$1, [
  33639. _hoisted_37$1,
  33640. createElementVNode("div", _hoisted_38$1, [
  33641. createVNode(unref(ElInput), {
  33642. modelValue: outlineWidth.value,
  33643. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => outlineWidth.value = $event),
  33644. placeholder: "\u8F93\u5165\u5BBD\u5EA6\u503C",
  33645. clearable: ""
  33646. }, null, 8, ["modelValue"])
  33647. ])
  33648. ], 512), [
  33649. [vShow, isShowOutlineWidth.value]
  33650. ]),
  33651. withDirectives(createElementVNode("div", _hoisted_39$1, [
  33652. _hoisted_40$1,
  33653. createElementVNode("div", _hoisted_41$1, [
  33654. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  33655. default: withCtx(() => [
  33656. createVNode(unref(ElColorPicker), {
  33657. modelValue: outlineColor.value,
  33658. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => outlineColor.value = $event),
  33659. "show-alpha": "",
  33660. predefine: predefineColors.value,
  33661. label: "12"
  33662. }, null, 8, ["modelValue", "predefine"])
  33663. ]),
  33664. _: 1
  33665. }, 8, ["locale"])
  33666. ])
  33667. ], 512), [
  33668. [vShow, isShowOutlineColor.value]
  33669. ]),
  33670. withDirectives(createElementVNode("div", _hoisted_42$1, [
  33671. _hoisted_43$1,
  33672. createElementVNode("div", _hoisted_44$1, [
  33673. createVNode(unref(ElInput), {
  33674. modelValue: txtVideoUrl.value,
  33675. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => txtVideoUrl.value = $event),
  33676. placeholder: "\u8F93\u5165\u64AD\u653E\u89C6\u9891\u7684\u5730\u5740",
  33677. clearable: "",
  33678. type: "textarea",
  33679. rows: 4
  33680. }, null, 8, ["modelValue"])
  33681. ])
  33682. ], 512), [
  33683. [vShow, isShowVideoUrl.value]
  33684. ]),
  33685. withDirectives(createElementVNode("div", _hoisted_45$1, [
  33686. _hoisted_46$1,
  33687. createElementVNode("div", _hoisted_47$1, [
  33688. createVNode(unref(ElInputNumber), {
  33689. modelValue: axisX.value,
  33690. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => axisX.value = $event),
  33691. precision: 2,
  33692. step: 0.1,
  33693. max: 10
  33694. }, null, 8, ["modelValue"])
  33695. ])
  33696. ], 512), [
  33697. [vShow, isShowAxis.value]
  33698. ]),
  33699. withDirectives(createElementVNode("div", _hoisted_48$1, [
  33700. _hoisted_49$1,
  33701. createElementVNode("div", _hoisted_50$1, [
  33702. createVNode(unref(ElInputNumber), {
  33703. modelValue: axisY.value,
  33704. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => axisY.value = $event),
  33705. precision: 2,
  33706. step: 0.1,
  33707. max: 10
  33708. }, null, 8, ["modelValue"])
  33709. ])
  33710. ], 512), [
  33711. [vShow, isShowAxis.value]
  33712. ]),
  33713. withDirectives(createElementVNode("div", _hoisted_51$1, [
  33714. _hoisted_52$1,
  33715. createElementVNode("div", _hoisted_53$1, [
  33716. createVNode(unref(ElInputNumber), {
  33717. modelValue: axisZ.value,
  33718. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => axisZ.value = $event),
  33719. precision: 2,
  33720. step: 0.1,
  33721. max: 10
  33722. }, null, 8, ["modelValue"])
  33723. ])
  33724. ], 512), [
  33725. [vShow, isShowAxis.value]
  33726. ]),
  33727. createElementVNode("div", _hoisted_54$1, [
  33728. createVNode(unref(ElButtonGroup), null, {
  33729. default: withCtx(() => [
  33730. createVNode(unref(ElButton), {
  33731. type: "primary",
  33732. icon: unref(edit_default),
  33733. onClick: _cache[16] || (_cache[16] = ($event) => submit())
  33734. }, {
  33735. default: withCtx(() => [
  33736. createTextVNode("\u4FEE\u6539")
  33737. ]),
  33738. _: 1
  33739. }, 8, ["icon"]),
  33740. createVNode(unref(ElButton), {
  33741. type: "primary",
  33742. style: { "background-color": "rgb(222, 146, 47)" },
  33743. icon: unref(delete_default),
  33744. onClick: _cache[17] || (_cache[17] = ($event) => remove2())
  33745. }, {
  33746. default: withCtx(() => [
  33747. createTextVNode("\u5220\u9664")
  33748. ]),
  33749. _: 1
  33750. }, 8, ["icon"]),
  33751. createVNode(unref(ElButton), {
  33752. type: "primary",
  33753. style: { "background-color": "rgb(126, 128, 135)" },
  33754. icon: unref(close_default),
  33755. onClick: _cache[18] || (_cache[18] = ($event) => close())
  33756. }, {
  33757. default: withCtx(() => [
  33758. createTextVNode("\u5173\u95ED")
  33759. ]),
  33760. _: 1
  33761. }, 8, ["icon"])
  33762. ]),
  33763. _: 1
  33764. })
  33765. ])
  33766. ])
  33767. ]),
  33768. _: 1
  33769. }, 8, ["modelValue", "title", "style"])
  33770. ]);
  33771. };
  33772. }
  33773. };
  33774. var DialogEditProperty$2 = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["styles", [_style_0$2]]]);
  33775. Array.prototype.last = function() {
  33776. if (this === void 0 || this.length === void 0 || this.length === 0)
  33777. return void 0;
  33778. return this[this.length - 1];
  33779. };
  33780. Array.prototype.first = function() {
  33781. if (this === void 0 || this.length === void 0 || this.length === 0)
  33782. return void 0;
  33783. return this[0];
  33784. };
  33785. Cesium.Entity.prototype.setEditType = function(options2) {
  33786. this._editType = options2;
  33787. };
  33788. Cesium.Entity.prototype.getEditType = function() {
  33789. return this._editType;
  33790. };
  33791. Cesium.Entity.prototype.setEntityType = function(entityType) {
  33792. this._entityType = entityType;
  33793. };
  33794. Cesium.Entity.prototype.getEntityType = function(entityType) {
  33795. return this._entityType;
  33796. };
  33797. Cesium.Entity.prototype.setIsEdit = function(isEdit) {
  33798. this._isEdit = isEdit;
  33799. };
  33800. Cesium.Entity.prototype.getIsEdit = function() {
  33801. return this._isEdit;
  33802. };
  33803. Cesium.Entity.prototype.setParams = function(params) {
  33804. this._params = params;
  33805. };
  33806. Cesium.Entity.prototype.getParams = function() {
  33807. return this._params;
  33808. };
  33809. Cesium.Entity.prototype.bindEntity = function(entity) {
  33810. this._bindEntity = entity;
  33811. };
  33812. Cesium.Entity.prototype.getBindEntity = function() {
  33813. return this._bindEntity;
  33814. };
  33815. class DrawTools {
  33816. constructor(viewer2, options2) {
  33817. this._viewer = viewer2;
  33818. this._init(options2);
  33819. }
  33820. static initEditPropertyParams() {
  33821. return {
  33822. id: void 0,
  33823. height: 20,
  33824. bottomHeight: 0,
  33825. color: "rgba(0,255,0,0.75)",
  33826. direction: "horizontal",
  33827. order: "-",
  33828. count: 2,
  33829. text: "",
  33830. lineWidth: 0,
  33831. power: 0.25,
  33832. outlineWidth: 0,
  33833. outlineColor: "rgba(255,255,255,1)",
  33834. videoUrl: "",
  33835. duration: 1500,
  33836. odlineHeight: 1e3,
  33837. odlineCount: 50,
  33838. axisX: 0,
  33839. axisY: 0,
  33840. axisZ: 0
  33841. };
  33842. }
  33843. _init(options2) {
  33844. this._viewer.scene.globe.depthTestAgainstTerrain = true;
  33845. this._viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  33846. this._sketchEntityName = this._guid();
  33847. let dataSource = new Cesium.CustomDataSource(this._sketchEntityName);
  33848. this._viewer.dataSources.add(dataSource);
  33849. this._entities = dataSource.entities;
  33850. this._pointEntitys = [];
  33851. this._sketchPointImage = void 0;
  33852. this._iconNormal = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcEAYAAAAinQPXAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAB2FJREFUWMO9mHtQlNcZxn/nW65GxHtEqTEajUxVoLYRSIyipHG4qG0lajtxVIRFubgqXuOI28ZE7FAvCLKLSNKxg/FSIzdvqNE62kaRitqpYMxovBGigo4I4n6nfwjsCrsLrtjnn53vnPe87/Oc9/2+854VdBhCd6ZP6dMHlAXO/lOngrzMLz/8EEQ0ASNGANNY2aOHxYIdfHr3LuBCwPnzQIKcf/AgiJ8pQV99BfmvR4+orHxZVsLxpZFT0qd07gyP7zqrej3IInF47lwQkTLV3d1xv3KXWPT4MYhLzMzIgHpn10+Sk+Gw74w+jx79HwSGnzUYhg4FED4FBcBq/jtokOOC2oSb0FZUgHpKVoeHQ9GtGM/y8lcgMLxf5juDBwNDlOWnTgGvUdWz5wsQ7c179fUWzz9y0tX1BdZPILeqCpTtil9QEOT9c876K1faWqS07XeMzJFuboCXkpaX1w5hqxl14QJIKYRWCzLV5OXtDQXbon3c3c2/TeMoYvncucAgPrl40Y7fA0zv1QtMydKwb58FL7toRwbDYo3/0utB3OD8qlX2hIkLqalwO0b9+fLlUHJOG9vQ0P4EjfyFIdPZGfqsURampIBIlxsWLLBtL/NltF4PhUIrVq92QGDIeEOmpye4pYju164Bq6n29LTiopy8tDTIL48pSExsDq/Oj9is/eAD4CRbli1DMEFUBAYCewnUaJD8jr2lpQjpJ7M2bBBi0+L47Tt2mP2G5xhNaWnAHrLj461tKF1rasA0rW5b//6w/0rigQcPWhrZKVFXP8TkybaFyb3kXbkCbiO6fpyU1Dwq58vNG3U6BJvEiYMHEcwQW8aNA3pT7O4OaPmTiwuCnlwcNQrEDRGYmytloilj5vr1Zv+mNXVhSUnmOFYEVnt6gtM9t+8mTbKlwo5AoWdySIjteWUcIwwG2LX7o6lPnkiZULTlj/7+wEThm5oKbCBeCOANUisqkNRxLCEBSSzrYmOB3jw6c8Yi3kL5K51OyvkZGXUTJz7LSH09CIPwMBpt85CHhMf48Q4IJFPofHzsbMAAJfjIEQtXC9TZWi0wkEuKAmjEyspKpNN2pyVBQULZaIjbvXmzUDb6xF0zGJCqv+no6NGAK5fLyiz8JssVcXEWgQLUsZZxWmGbrLTN057Agfh7eNiefhpRb7h922LgOzFp2DDzxnJXrsvLE0rqOW3sTz+12h4lLfRZhuQybuXmWmQkgPzhwy0o1jlV37ljh+e3/L1LF0cEXqX04UPb0075rlovLwtBHuqZ5845T5Z37UqbEAPkzOfsUvlHXZ35saFnQ4++fe04eIfftv64tEfgdvkXeweprFIvBQaaebJH+f3x4xbPvsRPnixlQlHGtDFjWq2Wuqj0yz4+QKk4FxNjMVXD2998Y0FRKEsCAuzwzBKv2eZpR6DspxQcPWpnvrNYoNNBZOTOnRoN0ilJMzYjA3ibsKoqoIxezs6gLJbpxcVSTbyePurwYSkT76VPKSgAWQslJcAmenTrBszgP7W1wBlRmZICY2SydHIC8ZCvdTo7Ak+ri44dcySDNDTs2mVufluhThoGD4bHp6or4uOb3zWJnoqwMGAVLnfuACHscHJCiFRmhISA0BMcFob52PDC/8EDkLfkR5GRQmycN8/t8mXw8O73WVwctnvdJ3SqrQXNSJeY3bttaWhHJxMxzDh97VqQAwheutR2IC6pm/z8oOBm7LcVFVJNKNo0oUsXhBKmGR0VBfI0vkFBINzExxoNEKP+ePYsktefFmVnC2Vjvm5SZSVEpGUNefNNUH8ti8rKQCziaOfOVuL2563PP4eCjJhxK1a8hMCJJ7NTPDxAXWIaefEi0J2r/ftbMfyryDhxAkZ2u1EaHAx6oReq2rb/JiTLZKkoUHLf2//YMWCGnPf++1YM7zHw+nVQ1mlKhg2DvPeiltr+GLaj2W524Kd6zZ4NhGOQ0ophI6GSkr4Gq61VGyjx7vdZQoIdYY1xVZ06RKttS1gTHLkPLjVmGo3AJZToaCsGjSWrPFBKfH3bvta0uyR3ySlGIxS4a7trte1l244MtoRpT93XSUk0l0oruFDbqROYUtQ9X3xhLr2WaBpX4+WnOTl2hHkw9eZN0Li5dLP6Dehogc1dexslK/7MynffhbNDvZXnWq9GNJWyiKC69TlphvobtWbOHNgnZonq6hdl+xL/yTQhbKUxeOtWEP9melSUFYMWJSv/IAtNprZLUu4Rf9u6FQpdo49bfRXaBQcy2BL1p+XURYtAZrLwhx+sGDSWrDpc3ZeVBbJMPt22zY6wRj/1oep08zXMUXRABpsQFmqcHhICYiLlhw4BBWiFA/5FOXmhoc8u0Pv3vyyrDshgEwqLYnKLi4FO5OfkvPh66UdudnZHCXsFAptQ96XMW7jQTsm2xAF23roFlD6NXLy4o9m8AoHFR7SxNTWgjGOsVovtxqBxXAzEbc4cKCycN+/+/Y7n88oRvjarcNYsCDtprP/+ewjvZ1xz9SpERBp3zpz5qqP/D5zQE33tptaiAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTA0LTA5VDE2OjQyOjI5KzA4OjAwjRBbGwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0wNC0wOVQxNjo0MjoyOSswODowMPxN46cAAABKdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL2hvbWUvYWRtaW4vaWNvbi1mb250L3RtcC9pY29uXzJhcHo1b3VpcnV4L2Rpbmd3ZWkuc3ZncY9vkgAAAABJRU5ErkJggg==";
  33853. this._iconBlue = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MkEyMUE1MDg3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MkEyMUE1MDc3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv/grmkAAAhxSURBVHjazFoLUFVFGN49597LBdFUEpEQI0IpyxIfqU1ZkY/pNZg1RZlWY2lW4yMncxq18oHZ0+lhOaWZUo0zPjIr8W1NiubI+AxBIkRQQsQE7us8tv3P7qGL7gXOPRdzZ3bmcnf3+7/v/Lv/+f/lYkIIMpur2yBktQVO5yM7LRybIvsOFKFGCeHyQz/dFO2Ousflcg6UJSlVlqVEjHEMjNMH5tE0vVLT9ZJAQNnn9fm3d+9z3xEYioR9bNcjW9Z8Gtv35l7PUAFjnU5HLytrFUU9TgV9XXD4+PJhoyfV2/GIFO4TGD8my1lVuGXSHYNuPdyhfbv5VkVAgzWwFjAACzAvp0fwoV++uz6lxzXLolzOW1AEmz+gHCwtq3i2z52Pn2jtlgvXI1LpgQ0jeqYm74y0CGiACdjUxkir3KxMlsoKNj6WmNAlV5Kk9qiNGmBTG6vAlhV+rd1aUuGeNSNSeiSuolGo2X1cdDogbThQ79h21CMfP6NKtR4dw/edYiTSK8GhZ/aO0R7KiFV7dnPpzeFQXkppWeWY9MGj8+ifektbqzVC8KbVH6UNHdJvOw2nHUIB7vrDI89df861p0SRsUSjuiSzB4qxyYzx0TVEdBUNTnVqs7I6B4beEKOFwqThuu7X/IJ7hj/yYlGoM9NqIakpSVH7t67c3C4muq8IyKcQ9EpuddSK3xqcSHJR7g7WsSkCm8+YiSEgRuU9gMbd3k5578kufrcTC8U0eLwF/e99anhJ6Sm/HSHSid/Xv5CclJAjAjlXr+GHP6x07z9JZCSDCBfzBJapBomJabJfdKqFCiGa4RkQgrQA6p+MtbVTEn2dY2XhUz956szM6wdkLRFtsVZFrReeeaRTQte46aIxT4DgrA9ABJKRw42QTLsjimqATgUZwpxNO/0OGz3KmMvWuBFgABZgimwBB+ASbtSSp0zIHutyOuNEg9NW/e06UE49YRBi5LFB2NxaMoQg5iGJfza+Y+MwlwlmogALMIXpD+UAXIBTOEKi4rt0zg51sFft8TjN7YQbnzrbVpeeD8Q+w3fYFCQba9ha5kHABGyRTcrlCeBkVQjO/Wxeb3rA00WDb62rcbHzAARML0hBAloK+lyQ4TEHx2B4BragUS69vl06/6aLnk6LQuQ+vdMyRQMHT/ql/D9VGfEQi00PGFDYwqsP8/AsMQyJbTvABhuiFb3TU+8Otb1CCXFd1SF2gGhg/f56Bw4+B9iCJ0J5Bv93fgAbbIimd7yq/UDgZklITLQ7RTSwp9grs7MgBYXYMEQ0OTtBWBR7d5FX+NQ5J0tCHG63K0GYglSpkrklGkXY1GGKMbdo8d+qkBfn5LB0RpwOeDlc2mo9NNYHbyOMIuCRptvNsCGqXxgnS2dEoslhxMrgSDXOSbL0HlFVzSv6vlMMJigorWGpnJ2ymzRdTrENGxY4NSeE+PwBYQ3ds6tDN1IewvvFRMLQwTBMPB2lxTuEaTvnRKwI0S/U1ZeLBganRWtGwteYAOoR8EgQFsUe3DNamNpzTroVIWp1TW2xaCCrf6xKzDScaP89SRKGGBLkCSMjVo1aZRS1IZrOOalWhCgHjxTvEw3ckhylD7rOobF6ghZJphhk1TO80DK8Yab1KgJssCHMKhgnxYqQQM7i5bv9AaVONDh7VFzAqCWMekLhRZIFzzQWWLzIMjAY3qwsii2+YakDTsDNkkdoRVZbXHLyN9EglKdjh8QoUBSBcaIDEYU91cbtRi7yUFCF2OgBha9lBRZg3nWjuPQFLsDJqkfAtfWfr1jzDSHiR/zuk/GBjO5YQyqtQDU/5WYKCjo/Oicd/JmPw1xYA2sBA7AAM8RFBAEuwMnqYTei3Q95vx47U1VzTJj3uDBZNzXRl9EdUTE+SshnECJcFPOWwraNxj0GYo3OyLM1PgQYgAWYIlvAAbgAp3AKK6XyTPXZ56bOm0f3p/BFFEdr7LwZSd5xQ9wKUukUo/u4h8SdecCHzPmwdtOMJF9ciHodbE+cvmA+cAm1rVoSAsD1m3fmH127cfvSUJOiXRh98nS8/8dpXb0DknWNKB5qzsOIKlwYdIULpWMwB+ZunNrVC2tDeQIa2P552+4jfFsROxd0sbRfm5/31dyMPumZLQWkwsqA9EOTCzqCzdTGvKB7MCNWTU9s/oIOWsHh41tvGz5uNv34Fxdi64IOvNaxQ/t2aXvzVixKTUnqezkSRBqhCm4bMW7GhboGuJw7H+qQW7nEBoALFPCvOx8cP+toYUl+W4v4o6h0L9iiNkvBdnNXplYvsSEtOFddc75owLCxc6jLd7aVCMDulzlmDtgCm6FSEju38RAxztJUumTkoy+9faqyqjDSIgDzgezJi6gN+P9Is1HKjpBGz9T+U1cy+ulXZ9XU/lMRKRGABZjUEyeseCJcIY1i6BY4NmHagjlen/+CXREUow6wADMcEeEKQTxxq96wadfvCz9cvpBuBSVcEbCWYuQAFmCGSgrbSojx0qW9KmfxV5u/zP1+MTEqI6vlCNFhLWAAFsdEl1sIvIAgdTn98muL1mzZtXe1VYCtv+xbDWsBg2OR/0OIKaaB9ooHsqcsoXt8h4Uwu+P+xyfD/zwqOIatHw7YFQJvVthSUICVDxs9Kae0rOJwS2vKyk8fgbmwhq/V7fKwLYSLgWLoPLz9s59//c3mwjKMPTZ+5hswl6ceWiQ4REQIF2OE5QOHCo9NfCVndoPHW3vxHPgOxmAOzOVr0BUlhIuB0Hn2+5937p/77hcLgsMyfF7wwbKFMAZz+Fx0RQoJDsvvL8ndYYZlM8y+8/HKbXbDbKgW8ftd+qQJLQcglFZCaE3qFn81wogEh1mYE/F74bb64RnFAm/DDwy6mPdrkJLzKGfLpsj+vwIMACSZzfDJFmOPAAAAAElFTkSuQmCC";
  33854. this._iconGreen = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MjI1NDIwOUU3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MjI1NDIwOUQ3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgEE4igAAAgKSURBVHjazFoJbFRVFP3L/OlMoQXKImAFm0JbFtFKShEQI6UsggmkGKghIKTIIgZUohIDKEuLaFTQiIKyKKghqSyyF0pZbcHQsJVpoRkKbYFAW+iU2f78/313+qY+hvc78+dPkZfcMJ377rn3/Pve/fe9gVUUhfENY5eBjNbhvlnI6Bmh+KT5NzBhGigg9sb5vX3NpohhRqMwgOe4eJ7nurIsGwl69MDskiRXS7Jc7naLpx1OV/4z/V67CKpw+Gf1ZiQv9/vWyc8lTkMEpgiCIVGLrSh6ShGhX4ovlG5Mz5jToCcjXKhPIGvyOOG2JW/OywNfuBAd1WqFVhIwwAZsAQOwAPNxZoQ9f+yPHnHdn94QYRSeZ8I4XG7xnLWianq/oZOuBrvkQs0IZz27a2RCfLeCcJOAAZiAjXyM0hqblslcRfHuiV07d9zKcVwU00IDsJGPLeBLS3zBLi3O8nfuyLjuXbegKtTsOrY4Ldz22u2GPFue4bL7MlfrqWXh+xhDjNLL2EtOj0r3jI8Z70kyJcnN4aC4RGtF9eSklzIOoD/lQEsrGCLs/m3f9nxlUP98VE6j1QDz6/P5xZWLI06KJ3lGwIWdB2tfZEgkJB4oVwwzWBgsLY1d6hoWPUxSw0Tl2na8sHjYiAnvlKntmaD3SHxcrDG1f9/1aiScspOZYZ1hGm4dHnmSRyRglk+i/ITQwVywAVvAoA3kMyolufc6iEHv0uKuntkxu1ts5xyacY2nhh1TNsZcpBTxjBl2K4AQ2eD8MiITWXFDmULiYJhUNlXak7DH0d7QnvrUr1feWtgjZdxa2hILKiOzp01o1/mp9gtoOrtsZ0eXjjYXMYhEa/RFKyxmLCaCmBF/NhF633xkCxiABZg0XxADxBJq1eLnz8ycYhSE9jTl3Iq5EWeYM/wjwUPQvj1CEwHP8SMFWIBJbX9QDBALzrNmIhGdOsZkqm3sTfWbhKbgTcSSMhBLiiYcMc9I2CMswARsmk8Uy5s4r5qIsFt/WN6nVaQ5iaZcVLkoQjEpjbD++4IM+hFUQniCDMYBTMCm+USxJP6+bkVfFWRVIny/Pj3TaIpiezF3SjzFN619AaNwRLABSwzhnSOWGxLABh80sz5J8a+qLS81IsY20a1TaIrc2lzhoX3A+2Ui6FcxkRn+4f3j9UEZbdtEDcCUgycSaTbF0RQnGk7wTY79S2xIbSvGIDCPNxynPnUckyYiBpPJ2JmmKBVLuSYCXIA9EWxWWAIPYZeJZdS4cEwGTXtEMBhMNEWthHonVieB5gix2Aft/NIYk6Y9wqHmMGzH4HANHBOn6T3i8UgO2vcxfIzibTdI0Tv88Lw+NMTUHBHF6XJTz9CJQqLs7ZdkLHoIkbbyf71YgpBAbdtxTIoWInK9reEGTTGk9RCpqfGTCDJ6skE2kxL2QRk4JlkLEc+dmrorNEVGTIbo7VxFgowUQlYU4oxCnFMAe0LMBJFmgmPyaCEinrt45TRNkRyZLA8SBkleMj5CMvGclCBJMIQdJgAC2OCDZoZjErUQcees3njK5RZtNOWy2GUu1sk2nidcOAiPX2aUAHvC/1yCBDDh1Khyw2KDmLBF8Bkpt1bWXSm/fpKmhOPp9OjpIhyKGCcWHxkPpQj4b2oPQcJnj7AAMy06jbo/IBaISWtGwF3Dj5tzf1PIIyQx1nRf40phUiTmQWMQTaTI/ePx2wPEPvAF7xWEAViAqXIRoUAsEJPWze6tdn8dOF5y63ZNCbXv4SKVvYl7HSkKItPQGMwjpFx+4he8V5AtYAAWYNJ8QQwQC0bQfLASq2/duTvjveXL0fqkvog6GDooR3sdtWdFZomsjW18Xj5SdhXBwYOADdgW9CpwAJbK3nDMWpC9AmJRW1aBiABww8GCwkt/7s5fpzbJzJmZ9XHrnYfiDtkHSgMlph59CSXC9y8phA7m5sXl2cFWLRMwwPe+w6cuYvqKngs6uFp4tvDApmUv9ktKC1RZSxwl3I66HYaD9QcNFtHC+RpAaDuShCR5RPQIz7h24zy9zb3lQFjFF0oPpY6Yuhh9vIaJ6Lqgg6y1jY5q1bPowOZV8XGxyY+jQUQVqjh15NSP6m0P4HLuntom13KJDQD1CPDa0NezFl2ylBe2NInLZdYi8IV8WvGCDJi9YC+JoXDW3qm5V5aSPmUJSnlBS5EA7P5pk5eAL/Cp1pLouY2HinEXtdLlo96Y+3ll9W1LuEkA5tjMeauQD/h9pNkqpYdIU2bq7tvKM976cFFN3f2qcJEALMBEmbiqJROhEmkig5ZAycz3s5c4nK56vSQQhg2wADMUEqESYXCTcWfX/qNnVn6zcSVaCmKoJMAWYeQAFmCqNYUtRYTBTcftnNWbDv68dedqVMZlrQBgA7aAAVgYk3ncRBTcNd189+NVuXlHi7ZpBTh07PQ2sAUMjKX8H0R8ZKB7qhqbOX8tWuNHNJTZI2MmzYPfPKowhq5rDL1E4M0q4w7qRnrGnBxrRdWFQDYVN25ehLlgg21lvXHoJoLJwInjHrz9M9/+5LPmyjLoJmYt/BTm4tZDCkcMYSGCyXjL8tnzlpJZH+QsfmB31PnPge9AB3NgLrZhnigimAyUzrs79xX8s+zLn7LJsgyfs7/esBJ0MAfPZZ5IImRZ/mrt1iO+suwrs1989+thvWVWbYT9fhc9aQUdB6CUVkNpje3SqQPDMgpZZmFO2O+FW+o/niEsyDb8qt7Rd78GLTmucrp80vz/K8AAYAEv1AHM/GwAAAAASUVORK5CYII=";
  33855. this._iconViolet = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzFDREU3Mjk3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzFDREU3Mjg3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Ppb+WxIAAAhcSURBVHjazFoLcFTVGb6vvdnNY0lEEJOIxhCSKTEFKSC1osIgjqIyA62mZfAxWJU+tC3TVh2lHSGhtNOKOqK0ii+0QwcfFB+IAsKIITpJhUBDHhMiSSBCTMgm2d377PnungubnXOT3L0b6rlzmM2e83/n+87/n/+ecxbeNE3OLvLFV3Fui3KiivNSkhmTNb7EpagQQvzxg++VBvxpc2XZN1MUhEJRFHJ5nk9HO5mwAV03OnTDaFYUtTocie66pOymOjSlYnzeq0d2bn02c9oVxXcTAct8PqnYja2qakeJoFdqDx3dNH/xij4vHhGSnYHlSxf5Out3rrjmqqmHglkZa9yKQIENbIEBLGCeT4/wB/f+c1LBpXkvpsm+73IpLFFF/bKltf2esjl3NI005JL1iNBSs23B5MKJe1ItAgWYwCZj3OiWm5vOQmvt9ttzJ4zbLAhCFjdKBdhkjNcwlht+Iw0tof6zrQsKLs19jWShIeM40hASure3S727O0WloV/QehTeSo/ZsilPzjCC11+k5yzM0/yTs4yhcAgvtaW1Y2nJ7MU7yJ/GcKE1EiH8B1ueLrr2+9N3kXQadAIM7f1abK84LEcOnBFFXuREMpk8TyrHx4jhMQ1OJ5x0U+f8s8boeY9MUbLmjNedMEm6Du2rqp17w5KfNTitmRGvkcKCfHnW9NK/O4kwIjp37JdfpDUv+jSgVw+IASHAofpRef/gSttQ0Rc2sAUGq5Axs2ZM+85GcPAaWkLT528/MDF/QiXLWPtG4Rt/tM+v1vSLMi9zPl4iniCVeASeEPjB82QQj8Az8IjOaZxqapxiKpzvygy9aMs1EekCmTnrX7WdfHjSjEUbWCE2Io88cPeSnAkXjV3J9ERY5xuX7PNrNQOin0/j0kiVUQUI8llVSnjs79FHpjawBQawgMkaCxzAJdmsJT50X/ky2ecby5yllTWy+p9+MY2PkYonb60RUuER1udBoixBMgcsYDK3P4QDuIBTMkLSxo+7oNxpYfe80eaLhZPMSSSkUAU8vPWvFVr2QrdimD7xfWw7nzUZMgdMYLPGJFx+DE5uhfCbn1s9JSM9UMJqbF9TJ5O5tNZEooh48o4Lk66fwWJIJZjAZtkQLsVvbFxTapm7ECKWTSmax2oYONgjRKp7RSluYbsRwRITS9cxQcDGGCybKSWF1zuFl5MQeUwwcwaroXtbmyTRWLdFkJekKxGDwo3nz4nB+iEVY7D6Z4/JmgluroSkB/wFrIa+z7rE2DyeWwfJiEhcO2fXD3n69p9mzjrl5EqI5PfLE5hv0qZ+gach4TacRhJmwFaaB5i8KCfJ1RrxSZKfuW3oUflE8l49kvg3xmCeX2KcXK0RMut8yo7BqSqUk+DqPaJpepjpqmyfaSbs30wPx24WFsZww2koIWYkqjDP0PKkDAO7WOuheyevBRgGxQS2XJjO3LZTTqYbIUZvqO84qyFz9lidyohtzenjRYT92LiZsy9kbocpJ8ONEO1UV3cjqyHn1nxNw+6V1tgsJicmdkaJCbDxgJ1zW77G6k85aW6EqF/WNVYzc3lZtuGfGdQ1sgXHVtwW4zbM4sPJ3tYDE9gYg2VDOaluhCiV6zftjypqiNWY92iponKKdZ7QaHUjJl6EbQ8sYOY+Uqo43LCEwAncXHmkuaWtu7H5q09ZjTieZv/kEhWHIpXURDHx6ydxLcT3OSdCsQ5YwAxeyz76ggs4ufUIXNv3/MtbXzfjj5BxZeK6aYpvaoYetUhECRnVqhoNNyvkTIP5WbNOh7H+sAUGsIDpcBFhggs4uV3sVrb79459R052dh1hGgZEs+hfP4hIU9P1iEUmapFSDGWQqPjnLHlDoQKiHGyBASxgssYCB3ABp2QOVmrHyVOn7/3V6tUkPpkvImlsmln83nXh4NJcNWKGuYgRIxcTpcQIx1fynd2OvrCBbfG710WA5bA2wvevrFgDLk5hNZwQAPd9uKfq8Jvbd210BPCL3GVPfS9a+PbVYWF6QA8bEBSrYYgzI1a1Ptvfk4q+l791dRi2Tp5Awdjvf7y/joaV6eWCLpPUy6p2vPTElWUl84bLSOH6XqHn3Xapd9fXotLUJ+jdmrUBFHMkU56UaQTnkkRxc54WKAkaw2HVHjr60awb7nycfDxGhXi6oIPXsoNZGUUHdry8rrAgf9r52CCSDFU7a8Gdv+sN9eNyrsdpkbu5xAZALwE8NueW5Y8drm+uGm0R/21oOYCxyJgtGHuoK1O3l9jYFnxzqqunYcb8ZauIy/eMlghgT5+3dBXGwphOWxIvt/HIGKfJVrr5xh/+/E9tHZ31qRYBzIXlD64jY+D3kSGzlBchZz3TfSbUvPiu3z7W1X2mPVUigAVM4okmN55IVshZMSQEjtz364pV4Ui016sIghECFjCTEZGsEI5u3E5t++CTz9c+uWktCQU1WRGwJRiVwAKm06ZwtIRYL11SOyvXv/ThC5vfWW/iaOf2PEJsYAsMYFFM7nwLwQsIW5cTv/j9uq07PzmwxS3AR3urt8AWGBTL/H8IscX04zp4YflDG0iM73aRZnfffMeD+M2jnWJ4Ovx7FYI3K0IKB7Dj8xevqGxpbT80nE3r8RN16Asbamt45eFZCBWDw1AP3v7lP330j0OlZbTdvvzhP6Av3XroqeCQEiFUjJWWaw7WH7n/N5WP9w+EuxP74Du0oQ/6UhvuWyWEikHqPP3O+3u+eOIv/6iIT8v4XPG3F9eiDX1oX+5bKSQ+Lf91w+bddlq20+yfn3n1Y69p1qmk/H6XzLRJjgNIpR1IrfkXj7+Q4zkzPs2iT8rvhUfrP54RLHgbv82Ps+/XsCWnWc7TmKzx/yfAAHo1CtU9myPWAAAAAElFTkSuQmCC";
  33856. this._image_arrow_forward = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAAgCAYAAABkS8DlAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA4FpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ4IDc5LjE2NDAzNiwgMjAxOS8wOC8xMy0wMTowNjo1NyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDplMWFmZGVkNi00MTJhLTc5NDAtYjQxMC04NDExNjRiMzQ0ODciIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QTA3MThEMzhCMjc3MTFFRDg1ODdDNkY4OTc4ODRCRjUiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QTA3MThEMzdCMjc3MTFFRDg1ODdDNkY4OTc4ODRCRjUiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIxLjAgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6YjI3YWU1YjEtZmRkMy0wOTQyLWIyMzUtMDFkYWY3YTJlNGUyIiBzdFJlZjpkb2N1bWVudElEPSJhZG9iZTpkb2NpZDpwaG90b3Nob3A6YWUwMWJjYWItYzAxZS04YTQyLTg4MjAtNDU1NmY4NDVmMjBiIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+BD9OfQAAEDhJREFUeNrsXT3PJEcRrho2QQ5IkAj4HfwJEhLInUHAjwBBgEACCRC2gAA5MEiQ2QRYpCQgPiJbsiAxyMYGm+O48927u+8WPd6Zd3t7u6qe6lnfe3tvt9Sa3Zmej+6uruep6i9+9NxzTPvAh4MQHf+Z09RCfsPRzUXInyOVa9b/Hnq4zMBdmnv9dhnp7enpDKtToJf9f04/5OZajQiwQhK4UmWskAUtTa3avSAV8aj9Ro7a7/JcDz34UtkVba/fp1JGLrCSpQvmx0EASnAfwZ8V650rgMugdAkA7lIhGGSQkMP1wxs1oqJds64jxIZOyg8jGTmZ2BXXdzfXOf2WozRykub4XAeWbiktK+deR5299G9+mhXgd1N8McU3z+wBqFrqNTLAQE0xYNE7ROKkS0J/n5hppJJXAQgBBT0SrBCH4yNP0K6TjsP3SfUZHlGxiA9ViEeNXOyyNLsszXVxXxmv1fTyDECL2Yazi7dJduRp1Vs9dJdQJ11nCF9K8ZMpfj/FN5pr9XQMgGptt1jPFEhvWd9FGp59Qdo9Gvk4h5XvfbsFvEPQMxF5JgeOZf0OgW8ZjPKI3jd/wzD9Lo+7gohcT+e3Bbko4674v90fOUXZHf7TLnvWdddwPfTQw4WEzaS7fp3ij1N8bYkHQLPec+bHDdZwrsxF8SZoYC8KYFDWETRUniv1fJieCDGAq/Z8bSwDWgZEtW4X37MiFSCV4LElTwwSQ494kXOfFP8/UXipNDLjkZ35sRGylBMXOX4X5zK4qxCOmVhsMwKSx43yf5OlXxf3dnLSQw89lPj9hRQ/m+KnU3w1xfvn8gBQ0JpHLFvb2q/34deUvxjWvgb0kT58Bq1hxPL13uNZ6QP4Tu97Ix4C6x2IFwUpj4hXQ3sH8u3oteg57TuQMkO+r/Xbau/PycmmIBzr7Pfj7Pp87Sr7vT785hRlk5GcHp5U6N74HvbtMJeI91J8IcWXU/xbCwGwQNvrG/cG7KGg7H2DRwyQ5wwKkUCfMVTyFiEELfdEAMRIV+06iRIA9PuRb1wK4lGiYZWRlq7iAQgTiyUEhQnv8tHS1fI9BGXMqmO0fq137DJisi7i1URO5uPj6fx4/DD7X6Zbd3LSwzNOAErMemkiAn8pSELIA+BZqwIAjzc1EL0HJSje/S1WeASQlzwXsbARr8K5PQHnsuqXehdQS/j0+n5Cq/atshBQ0XuigGqBfQuZGgJ5o4bvjJIjPkvdtsssSmZr77iavB8jyXiUkY2RiDyczj3Kfj+Yrn2YpZt/bzuO9XAmD0DeJfnHFL+T4m8mOTQJwED1PnAEqJda8BqAc+B7UOtaAGBBr0UHEUa+tQZcVlcABZWkl1YMMEIsYdS6jIAc6vmIgLTlGVpq0aNl3jImoREMmQ3vD0pUEALHhpyg+YwAey6XA0AgozNpWtoQ0v6HkD6IEc9tRkRmYvIgi/ez3/em4/+m45x2Qz1cEgEoceftFH9G+wGCf496AFr6/C0vAmLdKySDWZkGyNQ+6wAhHC0uejLARah9vECrm5waFFNUCVmgN5yWdwiIxsNQ1H/Uy+DlCx1vQADI1cBwiTKPkpHl3RKH6amtXo0ocYl6LILyeCNvVt2j71hC9lrG1ESeHSH2pOjWCBmJfFftnGTk5P5ERMb43+n/Byn+OzuXX3t89NS7OR5iA3jRxy6w36b4rRR/F+0CiPb7e258aQTw0gL20nrjDWrPo4pbGPVG5B4UT1miwNkKuMh5VPFFXP8RBbhUqbVaXUxtHpOlsw9axwNoRCPaBeC882ZciEcKqLCyW8BwaCgvVBZQr1K0Tmr1ER0/YbzrCITR5wr5U4qXkoaIt7Ce7uDFXGrkRL22BHo1kfdcTWTkPym+P5GSf9F+0N3b0//3p3MfTKTmNgkAVbDr9RS/meIvLAJgWebeNaL4QMCWlflQdhmZmRBhsS1MN2qha982NL4zYBFADXQIlsUSwGtR/i19wxGS0gpemLV5rDSHj58AwIAZ6FY5IhUWEQ6AOXM2HRm15j2PD/KcqCejdTYJUVvXFS98XlQnDQFdvAToOfunLYaG4gY34gWqbxEvMOopR7zn6AJ2+e/Re/K9FH+S4ju1ymwJEVIghjVuFYoEGpL1DXkQsFKIsLUKECdUba47WnZWHpD8ksMQvWfXGGb5OgG+Q1tVMvqM8t7IEtNI2VvpxCkvtEyl+l3ilgEiP1q55jIoC/NuvFfYaMMElE9lczGxvo0b86DVpSzQhWiQxvtr+kiMMhanDUXzKISvr4J4bP16FHd/FqTurXYrICC31BNSJ2zIXjkxXoB2VMvPp1L8Woo/TfFzHgEQowAFLMDagjxcqUA/87oClYAyJ6XhREBTAvfVCIYYjVCAckbA2RJycQSFi5+sAEe+uI6leFhRHlEm3KJEBbB4tPITkOwyqFS1bjJk4SdEYUfkWQy5jACCR0CI6otfeRa/V67aQl8CKO4WHdEOnAzLbfRJUskvA+DikVEEsDQ9jui0aSqySbzYAVAkPy1BFmALGwZOxEjQu4TFXKRNHHzLr30+xV+m+HyKn5m7AKIsDun3j/7mhvdaFSCAuxeZdsgN744+h2l5l4D3HM2diPZpou9t7Y/kQF644T1L3LWeaxidf3/OkfBaHpeU//H3H/f9L51aiHxvax211Dc6Y6Hl2+y9Pc4jk0u6ABHdQKAcU7DMiOJufG09EwGIJOKab+2eRvR+BNPQay33l+U1jm14ZWkXAOLGRdiWtyMgwlS5YG7sMGEBLUfEOkI2B0LvQayUSFeC57KNHKPWYst+EFFvTov3hSqeDW/cS83iQrtmOOB2RNtRixsQUSaHe8VU9uLLJyPtwHPtCpDO86awo7ti9ciwXrQs9mjdWN8kDe2vxTpmMD/syLJXl863SkQfH+sutrzbWXcmm1vXe5a2AN5YT68zWJ4Casmq7AyKwvAEp6XwLUUgZG+ZS6DLiEFBR9YxkEAjkqAyQIkJohxa6oYbFZKnTCOKBumSEPCd7NSfp+ijOz8iZRx1US6RM1baBBmuTISIWG3QyydX+u2lkq3IeB5PFoXaBluhXT45MYoYRXWChZPEsq2KAcLR8Q61vAoom7WxJZ7coWSnTCaAnvHSlLMSiu/NBpmKWocCkOzIFveahR4h2/Z7T+9+K8WvpPjVAQQhcVwe3qA6MQqOlYxG9xhA+8JrDVEChYsCnShPbLHUCWDT5DRmURpqpIxR0EStXAZkDQEetHykoazF8FIJQESQvFnAICH5wrInAcvcIgZWPpV3iNUGI4NzEY+HOHUaLVNkDECE7EmQwJfGS8Qjxwu/2+prZooPxEXD9GzxNiQD88za96K6PGIMoeO4JNjOI56c8v5x98Av0n6RoH8OhkUsgRcgzDHafyFKYxEQQKKj7cXJjwDP1nY95IyNSYBsRZUyWgcRa9ADfw4KJUK20MGlrcCOKuiagovOICDCBxp6HiiEVHBxyfPIWXKlDTBjhda2TBVm0DPIwLdansAzWKGmvLIB7l6/bMSrihJDDsihAM9EZrGgso2Ut+ZdEDBfClEQRM8tGVQYGQ+HzqjgRlnIwzgN8Ospfjk94g/zyVWgceQL5HhuIc2NoW1L28JbvalsnmJh0l3hVtcCG+RkVoaSuQnRDYc0j4onIBJQdJGpY0T1LYUHUJFGWLrnoq2VkCdDkcWrPBlG9r4gh0wPhocGXWZbew7apiJWk9Zm60RFTCJXey4B8sYV/dNKvgT0aFkyUNMBg6NbvHyDg7g+uh1tUyh5x9pbnawg7QuRI03movPoa3p7AGW4xQMTbVe2YViXj3yRoX9Mv9+lvQv/JcczldfFGyl+g24WAsoaa8NCQHkYCJ8T2rKgD9JAoqsORhd0QI6WVUPA957jHZHvtlcRq2+gg74/siOdZQW2bK1L1L4KHJKvc64EiD4HSVdZclm9Z2iUjSUb6Gh7EZTph2A5WGVTy0skr6i8DwvaSPS7tbIWalvds2X5cDrjEWmnSBu2cGm+Pu6P8HCyhMcV+8b9DsbV/O5NwPredP4eHZYgHuMVPZ1hA+CjuxTwymHiOaCK40KuMZjWUbkUuP9wD9+42D2LGbGgIiPRxWGibFg5FqNGLHbPJW+5n+vCI6bl6b2fHE8KSo4igxSt+cMSlLn8dq4UBiKTkXn4iOcqQqzF8Rp49eYt2d3igSNjvQjNChycNJ6F7xGhljU8kFlTeTqtrMXw9NW8C0L24EV2dAgH2i5ax1s63unwwQSu8wZDI9iOGwyNS+jOa/3fn9KO6caNinbUw5JgyRa0GdDKAARRFLG2+AYFG5jnMkVchcfXxHTdiuOytZSOVejS2IC8iszeXe0HMdxtVeCKEiPNnUkG2A+Om8xTWFYdDUG3YsTNq8iJIKSPi+pBVy9ESKEF2uKAH5tk2RfHSBtBlVWETFl6wUuHki7U4CjbFgfbCmLZbiaLbd5mON9e+PEEpjPQPiyAd073cEq7DpssPVxyyLs7RlL1pxS/TcB2wKvTB90IuFQ8AB7bVBqrKnFRDwHaFy4KMEWtaALf4ylZbzlhtr0BQgB4ZdfFy5vQMitVUymn9+XDH22PAkoKo91U1iJRnifCA2zLY6Kl1/oovXtbPQ6R+pSK/LSQWlEs5+hAPQHPkWKhXk3AupkAcjMB5Ayy60lBbjLwvJqANU/3+ADOcvnQ2cH/GQF9zrFhrtWXU/xRin/+SK4dsrc6VSriWRfIspGFkpOWxoxaz4hLNToTAPVgsML+I6QGAT0UCCygtFb+I8dNGtnKWahcubo+gLSlqwWx6C2wQWUw6i2QLFfeltgEeFUsMuN1B1nuZ3Y8CdaztxmYXhf/1wXYrqfj1RTXWZp1FrcTuG6n2EMPlxuerGeFC8NwHMPwQoo/T/GvKNlbATwRcYtrykb7BGQhHgZca0SxEdh4FR6P5EcsO9QyQ6bRRTd6sfpErbXfkVH/5RKcrVaZZ1Eu8UoI4BmxtoC2ABdfXEYgi3j+v52AdDfF6+zcNvu9no4zuO4ygN1mxxyQt0XsNl8Pt45Yd8Emv6Xw+xR/mOKrtB9nAYeVAVxWP3wNlL3FIKzlZJGFJFpdksgKS6cgJJDF71mRiNehVYxQELY2S4m4l6XY4tUjIMrzquMTKOAN0DbSmcFUClC9zq7PabbF9esCgL1z+bN66OFCgb2D/4WHUQe9Qvstfl9recAKAMxaPz7iXkUGEVrWaHS0bmR+prezUmSN+cg3Bqxtt3VHRjWj3QRz2BWWKhXgqh132f/r7Pz14Zzk13fF9fIZPfTQwwWZoj08sfAO7Vf1+0GKr7dywJUBTBGhQheI8abLnQJsm5cq0reqLUHsjWL33scFoFrLD9eWRC1jDYRr50T5Lx1Ye+hWcA/PRpWdo34vWkZ+leKLKb65hAPm2wHrGxacTnPSRq7nA5G8qTBWvzS6ap4G4LVZCzXQ9YBYA2frd1dcXXH1cJfq86z134Wpy9uTCyvAYt4Vq8LlVm0NdLm4tmSnPLp7rUG6BF9avqTX0Z1ugnLOcu51dOdE9xbz9n8BBgASWdK5g1XGVgAAAABJRU5ErkJggg==";
  33857. this._image_arrow_reverse = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAAgCAYAAABkS8DlAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA4FpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ4IDc5LjE2NDAzNiwgMjAxOS8wOC8xMy0wMTowNjo1NyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDplMWFmZGVkNi00MTJhLTc5NDAtYjQxMC04NDExNjRiMzQ0ODciIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QThBQTYyN0ZCMjc2MTFFREIzM0E4RjQ4Q0YwQTgyMzgiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QThBQTYyN0VCMjc2MTFFREIzM0E4RjQ4Q0YwQTgyMzgiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIxLjAgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6YmIzYjdkNGEtYmQwYi04YjRjLTkwNmQtMTRhMTNkNjEwZWUxIiBzdFJlZjpkb2N1bWVudElEPSJhZG9iZTpkb2NpZDpwaG90b3Nob3A6YWUwMWJjYWItYzAxZS04YTQyLTg4MjAtNDU1NmY4NDVmMjBiIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+EmbDrAAAEJdJREFUeNrsXTuPJEkRjujpmdnd2b1bYFkEAhwkpMPi7eCiQ+LuPAyEEMLhcQiQDgmEARL8AhxMDHxsHH4C+Hg4CAMDIYGziBMVZO1k7WRnZ0R8kdWz2zObKeVUVU898hEZX0RkZCQ/ubigkQ6UOGUZzfDc2mq096CRkUa6WRSNXEvjf61R4Y0Q2b1n5/anJ9vRJwdMchM51gsqsxzJOwaQHvF4Gl03UpjSuQJTNs6RY+vcAmiPgqU4SuN3Nu6pn6/vpaYAcXlX+it7zx5CAPh4yt9N+UdD5B9cdqRb2MVDEx+C2lXaFEC65M3e9WVdNo17qLimxrtQUK4BT4JAK8a79Puu+sh6PzsAbfU4eh83hIGWYLBb6upZXjkF8FrKP0z5zZQ/Mkbw4CQjje6/vroYFbs9dS4B86Q4X643jazdvylAe6OA9qYBrhYQWsCn3cPF+T7YcjpK6LseaCP3i6JRTwYga4KGouk/rTZaXsti4Akr1rUYAsMqC8DrKX875TdoTCUMrX6k0f3XXhc5VJ25ANNtAZ7pnNO5nFxd00mRN9X1SQW62+Ld1ADpqXGsAXJJUwDAIs+Vx6mhNUqwHaegOLqvqcrevPYUpBJ26iBgucT4vdayq3ex5J+l+qwlmrID/K2yMnC/oNaDHuB+JWv8P0j5s4PbjjTSSApz2xYgelacn+bz0+Ke1vW2AOJtA4ALcN1hwNLQ6ATTKoUqAPKeE0c71jRNUTRvD6AsIBADyFogwQ6AIMcIeCMAHRUErHl0ZF4dMa9b78/lFDa+L2A7tMo9BWik+p1dISQqAHws5a+l/HbKj4eqOZJLiiNdZ1q01gSccpZB9jQfl/Pz4nzJdwqwPasA+bQCWc3Ui4IeApbe8572Kw3iYwWgxKFWSwuManHeNy2Q9kaTOPXSwKp3zrlHSy4BDNXMyzZloF0toYDJd7SjgBZOQLvYNKKXuvWtloCItkfp9Ke2FyoAzEzhkxn4vzHY/kgm+d4+kD3LoHleHJff7uXjct26r8wL0G46gbNxnyAg7Wlz0wG0Me0+uQYq85hbbQHwTKceOEgQoJl057AImGvz59c0Ck2nC0SAsSwEqHUj8i2tv7W+pUa7liA7AZYAcjR9XdgRWKjQ2pEBywI8jhABYPYS/FLKP075M44JY6SRetK2ANN71fn9lO9mOrxbnN8rQDb9xudZCz4HwJQCGiqBYCrgdy0mEQE5URibKMylBSyTo915jDwyt6oxPA9E2Dm3NH1vbpsbWqsoJdO0X68fUS3dA3A22l2CVgkPG7yyS/D9njCDrGsXh75QS4vnG4GAMgP9x+AYQdf0E/AeBvjIznOeADB79s+Oft9M+UMdHT/S8aTTDKYX+fggHx/m45xfKc7vF0C7AO8W1IpQMEU0UNDbWFBty5ofZEcLbmkOEziAGRw/GuAJyCQQTcn5bcd7mQDNFxG2LOBH6hRhlhJoBwZaCtWEkekGASwmaN9pQoUlVEVAlp1xbD13ZfrfXzqHCCkofSA0JqBAbbUTg2MgMi4twQ39dlRw2HmvJQB8IeWfpvzFbLrs/eDtTfstcSeD6KsZWJfjo5TfW/3vYb5eQJZBCdUC0QjoSsXsraU7iObqMVbLgckzBzL5c55rrFKKRsZSRc5q1S3yXTkotelOQ+1nd9mxYVYUAjTuKIhbtIy8R8hehsVAm7cAaAKEC+kQxObb5nnY1vun9ruejUV07hrR/D0rQ49AgDgPlrCPll8DYDZ4j7XKAPX94ICiwri1gEuLCgMKR6v9vPpq/JaBMqvLAL+a8s9S/gQ4yJ5nupfB9P0pvy+D62ydeJx/e5R/f0++75zwtaM1o2ETbMVkEhbD84A+Im55modjOhNES/YGbO2tKo4Jc6qKxEGQtPquZWZEwFP7DOpVjWjZiBNaRNjSn69DgTRLxajzXI+w52nvHASwCMP3hCgUzHumLsrHUS18GYvsCBwC1Kc13iyTeY8JGp3TZ0f7RpwNifS1+Uy+74qQ7ZDI4Phkh883VkMIO+2D8lbNzB9RLqBVAB9M+Vspv5M1VW9wlum/hikqEDzBNO2g0Zs8k6VHpIjJkU2T3GVwCwl0kucbiswptjRAD+gQT1tkTi0aSMQyM0faHPm/xTBaXstEWJANhUaYC00OnSJwono1wVoTgBbx1KFfeV6WvCXgSxnyBZ33D5k0wXFCDlj0Wm487dYTJGVlu7ToF5nKWcrlOechJmzptE5EV2VooI2sXkBC8EZB1uOHETrRcDTSvlDfbIobPpfyb1L+RQP8EQmbi4GOgDgDxBQdgKz8xgEtEjGbeYO3Bf51Ga0wl8g1NcxKPVYai2ARKZgp7nTEnQyWgMFFjgk5aiJG+1EarxFQqyWDuS2XDJgwo3WghoUPmS+NMJ3yK0hYVqTNidYt2+qxOiCgzEFabwFb4B1sjePI8jEkLgEFtU82ymLRT9STXYzvInSEWi0JrCOTv6lP6/9s/I7wn640CwAfoEsnv9+l/GWDcLgxANsgJeoAYqBCHlPmQOcQ2V6n67UaHUQ5rmWwxVSteSNR+icCusi8Uk0L3txcb3v2vMVjwuibGHiHN6fp0UOLltmhFXTuMsI4OWhdQTScqGc7U3tumcE+ZpApinOftWGMHEB4RcBdwH7hhgVNW+/P1WcZsKwi1lOvLSLToBauRPi8p2R69BzhERq2eMKkF6CICfOVQKze7vTYPAXw65Tfot3lU0joQURjRADdezcDDeqBmOVUQgEmaAxIKGh5xCQbCVrSIkZ0Hr/H1N6zjCliSmv5Dfd6BaPmNc9aIAB9IVpMj8ORpqWX72yvv991/EOdsBzggaaU0PlyRNhsTeG0fD0kQGMe86SOtkKdYxFTsxfAhwxeUT0jmrVhopiDncVDJgfEEQ98hD45MA4j1iKEJ3GwnZhiFu+eUMzRlU4743ijAjmHGbllykL2OY7Ov4hjFSijL3HDbCaN+6yYz86cjiASoyWtevPh7GikvWDsCXYMCB8eYUfNaXGLDYcFUwaB2tJavb6MrNRQ+pq9cWNZ47gYyWJoVwyMcwnQDKJ9e2M/2o8REyriF4Bqodw5rjxLROT91jr2iBPyGq2bO9ug12rHYHsglhxv/r4WNiOR+lBlM7qK6CCr8WYB4Pt0uZ3vX5VPiaOdR5mSx4QY+C4FTFaL41EmKGkxZi6eZpBIjHsYnXdETVTWGlUBGYeA7ewJdhpYiwGMKHMXh2Fb1Magqdeia89EyyvGAzkCawn2rQ1FPCuX1p6IjwfiVc+geRUBlOhe6lHHKhS4PcHQmvZA55kRS5KAdEPgN3sEbu5oYw7wMwRoI4AYoTNkejDCs9Glx0jYbERpphV9Q4Y18akA8PeUf5vyV1L+fdCc6g02r2GQzpdOoo9oLHkAMKrlki3YCFP/sknUAUnzqxCKaWQ9dZaGaYw7Bi3qfISWmzrrboVaFZB+UdrUYi5QNYXEwPcsCxCqOTtty7SiXwQU9BgoKwFWNE1joyAv8KyOEdrzIvihfg89q18iIG3F/kAdC6NtXf+3Z4kbO/2AWJwlKGBxsI3Z4N1k8AWP/jkwnpt9WqwC4D+lP99J+Zcp/6tz0HNAo7I0CnYkr54EgJNQh8VC03Yjkd/QAYoyBwGYlQDaMjqtENW+BGCAVuAMDkjGa6wvVjkQJzVP0udA/3PFJhFth4GyOhqHRIUGDmpgFKBDxFqmMdm1MUw4MB5RK0uUR1lttMZ7noFzRINHhfT2+8TkC9b6fYuvWb4XkdUJiACH+JoxyGu8PlizVPYqAMuTi4vWA3MgoJ+n/Brhc/PzJkEfpctVBXMgng/TbrAezUENia2Nrmm1rAiexcGKaDWB1gkw+p4Zcx2dR7aes9YDR8oIhOBtlWMnAlb0vRIc2JOjya/dKAfdHwAtU3RLWWQnPuQ7E+mOc2v2MfA2FbKesTZu6WnDKA1QR9u3/78b9yM6hhDa4JXtb9WLKBbILDoevMBqGt+eqvb16hUJXYzu54A4hbYDFTG1lr4SyN/ZqKMn6HjOnc+e0QSAOWmhgDUgPaXjTPPqhiX07qN8nCMEPs7CycN8fj//PsdAmBtl22j4ySESCRDPmqiBIBBDAk6UGZECKMh3J5DxXBfgaO0+AXWlFQBtlbnRLyyN8Mw9ghRaV689NQbrtT3ar2u2G+4V6iJClSeY9AgPER4xrR67+2DUQxu9gsEa3nXIb3jPeXTChCsmPd9DlF5PQQ1ZoywBYE7aZkCtRjlWAeAmpHkq5m4WPuZQx6/Q1V4Bc0jjB1koWTbueTUfyx3ztp2DskeIiOxJ4DFNlPFqjHBS7mNQi0QZOVK3ifRoglMH+EXLI53PdAoqXaArnXWK0BGy10VUWOwBME+Dj7RppEyI0HAIUEXvYcAipT1v3cNgOTxAR33S6o2NohFue3zfPMFhTXRD8QQAoqvtgH+S8qczWLXW4w4B4CYnbEZp2fN+2Zr3ohJEyusH+d5y+9672SJzVtBLr3m2cT+XexusmWpAtaFDaX+HAnOj3Grb9AJO77bHqNXALs+VyV0UZh6d9ukRsiLadKStvBgHiBUCsXagZW7RjyO47O0oGVEsKDBOkSkGMqyXUYuBrHjWExYQS4J3D0esErYAcFXNmVl/KuXvpfz13Rc96+izgaIjHYkoc14IK4vQcScLIeeFEHOaj2fVfaf5+jTn+fcTAACmgCaGaINTh7a1dj6/R+CJmOFbYBed70fKjW4vjQJ1r6WmVzDy/AqY4r4RnjUHEWx6rIsR4Eetikhdestujd2Ipr5ipdveTqSIMKAFAFpWue1t/rY1WenVre+m/MeU/5nyX1J+my7nzctNT45JUx3p5U0zdfwn538fcTm3Od/Jx7Min1fn51kQOauEkvJ6m4WU5fqEsI1GagZiMTJrsySieIRNVsBMX3XiO4N5dSGD4Vtm1hoUDrFHuxG+N31H1LKx044tM7AV26DeLY8I22iHwTbUVn71cPneXQx7o1MeIupodBe/cmfISIRFZzO7/YiQyBRAneZ56TfpMoDQ5+n4nQBHGhLVSP3Esa1yKXBsi/NFQNlUQshZPm4LIWU5bnI+KSwsh7Z4oJaNXl8DxMrQ40/Qqbk/G88Rh75JAcs1/kOW1SKqjaNWgbaVYFdoZMId+CZHiNDKiewsiTqMW/2NRBM0HQR7BIAlvU6XWwe/VWgeIw1BYaSRnncqhYg6b8HfNvn3WiA5qYQVLs4twIwuRaWAw2IEFFF/AUR4QQQfpKxr6oPWAxEeiGK+A9Hl6hG/AFEsBl55kT1fVGFhu4L3/yHlv6X8j5TfGDzotqcB/iMdbZpyfvfIJehNJUhUVhDhQgAp/8/Fb5uGMKIdl+9agYO0zZusQa9NOSCmew8gUY3Dm9rQmJi2MRFS7poZRsvYalukHtrUhXL+9NSaynmWMAFAr+KfU/5Vyk9ebs028I6hSA/rx0gvqwT9v5yPndg3tB9JcqNcbxrP1cJHKyqlFvu+tRcDExZ2WByQZ2Ng90Q7RdgGg2AeES5qfw2kqM33rZkCGDx1pBfX6dFXDXobpDTSbeo0K6S2F2obDb/bCv+NOBIigYy8CLgtE34dO4FVwWd/Q/Wmc+j2hdGCDFp/OZWgAzWqDHp7qYlXXvaBeBPrJYd+mdyQjrJ+4+DzJfBPDYKo91Uw9wz5vwADAFVdqz1vyN8hAAAAAElFTkSuQmCC";
  33858. this._image_h_l_r = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAAgCAYAAABkS8DlAAABIklEQVR4nO3WbQuCMBiG0dn//80tiAp6WT4zi+A+54vTTdMKuZZ20Y/H2/is9/r+aFxdNz5/qa7t1/Gr+dlj79ZX5mrnvz93p+3T9zKznbnnynW/OPfwnLXP/v2xqXvolXv8dH7Ld7Vhvs+cf/2v/d/vd3dfq8/0zbm1a1d/18L2o3fIzHbtnVi51p5zK8f6q3Xj8cza8XjrusH+oQEAcQQAAAQSAAAQSAAAQCABAACBBAAABBIAABBIAABAIAEAAIEEAAAEEgAAEEgAAEAgAQAAgQQAAAQSAAAQSAAAQCABAACBBAAABBIAABBIAABAIAEAAIEEAAAEEgAAEEgAAEAgAQAAgQQAAAQSAAAQSAAAQCABAACBBAAABBIAAJCmtXYCutDwWwUr9cEAAAAASUVORK5CYII=";
  33859. this._image_h_r_l = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAAgCAYAAABkS8DlAAAAAXNSR0IArs4c6QAAAFBlWElmTU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAAAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACAKADAAQAAAABAAAAIAAAAACVLBWUAAABWWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgoZXuEHAAAC90lEQVR4Ae3WzVbbMBAG0PzBgcOa93/M7nCj2F8zUUILdDmXjWTNSLauBMz+19vbstvvl139+c5zza39sd7hUNe99mveZ/3dbs3/LF7W3j/IXbZ5hzI/Yzf7TXxux/fPY3n+W+wrOfP3Zs5P26wXk22d/bzenJf8jNf82h/73XLOh7KeS51b++fEw/R8uQfzetvzsubmbtyuPXLmteo6W/9Qv2lZ7te4fde6l6xT52Ysbf22jK3t+o7j8frdt/H1HTWe96RdY+v8OnfrX84u45kznrPm6Cde2/THnPRrW/vjK+e8OT6e61j6OZcaH/ZbfDvXy+/Qsc5Jv55TxtKOWNY/t39+bx/NSV6dk3VGrM4Zu/2fsbFW/Ou69RvGO2rOFlvq2Pwdc2w8Z/0tdpqeL/HTab0/iaWd1xt5iaWd587PyXt6evyOOT939LP8jCcv66d9fn78nsSH2cvLv3OS//p6mzvmJza3Izb+D64/ae/zR/zR3IyN+MfH/fz39+tY9j9yv9//6pw57+45/xvOfzv9ECBAgAABAt0EFADdTtx+CRAgQIDAWUAB4BoQIECAAIGGAgqAhoduywQIECBAQAHgDhAgQIAAgYYCCoCGh27LBAgQIEBAAeAOECBAgACBhgIKgIaHbssECBAgQEAB4A4QIECAAIGGAgqAhoduywQIECBAQAHgDhAgQIAAgYYCCoCGh27LBAgQIEBAAeAOECBAgACBhgIKgIaHbssECBAgQEAB4A4QIECAAIGGAgqAhoduywQIECBAQAHgDhAgQIAAgYYCCoCGh27LBAgQIEBAAeAOECBAgACBhgIKgIaHbssECBAgQEAB4A4QIECAAIGGAgqAhoduywQIECBAQAHgDhAgQIAAgYYCCoCGh27LBAgQIEBAAeAOECBAgACBhgIKgIaHbssECBAgQEAB4A4QIECAAIGGAgqAhoduywQIECBAQAHgDhAgQIAAgYYCCoCGh27LBAgQIEBAAeAOECBAgACBhgK/AX08dE/3SOoSAAAAAElFTkSuQmCC";
  33860. this._image_v_b_t = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAAgCAYAAABkS8DlAAADcklEQVR4nO3di27bMAyFYdpWLuv2/o+aJfFFgxOp5VjKdjDM6rD/A4KkbZyhwIBzTMluE/s+CAAA+J/EIH1/SL9ws/KLR/5rAADwZb2S4zHIMBzVN9YOzh8QN74XAAD8HTmLt2Z3Ns3PId7vR/MB9oPihtcAAGBfOq9Lr3WOR/0Icrt5BaAxb14rAwAA4OsUAC/HPxWAk4i0hSmAF/iT8zMAALCvnNXtQiHwwn/O8WkuAGdTALy1hFhoEQAAoA5ver+W4aoAXK8UAAAA/j1/UgDGED8mAHYZQB/ofYBQAgAAqMIL/qXN/L+F/6MAyPX6TUS6lQLgPYQCAABAFaUCsJbjY3oMQS4XXQDaFwoAywAAANRRCv6lApDP/odHAYi3Wy4A3YYCMFEAAACozgv9tUn+qApAnycA4cUCMFEAAACoxgv+LQVgSI8Q5OdPWwDawoE2/CcKAAAAVZTC3zuRn5wC0M0F4LuIHJx9AHb3/2TCnwIAAEAdugC0zmtRWW4LwP0xAYjPCcAhTQHswZ9uHOAUAQAAsC971t8WLunXBeD97H9+X14COBT2Adj1flsCKAAAAOzPC35vGcBb/291ATguFIBS8FMAAACoo1QASpP8993/7wUgLQGcUgEICxMAHfojVwIAAFCNLQDdCwUgPDcBXi5vqQAcCgUgOsFv9wIAAID9NE74ezf1swXgnt7X6CWAo7oh0FIBGLkSAACAqvJGPxv+paX8UW8AnH+Q7wR4NhsBvQIwqgnASAEAAKAaO/7fUgB6lfEx3wnwbDYCLhWAkQIAAEBVXgHwbuufc3xQ9/xJBeB6PacCcFooAF74jxQAAACqWAp/fVdfXQD6lO+PE/ggH0sA+koAUQdKOpACAADA1/BKARC1AbDNpSDE5wQgXwrYpQKwNgEYKQAAAFRTKgD27/roCYC+1f84TwDOZg9AMAfa9f+BCQAAAFW16iqAYJ717YBzjg9qiX96/jng2+2Uzv6PqgSUJgCDKQHcDRAAgP3Zs/9gvvY2Abb6ioC5AOTgP5vw17p0QKueKQAAANThFYCgzvytLn2dpwHHEO/3tfCX9P2ggr8zlwICAIB9NGb8vxT8OsePefw/XxIYpO9/mJ3/S/LGgqDW/ikAAADsp9kQ+J45v9/S9+NcALaGv5X/4W77IQAAoLI3EWl/AQ/TsX9wLtbWAAAAAElFTkSuQmCC";
  33861. this._image_v_t_b = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAAgCAYAAABkS8DlAAAAAXNSR0IArs4c6QAAAFBlWElmTU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAAAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACAKADAAQAAAABAAAAIAAAAACVLBWUAAABWWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgoZXuEHAAAHhUlEQVR4Ae2d2W7bSBREucmy7IcA+f+fnAePtXCZqr68IhVLSGLATIA5DbS72QspHT9U9UbV79++vVdV9axIgAAEIAABCEDgf0Kgq3a7f/RdR8WXT37nSf0yfvIWdIMABCAAAQhA4DcJNHP7+jf7uXlvA/CmTHb2TEDe0A3uhRT7XpWOg+JU1bXLCRCAAAQgAAEIbEFgmqzXjq1iN+d/ruF13dfT9NbVT08XdXI8zZ33StMQKHsN94R/UMNBFZ5BIEAAAhCAAAQgsBEB6W8j/U0T4MF4GgGnj3TcA/ej4rmr9vuzM4rpHpQteXfOG1j8ffOMvSos/CWqHAMgCAQIQAACEIDAVgRW4m8TYB1uNRs/VtNkA5AmYK3jFv+zCs7qe+6m/f6ki92qsW+SZsAdLf6OLrcBKNP+Kuj1oEEPyjpVESAAAQhAAAIQ2IhALR1uZsH3TH4n0W4lymkAbAys4w7W8F5t+6muPeg/dbUMgAp25SYh9BZ5G4BavUpH3cwd0wBY9Ici/mEI7DZcR4AABCAAAQhAYCsCtWX6ugfAot9rTO5ZgDQAax33YN0GwPrtJf9j18gAyA3kVEGO5m0AHIoB0J8QeU8thOjnUoDTNAduT4AABCAAAQhAYAsC0xQzADHi92g/xD+WAH7UcQ3xp75qGpuAMADT4XDUbsBaJqCeR/Ke4i8zAEqLAVCaIn9rAGIJYJTjcDkBAhCAAAQgAIGNCEi2lxmAZSkgR/85sE8d9wA/l/FPujh6E+BRmUYi3tSNNhTaIaQBsLtw8BG/2FhwHfmrj5cCxkblaoQBKKD4AwEIQAACENiIQAzcGwlwGf3rsq3GMZcAYv1/reOzAZB+n1UpA/Dy4uMAthFW+0E32in94BzUwSI/qFNJnVcc53KXESAAAQhAAAIQ2I6A5Lpq9MfRum0zUGYAXKZr1zs6eMe+Ndyn+C7KH7v6+fmoYo3xPZxvBqVlF6HLZAuio+rKDIA6W/B1A5//TyOgonJKoDyBPxCAAAQgAAEIbELAS/eN9NknAWppeCsNb10m+S5lNzpuDdfSvTS8HP/vqsPhXY2t4EXY9ZG9/u8phFqL+8UA6E7aJFDW+Yvou63arDcA2gQQIAABCEAAAhDYjoA12iP9YgK0lu+0GIC57J6O9xLsi3T/1E0vL+8e/auxR/flHKHyZQlAdy4GQOWut+hnXIu/y1xPgAAEIAABCEBgOwIxUz9q/C7h1+g+zEBcF3NwR8fLuwDU/tQ1h8O/cgLe0NdrE6BfCNQpbwdxuwRg8W+8vHA1Abn730cEMQDb/cN5EgQgAAEIQCAJlNG/hD7Ef53e03Gf3ov3BehVwN4DMIu6VDxmAGQAtALgtYUyAyCnYIVPob8xAaWvTwkQIAABCEAAAhDYmkARfonwYgBm4S+m4KOOFwMgXb/EEsA4xuheGwD1yTtVWNFjA4G/ii9jlL+IfxwLtPCPpd7tCBCAAAQgAAEIbEkgtNrr/2kCmqaUze/3uQ7kVT/qmKB13C8EunRtnAKwiNsVxAZAO4b5BldxTwOwFv6cFfD7AwgQgAAEIAABCGxLYPSreDRgT81OI+BZfEeHmBGYZvH3gN96X2YAvAegV7uz0usJAFXaTSwhDYDTtQmIlwdhABZS5CAAAQhAAALbELDIW/Rz4G5DkGYgDcDySXIGwL8H0PsYoN8DMEjXPfUf7wBwp3AVS7dZ6DWlEHsBMg1DgAFYSJGDAAQgAAEIbEMgRvf5PoCSSsLzdEDMAOQnkY5PsQQwGwAdA5TY+6d9y+hfSh5vAfzROcQMwDL693WO/qMuH0EKAQhAAAIQgMAWBNZi77xmA8rav4/x39PxeKePlwCGbtrtjmqT7//3C4CaMvq/19GC7zP/FnwMwBb/Wp4BAQhAAAIQeEzAWu3oWfvMW/zzet0zdPu6DNB1r69HqX+e/S9vANQ97joH9Q3hb9vFBPjmLidAAAIQgAAEILAtAeu1Q+r2oDf1W8QVStn601jEFTR7P1bDMJQfA+r860F++Y83DrhT39feFbju17mTQ9ct4p9lma47kIcABCAAAQhA4GsJpFan4M8a7ofe1XFruPcBKHZV256qp6dWbiDE352fnrQb8NYAlG9goc/oAud9MwIEIAABCEAAAn+GgAbt19H+rOG+9sa+m5D67bRtZQBeX09l5H+5LAbAN/hVA+A9AQQIQAACEIAABP4MgU4H+FKzU7/zev2J1gZAmwE7jfaP89T/YgC8gcAhb+BOS4h8HCWo1H9dt7QiBwEIQAACEIDA1xM4n0OzvYwfYVnC/6jjMZO/28kANM1ZsdZvAoSDyMaR5k2iQ36NtSFY57OeFAIQgAAEIACBbQgcDqnVy8DdT36k4/NMQFd9/352s+rt7Z4BWD78Wugf5ZfW5CAAAQhAAAIQ2IJADtz9rEd516V2Xw3A6WQDUFX7fU4d3N6gVN75M9/g5mF3mlEEAQhAAAIQgMAXErAeW/jX4v/ocWkCVK/f+Z2ena7arvOr4muWNf8rCjIQgAAEIACBv47AL+m4TwlcFH/W+K/7dnwgCEAAAhCAAAQ+T+A/hVJn6rP9qnIAAAAASUVORK5CYII=";
  33862. this._sketchTempPoints = [];
  33863. this._sketchPoints = [];
  33864. this._sketchOutputPoints = [];
  33865. this._sketchWallHeights = [];
  33866. this._drawEntity = void 0;
  33867. this._lineLabel = void 0;
  33868. this._polygonLabel = void 0;
  33869. if (options2 && options2.isDrawPoint)
  33870. this._isDrawPoint = options2.isDrawPoint;
  33871. else
  33872. this._isDrawPoint = false;
  33873. if (options2 && options2.isRetainDrawPoint)
  33874. this._isRetainDrawPoint = options2.isRetainDrawPoint;
  33875. else
  33876. this._isRetainDrawPoint = false;
  33877. this._param = {
  33878. lineWidth: 3,
  33879. lineColor: "rgba(0,255,0,0.75)",
  33880. outlineWidth: 2,
  33881. outlineColor: "rgba(255,255,255,1)",
  33882. polygonColor: "rgba(0,255,0,0.5)",
  33883. wallHeight: 30,
  33884. power: 0.25,
  33885. odlineHeight: 1e3,
  33886. odlineCount: 50,
  33887. text: "\u91D1\u7530\u4EA7\u4E1A\u96C6\u56E2",
  33888. duration: 1500,
  33889. count: 1,
  33890. direction_h: "horizontal",
  33891. direction_v: "vertical",
  33892. order_add: "+",
  33893. order_minus: "-",
  33894. houseColor: "rgba(0,255,0,0.95)"
  33895. };
  33896. if (options2 && options2.iconType) {
  33897. switch (options2.iconType) {
  33898. case DrawTools.IconType.Normal:
  33899. this._sketchPointImage = this._iconNormal;
  33900. break;
  33901. case DrawTools.IconType.Blue:
  33902. this._sketchPointImage = this._iconBlue;
  33903. break;
  33904. case DrawTools.IconType.Green:
  33905. this._sketchPointImage = this._iconGreen;
  33906. break;
  33907. case DrawTools.IconType.Violet:
  33908. this._sketchPointImage = this._iconViolet;
  33909. break;
  33910. default:
  33911. this._sketchPointImage = this._iconNormal;
  33912. break;
  33913. }
  33914. } else {
  33915. this._sketchPointImage = this._iconNormal;
  33916. }
  33917. this._canvasWidth = this._viewer.scene.canvas.width;
  33918. this._canvasHeight = this._viewer.scene.canvas.height;
  33919. if (this._isRuntimeApp()) {
  33920. this._viewer._cesiumWidget._supportsImageRenderingPixelated = Cesium.FeatureDetection.supportsImageRenderingPixelated();
  33921. this._viewer._cesiumWidget._forceResize = true;
  33922. if (Cesium.FeatureDetection.supportsImageRenderingPixelated()) {
  33923. this._viewer.resolutionScale = 2.6;
  33924. }
  33925. }
  33926. }
  33927. _arcToDegree(arc) {
  33928. return arc / Math.PI * 180;
  33929. }
  33930. _toColor(red, green, blue, alpha) {
  33931. let normalColor = new Cesium.Color(0, 0, 0, 1);
  33932. if (typeof red != "number")
  33933. return normalColor;
  33934. if (typeof green != "number")
  33935. return normalColor;
  33936. if (typeof blue != "number")
  33937. return normalColor;
  33938. if (typeof alpha != "number")
  33939. return normalColor;
  33940. if (red < 0 || red > 255 || green < 0 || green > 255 || blue < 0 || blue > 255 || alpha < 0 || alpha > 1)
  33941. return normalColor;
  33942. return new Cesium.Color(red / 255, green / 255, blue / 255, alpha);
  33943. }
  33944. _toColorFromArray(array) {
  33945. if (!array || array.length === void 0 || array.length === 0)
  33946. return new Cesium.Color(255 / 255, 255 / 255, 255 / 255, 1);
  33947. let r2 = 255, g = 255, b = 255, a = 1;
  33948. if (array.length === 1) {
  33949. r2 = parseInt(array[0]);
  33950. } else if (array.length === 2) {
  33951. r2 = parseInt(array[0]);
  33952. g = parseInt(array[1]);
  33953. } else if (array.length === 3) {
  33954. r2 = parseInt(array[0]);
  33955. g = parseInt(array[1]);
  33956. b = parseInt(array[2]);
  33957. } else if (array.length >= 4) {
  33958. r2 = parseInt(array[0]);
  33959. g = parseInt(array[1]);
  33960. b = parseInt(array[2]);
  33961. a = parseFloat(array[3]);
  33962. }
  33963. return new Cesium.Color(r2 / 255, g / 255, b / 255, a);
  33964. }
  33965. _updateScene() {
  33966. this._viewer.scene.requestRender();
  33967. }
  33968. _getScreenClickPosition(screenPosition) {
  33969. let resCartesian = void 0;
  33970. let ray = this._viewer.scene.camera.getPickRay(screenPosition);
  33971. let position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
  33972. Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  33973. if (Cesium.defined(position2)) {
  33974. resCartesian = {
  33975. x: position2.x,
  33976. y: position2.y,
  33977. z: position2.z
  33978. };
  33979. }
  33980. return resCartesian;
  33981. }
  33982. _getScreenClickPositionAndHeight(screenPoint) {
  33983. var lng = void 0, lat = void 0, height2 = void 0;
  33984. var ray = this._viewer.scene.camera.getPickRay(screenPoint);
  33985. var position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
  33986. var cartographic = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  33987. cartographic = Cesium.Cartographic.fromCartesian(position2);
  33988. var feature2 = this._viewer.scene.pick(screenPoint);
  33989. if (feature2 === void 0 && Cesium.defined(cartographic)) {
  33990. lng = this._arcToDegree(cartographic.longitude);
  33991. lat = this._arcToDegree(cartographic.latitude);
  33992. height2 = cartographic.height;
  33993. } else {
  33994. var cartesian = this._viewer.scene.pickPosition(screenPoint);
  33995. if (Cesium.defined(cartesian)) {
  33996. var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  33997. if (Cesium.defined(cartographic)) {
  33998. lng = this._arcToDegree(cartographic.longitude);
  33999. lat = this._arcToDegree(cartographic.latitude);
  34000. height2 = cartographic.height;
  34001. }
  34002. }
  34003. }
  34004. return {
  34005. lng,
  34006. lat,
  34007. height: height2
  34008. };
  34009. }
  34010. _transfromFromScreenPoint(screenPosition) {
  34011. let location = this._getScreenClickPositionAndHeight(screenPosition);
  34012. if (location.lng != void 0) {
  34013. var cartesian = Cesium.Cartesian3.fromDegrees(location.lng, location.lat, location.height);
  34014. return {
  34015. gLocation: location,
  34016. sLocation: cartesian
  34017. };
  34018. } else {
  34019. return {
  34020. gLocation: void 0,
  34021. sLocation: void 0
  34022. };
  34023. }
  34024. }
  34025. _removeEntityByName(entityName) {
  34026. var entities2 = this._entities;
  34027. if (!entities2 || !entities2.values)
  34028. return;
  34029. var delEntitys = [];
  34030. for (var i2 = 0; i2 < entities2.values.length; i2++) {
  34031. if (entities2.values[i2].name == entityName) {
  34032. delEntitys.push(entities2.values[i2]);
  34033. }
  34034. }
  34035. for (var i2 = 0; i2 < delEntitys.length; i2++) {
  34036. entities2.remove(delEntitys[i2]);
  34037. }
  34038. this._updateScene();
  34039. }
  34040. _removeEntityByObject(objEntity) {
  34041. if (!Cesium.defined(objEntity))
  34042. return;
  34043. this._entities.remove(objEntity);
  34044. }
  34045. _createPoint(coord, label2) {
  34046. let _self = this;
  34047. let entity = new Cesium.Entity({
  34048. name: _self._sketchEntityName + "_Point",
  34049. position: coord,
  34050. billboard: {
  34051. image: _self._sketchPointImage,
  34052. horizontalOrigin: Cesium.HorizontalOrigin.center,
  34053. verticalOrigin: Cesium.VerticalOrigin.bottom,
  34054. scale: 0.5,
  34055. pixelOffset: new Cesium.Cartesian2(0, -11),
  34056. disableDepthTestDistance: Number.POSITIVE_INFINITY
  34057. }
  34058. });
  34059. if (label2) {
  34060. entity.label = {
  34061. text: label2,
  34062. font: "12px sans-serif",
  34063. fillColor: this._toColor(255, 255, 255, 1),
  34064. outlineColor: this._toColor(0, 154, 94, 1),
  34065. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  34066. outlineWidth: 1,
  34067. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  34068. pixelOffset: new Cesium.Cartesian2(0, -28),
  34069. showBackground: true,
  34070. backgroundColor: this._toColor(0, 0, 0, 0.6),
  34071. disableDepthTestDistance: Number.POSITIVE_INFINITY
  34072. };
  34073. }
  34074. this._entities.add(entity);
  34075. this._pointEntitys.push(entity);
  34076. this._updateScene();
  34077. }
  34078. _removePointEntitys() {
  34079. this._removeEntityByName(this._sketchEntityName + "_Point");
  34080. this._pointEntitys = [];
  34081. }
  34082. _callUpdaeEllipseCenterPosition() {
  34083. let _self = this;
  34084. return function() {
  34085. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  34086. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  34087. _self._sketchEllipseCenterPosition = Cesium.Cartesian3.fromDegrees(
  34088. Cesium.Math.toDegrees(
  34089. point1cartographic.longitude
  34090. ),
  34091. Cesium.Math.toDegrees(point1cartographic.latitude),
  34092. point2cartographic.height
  34093. );
  34094. return _self._sketchEllipseCenterPosition;
  34095. };
  34096. }
  34097. _callUpdateEllipseMinorAxis(positions) {
  34098. let _self = this;
  34099. return function() {
  34100. if (positions === void 0 || positions.length === void 0 || positions.length < 2) {
  34101. _self._sketchEllipseRadius = 0;
  34102. } else {
  34103. _self._sketchEllipseRadius = _self._calculateEllipseMinorAxis(positions[0], positions[1]);
  34104. if (_self._sketchEllipseRadius <= 0)
  34105. _self._sketchEllipseRadius = 1;
  34106. }
  34107. return _self._sketchEllipseRadius;
  34108. };
  34109. }
  34110. _calculateEllipseMinorAxis(position1, position2) {
  34111. let point1cartographic = Cesium.Cartographic.fromCartesian(position1);
  34112. let point2cartographic = Cesium.Cartographic.fromCartesian(position2);
  34113. let geodesic = new Cesium.EllipsoidGeodesic();
  34114. geodesic.setEndPoints(point1cartographic, point2cartographic);
  34115. return geodesic.surfaceDistance;
  34116. }
  34117. _calculateEllipseOutlineCoordinate(position1, position2) {
  34118. let positionCenter = position1;
  34119. let positionRotate = position2;
  34120. let ellipseOutlineCoordinates = [];
  34121. for (let angle = 5; angle < 360; ) {
  34122. let newPosition = this._rotatedPointByAngle(positionRotate, positionCenter, angle);
  34123. ellipseOutlineCoordinates.push(newPosition);
  34124. angle = angle + 5;
  34125. }
  34126. ellipseOutlineCoordinates.push(ellipseOutlineCoordinates[0]);
  34127. return ellipseOutlineCoordinates;
  34128. }
  34129. _callEllipseOutlineCoordinate(positions) {
  34130. let _self = this;
  34131. return function() {
  34132. _self._ellipseOutlineCoordinates = _self._calculateEllipseOutlineCoordinate(positions[0], positions[1]);
  34133. return _self._ellipseOutlineCoordinates;
  34134. };
  34135. }
  34136. _rotatedPointByAngle(position_A, position_B, angle) {
  34137. var localToWorld_Matrix = Cesium.Transforms.eastNorthUpToFixedFrame(position_B);
  34138. var worldToLocal_Matrix = Cesium.Matrix4.inverse(localToWorld_Matrix, new Cesium.Matrix4());
  34139. Cesium.Matrix4.multiplyByPoint(worldToLocal_Matrix, position_B, new Cesium.Cartesian3());
  34140. var localPosition_A = Cesium.Matrix4.multiplyByPoint(worldToLocal_Matrix, position_A, new Cesium.Cartesian3());
  34141. var new_x = localPosition_A.x * Math.cos(Cesium.Math.toRadians(angle)) + localPosition_A.y * Math.sin(Cesium.Math.toRadians(angle));
  34142. var new_y = localPosition_A.y * Math.cos(Cesium.Math.toRadians(angle)) - localPosition_A.x * Math.sin(Cesium.Math.toRadians(angle));
  34143. var new_z = localPosition_A.z;
  34144. return Cesium.Matrix4.multiplyByPoint(
  34145. localToWorld_Matrix,
  34146. new Cesium.Cartesian3(new_x, new_y, new_z),
  34147. new Cesium.Cartesian3()
  34148. );
  34149. }
  34150. _callUpdateRectangleCoordinates(positions) {
  34151. let _self = this;
  34152. return function() {
  34153. let g0 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(positions[0]);
  34154. let g1 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(positions[1]);
  34155. let lng0 = Cesium.Math.toDegrees(g0.longitude);
  34156. let lat0 = Cesium.Math.toDegrees(g0.latitude);
  34157. let lng1 = Cesium.Math.toDegrees(g1.longitude);
  34158. let lat1 = Cesium.Math.toDegrees(g1.latitude);
  34159. _self._rectangleCoordinates = [0, 0, 1, 1];
  34160. if (lng0 < lng1) {
  34161. _self._rectangleCoordinates[0] = lng0;
  34162. _self._rectangleCoordinates[2] = lng1;
  34163. } else {
  34164. _self._rectangleCoordinates[0] = lng1;
  34165. _self._rectangleCoordinates[2] = lng0;
  34166. }
  34167. if (lat0 < lat1) {
  34168. _self._rectangleCoordinates[1] = lat0;
  34169. _self._rectangleCoordinates[3] = lat1;
  34170. } else {
  34171. _self._rectangleCoordinates[1] = lat1;
  34172. _self._rectangleCoordinates[3] = lat0;
  34173. }
  34174. let rectangle = Cesium.Rectangle.fromDegrees(
  34175. _self._rectangleCoordinates[0],
  34176. _self._rectangleCoordinates[1],
  34177. _self._rectangleCoordinates[2],
  34178. _self._rectangleCoordinates[3]
  34179. );
  34180. let res = _self._calculateRectangleOutlineCoordinates(rectangle);
  34181. _self._rectangleOutlineCoordinates = res.cPoints;
  34182. _self._sketchOutputPoints = res.gPoints;
  34183. return rectangle;
  34184. };
  34185. }
  34186. _calculateRectangleOutlineCoordinates(rectangle) {
  34187. let south_east = Cesium.Rectangle.southeast(rectangle);
  34188. let se2 = Cesium.Cartographic.toCartesian(south_east);
  34189. let south_west = Cesium.Rectangle.southwest(rectangle);
  34190. let sw = Cesium.Cartographic.toCartesian(south_west);
  34191. let north_east = Cesium.Rectangle.northeast(rectangle);
  34192. let ne2 = Cesium.Cartographic.toCartesian(north_east);
  34193. let north_west = Cesium.Rectangle.northwest(rectangle);
  34194. let nw = Cesium.Cartographic.toCartesian(north_west);
  34195. let gPoints = [];
  34196. gPoints.push({
  34197. lng: Cesium.Math.toDegrees(south_west.longitude),
  34198. lat: Cesium.Math.toDegrees(south_west.latitude),
  34199. height: south_west.height
  34200. });
  34201. gPoints.push({
  34202. lng: Cesium.Math.toDegrees(south_east.longitude),
  34203. lat: Cesium.Math.toDegrees(south_east.latitude),
  34204. height: south_east.height
  34205. });
  34206. gPoints.push({
  34207. lng: Cesium.Math.toDegrees(north_east.longitude),
  34208. lat: Cesium.Math.toDegrees(north_east.latitude),
  34209. height: north_east.height
  34210. });
  34211. gPoints.push({
  34212. lng: Cesium.Math.toDegrees(north_west.longitude),
  34213. lat: Cesium.Math.toDegrees(north_west.latitude),
  34214. height: north_west.height
  34215. });
  34216. gPoints.push({
  34217. lng: Cesium.Math.toDegrees(south_west.longitude),
  34218. lat: Cesium.Math.toDegrees(south_west.latitude),
  34219. height: south_west.height
  34220. });
  34221. return {
  34222. cPoints: [sw, se2, ne2, nw, sw],
  34223. gPoints
  34224. };
  34225. }
  34226. _callUpdateRectangleOutlineCoordinates() {
  34227. let _self = this;
  34228. return function() {
  34229. return _self._rectangleOutlineCoordinates;
  34230. };
  34231. }
  34232. _materialTextImageProperty(options2) {
  34233. this._canvasId = "canvasJt";
  34234. let canvasObj = document.getElementById(this._canvasId);
  34235. if (canvasObj != null) {
  34236. document.body.removeChild(canvasObj);
  34237. }
  34238. canvasObj = document.createElement("canvas");
  34239. canvasObj.id = this._canvasId;
  34240. canvasObj.setAttribute("width", "1024px");
  34241. canvasObj.setAttribute("height", "256px");
  34242. document.body.appendChild(canvasObj);
  34243. let context = canvasObj.getContext("2d");
  34244. context.fillStyle = options2.color === void 0 ? "rgba(255,0,0,1)" : options2.color;
  34245. context.font = "bold 240px \u5FAE\u8F6F\u96C5\u9ED1";
  34246. context.textAlign = "left";
  34247. context.textBaseline = "bottom";
  34248. context.fillText(options2.text, 12, 250, 1e3);
  34249. let textMaterial = new Cesium.ImageMaterialProperty({
  34250. image: canvasObj,
  34251. transparent: true
  34252. });
  34253. textMaterial._param = {
  34254. color: context.fillStyle,
  34255. text: options2.text
  34256. };
  34257. return textMaterial;
  34258. }
  34259. _materialColorProperty(options2) {
  34260. let mColor = "rgba(0,255,0,1)";
  34261. if (options2 !== void 0 && options2.color !== void 0)
  34262. mColor = options2.color;
  34263. let colorMaterial = new Cesium.ColorMaterialProperty(Cesium.Color.fromCssColorString(mColor));
  34264. colorMaterial._param = {
  34265. color: mColor
  34266. };
  34267. return colorMaterial;
  34268. }
  34269. _materialPolylineArrowProperty(options2) {
  34270. let mColor = "rgba(0,255,0,1)";
  34271. if (options2 !== void 0 && options2.color !== void 0)
  34272. mColor = options2.color;
  34273. let colorMaterial = new Cesium.PolylineArrowMaterialProperty(Cesium.Color.fromCssColorString(mColor));
  34274. colorMaterial._param = {
  34275. color: mColor
  34276. };
  34277. return colorMaterial;
  34278. }
  34279. _materialPolylineGlowProperty(options2) {
  34280. let mColor = "rgba(0,255,0,1)";
  34281. if (options2 !== void 0 && options2.color !== void 0)
  34282. mColor = options2.color;
  34283. let power = 0.25;
  34284. if (options2 !== void 0 && options2.power !== void 0 && typeof options2.power === "number")
  34285. power = options2.power;
  34286. let colorMaterial = new Cesium.PolylineGlowMaterialProperty({
  34287. color: Cesium.Color.fromCssColorString(mColor),
  34288. glowPower: power
  34289. });
  34290. colorMaterial._param = {
  34291. color: mColor,
  34292. power
  34293. };
  34294. return colorMaterial;
  34295. }
  34296. _materialPolylineOutlineProperty(options2) {
  34297. let mColor = "rgba(0,255,0,1)";
  34298. let outlineColor = "rgba(255,255,255,1.0)";
  34299. let outlineWidth = 1.2;
  34300. if (options2 !== void 0 && options2.color !== void 0)
  34301. mColor = options2.color;
  34302. if (options2 !== void 0 && options2.outlineColor !== void 0)
  34303. outlineColor = options2.outlineColor;
  34304. if (options2 !== void 0 && options2.outlineWidth !== void 0 && typeof options2.outlineWidth === "number")
  34305. outlineWidth = options2.outlineWidth;
  34306. let colorMaterial = new Cesium.PolylineOutlineMaterialProperty({
  34307. color: Cesium.Color.fromCssColorString(mColor),
  34308. outlineColor: Cesium.Color.fromCssColorString(outlineColor),
  34309. outlineWidth
  34310. });
  34311. colorMaterial._param = {
  34312. color: mColor,
  34313. outlineColor,
  34314. outlineWidth
  34315. };
  34316. return colorMaterial;
  34317. }
  34318. _clear(isAll) {
  34319. if (isAll != void 0 && isAll === true) {
  34320. this._removeEntityByName(this._sketchEntityName);
  34321. this._removePointEntitys();
  34322. }
  34323. this._sketchTempPoints = [];
  34324. this._sketchPoints = [];
  34325. this._sketchOutputPoints = [];
  34326. this._sketchWallHeights = [];
  34327. this._drawEntity = void 0;
  34328. this._removeOperationDom();
  34329. this._tooltipRemove();
  34330. if (this._drawEventHandler !== null && this._drawEventHandler !== void 0 && this._drawEventHandler.isDestroyed() === false) {
  34331. this._clearEvent(this._drawEventHandler);
  34332. }
  34333. }
  34334. }
  34335. Object.assign(DrawTools.prototype, {
  34336. setLabel: function(options2) {
  34337. if (!options2) {
  34338. options2 = {
  34339. lineLabel: void 0,
  34340. polygonLabel: void 0
  34341. };
  34342. }
  34343. if (options2.lineLabel)
  34344. this._lineLabel = options2.lineLabel;
  34345. if (options2.polygonLabel)
  34346. this._lineLabel = options2.polygonLabel;
  34347. }
  34348. });
  34349. Object.assign(DrawTools.prototype, {
  34350. _registerLeftClickEvent: function(handler, callChange) {
  34351. let _self = this;
  34352. if (!handler)
  34353. return;
  34354. handler.setInputAction(function(event2) {
  34355. _self._lock = true;
  34356. clearTimeout(_self._timer);
  34357. _self._timer = setTimeout(function() {
  34358. if (callChange)
  34359. callChange(event2);
  34360. _self._lock = false;
  34361. }, 200);
  34362. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  34363. },
  34364. _registerLeftDoubleClickEvent: function(handler, callChange) {
  34365. let _self = this;
  34366. if (!handler)
  34367. return;
  34368. handler.setInputAction(function(event2) {
  34369. clearTimeout(_self._timer);
  34370. _self._lock = false;
  34371. if (callChange)
  34372. callChange(event2);
  34373. }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  34374. },
  34375. _registerMouseMoveEvent: function(handler, callChange) {
  34376. let _self = this;
  34377. if (!handler)
  34378. return;
  34379. handler.setInputAction(function(event2) {
  34380. if (_self._lock === void 0 || _self._lock === false) {
  34381. if (callChange)
  34382. callChange(event2);
  34383. }
  34384. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  34385. },
  34386. _registerRightClickEvent: function(handler, callChange) {
  34387. if (!handler)
  34388. return;
  34389. handler.setInputAction(function(event2) {
  34390. if (callChange)
  34391. callChange(event2);
  34392. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  34393. },
  34394. _registerLeftDownEvent: function(handler, callChange) {
  34395. if (!handler)
  34396. return;
  34397. handler.setInputAction(function(event2) {
  34398. if (callChange)
  34399. callChange(event2);
  34400. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  34401. },
  34402. _registerLeftUpEvent: function(handler, callChange) {
  34403. if (!handler)
  34404. return;
  34405. handler.setInputAction(function(event2) {
  34406. if (callChange)
  34407. callChange(event2);
  34408. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  34409. },
  34410. _clearEvent: function(handler) {
  34411. this._endTooltip();
  34412. this._removeOperationDom();
  34413. if (!handler)
  34414. return;
  34415. handler.destroy();
  34416. handler = null;
  34417. }
  34418. });
  34419. Object.assign(DrawTools.prototype, {
  34420. _createPolyline: function(polylineType) {
  34421. let _self = this;
  34422. let entityParam = DrawTools.initEditPropertyParams();
  34423. let polylineWidth = _self._param.lineWidth;
  34424. let polylineMaterial = this._materialColorProperty({
  34425. color: _self._param.lineColor
  34426. });
  34427. entityParam.id = DrawTools.DrawType.Polyline;
  34428. if (polylineType !== void 0 && polylineType === DrawTools.PolylineType.ArrowsPolyline) {
  34429. polylineMaterial = this._materialPolylineArrowProperty({
  34430. color: _self._param.lineColor
  34431. });
  34432. polylineWidth = _self._param.lineWidth * 3;
  34433. entityParam.color = _self._param.lineColor;
  34434. entityParam.id = DrawTools.DrawType.ArrowPolyline;
  34435. } else if (polylineType !== void 0 && polylineType === DrawTools.PolylineType.GrowPolyline) {
  34436. polylineMaterial = this._materialPolylineGlowProperty({
  34437. color: _self._param.lineColor,
  34438. power: _self._param.power
  34439. });
  34440. polylineWidth = _self._param.lineWidth * 3;
  34441. entityParam.color = _self._param.lineColor;
  34442. entityParam.power = _self._param.power;
  34443. entityParam.id = DrawTools.DrawType.GrowPolyline;
  34444. } else if (polylineType !== void 0 && polylineType === DrawTools.PolylineType.OutlinePolyline) {
  34445. polylineMaterial = this._materialPolylineOutlineProperty({
  34446. color: _self._param.lineColor,
  34447. outlineColor: _self._param.outlineColor,
  34448. outlineWidth: _self._param.outlineWidth
  34449. });
  34450. polylineWidth = _self._param.lineWidth * 2;
  34451. entityParam.color = _self._param.lineColor;
  34452. entityParam.outlineColor = _self._param.outlineColor;
  34453. entityParam.outlineWidth = _self._param.outlineWidth;
  34454. entityParam.id = DrawTools.DrawType.OutlinePolyline;
  34455. } else if (polylineType !== void 0 && polylineType === DrawTools.PolylineType.DynamicPolyline) {
  34456. polylineMaterial = new WallMaterialProperty({
  34457. viewer: _self._viewer,
  34458. trailImage: _self._image_h_l_r,
  34459. duration: _self._param.duration,
  34460. color: Cesium.Color.fromCssColorString(_self._param.lineColor),
  34461. param: {
  34462. direction: _self._param.direction_h,
  34463. count: _self._param.count,
  34464. order: _self._param.order_minus
  34465. }
  34466. });
  34467. polylineWidth = _self._param.lineWidth;
  34468. entityParam.color = _self._param.lineColor;
  34469. entityParam.duration = _self._param.duration;
  34470. entityParam.direction = _self._param.direction_h;
  34471. entityParam.count = _self._param.count;
  34472. entityParam.order = _self._param.order_minus;
  34473. entityParam.id = DrawTools.DrawType.DynamicPolyline;
  34474. }
  34475. entityParam.lineWidth = polylineWidth;
  34476. let entityPolyline = new Cesium.Entity({
  34477. name: _self._sketchEntityName,
  34478. polyline: {
  34479. show: true,
  34480. positions: new Cesium.CallbackProperty(function() {
  34481. return _self._sketchTempPoints;
  34482. }, false),
  34483. material: polylineMaterial,
  34484. width: polylineWidth,
  34485. clampToGround: true
  34486. }
  34487. });
  34488. this._drawEntity = this._entities.add(entityPolyline);
  34489. this._drawEntity.setParams(entityParam);
  34490. },
  34491. _updatePolyline: function(isEdit) {
  34492. this._drawEntity.polyline.positions = this._sketchPoints;
  34493. this._drawEntity.setEntityType(DrawTools.DrawType.Polyline);
  34494. if (isEdit != void 0 && isEdit === true) {
  34495. this._removePointEntitys();
  34496. this._setEntityIsEdit(this._drawEntity);
  34497. }
  34498. },
  34499. _createSpatialPolyline: function() {
  34500. let _self = this;
  34501. let entityParam = DrawTools.initEditPropertyParams();
  34502. let lineMaterial = this._materialColorProperty({
  34503. color: _self._param.lineColor
  34504. });
  34505. entityParam.id = DrawTools.DrawType.SpatialLine;
  34506. entityParam.color = _self._param.lineColor;
  34507. entityParam.lineWidth = _self._param.lineWidth;
  34508. let entity = new Cesium.Entity({
  34509. name: _self._sketchEntityName,
  34510. polyline: {
  34511. show: true,
  34512. positions: new Cesium.CallbackProperty(function() {
  34513. return _self._sketchTempPoints;
  34514. }, false),
  34515. material: lineMaterial,
  34516. width: _self._param.lineWidth,
  34517. clampToGround: false
  34518. }
  34519. });
  34520. this._drawEntity = this._entities.add(entity);
  34521. this._drawEntity.setParams(entityParam);
  34522. },
  34523. _updateSpatialPolyline: function(isEdit) {
  34524. this._drawEntity.polyline.positions = this._sketchPoints;
  34525. this._drawEntity.setEntityType(DrawTools.DrawType.SpatialLine);
  34526. if (isEdit != void 0 && isEdit === true) {
  34527. this._removePointEntitys();
  34528. this._setEntityIsEdit(this._drawEntity);
  34529. }
  34530. },
  34531. _createPolygon: function(polygonType) {
  34532. let _self = this;
  34533. let entityParam = DrawTools.initEditPropertyParams();
  34534. let polygonMaterial = this._materialColorProperty({
  34535. color: _self._param.polygonColor
  34536. });
  34537. let lineMaterial = this._materialColorProperty({
  34538. color: _self._param.outlineColor
  34539. });
  34540. let entityPolygon = new Cesium.Entity({
  34541. name: _self._sketchEntityName,
  34542. polygon: {
  34543. show: true,
  34544. hierarchy: new Cesium.CallbackProperty(function() {
  34545. return {
  34546. positions: _self._sketchTempPoints
  34547. };
  34548. }, false),
  34549. material: polygonMaterial,
  34550. classificationType: Cesium.ClassificationType.BOTH
  34551. },
  34552. polyline: {
  34553. show: true,
  34554. positions: new Cesium.CallbackProperty(function() {
  34555. return _self._sketchTempPoints;
  34556. }, false),
  34557. material: lineMaterial,
  34558. width: _self._param.outlineWidth,
  34559. clampToGround: true
  34560. }
  34561. });
  34562. entityParam.color = _self._param.polygonColor;
  34563. entityParam.outlineColor = _self._param.outlineColor;
  34564. entityParam.outlineWidth = _self._param.outlineWidth;
  34565. this._drawEntity = this._entities.add(entityPolygon);
  34566. if (polygonType !== void 0 && polygonType === DrawTools.PolygonType.NormalPolygon) {
  34567. this._drawEntity.setEntityType(DrawTools.DrawType.Polygon);
  34568. entityParam.id = DrawTools.DrawType.Polygon;
  34569. } else if (polygonType !== void 0 && polygonType === DrawTools.PolygonType.HousePolygon) {
  34570. this._drawEntity.setEntityType(DrawTools.DrawType.House);
  34571. entityParam.id = DrawTools.DrawType.House;
  34572. }
  34573. this._drawEntity.setParams(entityParam);
  34574. },
  34575. _updatePolygon: function(isEdit) {
  34576. let _self = this;
  34577. let houseMaterial = this._materialColorProperty({
  34578. color: _self._param.houseColor
  34579. });
  34580. let entityType = this._drawEntity.getEntityType();
  34581. if (entityType === DrawTools.DrawType.Polygon) {
  34582. this._drawEntity.polygon.hierarchy = {
  34583. positions: _self._sketchPoints
  34584. };
  34585. this._drawEntity.polyline.positions = this._sketchPoints;
  34586. } else if (entityType === DrawTools.DrawType.House) {
  34587. let entityParam = this._drawEntity.getParams();
  34588. this._removeEntityByObject(this._drawEntity);
  34589. let height2 = parseFloat(this._sketchOutputPoints[0].height);
  34590. let houseHeight = height2 + parseInt(_self._param.wallHeight);
  34591. let houseEntity = new Cesium.Entity({
  34592. name: _self._sketchEntityName,
  34593. polygon: {
  34594. show: true,
  34595. hierarchy: {
  34596. positions: _self._sketchPoints
  34597. },
  34598. extrudedHeight: houseHeight,
  34599. material: houseMaterial
  34600. }
  34601. });
  34602. this._drawEntity = this._entities.add(houseEntity);
  34603. this._drawEntity.setEntityType(entityType);
  34604. entityParam.height = _self._param.wallHeight;
  34605. entityParam.bottomHeight = height2;
  34606. entityParam.color = _self._param.houseColor;
  34607. this._drawEntity.setParams(entityParam);
  34608. }
  34609. if (isEdit != void 0 && isEdit === true) {
  34610. this._removePointEntitys();
  34611. this._setEntityIsEdit(this._drawEntity);
  34612. }
  34613. },
  34614. _createRectangle: function() {
  34615. let _self = this;
  34616. let entityParam = DrawTools.initEditPropertyParams();
  34617. let rectMaterial = this._materialColorProperty({
  34618. color: _self._param.polygonColor
  34619. });
  34620. let lineMaterial = this._materialColorProperty({
  34621. color: _self._param.outlineColor
  34622. });
  34623. let entityRectangle = new Cesium.Entity({
  34624. name: _self._sketchEntityName,
  34625. polyline: {
  34626. show: true,
  34627. positions: new Cesium.CallbackProperty(
  34628. _self._callUpdateRectangleOutlineCoordinates(),
  34629. false
  34630. ),
  34631. material: lineMaterial,
  34632. width: _self._param.outlineWidth,
  34633. clampToGround: true
  34634. },
  34635. rectangle: {
  34636. show: true,
  34637. coordinates: new Cesium.CallbackProperty(
  34638. _self._callUpdateRectangleCoordinates(
  34639. _self._sketchTempPoints
  34640. ),
  34641. false
  34642. ),
  34643. material: rectMaterial,
  34644. classificationType: Cesium.ClassificationType.BOTH
  34645. }
  34646. });
  34647. entityParam.id = DrawTools.DrawType.Rectangle;
  34648. entityParam.color = _self._param.polygonColor;
  34649. entityParam.outlineColor = _self._param.outlineColor;
  34650. entityParam.outlineWidth = _self._param.outlineWidth;
  34651. this._drawEntity = this._entities.add(entityRectangle);
  34652. this._drawEntity.setParams(entityParam);
  34653. },
  34654. _updateRectangle(isEdit) {
  34655. this._drawEntity.polyline.positions = this._rectangleOutlineCoordinates;
  34656. let coordinates = this._rectangleCoordinates;
  34657. this._drawEntity.rectangle.coordinates = Cesium.Rectangle.fromDegrees(coordinates[0], coordinates[1], coordinates[2], coordinates[3]);
  34658. this._drawEntity.setEntityType(DrawTools.DrawType.Rectangle);
  34659. if (isEdit != void 0 && isEdit === true) {
  34660. this._setEntityIsEdit(this._drawEntity);
  34661. }
  34662. },
  34663. _createCircle: function(centerPosition, circleType) {
  34664. let _self = this;
  34665. let entityParam = DrawTools.initEditPropertyParams();
  34666. let circleMaterial = this._materialColorProperty({
  34667. color: _self._param.polygonColor
  34668. });
  34669. let lineMaterial = this._materialColorProperty({
  34670. color: _self._param.outlineColor
  34671. });
  34672. if (circleType != void 0 && circleType === DrawTools.CircleType.DynamicCircle) {
  34673. circleMaterial = new CircleMaterialProperty({
  34674. viewer: _self._viewer,
  34675. duration: _self._param.duration,
  34676. color: Cesium.Color.fromCssColorString(_self._param.polygonColor),
  34677. count: _self._param.count
  34678. });
  34679. }
  34680. this._sketchEllipseCenterPosition = centerPosition.clone();
  34681. let entityCircle = new Cesium.Entity({
  34682. name: _self._sketchEntityName,
  34683. position: centerPosition,
  34684. ellipse: {
  34685. show: true,
  34686. semiMinorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(
  34687. _self._sketchTempPoints
  34688. ), false),
  34689. semiMajorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(
  34690. _self._sketchTempPoints
  34691. ), false),
  34692. material: circleMaterial,
  34693. classificationType: Cesium.ClassificationType.BOTH
  34694. }
  34695. });
  34696. if (circleType === void 0 || circleType === DrawTools.CircleType.ColorCircle) {
  34697. entityCircle.polyline = {
  34698. show: true,
  34699. positions: new Cesium.CallbackProperty(_self._callEllipseOutlineCoordinate(
  34700. _self._sketchTempPoints
  34701. ), false),
  34702. material: lineMaterial,
  34703. width: _self._param.outlineWidth,
  34704. clampToGround: true
  34705. };
  34706. }
  34707. this._drawEntity = this._entities.add(entityCircle);
  34708. if (circleType === void 0 || circleType === DrawTools.CircleType.ColorCircle) {
  34709. this._drawEntity.setEntityType(DrawTools.DrawType.Circle);
  34710. entityParam.id = DrawTools.DrawType.Circle;
  34711. entityParam.color = _self._param.polygonColor;
  34712. entityParam.outlineColor = _self._param.outlineColor;
  34713. entityParam.outlineWidth = _self._param.outlineWidth;
  34714. } else if (circleType != void 0 && circleType === DrawTools.CircleType.DynamicCircle) {
  34715. this._drawEntity.setEntityType(DrawTools.DrawType.DynamicCircle);
  34716. entityParam.id = DrawTools.DrawType.DynamicCircle;
  34717. entityParam.color = _self._param.polygonColor;
  34718. entityParam.duration = _self._param.duration;
  34719. entityParam.count = _self._param.count;
  34720. }
  34721. this._drawEntity.setParams(entityParam);
  34722. },
  34723. _updateCircle(isEdit) {
  34724. this._drawEntity.position = this._sketchEllipseCenterPosition;
  34725. let center2 = this._sketchTempPoints.first();
  34726. let outpoint = this._sketchTempPoints.last();
  34727. this._ellipseOutlineCoordinates = this._calculateEllipseOutlineCoordinate(center2, outpoint);
  34728. this._sketchEllipseRadius = this._calculateEllipseMinorAxis(center2, outpoint);
  34729. if (this._drawEntity.polyline != void 0) {
  34730. this._drawEntity.polyline.positions = this._ellipseOutlineCoordinates;
  34731. }
  34732. this._drawEntity.ellipse.semiMajorAxis = this._sketchEllipseRadius;
  34733. this._drawEntity.ellipse.semiMinorAxis = this._sketchEllipseRadius;
  34734. if (isEdit != void 0 && isEdit === true) {
  34735. this._setEntityIsEdit(this._drawEntity);
  34736. }
  34737. },
  34738. _createWall: function(wallType) {
  34739. let _self = this;
  34740. let entityParam = DrawTools.initEditPropertyParams();
  34741. let wallMaterial = this._materialColorProperty({
  34742. color: _self._param.polygonColor
  34743. });
  34744. entityParam.color = _self._param.polygonColor;
  34745. if (wallType !== void 0 && wallType === DrawTools.WallType.TextWall) {
  34746. wallMaterial = this._materialTextImageProperty({
  34747. color: _self._param.polygonColor,
  34748. text: _self._param.text
  34749. });
  34750. entityParam.text = _self._param.text;
  34751. entityParam.color = _self._param.polygonColor;
  34752. } else if (wallType !== void 0 && wallType === DrawTools.WallType.DynamicWall) {
  34753. wallMaterial = new WallMaterialProperty({
  34754. viewer: _self._viewer,
  34755. trailImage: _self._image_v_t_b,
  34756. duration: _self._param.duration,
  34757. color: Cesium.Color.fromCssColorString(_self._param.polygonColor),
  34758. param: {
  34759. count: _self._param.count,
  34760. direction: _self._param.direction_v,
  34761. order: _self._param.order_minus
  34762. }
  34763. });
  34764. entityParam.color = _self._param.polygonColor;
  34765. entityParam.duration = _self._param.duration;
  34766. entityParam.direction = _self._param.direction_v;
  34767. entityParam.count = _self._param.count;
  34768. entityParam.order = _self._param.order_minus;
  34769. }
  34770. let normalWall = new Cesium.Entity({
  34771. name: _self._sketchEntityName,
  34772. wall: {
  34773. show: true,
  34774. positions: new Cesium.CallbackProperty(function() {
  34775. return _self._sketchTempPoints;
  34776. }, false),
  34777. minimumHeights: new Cesium.CallbackProperty(function() {
  34778. return _self._sketchWallHeights;
  34779. }, false),
  34780. maximumHeights: new Cesium.CallbackProperty(function() {
  34781. _self._sketchWallMaxHeights = [];
  34782. for (let i2 = 0; i2 < _self._sketchWallHeights.length; i2++) {
  34783. _self._sketchWallMaxHeights.push(_self._sketchWallHeights[i2] + _self._param.wallHeight);
  34784. }
  34785. return _self._sketchWallMaxHeights;
  34786. }, false),
  34787. material: wallMaterial
  34788. }
  34789. });
  34790. this._drawEntity = this._entities.add(normalWall);
  34791. entityParam.height = this._param.wallHeight;
  34792. if (wallType === void 0 || wallType === DrawTools.WallType.ColorWall) {
  34793. this._drawEntity.setEntityType(DrawTools.DrawType.NormalWall);
  34794. entityParam.id = DrawTools.DrawType.NormalWall;
  34795. } else if (wallType !== void 0 && wallType === DrawTools.WallType.DynamicWall) {
  34796. this._drawEntity.setEntityType(DrawTools.DrawType.DynamicWall);
  34797. entityParam.id = DrawTools.DrawType.DynamicWall;
  34798. } else if (wallType !== void 0 && wallType === DrawTools.WallType.TextWall) {
  34799. this._drawEntity.setEntityType(DrawTools.DrawType.TextWall);
  34800. entityParam.id = DrawTools.DrawType.TextWall;
  34801. }
  34802. this._drawEntity.setParams(entityParam);
  34803. },
  34804. _updateWall: function(isEdit) {
  34805. let hLength = this._sketchWallHeights.length;
  34806. let mhLength = this._sketchWallMaxHeights.length;
  34807. let pLength = this._sketchPoints.length;
  34808. if (hLength === mhLength && hLength - pLength === 1) {
  34809. this._sketchWallHeights.pop();
  34810. this._sketchWallMaxHeights.pop();
  34811. this._drawEntity.wall.positions = this._sketchPoints;
  34812. this._drawEntity.wall.minimumHeights = this._sketchWallHeights;
  34813. this._drawEntity.wall.maximumHeights = this._sketchWallMaxHeights;
  34814. if (isEdit != void 0 && isEdit === true) {
  34815. this._removePointEntitys();
  34816. this._setEntityIsEdit(this._drawEntity);
  34817. }
  34818. } else {
  34819. this._console(hLength, mhLength, pLength);
  34820. }
  34821. },
  34822. _createVideoWall: function() {
  34823. let _self = this;
  34824. let entityWall = new Cesium.Entity({
  34825. name: _self._sketchEntityName,
  34826. position: _self._sketchOutputPoints[0],
  34827. wall: {
  34828. show: true,
  34829. positions: new Cesium.CallbackProperty(function() {
  34830. let pt0 = _self._sketchOutputPoints[0];
  34831. let pt1 = _self._sketchOutputPoints[1];
  34832. _self._wallPositions = [];
  34833. _self._wallPositions.push(Cesium.Cartesian3.fromDegrees(
  34834. pt0.lng,
  34835. pt0.lat,
  34836. pt0.height
  34837. ));
  34838. _self._wallPositions.push(Cesium.Cartesian3.fromDegrees(
  34839. pt1.lng,
  34840. pt1.lat,
  34841. pt0.height
  34842. ));
  34843. return _self._wallPositions;
  34844. }, false),
  34845. maximumHeights: new Cesium.CallbackProperty(function() {
  34846. _self._sketchWallHeights = [];
  34847. let pt2 = _self._sketchOutputPoints[0];
  34848. _self._sketchWallHeights.push(pt2.height);
  34849. _self._sketchWallHeights.push(pt2.height);
  34850. return _self._sketchWallHeights;
  34851. }, false),
  34852. minimumHeights: new Cesium.CallbackProperty(function() {
  34853. _self._sketchWallMaxHeights = [];
  34854. let pt2 = _self._sketchOutputPoints[1];
  34855. _self._sketchWallMaxHeights.push(pt2.height);
  34856. _self._sketchWallMaxHeights.push(pt2.height);
  34857. return _self._sketchWallMaxHeights;
  34858. }, false),
  34859. material: Cesium.Color.fromCssColorString(_self._param.polygonColor),
  34860. outline: true,
  34861. outlineColor: Cesium.Color.fromCssColorString(_self._param.outlineColor),
  34862. outlineWidth: _self._param.outlineWidth
  34863. }
  34864. });
  34865. _self._drawEntity = _self._entities.add(entityWall);
  34866. },
  34867. _updateVideoWall: function(isEdit) {
  34868. let entityParam = DrawTools.initEditPropertyParams();
  34869. entityParam.id = DrawTools.DrawType.VideoWall;
  34870. let videoElement = document.getElementById("wallVideo");
  34871. if (videoElement !== null) {
  34872. document.body.removeChild(videoElement);
  34873. }
  34874. videoElement = document.createElement("video");
  34875. videoElement.id = "wallVideo";
  34876. videoElement.setAttribute("crossorigin", "anonymous");
  34877. videoElement.setAttribute("width", "1024px");
  34878. videoElement.setAttribute("height", "256px");
  34879. videoElement.setAttribute("controls", "controls");
  34880. videoElement.setAttribute(
  34881. "src",
  34882. "https://lf3-cdn-tos.bytescm.com/obj/eden-cn/lmeh7pfuho/campus/campus_intro_20200522.mp4"
  34883. );
  34884. videoElement.setAttribute("loop", "loop");
  34885. videoElement.play();
  34886. document.body.appendChild(videoElement);
  34887. this._drawEntity.wall.positions = this._wallPositions;
  34888. this._drawEntity.wall.minimumHeights = this._sketchWallHeights;
  34889. this._drawEntity.wall.maximumHeights = this._sketchWallMaxHeights;
  34890. entityParam.height = this._sketchWallMaxHeights[0] - this._sketchWallHeights[0];
  34891. this._drawEntity.wall.material = videoElement;
  34892. this._removePointEntitys();
  34893. this._drawEntity.setEntityType(DrawTools.DrawType.VideoWall);
  34894. entityParam.videoUrl = "https://lf3-cdn-tos.bytescm.com/obj/eden-cn/lmeh7pfuho/campus/campus_intro_20200522.mp4";
  34895. entityParam.id = DrawTools.DrawType.VideoWall;
  34896. this._drawEntity.setParams(entityParam);
  34897. if (isEdit != void 0 && isEdit === true) {
  34898. this._setEntityIsEdit(this._drawEntity);
  34899. }
  34900. },
  34901. _calculateOdlinePositios: function(strPoint, endPoint, height2, count) {
  34902. let pt1 = this._cartesian3ToGeo(strPoint);
  34903. let pt2 = this._cartesian3ToGeo(endPoint);
  34904. var h2 = height2 && height2 < 1e3 ? height2 : 1e3;
  34905. var L = Math.abs(pt1.longitude - pt2.longitude) > Math.abs(pt1.latitude - pt2.latitude) ? Math.abs(pt1.longitude - pt2.longitude) : Math.abs(pt1.latitude - pt2.latitude);
  34906. var num = count && count > 50 ? count : 50;
  34907. var result = [];
  34908. var tempResult = [];
  34909. var dlt = L / num;
  34910. var addHeight = pt1.height > pt2.height ? pt1.height : pt2.height;
  34911. var maxHeight = addHeight + h2;
  34912. var minHeight1 = pt1.height;
  34913. var minHeight2 = pt2.height;
  34914. if (Math.abs(pt1.longitude - pt2.longitude) > Math.abs(pt1.latitude - pt2.latitude)) {
  34915. var delLat = (pt2.latitude - pt1.latitude) / num;
  34916. if (pt1.longitude - pt2.longitude > 0) {
  34917. dlt = -dlt;
  34918. }
  34919. for (var i2 = 1; i2 < num; i2++) {
  34920. var tempH = h2 - Math.pow(-0.5 * L + Math.abs(dlt) * i2, 2) * 4 * h2 / Math.pow(L, 2);
  34921. var lon = pt1.longitude + dlt * i2;
  34922. var lat = pt1.latitude + delLat * i2;
  34923. var alt = void 0;
  34924. if (Math.abs(dlt) * i2 == 0.5 * L) {
  34925. alt = maxHeight;
  34926. } else if (Math.abs(dlt) * i2 < 0.5 * L) {
  34927. alt = (maxHeight - minHeight1) / h2 * tempH + minHeight1;
  34928. } else {
  34929. alt = (maxHeight - minHeight2) / h2 * tempH + minHeight2;
  34930. }
  34931. tempResult.push([lon, lat, alt]);
  34932. }
  34933. } else {
  34934. var delLon = (pt2.longitude - pt1.longitude) / num;
  34935. if (pt1.latitude - pt2.latitude > 0) {
  34936. dlt = -dlt;
  34937. }
  34938. for (var i2 = 1; i2 < num; i2++) {
  34939. var tempH = h2 - Math.pow(-0.5 * L + Math.abs(dlt) * i2, 2) * 4 * h2 / Math.pow(L, 2);
  34940. var lon = pt1.longitude + delLon * i2;
  34941. var lat = pt1.latitude + dlt * i2;
  34942. var alt = void 0;
  34943. if (Math.abs(dlt) * i2 == 0.5 * L) {
  34944. alt = maxHeight;
  34945. } else if (Math.abs(dlt) * i2 < 0.5 * L) {
  34946. alt = (maxHeight - minHeight1) / h2 * tempH + minHeight1;
  34947. } else {
  34948. alt = (maxHeight - minHeight2) / h2 * tempH + minHeight2;
  34949. }
  34950. tempResult.push([lon, lat, alt]);
  34951. }
  34952. }
  34953. result.push([pt1.longitude, pt1.latitude, pt1.height]);
  34954. for (var i2 = 0; i2 < tempResult.length; i2++) {
  34955. result.push(tempResult[i2]);
  34956. }
  34957. result.push([pt2.longitude, pt2.latitude, pt2.height]);
  34958. let results = [];
  34959. for (let i3 = 0; i3 < result.length; i3++) {
  34960. results.push(Cesium.Cartesian3.fromDegrees(result[i3][0], result[i3][1], result[i3][2]));
  34961. }
  34962. return results;
  34963. },
  34964. _createOdline: function(isFirst) {
  34965. let _self = this;
  34966. if (isFirst !== void 0 && isFirst === true) {
  34967. let fatherEntity = new Cesium.Entity({
  34968. name: this._sketchEntityName
  34969. });
  34970. this._odlineFatherEntity = this._entities.add(fatherEntity);
  34971. let entityParam = DrawTools.initEditPropertyParams();
  34972. entityParam.id = DrawTools.DrawType.OdLine;
  34973. entityParam.color = _self._param.polygonColor;
  34974. entityParam.duration = _self._param.duration;
  34975. entityParam.direction = _self._param.direction_h;
  34976. entityParam.count = _self._param.count;
  34977. entityParam.order = _self._param.order_add;
  34978. entityParam.odlineHeight = _self._param.odlineHeight;
  34979. entityParam.odlineCount = _self._param.odlineCount;
  34980. entityParam.lineWidth = _self._param.lineWidth * 3;
  34981. this._odlineFatherEntity.setParams(entityParam);
  34982. this._odlineEntitys = [];
  34983. }
  34984. let faterParam = this._odlineFatherEntity.getParams();
  34985. let odLineMaterial = new WallMaterialProperty({
  34986. viewer: _self._viewer,
  34987. trailImage: _self._image_arrow_reverse,
  34988. duration: faterParam.duration,
  34989. color: Cesium.Color.fromCssColorString(faterParam.color),
  34990. param: {
  34991. direction: faterParam.direction,
  34992. count: faterParam.count,
  34993. order: faterParam.order
  34994. }
  34995. });
  34996. let entity = new Cesium.Entity({
  34997. name: _self._sketchEntityName,
  34998. parent: this._odlineFatherEntity,
  34999. polyline: {
  35000. show: true,
  35001. positions: new Cesium.CallbackProperty(function() {
  35002. let center2 = _self._sketchTempPoints[0];
  35003. let endPoint = _self._sketchTempPoints[_self._sketchTempPoints.length - 1];
  35004. let results = _self._calculateOdlinePositios(
  35005. center2,
  35006. endPoint,
  35007. parseInt(
  35008. faterParam.odlineHeight
  35009. ),
  35010. parseInt(faterParam.odlineCount)
  35011. );
  35012. return results;
  35013. }, false),
  35014. material: odLineMaterial,
  35015. width: faterParam.lineWidth,
  35016. clampToGround: false
  35017. }
  35018. });
  35019. this._drawEntity = this._entities.add(entity);
  35020. },
  35021. _updateOdline: function(isLast, isEdit) {
  35022. if (isLast !== void 0 && isLast === true) {
  35023. if (isEdit !== void 0 && isEdit === true) {
  35024. this._drawEntity.setEntityType(DrawTools.DrawType.OdLine);
  35025. this._setEntityIsEdit(this._drawEntity);
  35026. this._drawEntity.parent.setIsEdit(true);
  35027. }
  35028. } else {
  35029. let params = this._drawEntity.parent.getParams();
  35030. let center2 = this._sketchTempPoints[0];
  35031. let endPoint = this._sketchTempPoints[this._sketchTempPoints.length - 1];
  35032. let results = this._calculateOdlinePositios(
  35033. center2,
  35034. endPoint,
  35035. parseInt(params.odlineHeight),
  35036. parseInt(params.odlineCount)
  35037. );
  35038. this._drawEntity.polyline.positions = results;
  35039. this._drawEntity.setEntityType(DrawTools.DrawType.OdLine);
  35040. this._odlineEntitys.push(this._drawEntity);
  35041. if (isEdit !== void 0 && isEdit === true) {
  35042. this._drawEntity.setIsEdit(true);
  35043. }
  35044. }
  35045. },
  35046. _guid() {
  35047. function S4() {
  35048. return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
  35049. }
  35050. return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
  35051. },
  35052. _console(...rest) {
  35053. console.log("===>>>", rest);
  35054. }
  35055. });
  35056. Object.assign(DrawTools.prototype, {
  35057. _drawMovingDoubleTooltip(position2) {
  35058. this._updateTooltip("\u5DE6\u952E\u5355\u51FB\u7ED8\u5236,\u53F3\u952E\u5355\u51FB\u64A4\u9500<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236", position2);
  35059. },
  35060. _drawMovingSimpleTooltip(position2) {
  35061. this._updateTooltip("\u5DE6\u952E\u5355\u51FB\u7ED3\u675F\u7ED8\u5236", position2);
  35062. },
  35063. _removeLastDrawPointEntity() {
  35064. let lastPointEntity = this._pointEntitys.last();
  35065. if (lastPointEntity !== void 0) {
  35066. this._removeEntityByObject(lastPointEntity);
  35067. this._pointEntitys.pop();
  35068. }
  35069. },
  35070. _sketchDrawPoint(handler, options2) {
  35071. let _self = this;
  35072. this._registerLeftClickEvent(handler, function(event2) {
  35073. let scene = _self._viewer.scene;
  35074. if (scene.mode !== Cesium.SceneMode.MORPHING) {
  35075. var pickedObject = scene.pick(event2.position);
  35076. if (scene.pickPositionSupported && Cesium.defined(pickedObject)) {
  35077. var cartesian = scene.pickPosition(event2.position);
  35078. if (Cesium.defined(cartesian)) {
  35079. var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  35080. var lng = Cesium.Math.toDegrees(cartographic.longitude);
  35081. var lat = Cesium.Math.toDegrees(cartographic.latitude);
  35082. var height2 = cartographic.height;
  35083. _self._sketchOutputPoints.push({
  35084. lng,
  35085. lat,
  35086. height: height2
  35087. });
  35088. }
  35089. _self._createPoint(cartesian, "\u70B9");
  35090. _self._sketchPoints.push(cartesian.clone());
  35091. if (_self._sketchPoints.length >= 2) {
  35092. _self._createVideoWall();
  35093. _self._clearEvent(handler);
  35094. }
  35095. }
  35096. }
  35097. if (options2.onComplete)
  35098. options2.onComplete(loc.sLocation, loc.gLocation);
  35099. });
  35100. },
  35101. _sketchDrawMultiplePoint(handler, options2) {
  35102. let _self = this;
  35103. this._registerLeftClickEvent(handler, function(event2) {
  35104. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35105. if (!Cesium.defined(loc2.sLocation))
  35106. return;
  35107. if (_self._isDrawPoint) {
  35108. _self._createPoint(loc2.sLocation, _self._lineLabel);
  35109. }
  35110. _self._sketchPoints.push(loc2.sLocation);
  35111. _self._sketchOutputPoints.push(loc2.gLocation);
  35112. if (options2.onAdded)
  35113. options2.onAdded(loc2.sLocation, loc2.gLocation);
  35114. });
  35115. this._registerRightClickEvent(handler, function(event2) {
  35116. if (_self._sketchPoints.length > 0) {
  35117. _self._sketchPoints.pop();
  35118. _self._sketchOutputPoints.pop();
  35119. if (options2.onUndo)
  35120. options2.onUndo();
  35121. }
  35122. });
  35123. this._registerLeftDoubleClickEvent(handler, function(event2) {
  35124. _self._clearEvent(handler);
  35125. if (options2.onComplete)
  35126. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  35127. });
  35128. },
  35129. _sketchDrawPolyline(handler, options2) {
  35130. let _self = this;
  35131. this._registerLeftClickEvent(handler, function(event2) {
  35132. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35133. if (!Cesium.defined(loc2.sLocation))
  35134. return;
  35135. if (_self._isDrawPoint) {
  35136. _self._createPoint(loc2.sLocation, _self._lineLabel);
  35137. }
  35138. if (_self._sketchTempPoints.length === 0) {
  35139. _self._createPolyline(options2.polylineType);
  35140. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35141. }
  35142. _self._sketchTempPoints.push(loc2.sLocation);
  35143. _self._sketchPoints.push(loc2.sLocation.clone());
  35144. _self._sketchOutputPoints.push(loc2.gLocation);
  35145. if (options2.onAdded)
  35146. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  35147. _self._createOperationDom();
  35148. });
  35149. this._registerMouseMoveEvent(handler, function(event2) {
  35150. if (_self._isRuntimeApp())
  35151. return;
  35152. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35153. if (!Cesium.defined(loc2.sLocation))
  35154. return;
  35155. if (_self._sketchTempPoints.length > 1) {
  35156. _self._drawMovingDoubleTooltip(event2.endPosition);
  35157. _self._sketchTempPoints.pop();
  35158. _self._sketchTempPoints.push(loc2.sLocation);
  35159. if (options2.onMoving)
  35160. options2.onMoving(loc2.sLocation);
  35161. }
  35162. });
  35163. this._registerRightClickEvent(handler, function(event2) {
  35164. if (_self._sketchTempPoints.length > 2) {
  35165. _self._drawByUndo();
  35166. if (options2.onUndo)
  35167. options2.onUndo();
  35168. }
  35169. });
  35170. this._registerLeftDoubleClickEvent(handler, function(event2) {
  35171. if (_self._sketchPoints.length < 2) {
  35172. if (options2.onError)
  35173. options2.onError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  35174. return;
  35175. }
  35176. _self._updatePolyline(options2.isEdit);
  35177. if (!_self._isRetainDrawPoint)
  35178. _self._removePointEntitys();
  35179. _self._clearEvent(handler);
  35180. if (options2.onComplete)
  35181. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  35182. });
  35183. },
  35184. _sketchDrawSpatialPolyline(handler, options2) {
  35185. let _self = this;
  35186. this._registerLeftClickEvent(handler, function(event2) {
  35187. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35188. if (!Cesium.defined(loc2.sLocation))
  35189. return;
  35190. if (_self._isDrawPoint) {
  35191. _self._createPoint(loc2.sLocation, _self._lineLabel);
  35192. }
  35193. if (_self._sketchTempPoints.length === 0) {
  35194. _self._createSpatialPolyline();
  35195. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35196. }
  35197. _self._sketchTempPoints.push(loc2.sLocation);
  35198. _self._sketchPoints.push(loc2.sLocation.clone());
  35199. _self._sketchOutputPoints.push(loc2.gLocation);
  35200. if (options2.onAdded)
  35201. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  35202. _self._createOperationDom();
  35203. });
  35204. this._registerMouseMoveEvent(handler, function(event2) {
  35205. if (_self._isRuntimeApp())
  35206. return;
  35207. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35208. if (!Cesium.defined(loc2.sLocation))
  35209. return;
  35210. if (_self._sketchTempPoints.length > 1) {
  35211. _self._drawMovingDoubleTooltip(event2.endPosition);
  35212. _self._sketchTempPoints.pop();
  35213. _self._sketchTempPoints.push(loc2.sLocation);
  35214. if (options2.onMoving)
  35215. options2.onMoving(loc2.sLocation);
  35216. }
  35217. });
  35218. this._registerLeftDoubleClickEvent(handler, function(event2) {
  35219. if (_self._sketchPoints.length < 2) {
  35220. if (options2.onError)
  35221. options2.onError("\u7ED8\u5236\u70B9\u5C11\u4E8E2\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  35222. return;
  35223. }
  35224. _self._updateSpatialPolyline(options2.isEdit);
  35225. _self._removePointEntitys();
  35226. _self._clearEvent(handler);
  35227. if (options2.onComplete)
  35228. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  35229. });
  35230. this._registerRightClickEvent(handler, function(event2) {
  35231. if (_self._sketchTempPoints.length > 2) {
  35232. _self._drawByUndo();
  35233. if (options2.onUndo)
  35234. options2.onUndo();
  35235. }
  35236. });
  35237. },
  35238. _sketchDrawOdline(handler, options2) {
  35239. let _self = this;
  35240. this._registerLeftClickEvent(handler, function(event2) {
  35241. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35242. if (!Cesium.defined(loc2.sLocation))
  35243. return;
  35244. if (_self._isDrawPoint) {
  35245. _self._createPoint(loc2.sLocation, _self._lineLabel);
  35246. }
  35247. if (_self._isRuntimeApp()) {
  35248. _self._showTooltipMessage("\u518D\u6B21\u5355\u51FB\u7ED8\u5236\u4E00\u6761OD\u7EBF\uFF01");
  35249. }
  35250. if (_self._sketchTempPoints.length === 0) {
  35251. _self._createOdline(true);
  35252. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35253. } else {
  35254. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35255. _self._updateOdline(false, options2.isEdit);
  35256. _self._createOdline();
  35257. }
  35258. _self._sketchTempPoints.push(loc2.sLocation);
  35259. _self._sketchPoints.push(loc2.sLocation.clone());
  35260. _self._sketchOutputPoints.push(loc2.gLocation);
  35261. if (options2.onAdded)
  35262. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  35263. _self._createOperationDom();
  35264. });
  35265. this._registerMouseMoveEvent(handler, function(event2) {
  35266. if (_self._isRuntimeApp())
  35267. return;
  35268. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35269. if (!Cesium.defined(loc2.sLocation))
  35270. return;
  35271. if (_self._sketchTempPoints.length > 1) {
  35272. _self._drawMovingDoubleTooltip(event2.endPosition);
  35273. _self._sketchTempPoints.pop();
  35274. _self._sketchTempPoints.push(loc2.sLocation);
  35275. if (options2.onMoving)
  35276. options2.onMoving(loc2.sLocation);
  35277. }
  35278. });
  35279. this._registerLeftDoubleClickEvent(handler, function(event2) {
  35280. _self._removeEntityByObject(_self._drawEntity);
  35281. _self._updateOdline(true, options2.isEdit);
  35282. _self._removePointEntitys();
  35283. _self._clearEvent(handler);
  35284. if (options2.onComplete)
  35285. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  35286. });
  35287. this._registerRightClickEvent(handler, function(event2) {
  35288. if (_self._odlineEntitys.length > 0) {
  35289. if (_self._isDrawPoint) {
  35290. _self._removeLastDrawPointEntity();
  35291. }
  35292. _self._removeEntityByObject(_self._odlineEntitys.last());
  35293. _self._odlineEntitys.pop();
  35294. if (options2.onUndo)
  35295. options2.onUndo();
  35296. }
  35297. });
  35298. },
  35299. _sketchDrawPolygon(handler, options2) {
  35300. let _self = this;
  35301. this._registerLeftClickEvent(handler, function(event2) {
  35302. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35303. if (!Cesium.defined(loc2.sLocation))
  35304. return;
  35305. if (_self._isDrawPoint) {
  35306. _self._createPoint(loc2.sLocation, _self._lineLabel);
  35307. }
  35308. if (_self._sketchTempPoints.length === 0) {
  35309. _self._createPolygon(options2.polygonType);
  35310. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35311. }
  35312. _self._sketchTempPoints.push(loc2.sLocation);
  35313. _self._sketchPoints.push(loc2.sLocation.clone());
  35314. _self._sketchOutputPoints.push(loc2.gLocation);
  35315. if (options2.onAdded)
  35316. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  35317. _self._createOperationDom();
  35318. });
  35319. this._registerMouseMoveEvent(handler, function(event2) {
  35320. if (_self._isRuntimeApp())
  35321. return;
  35322. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35323. if (!Cesium.defined(loc2.sLocation))
  35324. return;
  35325. if (_self._sketchTempPoints.length > 1) {
  35326. _self._drawMovingDoubleTooltip(event2.endPosition);
  35327. _self._sketchTempPoints.pop();
  35328. _self._sketchTempPoints.push(loc2.sLocation);
  35329. if (options2.onMoving)
  35330. options2.onMoving(loc2.sLocation);
  35331. }
  35332. });
  35333. this._registerRightClickEvent(handler, function(event2) {
  35334. if (_self._sketchTempPoints.length > 2) {
  35335. _self._drawByUndo();
  35336. if (options2.onUndo)
  35337. options2.onUndo();
  35338. }
  35339. });
  35340. this._registerLeftDoubleClickEvent(handler, function(event2) {
  35341. if (_self._sketchPoints.length < 3) {
  35342. if (options2.onError)
  35343. options2.onError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  35344. return;
  35345. }
  35346. _self._updatePolygon(options2.isEdit);
  35347. if (!_self._isRetainDrawPoint)
  35348. _self._removePointEntitys();
  35349. _self._clearEvent(handler);
  35350. if (options2.onComplete)
  35351. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  35352. });
  35353. },
  35354. _sketchDrawCircle: function(handler, options2) {
  35355. let _self = this;
  35356. this._registerLeftClickEvent(handler, function(event2) {
  35357. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35358. if (!Cesium.defined(loc2.sLocation))
  35359. return;
  35360. if (_self._sketchTempPoints.length === 0) {
  35361. if (_self._isDrawPoint) {
  35362. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  35363. }
  35364. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35365. _self._sketchTempPoints.push(loc2.sLocation);
  35366. _self._sketchPoints.push(loc2.sLocation.clone());
  35367. _self._sketchOutputPoints.push(loc2.gLocation);
  35368. _self._createCircle(loc2.sLocation, options2.circleType);
  35369. if (_self._isRuntimeApp()) {
  35370. _self._showTooltipMessage("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u7ED8\u5236\uFF01");
  35371. }
  35372. if (options2.onAdded)
  35373. options2.onAdded(loc2.sLocation);
  35374. } else {
  35375. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35376. _self._removePointEntitys();
  35377. _self._updateCircle(options2.isEdit);
  35378. _self._clearEvent(handler);
  35379. if (options2.onComplete)
  35380. options2.onComplete(_self._sketchOutputPoints[0], _self._sketchEllipseRadius);
  35381. }
  35382. });
  35383. this._registerMouseMoveEvent(handler, function(event2) {
  35384. if (_self._isRuntimeApp()) {
  35385. return;
  35386. }
  35387. if (_self._sketchTempPoints.length <= 0)
  35388. return;
  35389. _self._drawMovingSimpleTooltip(event2.endPosition);
  35390. var cartesian = _self._viewer.scene.pickPosition(event2.endPosition);
  35391. if (cartesian == void 0)
  35392. return;
  35393. _self._sketchTempPoints.pop();
  35394. _self._sketchTempPoints.push(cartesian);
  35395. });
  35396. },
  35397. _sketchDrawRectangle: function(handler, options2) {
  35398. let _self = this;
  35399. this._registerLeftClickEvent(handler, function(event2) {
  35400. if (_self._sketchTempPoints.length === 0) {
  35401. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35402. if (!Cesium.defined(loc2.sLocation))
  35403. return;
  35404. if (_self._isDrawPoint) {
  35405. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  35406. }
  35407. _self._sketchTempPoints.push(loc2.sLocation);
  35408. _self._sketchTempPoints.push(loc2.sLocation);
  35409. _self._sketchPoints.push(loc2.gLocation);
  35410. _self._createRectangle();
  35411. if (options2.onAdded)
  35412. options2.onAdded(loc2.sLocation);
  35413. if (_self._isRuntimeApp()) {
  35414. _self._showTooltipMessage("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u7ED8\u5236\uFF01");
  35415. }
  35416. } else {
  35417. _self._removePointEntitys();
  35418. _self._removeEntityByObject(_self._sketchTempRectangle);
  35419. _self._updateRectangle(options2.isEdit);
  35420. _self._clearEvent(handler);
  35421. if (options2.onComplete)
  35422. options2.onComplete(_self._sketchOutputPoints);
  35423. }
  35424. });
  35425. this._registerMouseMoveEvent(handler, function(event2) {
  35426. if (_self._sketchTempPoints.length < 1)
  35427. return;
  35428. _self._drawMovingSimpleTooltip(event2.endPosition);
  35429. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35430. if (!Cesium.defined(loc2.sLocation))
  35431. return;
  35432. _self._sketchTempPoints.pop();
  35433. _self._sketchTempPoints.push(loc2.sLocation);
  35434. });
  35435. },
  35436. _sketchDrawWall: function(handler, options2) {
  35437. let _self = this;
  35438. this._registerLeftClickEvent(handler, function(event2) {
  35439. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35440. if (!Cesium.defined(loc2.sLocation))
  35441. return;
  35442. if (_self._isDrawPoint) {
  35443. _self._createPoint(loc2.sLocation, _self._lineLabel);
  35444. }
  35445. if (_self._sketchTempPoints.length === 0) {
  35446. _self._createWall(options2.wallType);
  35447. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35448. _self._sketchWallHeights.push(loc2.gLocation.height);
  35449. }
  35450. _self._sketchTempPoints.push(loc2.sLocation);
  35451. _self._sketchWallHeights.push(loc2.gLocation.height);
  35452. _self._sketchPoints.push(loc2.sLocation.clone());
  35453. _self._createOperationDom();
  35454. });
  35455. this._registerMouseMoveEvent(handler, function(event2) {
  35456. if (_self._isRuntimeApp()) {
  35457. return;
  35458. }
  35459. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35460. if (!Cesium.defined(loc2.sLocation))
  35461. return;
  35462. if (_self._sketchTempPoints.length > 1) {
  35463. _self._drawMovingDoubleTooltip(event2.endPosition);
  35464. _self._sketchTempPoints.pop();
  35465. _self._sketchTempPoints.push(loc2.sLocation);
  35466. _self._sketchWallHeights.pop();
  35467. _self._sketchWallHeights.push(loc2.gLocation.height);
  35468. }
  35469. });
  35470. this._registerRightClickEvent(handler, function(event2) {
  35471. if (_self._sketchTempPoints.length > 2) {
  35472. _self._sketchPoints.pop();
  35473. if (_self._isRuntimeApp()) {
  35474. _self._sketchTempPoints.splice(_self._sketchTempPoints.length - 1, 1);
  35475. _self._sketchWallHeights.splice(_self._sketchWallHeights.length - 1, 1);
  35476. } else {
  35477. _self._sketchTempPoints.splice(_self._sketchTempPoints.length - 2, 1);
  35478. _self._sketchWallHeights.splice(_self._sketchWallHeights.length - 2, 1);
  35479. }
  35480. if (_self._isDrawPoint) {
  35481. _self._removeLastDrawPointEntity();
  35482. }
  35483. }
  35484. });
  35485. this._registerLeftDoubleClickEvent(handler, function(event2) {
  35486. if (_self._sketchPoints.length < 2) {
  35487. if (options2.onError)
  35488. options2.onError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  35489. return;
  35490. }
  35491. _self._updateWall(options2.isEdit);
  35492. if (!_self._isRetainDrawPoint)
  35493. _self._removePointEntitys();
  35494. _self._clearEvent(handler);
  35495. });
  35496. },
  35497. _sketchDrawVideoWall: function(handler, options2) {
  35498. let _self = this;
  35499. this._registerLeftClickEvent(handler, function(event2) {
  35500. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35501. if (!Cesium.defined(loc2.sLocation))
  35502. return;
  35503. if (_self._isDrawPoint) {
  35504. _self._createPoint(loc2.sLocation, _self._lineLabel);
  35505. }
  35506. if (_self._sketchOutputPoints.length === 0) {
  35507. _self._sketchOutputPoints.push(loc2.gLocation);
  35508. _self._sketchOutputPoints.push(loc2.gLocation);
  35509. _self._createVideoWall();
  35510. if (_self._isRuntimeApp()) {
  35511. _self._showTooltipMessage("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u7ED8\u5236");
  35512. }
  35513. } else {
  35514. _self._updateVideoWall(options2.isEdit);
  35515. _self._clearEvent(handler);
  35516. }
  35517. });
  35518. this._registerMouseMoveEvent(handler, function(event2) {
  35519. if (_self._isRuntimeApp())
  35520. return;
  35521. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35522. if (!Cesium.defined(loc2.sLocation))
  35523. return;
  35524. if (_self._sketchOutputPoints.length > 1) {
  35525. _self._drawMovingSimpleTooltip(event2.endPosition);
  35526. _self._sketchOutputPoints.pop();
  35527. _self._sketchOutputPoints.push(loc2.gLocation);
  35528. }
  35529. });
  35530. },
  35531. _drawByUndo: function() {
  35532. this._sketchPoints.pop();
  35533. if (this._isRuntimeApp()) {
  35534. this._sketchTempPoints.splice(this._sketchTempPoints.length - 1, 1);
  35535. } else {
  35536. this._sketchTempPoints.splice(this._sketchTempPoints.length - 2, 1);
  35537. }
  35538. if (this._isDrawPoint) {
  35539. this._removeLastDrawPointEntity();
  35540. }
  35541. },
  35542. draw: function(type2, options2) {
  35543. let _self = this;
  35544. this._clear();
  35545. this._drawEventHandler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  35546. if (this._isRuntimeApp()) {
  35547. this._showTooltipMessage("\u5355\u51FB\u7ED8\u5236");
  35548. } else {
  35549. this._beginTooltip("\u5DE6\u952E\u5355\u51FB\u7ED8\u5236", void 0);
  35550. }
  35551. this._drawType = type2;
  35552. switch (type2) {
  35553. case DrawTools.DrawType.Point:
  35554. _self._sketchDrawPoint(_self._drawEventHandler, options2);
  35555. break;
  35556. case DrawTools.DrawType.Polyline:
  35557. options2.polylineType = DrawTools.PolylineType.NormalPolyline;
  35558. _self._sketchDrawPolyline(_self._drawEventHandler, options2);
  35559. break;
  35560. case DrawTools.DrawType.ArrowPolyline:
  35561. options2.polylineType = DrawTools.PolylineType.ArrowsPolyline;
  35562. _self._sketchDrawPolyline(_self._drawEventHandler, options2);
  35563. break;
  35564. case DrawTools.DrawType.DynamicPolyline:
  35565. options2.polylineType = DrawTools.PolylineType.DynamicPolyline;
  35566. _self._sketchDrawPolyline(_self._drawEventHandler, options2);
  35567. break;
  35568. case DrawTools.DrawType.GrowPolyline:
  35569. options2.polylineType = DrawTools.PolylineType.GrowPolyline;
  35570. _self._sketchDrawPolyline(_self._drawEventHandler, options2);
  35571. break;
  35572. case DrawTools.DrawType.OutlinePolyline:
  35573. options2.polylineType = DrawTools.PolylineType.OutlinePolyline;
  35574. _self._sketchDrawPolyline(_self._drawEventHandler, options2);
  35575. break;
  35576. case DrawTools.DrawType.Polygon:
  35577. options2.polygonType = DrawTools.PolygonType.NormalPolygon;
  35578. _self._sketchDrawPolygon(_self._drawEventHandler, options2);
  35579. break;
  35580. case DrawTools.DrawType.SpatialLine:
  35581. _self._sketchDrawSpatialPolyline(_self._drawEventHandler, options2);
  35582. break;
  35583. case DrawTools.DrawType.Circle:
  35584. options2.circleType = DrawTools.CircleType.ColorCircle;
  35585. _self._sketchDrawCircle(_self._drawEventHandler, options2);
  35586. break;
  35587. case DrawTools.DrawType.Rectangle:
  35588. _self._sketchDrawRectangle(_self._drawEventHandler, options2);
  35589. break;
  35590. case DrawTools.DrawType.NormalWall:
  35591. options2.wallType = DrawTools.WallType.ColorWall;
  35592. _self._sketchDrawWall(_self._drawEventHandler, options2);
  35593. break;
  35594. case DrawTools.DrawType.DynamicWall:
  35595. options2.wallType = DrawTools.WallType.DynamicWall;
  35596. _self._sketchDrawWall(_self._drawEventHandler, options2);
  35597. break;
  35598. case DrawTools.DrawType.TextWall:
  35599. options2.wallType = DrawTools.WallType.TextWall;
  35600. _self._sketchDrawWall(_self._drawEventHandler, options2);
  35601. break;
  35602. case DrawTools.DrawType.DynamicCircle:
  35603. options2.circleType = DrawTools.CircleType.DynamicCircle;
  35604. _self._sketchDrawCircle(_self._drawEventHandler, options2);
  35605. break;
  35606. case DrawTools.DrawType.House:
  35607. options2.polygonType = DrawTools.PolygonType.HousePolygon;
  35608. _self._sketchDrawPolygon(_self._drawEventHandler, options2);
  35609. break;
  35610. case DrawTools.DrawType.VideoWall:
  35611. _self._sketchDrawVideoWall(_self._drawEventHandler, options2);
  35612. break;
  35613. case DrawTools.DrawType.OdLine:
  35614. _self._sketchDrawOdline(_self._drawEventHandler, options2);
  35615. break;
  35616. }
  35617. },
  35618. Clear: function() {
  35619. this._clear(true);
  35620. this._unActivateEdit();
  35621. this._closePropertyEditDialog();
  35622. this._removeOperationDom();
  35623. },
  35624. sketchInit: function() {
  35625. this._clear(false);
  35626. },
  35627. _checkAppOrWeb() {
  35628. if (window.navigator.userAgent.match(
  35629. /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
  35630. )) {
  35631. return DrawTools.RuntimeEnvironment.App;
  35632. } else {
  35633. return DrawTools.RuntimeEnvironment.Web;
  35634. }
  35635. },
  35636. _isRuntimeApp() {
  35637. if (this._checkAppOrWeb() === DrawTools.RuntimeEnvironment.App) {
  35638. return true;
  35639. }
  35640. return false;
  35641. }
  35642. });
  35643. Object.assign(DrawTools.prototype, {
  35644. _tooltipInit: function(text, mousePosition) {
  35645. let _self = this;
  35646. this._tooltipId = "tooltipSketchmodel";
  35647. let tooltipObj = document.getElementById(this._tooltipId);
  35648. if (tooltipObj === null) {
  35649. tooltipObj = document.createElement("div");
  35650. tooltipObj.id = this._tooltipId;
  35651. document.body.appendChild(tooltipObj);
  35652. let divStyle = "";
  35653. divStyle += "top: 30px;";
  35654. divStyle += "left: 30px;";
  35655. divStyle += "position: absolute;";
  35656. divStyle += "display: flex;";
  35657. divStyle += "align-items: center;";
  35658. divStyle += "width: 12x0px;";
  35659. divStyle += "height: auto;";
  35660. divStyle += "background-color: rgba(0, 0, 0, 0.65);";
  35661. divStyle += "border-radius: 5px;";
  35662. divStyle += "color: rgb(255, 255, 255);";
  35663. divStyle += "font-size: 12px;";
  35664. divStyle += "font-family: 'Alimama_ShuHeiTi_Bold';";
  35665. divStyle += "padding: 8px;";
  35666. divStyle += "border:solid 1px rgb(255,0,0);";
  35667. tooltipObj.setAttribute("style", divStyle);
  35668. }
  35669. if (text != void 0)
  35670. tooltipObj.innerHTML = text;
  35671. if (mousePosition === void 0) {
  35672. document.onmousemove = function(event2) {
  35673. if (event2.clientX < 100 || event2.clientX > _self._canvasWidth - 100 || event2.clientY < 100 || event2.clientY > _self._canvasHeight - 100) {
  35674. tooltipObj.style.display = "none";
  35675. } else {
  35676. tooltipObj.style.display = "flex";
  35677. tooltipObj.style.left = event2.clientX + 10 + "px";
  35678. tooltipObj.style.top = event2.clientY - tooltipObj.offsetHeight / 2 + "px";
  35679. }
  35680. };
  35681. } else {
  35682. if (mousePosition.x < 100 || mousePosition.x > _self._canvasWidth - 100 || mousePosition.y < 100 || mousePosition.y > _self._canvasHeight - 100) {
  35683. tooltipObj.style.display = "none";
  35684. } else {
  35685. tooltipObj.style.display = "flex";
  35686. tooltipObj.style.left = mousePosition.x + 10 + "px";
  35687. tooltipObj.style.top = mousePosition.y - tooltipObj.offsetHeight / 2 + "px";
  35688. }
  35689. }
  35690. },
  35691. _tooltipRemove: function() {
  35692. let tooltipObj = document.getElementById(this._tooltipId);
  35693. if (tooltipObj != null) {
  35694. document.body.removeChild(tooltipObj);
  35695. }
  35696. },
  35697. _tooltipSetText: function(text, mousePosition) {
  35698. let tooltipObj = document.getElementById(this._tooltipId);
  35699. if (tooltipObj != null) {
  35700. if (text != void 0)
  35701. tooltipObj.innerHTML = text;
  35702. if (mousePosition != void 0) {
  35703. if (mousePosition.x < 100 || mousePosition.x > this._canvasWidth - 100 || mousePosition.y < 100 || mousePosition.y > this._canvasHeight - 100) {
  35704. tooltipObj.style.display = "none";
  35705. } else {
  35706. tooltipObj.style.display = "flex";
  35707. tooltipObj.style.left = mousePosition.x + 10 + "px";
  35708. tooltipObj.style.top = mousePosition.y - tooltipObj.offsetHeight / 2 + "px";
  35709. }
  35710. }
  35711. }
  35712. },
  35713. _setMousePointerStyle: function() {
  35714. document.querySelector("body").style.cursor = "crosshair";
  35715. },
  35716. _setMouseDefaultStyle: function() {
  35717. document.querySelector("body").style.cursor = "default";
  35718. },
  35719. _beginTooltip(text, position2) {
  35720. this._tooltipInit(text, position2);
  35721. this._setMousePointerStyle();
  35722. },
  35723. _updateTooltip(text, position2) {
  35724. this._tooltipSetText(text, position2);
  35725. },
  35726. _endTooltip() {
  35727. this._tooltipRemove();
  35728. this._setMouseDefaultStyle();
  35729. },
  35730. _showTooltipMessage: function(message) {
  35731. let msgMainDom = document.getElementById("messageMainDom");
  35732. if (msgMainDom !== null && msgMainDom !== void 0) {
  35733. document.body.removeChild(msgMainDom);
  35734. }
  35735. msgMainDom = document.createElement("div");
  35736. msgMainDom.style.width = "30%";
  35737. msgMainDom.style.backgroundColor = "rgba(237, 248, 230, 1.0)";
  35738. msgMainDom.style.height = "45px";
  35739. msgMainDom.style.border = "solid 2px rgb(219, 241, 208)";
  35740. msgMainDom.style.borderRadius = "8px";
  35741. msgMainDom.style.display = "flex";
  35742. msgMainDom.style.alignItems = "center";
  35743. msgMainDom.style.paddingLeft = "10px";
  35744. msgMainDom.style.color = "rgb(91, 188, 48)";
  35745. msgMainDom.style.fontSize = "14px";
  35746. msgMainDom.style.fontWeight = "600";
  35747. msgMainDom.style.position = "absolute";
  35748. msgMainDom.style.left = "35%";
  35749. msgMainDom.style.transition = "transform 1s";
  35750. msgMainDom.style.transform = "translateY(-90px)";
  35751. msgMainDom.style.top = "0px";
  35752. msgMainDom.style.zIndex = 1e3;
  35753. document.body.appendChild(msgMainDom);
  35754. let strHtml = "";
  35755. strHtml += "<div style='";
  35756. strHtml += "background-color: rgb(88, 185, 45);";
  35757. strHtml += "color: rgb(255, 255, 255);";
  35758. strHtml += "height: 24px;";
  35759. strHtml += "width: 24px;";
  35760. strHtml += "border-radius: 20px;";
  35761. strHtml += "display: flex;";
  35762. strHtml += "justify-content: center;";
  35763. strHtml += "align-items: center;";
  35764. strHtml += "font-size: 14px;";
  35765. strHtml += "margin-right: 18px;";
  35766. strHtml += "'>&#10003</div>";
  35767. strHtml += "<div>" + message + "</div>";
  35768. msgMainDom.innerHTML = strHtml;
  35769. msgMainDom.addEventListener("transitionend", function() {
  35770. setTimeout(function() {
  35771. document.body.removeChild(msgMainDom);
  35772. }, 1e3);
  35773. }, false);
  35774. setTimeout(function() {
  35775. msgMainDom.style.transform = "translateY(50px)";
  35776. }, 100);
  35777. }
  35778. });
  35779. Object.assign(DrawTools.prototype, {
  35780. _createSingleCoordinateAxisArrow(positions, color2, axisEntityId) {
  35781. let _self = this;
  35782. let coordinateAxisEntity = new Cesium.Entity({
  35783. id: axisEntityId,
  35784. name: _self._coordinateAxisEntityName,
  35785. position: positions[0],
  35786. polyline: {
  35787. positions,
  35788. width: 10,
  35789. material: _self._materialPolylineArrowProperty({
  35790. color: color2
  35791. })
  35792. }
  35793. });
  35794. coordinateAxisEntity.setEditType({
  35795. type: DrawTools.EditPointType.CoordinateAxis
  35796. });
  35797. return this._entities.add(coordinateAxisEntity);
  35798. },
  35799. _getTranslatePostion: function(originPosition, translateCartesian) {
  35800. let transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(originPosition);
  35801. let m = new Cesium.Matrix4();
  35802. Cesium.Matrix4.setTranslation(
  35803. Cesium.Matrix4.IDENTITY,
  35804. translateCartesian,
  35805. m
  35806. );
  35807. let modelMatrix = Cesium.Matrix4.multiply(transform3, m, transform3);
  35808. let outPosition = new Cesium.Cartesian3(0, 0, 0);
  35809. Cesium.Matrix4.getTranslation(modelMatrix, outPosition);
  35810. return outPosition;
  35811. },
  35812. _createCoordinateAxis: function(position2) {
  35813. this._showTooltipMessage("\u5355\u51FB\u53F3\u952E\u79FB\u9664\u8C03\u6574\u8F74\u7EBF\uFF01");
  35814. this._removeCoorinateAxis();
  35815. let _self = this;
  35816. let cameraRight = this._viewer.scene.camera.rightWC;
  35817. this._tx = cameraRight.x > 0 ? 150 : -150;
  35818. this._ty = cameraRight.y > 0 ? 150 : -150;
  35819. this._tz = 150;
  35820. this._coordinateAxisEntityId_x = "coordinateAxisId_x";
  35821. this._coordinateAxisEntityId_y = "coordinateAxisId_y";
  35822. this._coordinateAxisEntityId_z = "coordinateAxisId_z";
  35823. this._coordinateAxisEntityName = "coordinateAxisEntity";
  35824. let translateCartesian = new Cesium.Cartesian3(this._tx, 0, 0);
  35825. let endPosition = this._getTranslatePostion(position2, translateCartesian);
  35826. const xPos = [position2, endPosition];
  35827. this._coordinateEntity_x = this._createSingleCoordinateAxisArrow(xPos, "rgba(0,255,0,1.0)", this._coordinateAxisEntityId_x);
  35828. this._coordinateAxisBindEntity(this._coordinateEntity_x);
  35829. translateCartesian = new Cesium.Cartesian3(0, this._ty, 0);
  35830. endPosition = this._getTranslatePostion(position2, translateCartesian);
  35831. const yPos = [position2, endPosition];
  35832. this._coordinateEntity_y = this._createSingleCoordinateAxisArrow(yPos, "rgba(0,0,255,1.0)", this._coordinateAxisEntityId_y);
  35833. this._coordinateAxisBindEntity(this._coordinateEntity_y);
  35834. translateCartesian = new Cesium.Cartesian3(0, 0, this._tz);
  35835. endPosition = this._getTranslatePostion(position2, translateCartesian);
  35836. const zPos = [position2, endPosition];
  35837. this._coordinateEntity_z = this._createSingleCoordinateAxisArrow(zPos, "rgba(255,0,0,1.0)", this._coordinateAxisEntityId_z);
  35838. this._coordinateAxisBindEntity(this._coordinateEntity_z);
  35839. this._eventCoorinateAxis = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  35840. this._registerLeftDownEvent(this._eventCoorinateAxis, function(event2) {
  35841. _self._coorinateAxisMouseDown(event2);
  35842. });
  35843. this._registerMouseMoveEvent(this._eventCoorinateAxis, function(event2) {
  35844. _self._coorinateAxisMouseMove(event2);
  35845. });
  35846. this._registerLeftUpEvent(this._eventCoorinateAxis, function(event2) {
  35847. _self._coorinateAxisMouseUp(event2);
  35848. });
  35849. this._registerRightClickEvent(this._eventCoorinateAxis, function(event2) {
  35850. _self._removeCoorinateAxis();
  35851. });
  35852. },
  35853. _coordinateAxisBindEntity: function(axisEntity) {
  35854. if (this._editEntity === void 0)
  35855. return;
  35856. let editEntityType = this._editEntity.getEntityType();
  35857. if (editEntityType === void 0)
  35858. return;
  35859. if (editEntityType === DrawTools.DrawType.VideoWall) {
  35860. axisEntity.bindEntity(this._editEntity);
  35861. }
  35862. },
  35863. _coorinateAxisMouseDown: function(event2) {
  35864. let _self = this;
  35865. let feature2 = this._viewer.scene.pick(event2.position);
  35866. if (feature2 === void 0)
  35867. return;
  35868. if (feature2.id != void 0 && feature2.id instanceof Cesium.Entity) {
  35869. this._viewer.scene.screenSpaceCameraController.enableRotate = false;
  35870. if (feature2.id.getEditType() === void 0)
  35871. return;
  35872. let entityType = feature2.id.getEditType().type;
  35873. if (entityType !== DrawTools.EditPointType.CoordinateAxis)
  35874. return;
  35875. this._editCoorinateAxis = feature2.id;
  35876. this._editCoorinateAxis.polyline.width = 15;
  35877. this._coordinateAxisMoveStartPosition = this._viewer.scene.camera.pickEllipsoid(
  35878. event2.position,
  35879. this._viewer.scene.globe.ellipsoid
  35880. );
  35881. this._coordinateAxisMoveStartScreen = event2.position;
  35882. this._coorinateAxisPosition = this._editCoorinateAxis.position._value;
  35883. this._coordinateEntity_x.polyline.positions = new Cesium.CallbackProperty(function() {
  35884. let translateCartesian = new Cesium.Cartesian3(_self._tx, 0, 0);
  35885. let endPosition = _self._getTranslatePostion(
  35886. _self._coorinateAxisPosition,
  35887. translateCartesian
  35888. );
  35889. return [_self._coorinateAxisPosition, endPosition];
  35890. }, false);
  35891. this._coordinateEntity_y.polyline.positions = new Cesium.CallbackProperty(function() {
  35892. let translateCartesian = new Cesium.Cartesian3(0, _self._ty, 0);
  35893. let endPosition = _self._getTranslatePostion(
  35894. _self._coorinateAxisPosition,
  35895. translateCartesian
  35896. );
  35897. return [_self._coorinateAxisPosition, endPosition];
  35898. }, false);
  35899. this._coordinateEntity_z.polyline.positions = new Cesium.CallbackProperty(function() {
  35900. let translateCartesian = new Cesium.Cartesian3(0, 0, _self._tz);
  35901. let endPosition = _self._getTranslatePostion(
  35902. _self._coorinateAxisPosition,
  35903. translateCartesian
  35904. );
  35905. return [_self._coorinateAxisPosition, endPosition];
  35906. }, false);
  35907. this._coordinateAxisActivateEditEntity(this._editCoorinateAxis);
  35908. }
  35909. },
  35910. _coorinateAxisMouseMove: function(event2) {
  35911. if (!Cesium.defined(this._editCoorinateAxis))
  35912. return;
  35913. let position2 = this._viewer.scene.camera.pickEllipsoid(
  35914. event2.endPosition,
  35915. this._viewer.scene.globe.ellipsoid
  35916. );
  35917. if (!position2)
  35918. return;
  35919. let strGeo = this._cartesian3ToGeo(this._coordinateAxisMoveStartPosition);
  35920. let endGeo = this._cartesian3ToGeo(position2);
  35921. let entityId = this._editCoorinateAxis.id;
  35922. let entityPosition = this._editCoorinateAxis.position._value;
  35923. let entityGeo = this._cartesian3ToGeo(entityPosition);
  35924. let heightDifference = 0;
  35925. if (entityId === this._coordinateAxisEntityId_x) {
  35926. let difference = strGeo.longitude - endGeo.longitude;
  35927. entityGeo.longitude = entityGeo.longitude - difference;
  35928. } else if (entityId === this._coordinateAxisEntityId_y) {
  35929. let difference = strGeo.latitude - endGeo.latitude;
  35930. entityGeo.latitude = entityGeo.latitude - difference;
  35931. } else if (entityId === this._coordinateAxisEntityId_z) {
  35932. heightDifference = event2.endPosition.y - this._coordinateAxisMoveStartScreen.y;
  35933. heightDifference = heightDifference * 0.5;
  35934. entityGeo.height = entityGeo.height - heightDifference;
  35935. }
  35936. this._coorinateAxisPosition = Cesium.Cartesian3.fromDegrees(entityGeo.longitude, entityGeo.latitude, entityGeo.height);
  35937. this._moveEditEntityByCoordinateAxis(entityPosition, this._coorinateAxisPosition, heightDifference);
  35938. },
  35939. _coorinateAxisMouseUp: function(event2) {
  35940. this._viewer.scene.screenSpaceCameraController.enableRotate = true;
  35941. if (this._editCoorinateAxis !== void 0) {
  35942. this._editCoorinateAxis.polyline.width = 10;
  35943. let translateCartesian = new Cesium.Cartesian3(this._tx, 0, 0);
  35944. let endPosition = this._getTranslatePostion(this._coorinateAxisPosition, translateCartesian);
  35945. this._coordinateEntity_x.polyline.positions = [this._coorinateAxisPosition, endPosition];
  35946. translateCartesian = new Cesium.Cartesian3(0, this._ty, 0);
  35947. endPosition = this._getTranslatePostion(this._coorinateAxisPosition, translateCartesian);
  35948. this._coordinateEntity_y.polyline.positions = [this._coorinateAxisPosition, endPosition];
  35949. translateCartesian = new Cesium.Cartesian3(0, 0, this._tz);
  35950. endPosition = this._getTranslatePostion(this._coorinateAxisPosition, translateCartesian);
  35951. this._coordinateEntity_z.polyline.positions = [this._coorinateAxisPosition, endPosition];
  35952. this._coordinateEntity_x.position = this._coorinateAxisPosition;
  35953. this._coordinateEntity_y.position = this._coorinateAxisPosition;
  35954. this._coordinateEntity_z.position = this._coorinateAxisPosition;
  35955. this._coordinateAxisUpdateEditEntity(this._editCoorinateAxis);
  35956. this._editCoorinateAxis = void 0;
  35957. }
  35958. },
  35959. _moveEditEntityByCoordinateAxis: function(strPosition, endPosition, heightDifference) {
  35960. let movePosition = Cesium.Cartesian3.subtract(endPosition, strPosition, new Cesium.Cartesian3());
  35961. for (let i2 = 0; i2 < this._moveInitPositions.length; i2++) {
  35962. let moveResult = Cesium.Cartesian3.add(this._moveInitPositions[i2], movePosition, new Cesium.Cartesian3());
  35963. this._moveUpdatePositions[i2] = moveResult.clone();
  35964. }
  35965. for (let i2 = 0; i2 < this._moveInitHeights.length; i2++) {
  35966. this._moveUpdateHeights[i2] = parseFloat(this._moveInitHeights[i2]) + heightDifference * -1;
  35967. }
  35968. },
  35969. _coordinateAxisActivateEditEntity: function(moveAxisEntity) {
  35970. let _self = this;
  35971. let bindEntity = moveAxisEntity.getBindEntity();
  35972. if (bindEntity === void 0)
  35973. return;
  35974. let bindEntityType = bindEntity.getEntityType();
  35975. if (bindEntityType === DrawTools.DrawType.VideoWall) {
  35976. let wall = bindEntity.wall;
  35977. this._moveInitPositions = wall.positions._value;
  35978. this._moveInitHeights = wall.minimumHeights._value;
  35979. this._moveInitHeight = wall.maximumHeights._value[0] - wall.minimumHeights._value[0];
  35980. this._moveUpdatePositions = [];
  35981. for (let i2 = 0; i2 < this._moveInitPositions.length; i2++) {
  35982. this._moveUpdatePositions.push(this._moveInitPositions[i2].clone());
  35983. }
  35984. wall.positions = new Cesium.CallbackProperty(function() {
  35985. return _self._moveUpdatePositions;
  35986. }, false);
  35987. this._moveUpdateHeights = [];
  35988. for (let i2 = 0; i2 < this._moveInitHeights.length; i2++) {
  35989. this._moveUpdateHeights.push(this._moveInitHeights[i2]);
  35990. }
  35991. wall.minimumHeights = new Cesium.CallbackProperty(function() {
  35992. return _self._moveUpdateHeights;
  35993. }, false);
  35994. wall.maximumHeights = new Cesium.CallbackProperty(function() {
  35995. let maxHeights = [];
  35996. for (let i2 = 0; i2 < _self._moveUpdateHeights.length; i2++) {
  35997. maxHeights.push(parseFloat(_self._moveUpdateHeights[i2]) + _self._moveInitHeight);
  35998. }
  35999. return maxHeights;
  36000. }, false);
  36001. }
  36002. },
  36003. _coordinateAxisUpdateEditEntity: function(moveAxisEntity) {
  36004. let bindEntity = moveAxisEntity.getBindEntity();
  36005. if (bindEntity === void 0)
  36006. return;
  36007. let bindEntityType = bindEntity.getEntityType();
  36008. if (bindEntityType === DrawTools.DrawType.VideoWall) {
  36009. let wall = bindEntity.wall;
  36010. wall.positions = this._moveUpdatePositions;
  36011. wall.minimumHeights = this._moveUpdateHeights;
  36012. let maxHeights = [];
  36013. for (let i2 = 0; i2 < this._moveUpdateHeights.length; i2++) {
  36014. maxHeights.push(parseFloat(this._moveUpdateHeights[i2]) + this._moveInitHeight);
  36015. }
  36016. wall.maximumHeights = maxHeights;
  36017. }
  36018. },
  36019. _coordinateCalculateEntityOrientation: function(entity, options2) {
  36020. let position2 = entity.position._value;
  36021. let orientation = entity.orientation === void 0 ? new Cesium.Cartesian3(0, 0, 0) : entity.orientation._value;
  36022. let transform3 = Cesium.Matrix4.fromTranslationQuaternionRotationScale(
  36023. position2,
  36024. orientation,
  36025. new Cesium.Cartesian3(1, 1, 1),
  36026. new Cesium.Matrix4()
  36027. );
  36028. let _rotateX = Cesium.Matrix3.fromRotationX(Cesium.Math.toRadians(options2.x));
  36029. let _rotateY = Cesium.Matrix3.fromRotationX(Cesium.Math.toRadians(options2.y));
  36030. let _rotateZ = Cesium.Matrix3.fromRotationX(Cesium.Math.toRadians(options2.z));
  36031. transform3 = Cesium.Matrix4.multiplyByMatrix3(transform3, _rotateX, transform3);
  36032. transform3 = Cesium.Matrix4.multiplyByMatrix3(transform3, _rotateY, transform3);
  36033. transform3 = Cesium.Matrix4.multiplyByMatrix3(transform3, _rotateZ, transform3);
  36034. let m3 = Cesium.Matrix4.getRotation(transform3, new Cesium.Matrix3());
  36035. let resOrientation = new Cesium.Quaternion();
  36036. Cesium.Quaternion.fromRotationMatrix(m3, resOrientation);
  36037. return resOrientation;
  36038. },
  36039. _removeCoorinateAxis: function() {
  36040. if (this._coordinateAxisEntityName !== void 0) {
  36041. this._removeEntityByName(this._coordinateAxisEntityName);
  36042. }
  36043. if (this._eventCoorinateAxis !== void 0) {
  36044. this._clearEvent(this._eventCoorinateAxis);
  36045. this._eventCoorinateAxis = void 0;
  36046. }
  36047. }
  36048. });
  36049. Object.assign(DrawTools.prototype, {
  36050. _setEntityIsEdit(entity) {
  36051. let _self = this;
  36052. entity.setIsEdit(true);
  36053. this._unActivateEdit();
  36054. this._sendShowPropertyDialog(entity);
  36055. let handler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  36056. this._registerLeftClickEvent(handler, function(event2) {
  36057. _self._unActivateEdit();
  36058. let feature2 = _self._viewer.scene.pick(event2.position);
  36059. if (feature2 !== void 0 && feature2.id instanceof Cesium.Entity) {
  36060. let featureType = feature2.id.getEditType();
  36061. let entityType = feature2.id.getEntityType();
  36062. if (featureType === DrawTools.EditPointType.Node || featureType === DrawTools.EditPointType.Middle || featureType === DrawTools.EditPointType.Center || featureType === DrawTools.EditPointType.CoordinateAxis || featureType === DrawTools.EditPointType.OdlineStrartNode || featureType === DrawTools.EditPointType.OdlineEndNode || entityType === DrawTools.DrawType.Polyline || entityType === DrawTools.DrawType.ArrowPolyline || entityType === DrawTools.DrawType.DynamicPolyline || entityType === DrawTools.DrawType.GrowPolyline || entityType === DrawTools.DrawType.OutlinePolyline || entityType === DrawTools.DrawType.OdLine || entityType === DrawTools.DrawType.Polygon || entityType === DrawTools.DrawType.SpatialLine || entityType === DrawTools.DrawType.Circle || entityType === DrawTools.DrawType.DynamicCircle || entityType === DrawTools.DrawType.Rectangle || entityType === DrawTools.DrawType.NormalWall || entityType === DrawTools.DrawType.DynamicWall || entityType === DrawTools.DrawType.House || entityType === DrawTools.DrawType.TextWall || entityType === DrawTools.DrawType.VideoWall) {
  36063. _self._sendShowPropertyDialog(feature2.id);
  36064. }
  36065. }
  36066. });
  36067. },
  36068. _sendShowPropertyDialog(entity) {
  36069. let _self = this;
  36070. let editEntityType = entity.getEntityType();
  36071. if (entity.getIsEdit() === void 0 || entity.getIsEdit() === false || editEntityType === void 0) {
  36072. this._unActivateEdit();
  36073. return;
  36074. }
  36075. let editProperty = entity.getParams();
  36076. if (editEntityType === DrawTools.DrawType.OdLine) {
  36077. editProperty = entity.parent.getParams();
  36078. }
  36079. this._console("\u9009\u62E9\u5B9E\u4F53\u7684\u5C5E\u6027", editProperty);
  36080. if (editProperty !== void 0 && this.onEditProperty !== void 0) {
  36081. this._openPropertyEditDialog(editProperty, function(params) {
  36082. _self.updateEditEntityProperty(params);
  36083. }, function() {
  36084. _self._removeEditEntity();
  36085. });
  36086. }
  36087. this._activateEdit(entity);
  36088. },
  36089. _removeEditEntity() {
  36090. if (this._editEntity !== void 0) {
  36091. this._console("\u79FB\u9664\u5B9E\u4F53", this._editEntity);
  36092. let entityType = this._editEntity.getEntityType();
  36093. if (entityType === DrawTools.DrawType.OdLine) {
  36094. let fatherEntityId = this._editEntity.parent.id;
  36095. let removeEntitys = [];
  36096. for (let entity of this._entities.values) {
  36097. if (entity.parent !== void 0 && entity.parent.id === fatherEntityId) {
  36098. removeEntitys.push(entity);
  36099. }
  36100. }
  36101. for (let removeEntity of removeEntitys) {
  36102. this._removeEntityByObject(removeEntity);
  36103. }
  36104. } else {
  36105. this._removeEntityByObject(this._editEntity);
  36106. }
  36107. this._unActivateEdit();
  36108. this._editEntity = void 0;
  36109. }
  36110. },
  36111. updateEditEntityProperty: function(params) {
  36112. if (this._editEntity === void 0)
  36113. return;
  36114. if (this._editEntity.getIsEdit() === void 0 || this._editEntity.getIsEdit() === false)
  36115. return;
  36116. let editEntityType = this._editEntity.getEntityType();
  36117. if (editEntityType === void 0)
  36118. return;
  36119. if (editEntityType === DrawTools.DrawType.NormalWall || editEntityType === DrawTools.DrawType.DynamicWall || editEntityType === DrawTools.DrawType.TextWall) {
  36120. this._updateWallProperty(params);
  36121. } else if (editEntityType === DrawTools.DrawType.Circle || editEntityType === DrawTools.DrawType.DynamicCircle) {
  36122. this._updateCircleProperty(params);
  36123. } else if (editEntityType === DrawTools.DrawType.House) {
  36124. this._updateHouseProperty(params);
  36125. } else if (editEntityType === DrawTools.DrawType.VideoWall) {
  36126. this._updateVideoWallProperty(params);
  36127. } else if (editEntityType === DrawTools.DrawType.Polyline) {
  36128. this._updatePolylineProperty(params);
  36129. } else if (editEntityType === DrawTools.DrawType.Polygon) {
  36130. this._updatePolygonProperty(params);
  36131. } else if (editEntityType === DrawTools.DrawType.Rectangle) {
  36132. this._updateRectangleProperty(params);
  36133. } else if (editEntityType === DrawTools.DrawType.SpatialLine) {
  36134. this._updateSpatialPolylineProperty(params);
  36135. } else if (editEntityType === DrawTools.DrawType.OdLine) {
  36136. this._updateOdlineProperty(params);
  36137. }
  36138. },
  36139. _updateOdlineProperty(params) {
  36140. let _self = this;
  36141. let fatherEntity = this._editEntity.parent;
  36142. this._editOdlineEntities = [];
  36143. for (let entity of this._entities.values) {
  36144. if (entity.parent !== void 0 && entity.parent.id === fatherEntity.id) {
  36145. this._editOdlineEntities.push(entity);
  36146. }
  36147. }
  36148. let meterialImage = this._image_arrow_reverse;
  36149. if (params.order === this._param.order_add) {
  36150. meterialImage = this._image_arrow_reverse;
  36151. } else if (params.order === this._param.order_minus) {
  36152. meterialImage = this._image_arrow_forward;
  36153. }
  36154. let odLineMaterial = new WallMaterialProperty({
  36155. viewer: _self._viewer,
  36156. trailImage: meterialImage,
  36157. duration: params.duration,
  36158. color: Cesium.Color.fromCssColorString(params.color),
  36159. param: {
  36160. direction: params.direction,
  36161. count: params.count,
  36162. order: params.order
  36163. }
  36164. });
  36165. for (let entity of this._editOdlineEntities) {
  36166. entity.polyline.material = odLineMaterial;
  36167. let positions = entity.polyline.positions._value;
  36168. let strPoint = positions.first();
  36169. let endPoint = positions.last();
  36170. let newPositios = this._calculateOdlinePositios(
  36171. strPoint,
  36172. endPoint,
  36173. parseInt(params.odlineHeight),
  36174. parseInt(params.odlineCount)
  36175. );
  36176. entity.polyline.positions = newPositios;
  36177. entity.polyline.width = parseInt(params.lineWidth);
  36178. }
  36179. fatherEntity.setParams(params);
  36180. },
  36181. _updateSpatialPolylineProperty(params) {
  36182. let material = this._editEntity.polyline.material;
  36183. let newMaterial = void 0;
  36184. if (material instanceof Cesium.ColorMaterialProperty) {
  36185. newMaterial = this._materialColorProperty({
  36186. color: params.color
  36187. });
  36188. }
  36189. if (newMaterial !== void 0)
  36190. this._editEntity.polyline.material = newMaterial;
  36191. this._editEntity.polyline.width = parseFloat(params.lineWidth);
  36192. this._editEntity.setParams(params);
  36193. },
  36194. _updateRectangleProperty(params) {
  36195. let material = this._editEntity.rectangle.material;
  36196. if (material instanceof Cesium.ColorMaterialProperty) {
  36197. let newMaterial = this._materialColorProperty({
  36198. color: params.color
  36199. });
  36200. this._editEntity.rectangle.material = newMaterial;
  36201. }
  36202. if (this._editEntity.polyline !== void 0) {
  36203. let newMaterial = this._materialColorProperty({
  36204. color: params.outlineColor
  36205. });
  36206. this._editEntity.polyline.material = newMaterial;
  36207. this._editEntity.polyline.width = parseFloat(params.outlineWidth);
  36208. }
  36209. this._editEntity.setParams(params);
  36210. },
  36211. _updatePolygonProperty(params) {
  36212. let material = this._editEntity.polygon.material;
  36213. if (material instanceof Cesium.ColorMaterialProperty) {
  36214. let newMaterial = this._materialColorProperty({
  36215. color: params.color
  36216. });
  36217. this._editEntity.polygon.material = newMaterial;
  36218. }
  36219. if (this._editEntity.polyline !== void 0) {
  36220. let newMaterial = this._materialColorProperty({
  36221. color: params.outlineColor
  36222. });
  36223. this._editEntity.polyline.material = newMaterial;
  36224. this._editEntity.polyline.width = parseFloat(params.outlineWidth);
  36225. }
  36226. this._editEntity.setParams(params);
  36227. },
  36228. _updatePolylineProperty(params) {
  36229. let material = this._editEntity.polyline.material;
  36230. let newMaterial = void 0;
  36231. if (material instanceof Cesium.ColorMaterialProperty) {
  36232. newMaterial = this._materialColorProperty({
  36233. color: params.color
  36234. });
  36235. } else if (material instanceof Cesium.PolylineArrowMaterialProperty) {
  36236. newMaterial = this._materialPolylineArrowProperty({
  36237. color: params.color
  36238. });
  36239. } else if (material instanceof WallMaterialProperty) {
  36240. let materialImage = this._image_h_l_r;
  36241. if (params.order === this._param.order_minus) {
  36242. materialImage = this._image_h_r_l;
  36243. } else if (params.order === this._param.order_add) {
  36244. materialImage = this._image_h_l_r;
  36245. }
  36246. newMaterial = new WallMaterialProperty({
  36247. viewer: this._viewer,
  36248. trailImage: materialImage,
  36249. duration: params.duration,
  36250. color: Cesium.Color.fromCssColorString(params.color),
  36251. param: {
  36252. count: parseInt(params.count),
  36253. direction: params.direction,
  36254. order: params.order
  36255. }
  36256. });
  36257. } else if (material instanceof Cesium.PolylineGlowMaterialProperty) {
  36258. newMaterial = this._materialPolylineGlowProperty({
  36259. color: params.color,
  36260. power: parseFloat(params.power)
  36261. });
  36262. } else if (material instanceof Cesium.PolylineOutlineMaterialProperty) {
  36263. newMaterial = this._materialPolylineOutlineProperty({
  36264. color: params.color,
  36265. outlineWidth: parseFloat(params.outlineWidth),
  36266. outlineColor: params.outlineColor
  36267. });
  36268. }
  36269. if (newMaterial !== void 0)
  36270. this._editEntity.polyline.material = newMaterial;
  36271. this._editEntity.polyline.width = params.lineWidth;
  36272. this._editEntity.setParams(params);
  36273. },
  36274. _updateHouseProperty(params) {
  36275. let entityParams = this._editEntity.getParams();
  36276. let polygonMaterial = this._editEntity.polygon.material;
  36277. if (polygonMaterial instanceof Cesium.ColorMaterialProperty) {
  36278. let material = this._materialColorProperty({
  36279. color: params.color
  36280. });
  36281. this._editEntity.polygon.material = material;
  36282. this._editEntity.polygon.extrudedHeight = parseFloat(params.height) + parseFloat(
  36283. entityParams.bottomHeight
  36284. );
  36285. this._editEntity.setParams(params);
  36286. }
  36287. },
  36288. _updateCircleProperty(params) {
  36289. let circleMaterial = this._editEntity.ellipse.material;
  36290. if (circleMaterial instanceof CircleMaterialProperty) {
  36291. let material = new CircleMaterialProperty({
  36292. viewer: this._viewer,
  36293. duration: params.duration,
  36294. color: Cesium.Color.fromCssColorString(params.color),
  36295. count: parseFloat(params.count)
  36296. });
  36297. this._editEntity.ellipse.material = material;
  36298. } else if (circleMaterial instanceof Cesium.ColorMaterialProperty) {
  36299. let material = this._materialColorProperty({
  36300. color: params.color
  36301. });
  36302. this._editEntity.ellipse.material = material;
  36303. if (this._editEntity.polyline !== void 0) {
  36304. let newMaterial = this._materialColorProperty({
  36305. color: params.outlineColor
  36306. });
  36307. this._editEntity.polyline.material = newMaterial;
  36308. this._editEntity.polyline.width = parseFloat(params.outlineWidth);
  36309. }
  36310. }
  36311. this._editEntity.setParams(params);
  36312. },
  36313. _updateVideoWallProperty(params) {
  36314. let videoElement = document.getElementById("wallVideo");
  36315. if (videoElement !== null) {
  36316. document.body.removeChild(videoElement);
  36317. }
  36318. videoElement = document.createElement("video");
  36319. videoElement.id = "wallVideo";
  36320. videoElement.setAttribute("crossorigin", "anonymous");
  36321. videoElement.setAttribute("width", "1024px");
  36322. videoElement.setAttribute("height", "256px");
  36323. videoElement.setAttribute("controls", "controls");
  36324. videoElement.setAttribute("src", params.videoUrl);
  36325. videoElement.setAttribute("loop", "loop");
  36326. videoElement.play();
  36327. document.body.appendChild(videoElement);
  36328. let minimumHeights = this._editEntity.wall.minimumHeights._value;
  36329. let maximumHeights = [];
  36330. for (let i2 = 0; i2 < minimumHeights.length; i2++) {
  36331. maximumHeights.push(minimumHeights[i2] + parseFloat(params.height));
  36332. }
  36333. this._editEntity.wall.maximumHeights = maximumHeights;
  36334. this._editEntity.wall.material = videoElement;
  36335. let wallPositions = this._editEntity.wall.positions._value;
  36336. let newPositions = [];
  36337. for (let wallPosition of wallPositions) {
  36338. let transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(wallPosition);
  36339. let m = new Cesium.Matrix4();
  36340. Cesium.Matrix4.setTranslation(Cesium.Matrix4.IDENTITY, new Cesium.Cartesian3(
  36341. parseFloat(params.axisX),
  36342. parseFloat(params.axisY),
  36343. parseFloat(params.axisZ)
  36344. ), m);
  36345. let moveMatrix = Cesium.Matrix4.multiply(transform3, m, transform3);
  36346. let newPosition = new Cesium.Cartesian3();
  36347. Cesium.Matrix4.getTranslation(moveMatrix, newPosition);
  36348. newPositions.push(newPosition);
  36349. }
  36350. this._editEntity.wall.positions = newPositions;
  36351. params.axisX = params.axisY = params.axisZ = 0;
  36352. this._editEntity.setParams(params);
  36353. this._activateEdit(this._editEntity);
  36354. },
  36355. _updateWallProperty(params) {
  36356. let minHeights = this._editEntity.wall.minimumHeights._value;
  36357. let maxHeights = [];
  36358. for (let i2 = 0; i2 < minHeights.length; i2++) {
  36359. maxHeights.push(minHeights[i2] + parseFloat(params.height));
  36360. }
  36361. this._editEntity.wall.maximumHeights = maxHeights;
  36362. this._sketchWallMaxHeights = maxHeights;
  36363. let wallMaterial = this._editEntity.wall.material;
  36364. if (wallMaterial instanceof Cesium.ImageMaterialProperty) {
  36365. let material = this._materialTextImageProperty({
  36366. color: params.color,
  36367. text: params.text
  36368. });
  36369. this._editEntity.wall.material = material;
  36370. } else if (wallMaterial instanceof WallMaterialProperty) {
  36371. let materialImage = this._image_h_l_r;
  36372. if (params.direction === this._param.direction_h && params.order === this._param.order_add) {
  36373. materialImage = this._image_h_l_r;
  36374. } else if (params.direction === this._param.direction_h && params.order === this._param.order_add) {
  36375. materialImage = this._image_h_r_l;
  36376. } else if (params.direction === this._param.direction_v && params.order === this._param.order_minus) {
  36377. materialImage = this._image_v_t_b;
  36378. } else if (params.direction === this._param.direction_v && params.order === this._param.order_add) {
  36379. materialImage = this._image_v_b_t;
  36380. }
  36381. let material = new WallMaterialProperty({
  36382. viewer: this._viewer,
  36383. trailImage: materialImage,
  36384. duration: params.duration,
  36385. color: Cesium.Color.fromCssColorString(params.color),
  36386. param: {
  36387. count: parseFloat(params.count),
  36388. direction: params.direction,
  36389. order: params.order
  36390. }
  36391. });
  36392. this._editEntity.wall.material = material;
  36393. } else if (wallMaterial instanceof Cesium.ColorMaterialProperty) {
  36394. let material = this._materialColorProperty({
  36395. color: params.color
  36396. });
  36397. this._editEntity.wall.material = material;
  36398. }
  36399. this._editEntity.setParams(params);
  36400. },
  36401. rotationEntity(options2) {
  36402. if (this._editEntity === void 0)
  36403. return;
  36404. this._coordinateCalculateEntityOrientation(this._editEntity, options2);
  36405. },
  36406. _getEntityEditData: function(entity) {
  36407. if (entity instanceof Cesium.Entity) {
  36408. let editEntityType = entity.getEntityType();
  36409. if (editEntityType === DrawTools.DrawType.Polyline || editEntityType === DrawTools.DrawType.SpatialLine) {
  36410. return entity.polyline.positions._value;
  36411. } else if (editEntityType === DrawTools.DrawType.Polygon || editEntityType === DrawTools.DrawType.House) {
  36412. let positions = entity.polygon.hierarchy._value.positions;
  36413. if (positions[0].x !== positions[positions.length - 1].x) {
  36414. positions.push(positions[0].clone());
  36415. }
  36416. return positions;
  36417. } else if (editEntityType === DrawTools.DrawType.Rectangle) {
  36418. let rect = entity.rectangle.coordinates._value;
  36419. let gNw = Cesium.Rectangle.northwest(rect);
  36420. if (gNw.height <= 0) {
  36421. let height2 = this._queryHeightFromGeo(Cesium.Math.toDegrees(gNw.longitude), Cesium.Math.toDegrees(gNw.latitude));
  36422. gNw.height = height2;
  36423. }
  36424. let cNw = Cesium.Cartesian3.fromRadians(gNw.longitude, gNw.latitude, gNw.height);
  36425. let gSe = Cesium.Rectangle.southeast(rect);
  36426. if (gSe.height <= 0) {
  36427. let height2 = this._queryHeightFromGeo(Cesium.Math.toDegrees(gSe.longitude), Cesium.Math.toDegrees(gSe.latitude));
  36428. gSe.height = height2;
  36429. }
  36430. let cSe = Cesium.Cartesian3.fromRadians(gSe.longitude, gSe.latitude, gSe.height);
  36431. return [cNw, cSe];
  36432. } else if (editEntityType === DrawTools.DrawType.Circle || editEntityType === DrawTools.DrawType.DynamicCircle) {
  36433. let centerPosition = entity.position._value;
  36434. let radius = entity.ellipse.semiMajorAxis._value;
  36435. let cbPoint = this._calculateCircleBoundaryPoint(centerPosition, radius);
  36436. return [centerPosition, cbPoint];
  36437. } else if (editEntityType === DrawTools.DrawType.NormalWall || editEntityType === DrawTools.DrawType.DynamicWall || editEntityType === DrawTools.DrawType.TextWall) {
  36438. this._sketchWallHeights = [];
  36439. this._sketchWallMaxHeights = [];
  36440. let minHeights = entity.wall.minimumHeights._value;
  36441. let maxHeights = entity.wall.maximumHeights._value;
  36442. for (let i2 = 0; i2 < minHeights.length; i2++) {
  36443. this._sketchWallHeights.push(minHeights[i2]);
  36444. this._sketchWallMaxHeights.push(maxHeights[i2]);
  36445. }
  36446. return entity.wall.positions._value;
  36447. } else if (editEntityType === DrawTools.DrawType.VideoWall) {
  36448. let positions = entity.wall.positions._value;
  36449. return [positions[0].clone()];
  36450. } else {
  36451. return [];
  36452. }
  36453. } else {
  36454. return [];
  36455. }
  36456. },
  36457. _calculateCircleBoundaryPoint: function(centerPosition, radius) {
  36458. let gCenter = Cesium.Ellipsoid.WGS84.cartesianToCartographic(centerPosition);
  36459. let cPoint = point([Cesium.Math.toDegrees(gCenter.longitude), Cesium.Math.toDegrees(
  36460. gCenter.latitude
  36461. )]);
  36462. let boundaryPoint = destination(cPoint, radius / 1e3, 90, {
  36463. units: "kilometers"
  36464. }).geometry.coordinates;
  36465. let height2 = this._queryHeightFromGeo(boundaryPoint[0], boundaryPoint[1]);
  36466. let cbPoint = Cesium.Cartesian3.fromDegrees(boundaryPoint[0], boundaryPoint[1], height2);
  36467. return cbPoint;
  36468. },
  36469. _calculateCenterPosition: function(positions) {
  36470. if (positions === void 0 || positions.length === 0)
  36471. return void 0;
  36472. else if (positions.length === 1) {
  36473. return positions[0];
  36474. } else if (positions.length === 2) {
  36475. let pt0 = this._cartesian3ToGeo(positions[0]);
  36476. let pt1 = this._cartesian3ToGeo(positions[1]);
  36477. let point0 = point([pt0.longitude, pt0.latitude]);
  36478. let point1 = point([pt1.longitude, pt1.latitude]);
  36479. let center2 = midpoint(point0, point1).geometry.coordinates;
  36480. let height2 = this._queryHeightFromGeo(center2[0], center2[1]);
  36481. return Cesium.Cartesian3.fromDegrees(center2[0], center2[1], height2);
  36482. } else {
  36483. let geoPoints = [
  36484. []
  36485. ];
  36486. for (let i2 = 0; i2 < positions.length; i2++) {
  36487. let geoPoint = this._cartesian3ToGeo(positions[i2]);
  36488. geoPoints[0].push([geoPoint.longitude, geoPoint.latitude]);
  36489. }
  36490. geoPoints[0].push(geoPoints[0][0]);
  36491. let polygon$1 = polygon(geoPoints);
  36492. let center2 = centerOfMass(polygon$1).geometry.coordinates;
  36493. let height2 = this._queryHeightFromGeo(center2[0], center2[1]);
  36494. return Cesium.Cartesian3.fromDegrees(center2[0], center2[1], height2);
  36495. }
  36496. },
  36497. _calculateTransformPosition: function(position2, distance2, bearing2, options2) {
  36498. let geoPoint = this._cartesian3ToGeo(position2);
  36499. let point$1 = point([geoPoint.longitude, geoPoint.latitude]);
  36500. let resPoint = destination(point$1, distance2, bearing2, options2).geometry.coordinates;
  36501. let height2 = geoPoint.height;
  36502. if (options2 !== void 0 && options2.calculateHeight !== void 0 && options2.calculateHeight === true) {
  36503. height2 = this._queryHeightFromGeo(resPoint[0], resPoint[1]);
  36504. }
  36505. let cPosition = Cesium.Cartesian3.fromDegrees(
  36506. resPoint[0],
  36507. resPoint[1],
  36508. height2
  36509. );
  36510. return cPosition;
  36511. },
  36512. _unActivateEdit: function() {
  36513. this._clearEditPoint();
  36514. this._removeCoorinateAxis();
  36515. this._closePropertyEditDialog();
  36516. },
  36517. _activateEdit: function(editEntity) {
  36518. let entityType = editEntity.getEntityType();
  36519. let entityIsEdit = editEntity.getIsEdit();
  36520. if (entityIsEdit === void 0 || entityType === void 0 || entityIsEdit === false) {
  36521. this._console("\u8BE5\u5B9E\u4F53\u4E0D\u53EF\u7F16\u8F91");
  36522. return;
  36523. }
  36524. if (entityType === DrawTools.DrawType.OdLine) {
  36525. this._activeteOdlineEdit(editEntity);
  36526. } else {
  36527. this._activeteNormalEdit(editEntity);
  36528. }
  36529. },
  36530. _activeteOdlineEdit: function(editEntity) {
  36531. let _self = this;
  36532. let entityType = editEntity.getEntityType();
  36533. if (entityType === void 0 || entityType !== DrawTools.DrawType.OdLine) {
  36534. this._console("\u8BE5\u5B9E\u4F53\u4E0D\u53EF\u7F16\u8F91\u6216\u8BE5\u5B9E\u4F53\u4E0D\u662FOD\u7EBF\u7C7B\u578B");
  36535. return;
  36536. }
  36537. let faterEntityId = editEntity.parent.id;
  36538. this._editOdlineEntities = [];
  36539. for (let entity of this._entities.values) {
  36540. if (entity.parent !== void 0 && entity.parent.id === faterEntityId) {
  36541. this._editOdlineEntities.push(entity);
  36542. }
  36543. }
  36544. if (this._editOdlineEntities.length === 0)
  36545. return;
  36546. this._editEntity = this._editOdlineEntities[0];
  36547. for (let i2 = 0; i2 < this._editOdlineEntities.length; i2++) {
  36548. let entity = this._editOdlineEntities[i2];
  36549. let positions = entity.polyline.positions._value;
  36550. if (i2 === 0) {
  36551. this._createEditOdlineStartPoint(positions.first(), entity);
  36552. this._createEditOdlineEndPoint(positions.last(), entity);
  36553. } else {
  36554. this._createEditOdlineEndPoint(positions.last(), entity);
  36555. }
  36556. }
  36557. if (this._sketchEditHandler === void 0) {
  36558. this._sketchEditHandler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  36559. }
  36560. this._registerLeftDownEvent(this._sketchEditHandler, function(event2) {
  36561. _self._eventEditMouseDown(event2);
  36562. });
  36563. this._registerMouseMoveEvent(this._sketchEditHandler, function(event2) {
  36564. _self._eventEditMouseMove(event2);
  36565. });
  36566. this._registerLeftUpEvent(this._sketchEditHandler, function(event2) {
  36567. _self._eventEditMouseUp(event2);
  36568. });
  36569. },
  36570. _activeteNormalEdit: function(editEntity) {
  36571. let _self = this;
  36572. let positions = this._getEntityEditData(editEntity);
  36573. this._removePointEntitys();
  36574. let entityType = editEntity.getEntityType();
  36575. this._editEntity = editEntity;
  36576. if (entityType === DrawTools.DrawType.Circle || entityType === DrawTools.DrawType.DynamicCircle) {
  36577. this._createEditCenterPoint(positions[0]);
  36578. this._createEditNodePoint(positions, 1);
  36579. } else if (entityType === DrawTools.DrawType.VideoWall) {
  36580. if (!this._isRuntimeApp()) {
  36581. let position2 = positions[0];
  36582. this._removeCoorinateAxis();
  36583. this._createCoordinateAxis(position2);
  36584. }
  36585. } else {
  36586. this._createEditNodePoint(positions);
  36587. let centerPosition = this._calculateCenterPosition(positions);
  36588. if (centerPosition !== void 0) {
  36589. this._createEditCenterPoint(centerPosition);
  36590. }
  36591. }
  36592. if (entityType !== DrawTools.DrawType.Rectangle && entityType !== DrawTools.DrawType.Circle && entityType !== DrawTools.DrawType.DynamicCircle && entityType !== DrawTools.DrawType.VideoWall) {
  36593. if (entityType === DrawTools.DrawType.SpatialLine) {
  36594. this._createEditMiddlePoint(positions, true);
  36595. } else {
  36596. this._createEditMiddlePoint(positions);
  36597. }
  36598. }
  36599. if (this._sketchEditHandler === void 0) {
  36600. this._sketchEditHandler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  36601. }
  36602. this._registerLeftDownEvent(this._sketchEditHandler, function(event2) {
  36603. _self._eventEditMouseDown(event2);
  36604. });
  36605. this._registerMouseMoveEvent(this._sketchEditHandler, function(event2) {
  36606. _self._eventEditMouseMove(event2);
  36607. });
  36608. this._registerLeftUpEvent(this._sketchEditHandler, function(event2) {
  36609. _self._eventEditMouseUp(event2);
  36610. });
  36611. },
  36612. _eventEditMouseDown: function(event2) {
  36613. let _self = this;
  36614. let feature2 = _self._viewer.scene.pick(event2.position);
  36615. if (feature2 != void 0 && feature2.id instanceof Cesium.Entity) {
  36616. let featureType = feature2.id.getEditType();
  36617. if (featureType === void 0)
  36618. return;
  36619. _self._viewer.scene.screenSpaceCameraController.enableRotate = false;
  36620. let entityPosition = feature2.id.position._value;
  36621. _self._editPointEntity = feature2.id;
  36622. _self._setMousePointerStyle();
  36623. if (featureType.type === DrawTools.EditPointType.Node || featureType.type === DrawTools.EditPointType.Middle) {
  36624. _self._entityCallbackPropertyByMouseDown();
  36625. _self._removeEntityByObject(_self._editPointEntity);
  36626. if (_self._sketchEditEntitySpatialName != void 0) {
  36627. _self._removeEntityByName(_self._sketchEditEntitySpatialName);
  36628. }
  36629. } else if (featureType.type === DrawTools.EditPointType.Center) {
  36630. _self._entityCenterMouseDownEvent();
  36631. } else if (featureType.type === DrawTools.EditPointType.OdlineEndNode) {
  36632. _self._removeEntityByObject(_self._editPointEntity);
  36633. _self._editEntity = featureType.joinEntity;
  36634. let params = _self._editEntity.parent.getParams();
  36635. _self._sketchEditPoints = [];
  36636. let joinEntityPositions = _self._editEntity.polyline.positions._value;
  36637. _self._sketchEditPoints.push(joinEntityPositions.first());
  36638. _self._sketchEditPoints.push(joinEntityPositions.last());
  36639. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(function() {
  36640. let positions = _self._calculateOdlinePositios(_self._sketchEditPoints[0], _self._sketchEditPoints[1], parseInt(params.odlineHeight), parseInt(params.odlineCount));
  36641. return positions;
  36642. }, false);
  36643. } else if (featureType.type === DrawTools.EditPointType.OdlineStrartNode) {
  36644. _self._removeEntityByObject(_self._editPointEntity);
  36645. _self._editEntity = featureType.joinEntity;
  36646. let params = _self._editEntity.parent.getParams();
  36647. _self._sketchEditPoints = [];
  36648. let joinEntityPositions = _self._editEntity.polyline.positions._value;
  36649. _self._sketchEditPoints.push(joinEntityPositions.first());
  36650. for (let odEntity of _self._editOdlineEntities) {
  36651. let odEntityPositions = odEntity.polyline.positions._value;
  36652. let lastPosition = odEntityPositions.last();
  36653. _self._sketchEditPoints.push(lastPosition.clone());
  36654. odEntity.polyline.positions = new Cesium.CallbackProperty(function() {
  36655. let positions = _self._calculateOdlinePositios(
  36656. _self._sketchEditPoints[0],
  36657. lastPosition,
  36658. parseInt(params.odlineHeight),
  36659. parseInt(params.odlineCount)
  36660. );
  36661. return positions;
  36662. }, false);
  36663. }
  36664. }
  36665. if (featureType.type === DrawTools.EditPointType.Middle) {
  36666. let index2 = featureType.index;
  36667. _self._sketchEditPoints.splice(index2, 0, entityPosition);
  36668. _self._sketchEditIndex = index2;
  36669. if (_self._sketchWallHeights != void 0 && _self._sketchWallHeights.length > 0) {
  36670. let geoPoint = _self._cartesian3ToGeo(entityPosition);
  36671. let height2 = _self._queryHeightFromGeo(geoPoint.longitude, geoPoint.latitude);
  36672. _self._sketchWallHeights.splice(index2, 0, height2);
  36673. let heightDifference = _self._sketchWallMaxHeights[0] - _self._sketchWallHeights[0];
  36674. _self._sketchWallMaxHeights.splice(index2, 0, height2 + heightDifference);
  36675. }
  36676. _self._tooltipInit("\u62D6\u52A8\u4E2D\u70B9\uFF0C\u6539\u53D8\u5F62\u72B6", event2.position);
  36677. } else if (featureType.type === DrawTools.EditPointType.Node) {
  36678. _self._sketchEditIndex = featureType.index;
  36679. _self._tooltipInit("\u62D6\u52A8\u8282\u70B9\uFF0C\u6539\u53D8\u5F62\u72B6", event2.position);
  36680. } else if (featureType.type === DrawTools.EditPointType.Spatial) {
  36681. _self._sketchEditIndex = featureType.index;
  36682. _self._tooltipInit("\u62D6\u52A8\u8282\u70B9\uFF0C\u6539\u53D8\u9AD8\u5EA6", event2.position);
  36683. } else if (featureType.type === DrawTools.EditPointType.CoordinateAxis) {
  36684. _self._tooltipInit("\u62D6\u52A8\u5750\u6807\u8F74\uFF0C\u6539\u53D8\u4F4D\u7F6E", event2.position);
  36685. } else if (featureType.type === DrawTools.EditPointType.OdlineEndNode || featureType.type === DrawTools.EditPointType.OdlineStrartNode) {
  36686. _self._tooltipInit("\u62D6\u52A8\u8282\u70B9\uFF0C\u6539\u53D8OD\u7EBF\u4F4D\u7F6E", event2.position);
  36687. }
  36688. }
  36689. },
  36690. _eventEditMouseMove: function(event2) {
  36691. let _self = this;
  36692. if (_self._editPointEntity != void 0) {
  36693. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  36694. if (!Cesium.defined(loc2.sLocation))
  36695. return;
  36696. _self._editPosition = loc2.sLocation;
  36697. let editEntityType = _self._editPointEntity.getEditType();
  36698. if (editEntityType.type === DrawTools.EditPointType.Node) {
  36699. _self._sketchEditPoints[_self._sketchEditIndex] = loc2.sLocation;
  36700. let editEntityType2 = _self._editEntity.getEntityType();
  36701. if (editEntityType2 != DrawTools.DrawType.Rectangle && editEntityType2 != DrawTools.DrawType.Circle && editEntityType2 != DrawTools.DrawType.DynamicCircle) {
  36702. if ((editEntityType2 === DrawTools.DrawType.Polygon || editEntityType2 === DrawTools.DrawType.House) && _self._sketchEditIndex === 0) {
  36703. _self._sketchEditPoints[_self._sketchEditPoints.length - 1] = loc2.sLocation;
  36704. } else if (editEntityType2 === DrawTools.DrawType.NormalWall || editEntityType2 === DrawTools.DrawType.DynamicWall || editEntityType2 === DrawTools.DrawType.TextWall) {
  36705. _self._sketchWallHeights[_self._sketchEditIndex] = loc2.gLocation.height;
  36706. }
  36707. _self._removeEntityByName(_self._sketchEditEntityMiddleName);
  36708. if (editEntityType2 === DrawTools.DrawType.SpatialLine) {
  36709. _self._createEditMiddlePoint(_self._sketchEditPoints, true);
  36710. } else {
  36711. _self._createEditMiddlePoint(_self._sketchEditPoints);
  36712. }
  36713. }
  36714. } else if (editEntityType.type === DrawTools.EditPointType.Middle) {
  36715. _self._sketchEditPoints[_self._sketchEditIndex] = loc2.sLocation;
  36716. } else if (editEntityType.type === DrawTools.EditPointType.Center) {
  36717. _self._entityCenterMouseMoveEvent(event2);
  36718. } else if (editEntityType.type === DrawTools.EditPointType.Spatial) {
  36719. let ellipsoid = _self._viewer.scene.globe.ellipsoid;
  36720. let cartesian = _self._viewer.camera.pickEllipsoid(
  36721. event2.endPosition,
  36722. ellipsoid
  36723. );
  36724. let bottomPoint = _self._sketchEditPoints[_self._sketchEditIndex];
  36725. let heightDifference = cartesian.z - bottomPoint.z;
  36726. if (heightDifference > 0 && heightDifference < 500) {
  36727. for (let i2 = 0; i2 < _self._sketchWallHeights.length; i2++) {
  36728. _self._sketchWallMaxHeights[i2] = _self._sketchWallHeights[i2] + heightDifference;
  36729. }
  36730. }
  36731. } else if (editEntityType.type === DrawTools.EditPointType.OdlineEndNode) {
  36732. _self._sketchEditPoints[_self._sketchEditPoints.length - 1] = loc2.sLocation;
  36733. } else if (editEntityType.type === DrawTools.EditPointType.OdlineStrartNode) {
  36734. _self._sketchEditPoints[0] = loc2.sLocation;
  36735. }
  36736. _self._tooltipInit("\u62AC\u8D77\u9F20\u6807\uFF0C\u5B8C\u6210\u66F4\u6539", event2.endPosition);
  36737. }
  36738. },
  36739. _eventEditMouseUp: function(event2) {
  36740. let _self = this;
  36741. if (_self._editPointEntity != void 0) {
  36742. _self._viewer.scene.screenSpaceCameraController.enableRotate = true;
  36743. _self._tooltipRemove();
  36744. _self._setMouseDefaultStyle();
  36745. let editEntityPointType = _self._editPointEntity.getEditType().type;
  36746. let entityType = _self._editEntity.getEntityType();
  36747. if (editEntityPointType === DrawTools.EditPointType.CoordinateAxis)
  36748. ;
  36749. else if (editEntityPointType === DrawTools.EditPointType.OdlineEndNode) {
  36750. let params = _self._editEntity.parent.getParams();
  36751. let positions = _self._calculateOdlinePositios(_self._sketchEditPoints[0], _self._sketchEditPoints[1], parseInt(params.odlineHeight), parseInt(params.odlineCount));
  36752. _self._editEntity.polyline.positions = positions;
  36753. _self._createEditOdlineEndPoint(_self._sketchEditPoints[1], _self._editEntity);
  36754. } else if (editEntityPointType === DrawTools.EditPointType.OdlineStrartNode) {
  36755. let params = _self._editEntity.parent.getParams();
  36756. let index2 = 1;
  36757. for (let odEntity of _self._editOdlineEntities) {
  36758. let lastPosition = _self._sketchEditPoints[index2++];
  36759. let positions = _self._calculateOdlinePositios(
  36760. _self._sketchEditPoints[0],
  36761. lastPosition,
  36762. parseInt(params.odlineHeight),
  36763. parseInt(params.odlineCount)
  36764. );
  36765. odEntity.polyline.positions = positions;
  36766. }
  36767. _self._createEditOdlineStartPoint(_self._sketchEditPoints[0], _self._editOdlineEntities[0]);
  36768. } else {
  36769. if (editEntityPointType === DrawTools.EditPointType.Node || editEntityPointType === DrawTools.EditPointType.Middle) {
  36770. _self._entityCallbackPropertyByMouseUp();
  36771. } else if (editEntityPointType === DrawTools.EditPointType.Center) {
  36772. _self._entityCenterMouseUpEvent(event2);
  36773. }
  36774. _self._removeEntityByName(_self._sketchEditEntityNodeName);
  36775. _self._removeEntityByName(_self._sketchEditEntityMiddleName);
  36776. _self._removeEntityByName(_self._sketchEditEntityCenterName);
  36777. if (entityType === DrawTools.DrawType.Circle || entityType === DrawTools.DrawType.DynamicCircle) {
  36778. let centerPosition = _self._editEntity.position._value;
  36779. let boundaryPosition = _self._calculateCircleBoundaryPoint(
  36780. centerPosition,
  36781. _self._sketchEllipseRadius
  36782. );
  36783. _self._sketchEditPoints[0] = centerPosition;
  36784. _self._sketchEditPoints[1] = boundaryPosition;
  36785. _self._createEditNodePoint(_self._sketchEditPoints, 1);
  36786. _self._createEditCenterPoint(centerPosition);
  36787. } else {
  36788. _self._createEditNodePoint(_self._sketchEditPoints);
  36789. let centerPosition = _self._calculateCenterPosition(_self._sketchEditPoints);
  36790. _self._createEditCenterPoint(centerPosition);
  36791. }
  36792. if (entityType != DrawTools.DrawType.Rectangle && entityType != DrawTools.DrawType.Circle && entityType != DrawTools.DrawType.DynamicCircle) {
  36793. if (entityType === DrawTools.DrawType.SpatialLine) {
  36794. _self._createEditMiddlePoint(_self._sketchEditPoints, true);
  36795. } else {
  36796. _self._createEditMiddlePoint(_self._sketchEditPoints);
  36797. }
  36798. }
  36799. }
  36800. _self._editPointEntity = void 0;
  36801. }
  36802. },
  36803. _entityCenterMouseDownEvent: function() {
  36804. let _self = this;
  36805. let entityPosition = this._editEntity.position._value;
  36806. this._removeEntityByName(this._sketchEditEntityNodeName);
  36807. this._removeEntityByName(this._sketchEditEntityMiddleName);
  36808. this._removeEntityByName(this._sketchEditEntityCenterName);
  36809. this._startPoint = entityPosition;
  36810. this._startMovePoints = [];
  36811. this._movePoint = entityPosition;
  36812. let editEntityType = this._editEntity.getEntityType();
  36813. if (editEntityType === DrawTools.DrawType.Circle || editEntityType === DrawTools.DrawType.DynamicCircle) {
  36814. if (this._editEntity.polyline !== void 0) {
  36815. for (let i2 = 0; i2 < this._ellipseOutlineCoordinates.length; i2++) {
  36816. this._startMovePoints.push(this._ellipseOutlineCoordinates[i2]);
  36817. }
  36818. this._editEntity.polyline.positions = new Cesium.CallbackProperty(
  36819. function() {
  36820. return _self._ellipseOutlineCoordinates;
  36821. },
  36822. false
  36823. );
  36824. }
  36825. this._editEntity.position = new Cesium.CallbackProperty(function() {
  36826. return _self._movePoint;
  36827. }, false);
  36828. } else if (editEntityType === DrawTools.DrawType.Polygon || editEntityType === DrawTools.DrawType.House) {
  36829. for (let i2 = 0; i2 < this._sketchEditPoints.length; i2++) {
  36830. this._startMovePoints.push(this._sketchEditPoints[i2]);
  36831. }
  36832. _self._editEntity.polygon.hierarchy = new Cesium.CallbackProperty(function() {
  36833. return {
  36834. positions: _self._sketchEditPoints
  36835. };
  36836. }, false);
  36837. if (_self._editEntity.polyline != void 0) {
  36838. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(function() {
  36839. return _self._sketchEditPoints;
  36840. }, false);
  36841. }
  36842. } else if (editEntityType === DrawTools.DrawType.Polyline || editEntityType === DrawTools.DrawType.SpatialLine) {
  36843. for (let i2 = 0; i2 < this._sketchEditPoints.length; i2++) {
  36844. this._startMovePoints.push(this._sketchEditPoints[i2]);
  36845. }
  36846. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(function() {
  36847. return _self._sketchEditPoints;
  36848. }, false);
  36849. } else if (editEntityType === DrawTools.DrawType.Rectangle) {
  36850. for (let i2 = 0; i2 < this._sketchEditPoints.length; i2++) {
  36851. this._startMovePoints.push(this._sketchEditPoints[i2]);
  36852. }
  36853. _self._editEntity.rectangle.coordinates = new Cesium.CallbackProperty(_self._callUpdateRectangleCoordinates(_self._sketchEditPoints), false);
  36854. if (_self._editEntity.polyline != void 0) {
  36855. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(
  36856. _self._callUpdateRectangleOutlineCoordinates(),
  36857. false
  36858. );
  36859. }
  36860. }
  36861. },
  36862. _entityCenterMouseMoveEvent: function(event2) {
  36863. this._calculatePositionsByCenter(event2.endPosition, false);
  36864. },
  36865. _calculatePositionsByCenter: function(screenPosition, calculateHeight) {
  36866. let strLoc = this._cartesian3ToGeo(this._startPoint);
  36867. let endLoc = this._transfromFromScreenPoint(screenPosition);
  36868. var point1 = point([strLoc.longitude, strLoc.latitude]);
  36869. var point2 = point([endLoc.gLocation.lng, endLoc.gLocation.lat]);
  36870. var bearing$1 = bearing(point1, point2);
  36871. var options2 = {
  36872. units: "kilometers",
  36873. calculateHeight
  36874. };
  36875. var distance$1 = distance(point1, point2, options2);
  36876. let editEntityType = this._editEntity.getEntityType();
  36877. if (editEntityType === DrawTools.DrawType.Circle || editEntityType === DrawTools.DrawType.DynamicCircle) {
  36878. for (let i2 = 0; i2 < this._startMovePoints.length; i2++) {
  36879. let position2 = this._calculateTransformPosition(
  36880. this._startMovePoints[i2],
  36881. distance$1,
  36882. bearing$1,
  36883. options2
  36884. );
  36885. this._ellipseOutlineCoordinates[i2] = position2.clone();
  36886. }
  36887. this._movePoint = endLoc.sLocation;
  36888. } else {
  36889. for (let i2 = 0; i2 < this._startMovePoints.length; i2++) {
  36890. let position2 = this._calculateTransformPosition(
  36891. this._startMovePoints[i2],
  36892. distance$1,
  36893. bearing$1,
  36894. options2
  36895. );
  36896. this._sketchEditPoints[i2] = position2.clone();
  36897. }
  36898. }
  36899. },
  36900. _entityCenterMouseUpEvent: function(event2) {
  36901. this._calculatePositionsByCenter(event2.position, true);
  36902. let _self = this;
  36903. let editEntityType = this._editEntity.getEntityType();
  36904. if (editEntityType === DrawTools.DrawType.Circle || editEntityType === DrawTools.DrawType.DynamicCircle) {
  36905. this._editEntity.position = this._movePoint;
  36906. if (this._editEntity.polyline !== void 0) {
  36907. this._editEntity.polyline.positions = this._ellipseOutlineCoordinates;
  36908. }
  36909. } else if (editEntityType === DrawTools.DrawType.Polyline || editEntityType === DrawTools.DrawType.SpatialLine) {
  36910. this._editEntity.polyline.positions = this._sketchEditPoints;
  36911. } else if (editEntityType === DrawTools.DrawType.Polygon || editEntityType === DrawTools.DrawType.House) {
  36912. this._editEntity.polygon.hierarchy = {
  36913. positions: _self._sketchEditPoints
  36914. };
  36915. if (this._editEntity.polyline != void 0) {
  36916. this._editEntity.polyline.positions = this._sketchEditPoints;
  36917. }
  36918. } else if (editEntityType === DrawTools.DrawType.Rectangle) {
  36919. this._editEntity.rectangle.coordinates = Cesium.Rectangle.fromDegrees(_self._rectangleCoordinates[0], _self._rectangleCoordinates[1], _self._rectangleCoordinates[2], _self._rectangleCoordinates[3]);
  36920. if (this._editEntity.polyline != void 0) {
  36921. this._editEntity.polyline.positions = _self._rectangleOutlineCoordinates;
  36922. }
  36923. }
  36924. },
  36925. _entityCallbackPropertyByMouseUp: function() {
  36926. let _self = this;
  36927. let entityType = _self._editEntity.getEntityType();
  36928. if (entityType === DrawTools.DrawType.Polyline) {
  36929. _self._editEntity.polyline.positions = _self._sketchEditPoints;
  36930. } else if (entityType === DrawTools.DrawType.Polygon || entityType === DrawTools.DrawType.House) {
  36931. _self._editEntity.polygon.hierarchy = {
  36932. positions: _self._sketchEditPoints
  36933. };
  36934. if (_self._editEntity.polyline != void 0) {
  36935. let polygonPositions = _self._editEntity.polygon.hierarchy._value.positions;
  36936. let linePositions = [];
  36937. for (let i2 = 0; i2 < polygonPositions.length; i2++) {
  36938. linePositions.push(polygonPositions[i2].clone());
  36939. }
  36940. if (linePositions[0].x !== linePositions[linePositions.length - 1].x) {
  36941. linePositions.push(linePositions[0].clone());
  36942. }
  36943. _self._editEntity.polyline.positions = linePositions;
  36944. }
  36945. } else if (entityType === DrawTools.DrawType.Rectangle) {
  36946. _self._editEntity.rectangle.coordinates = Cesium.Rectangle.fromDegrees(_self._rectangleCoordinates[0], _self._rectangleCoordinates[1], _self._rectangleCoordinates[2], _self._rectangleCoordinates[3]);
  36947. if (_self._editEntity.polyline != void 0) {
  36948. _self._editEntity.polyline.positions = _self._rectangleOutlineCoordinates;
  36949. }
  36950. } else if (entityType === DrawTools.DrawType.Circle || entityType === DrawTools.DrawType.DynamicCircle) {
  36951. _self._editEntity.ellipse.semiMajorAxis = _self._sketchEllipseRadius;
  36952. _self._editEntity.ellipse.semiMinorAxis = _self._sketchEllipseRadius;
  36953. if (_self._editEntity.polyline != void 0) {
  36954. _self._editEntity.polyline.positions = _self._ellipseOutlineCoordinates;
  36955. }
  36956. } else if (entityType === DrawTools.DrawType.NormalWall || entityType === DrawTools.DrawType.DynamicWall || entityType === DrawTools.DrawType.TextWall) {
  36957. _self._editEntity.wall.positions = _self._sketchEditPoints;
  36958. _self._editEntity.wall.minimumHeights = _self._sketchWallHeights;
  36959. _self._editEntity.wall.maximumHeights = _self._sketchWallMaxHeights;
  36960. }
  36961. },
  36962. _entityCallbackPropertyByMouseDown: function() {
  36963. let _self = this;
  36964. let entityType = _self._editEntity.getEntityType();
  36965. if (entityType === DrawTools.DrawType.Polyline || entityType === DrawTools.DrawType.SpatialLine) {
  36966. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(
  36967. function() {
  36968. return _self._sketchEditPoints;
  36969. },
  36970. false
  36971. );
  36972. } else if (entityType === DrawTools.DrawType.Polygon || entityType === DrawTools.DrawType.House) {
  36973. _self._editEntity.polygon.hierarchy = new Cesium.CallbackProperty(
  36974. function() {
  36975. return {
  36976. positions: _self._sketchEditPoints
  36977. };
  36978. },
  36979. false
  36980. );
  36981. if (_self._editEntity.polyline != void 0) {
  36982. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(
  36983. function() {
  36984. let polygonPositions = _self._sketchEditPoints;
  36985. let linePositions = [];
  36986. for (let i2 = 0; i2 < polygonPositions.length; i2++) {
  36987. linePositions.push(polygonPositions[i2].clone());
  36988. }
  36989. if (linePositions[0].x !== linePositions[linePositions.length - 1].x) {
  36990. linePositions.push(linePositions[0].clone());
  36991. }
  36992. return linePositions;
  36993. },
  36994. false
  36995. );
  36996. }
  36997. } else if (entityType === DrawTools.DrawType.Rectangle) {
  36998. _self._editEntity.rectangle.coordinates = new Cesium.CallbackProperty(
  36999. _self._callUpdateRectangleCoordinates(_self._sketchEditPoints),
  37000. false
  37001. );
  37002. if (_self._editEntity.polyline != void 0) {
  37003. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(
  37004. _self._callUpdateRectangleOutlineCoordinates(),
  37005. false
  37006. );
  37007. }
  37008. } else if (entityType === DrawTools.DrawType.Circle || entityType === DrawTools.DrawType.DynamicCircle) {
  37009. if (_self._editPointEntity.getEditType().index === 1) {
  37010. _self._editEntity.ellipse.semiMajorAxis = new Cesium.CallbackProperty(
  37011. _self._callUpdateEllipseMinorAxis(_self._sketchEditPoints),
  37012. false
  37013. );
  37014. _self._editEntity.ellipse.semiMinorAxis = new Cesium.CallbackProperty(
  37015. _self._callUpdateEllipseMinorAxis(_self._sketchEditPoints),
  37016. false
  37017. );
  37018. }
  37019. if (_self._editEntity.polyline != void 0) {
  37020. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(
  37021. _self._callEllipseOutlineCoordinate(_self._sketchEditPoints),
  37022. false
  37023. );
  37024. }
  37025. } else if (entityType === DrawTools.DrawType.NormalWall || entityType === DrawTools.DrawType.DynamicWall || entityType === DrawTools.DrawType.TextWall) {
  37026. _self._editEntity.wall.positions = new Cesium.CallbackProperty(function() {
  37027. return _self._sketchEditPoints;
  37028. }, false);
  37029. _self._editEntity.wall.minimumHeights = new Cesium.CallbackProperty(function() {
  37030. return _self._sketchWallHeights;
  37031. }, false);
  37032. _self._editEntity.wall.maximumHeights = new Cesium.CallbackProperty(function() {
  37033. return _self._sketchWallMaxHeights;
  37034. }, false);
  37035. }
  37036. },
  37037. _createEditPointEntity(options2) {
  37038. let _self = this;
  37039. if (options2 === void 0 || options2.position === void 0)
  37040. return;
  37041. if (options2 === void 0 || options2.editType === void 0)
  37042. return;
  37043. let color2 = options2.color != void 0 ? options2.color : [255, 0, 0, 1];
  37044. let size = options2.size != void 0 && typeof options2.size === "number" ? options2.size : 9;
  37045. let outlineWidth = options2.outlineWidth != void 0 && typeof options2.outlineWidth === "number" ? options2.outlineWidth : 1;
  37046. let outlineColor = options2.outlineColor != void 0 ? options2.outlineColor : [255, 255, 255, 1];
  37047. let pointEntity = new Cesium.Entity({
  37048. name: options2.name != void 0 ? options2.name : _self._sketchEntityName,
  37049. position: options2.position,
  37050. point: {
  37051. show: true,
  37052. pixelSize: size,
  37053. heightReference: Cesium.HeightReference.NONE,
  37054. color: _self._toColorFromArray(color2),
  37055. outlineWidth,
  37056. outlineColor: _self._toColorFromArray(outlineColor),
  37057. disableDepthTestDistance: 15e11
  37058. }
  37059. });
  37060. pointEntity.setEditType(options2.editType);
  37061. _self._entities.add(pointEntity);
  37062. },
  37063. _createEditNodePoint(positions, startIndex) {
  37064. this._sketchEditEntityNodeName = "SketchEditEntityNode";
  37065. let _self = this;
  37066. this._sketchEditPoints = [];
  37067. let strIndex = startIndex === void 0 ? 0 : startIndex;
  37068. for (let i2 = 0; i2 < positions.length; i2++) {
  37069. let position2 = positions[i2];
  37070. this._sketchEditPoints.push(position2.clone());
  37071. if (i2 < strIndex)
  37072. continue;
  37073. if (i2 !== 0 && position2.x === positions[0].x && position2.y === positions[0].y && position2.z === positions[0].z) {
  37074. continue;
  37075. }
  37076. let geoPoint = this._cartesian3ToGeo(position2);
  37077. let height2 = this._queryHeightFromGeo(geoPoint.longitude, geoPoint.latitude);
  37078. let newPosition = Cesium.Cartesian3.fromDegrees(geoPoint.longitude, geoPoint.latitude, height2);
  37079. _self._createEditPointEntity({
  37080. name: _self._sketchEditEntityNodeName,
  37081. position: newPosition,
  37082. size: 12,
  37083. color: [0, 0, 255, 1],
  37084. editType: {
  37085. type: DrawTools.EditPointType.Node,
  37086. index: i2
  37087. }
  37088. });
  37089. }
  37090. },
  37091. _createEditSpatialPoint(positions, heights, startIndex) {
  37092. return;
  37093. },
  37094. _createEditMiddlePoint(positions, isSpatial = false) {
  37095. this._sketchEditEntityMiddleName = "SketchEditEntityMiddle";
  37096. let _self = this;
  37097. if (!isSpatial) {
  37098. for (let i2 = 1; i2 < positions.length; i2++) {
  37099. let p1 = positions[i2 - 1];
  37100. let p2 = positions[i2];
  37101. let pCenter = this._calculateMiddlePoint(p1, p2);
  37102. this._createEditPointEntity({
  37103. name: _self._sketchEditEntityMiddleName,
  37104. position: pCenter,
  37105. size: 9,
  37106. color: [255, 255, 0, 1],
  37107. editType: {
  37108. type: DrawTools.EditPointType.Middle,
  37109. index: i2
  37110. }
  37111. });
  37112. }
  37113. } else {
  37114. for (let i2 = 1; i2 < positions.length; i2++) {
  37115. let p1 = positions[i2 - 1];
  37116. let p2 = positions[i2];
  37117. let pCenter = {
  37118. x: (p1.x + p2.x) / 2,
  37119. y: (p1.y + p2.y) / 2,
  37120. z: (p1.z + p2.z) / 2
  37121. };
  37122. this._createEditPointEntity({
  37123. name: _self._sketchEditEntityMiddleName,
  37124. position: pCenter,
  37125. size: 9,
  37126. color: [255, 255, 0, 1],
  37127. editType: {
  37128. type: DrawTools.EditPointType.Middle,
  37129. index: i2
  37130. }
  37131. });
  37132. }
  37133. }
  37134. },
  37135. _createEditCenterPoint(position2) {
  37136. let _self = this;
  37137. this._sketchEditEntityCenterName = "SketchEditEntityCenter";
  37138. this._createEditPointEntity({
  37139. name: _self._sketchEditEntityCenterName,
  37140. position: position2,
  37141. size: 12,
  37142. color: [0, 255, 0, 0.1],
  37143. outlineWidth: 2,
  37144. outlineColor: [255, 255, 255, 1],
  37145. editType: {
  37146. type: DrawTools.EditPointType.Center
  37147. }
  37148. });
  37149. if (this._editEntity != void 0) {
  37150. this._editEntity.position = position2.clone();
  37151. }
  37152. },
  37153. _createEditOdlineEndPoint(position2, joinEntity) {
  37154. this._sketchEditEntityNodeName = "SketchEditEntityNode";
  37155. let _self = this;
  37156. let geoPoint = this._cartesian3ToGeo(position2);
  37157. let height2 = this._queryHeightFromGeo(geoPoint.longitude, geoPoint.latitude);
  37158. Cesium.Cartesian3.fromDegrees(geoPoint.longitude, geoPoint.latitude, height2);
  37159. _self._createEditPointEntity({
  37160. name: _self._sketchEditEntityNodeName,
  37161. position: position2,
  37162. size: 12,
  37163. color: [0, 0, 255, 1],
  37164. editType: {
  37165. type: DrawTools.EditPointType.OdlineEndNode,
  37166. joinEntity
  37167. }
  37168. });
  37169. },
  37170. _createEditOdlineStartPoint(position2, joinEntity) {
  37171. this._sketchEditEntityNodeName = "SketchEditEntityNode";
  37172. let _self = this;
  37173. let geoPoint = this._cartesian3ToGeo(position2);
  37174. let height2 = this._queryHeightFromGeo(geoPoint.longitude, geoPoint.latitude);
  37175. Cesium.Cartesian3.fromDegrees(geoPoint.longitude, geoPoint.latitude, height2);
  37176. _self._createEditPointEntity({
  37177. name: _self._sketchEditEntityNodeName,
  37178. position: position2,
  37179. size: 12,
  37180. color: [0, 255, 0, 0.6],
  37181. editType: {
  37182. type: DrawTools.EditPointType.OdlineStrartNode,
  37183. joinEntity
  37184. }
  37185. });
  37186. },
  37187. _calculateMiddlePoint(position1, position2) {
  37188. let g1 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position1);
  37189. let g2 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  37190. let pt1 = [Cesium.Math.toDegrees(g1.longitude), Cesium.Math.toDegrees(g1.latitude)];
  37191. let pt2 = [Cesium.Math.toDegrees(g2.longitude), Cesium.Math.toDegrees(g2.latitude)];
  37192. let tpt1 = point(pt1);
  37193. let tpt2 = point(pt2);
  37194. let midpoint$1 = midpoint(tpt1, tpt2).geometry.coordinates;
  37195. let height2 = this._queryHeightFromGeo(midpoint$1[0], midpoint$1[1]);
  37196. let result = Cesium.Cartesian3.fromDegrees(midpoint$1[0], midpoint$1[1], height2);
  37197. return result;
  37198. },
  37199. _cartesian3ToGeo: function(position2) {
  37200. let g = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  37201. return {
  37202. longitude: Cesium.Math.toDegrees(g.longitude),
  37203. latitude: Cesium.Math.toDegrees(g.latitude),
  37204. height: g.height
  37205. };
  37206. },
  37207. _queryHeightFromGeo: function(longitude, latitude) {
  37208. if (longitude === void 0 || latitude === void 0 || typeof longitude != "number" || typeof latitude != "number")
  37209. return 0;
  37210. let rLng = Cesium.Math.toRadians(longitude);
  37211. let rLat = Cesium.Math.toRadians(latitude);
  37212. let cartographic = new Cesium.Cartographic(rLng, rLat);
  37213. let noQueryEntities = [];
  37214. for (let i2 = 0; i2 < this._entities.values.length; i2++) {
  37215. if (this._entities.values[i2].name === this._sketchEntityName) {
  37216. noQueryEntities.push(this._entities.values[i2]);
  37217. }
  37218. }
  37219. let height2 = this._viewer.scene.sampleHeight(cartographic, noQueryEntities);
  37220. if (height2 === void 0)
  37221. return 0;
  37222. else
  37223. return height2;
  37224. },
  37225. _queryHeightFromGeoAsync: function(longitude, latitude, callComplete) {
  37226. if (longitude === void 0 || latitude === void 0 || typeof longitude != "number" || typeof latitude != "number")
  37227. return 0;
  37228. let rLng = Cesium.Math.toRadians(longitude);
  37229. let rLat = Cesium.Math.toRadians(latitude);
  37230. let cartographic = new Cesium.Cartographic(rLng, rLat);
  37231. let promise = this._viewer.scene.sampleHeightMostDetailed([cartographic]);
  37232. promise.then(function(updatedPositions) {
  37233. if (callComplete)
  37234. callComplete(updatedPositions[0].height);
  37235. });
  37236. },
  37237. _clearEditPoint: function() {
  37238. if (this._sketchEditHandler != void 0) {
  37239. this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOWN);
  37240. this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_UP);
  37241. this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  37242. }
  37243. this._sketchEditPoints = [];
  37244. this._sketchEditIndex = void 0;
  37245. this._editEntity = void 0;
  37246. this._removeEntityByName(this._sketchEditEntityNodeName);
  37247. this._removeEntityByName(this._sketchEditEntityMiddleName);
  37248. this._removeEntityByName(this._sketchEditEntityCenterName);
  37249. this._removeEntityByName(this._sketchEditEntitySpatialName);
  37250. }
  37251. });
  37252. Object.assign(DrawTools.prototype, {
  37253. _checkColor: function(color2) {
  37254. if (color2 === void 0 || color2 === null)
  37255. return false;
  37256. if (typeof color2 != "number")
  37257. return false;
  37258. let intColor = parseInt(color2);
  37259. if (intColor < 0 || intColor > 255)
  37260. return false;
  37261. return true;
  37262. },
  37263. _checkAlpha: function(alpha) {
  37264. if (alpha === void 0 || alpha === null)
  37265. return false;
  37266. if (typeof alpha != "number")
  37267. return false;
  37268. let floatAlpha = parseFloat(alpha);
  37269. if (floatAlpha < 0 || floatAlpha > 1)
  37270. return false;
  37271. return true;
  37272. },
  37273. _checkColorAndAlpha: function(colorAndAlpah) {
  37274. let setColor = void 0;
  37275. if (!colorAndAlpah || colorAndAlpah.length === void 0 || colorAndAlpah.length === 0)
  37276. return void 0;
  37277. if (colorAndAlpah.length === 1 && this._checkColor(colorAndAlpah[0])) {
  37278. setColor = [colorAndAlpah[0], 0, 0, 1];
  37279. } else if (colorAndAlpah.length === 2 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
  37280. colorAndAlpah[1]
  37281. )) {
  37282. setColor = [colorAndAlpah[0], colorAndAlpah[1], 0, 1];
  37283. } else if (colorAndAlpah.length === 3 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
  37284. colorAndAlpah[1]
  37285. ) && this._checkColor(colorAndAlpah[2])) {
  37286. setColor = [colorAndAlpah[0], colorAndAlpah[1], colorAndAlpah[2], 1];
  37287. } else if (colorAndAlpah.length === 4 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
  37288. colorAndAlpah[1]
  37289. ) && this._checkColor(colorAndAlpah[2]) && this._checkAlpha(
  37290. colorAndAlpah[3]
  37291. )) {
  37292. setColor = [colorAndAlpah[0], colorAndAlpah[1], colorAndAlpah[2], colorAndAlpah[3]];
  37293. }
  37294. return setColor;
  37295. }
  37296. });
  37297. Object.assign(DrawTools.prototype, {
  37298. _initOperationDom: function() {
  37299. let _self = this;
  37300. this._operationDomId = "drawButtonDiv";
  37301. this._operationDom = document.getElementById(this._operationDomId);
  37302. this._removeOperationDom();
  37303. this._createOperationMainDom();
  37304. if ([
  37305. DrawTools.DrawType.Rectangle,
  37306. DrawTools.DrawType.Circle,
  37307. DrawTools.DrawType.DynamicCircle,
  37308. DrawTools.DrawType.VideoWall
  37309. ].indexOf(this._drawType) === -1) {
  37310. let btnUndo = this._createOperationUndoButtonDom();
  37311. btnUndo.onclick = function() {
  37312. _self._operationExecuteEvent(Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  37313. };
  37314. }
  37315. if ([
  37316. DrawTools.DrawType.Rectangle,
  37317. DrawTools.DrawType.Circle,
  37318. DrawTools.DrawType.DynamicCircle,
  37319. DrawTools.DrawType.VideoWall
  37320. ] === -1) {
  37321. let btnCompletion = this._crateOperationCompletionButtonDom();
  37322. btnCompletion.onclick = function() {
  37323. _self._operationExecuteEvent(Cesium.ScreenSpaceEventType.LEFT_CLICK);
  37324. };
  37325. } else {
  37326. let btnCompletion = this._crateOperationCompletionButtonDom();
  37327. btnCompletion.onclick = function() {
  37328. _self._operationExecuteEvent(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  37329. };
  37330. }
  37331. },
  37332. _operationExecuteEvent(eventType) {
  37333. if (this._drawEventHandler !== void 0 && this._drawEventHandler.isDestroyed() === false) {
  37334. let event2 = {
  37335. position: new Cesium.Cartesian2(300, 300)
  37336. };
  37337. let action = this._drawEventHandler.getInputAction(eventType);
  37338. action(event2);
  37339. }
  37340. },
  37341. _createOperationMainDom: function() {
  37342. this._operationDom = document.createElement("div");
  37343. this._operationDom.id = this._operationDomId;
  37344. this._operationDom.style.width = "80px";
  37345. this._operationDom.style.backgroundColor = "rgba(5, 45, 155, 0.7)";
  37346. this._operationDom.style.borderRadius = "5px";
  37347. this._operationDom.style.display = "flex";
  37348. this._operationDom.style.flexDirection = "column";
  37349. this._operationDom.style.padding = "8px";
  37350. this._operationDom.style.justifyContent = "center";
  37351. this._operationDom.style.position = "absolute";
  37352. this._operationDom.style.bottom = "150px";
  37353. this._operationDom.style.right = "10px";
  37354. document.body.appendChild(this._operationDom);
  37355. },
  37356. _createOperationUndoButtonDom: function() {
  37357. let btnUndo = document.createElement("button");
  37358. btnUndo.id = "btnDrawBackout";
  37359. btnUndo.style.height = "30px";
  37360. btnUndo.style.marginBottom = "8px";
  37361. btnUndo.style.backgroundColor = "rgba(52, 137, 255, 1.0)";
  37362. btnUndo.style.color = "rgb(255, 255, 255)";
  37363. btnUndo.style.border = "0px solid red";
  37364. btnUndo.style.borderRadius = "5px";
  37365. btnUndo.innerHTML = "\u56DE\u9000";
  37366. btnUndo.style.fontSize = "13px";
  37367. btnUndo.style.cursor = "pointer";
  37368. this._operationDom.appendChild(btnUndo);
  37369. return btnUndo;
  37370. },
  37371. _crateOperationCompletionButtonDom: function() {
  37372. let btnCompletion = document.createElement("button");
  37373. btnCompletion.id = "btnDrawComplete";
  37374. btnCompletion.style.height = "30px";
  37375. btnCompletion.style.backgroundColor = "rgba(88, 185, 45, 1.0)";
  37376. btnCompletion.style.color = "rgb(255, 255, 255)";
  37377. btnCompletion.style.border = "0px solid red";
  37378. btnCompletion.style.borderRadius = "5px";
  37379. btnCompletion.innerHTML = "\u5B8C\u6210";
  37380. btnCompletion.style.fontSize = "13px";
  37381. btnCompletion.style.cursor = "pointer";
  37382. this._operationDom.appendChild(btnCompletion);
  37383. return btnCompletion;
  37384. },
  37385. _removeOperationDom: function() {
  37386. if (this._operationDom !== null && this._operationDom !== void 0) {
  37387. document.body.removeChild(this._operationDom);
  37388. this._operationDom = void 0;
  37389. }
  37390. },
  37391. _createOperationDom: function() {
  37392. if (this._isRuntimeApp()) {
  37393. this._initOperationDom();
  37394. }
  37395. }
  37396. });
  37397. Object.assign(DrawTools.prototype, {
  37398. _openPropertyEditDialog: function(params, callEdit, callRemove) {
  37399. this._editPropertyDialogDomId = "dialog-property-dom";
  37400. this._registerDOMPropertyEdit = "dialog-edit-property";
  37401. let PropertyEditComponent = customElements.get(this._registerDOMPropertyEdit);
  37402. if (PropertyEditComponent === void 0) {
  37403. PropertyEditComponent = defineCustomElement(DialogEditProperty$2);
  37404. customElements.define(this._registerDOMPropertyEdit, PropertyEditComponent);
  37405. }
  37406. this._closePropertyEditDialog();
  37407. let dialogPropertyElement = new PropertyEditComponent({
  37408. params
  37409. });
  37410. dialogPropertyElement.id = this._editPropertyDialogDomId;
  37411. dialogPropertyElement.showDialog = true;
  37412. document.body.appendChild(dialogPropertyElement);
  37413. dialogPropertyElement.addEventListener(
  37414. "submit",
  37415. (e) => {
  37416. if (callEdit)
  37417. callEdit(e.detail[0]);
  37418. },
  37419. false
  37420. );
  37421. dialogPropertyElement.addEventListener(
  37422. "remove",
  37423. (e) => {
  37424. if (callRemove)
  37425. callRemove();
  37426. },
  37427. false
  37428. );
  37429. },
  37430. _closePropertyEditDialog() {
  37431. let dom2 = document.getElementById(this._editPropertyDialogDomId);
  37432. if (dom2 !== null && dom2 !== void 0) {
  37433. document.body.removeChild(dom2);
  37434. }
  37435. }
  37436. });
  37437. DrawTools.DrawType = Object.freeze({
  37438. Point: "point",
  37439. Polyline: "polyline",
  37440. ArrowPolyline: "arrowPolyline",
  37441. DynamicPolyline: "dynamicPolyline",
  37442. GrowPolyline: "\u53D1\u5149\u7EBF",
  37443. OutlinePolyline: "outlinePolyline",
  37444. OdLine: "odLine",
  37445. Polygon: "polygon",
  37446. SpatialLine: "spatialLine",
  37447. Circle: "circle",
  37448. DynamicCircle: "dynamicCircle",
  37449. Rectangle: "rectangle",
  37450. NormalWall: "normalWall",
  37451. DynamicWall: "dynamicWall",
  37452. House: "house",
  37453. TextWall: "text",
  37454. VideoWall: "videoWall"
  37455. });
  37456. DrawTools.IconType = Object.freeze({
  37457. Normal: "normal",
  37458. Blue: "blue",
  37459. Green: "green",
  37460. Violet: "violter"
  37461. });
  37462. DrawTools.EditPointType = Object.freeze({
  37463. Node: "node",
  37464. Middle: "middle",
  37465. Center: "center",
  37466. CoordinateAxis: "coordinateAxis",
  37467. OdlineStrartNode: "odlineStartNode",
  37468. OdlineEndNode: "odlineEndNode"
  37469. });
  37470. DrawTools.WallType = Object.freeze({
  37471. ColorWall: "colorWall",
  37472. DynamicWall: "dynamicWall",
  37473. TextWall: "textWall"
  37474. });
  37475. DrawTools.CircleType = Object.freeze({
  37476. ColorCircle: "colorCircle",
  37477. DynamicCircle: "dynamicCircle"
  37478. });
  37479. DrawTools.PolylineType = Object.freeze({
  37480. NormalPolyline: "normalPolyline",
  37481. ArrowsPolyline: "arrowsPolyline",
  37482. DynamicPolyline: "dynamicPolyline",
  37483. DottedPolyline: "dottedPolyline",
  37484. GrowPolyline: "growPolyline",
  37485. OutlinePolyline: "outlinePolyline"
  37486. });
  37487. DrawTools.PolygonType = Object.freeze({
  37488. NormalPolygon: "normalPolygon",
  37489. HousePolygon: "housePolygon"
  37490. });
  37491. DrawTools.RuntimeEnvironment = Object.freeze({
  37492. App: "app",
  37493. Web: "web"
  37494. });
  37495. class WallMaterialProperty {
  37496. constructor(options2) {
  37497. this._viewer = options2.viewer;
  37498. this._definitionChanged = new Cesium.Event();
  37499. this._color = void 0;
  37500. this.color = options2.color || Cesium.Color.BLUE;
  37501. this.duration = options2.duration || 1e3;
  37502. this.trailImage = options2.trailImage;
  37503. this._time = new Date().getTime();
  37504. this._materialTypeName = "WallMaterial" + this._guid();
  37505. this._param = {
  37506. color: this.color._value.toCssColorString(),
  37507. image: this.trailImage,
  37508. duration: this.duration,
  37509. count: 0,
  37510. direction: "",
  37511. order: ""
  37512. };
  37513. Cesium.Material._materialCache.addMaterial(this._materialTypeName, {
  37514. fabric: {
  37515. type: this._materialTypeName,
  37516. uniforms: {
  37517. time: -20,
  37518. color: new Cesium.Color(1, 0, 0, 0.5),
  37519. image: options2.trailImage
  37520. },
  37521. source: this._getDirectionWallShader(options2.param)
  37522. },
  37523. translucent: function(material) {
  37524. return true;
  37525. }
  37526. });
  37527. }
  37528. _guid() {
  37529. function S4() {
  37530. return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
  37531. }
  37532. return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
  37533. }
  37534. getType(time) {
  37535. return this._materialTypeName;
  37536. }
  37537. getValue(time, result) {
  37538. if (!Cesium.defined(result)) {
  37539. result = {};
  37540. }
  37541. result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.BLUE, result.color);
  37542. result.image = this.trailImage;
  37543. if (this.duration) {
  37544. result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
  37545. }
  37546. this._viewer.scene.requestRender();
  37547. return result;
  37548. }
  37549. equals(other) {
  37550. return this === other || other instanceof WallMaterialProperty && Cesium.Property.equals(this._color, other._color) && other._param.order === this._param.order && other._param.count === this._param.count && other._param.direction === this._param.direction && other.duration === this.duration;
  37551. }
  37552. _getDirectionWallShader(options2) {
  37553. let op = Cesium.defaultValue(options2, {});
  37554. let count = op.count !== void 0 && typeof op.count === "number" && op.count > 0 ? op.count : 1;
  37555. let direction = op.direction === "horizontal" ? "horizontal" : "vertical";
  37556. let order = op.order === "+" ? "+" : "-";
  37557. this._param.count = count;
  37558. this._param.direction = direction;
  37559. this._param.order = order;
  37560. let materail = "";
  37561. materail += "czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n";
  37562. if (direction === "vertical") {
  37563. materail += " vec4 colorImage = texture2D(image,vec2(st.s,fract(float(" + count + ")*st.t " + order + " time)));\n";
  37564. } else if (direction === "horizontal") {
  37565. materail += " vec4 colorImage = texture2D(image, vec2(fract(float(" + count + ")*st.s " + order + " time), st.t));\n";
  37566. }
  37567. materail += " vec4 fragColor;\n fragColor.rgb = color.rgb / 1.0;\n fragColor = czm_gammaCorrect(fragColor);\n material.alpha = colorImage.a * color.a;\n material.diffuse = color.rgb;\n material.emission = fragColor.rgb;\n return material;\n}";
  37568. return materail;
  37569. }
  37570. }
  37571. Object.defineProperties(WallMaterialProperty.prototype, {
  37572. isConstant: {
  37573. get: function() {
  37574. return false;
  37575. }
  37576. },
  37577. definitionChanged: {
  37578. get: function() {
  37579. return this._definitionChanged;
  37580. }
  37581. },
  37582. color: Cesium.createPropertyDescriptor("color")
  37583. });
  37584. class CircleMaterialProperty {
  37585. constructor(options2) {
  37586. this._viewer = options2.viewer;
  37587. this._definitionChanged = new Cesium.Event();
  37588. this._color = void 0;
  37589. this.color = options2.color || Cesium.Color.BLUE;
  37590. this.count = options2.count || 1;
  37591. this.duration = options2.duration || 1e3;
  37592. this._time = new Date().getTime();
  37593. this._materialTypeName = "jtCircleMaterial";
  37594. this._param = {
  37595. color: this.color._value.toCssColorString(),
  37596. duration: this.duration,
  37597. count: this.count
  37598. };
  37599. Cesium.Material._materialCache.addMaterial(this._materialTypeName, {
  37600. fabric: {
  37601. type: this._materialTypeName,
  37602. uniforms: {
  37603. time: 0,
  37604. color: new Cesium.Color(1, 0, 0, 0.5),
  37605. count: 1
  37606. },
  37607. source: this._getCircleMaterial()
  37608. },
  37609. translucent: function(material) {
  37610. return true;
  37611. }
  37612. });
  37613. }
  37614. _getCircleMaterial() {
  37615. let circleMaterial = "czm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n material.diffuse = 1.5 * color.rgb;\n vec2 st = materialInput.st;\n vec3 str = materialInput.str;\n float dis = distance(st, vec2(0.5, 0.5));\n float per = fract(time);\n if (abs(str.z) > 0.001)\n {\n //\u7740\u8272\u5668\u6E32\u67D3\u505C\u6B62\uFF0C\u4E0D\u5728\u7ED8\u5236\u5185\u5BB9 \n discard;\n }\n if (dis > 0.5)\n {\n //\u8D85\u51FA\u534A\u5F84\u8303\u56F4\u65F6\uFF0C\u7740\u8272\u5668\u6E32\u67D3\u505C\u6B62 \n discard;\n } else {\n //\u628A\u534A\u5F84\u5206\u6210count\u4EFD\uFF0C\u6BCF\u4E24\u4EFD\u4E4B\u95F4\u7684\u95F4\u9694\u8DDD\u79BB \n float perDis = 0.5 / count;\n float disNum;\n float bl = 0.0;\n //\u5FAA\u73AF\uFF0C\u6700\u591A999\u4E2A\u73AF \n for (int i = 0; i <= 999; i++)\n {\n //\u5224\u65AD\u662F\u5426\u5C5E\u4E8E\u6570\u91CF\u5185\u7684\u73AF \n if (float(i) <= count)\n {\n disNum = perDis * float(i) - dis + per / count;\n if (disNum > 0.0)\n {\n if (disNum < perDis)\n {\n bl = 1.0 - disNum / perDis;\n } else if (disNum - perDis < perDis) {\n bl = 1.0 - abs(1.0 - disNum / perDis);\n }\n material.alpha = color.a * pow(bl, 3.0);\n }\n }\n }\n }\n return material;\n}\n";
  37616. return circleMaterial;
  37617. }
  37618. }
  37619. Object.assign(CircleMaterialProperty.prototype, {
  37620. getType: function(time) {
  37621. return this._materialTypeName;
  37622. },
  37623. getValue: function(time, result) {
  37624. if (!Cesium.defined(result)) {
  37625. result = {};
  37626. }
  37627. result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.BLUE, result.color);
  37628. result.count = this.count;
  37629. if (this.duration) {
  37630. result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
  37631. }
  37632. this._viewer.scene.requestRender();
  37633. return result;
  37634. },
  37635. equals: function(other) {
  37636. return this === other || other instanceof CircleMaterialProperty && Cesium.Property.equals(this._color, other._color);
  37637. }
  37638. });
  37639. Object.defineProperties(CircleMaterialProperty.prototype, {
  37640. isConstant: {
  37641. get: function() {
  37642. return false;
  37643. }
  37644. },
  37645. definitionChanged: {
  37646. get: function() {
  37647. return this._definitionChanged;
  37648. }
  37649. },
  37650. color: Cesium.createPropertyDescriptor("color")
  37651. });
  37652. const _checkAppOrWeb = function() {
  37653. if (window.navigator.userAgent.match(
  37654. /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
  37655. )) {
  37656. return "App";
  37657. } else {
  37658. return "Web";
  37659. }
  37660. };
  37661. const isRuntimeApp = function() {
  37662. if (_checkAppOrWeb() === "App") {
  37663. return true;
  37664. }
  37665. return false;
  37666. };
  37667. const isRuntimeWeb = function() {
  37668. if (_checkAppOrWeb() === "Web") {
  37669. return true;
  37670. }
  37671. return false;
  37672. };
  37673. function createOperationMainDom() {
  37674. let buttonDiv = document.createElement("div");
  37675. buttonDiv.id = "drawButtonDiv";
  37676. buttonDiv.style.width = "80px";
  37677. buttonDiv.style.backgroundColor = "rgba(5, 45, 155, 0.7)";
  37678. buttonDiv.style.borderRadius = "5px";
  37679. buttonDiv.style.display = "flex";
  37680. buttonDiv.style.flexDirection = "column";
  37681. buttonDiv.style.padding = "8px";
  37682. buttonDiv.style.justifyContent = "center";
  37683. buttonDiv.style.position = "absolute";
  37684. buttonDiv.style.bottom = "150px";
  37685. buttonDiv.style.right = "10px";
  37686. let btnUndo = document.createElement("button");
  37687. btnUndo.id = "btnDrawBackout";
  37688. btnUndo.style.height = "30px";
  37689. btnUndo.style.marginBottom = "8px";
  37690. btnUndo.style.backgroundColor = "rgba(52, 137, 255, 1.0)";
  37691. btnUndo.style.color = "rgb(255, 255, 255)";
  37692. btnUndo.style.border = "0px solid red";
  37693. btnUndo.style.borderRadius = "5px";
  37694. btnUndo.innerHTML = "\u56DE\u9000";
  37695. btnUndo.style.fontSize = "13px";
  37696. btnUndo.style.cursor = "pointer";
  37697. buttonDiv.appendChild(btnUndo);
  37698. let btnCompletion = document.createElement("button");
  37699. btnCompletion.id = "btnDrawComplete";
  37700. btnCompletion.style.height = "30px";
  37701. btnCompletion.style.backgroundColor = "rgba(88, 185, 45, 1.0)";
  37702. btnCompletion.style.color = "rgb(255, 255, 255)";
  37703. btnCompletion.style.border = "0px solid red";
  37704. btnCompletion.style.borderRadius = "5px";
  37705. btnCompletion.innerHTML = "\u5B8C\u6210";
  37706. btnCompletion.style.fontSize = "13px";
  37707. btnCompletion.style.cursor = "pointer";
  37708. buttonDiv.appendChild(btnCompletion);
  37709. document.body.appendChild(buttonDiv);
  37710. }
  37711. function showTooltipMessage(message) {
  37712. let msgMainDom = document.getElementById("messageMainDom");
  37713. if (msgMainDom !== null && msgMainDom !== void 0) {
  37714. document.body.removeChild(msgMainDom);
  37715. }
  37716. msgMainDom = document.createElement("div");
  37717. msgMainDom.style.width = "30%";
  37718. msgMainDom.style.backgroundColor = "rgba(237, 248, 230, 1.0)";
  37719. msgMainDom.style.height = "45px";
  37720. msgMainDom.style.border = "solid 2px rgb(219, 241, 208)";
  37721. msgMainDom.style.borderRadius = "8px";
  37722. msgMainDom.style.display = "flex";
  37723. msgMainDom.style.alignItems = "center";
  37724. msgMainDom.style.paddingLeft = "10px";
  37725. msgMainDom.style.color = "rgb(91, 188, 48)";
  37726. msgMainDom.style.fontSize = "14px";
  37727. msgMainDom.style.fontWeight = "600";
  37728. msgMainDom.style.position = "absolute";
  37729. msgMainDom.style.left = "35%";
  37730. msgMainDom.style.transition = "transform 1s";
  37731. msgMainDom.style.transform = "translateY(-90px)";
  37732. msgMainDom.style.top = "0px";
  37733. msgMainDom.style.zIndex = 1e3;
  37734. document.body.appendChild(msgMainDom);
  37735. let strHtml = "";
  37736. strHtml += "<div style='";
  37737. strHtml += "background-color: rgb(88, 185, 45);";
  37738. strHtml += "color: rgb(255, 255, 255);";
  37739. strHtml += "height: 24px;";
  37740. strHtml += "width: 24px;";
  37741. strHtml += "border-radius: 20px;";
  37742. strHtml += "display: flex;";
  37743. strHtml += "justify-content: center;";
  37744. strHtml += "align-items: center;";
  37745. strHtml += "font-size: 14px;";
  37746. strHtml += "margin-right: 18px;";
  37747. strHtml += "'>&#10003</div>";
  37748. strHtml += "<div>" + message + "</div>";
  37749. msgMainDom.innerHTML = strHtml;
  37750. msgMainDom.addEventListener("transitionend", function() {
  37751. setTimeout(function() {
  37752. document.body.removeChild(msgMainDom);
  37753. }, 1e3);
  37754. }, false);
  37755. setTimeout(function() {
  37756. msgMainDom.style.transform = "translateY(50px)";
  37757. }, 100);
  37758. }
  37759. var RuntimeEnvironment = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  37760. __proto__: null,
  37761. isRuntimeApp,
  37762. isRuntimeWeb,
  37763. createOperationMainDom,
  37764. showTooltipMessage
  37765. }, Symbol.toStringTag, { value: "Module" }));
  37766. class DrawStraightArrow {
  37767. constructor(arg) {
  37768. this.viewer = arg.viewer;
  37769. this.Cesium = arg.Cesium;
  37770. this.floatingPoint = null;
  37771. this._straightArrow = null;
  37772. this._straightArrowLast = null;
  37773. this._positions = [];
  37774. this._entities_point = [];
  37775. this._entities_straightArrow = [];
  37776. this._straightArrowData = null;
  37777. this.DrawStartEvent = new Cesium.Event();
  37778. this.DrawEndEvent = new Cesium.Event();
  37779. this._tooltip = createTooltip(this.viewer.container);
  37780. this._param = {
  37781. id: "DrawStraightArrow",
  37782. polygonColor: "rgba(0,255,0,0.5)",
  37783. outlineColor: "rgba(255, 255, 255, 1)",
  37784. outlineWidth: 1
  37785. };
  37786. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  37787. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  37788. }
  37789. get straightArrow() {
  37790. return this._straightArrowLast;
  37791. }
  37792. getData() {
  37793. return this._straightArrowData;
  37794. }
  37795. computePosition(data) {
  37796. var $this = this;
  37797. var length = data.length;
  37798. var p1 = data[0];
  37799. var p2 = data[length - 1];
  37800. var firstPoint = $this.cartesianToLatlng(p1);
  37801. var endPoints = $this.cartesianToLatlng(p2);
  37802. var arrow = [];
  37803. var res = $this.fineArrow([firstPoint[0], firstPoint[1]], [endPoints[0], endPoints[1]]);
  37804. for (var i2 = 0; i2 < res.length; i2++) {
  37805. var cart3 = new $this.Cesium.Cartesian3(res[i2].x, res[i2].y, res[i2].z);
  37806. arrow.push(cart3);
  37807. }
  37808. $this._straightArrowData = [firstPoint, endPoints];
  37809. return new $this.Cesium.PolygonHierarchy(arrow);
  37810. }
  37811. addload(data) {
  37812. var $this = this;
  37813. if (data.length < 2) {
  37814. return null;
  37815. }
  37816. var length = data.length;
  37817. var p1 = data[0];
  37818. var p2 = data[length - 1];
  37819. var arrow = [];
  37820. var res = $this.fineArrow([p1[0], p1[1]], [p2[0], p2[1]]);
  37821. for (var i2 = 0; i2 < res.length; i2++) {
  37822. var cart3 = new $this.Cesium.Cartesian3(res[i2].x, res[i2].y, res[i2].z);
  37823. arrow.push(cart3);
  37824. }
  37825. var arrowEntity = $this.viewer.entities.add({
  37826. Type: "DrawStraightArrow",
  37827. Position: data,
  37828. id: data.id || $this.objId,
  37829. polygon: {
  37830. hierarchy: new $this.Cesium.PolygonHierarchy(arrow),
  37831. show: true,
  37832. fill: true,
  37833. clampToGround: true,
  37834. material: $this.polygonMaterial
  37835. }
  37836. });
  37837. return arrowEntity;
  37838. }
  37839. startCreate(drawType) {
  37840. if (isRuntimeApp()) {
  37841. showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  37842. }
  37843. var $this = this;
  37844. this.drawType = drawType;
  37845. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  37846. this.handler.setInputAction(function(evt) {
  37847. if (isRuntimeApp()) {
  37848. var cartesian = $this.getCatesian3FromPX(evt.position);
  37849. if (!cartesian) {
  37850. return;
  37851. }
  37852. $this.createPoint(cartesian);
  37853. $this._positions.push(cartesian);
  37854. if ($this._positions.length === 2) {
  37855. showTooltipMessage("\u70B9\u51FB\u5B8C\u6210\u6309\u94AE\uFF0C\u7ED3\u675F\u7ED8\u5236");
  37856. $this.destroy();
  37857. if (!$this.Cesium.defined($this._straightArrow)) {
  37858. $this._straightArrow = $this.createStraightArrow();
  37859. createOperationMainDom();
  37860. document.getElementById("btnDrawBackout").style.display = "none";
  37861. document.getElementById("btnDrawComplete").onclick = () => {
  37862. $this._straightArrowData = $this._positions.concat();
  37863. $this.viewer.entities.remove($this._straightArrow);
  37864. $this._straightArrow = null;
  37865. $this._positions = [];
  37866. var lnglatArr = [];
  37867. for (var i2 = 0; i2 < $this._straightArrowData.length; i2++) {
  37868. var lnglat = $this.cartesianToLatlng($this._straightArrowData[i2]);
  37869. lnglatArr.push(lnglat);
  37870. }
  37871. $this._straightArrowData = lnglatArr;
  37872. var straightArrow = $this.addload($this._straightArrowData);
  37873. $this._entities_straightArrow.push(straightArrow);
  37874. $this._straightArrowLast = straightArrow;
  37875. $this.clearPoint();
  37876. $this.destroy();
  37877. let buttonDiv = document.getElementById("drawButtonDiv");
  37878. if (buttonDiv) {
  37879. document.body.removeChild(buttonDiv);
  37880. }
  37881. };
  37882. }
  37883. }
  37884. } else {
  37885. clearTimeout($this._timer);
  37886. $this._timer = setTimeout(function() {
  37887. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u5355\u51FB");
  37888. var cartesian2 = $this.getCatesian3FromPX(evt.position);
  37889. if ($this._positions.length == 0) {
  37890. $this._positions.push(cartesian2.clone());
  37891. $this.floatingPoint = $this.createPoint(cartesian2);
  37892. $this._positions.push(cartesian2);
  37893. }
  37894. if (!$this._straightArrow) {
  37895. $this.createPoint(cartesian2);
  37896. } else {
  37897. $this._straightArrowData = $this._positions.concat();
  37898. $this.viewer.entities.remove($this._straightArrow);
  37899. $this._straightArrow = null;
  37900. $this._positions = [];
  37901. $this.floatingPoint.position.setValue(cartesian2);
  37902. var lnglatArr = [];
  37903. for (var i2 = 0; i2 < $this._straightArrowData.length; i2++) {
  37904. var lnglat = $this.cartesianToLatlng($this._straightArrowData[i2]);
  37905. lnglatArr.push(lnglat);
  37906. }
  37907. $this._straightArrowData = lnglatArr;
  37908. var straightArrow = $this.addload($this._straightArrowData);
  37909. $this._entities_straightArrow.push(straightArrow);
  37910. $this._straightArrowLast = straightArrow;
  37911. $this.clearPoint();
  37912. $this.destroy();
  37913. $this._tooltip.setVisible(false);
  37914. }
  37915. }, 200);
  37916. }
  37917. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  37918. this.handler.setInputAction(function(evt) {
  37919. if (isRuntimeApp())
  37920. return;
  37921. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  37922. if ($this._positions.length < 2)
  37923. return;
  37924. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u7ED3\u675F\u7ED8\u5236");
  37925. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  37926. if (!$this.Cesium.defined($this._straightArrow)) {
  37927. $this._straightArrow = $this.createStraightArrow();
  37928. }
  37929. $this.floatingPoint.position.setValue(cartesian);
  37930. if ($this._straightArrow) {
  37931. $this._positions.pop();
  37932. $this._positions.push(cartesian);
  37933. }
  37934. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  37935. }
  37936. createStraightArrow() {
  37937. var $this = this;
  37938. var arrowEntity = $this.viewer.entities.add({
  37939. polygon: {
  37940. hierarchy: new $this.Cesium.CallbackProperty(
  37941. function() {
  37942. var length = $this._positions.length;
  37943. var p1 = $this._positions[0];
  37944. var p2 = $this._positions[length - 1];
  37945. var firstPoint = $this.cartesianToLatlng(p1);
  37946. var endPoints = $this.cartesianToLatlng(p2);
  37947. var arrow = [];
  37948. var res = $this.fineArrow([firstPoint[0], firstPoint[1]], [endPoints[0], endPoints[1]]);
  37949. for (var i2 = 0; i2 < res.length; i2++) {
  37950. var cart3 = new $this.Cesium.Cartesian3(res[i2].x, res[i2].y, res[i2].z);
  37951. arrow.push(cart3);
  37952. }
  37953. return new $this.Cesium.PolygonHierarchy(arrow);
  37954. },
  37955. false
  37956. ),
  37957. show: true,
  37958. fill: true,
  37959. clampToGround: true,
  37960. material: $this.polygonMaterial
  37961. }
  37962. });
  37963. $this._entities_straightArrow.push(arrowEntity);
  37964. return arrowEntity;
  37965. }
  37966. createPoint(cartesian) {
  37967. var $this = this;
  37968. var point2 = this.viewer.entities.add({
  37969. position: cartesian,
  37970. point: {
  37971. pixelSize: 10,
  37972. color: $this.Cesium.Color.RED,
  37973. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  37974. }
  37975. });
  37976. $this._entities_point.push(point2);
  37977. return point2;
  37978. }
  37979. cartesianToLatlng(cartesian) {
  37980. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  37981. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  37982. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  37983. return [lng, lat];
  37984. }
  37985. destroy() {
  37986. if (this.handler) {
  37987. this.handler.destroy();
  37988. this.handler = null;
  37989. }
  37990. }
  37991. clearPoint() {
  37992. this.DrawEndEvent.raiseEvent(this._straightArrowLast, this._straightArrowData, this.drawType);
  37993. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  37994. this.viewer.entities.remove(this._entities_point[i2]);
  37995. }
  37996. this._entities_point = [];
  37997. }
  37998. clear() {
  37999. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  38000. this.viewer.entities.remove(this._entities_point[i2]);
  38001. }
  38002. for (var i2 = 0; i2 < this._entities_straightArrow.length; i2++) {
  38003. this.viewer.entities.remove(this._entities_straightArrow[i2]);
  38004. }
  38005. this.floatingPoint = null;
  38006. this._straightArrow = null;
  38007. this._straightArrowLast = null;
  38008. this._positions = [];
  38009. this._entities_point = [];
  38010. this._entities_straightArrow = [];
  38011. this._straightArrowData = null;
  38012. }
  38013. getCatesian3FromPX(px) {
  38014. var cartesian;
  38015. var ray = this.viewer.camera.getPickRay(px);
  38016. if (!ray)
  38017. return null;
  38018. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  38019. return cartesian;
  38020. }
  38021. fineArrowDefualParam() {
  38022. return {
  38023. tailWidthFactor: 0.15,
  38024. neckWidthFactor: 0.2,
  38025. headWidthFactor: 0.25,
  38026. headAngle: Math.PI / 8.5,
  38027. neckAngle: Math.PI / 13
  38028. };
  38029. }
  38030. fineArrow(tailPoint, headerPoint) {
  38031. var $this = this;
  38032. if (tailPoint.length < 2 || headerPoint.length < 2)
  38033. return;
  38034. let tailWidthFactor = $this.fineArrowDefualParam().tailWidthFactor;
  38035. let neckWidthFactor = $this.fineArrowDefualParam().neckWidthFactor;
  38036. let headWidthFactor = $this.fineArrowDefualParam().headWidthFactor;
  38037. let headAngle = $this.fineArrowDefualParam().headAngle;
  38038. let neckAngle = $this.fineArrowDefualParam().neckAngle;
  38039. var o = [];
  38040. o[0] = tailPoint;
  38041. o[1] = headerPoint;
  38042. var e = o[0], r2 = o[1], n = $this.getBaseLength(o), g = n * tailWidthFactor, i2 = n * neckWidthFactor, s = n * headWidthFactor, a = $this.getThirdPoint(r2, e, Math.PI / 2, g, true), l = $this.getThirdPoint(r2, e, Math.PI / 2, g, false), u = $this.getThirdPoint(e, r2, headAngle, s, false), c = $this.getThirdPoint(e, r2, headAngle, s, true), p = $this.getThirdPoint(e, r2, neckAngle, i2, false), h2 = $this.getThirdPoint(e, r2, neckAngle, i2, true), d2 = [];
  38043. d2.push(a[0], a[1], p[0], p[1], u[0], u[1], r2[0], r2[1], c[0], c[1], h2[0], h2[1], l[0], l[1], e[0], e[1]);
  38044. return $this.Cesium.Cartesian3.fromDegreesArray(d2);
  38045. }
  38046. getBaseLength(t2) {
  38047. return Math.pow(this.wholeDistance(t2), 0.99);
  38048. }
  38049. wholeDistance(t2) {
  38050. for (var o = 0, e = 0; e < t2.length - 1; e++)
  38051. o += this.distance(t2[e], t2[e + 1]);
  38052. return o;
  38053. }
  38054. distance(t2, o) {
  38055. return Math.sqrt(Math.pow(t2[0] - o[0], 2) + Math.pow(t2[1] - o[1], 2));
  38056. }
  38057. getThirdPoint(t2, o, e, r2, n) {
  38058. var g = this.getAzimuth(t2, o), i2 = n ? g + e : g - e, s = r2 * Math.cos(i2), a = r2 * Math.sin(i2);
  38059. return [o[0] + s, o[1] + a];
  38060. }
  38061. getAzimuth(t2, o) {
  38062. var e, r2 = Math.asin(Math.abs(o[1] - t2[1]) / this.distance(t2, o));
  38063. return o[1] >= t2[1] && o[0] >= t2[0] ? e = r2 + Math.PI : o[1] >= t2[1] && o[0] < t2[0] ? e = 2 * Math.PI - r2 : o[1] < t2[1] && o[0] < t2[0] ? e = r2 : o[1] < t2[1] && o[0] >= t2[0] && (e = Math.PI - r2), e;
  38064. }
  38065. }
  38066. class DrawAttackArrow {
  38067. constructor(arg) {
  38068. __publicField(this, "getAttackArrowBodyPoints", function(t2, o, e, r2) {
  38069. var $this = this;
  38070. for (var n = $this.wholeDistance(t2), g = $this.getBaseLength(t2), i2 = g * r2, s = $this.distance(o, e), a = (i2 - s) / 2, l = 0, u = [], c = [], p = 1; p < t2.length - 1; p++) {
  38071. var h2 = $this.getAngleOfThreePoints(t2[p - 1], t2[p], t2[p + 1]) / 2;
  38072. l += $this.distance(t2[p - 1], t2[p]);
  38073. var d2 = (i2 / 2 - l / n * a) / Math.sin(h2), f = $this.getThirdPoint(t2[p - 1], t2[p], Math.PI - h2, d2, true), E2 = $this.getThirdPoint(t2[p - 1], t2[p], h2, d2, false);
  38074. u.push(f), c.push(E2);
  38075. }
  38076. return u.concat(c);
  38077. });
  38078. __publicField(this, "getQBSplinePoints", function(t2) {
  38079. if (t2.length <= 2)
  38080. return t2;
  38081. var o = 2, e = [], r2 = t2.length - o - 1, y = 0;
  38082. e.push(t2[0]);
  38083. for (var n = 0; r2 >= n; n++)
  38084. for (var g = 0; 1 >= g; g += 0.05) {
  38085. for (var i2 = y = 0, s = 0; o >= s; s++) {
  38086. var a = this.getQuadricBSplineFactor(s, g);
  38087. i2 += a * t2[n + s][0], y += a * t2[n + s][1];
  38088. }
  38089. e.push([i2, y]);
  38090. }
  38091. return e.push(t2[t2.length - 1]), e;
  38092. });
  38093. __publicField(this, "getQuadricBSplineFactor", function(t2, o) {
  38094. return 0 == t2 ? Math.pow(o - 1, 2) / 2 : 1 == t2 ? (-2 * Math.pow(o, 2) + 2 * o + 1) / 2 : 2 == t2 ? Math.pow(o, 2) / 2 : 0;
  38095. });
  38096. __publicField(this, "array2Dto1D", function(array) {
  38097. var newArray = [];
  38098. array.forEach(function(elt) {
  38099. newArray.push(elt[0]);
  38100. newArray.push(elt[1]);
  38101. });
  38102. return newArray;
  38103. });
  38104. this.objId = Number(new Date().getTime() + "" + Number(Math.random() * 1e3).toFixed(0));
  38105. this.viewer = arg.viewer;
  38106. this.Cesium = arg.Cesium;
  38107. this.floatingPoint = null;
  38108. this._AttackArrow = null;
  38109. this._AttackArrowLast = null;
  38110. this._positions = [];
  38111. this._entities_point = [];
  38112. this._entities_AttackArrow = [];
  38113. this._AttackArrowData = null;
  38114. this.DrawStartEvent = new Cesium.Event();
  38115. this.DrawEndEvent = new Cesium.Event();
  38116. this._tooltip = createTooltip(this.viewer.container);
  38117. this._param = {
  38118. id: "DrawStraightArrow",
  38119. polygonColor: "rgba(0,255,0,0.5)",
  38120. outlineColor: "rgba(255, 255, 255, 1)",
  38121. outlineWidth: 1
  38122. };
  38123. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  38124. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  38125. }
  38126. get AttackArrow() {
  38127. return this._AttackArrowLast;
  38128. }
  38129. getData() {
  38130. return this._AttackArrowData;
  38131. }
  38132. addload(data) {
  38133. var $this = this;
  38134. if (data.length < 3) {
  38135. return null;
  38136. }
  38137. var res = $this.fineArrow(data);
  38138. var returnData = res.polygonalPoint;
  38139. var arrowEntity = $this.viewer.entities.add({
  38140. Type: "DrawAttackArrow",
  38141. Position: data,
  38142. id: data.id || $this.objId,
  38143. polygon: {
  38144. hierarchy: new $this.Cesium.PolygonHierarchy(returnData),
  38145. show: true,
  38146. fill: true,
  38147. clampToGround: true,
  38148. material: $this.polygonMaterial
  38149. }
  38150. });
  38151. return arrowEntity;
  38152. }
  38153. computePosition(data) {
  38154. let $this = this;
  38155. var lnglatArr = [];
  38156. for (var i2 = 0; i2 < data.length; i2++) {
  38157. var lnglat = $this.cartesianToLatlng(data[i2]);
  38158. lnglatArr.push(lnglat);
  38159. }
  38160. $this._AttackArrowData = lnglatArr;
  38161. var res = $this.fineArrow(lnglatArr);
  38162. var returnData = res.polygonalPoint;
  38163. return new $this.Cesium.PolygonHierarchy(returnData);
  38164. }
  38165. startCreate(drawType) {
  38166. if (isRuntimeApp()) {
  38167. showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  38168. }
  38169. var $this = this;
  38170. this.drawType = drawType;
  38171. this.handler = new $this.Cesium.ScreenSpaceEventHandler($this.viewer.scene.canvas);
  38172. this.handler.setInputAction(function(evt) {
  38173. if (isRuntimeApp()) {
  38174. var cartesian = $this.getCatesian3FromPX(evt.position);
  38175. if (!cartesian) {
  38176. return;
  38177. }
  38178. $this.createPoint(cartesian);
  38179. $this._positions.push(cartesian);
  38180. if ($this._positions.length <= 2) {
  38181. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9");
  38182. } else {
  38183. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9\uFF0C\u70B9\u51FB\u5B8C\u6210\u6309\u94AE\uFF0C\u7ED3\u675F\u7ED8\u5236");
  38184. if ($this._positions.length === 3) {
  38185. if (!$this.Cesium.defined($this._AttackArrow)) {
  38186. $this._AttackArrow = $this.createAttackArrow();
  38187. createOperationMainDom();
  38188. document.getElementById("btnDrawBackout").style.display = "none";
  38189. document.getElementById("btnDrawComplete").onclick = () => {
  38190. $this._AttackArrowData = $this._positions.concat();
  38191. $this.viewer.entities.remove($this._AttackArrow);
  38192. $this._AttackArrow = null;
  38193. $this._positions = [];
  38194. let lnglatArr = [];
  38195. for (var i2 = 0; i2 < $this._AttackArrowData.length; i2++) {
  38196. var lnglat = $this.cartesianToLatlng($this._AttackArrowData[i2]);
  38197. lnglatArr.push(lnglat);
  38198. }
  38199. $this._AttackArrowData = lnglatArr;
  38200. var straightArrow = $this.addload(lnglatArr);
  38201. $this._entities_AttackArrow.push(straightArrow);
  38202. $this._AttackArrowLast = straightArrow;
  38203. $this.clearPoint();
  38204. $this.destroy();
  38205. let buttonDiv = document.getElementById("drawButtonDiv");
  38206. if (buttonDiv) {
  38207. document.body.removeChild(buttonDiv);
  38208. }
  38209. };
  38210. }
  38211. }
  38212. }
  38213. } else {
  38214. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u5355\u51FB");
  38215. clearTimeout($this._timer);
  38216. $this._timer = setTimeout(function() {
  38217. var cartesian2 = $this.getCatesian3FromPX(evt.position);
  38218. if (!cartesian2) {
  38219. return;
  38220. }
  38221. if ($this._positions.length == 0) {
  38222. $this.floatingPoint = $this.createPoint(cartesian2);
  38223. $this.createPoint(cartesian2);
  38224. }
  38225. if ($this._positions.length == 1) {
  38226. $this._positions.push(cartesian2.clone());
  38227. $this.createPoint(cartesian2);
  38228. }
  38229. $this._positions.push(cartesian2);
  38230. }, 200);
  38231. }
  38232. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  38233. this.handler.setInputAction(function(evt) {
  38234. if (isRuntimeApp())
  38235. return;
  38236. if ($this._positions.length == 0) {
  38237. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  38238. } else {
  38239. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9");
  38240. }
  38241. if ($this._positions.length < 3)
  38242. return;
  38243. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9\uFF0C\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  38244. if (!$this.Cesium.defined($this._AttackArrow)) {
  38245. $this._AttackArrow = $this.createAttackArrow();
  38246. }
  38247. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  38248. if (!cartesian) {
  38249. return;
  38250. }
  38251. $this.floatingPoint.position.setValue(cartesian);
  38252. if ($this._AttackArrow) {
  38253. $this._positions.pop();
  38254. $this._positions.push(cartesian);
  38255. }
  38256. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  38257. this.handler.setInputAction(function(evt) {
  38258. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  38259. this.handler.setInputAction(function(evt) {
  38260. if (isRuntimeApp())
  38261. return;
  38262. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u53CC\u51FB");
  38263. clearTimeout($this._timer);
  38264. var cartesian = $this.getCatesian3FromPX(evt.position);
  38265. $this._positions.pop();
  38266. $this._positions.push(cartesian);
  38267. $this._AttackArrowData = $this._positions.concat();
  38268. $this.viewer.entities.remove($this._AttackArrow);
  38269. $this._AttackArrow = null;
  38270. $this._positions = [];
  38271. $this.floatingPoint.position.setValue(cartesian);
  38272. let lnglatArr = [];
  38273. for (var i2 = 0; i2 < $this._AttackArrowData.length; i2++) {
  38274. var lnglat = $this.cartesianToLatlng($this._AttackArrowData[i2]);
  38275. lnglatArr.push(lnglat);
  38276. }
  38277. $this._AttackArrowData = lnglatArr;
  38278. var straightArrow = $this.addload(lnglatArr);
  38279. $this._entities_AttackArrow.push(straightArrow);
  38280. $this._AttackArrowLast = straightArrow;
  38281. $this.clearPoint();
  38282. $this.destroy();
  38283. $this._tooltip.setVisible(false);
  38284. }, $this.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  38285. }
  38286. createAttackArrow() {
  38287. var $this = this;
  38288. var arrowEntity = $this.viewer.entities.add({
  38289. polygon: {
  38290. hierarchy: new $this.Cesium.CallbackProperty(
  38291. function() {
  38292. var lnglatArr = [];
  38293. for (var i2 = 0; i2 < $this._positions.length; i2++) {
  38294. var lnglat = $this.cartesianToLatlng($this._positions[i2]);
  38295. lnglatArr.push(lnglat);
  38296. }
  38297. var res = $this.fineArrow(lnglatArr);
  38298. var returnData = res.polygonalPoint;
  38299. return new $this.Cesium.PolygonHierarchy(returnData);
  38300. },
  38301. false
  38302. ),
  38303. show: true,
  38304. fill: true,
  38305. clampToGround: true,
  38306. material: $this.polygonMaterial
  38307. }
  38308. });
  38309. $this._entities_AttackArrow.push(arrowEntity);
  38310. return arrowEntity;
  38311. }
  38312. createPoint(cartesian) {
  38313. var $this = this;
  38314. var point2 = this.viewer.entities.add({
  38315. position: cartesian,
  38316. point: {
  38317. pixelSize: 10,
  38318. color: $this.Cesium.Color.RED,
  38319. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  38320. }
  38321. });
  38322. point2.objId = this.objId;
  38323. $this._entities_point.push(point2);
  38324. return point2;
  38325. }
  38326. cartesianToLatlng(cartesian) {
  38327. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  38328. let lat = this.Cesium.Math.toDegrees(cartographic.latitude);
  38329. let lng = this.Cesium.Math.toDegrees(cartographic.longitude);
  38330. let alt = cartographic.height;
  38331. return [lng, lat, alt];
  38332. }
  38333. destroy() {
  38334. if (this.handler) {
  38335. this.handler.destroy();
  38336. this.handler = null;
  38337. }
  38338. }
  38339. clearPoint() {
  38340. this.DrawEndEvent.raiseEvent(this._AttackArrowLast, this._AttackArrowData, this.drawType);
  38341. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  38342. this.viewer.entities.remove(this._entities_point[i2]);
  38343. }
  38344. this._entities_point = [];
  38345. }
  38346. clear() {
  38347. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  38348. this.viewer.entities.remove(this._entities_point[i2]);
  38349. }
  38350. for (var i2 = 0; i2 < this._entities_AttackArrow.length; i2++) {
  38351. this.viewer.entities.remove(this._entities_AttackArrow[i2]);
  38352. }
  38353. this.floatingPoint = null;
  38354. this._AttackArrow = null;
  38355. this._AttackArrowLast = null;
  38356. this._positions = [];
  38357. this._entities_point = [];
  38358. this._entities_AttackArrow = [];
  38359. this._AttackArrowData = null;
  38360. }
  38361. getCatesian3FromPX(px) {
  38362. var cartesian;
  38363. var ray = this.viewer.camera.getPickRay(px);
  38364. if (!ray)
  38365. return null;
  38366. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  38367. return cartesian;
  38368. }
  38369. fineArrowDefualParam() {
  38370. return {
  38371. headHeightFactor: 0.18,
  38372. headWidthFactor: 0.3,
  38373. neckHeightFactor: 0.85,
  38374. neckWidthFactor: 0.15,
  38375. tailWidthFactor: 0.1,
  38376. headTailFactor: 0.8,
  38377. swallowTailFactor: 1
  38378. };
  38379. }
  38380. fineArrow(inputPoint) {
  38381. var $this = this;
  38382. inputPoint = $this.dereplication(inputPoint);
  38383. let tailWidthFactor = $this.fineArrowDefualParam().tailWidthFactor;
  38384. let swallowTailFactor = $this.fineArrowDefualParam().swallowTailFactor;
  38385. let swallowTailPnt = $this.fineArrowDefualParam().swallowTailPnt;
  38386. var result = {
  38387. controlPoint: null,
  38388. polygonalPoint: null
  38389. };
  38390. result.controlPoint = inputPoint;
  38391. var t2 = inputPoint.length;
  38392. if (!(2 > t2)) {
  38393. if (2 == inputPoint.length) {
  38394. result.polygonalPoint = inputPoint;
  38395. return result;
  38396. }
  38397. var o = inputPoint, e = o[0], r2 = o[1];
  38398. $this.isClockWise(o[0], o[1], o[2]) && (e = o[1], r2 = o[0]);
  38399. var n = $this.mid(e, r2), g = [n].concat(o.slice(2)), i2 = $this.getAttackArrowHeadPoints(g, e, r2, $this.fineArrowDefualParam()), s = i2[0], a = i2[4], l = $this.distance(e, r2), u = $this.getBaseLength(g), c = u * tailWidthFactor * swallowTailFactor;
  38400. swallowTailPnt = $this.getThirdPoint(g[1], g[0], 0, c, true);
  38401. var p = l / u, h2 = $this.getAttackArrowBodyPoints(g, s, a, p), t2 = h2.length, d2 = [e].concat(h2.slice(0, t2 / 2));
  38402. d2.push(s);
  38403. var f = [r2].concat(h2.slice(t2 / 2, t2));
  38404. var newArray = [];
  38405. f.push(a), d2 = $this.getQBSplinePoints(d2), f = $this.getQBSplinePoints(f), newArray = $this.array2Dto1D(d2.concat(i2, f.reverse(), [swallowTailPnt, d2[0]]));
  38406. result.polygonalPoint = $this.Cesium.Cartesian3.fromDegreesArray(newArray);
  38407. }
  38408. return result;
  38409. }
  38410. getArrowBodyPoints(t2, o, e, r2) {
  38411. var $this = this;
  38412. for (var n = $this.wholeDistance(t2), g = $this.getBaseLength(t2), i2 = g * r2, s = $this.distance(o, e), a = (i2 - s) / 2, l = 0, u = [], c = [], p = 1; p < t2.length - 1; p++) {
  38413. var h2 = $this.getAngleOfThreePoints(t2[p - 1], t2[p], t2[p + 1]) / 2;
  38414. l += $this.distance(t2[p - 1], t2[p]);
  38415. var d2 = (i2 / 2 - l / n * a) / Math.sin(h2), f = $this.getThirdPoint(t2[p - 1], t2[p], Math.PI - h2, d2, true), E2 = $this.getThirdPoint(t2[p - 1], t2[p], h2, d2, false);
  38416. u.push(f), c.push(E2);
  38417. }
  38418. return u.concat(c);
  38419. }
  38420. getAttackArrowHeadPoints(t2, o, e, defaultParam) {
  38421. var $this = this;
  38422. let headHeightFactor = defaultParam.headHeightFactor;
  38423. let headTailFactor = defaultParam.headTailFactor;
  38424. let headWidthFactor = defaultParam.headWidthFactor;
  38425. let neckWidthFactor = defaultParam.neckWidthFactor;
  38426. let neckHeightFactor = defaultParam.neckHeightFactor;
  38427. var r2 = $this.getBaseLength(t2), n = r2 * headHeightFactor, g = t2[t2.length - 1];
  38428. r2 = $this.distance(g, t2[t2.length - 2]);
  38429. var i2 = $this.distance(o, e);
  38430. n > i2 * headTailFactor && (n = i2 * headTailFactor);
  38431. var s = n * headWidthFactor, a = n * neckWidthFactor;
  38432. n = n > r2 ? r2 : n;
  38433. var l = n * neckHeightFactor, u = $this.getThirdPoint(t2[t2.length - 2], g, 0, n, true), c = $this.getThirdPoint(t2[t2.length - 2], g, 0, l, true), p = $this.getThirdPoint(g, u, Math.PI / 2, s, false), h2 = $this.getThirdPoint(g, u, Math.PI / 2, s, true), d2 = $this.getThirdPoint(g, c, Math.PI / 2, a, false), f = $this.getThirdPoint(g, c, Math.PI / 2, a, true);
  38434. return [d2, p, g, h2, f];
  38435. }
  38436. getAngleOfThreePoints(t2, o, e) {
  38437. var r2 = this.getAzimuth(o, t2) - this.getAzimuth(o, e);
  38438. return 0 > r2 ? r2 + Math.PI * 2 : r2;
  38439. }
  38440. dereplication(array) {
  38441. var last = array[array.length - 1];
  38442. var change = false;
  38443. var newArray = [];
  38444. newArray = array.filter(function(i2) {
  38445. if (i2[0] != last[0] && i2[1] != last[1]) {
  38446. return i2;
  38447. }
  38448. change = true;
  38449. });
  38450. if (change)
  38451. newArray.push(last);
  38452. return newArray;
  38453. }
  38454. getBaseLength(t2) {
  38455. return Math.pow(this.wholeDistance(t2), 0.99);
  38456. }
  38457. wholeDistance(t2) {
  38458. for (var o = 0, e = 0; e < t2.length - 1; e++)
  38459. o += this.distance(t2[e], t2[e + 1]);
  38460. return o;
  38461. }
  38462. distance(t2, o) {
  38463. return Math.sqrt(Math.pow(t2[0] - o[0], 2) + Math.pow(t2[1] - o[1], 2));
  38464. }
  38465. getThirdPoint(t2, o, e, r2, n) {
  38466. var g = this.getAzimuth(t2, o), i2 = n ? g + e : g - e, s = r2 * Math.cos(i2), a = r2 * Math.sin(i2);
  38467. return [o[0] + s, o[1] + a];
  38468. }
  38469. getAzimuth(t2, o) {
  38470. var e, r2 = Math.asin(Math.abs(o[1] - t2[1]) / this.distance(t2, o));
  38471. return o[1] >= t2[1] && o[0] >= t2[0] ? e = r2 + Math.PI : o[1] >= t2[1] && o[0] < t2[0] ? e = 2 * Math.PI - r2 : o[1] < t2[1] && o[0] < t2[0] ? e = r2 : o[1] < t2[1] && o[0] >= t2[0] && (e = Math.PI - r2), e;
  38472. }
  38473. isClockWise(t2, o, e) {
  38474. return (e[1] - t2[1]) * (o[0] - t2[0]) > (o[1] - t2[1]) * (e[0] - t2[0]);
  38475. }
  38476. mid(t2, o) {
  38477. return [(t2[0] + o[0]) / 2, (t2[1] + o[1]) / 2];
  38478. }
  38479. }
  38480. class DrawPincerArrow {
  38481. constructor(arg) {
  38482. this.viewer = arg.viewer;
  38483. this.Cesium = arg.Cesium;
  38484. this.floatingPoint = null;
  38485. this._PincerArrow = null;
  38486. this._PincerArrowLast = null;
  38487. this._positions = [];
  38488. this._entities_point = [];
  38489. this._entities_PincerArrow = [];
  38490. this._PincerArrowData = null;
  38491. this.DrawStartEvent = new Cesium.Event();
  38492. this.DrawEndEvent = new Cesium.Event();
  38493. this._tooltip = createTooltip(this.viewer.container);
  38494. this._param = {
  38495. id: "DrawStraightArrow",
  38496. polygonColor: "rgba(0,255,0,0.5)",
  38497. outlineColor: "rgba(255, 255, 255, 1)",
  38498. outlineWidth: 1
  38499. };
  38500. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  38501. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  38502. }
  38503. get PincerArrow() {
  38504. return this._PincerArrowLast;
  38505. }
  38506. getData() {
  38507. return this._PincerArrowData;
  38508. }
  38509. addload(data) {
  38510. var $this = this;
  38511. if (data.length < 3) {
  38512. return;
  38513. }
  38514. var res = $this.doubleArrow(data);
  38515. var returnData = res.polygonalPoint;
  38516. var arrowEntity = $this.viewer.entities.add({
  38517. Type: "DrawPincerArrow",
  38518. Position: data,
  38519. id: data.id || $this.objId,
  38520. polygon: {
  38521. hierarchy: new $this.Cesium.PolygonHierarchy(returnData),
  38522. show: true,
  38523. fill: true,
  38524. clampToGround: true,
  38525. material: $this.polygonMaterial
  38526. }
  38527. });
  38528. return arrowEntity;
  38529. }
  38530. computePosition(data) {
  38531. let $this = this;
  38532. var lnglatArr = [];
  38533. for (var i2 = 0; i2 < data.length; i2++) {
  38534. var lnglat = $this.cartesianToLatlng(data[i2]);
  38535. lnglatArr.push(lnglat);
  38536. }
  38537. $this._PincerArrowData = lnglatArr;
  38538. var res = $this.doubleArrow(lnglatArr);
  38539. var returnData = res.polygonalPoint;
  38540. return new $this.Cesium.PolygonHierarchy(returnData);
  38541. }
  38542. startCreate(drawType) {
  38543. if (isRuntimeApp()) {
  38544. showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  38545. }
  38546. var $this = this;
  38547. this.drawType = drawType;
  38548. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  38549. this.handler.setInputAction(function(evt) {
  38550. if (isRuntimeApp()) {
  38551. var cartesian = $this.getCatesian3FromPX(evt.position);
  38552. if (!cartesian) {
  38553. return;
  38554. }
  38555. $this.createPoint(cartesian);
  38556. $this._positions.push(cartesian);
  38557. if ($this._positions.length < 3 || $this._positions.length === 4) {
  38558. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9");
  38559. }
  38560. if ($this._positions.length === 2) {
  38561. if (!$this.Cesium.defined($this._PincerArrow)) {
  38562. $this._PincerArrow = $this.createPincerArrow();
  38563. }
  38564. }
  38565. if ($this._positions.length === 3) {
  38566. $this._positions.pop();
  38567. $this._positions.push(cartesian);
  38568. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9\uFF0C\u70B9\u51FB\u5B8C\u6210\u6309\u94AE\uFF0C\u7ED3\u675F\u7ED8\u5236");
  38569. createOperationMainDom();
  38570. document.getElementById("btnDrawBackout").style.display = "none";
  38571. document.getElementById("btnDrawComplete").onclick = () => {
  38572. $this._PincerArrowData = $this._positions.concat();
  38573. $this.viewer.entities.remove($this._PincerArrow);
  38574. $this._PincerArrow = null;
  38575. $this._positions = [];
  38576. var lnglatArr = [];
  38577. for (var i2 = 0; i2 < $this._PincerArrowData.length; i2++) {
  38578. var lnglat = $this.cartesianToLatlng($this._PincerArrowData[i2]);
  38579. lnglatArr.push(lnglat);
  38580. }
  38581. $this._PincerArrowData = lnglatArr;
  38582. var pincerArrow = $this.addload(lnglatArr);
  38583. $this._entities_PincerArrow.push(pincerArrow);
  38584. $this._PincerArrowLast = pincerArrow;
  38585. $this.clearPoint();
  38586. $this.destroy();
  38587. let buttonDiv = document.getElementById("drawButtonDiv");
  38588. if (buttonDiv) {
  38589. document.body.removeChild(buttonDiv);
  38590. }
  38591. };
  38592. }
  38593. if ($this._positions.length === 5) {
  38594. showTooltipMessage("\u70B9\u51FB\u5B8C\u6210\u6309\u94AE\uFF0C\u7ED3\u675F\u7ED8\u5236");
  38595. $this.destroy();
  38596. }
  38597. } else {
  38598. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u5355\u51FB");
  38599. clearTimeout($this._timer);
  38600. $this._timer = setTimeout(function() {
  38601. var cartesian2 = $this.getCatesian3FromPX(evt.position);
  38602. if (!cartesian2) {
  38603. return;
  38604. }
  38605. if ($this._positions.length == 0) {
  38606. $this.floatingPoint = $this.createPoint(cartesian2);
  38607. }
  38608. if ($this._positions.length < 5) {
  38609. $this._positions.push(cartesian2);
  38610. $this.createPoint(cartesian2);
  38611. }
  38612. if ($this._positions.length == 5) {
  38613. $this._positions[4] = cartesian2;
  38614. $this.floatingPoint.position.setValue(cartesian2);
  38615. }
  38616. }, 200);
  38617. }
  38618. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  38619. this.handler.setInputAction(function(evt) {
  38620. if (isRuntimeApp())
  38621. return;
  38622. if ($this._positions.length == 0) {
  38623. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  38624. } else {
  38625. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9");
  38626. }
  38627. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  38628. if (!cartesian)
  38629. return;
  38630. if ($this._positions.length < 2)
  38631. return;
  38632. if (!$this.Cesium.defined($this._PincerArrow)) {
  38633. if ($this._positions.length == 2) {
  38634. $this._positions.push(cartesian);
  38635. }
  38636. $this._PincerArrow = $this.createPincerArrow();
  38637. }
  38638. $this.floatingPoint.position.setValue(cartesian);
  38639. if ($this._positions.length == 3) {
  38640. $this._positions[2] = cartesian;
  38641. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9\uFF0C\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  38642. }
  38643. if ($this._positions.length > 3) {
  38644. $this._positions.pop();
  38645. $this._positions.push(cartesian);
  38646. if ($this._positions === 4) {
  38647. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9");
  38648. }
  38649. if ($this._positions.length == 5) {
  38650. $this._tooltip.showAt(evt.endPosition, "\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  38651. }
  38652. }
  38653. console.log($this._positions.length);
  38654. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  38655. this.handler.setInputAction(function(evt) {
  38656. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  38657. this.handler.setInputAction(function(evt) {
  38658. if (isRuntimeApp())
  38659. return;
  38660. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u53CC\u51FB");
  38661. clearTimeout($this._timer);
  38662. if (!$this._PincerArrow) {
  38663. return;
  38664. }
  38665. var cartesian = $this.getCatesian3FromPX(evt.position);
  38666. if (!cartesian)
  38667. return;
  38668. $this._positions.pop();
  38669. $this._PincerArrowData = $this._positions.concat();
  38670. $this.viewer.entities.remove($this._PincerArrow);
  38671. $this._PincerArrow = null;
  38672. $this._positions = [];
  38673. $this.floatingPoint.position.setValue(cartesian);
  38674. var lnglatArr = [];
  38675. for (var i2 = 0; i2 < $this._PincerArrowData.length; i2++) {
  38676. var lnglat = $this.cartesianToLatlng($this._PincerArrowData[i2]);
  38677. lnglatArr.push(lnglat);
  38678. }
  38679. $this._PincerArrowData = lnglatArr;
  38680. var pincerArrow = $this.addload(lnglatArr);
  38681. $this._entities_PincerArrow.push(pincerArrow);
  38682. $this._PincerArrowLast = pincerArrow;
  38683. $this.clearPoint();
  38684. $this.destroy();
  38685. $this._tooltip.setVisible(false);
  38686. }, $this.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  38687. }
  38688. createPincerArrow() {
  38689. var $this = this;
  38690. $this._computeTempPositions();
  38691. var arrowEntity = $this.viewer.entities.add({
  38692. polygon: {
  38693. hierarchy: new $this.Cesium.CallbackProperty(
  38694. function() {
  38695. var lnglatArr = [];
  38696. for (var i2 = 0; i2 < $this._positions.length; i2++) {
  38697. var lnglat = $this.cartesianToLatlng($this._positions[i2]);
  38698. lnglatArr.push(lnglat);
  38699. }
  38700. var res = $this.doubleArrow(lnglatArr);
  38701. var returnData = res.polygonalPoint;
  38702. return new $this.Cesium.PolygonHierarchy(returnData);
  38703. },
  38704. false
  38705. ),
  38706. show: true,
  38707. fill: true,
  38708. clampToGround: true,
  38709. material: $this.polygonMaterial
  38710. }
  38711. });
  38712. $this._entities_PincerArrow.push(arrowEntity);
  38713. return arrowEntity;
  38714. }
  38715. createPoint(cartesian) {
  38716. var $this = this;
  38717. var point2 = this.viewer.entities.add({
  38718. position: cartesian,
  38719. point: {
  38720. pixelSize: 10,
  38721. color: $this.Cesium.Color.RED,
  38722. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  38723. }
  38724. });
  38725. $this._entities_point.push(point2);
  38726. return point2;
  38727. }
  38728. cartesianToLatlng(cartesian) {
  38729. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  38730. let lat = this.Cesium.Math.toDegrees(cartographic.latitude);
  38731. let lng = this.Cesium.Math.toDegrees(cartographic.longitude);
  38732. let alt = cartographic.height;
  38733. return [lng, lat, alt];
  38734. }
  38735. destroy() {
  38736. if (this.handler) {
  38737. this.handler.destroy();
  38738. this.handler = null;
  38739. }
  38740. }
  38741. clearPoint() {
  38742. this.DrawEndEvent.raiseEvent(this._PincerArrowLast, this._PincerArrowData, this.drawType);
  38743. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  38744. this.viewer.entities.remove(this._entities_point[i2]);
  38745. }
  38746. this._entities_point = [];
  38747. }
  38748. clear() {
  38749. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  38750. this.viewer.entities.remove(this._entities_point[i2]);
  38751. }
  38752. for (var i2 = 0; i2 < this._entities_PincerArrow.length; i2++) {
  38753. this.viewer.entities.remove(this._entities_PincerArrow[i2]);
  38754. }
  38755. this.floatingPoint = null;
  38756. this._PincerArrow = null;
  38757. this._PincerArrowLast = null;
  38758. this._positions = [];
  38759. this._entities_point = [];
  38760. this._entities_PincerArrow = [];
  38761. this._PincerArrowData = null;
  38762. }
  38763. getCatesian3FromPX(px) {
  38764. var cartesian;
  38765. var ray = this.viewer.camera.getPickRay(px);
  38766. if (!ray)
  38767. return null;
  38768. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  38769. return cartesian;
  38770. }
  38771. _computeTempPositions() {
  38772. var _this = this;
  38773. var pnts = [].concat(_this._positions);
  38774. var num = pnts.length;
  38775. var first = pnts[0];
  38776. var last = pnts[num - 1];
  38777. if (_this._isSimpleXYZ(first, last) == false) {
  38778. pnts.push(first);
  38779. num += 1;
  38780. }
  38781. _this.tempPositions = [];
  38782. for (var i2 = 1; i2 < num; i2++) {
  38783. var p1 = pnts[i2 - 1];
  38784. var p2 = pnts[i2];
  38785. var cp = _this._computeCenterPotition(p1, p2);
  38786. _this.tempPositions.push(p1);
  38787. _this.tempPositions.push(cp);
  38788. }
  38789. }
  38790. _isSimpleXYZ(p1, p2) {
  38791. if (p1.x == p2.x && p1.y == p2.y && p1.z == p2.z) {
  38792. return true;
  38793. }
  38794. return false;
  38795. }
  38796. _computeCenterPotition(p1, p2) {
  38797. var _this = this;
  38798. var c1 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p1);
  38799. var c2 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p2);
  38800. var cm = new _this.Cesium.EllipsoidGeodesic(c1, c2).interpolateUsingFraction(0.5);
  38801. var cp = _this.viewer.scene.globe.ellipsoid.cartographicToCartesian(cm);
  38802. return cp;
  38803. }
  38804. doubleArrow(inputPoint) {
  38805. var $this = this;
  38806. this.connPoint = null;
  38807. this.tempPoint4 = null;
  38808. this.points = inputPoint;
  38809. var result = {
  38810. controlPoint: null,
  38811. polygonalPoint: null
  38812. };
  38813. var t2 = inputPoint.length;
  38814. if (!(2 > t2)) {
  38815. if (2 == t2)
  38816. return inputPoint;
  38817. var o = this.points[0], e = this.points[1], r2 = this.points[2], t2 = inputPoint.length;
  38818. 3 == t2 ? this.tempPoint4 = $this.getTempPoint4(o, e, r2) : this.tempPoint4 = this.points[3], 3 == t2 || 4 == t2 ? this.connPoint = $this.mid(o, e) : this.connPoint = this.points[4];
  38819. var n, g;
  38820. $this.isClockWise(o, e, r2) ? (n = $this.getArrowPoints(o, this.connPoint, this.tempPoint4, false), g = $this.getArrowPoints(this.connPoint, e, r2, true)) : (n = $this.getArrowPoints(e, this.connPoint, r2, false), g = $this.getArrowPoints(this.connPoint, o, this.tempPoint4, true));
  38821. var i2 = n.length, s = (i2 - 5) / 2, a = n.slice(0, s), l = n.slice(s, s + 5), u = n.slice(s + 5, i2), c = g.slice(0, s), p = g.slice(s, s + 5), h2 = g.slice(s + 5, i2);
  38822. c = $this.getBezierPoints(c);
  38823. var d2 = $this.getBezierPoints(h2.concat(a.slice(1)));
  38824. u = $this.getBezierPoints(u);
  38825. var f = c.concat(p, d2, l, u);
  38826. var newArray = $this.array2Dto1D(f);
  38827. result.controlPoint = [o, e, r2, this.tempPoint4, this.connPoint];
  38828. result.polygonalPoint = $this.Cesium.Cartesian3.fromDegreesArray(newArray);
  38829. }
  38830. return result;
  38831. }
  38832. getTempPoint4(t2, o, e) {
  38833. var $this = this;
  38834. var r2, n, g, i2, s = $this.mid(t2, o), a = $this.distance(s, e), l = $this.getAngleOfThreePoints(t2, s, e);
  38835. return l < Math.PI / 2 ? (n = a * Math.sin(l), g = a * Math.cos(l), i2 = $this.getThirdPoint(t2, s, Math.PI / 2, n, false), r2 = $this.getThirdPoint(s, i2, Math.PI / 2, g, true)) : l >= Math.PI / 2 && l < Math.PI ? (n = a * Math.sin(Math.PI - l), g = a * Math.cos(Math.PI - l), i2 = $this.getThirdPoint(t2, s, Math.PI / 2, n, false), r2 = $this.getThirdPoint(s, i2, Math.PI / 2, g, false)) : l >= Math.PI && l < 1.5 * Math.PI ? (n = a * Math.sin(l - Math.PI), g = a * Math.cos(l - Math.PI), i2 = $this.getThirdPoint(t2, s, Math.PI / 2, n, true), r2 = $this.getThirdPoint(s, i2, Math.PI / 2, g, true)) : (n = a * Math.sin(2 * Math.PI - l), g = a * Math.cos(2 * Math.PI - l), i2 = $this.getThirdPoint(t2, s, Math.PI / 2, n, true), r2 = $this.getThirdPoint(s, i2, Math.PI / 2, g, false)), r2;
  38836. }
  38837. mid(t2, o) {
  38838. return [(t2[0] + o[0]) / 2, (t2[1] + o[1]) / 2];
  38839. }
  38840. isClockWise(t2, o, e) {
  38841. return (e[1] - t2[1]) * (o[0] - t2[0]) > (o[1] - t2[1]) * (e[0] - t2[0]);
  38842. }
  38843. getArrowPoints(t2, o, e, r2) {
  38844. var $this = this;
  38845. var doubleArrowDefualParam = {
  38846. type: "doublearrow",
  38847. headHeightFactor: 0.25,
  38848. headWidthFactor: 0.3,
  38849. neckHeightFactor: 0.85,
  38850. fixPointCount: 4,
  38851. neckWidthFactor: 0.15
  38852. };
  38853. this.type = doubleArrowDefualParam.type, this.headHeightFactor = doubleArrowDefualParam.headHeightFactor, this.headWidthFactor = doubleArrowDefualParam.headWidthFactor, this.neckHeightFactor = doubleArrowDefualParam.neckHeightFactor, this.neckWidthFactor = doubleArrowDefualParam.neckWidthFactor;
  38854. var n = $this.mid(t2, o), g = $this.distance(n, e), i2 = $this.getThirdPoint(e, n, 0, 0.3 * g, true), s = $this.getThirdPoint(e, n, 0, 0.5 * g, true);
  38855. i2 = $this.getThirdPoint(n, i2, Math.PI / 2, g / 5, r2), s = $this.getThirdPoint(n, s, Math.PI / 2, g / 4, r2);
  38856. var a = [n, i2, s, e], l = $this.getArrowHeadPoints(a, this.headHeightFactor, this.headWidthFactor, this.neckHeightFactor, this.neckWidthFactor), u = l[0], c = l[4], p = $this.distance(t2, o) / $this.getBaseLength(a) / 2, h2 = $this.getArrowBodyPoints(a, u, c, p), d2 = h2.length, f = h2.slice(0, d2 / 2), E2 = h2.slice(d2 / 2, d2);
  38857. return f.push(u), E2.push(c), f = f.reverse(), f.push(o), E2 = E2.reverse(), E2.push(t2), f.reverse().concat(l, E2);
  38858. }
  38859. getArrowHeadPoints(t2, o, e) {
  38860. var $this = this;
  38861. var doubleArrowDefualParam = {
  38862. type: "doublearrow",
  38863. headHeightFactor: 0.25,
  38864. headWidthFactor: 0.3,
  38865. neckHeightFactor: 0.85,
  38866. fixPointCount: 4,
  38867. neckWidthFactor: 0.15
  38868. };
  38869. this.type = doubleArrowDefualParam.type, this.headHeightFactor = doubleArrowDefualParam.headHeightFactor, this.headWidthFactor = doubleArrowDefualParam.headWidthFactor, this.neckHeightFactor = doubleArrowDefualParam.neckHeightFactor, this.neckWidthFactor = doubleArrowDefualParam.neckWidthFactor;
  38870. var r2 = $this.getBaseLength(t2), n = r2 * this.headHeightFactor, g = t2[t2.length - 1], i2 = ($this.distance(o, e), n * this.headWidthFactor), s = n * this.neckWidthFactor, a = n * this.neckHeightFactor, l = $this.getThirdPoint(t2[t2.length - 2], g, 0, n, true), u = $this.getThirdPoint(t2[t2.length - 2], g, 0, a, true), c = $this.getThirdPoint(g, l, Math.PI / 2, i2, false), p = $this.getThirdPoint(g, l, Math.PI / 2, i2, true), h2 = $this.getThirdPoint(g, u, Math.PI / 2, s, false), d2 = $this.getThirdPoint(g, u, Math.PI / 2, s, true);
  38871. return [h2, c, g, p, d2];
  38872. }
  38873. getArrowBodyPoints(t2, o, e, r2) {
  38874. var $this = this;
  38875. for (var n = $this.wholeDistance(t2), g = $this.getBaseLength(t2), i2 = g * r2, s = $this.distance(o, e), a = (i2 - s) / 2, l = 0, u = [], c = [], p = 1; p < t2.length - 1; p++) {
  38876. var h2 = $this.getAngleOfThreePoints(t2[p - 1], t2[p], t2[p + 1]) / 2;
  38877. l += $this.distance(t2[p - 1], t2[p]);
  38878. var d2 = (i2 / 2 - l / n * a) / Math.sin(h2), f = $this.getThirdPoint(t2[p - 1], t2[p], Math.PI - h2, d2, true), E2 = $this.getThirdPoint(t2[p - 1], t2[p], h2, d2, false);
  38879. u.push(f), c.push(E2);
  38880. }
  38881. return u.concat(c);
  38882. }
  38883. getBezierPoints(t2) {
  38884. if (t2.length <= 2)
  38885. return t2;
  38886. for (var o = [], e = t2.length - 1, r2 = 0; 1 >= r2; r2 += 0.01) {
  38887. for (var n = 0, y = 0, g = 0; e >= g; g++) {
  38888. var i2 = this.getBinomialFactor(e, g), s = Math.pow(r2, g), a = Math.pow(1 - r2, e - g);
  38889. n += i2 * s * a * t2[g][0], y += i2 * s * a * t2[g][1];
  38890. }
  38891. o.push([n, y]);
  38892. }
  38893. return o.push(t2[e]), o;
  38894. }
  38895. getBaseLength(t2) {
  38896. return Math.pow(this.wholeDistance(t2), 0.99);
  38897. }
  38898. wholeDistance(t2) {
  38899. for (var o = 0, e = 0; e < t2.length - 1; e++)
  38900. o += this.distance(t2[e], t2[e + 1]);
  38901. return o;
  38902. }
  38903. getBinomialFactor(t2, o) {
  38904. return this.getFactorial(t2) / (this.getFactorial(o) * this.getFactorial(t2 - o));
  38905. }
  38906. getFactorial(t2) {
  38907. if (1 >= t2)
  38908. return 1;
  38909. if (2 == t2)
  38910. return 2;
  38911. if (3 == t2)
  38912. return 6;
  38913. if (4 == t2)
  38914. return 24;
  38915. if (5 == t2)
  38916. return 120;
  38917. for (var o = 1, e = 1; t2 >= e; e++)
  38918. o *= e;
  38919. return o;
  38920. }
  38921. array2Dto1D(array) {
  38922. var newArray = [];
  38923. array.forEach(function(elt) {
  38924. newArray.push(elt[0]);
  38925. newArray.push(elt[1]);
  38926. });
  38927. return newArray;
  38928. }
  38929. distance(t2, o) {
  38930. return Math.sqrt(Math.pow(t2[0] - o[0], 2) + Math.pow(t2[1] - o[1], 2));
  38931. }
  38932. getAngleOfThreePoints(t2, o, e) {
  38933. var r2 = this.getAzimuth(o, t2) - this.getAzimuth(o, e);
  38934. return 0 > r2 ? r2 + 2 * Math.PI : r2;
  38935. }
  38936. getAzimuth(t2, o) {
  38937. var e, r2 = Math.asin(Math.abs(o[1] - t2[1]) / this.distance(t2, o));
  38938. return o[1] >= t2[1] && o[0] >= t2[0] ? e = r2 + Math.PI : o[1] >= t2[1] && o[0] < t2[0] ? e = 2 * Math.PI - r2 : o[1] < t2[1] && o[0] < t2[0] ? e = r2 : o[1] < t2[1] && o[0] >= t2[0] && (e = Math.PI - r2), e;
  38939. }
  38940. getThirdPoint(t2, o, e, r2, n) {
  38941. var g = this.getAzimuth(t2, o), i2 = n ? g + e : g - e, s = r2 * Math.cos(i2), a = r2 * Math.sin(i2);
  38942. return [o[0] + s, o[1] + a];
  38943. }
  38944. }
  38945. class DrawGatheringPlace {
  38946. constructor(arg) {
  38947. this.viewer = arg.viewer;
  38948. this.Cesium = arg.Cesium;
  38949. this.tt = 0.4;
  38950. this.floatingPoint = null;
  38951. this.drawHandler = null;
  38952. this.gatheringPlace = null;
  38953. this._gatheringPlaceLast = null;
  38954. this._positions = [];
  38955. this._entities_point = [];
  38956. this._entities_PincerArrow = [];
  38957. this._gatheringPlaceData = null;
  38958. this.DrawStartEvent = new Cesium.Event();
  38959. this.DrawEndEvent = new Cesium.Event();
  38960. this._tooltip = createTooltip(this.viewer.container);
  38961. this._param = {
  38962. id: "DrawStraightArrow",
  38963. polygonColor: "rgba(0,255,0,0.5)",
  38964. outlineColor: "rgba(255, 255, 255, 1)",
  38965. outlineWidth: 1
  38966. };
  38967. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  38968. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  38969. }
  38970. get PincerArrow() {
  38971. return this._gatheringPlaceLast;
  38972. }
  38973. getData() {
  38974. return this._gatheringPlaceData;
  38975. }
  38976. computePosition(data) {
  38977. var $this = this;
  38978. if (data.length < 3) {
  38979. return;
  38980. }
  38981. var gatheringPlace = [];
  38982. var lonLats = [];
  38983. var res = $this.fineGatheringPlace(data);
  38984. for (var i2 = 0; i2 < res.length; i2++) {
  38985. var cart3 = new $this.Cesium.Cartesian3(res[i2].x, res[i2].y, res[i2].z);
  38986. gatheringPlace.push(cart3);
  38987. }
  38988. for (let q2 = 0; q2 < data.length; q2++) {
  38989. lonLats.push($this.cartesianToLatlng(data[q2]));
  38990. }
  38991. this._gatheringPlaceData = lonLats;
  38992. return new $this.Cesium.PolygonHierarchy(gatheringPlace);
  38993. }
  38994. addload(data) {
  38995. var $this = this;
  38996. if (data.length < 3) {
  38997. return;
  38998. }
  38999. var gatheringPlace = [];
  39000. var lnglatArr = [];
  39001. for (var i2 = 0; i2 < data.length; i2++) {
  39002. var lnglat = $this.LatlngTocartesian(data[i2]);
  39003. lnglatArr.push(lnglat);
  39004. }
  39005. var res = $this.fineGatheringPlace(lnglatArr);
  39006. for (var i2 = 0; i2 < res.length; i2++) {
  39007. var cart3 = new $this.Cesium.Cartesian3(res[i2].x, res[i2].y, res[i2].z);
  39008. gatheringPlace.push(cart3);
  39009. }
  39010. var pHierarchy = new $this.Cesium.PolygonHierarchy(gatheringPlace);
  39011. var arrowEntity = $this.viewer.entities.add({
  39012. Type: "DrawGatheringPlace",
  39013. Position: data,
  39014. id: data.id || $this.objId,
  39015. polygon: {
  39016. hierarchy: pHierarchy,
  39017. show: true,
  39018. fill: true,
  39019. clampToGround: true,
  39020. material: $this.polygonMaterial
  39021. }
  39022. });
  39023. return arrowEntity;
  39024. }
  39025. startCreate(drawType) {
  39026. if (isRuntimeApp()) {
  39027. showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  39028. }
  39029. var $this = this;
  39030. this.drawType = drawType;
  39031. this.handler = new $this.Cesium.ScreenSpaceEventHandler($this.viewer.scene.canvas);
  39032. this.handler.setInputAction(function(event2) {
  39033. if (isRuntimeApp()) {
  39034. var cartesian = $this.getCatesian3FromPX(event2.position);
  39035. if (!cartesian) {
  39036. return;
  39037. }
  39038. $this.createPoint(cartesian);
  39039. $this._positions.push(cartesian);
  39040. if ($this._positions.length < 3) {
  39041. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9");
  39042. }
  39043. if ($this._positions.length === 3) {
  39044. showTooltipMessage("\u70B9\u51FB\u5B8C\u6210\u6309\u94AE\uFF0C\u7ED3\u675F\u7ED8\u5236");
  39045. $this.destroy();
  39046. if (!$this.Cesium.defined($this.gatheringPlace)) {
  39047. $this.gatheringPlace = $this.createGatheringPlace();
  39048. createOperationMainDom();
  39049. document.getElementById("btnDrawBackout").style.display = "none";
  39050. document.getElementById("btnDrawComplete").onclick = () => {
  39051. $this._gatheringPlaceData = $this._positions.concat();
  39052. $this.viewer.entities.remove($this.gatheringPlace);
  39053. $this.gatheringPlace = null;
  39054. var lnglatArr = [];
  39055. for (var i2 = 0; i2 < $this._gatheringPlaceData.length; i2++) {
  39056. var lnglat = $this.cartesianToLatlng($this._gatheringPlaceData[i2]);
  39057. lnglatArr.push(lnglat);
  39058. }
  39059. $this._gatheringPlaceData = lnglatArr;
  39060. var pincerArrow = $this.addload(lnglatArr);
  39061. $this._entities_PincerArrow.push(pincerArrow);
  39062. $this._gatheringPlaceLast = pincerArrow;
  39063. $this.viewer.entities.remove($this.floatingPoint);
  39064. $this.floatingPoint = null;
  39065. $this.clearPoint();
  39066. $this.destroy();
  39067. let buttonDiv = document.getElementById("drawButtonDiv");
  39068. if (buttonDiv) {
  39069. document.body.removeChild(buttonDiv);
  39070. }
  39071. };
  39072. }
  39073. }
  39074. } else {
  39075. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u5355\u51FB");
  39076. clearTimeout($this._timer);
  39077. $this._timer = setTimeout(function() {
  39078. var position2 = event2.position;
  39079. if (!$this.Cesium.defined(position2)) {
  39080. return;
  39081. }
  39082. var ray = $this.viewer.camera.getPickRay(position2);
  39083. if (!$this.Cesium.defined(ray)) {
  39084. return;
  39085. }
  39086. var cartesian2 = $this.viewer.scene.globe.pick(ray, $this.viewer.scene);
  39087. if (!$this.Cesium.defined(cartesian2)) {
  39088. return;
  39089. }
  39090. if ($this._positions.length == 0) {
  39091. $this._positions.push(cartesian2.clone());
  39092. $this.floatingPoint = $this.createPoint(cartesian2);
  39093. }
  39094. if ($this._positions.length <= 2) {
  39095. $this.createPoint(cartesian2);
  39096. $this._positions.push(cartesian2);
  39097. }
  39098. }, 200);
  39099. }
  39100. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  39101. this.handler.setInputAction(function(event2) {
  39102. if (isRuntimeApp())
  39103. return;
  39104. if ($this._positions.length == 0) {
  39105. $this._tooltip.showAt(event2.endPosition, "\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  39106. } else {
  39107. $this._tooltip.showAt(event2.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9");
  39108. }
  39109. if ($this._positions.length < 2) {
  39110. return;
  39111. }
  39112. if ($this._positions.length == 3) {
  39113. $this._tooltip.showAt(event2.endPosition, "\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  39114. }
  39115. var position2 = event2.endPosition;
  39116. if (!$this.Cesium.defined(position2)) {
  39117. return;
  39118. }
  39119. var ray = $this.viewer.camera.getPickRay(position2);
  39120. if (!$this.Cesium.defined(ray)) {
  39121. return;
  39122. }
  39123. var cartesian = $this.viewer.scene.globe.pick(ray, $this.viewer.scene);
  39124. if (!$this.Cesium.defined(cartesian)) {
  39125. return;
  39126. }
  39127. if (!$this.Cesium.defined($this.gatheringPlace)) {
  39128. $this.gatheringPlace = $this.createGatheringPlace();
  39129. }
  39130. $this.floatingPoint.position.setValue(cartesian);
  39131. if ($this.gatheringPlace) {
  39132. if ($this._positions.length == 3) {
  39133. $this._positions[1] = cartesian;
  39134. } else {
  39135. $this._positions.pop();
  39136. $this._positions.push(cartesian);
  39137. }
  39138. }
  39139. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  39140. this.handler.setInputAction(function(movement) {
  39141. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  39142. this.handler.setInputAction(function(movement) {
  39143. if (isRuntimeApp())
  39144. return;
  39145. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u53CC\u51FB");
  39146. clearTimeout($this._timer);
  39147. if ($this._positions.length >= 3) {
  39148. $this._gatheringPlaceData = $this._positions.concat();
  39149. $this.viewer.entities.remove($this.gatheringPlace);
  39150. $this.gatheringPlace = null;
  39151. var lnglatArr = [];
  39152. for (var i2 = 0; i2 < $this._gatheringPlaceData.length; i2++) {
  39153. var lnglat = $this.cartesianToLatlng($this._gatheringPlaceData[i2]);
  39154. lnglatArr.push(lnglat);
  39155. }
  39156. $this._gatheringPlaceData = lnglatArr;
  39157. var pincerArrow = $this.addload(lnglatArr);
  39158. $this._entities_PincerArrow.push(pincerArrow);
  39159. $this._gatheringPlaceLast = pincerArrow;
  39160. $this.viewer.entities.remove($this.floatingPoint);
  39161. $this.floatingPoint = null;
  39162. $this.clearPoint();
  39163. $this.destroy();
  39164. $this._tooltip.setVisible(false);
  39165. }
  39166. }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  39167. }
  39168. createGatheringPlace() {
  39169. let $this = this;
  39170. var gatheringPlaceEntity = $this.viewer.entities.add({
  39171. polygon: {
  39172. hierarchy: new $this.Cesium.CallbackProperty(function() {
  39173. if ($this._positions.length < 3) {
  39174. return;
  39175. }
  39176. var gatheringPlace = [];
  39177. var res = $this.fineGatheringPlace($this._positions);
  39178. for (var i2 = 0; i2 < res.length; i2++) {
  39179. var cart3 = new $this.Cesium.Cartesian3(res[i2].x, res[i2].y, res[i2].z);
  39180. gatheringPlace.push(cart3);
  39181. }
  39182. var pHierarchy = new $this.Cesium.PolygonHierarchy(gatheringPlace);
  39183. var lonLats = $this.cartesianToLatlng($this._positions);
  39184. pHierarchy.keyPoints = lonLats;
  39185. return pHierarchy;
  39186. }, false),
  39187. show: true,
  39188. fill: true,
  39189. clampToGround: true,
  39190. material: $this.polygonMaterial
  39191. }
  39192. });
  39193. $this._entities_PincerArrow.push(gatheringPlaceEntity);
  39194. return gatheringPlaceEntity;
  39195. }
  39196. createPoint(cartesian) {
  39197. var $this = this;
  39198. var point2 = this.viewer.entities.add({
  39199. position: cartesian,
  39200. point: {
  39201. pixelSize: 10,
  39202. color: $this.Cesium.Color.RED,
  39203. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  39204. }
  39205. });
  39206. $this._entities_point.push(point2);
  39207. return point2;
  39208. }
  39209. cartesianToLatlng(cartesian) {
  39210. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  39211. let lat = this.Cesium.Math.toDegrees(cartographic.latitude);
  39212. let lng = this.Cesium.Math.toDegrees(cartographic.longitude);
  39213. let alt = cartographic.height;
  39214. return [lng, lat, alt];
  39215. }
  39216. destroy() {
  39217. if (this.handler) {
  39218. this.handler.destroy();
  39219. this.handler = null;
  39220. }
  39221. }
  39222. clearPoint() {
  39223. this.DrawEndEvent.raiseEvent(this._gatheringPlaceLast, this._gatheringPlaceData, this.drawType);
  39224. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  39225. this.viewer.entities.remove(this._entities_point[i2]);
  39226. }
  39227. this._entities_point = [];
  39228. }
  39229. clear() {
  39230. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  39231. this.viewer.entities.remove(this._entities_point[i2]);
  39232. }
  39233. for (var i2 = 0; i2 < this._entities_PincerArrow.length; i2++) {
  39234. this.viewer.entities.remove(this._entities_PincerArrow[i2]);
  39235. }
  39236. this.floatingPoint = null;
  39237. this._PincerArrow = null;
  39238. this._PincerArrowLast = null;
  39239. this._positions = [];
  39240. this._entities_point = [];
  39241. this._entities_PincerArrow = [];
  39242. this._PincerArrowData = null;
  39243. }
  39244. getCatesian3FromPX(px) {
  39245. var cartesian;
  39246. var ray = this.viewer.camera.getPickRay(px);
  39247. if (!ray)
  39248. return null;
  39249. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  39250. return cartesian;
  39251. }
  39252. _computeTempPositions() {
  39253. var _this = this;
  39254. var pnts = [].concat(_this._positions);
  39255. var num = pnts.length;
  39256. var first = pnts[0];
  39257. var last = pnts[num - 1];
  39258. if (_this._isSimpleXYZ(first, last) == false) {
  39259. pnts.push(first);
  39260. num += 1;
  39261. }
  39262. _this.tempPositions = [];
  39263. for (var i2 = 1; i2 < num; i2++) {
  39264. var p1 = pnts[i2 - 1];
  39265. var p2 = pnts[i2];
  39266. var cp = _this._computeCenterPotition(p1, p2);
  39267. _this.tempPositions.push(p1);
  39268. _this.tempPositions.push(cp);
  39269. }
  39270. }
  39271. _isSimpleXYZ(p1, p2) {
  39272. if (p1.x == p2.x && p1.y == p2.y && p1.z == p2.z) {
  39273. return true;
  39274. }
  39275. return false;
  39276. }
  39277. _computeCenterPotition(p1, p2) {
  39278. var _this = this;
  39279. var c1 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p1);
  39280. var c2 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p2);
  39281. var cm = new _this.Cesium.EllipsoidGeodesic(c1, c2).interpolateUsingFraction(0.5);
  39282. var cp = _this.viewer.scene.globe.ellipsoid.cartographicToCartesian(cm);
  39283. return cp;
  39284. }
  39285. getLonLat(cartesian) {
  39286. var cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  39287. cartographic.height = this.viewer.scene.globe.getHeight(cartographic);
  39288. var pos = {
  39289. lon: cartographic.longitude,
  39290. lat: cartographic.latitude,
  39291. alt: cartographic.height
  39292. };
  39293. pos.lon = this.Cesium.Math.toDegrees(pos.lon);
  39294. pos.lat = this.Cesium.Math.toDegrees(pos.lat);
  39295. return pos;
  39296. }
  39297. LatlngTocartesian(latlng) {
  39298. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  39299. return cartesian3;
  39300. }
  39301. fineGatheringPlace(gatherPosition) {
  39302. let $this = this;
  39303. let points2 = gatherPosition.length;
  39304. if (points2 < 2) {
  39305. return false;
  39306. } else {
  39307. let pnts = new Array();
  39308. gatherPosition.forEach(function(item) {
  39309. var posLonLat = $this.getLonLat(item);
  39310. pnts.push([posLonLat.lon, posLonLat.lat]);
  39311. });
  39312. if (pnts.length === 2) {
  39313. let mid2 = $this.mid(pnts[0], pnts[1]);
  39314. let d2 = $this.distance(pnts[0], mid2) / 0.9;
  39315. let pnt = $this.getThirdPoint(pnts[0], mid2, Math.PI / 2, d2, true);
  39316. pnts = [pnts[0], pnt, pnts[1]];
  39317. }
  39318. let mid = $this.mid(pnts[0], pnts[2]);
  39319. pnts.push(mid, pnts[0], pnts[1]);
  39320. let [normals, pnt1, pnt2, pnt3, pList] = [
  39321. [],
  39322. void 0,
  39323. void 0,
  39324. void 0,
  39325. []
  39326. ];
  39327. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39328. pnt1 = pnts[i2];
  39329. pnt2 = pnts[i2 + 1];
  39330. pnt3 = pnts[i2 + 2];
  39331. let normalPoints = $this.getBisectorNormals($this.tt, pnt1, pnt2, pnt3);
  39332. normals = normals.concat(normalPoints);
  39333. }
  39334. let count = normals.length;
  39335. normals = [normals[count - 1]].concat(normals.slice(0, count - 1));
  39336. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39337. pnt1 = pnts[i2];
  39338. pnt2 = pnts[i2 + 1];
  39339. pList = pList.concat(pnt1);
  39340. for (let t2 = 0; t2 <= 100; t2++) {
  39341. let pnt = $this.getCubicValue(t2 / 100, pnt1, normals[i2 * 2], normals[i2 * 2 + 1], pnt2);
  39342. pList = pList.concat(pnt);
  39343. }
  39344. pList = pList.concat(pnt2);
  39345. }
  39346. return Cesium.Cartesian3.fromDegreesArray(pList);
  39347. }
  39348. }
  39349. mid(t2, o) {
  39350. return [(t2[0] + o[0]) / 2, (t2[1] + o[1]) / 2];
  39351. }
  39352. distance(t2, o) {
  39353. return Math.sqrt(Math.pow(t2[0] - o[0], 2) + Math.pow(t2[1] - o[1], 2));
  39354. }
  39355. getThirdPoint(t2, o, e, r2, n) {
  39356. var g = this.getAzimuth(t2, o), i2 = n ? g + e : g - e, s = r2 * Math.cos(i2), a = r2 * Math.sin(i2);
  39357. return [o[0] + s, o[1] + a];
  39358. }
  39359. getAzimuth(t2, o) {
  39360. var e, r2 = Math.asin(Math.abs(o[1] - t2[1]) / this.distance(t2, o));
  39361. return o[1] >= t2[1] && o[0] >= t2[0] ? e = r2 + Math.PI : o[1] >= t2[1] && o[0] < t2[0] ? e = 2 * Math.PI - r2 : o[1] < t2[1] && o[0] < t2[0] ? e = r2 : o[1] < t2[1] && o[0] >= t2[0] && (e = Math.PI - r2), e;
  39362. }
  39363. getBisectorNormals(t2, o, e, r2) {
  39364. var n = this.getNormal(o, e, r2), g = Math.sqrt(n[0] * n[0] + n[1] * n[1]), i2 = n[0] / g, s = n[1] / g, a = this.distance(o, e), l = this.distance(e, r2);
  39365. if (g > 1e-4)
  39366. if (this.isClockWise(o, e, r2)) {
  39367. var u = t2 * a, c = e[0] - u * s, p = e[1] + u * i2, h2 = [c, p];
  39368. u = t2 * l, c = e[0] + u * s, p = e[1] - u * i2;
  39369. var d2 = [c, p];
  39370. } else
  39371. u = t2 * a, c = e[0] + u * s, p = e[1] - u * i2, h2 = [c, p], u = t2 * l, c = e[0] - u * s, p = e[1] + u * i2, d2 = [c, p];
  39372. else
  39373. c = e[0] + t2 * (o[0] - e[0]), p = e[1] + t2 * (o[1] - e[1]), h2 = [c, p], c = e[0] + t2 * (r2[0] - e[0]), p = e[1] + t2 * (r2[1] - e[1]), d2 = [c, p];
  39374. return [h2, d2];
  39375. }
  39376. getNormal(t2, o, e) {
  39377. var r2 = t2[0] - o[0], n = t2[1] - o[1], g = Math.sqrt(r2 * r2 + n * n);
  39378. r2 /= g, n /= g;
  39379. var i2 = e[0] - o[0], s = e[1] - o[1], a = Math.sqrt(i2 * i2 + s * s);
  39380. i2 /= a, s /= a;
  39381. var l = r2 + i2, u = n + s;
  39382. return [l, u];
  39383. }
  39384. isClockWise(t2, o, e) {
  39385. return (e[1] - t2[1]) * (o[0] - t2[0]) > (o[1] - t2[1]) * (e[0] - t2[0]);
  39386. }
  39387. getCubicValue(t2, o, e, r2, n) {
  39388. t2 = Math.max(Math.min(t2, 1), 0);
  39389. var g = 1 - t2, i2 = t2 * t2, s = i2 * t2, a = g * g, l = a * g, u = l * o[0] + 3 * a * t2 * e[0] + 3 * g * i2 * r2[0] + s * n[0], c = l * o[1] + 3 * a * t2 * e[1] + 3 * g * i2 * r2[1] + s * n[1];
  39390. return [u, c];
  39391. }
  39392. }
  39393. class DrawClosedCurve {
  39394. constructor(arg) {
  39395. this.viewer = arg.viewer;
  39396. this.Cesium = arg.Cesium;
  39397. this.floatingPoint = null;
  39398. this._ClosedCurve = null;
  39399. this._ClosedCurveLast = null;
  39400. this._positions = [];
  39401. this._entities_point = [];
  39402. this._entities_ClosedCurve = [];
  39403. this._ClosedCurveData = null;
  39404. this.ZERO_TOLERANCE = 1e-4;
  39405. this.FITTING_COUNT = 100;
  39406. this.t = 0.3;
  39407. this.objId = Number(new Date().getTime() + "" + Number(Math.random() * 1e3).toFixed(0));
  39408. this.DrawStartEvent = new Cesium.Event();
  39409. this.DrawEndEvent = new Cesium.Event();
  39410. this._tooltip = createTooltip(this.viewer.container);
  39411. this._param = {
  39412. id: "DrawStraightArrow",
  39413. polygonColor: "rgba(0,255,0,0.5)",
  39414. outlineColor: "rgba(255, 255, 255, 1)",
  39415. outlineWidth: 1
  39416. };
  39417. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  39418. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  39419. }
  39420. get ClosedCurve() {
  39421. return this._ClosedCurveLast;
  39422. }
  39423. getData() {
  39424. return this._ClosedCurveData;
  39425. }
  39426. computePosition(data) {
  39427. let $this = this;
  39428. if (data.length < 2)
  39429. return;
  39430. let pnts = [];
  39431. for (let p = 0; p < data.length; p++) {
  39432. pnts.push($this.cartesianToLatlng(data[p]));
  39433. }
  39434. this._ClosedCurveData = Array.from(pnts);
  39435. pnts.push(pnts[0], pnts[1]);
  39436. let [normals, pList] = [
  39437. [],
  39438. []
  39439. ];
  39440. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39441. let normalPoints = $this.getBisectorNormals($this.t, pnts[i2], pnts[i2 + 1], pnts[i2 + 2]);
  39442. normals = normals.concat(normalPoints);
  39443. }
  39444. let count = normals.length;
  39445. normals = [normals[count - 1]].concat(normals.slice(0, count - 1));
  39446. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39447. let pnt1 = pnts[i2];
  39448. let pnt2 = pnts[i2 + 1];
  39449. pList.push($this.LatlngTocartesian(pnt1));
  39450. for (let t2 = 0; t2 <= $this.FITTING_COUNT; t2++) {
  39451. let pnt = $this.getCubicValue(t2 / $this.FITTING_COUNT, pnt1, normals[i2 * 2], normals[i2 * 2 + 1], pnt2);
  39452. pList.push($this.LatlngTocartesian(pnt));
  39453. }
  39454. pList.push($this.LatlngTocartesian(pnt2));
  39455. }
  39456. let PolygonHierarchy = new $this.Cesium.PolygonHierarchy(pList);
  39457. return {
  39458. PolygonHierarchy,
  39459. pList
  39460. };
  39461. }
  39462. addload(data) {
  39463. let $this = this;
  39464. if (data.length < 2)
  39465. return;
  39466. let pnts = Array.from(data);
  39467. pnts.push(pnts[0], pnts[1]);
  39468. let [normals, pList] = [
  39469. [],
  39470. []
  39471. ];
  39472. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39473. let normalPoints = $this.getBisectorNormals($this.t, pnts[i2], pnts[i2 + 1], pnts[i2 + 2]);
  39474. normals = normals.concat(normalPoints);
  39475. }
  39476. let count = normals.length;
  39477. normals = [normals[count - 1]].concat(normals.slice(0, count - 1));
  39478. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39479. let pnt1 = pnts[i2];
  39480. let pnt2 = pnts[i2 + 1];
  39481. pList.push($this.LatlngTocartesian(pnt1));
  39482. for (let t2 = 0; t2 <= $this.FITTING_COUNT; t2++) {
  39483. let pnt = $this.getCubicValue(t2 / $this.FITTING_COUNT, pnt1, normals[i2 * 2], normals[i2 * 2 + 1], pnt2);
  39484. pList.push($this.LatlngTocartesian(pnt));
  39485. }
  39486. pList.push($this.LatlngTocartesian(pnt2));
  39487. }
  39488. console.log(data, pnts);
  39489. var arrowEntity = $this.viewer.entities.add({
  39490. Type: "DrawClosedCurve",
  39491. Position: data,
  39492. id: data.id || $this.objId,
  39493. polygon: {
  39494. hierarchy: new $this.Cesium.PolygonHierarchy(pList),
  39495. show: true,
  39496. fill: true,
  39497. clampToGround: true,
  39498. material: $this.polygonMaterial
  39499. },
  39500. polyline: {
  39501. positions: pList,
  39502. show: true,
  39503. material: new Cesium.PolylineDashMaterialProperty({
  39504. color: Cesium.Color.YELLOW
  39505. }),
  39506. width: 3,
  39507. clampToGround: true
  39508. }
  39509. });
  39510. return arrowEntity;
  39511. }
  39512. startCreate(drawType) {
  39513. if (isRuntimeApp()) {
  39514. showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  39515. }
  39516. var $this = this;
  39517. this.drawType = drawType;
  39518. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  39519. this.handler.setInputAction(function(evt) {
  39520. if (isRuntimeApp()) {
  39521. var cartesian = $this.getCatesian3FromPX(evt.position);
  39522. if (!cartesian) {
  39523. return;
  39524. }
  39525. $this.createPoint(cartesian);
  39526. $this._positions.push(cartesian);
  39527. if ($this._positions.length > 2) {
  39528. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9\uFF0C\u70B9\u51FB\u5B8C\u6210\u6309\u94AE\uFF0C\u7ED3\u675F\u7ED8\u5236");
  39529. if ($this._positions.length === 3) {
  39530. if (!$this.Cesium.defined($this._ClosedCurve)) {
  39531. $this._ClosedCurve = $this.createClosedCurve();
  39532. createOperationMainDom();
  39533. document.getElementById("btnDrawBackout").style.display = "none";
  39534. document.getElementById("btnDrawComplete").onclick = () => {
  39535. $this._ClosedCurveData = $this._positions.concat();
  39536. $this.viewer.entities.remove($this._ClosedCurve);
  39537. $this._ClosedCurve = null;
  39538. $this._positions = [];
  39539. var lnglatArr = [];
  39540. for (var i2 = 0; i2 < $this._ClosedCurveData.length; i2++) {
  39541. var lnglat = $this.cartesianToLatlng($this._ClosedCurveData[i2]);
  39542. lnglatArr.push(lnglat);
  39543. }
  39544. $this._ClosedCurveData = lnglatArr;
  39545. var ClosedCurve = $this.addload(lnglatArr);
  39546. $this._entities_ClosedCurve.push(ClosedCurve);
  39547. $this._ClosedCurveLast = ClosedCurve;
  39548. $this.clearPoint();
  39549. $this.destroy();
  39550. let buttonDiv = document.getElementById("drawButtonDiv");
  39551. if (buttonDiv) {
  39552. document.body.removeChild(buttonDiv);
  39553. }
  39554. };
  39555. }
  39556. }
  39557. } else {
  39558. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9");
  39559. }
  39560. } else {
  39561. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u5355\u51FB");
  39562. clearTimeout($this._timer);
  39563. $this._timer = setTimeout(function() {
  39564. var cartesian2 = $this.getCatesian3FromPX(evt.position);
  39565. if ($this._positions.length == 0) {
  39566. $this.floatingPoint = $this.createPoint(cartesian2);
  39567. }
  39568. $this._positions.push(cartesian2);
  39569. $this.createPoint(cartesian2);
  39570. }, 200);
  39571. }
  39572. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  39573. this.handler.setInputAction(function(evt) {
  39574. if (isRuntimeApp())
  39575. return;
  39576. if ($this._positions.length == 0) {
  39577. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  39578. } else {
  39579. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9");
  39580. }
  39581. if ($this._positions.length < 2)
  39582. return;
  39583. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9\uFF0C\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  39584. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  39585. if ($this._positions.length == 2) {
  39586. $this._positions.push(cartesian);
  39587. }
  39588. $this._positions.pop();
  39589. $this._positions.push(cartesian);
  39590. if (!$this.Cesium.defined($this._ClosedCurve)) {
  39591. $this._ClosedCurve = $this.createClosedCurve();
  39592. }
  39593. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  39594. this.handler.setInputAction(function(evt) {
  39595. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  39596. this.handler.setInputAction(function(evt) {
  39597. if (isRuntimeApp())
  39598. return;
  39599. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u53CC\u51FB");
  39600. clearTimeout($this._timer);
  39601. if (!$this._ClosedCurve)
  39602. return;
  39603. var cartesian = $this.getCatesian3FromPX(evt.position);
  39604. $this._positions.pop();
  39605. $this._positions.push(cartesian);
  39606. $this._ClosedCurveData = $this._positions.concat();
  39607. $this.viewer.entities.remove($this._ClosedCurve);
  39608. $this._ClosedCurve = null;
  39609. $this._positions = [];
  39610. $this.floatingPoint.position.setValue(cartesian);
  39611. var lnglatArr = [];
  39612. for (var i2 = 0; i2 < $this._ClosedCurveData.length; i2++) {
  39613. var lnglat = $this.cartesianToLatlng($this._ClosedCurveData[i2]);
  39614. lnglatArr.push(lnglat);
  39615. }
  39616. $this._ClosedCurveData = lnglatArr;
  39617. var ClosedCurve = $this.addload(lnglatArr);
  39618. $this._entities_ClosedCurve.push(ClosedCurve);
  39619. $this._ClosedCurveLast = ClosedCurve;
  39620. $this.clearPoint();
  39621. $this.destroy();
  39622. $this._tooltip.setVisible(false);
  39623. }, $this.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  39624. }
  39625. createClosedCurve() {
  39626. var $this = this;
  39627. $this.pLists = "";
  39628. var arrowEntity = $this.viewer.entities.add({
  39629. polygon: {
  39630. hierarchy: new $this.Cesium.CallbackProperty(
  39631. function() {
  39632. if ($this._positions.length < 2)
  39633. return;
  39634. let pnts = [];
  39635. for (let p = 0; p < $this._positions.length; p++) {
  39636. pnts.push($this.cartesianToLatlng($this._positions[p]));
  39637. }
  39638. pnts.push(pnts[0], pnts[1]);
  39639. let [normals, pList] = [
  39640. [],
  39641. []
  39642. ];
  39643. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39644. let normalPoints = $this.getBisectorNormals($this.t, pnts[i2], pnts[i2 + 1], pnts[i2 + 2]);
  39645. normals = normals.concat(normalPoints);
  39646. }
  39647. let count = normals.length;
  39648. normals = [normals[count - 1]].concat(normals.slice(0, count - 1));
  39649. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39650. let pnt1 = pnts[i2];
  39651. let pnt2 = pnts[i2 + 1];
  39652. pList.push($this.LatlngTocartesian(pnt1));
  39653. for (let t2 = 0; t2 <= $this.FITTING_COUNT; t2++) {
  39654. let pnt = $this.getCubicValue(t2 / $this.FITTING_COUNT, pnt1, normals[i2 * 2], normals[i2 * 2 + 1], pnt2);
  39655. pList.push($this.LatlngTocartesian(pnt));
  39656. }
  39657. pList.push($this.LatlngTocartesian(pnt2));
  39658. }
  39659. $this.pLists = pList;
  39660. return new $this.Cesium.PolygonHierarchy(pList);
  39661. },
  39662. false
  39663. ),
  39664. show: true,
  39665. fill: true,
  39666. clampToGround: true,
  39667. material: $this.polygonMaterial
  39668. },
  39669. polyline: {
  39670. positions: new $this.Cesium.CallbackProperty(
  39671. function() {
  39672. return $this.pLists;
  39673. },
  39674. false
  39675. ),
  39676. show: true,
  39677. material: new Cesium.PolylineDashMaterialProperty({
  39678. color: Cesium.Color.YELLOW
  39679. }),
  39680. width: 3,
  39681. clampToGround: true
  39682. }
  39683. });
  39684. $this._entities_ClosedCurve.push(arrowEntity);
  39685. return arrowEntity;
  39686. }
  39687. createPoint(cartesian) {
  39688. var $this = this;
  39689. var point2 = this.viewer.entities.add({
  39690. position: cartesian,
  39691. point: {
  39692. pixelSize: 10,
  39693. color: $this.Cesium.Color.RED,
  39694. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  39695. }
  39696. });
  39697. $this._entities_point.push(point2);
  39698. return point2;
  39699. }
  39700. cartesianToLatlng(cartesian) {
  39701. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  39702. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  39703. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  39704. return [lng, lat];
  39705. }
  39706. LatlngTocartesian(latlng) {
  39707. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  39708. return cartesian3;
  39709. }
  39710. lonLatToMercator(Latlng) {
  39711. var E2 = Latlng[0];
  39712. var N2 = Latlng[1];
  39713. var x = E2 * 2003750834e-2 / 180;
  39714. var y = Math.log(Math.tan((90 + N2) * Math.PI / 360)) / (Math.PI / 180);
  39715. y = y * 2003750834e-2 / 180;
  39716. return [x, y];
  39717. }
  39718. WebMercator2lonLat(mercator) {
  39719. let x = mercator[0] / 2003750834e-2 * 180;
  39720. let ly = mercator[1] / 2003750834e-2 * 180;
  39721. let y = 180 / Math.PI * (2 * Math.atan(Math.exp(ly * Math.PI / 180)) - Math.PI / 2);
  39722. return [x, y];
  39723. }
  39724. destroy() {
  39725. if (this.handler) {
  39726. this.handler.destroy();
  39727. this.handler = null;
  39728. }
  39729. }
  39730. clearPoint() {
  39731. this.DrawEndEvent.raiseEvent(this._ClosedCurveLast, this._ClosedCurveData);
  39732. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  39733. this.viewer.entities.remove(this._entities_point[i2]);
  39734. }
  39735. this._entities_point = [];
  39736. }
  39737. clear() {
  39738. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  39739. this.viewer.entities.remove(this._entities_point[i2]);
  39740. }
  39741. for (var i2 = 0; i2 < this._entities_ClosedCurve.length; i2++) {
  39742. this.viewer.entities.remove(this._entities_ClosedCurve[i2]);
  39743. }
  39744. this.floatingPoint = null;
  39745. this._ClosedCurve = null;
  39746. this._ClosedCurveLast = null;
  39747. this._positions = [];
  39748. this._entities_point = [];
  39749. this._entities_ClosedCurve = [];
  39750. this._ClosedCurveData = null;
  39751. }
  39752. getCatesian3FromPX(px) {
  39753. var cartesian;
  39754. var ray = this.viewer.camera.getPickRay(px);
  39755. if (!ray)
  39756. return null;
  39757. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  39758. return cartesian;
  39759. }
  39760. getBisectorNormals(t2, pnt1, pnt2, pnt3) {
  39761. let $this = this;
  39762. let normal = $this.getNormal(pnt1, pnt2, pnt3);
  39763. let [bisectorNormalRight, bisectorNormalLeft, dt2, x, y] = [null, null, null, null, null];
  39764. let dist = Math.sqrt(normal[0] * normal[0] + normal[1] * normal[1]);
  39765. let uX = normal[0] / dist;
  39766. let uY = normal[1] / dist;
  39767. let d1 = $this.MathDistance(pnt1, pnt2);
  39768. let d2 = $this.MathDistance(pnt2, pnt3);
  39769. if (dist > $this.ZERO_TOLERANCE) {
  39770. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  39771. dt2 = t2 * d1;
  39772. x = pnt2[0] - dt2 * uY;
  39773. y = pnt2[1] + dt2 * uX;
  39774. bisectorNormalRight = [x, y];
  39775. dt2 = t2 * d2;
  39776. x = pnt2[0] + dt2 * uY;
  39777. y = pnt2[1] - dt2 * uX;
  39778. bisectorNormalLeft = [x, y];
  39779. } else {
  39780. dt2 = t2 * d1;
  39781. x = pnt2[0] + dt2 * uY;
  39782. y = pnt2[1] - dt2 * uX;
  39783. bisectorNormalRight = [x, y];
  39784. dt2 = t2 * d2;
  39785. x = pnt2[0] - dt2 * uY;
  39786. y = pnt2[1] + dt2 * uX;
  39787. bisectorNormalLeft = [x, y];
  39788. }
  39789. } else {
  39790. x = pnt2[0] + t2 * (pnt1[0] - pnt2[0]);
  39791. y = pnt2[1] + t2 * (pnt1[1] - pnt2[1]);
  39792. bisectorNormalRight = [x, y];
  39793. x = pnt2[0] + t2 * (pnt3[0] - pnt2[0]);
  39794. y = pnt2[1] + t2 * (pnt3[1] - pnt2[1]);
  39795. bisectorNormalLeft = [x, y];
  39796. }
  39797. return [bisectorNormalRight, bisectorNormalLeft];
  39798. }
  39799. getNormal(pnt1, pnt2, pnt3) {
  39800. let dX1 = pnt1[0] - pnt2[0];
  39801. let dY1 = pnt1[1] - pnt2[1];
  39802. let d1 = Math.sqrt(dX1 * dX1 + dY1 * dY1);
  39803. dX1 /= d1;
  39804. dY1 /= d1;
  39805. let dX2 = pnt3[0] - pnt2[0];
  39806. let dY2 = pnt3[1] - pnt2[1];
  39807. let d2 = Math.sqrt(dX2 * dX2 + dY2 * dY2);
  39808. dX2 /= d2;
  39809. dY2 /= d2;
  39810. let uX = dX1 + dX2;
  39811. let uY = dY1 + dY2;
  39812. return [uX, uY];
  39813. }
  39814. MathDistance(pnt1, pnt2) {
  39815. return Math.sqrt(Math.pow(pnt1[0] - pnt2[0], 2) + Math.pow(pnt1[1] - pnt2[1], 2));
  39816. }
  39817. isClockWise(pnt1, pnt2, pnt3) {
  39818. return (pnt3[1] - pnt1[1]) * (pnt2[0] - pnt1[0]) > (pnt2[1] - pnt1[1]) * (pnt3[0] - pnt1[0]);
  39819. }
  39820. getCubicValue(t2, startPnt, cPnt1, cPnt2, endPnt) {
  39821. t2 = Math.max(Math.min(t2, 1), 0);
  39822. let [tp, t22] = [1 - t2, t2 * t2];
  39823. let t3 = t22 * t2;
  39824. let tp2 = tp * tp;
  39825. let tp3 = tp2 * tp;
  39826. let x = tp3 * startPnt[0] + 3 * tp2 * t2 * cPnt1[0] + 3 * tp * t22 * cPnt2[0] + t3 * endPnt[0];
  39827. let y = tp3 * startPnt[1] + 3 * tp2 * t2 * cPnt1[1] + 3 * tp * t22 * cPnt2[1] + t3 * endPnt[1];
  39828. return [x, y];
  39829. }
  39830. }
  39831. class DrawSector {
  39832. constructor(arg) {
  39833. this.viewer = arg.viewer;
  39834. this.Cesium = arg.Cesium;
  39835. this.floatingPoint = null;
  39836. this._sector = null;
  39837. this._sectorLast = null;
  39838. this._positions = [];
  39839. this._entities_point = [];
  39840. this._entities_sector = [];
  39841. this._sectorData = null;
  39842. this.DrawStartEvent = new Cesium.Event();
  39843. this.DrawEndEvent = new Cesium.Event();
  39844. this._param = {
  39845. id: "DrawStraightArrow",
  39846. polygonColor: "rgba(0,255,0,0.5)",
  39847. outlineColor: "rgba(255, 255, 255, 1)",
  39848. outlineWidth: 1
  39849. };
  39850. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  39851. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  39852. }
  39853. get sector() {
  39854. return this._sectorLast;
  39855. }
  39856. getData() {
  39857. return this._sectorData;
  39858. }
  39859. computePosition(data) {
  39860. let $this = this;
  39861. let pnts = data;
  39862. let center2 = $this.lonLatToMercator($this.cartesianToLatlng(pnts[0]));
  39863. let pnt2 = $this.lonLatToMercator($this.cartesianToLatlng(pnts[1]));
  39864. let pnt3 = $this.lonLatToMercator($this.cartesianToLatlng(pnts[2]));
  39865. var radius = $this.MathDistance(pnt2, center2);
  39866. var startAngle = $this.getAzimuth(pnt2, center2);
  39867. var endAngle = $this.getAzimuth(pnt3, center2);
  39868. var pList = $this.getArcPoints(center2, radius, startAngle, endAngle);
  39869. pList.push(pnts[0], pList[0]);
  39870. let arrow = [];
  39871. for (var i2 = 0; i2 < pList.length; i2++) {
  39872. var cart3 = new $this.Cesium.Cartesian3(pList[i2].x, pList[i2].y, pList[i2].z);
  39873. arrow.push(cart3);
  39874. }
  39875. var lnglatArr = [];
  39876. for (var d2 = 0; d2 < data.length; d2++) {
  39877. lnglatArr.push($this.cartesianToLatlng(data[d2]));
  39878. }
  39879. $this._sectorData = lnglatArr;
  39880. return new $this.Cesium.PolygonHierarchy(arrow);
  39881. }
  39882. addload(data) {
  39883. var $this = this;
  39884. let pnts = data;
  39885. let center2 = $this.lonLatToMercator(pnts[0]);
  39886. let pnt2 = $this.lonLatToMercator(pnts[1]);
  39887. let pnt3 = $this.lonLatToMercator(pnts[2]);
  39888. var radius = $this.MathDistance(pnt2, center2);
  39889. var startAngle = $this.getAzimuth(pnt2, center2);
  39890. var endAngle = $this.getAzimuth(pnt3, center2);
  39891. var pList = $this.getArcPoints(center2, radius, startAngle, endAngle);
  39892. let pntsc = $this.Cesium.Cartesian3.fromDegrees(pnts[0][0], pnts[0][1]);
  39893. pList.push(pntsc, pList[0]);
  39894. let arrow = [];
  39895. for (var i2 = 0; i2 < pList.length; i2++) {
  39896. var cart3 = new $this.Cesium.Cartesian3(pList[i2].x, pList[i2].y, pList[i2].z);
  39897. arrow.push(cart3);
  39898. }
  39899. var arrowEntity = $this.viewer.entities.add({
  39900. Type: "DrawSector",
  39901. Position: data,
  39902. id: data.id || $this.objId,
  39903. polygon: {
  39904. hierarchy: new $this.Cesium.PolygonHierarchy(arrow),
  39905. show: true,
  39906. fill: true,
  39907. clampToGround: true,
  39908. material: $this.Cesium.Color.AQUA.withAlpha(0.9)
  39909. }
  39910. });
  39911. return arrowEntity;
  39912. }
  39913. startCreate() {
  39914. var $this = this;
  39915. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  39916. this.handler.setInputAction(function(evt) {
  39917. var cartesian = $this.getCatesian3FromPX(evt.position);
  39918. if ($this._positions.length < 3) {
  39919. $this.floatingPoint = $this.createPoint(cartesian);
  39920. $this._positions.push(cartesian);
  39921. }
  39922. if (!$this._sector)
  39923. ;
  39924. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  39925. this.handler.setInputAction(function(evt) {
  39926. if ($this._positions.length < 2)
  39927. return;
  39928. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  39929. if ($this._positions.length == 2) {
  39930. $this._positions.push(cartesian);
  39931. }
  39932. if ($this._positions.length == 3) {
  39933. $this._positions.pop();
  39934. $this._positions.push(cartesian);
  39935. if (!$this.Cesium.defined($this._sector)) {
  39936. $this._sector = $this.createsector();
  39937. }
  39938. }
  39939. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  39940. this.handler.setInputAction(function(evt) {
  39941. if (!$this._sector)
  39942. return;
  39943. var cartesian = $this.getCatesian3FromPX(evt.position);
  39944. $this._positions.pop();
  39945. $this._positions.push(cartesian);
  39946. $this._sectorData = $this._positions.concat();
  39947. $this.viewer.entities.remove($this._sector);
  39948. $this._sector = null;
  39949. $this._positions = [];
  39950. $this.floatingPoint.position.setValue(cartesian);
  39951. var lnglatArr = [];
  39952. for (var i2 = 0; i2 < $this._sectorData.length; i2++) {
  39953. var lnglat = $this.cartesianToLatlng($this._sectorData[i2]);
  39954. lnglatArr.push(lnglat);
  39955. }
  39956. $this._sectorData = lnglatArr;
  39957. var sector = $this.addload(lnglatArr);
  39958. $this._entities_sector.push(sector);
  39959. $this._sectorLast = sector;
  39960. $this.clearPoint();
  39961. $this.destroy();
  39962. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  39963. }
  39964. createsector() {
  39965. var $this = this;
  39966. var arrowEntity = $this.viewer.entities.add(
  39967. {
  39968. polygon: {
  39969. hierarchy: new $this.Cesium.CallbackProperty(
  39970. function() {
  39971. let pnts = $this._positions;
  39972. let center2 = $this.lonLatToMercator($this.cartesianToLatlng(pnts[0]));
  39973. let pnt2 = $this.lonLatToMercator($this.cartesianToLatlng(pnts[1]));
  39974. let pnt3 = $this.lonLatToMercator($this.cartesianToLatlng(pnts[2]));
  39975. var radius = $this.MathDistance(pnt2, center2);
  39976. var startAngle = $this.getAzimuth(pnt2, center2);
  39977. var endAngle = $this.getAzimuth(pnt3, center2);
  39978. var pList = $this.getArcPoints(center2, radius, startAngle, endAngle);
  39979. pList.push(pnts[0], pList[0]);
  39980. for (var i2 = 0; i2 < pList.length; i2++) {
  39981. new $this.Cesium.Cartesian3(pList[i2].x, pList[i2].y, pList[i2].z);
  39982. }
  39983. return new $this.Cesium.PolygonHierarchy(pList);
  39984. },
  39985. false
  39986. ),
  39987. show: true,
  39988. fill: true,
  39989. clampToGround: true,
  39990. material: $this.Cesium.Color.AQUA.withAlpha(0.5)
  39991. }
  39992. }
  39993. );
  39994. $this._entities_sector.push(arrowEntity);
  39995. return arrowEntity;
  39996. }
  39997. createPoint(cartesian) {
  39998. var $this = this;
  39999. var point2 = this.viewer.entities.add({
  40000. position: cartesian,
  40001. point: {
  40002. pixelSize: 10,
  40003. color: $this.Cesium.Color.RED,
  40004. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  40005. }
  40006. });
  40007. $this._entities_point.push(point2);
  40008. return point2;
  40009. }
  40010. cartesianToLatlng(cartesian) {
  40011. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  40012. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  40013. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  40014. return [lng, lat];
  40015. }
  40016. lonLatToMercator(Latlng) {
  40017. var E2 = Latlng[0];
  40018. var N2 = Latlng[1];
  40019. var x = E2 * 2003750834e-2 / 180;
  40020. var y = Math.log(Math.tan((90 + N2) * Math.PI / 360)) / (Math.PI / 180);
  40021. y = y * 2003750834e-2 / 180;
  40022. return [x, y];
  40023. }
  40024. WebMercator2lonLat(mercator) {
  40025. let x = mercator[0] / 2003750834e-2 * 180;
  40026. let ly = mercator[1] / 2003750834e-2 * 180;
  40027. let y = 180 / Math.PI * (2 * Math.atan(Math.exp(ly * Math.PI / 180)) - Math.PI / 2);
  40028. return [x, y];
  40029. }
  40030. destroy() {
  40031. if (this.handler) {
  40032. this.handler.destroy();
  40033. this.handler = null;
  40034. }
  40035. }
  40036. clearPoint() {
  40037. this.DrawEndEvent.raiseEvent(this._sectorLast, this._sectorData);
  40038. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  40039. this.viewer.entities.remove(this._entities_point[i2]);
  40040. }
  40041. this._entities_point = [];
  40042. }
  40043. clear() {
  40044. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  40045. this.viewer.entities.remove(this._entities_point[i2]);
  40046. }
  40047. for (var i2 = 0; i2 < this._entities_sector.length; i2++) {
  40048. this.viewer.entities.remove(this._entities_sector[i2]);
  40049. }
  40050. this.floatingPoint = null;
  40051. this._sector = null;
  40052. this._sectorLast = null;
  40053. this._positions = [];
  40054. this._entities_point = [];
  40055. this._entities_sector = [];
  40056. this._sectorData = null;
  40057. }
  40058. getCatesian3FromPX(px) {
  40059. var cartesian;
  40060. var ray = this.viewer.camera.getPickRay(px);
  40061. if (!ray)
  40062. return null;
  40063. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  40064. return cartesian;
  40065. }
  40066. MathDistance(pnt1, pnt2) {
  40067. return Math.sqrt(Math.pow(pnt1[0] - pnt2[0], 2) + Math.pow(pnt1[1] - pnt2[1], 2));
  40068. }
  40069. getAzimuth(startPoint, endPoint) {
  40070. var azimuth;
  40071. var angle = Math.asin(Math.abs(endPoint[1] - startPoint[1]) / this.MathDistance(startPoint, endPoint));
  40072. if (endPoint[1] >= startPoint[1] && endPoint[0] >= startPoint[0]) {
  40073. azimuth = angle + Math.PI;
  40074. } else if (endPoint[1] >= startPoint[1] && endPoint[0] < startPoint[0]) {
  40075. azimuth = Math.PI * 2 - angle;
  40076. } else if (endPoint[1] < startPoint[1] && endPoint[0] < startPoint[0]) {
  40077. azimuth = angle;
  40078. } else if (endPoint[1] < startPoint[1] && endPoint[0] >= startPoint[0]) {
  40079. azimuth = Math.PI - angle;
  40080. }
  40081. return azimuth;
  40082. }
  40083. getArcPoints(center2, radius, startAngle, endAngle) {
  40084. var x = null, y = null, pnts = [], angleDiff = endAngle - startAngle;
  40085. angleDiff = angleDiff < 0 ? angleDiff + Math.PI * 2 : angleDiff;
  40086. for (var i2 = 0; i2 <= 100; i2++) {
  40087. var angle = startAngle + angleDiff * i2 / 100;
  40088. x = center2[0] + radius * Math.cos(angle);
  40089. y = center2[1] + radius * Math.sin(angle);
  40090. let latlon = this.WebMercator2lonLat([x, y]);
  40091. pnts.push(this.Cesium.Cartesian3.fromDegrees(latlon[0], latlon[1]));
  40092. }
  40093. return pnts;
  40094. }
  40095. }
  40096. class DrawBowLine {
  40097. constructor(arg) {
  40098. this.viewer = arg.viewer;
  40099. this.Cesium = arg.Cesium;
  40100. this.tt = 0.4;
  40101. this.floatingPoint = null;
  40102. this.drawHandler = null;
  40103. this.DrawBowLine = null;
  40104. this._DrawBowLineLast = null;
  40105. this._positions = [];
  40106. this._entities_point = [];
  40107. this._entities_PincerArrow = [];
  40108. this._DrawBowLineData = null;
  40109. this.DrawStartEvent = new Cesium.Event();
  40110. this.DrawEndEvent = new Cesium.Event();
  40111. this._param = {
  40112. id: "DrawStraightArrow",
  40113. polygonColor: "rgba(0,255,0,0.5)",
  40114. outlineColor: "rgba(255, 255, 255, 1)",
  40115. outlineWidth: 1
  40116. };
  40117. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  40118. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  40119. }
  40120. get PincerArrow() {
  40121. return this._DrawBowLineLast;
  40122. }
  40123. getData() {
  40124. return this._DrawBowLineData;
  40125. }
  40126. computePosition(data) {
  40127. var $this = this;
  40128. if (data.length < 3) {
  40129. return;
  40130. }
  40131. var DrawBowLine2 = [];
  40132. let positions = [];
  40133. for (var i2 = 0; i2 < data.length; i2++) {
  40134. positions.push($this.cartesianToLatlng(data[i2]));
  40135. var cart3 = $this.lonLatToMercator($this.cartesianToLatlng(data[i2]));
  40136. DrawBowLine2.push(cart3);
  40137. }
  40138. let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowLine2[0], DrawBowLine2[2], DrawBowLine2[1], null, null];
  40139. let center2 = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3);
  40140. let radius = $this.MathDistance(pnt1, center2);
  40141. let angle1 = $this.getAzimuth(pnt1, center2);
  40142. let angle2 = $this.getAzimuth(pnt2, center2);
  40143. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  40144. startAngle = angle2;
  40145. endAngle = angle1;
  40146. } else {
  40147. startAngle = angle1;
  40148. endAngle = angle2;
  40149. }
  40150. let getArcPoint = $this.getArcPoints(center2, radius, startAngle, endAngle);
  40151. let pHierarchy = [];
  40152. for (var l = 0; l < getArcPoint.length; l++) {
  40153. var cart3 = $this.LatlngTocartesian($this.WebMercator2lonLat(getArcPoint[l]));
  40154. pHierarchy.push(cart3);
  40155. }
  40156. $this._DrawBowLineData = positions;
  40157. return pHierarchy;
  40158. }
  40159. addload(data) {
  40160. var $this = this;
  40161. if (data.length < 3) {
  40162. return;
  40163. }
  40164. var DrawBowLine2 = [];
  40165. for (var i2 = 0; i2 < data.length; i2++) {
  40166. var cart3 = $this.lonLatToMercator(data[i2]);
  40167. DrawBowLine2.push(cart3);
  40168. }
  40169. let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowLine2[0], DrawBowLine2[2], DrawBowLine2[1], null, null];
  40170. let center2 = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3);
  40171. let radius = $this.MathDistance(pnt1, center2);
  40172. let angle1 = $this.getAzimuth(pnt1, center2);
  40173. let angle2 = $this.getAzimuth(pnt2, center2);
  40174. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  40175. startAngle = angle2;
  40176. endAngle = angle1;
  40177. } else {
  40178. startAngle = angle1;
  40179. endAngle = angle2;
  40180. }
  40181. let getArcPoint = $this.getArcPoints(center2, radius, startAngle, endAngle);
  40182. let pHierarchy = [];
  40183. for (var l = 0; l < getArcPoint.length; l++) {
  40184. var cart3 = $this.LatlngTocartesian($this.WebMercator2lonLat(getArcPoint[l]));
  40185. pHierarchy.push(cart3);
  40186. }
  40187. var arrowEntity = $this.viewer.entities.add({
  40188. Type: "DrawBowLine",
  40189. Position: data,
  40190. id: data.id || $this.objId,
  40191. polyline: {
  40192. positions: pHierarchy,
  40193. show: true,
  40194. material: $this.Cesium.Color.YELLOW,
  40195. width: 3,
  40196. clampToGround: true
  40197. }
  40198. });
  40199. return arrowEntity;
  40200. }
  40201. startCreate(drawType) {
  40202. this.drawType = drawType;
  40203. var $this = this;
  40204. this.handler = new $this.Cesium.ScreenSpaceEventHandler($this.viewer.scene.canvas);
  40205. this.handler.setInputAction(function(event2) {
  40206. var position2 = event2.position;
  40207. if (!$this.Cesium.defined(position2)) {
  40208. return;
  40209. }
  40210. var ray = $this.viewer.camera.getPickRay(position2);
  40211. if (!$this.Cesium.defined(ray)) {
  40212. return;
  40213. }
  40214. var cartesian = $this.viewer.scene.globe.pick(ray, $this.viewer.scene);
  40215. if (!$this.Cesium.defined(cartesian)) {
  40216. return;
  40217. }
  40218. if ($this._positions.length == 0) {
  40219. $this._positions.push(cartesian.clone());
  40220. $this.floatingPoint = $this.createPoint(cartesian);
  40221. }
  40222. if ($this._positions.length <= 2) {
  40223. $this.createPoint(cartesian);
  40224. $this._positions.push(cartesian);
  40225. }
  40226. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  40227. this.handler.setInputAction(function(event2) {
  40228. if ($this._positions.length < 2) {
  40229. return;
  40230. }
  40231. var position2 = event2.endPosition;
  40232. if (!$this.Cesium.defined(position2)) {
  40233. return;
  40234. }
  40235. var ray = $this.viewer.camera.getPickRay(position2);
  40236. if (!$this.Cesium.defined(ray)) {
  40237. return;
  40238. }
  40239. var cartesian = $this.viewer.scene.globe.pick(ray, $this.viewer.scene);
  40240. if (!$this.Cesium.defined(cartesian)) {
  40241. return;
  40242. }
  40243. if (!$this.Cesium.defined($this.DrawBowLine)) {
  40244. $this.DrawBowLine = $this.createDrawBowLine();
  40245. }
  40246. $this.floatingPoint.position.setValue(cartesian);
  40247. if ($this.DrawBowLine) {
  40248. if ($this._positions.length == 3) {
  40249. $this._positions[1] = cartesian;
  40250. } else {
  40251. $this._positions.pop();
  40252. $this._positions.push(cartesian);
  40253. }
  40254. }
  40255. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  40256. this.handler.setInputAction(function(movement) {
  40257. if ($this._positions.length >= 3) {
  40258. $this._DrawBowLineData = $this._positions.concat();
  40259. $this.viewer.entities.remove($this.DrawBowLine);
  40260. $this.DrawBowLine = null;
  40261. var lnglatArr = [];
  40262. for (var i2 = 0; i2 < $this._DrawBowLineData.length; i2++) {
  40263. var lnglat = $this.cartesianToLatlng($this._DrawBowLineData[i2]);
  40264. lnglatArr.push(lnglat);
  40265. }
  40266. $this._DrawBowLineData = lnglatArr;
  40267. var pincerArrow = $this.addload(lnglatArr);
  40268. $this._entities_PincerArrow.push(pincerArrow);
  40269. $this._DrawBowLineLast = pincerArrow;
  40270. $this.viewer.entities.remove($this.floatingPoint);
  40271. $this.floatingPoint = null;
  40272. $this.clearPoint();
  40273. $this.destroy();
  40274. }
  40275. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  40276. }
  40277. createDrawBowLine() {
  40278. let $this = this;
  40279. var DrawBowLineEntity = $this.viewer.entities.add({
  40280. polyline: {
  40281. positions: new $this.Cesium.CallbackProperty(function() {
  40282. if ($this._positions.length < 3) {
  40283. return;
  40284. }
  40285. var DrawBowLine2 = [];
  40286. for (var i2 = 0; i2 < $this._positions.length; i2++) {
  40287. var cart3 = $this.lonLatToMercator($this.cartesianToLatlng($this._positions[i2]));
  40288. DrawBowLine2.push(cart3);
  40289. }
  40290. let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowLine2[0], DrawBowLine2[2], DrawBowLine2[1], null, null];
  40291. let center2 = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3);
  40292. let radius = $this.MathDistance(pnt1, center2);
  40293. let angle1 = $this.getAzimuth(pnt1, center2);
  40294. let angle2 = $this.getAzimuth(pnt2, center2);
  40295. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  40296. startAngle = angle2;
  40297. endAngle = angle1;
  40298. } else {
  40299. startAngle = angle1;
  40300. endAngle = angle2;
  40301. }
  40302. let getArcPoint = $this.getArcPoints(center2, radius, startAngle, endAngle);
  40303. let pHierarchy = [];
  40304. for (var l = 0; l < getArcPoint.length; l++) {
  40305. var cart3 = $this.LatlngTocartesian($this.WebMercator2lonLat(getArcPoint[l]));
  40306. pHierarchy.push(cart3);
  40307. }
  40308. return pHierarchy;
  40309. }, false),
  40310. show: true,
  40311. material: $this.Cesium.Color.YELLOW,
  40312. width: 3,
  40313. clampToGround: true
  40314. }
  40315. });
  40316. $this._entities_PincerArrow.push(DrawBowLineEntity);
  40317. return DrawBowLineEntity;
  40318. }
  40319. createPoint(cartesian) {
  40320. var $this = this;
  40321. var point2 = this.viewer.entities.add({
  40322. position: cartesian,
  40323. point: {
  40324. pixelSize: 10,
  40325. color: $this.Cesium.Color.RED,
  40326. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  40327. }
  40328. });
  40329. $this._entities_point.push(point2);
  40330. return point2;
  40331. }
  40332. cartesianToLatlng(cartesian) {
  40333. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  40334. let lat = this.Cesium.Math.toDegrees(cartographic.latitude);
  40335. let lng = this.Cesium.Math.toDegrees(cartographic.longitude);
  40336. cartographic.height;
  40337. return [lng, lat];
  40338. }
  40339. destroy() {
  40340. if (this.handler) {
  40341. this.handler.destroy();
  40342. this.handler = null;
  40343. }
  40344. }
  40345. clearPoint() {
  40346. this.DrawEndEvent.raiseEvent(this._DrawBowLineLast, this._DrawBowLineData, this.drawType);
  40347. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  40348. this.viewer.entities.remove(this._entities_point[i2]);
  40349. }
  40350. this._entities_point = [];
  40351. }
  40352. clear() {
  40353. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  40354. this.viewer.entities.remove(this._entities_point[i2]);
  40355. }
  40356. for (var i2 = 0; i2 < this._entities_PincerArrow.length; i2++) {
  40357. this.viewer.entities.remove(this._entities_PincerArrow[i2]);
  40358. }
  40359. this.floatingPoint = null;
  40360. this._PincerArrow = null;
  40361. this._PincerArrowLast = null;
  40362. this._positions = [];
  40363. this._entities_point = [];
  40364. this._entities_PincerArrow = [];
  40365. this._PincerArrowData = null;
  40366. }
  40367. getCatesian3FromPX(px) {
  40368. var cartesian;
  40369. var ray = this.viewer.camera.getPickRay(px);
  40370. if (!ray)
  40371. return null;
  40372. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  40373. return cartesian;
  40374. }
  40375. _computeTempPositions() {
  40376. var _this = this;
  40377. var pnts = [].concat(_this._positions);
  40378. var num = pnts.length;
  40379. var first = pnts[0];
  40380. var last = pnts[num - 1];
  40381. if (_this._isSimpleXYZ(first, last) == false) {
  40382. pnts.push(first);
  40383. num += 1;
  40384. }
  40385. _this.tempPositions = [];
  40386. for (var i2 = 1; i2 < num; i2++) {
  40387. var p1 = pnts[i2 - 1];
  40388. var p2 = pnts[i2];
  40389. var cp = _this._computeCenterPotition(p1, p2);
  40390. _this.tempPositions.push(p1);
  40391. _this.tempPositions.push(cp);
  40392. }
  40393. }
  40394. _isSimpleXYZ(p1, p2) {
  40395. if (p1.x == p2.x && p1.y == p2.y && p1.z == p2.z) {
  40396. return true;
  40397. }
  40398. return false;
  40399. }
  40400. _computeCenterPotition(p1, p2) {
  40401. var _this = this;
  40402. var c1 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p1);
  40403. var c2 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p2);
  40404. var cm = new _this.Cesium.EllipsoidGeodesic(c1, c2).interpolateUsingFraction(0.5);
  40405. var cp = _this.viewer.scene.globe.ellipsoid.cartographicToCartesian(cm);
  40406. return cp;
  40407. }
  40408. getLonLat(cartesian) {
  40409. var cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  40410. cartographic.height = this.viewer.scene.globe.getHeight(cartographic);
  40411. var pos = {
  40412. lon: cartographic.longitude,
  40413. lat: cartographic.latitude,
  40414. alt: cartographic.height
  40415. };
  40416. pos.lon = this.Cesium.Math.toDegrees(pos.lon);
  40417. pos.lat = this.Cesium.Math.toDegrees(pos.lat);
  40418. return pos;
  40419. }
  40420. LatlngTocartesian(latlng) {
  40421. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  40422. return cartesian3;
  40423. }
  40424. lonLatToMercator(Latlng) {
  40425. var E2 = Latlng[0];
  40426. var N2 = Latlng[1];
  40427. var x = E2 * 2003750834e-2 / 180;
  40428. var y = Math.log(Math.tan((90 + N2) * Math.PI / 360)) / (Math.PI / 180);
  40429. y = y * 2003750834e-2 / 180;
  40430. return [x, y];
  40431. }
  40432. WebMercator2lonLat(mercator) {
  40433. let x = mercator[0] / 2003750834e-2 * 180;
  40434. let ly = mercator[1] / 2003750834e-2 * 180;
  40435. let y = 180 / Math.PI * (2 * Math.atan(Math.exp(ly * Math.PI / 180)) - Math.PI / 2);
  40436. return [x, y];
  40437. }
  40438. getCircleCenterOfThreePoints(point1, point2, point3) {
  40439. let pntA = [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
  40440. let pntB = [pntA[0] - point1[1] + point2[1], pntA[1] + point1[0] - point2[0]];
  40441. let pntC = [(point1[0] + point3[0]) / 2, (point1[1] + point3[1]) / 2];
  40442. let pntD = [pntC[0] - point1[1] + point3[1], pntC[1] + point1[0] - point3[0]];
  40443. return this.getIntersectPoint(pntA, pntB, pntC, pntD);
  40444. }
  40445. getIntersectPoint(pntA, pntB, pntC, pntD) {
  40446. if (pntA[1] === pntB[1]) {
  40447. let f2 = (pntD[0] - pntC[0]) / (pntD[1] - pntC[1]);
  40448. let x2 = f2 * (pntA[1] - pntC[1]) + pntC[0];
  40449. let y2 = pntA[1];
  40450. return [x2, y2];
  40451. }
  40452. if (pntC[1] === pntD[1]) {
  40453. let e2 = (pntB[0] - pntA[0]) / (pntB[1] - pntA[1]);
  40454. let x2 = e2 * (pntC[1] - pntA[1]) + pntA[0];
  40455. let y2 = pntC[1];
  40456. return [x2, y2];
  40457. }
  40458. let e = (pntB[0] - pntA[0]) / (pntB[1] - pntA[1]);
  40459. let f = (pntD[0] - pntC[0]) / (pntD[1] - pntC[1]);
  40460. let y = (e * pntA[1] - pntA[0] - f * pntC[1] + pntC[0]) / (e - f);
  40461. let x = e * y - e * pntA[1] + pntA[0];
  40462. return [x, y];
  40463. }
  40464. MathDistance(pnt1, pnt2) {
  40465. return Math.sqrt(Math.pow(pnt1[0] - pnt2[0], 2) + Math.pow(pnt1[1] - pnt2[1], 2));
  40466. }
  40467. getAzimuth(startPoint, endPoint) {
  40468. let azimuth;
  40469. let angle = Math.asin(Math.abs(endPoint[1] - startPoint[1]) / this.MathDistance(startPoint, endPoint));
  40470. if (endPoint[1] >= startPoint[1] && endPoint[0] >= startPoint[0]) {
  40471. azimuth = angle + Math.PI;
  40472. } else if (endPoint[1] >= startPoint[1] && endPoint[0] < startPoint[0]) {
  40473. azimuth = Math.PI * 2 - angle;
  40474. } else if (endPoint[1] < startPoint[1] && endPoint[0] < startPoint[0]) {
  40475. azimuth = angle;
  40476. } else if (endPoint[1] < startPoint[1] && endPoint[0] >= startPoint[0]) {
  40477. azimuth = Math.PI - angle;
  40478. }
  40479. return azimuth;
  40480. }
  40481. isClockWise(pnt1, pnt2, pnt3) {
  40482. return (pnt3[1] - pnt1[1]) * (pnt2[0] - pnt1[0]) > (pnt2[1] - pnt1[1]) * (pnt3[0] - pnt1[0]);
  40483. }
  40484. getArcPoints(center2, radius, startAngle, endAngle) {
  40485. let [x, y, pnts, angleDiff] = [null, null, [], endAngle - startAngle];
  40486. angleDiff = angleDiff < 0 ? angleDiff + Math.PI * 2 : angleDiff;
  40487. for (let i2 = 0; i2 <= 100; i2++) {
  40488. let angle = startAngle + angleDiff * i2 / 100;
  40489. x = center2[0] + radius * Math.cos(angle);
  40490. y = center2[1] + radius * Math.sin(angle);
  40491. pnts.push([x, y]);
  40492. }
  40493. return pnts;
  40494. }
  40495. }
  40496. class DrawBowPlane {
  40497. constructor(arg) {
  40498. this.viewer = arg.viewer;
  40499. this.Cesium = arg.Cesium;
  40500. this.tt = 0.4;
  40501. this.floatingPoint = null;
  40502. this.drawHandler = null;
  40503. this.DrawBowPlane = null;
  40504. this._DrawBowPlaneLast = null;
  40505. this._positions = [];
  40506. this._entities_point = [];
  40507. this._entities_PincerArrow = [];
  40508. this._DrawBowPlaneData = null;
  40509. this.DrawStartEvent = new Cesium.Event();
  40510. this.DrawEndEvent = new Cesium.Event();
  40511. this._param = {
  40512. id: "DrawStraightArrow",
  40513. polygonColor: "rgba(0,255,0,0.5)",
  40514. outlineColor: "rgba(255, 255, 255, 1)",
  40515. outlineWidth: 1
  40516. };
  40517. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  40518. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  40519. }
  40520. get PincerArrow() {
  40521. return this._DrawBowPlaneLast;
  40522. }
  40523. getData() {
  40524. return this._DrawBowPlaneData;
  40525. }
  40526. computePosition(data) {
  40527. var $this = this;
  40528. if (data.length < 3) {
  40529. return;
  40530. }
  40531. var DrawBowPlane2 = [];
  40532. let positions = [];
  40533. for (var i2 = 0; i2 < data.length; i2++) {
  40534. positions.push($this.cartesianToLatlng(data[i2]));
  40535. var cart3 = $this.lonLatToMercator($this.cartesianToLatlng(data[i2]));
  40536. DrawBowPlane2.push(cart3);
  40537. }
  40538. let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowPlane2[0], DrawBowPlane2[2], DrawBowPlane2[1], null, null];
  40539. let center2 = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3);
  40540. let radius = $this.MathDistance(pnt1, center2);
  40541. let angle1 = $this.getAzimuth(pnt1, center2);
  40542. let angle2 = $this.getAzimuth(pnt2, center2);
  40543. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  40544. startAngle = angle2;
  40545. endAngle = angle1;
  40546. } else {
  40547. startAngle = angle1;
  40548. endAngle = angle2;
  40549. }
  40550. let getArcPoint = $this.getArcPoints(center2, radius, startAngle, endAngle);
  40551. let pHierarchy = [];
  40552. for (var l = 0; l < getArcPoint.length; l++) {
  40553. var cart3 = $this.LatlngTocartesian($this.WebMercator2lonLat(getArcPoint[l]));
  40554. pHierarchy.push(cart3);
  40555. }
  40556. pHierarchy.push(pHierarchy[0]);
  40557. $this._DrawBowPlaneData = positions;
  40558. return new $this.Cesium.PolygonHierarchy(pHierarchy);
  40559. }
  40560. addload(data) {
  40561. var $this = this;
  40562. if (data.length < 3) {
  40563. return;
  40564. }
  40565. var DrawBowPlane2 = [];
  40566. for (var i2 = 0; i2 < data.length; i2++) {
  40567. var cart3 = $this.lonLatToMercator(data[i2]);
  40568. DrawBowPlane2.push(cart3);
  40569. }
  40570. let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowPlane2[0], DrawBowPlane2[2], DrawBowPlane2[1], null, null];
  40571. let center2 = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3);
  40572. let radius = $this.MathDistance(pnt1, center2);
  40573. let angle1 = $this.getAzimuth(pnt1, center2);
  40574. let angle2 = $this.getAzimuth(pnt2, center2);
  40575. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  40576. startAngle = angle2;
  40577. endAngle = angle1;
  40578. } else {
  40579. startAngle = angle1;
  40580. endAngle = angle2;
  40581. }
  40582. let getArcPoint = $this.getArcPoints(center2, radius, startAngle, endAngle);
  40583. let pHierarchy = [];
  40584. for (var l = 0; l < getArcPoint.length; l++) {
  40585. var cart3 = $this.LatlngTocartesian($this.WebMercator2lonLat(getArcPoint[l]));
  40586. pHierarchy.push(cart3);
  40587. }
  40588. pHierarchy.push(pHierarchy[0]);
  40589. var arrowEntity = $this.viewer.entities.add(
  40590. {
  40591. Type: "DrawBowPlane",
  40592. Position: data,
  40593. id: data.id || $this.objId,
  40594. polygon: {
  40595. hierarchy: new $this.Cesium.PolygonHierarchy(pHierarchy),
  40596. show: true,
  40597. material: $this.Cesium.Color.YELLOW,
  40598. width: 3,
  40599. clampToGround: true,
  40600. outlineWidth: 3,
  40601. outline: true,
  40602. outlineColor: Cesium.Color.MAGENTA
  40603. }
  40604. }
  40605. );
  40606. return arrowEntity;
  40607. }
  40608. startCreate(drawType) {
  40609. this.drawType = drawType;
  40610. var $this = this;
  40611. this.handler = new $this.Cesium.ScreenSpaceEventHandler($this.viewer.scene.canvas);
  40612. this.handler.setInputAction(function(event2) {
  40613. var position2 = event2.position;
  40614. if (!$this.Cesium.defined(position2)) {
  40615. return;
  40616. }
  40617. var ray = $this.viewer.camera.getPickRay(position2);
  40618. if (!$this.Cesium.defined(ray)) {
  40619. return;
  40620. }
  40621. var cartesian = $this.viewer.scene.globe.pick(ray, $this.viewer.scene);
  40622. if (!$this.Cesium.defined(cartesian)) {
  40623. return;
  40624. }
  40625. if ($this._positions.length == 0) {
  40626. $this._positions.push(cartesian.clone());
  40627. $this.floatingPoint = $this.createPoint(cartesian);
  40628. }
  40629. if ($this._positions.length <= 2) {
  40630. $this.createPoint(cartesian);
  40631. $this._positions.push(cartesian);
  40632. }
  40633. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  40634. this.handler.setInputAction(function(event2) {
  40635. if ($this._positions.length < 2) {
  40636. return;
  40637. }
  40638. var position2 = event2.endPosition;
  40639. if (!$this.Cesium.defined(position2)) {
  40640. return;
  40641. }
  40642. var ray = $this.viewer.camera.getPickRay(position2);
  40643. if (!$this.Cesium.defined(ray)) {
  40644. return;
  40645. }
  40646. var cartesian = $this.viewer.scene.globe.pick(ray, $this.viewer.scene);
  40647. if (!$this.Cesium.defined(cartesian)) {
  40648. return;
  40649. }
  40650. if (!$this.Cesium.defined($this.DrawBowPlane)) {
  40651. $this.DrawBowPlane = $this.createDrawBowPlane();
  40652. }
  40653. $this.floatingPoint.position.setValue(cartesian);
  40654. if ($this.DrawBowPlane) {
  40655. if ($this._positions.length == 3) {
  40656. $this._positions[1] = cartesian;
  40657. } else {
  40658. $this._positions.pop();
  40659. $this._positions.push(cartesian);
  40660. }
  40661. }
  40662. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  40663. this.handler.setInputAction(function(movement) {
  40664. if ($this._positions.length >= 3) {
  40665. $this._DrawBowPlaneData = $this._positions.concat();
  40666. $this.viewer.entities.remove($this.DrawBowPlane);
  40667. $this.DrawBowPlane = null;
  40668. var lnglatArr = [];
  40669. for (var i2 = 0; i2 < $this._DrawBowPlaneData.length; i2++) {
  40670. var lnglat = $this.cartesianToLatlng($this._DrawBowPlaneData[i2]);
  40671. lnglatArr.push(lnglat);
  40672. }
  40673. $this._DrawBowPlaneData = lnglatArr;
  40674. var pincerArrow = $this.addload(lnglatArr);
  40675. $this._entities_PincerArrow.push(pincerArrow);
  40676. $this._DrawBowPlaneLast = pincerArrow;
  40677. $this.viewer.entities.remove($this.floatingPoint);
  40678. $this.floatingPoint = null;
  40679. $this.clearPoint();
  40680. $this.destroy();
  40681. }
  40682. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  40683. }
  40684. createDrawBowPlane() {
  40685. let $this = this;
  40686. var DrawBowPlaneEntity = $this.viewer.entities.add(
  40687. {
  40688. polygon: {
  40689. hierarchy: new $this.Cesium.CallbackProperty(function() {
  40690. if ($this._positions.length < 3) {
  40691. return;
  40692. }
  40693. var DrawBowPlane2 = [];
  40694. for (var i2 = 0; i2 < $this._positions.length; i2++) {
  40695. var cart3 = $this.lonLatToMercator($this.cartesianToLatlng($this._positions[i2]));
  40696. DrawBowPlane2.push(cart3);
  40697. }
  40698. let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowPlane2[0], DrawBowPlane2[2], DrawBowPlane2[1], null, null];
  40699. let center2 = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3);
  40700. let radius = $this.MathDistance(pnt1, center2);
  40701. let angle1 = $this.getAzimuth(pnt1, center2);
  40702. let angle2 = $this.getAzimuth(pnt2, center2);
  40703. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  40704. startAngle = angle2;
  40705. endAngle = angle1;
  40706. } else {
  40707. startAngle = angle1;
  40708. endAngle = angle2;
  40709. }
  40710. let getArcPoint = $this.getArcPoints(center2, radius, startAngle, endAngle);
  40711. let pHierarchy = [];
  40712. for (var l = 0; l < getArcPoint.length; l++) {
  40713. var cart3 = $this.LatlngTocartesian($this.WebMercator2lonLat(getArcPoint[l]));
  40714. pHierarchy.push(cart3);
  40715. }
  40716. pHierarchy.push(pHierarchy[0]);
  40717. return new $this.Cesium.PolygonHierarchy(pHierarchy);
  40718. }, false),
  40719. show: true,
  40720. material: $this.Cesium.Color.YELLOW,
  40721. clampToGround: true
  40722. }
  40723. }
  40724. );
  40725. $this._entities_PincerArrow.push(DrawBowPlaneEntity);
  40726. return DrawBowPlaneEntity;
  40727. }
  40728. createPoint(cartesian) {
  40729. var $this = this;
  40730. var point2 = this.viewer.entities.add({
  40731. position: cartesian,
  40732. point: {
  40733. pixelSize: 10,
  40734. color: $this.Cesium.Color.RED,
  40735. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  40736. }
  40737. });
  40738. $this._entities_point.push(point2);
  40739. return point2;
  40740. }
  40741. cartesianToLatlng(cartesian) {
  40742. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  40743. let lat = this.Cesium.Math.toDegrees(cartographic.latitude);
  40744. let lng = this.Cesium.Math.toDegrees(cartographic.longitude);
  40745. cartographic.height;
  40746. return [lng, lat];
  40747. }
  40748. destroy() {
  40749. if (this.handler) {
  40750. this.handler.destroy();
  40751. this.handler = null;
  40752. }
  40753. }
  40754. clearPoint() {
  40755. this.DrawEndEvent.raiseEvent(this._DrawBowPlaneLast, this._DrawBowPlaneData, this.drawType);
  40756. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  40757. this.viewer.entities.remove(this._entities_point[i2]);
  40758. }
  40759. this._entities_point = [];
  40760. }
  40761. clear() {
  40762. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  40763. this.viewer.entities.remove(this._entities_point[i2]);
  40764. }
  40765. for (var i2 = 0; i2 < this._entities_PincerArrow.length; i2++) {
  40766. this.viewer.entities.remove(this._entities_PincerArrow[i2]);
  40767. }
  40768. this.floatingPoint = null;
  40769. this._PincerArrow = null;
  40770. this._PincerArrowLast = null;
  40771. this._positions = [];
  40772. this._entities_point = [];
  40773. this._entities_PincerArrow = [];
  40774. this._PincerArrowData = null;
  40775. }
  40776. getCatesian3FromPX(px) {
  40777. var cartesian;
  40778. var ray = this.viewer.camera.getPickRay(px);
  40779. if (!ray)
  40780. return null;
  40781. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  40782. return cartesian;
  40783. }
  40784. _computeTempPositions() {
  40785. var _this = this;
  40786. var pnts = [].concat(_this._positions);
  40787. var num = pnts.length;
  40788. var first = pnts[0];
  40789. var last = pnts[num - 1];
  40790. if (_this._isSimpleXYZ(first, last) == false) {
  40791. pnts.push(first);
  40792. num += 1;
  40793. }
  40794. _this.tempPositions = [];
  40795. for (var i2 = 1; i2 < num; i2++) {
  40796. var p1 = pnts[i2 - 1];
  40797. var p2 = pnts[i2];
  40798. var cp = _this._computeCenterPotition(p1, p2);
  40799. _this.tempPositions.push(p1);
  40800. _this.tempPositions.push(cp);
  40801. }
  40802. }
  40803. _isSimpleXYZ(p1, p2) {
  40804. if (p1.x == p2.x && p1.y == p2.y && p1.z == p2.z) {
  40805. return true;
  40806. }
  40807. return false;
  40808. }
  40809. _computeCenterPotition(p1, p2) {
  40810. var _this = this;
  40811. var c1 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p1);
  40812. var c2 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p2);
  40813. var cm = new _this.Cesium.EllipsoidGeodesic(c1, c2).interpolateUsingFraction(0.5);
  40814. var cp = _this.viewer.scene.globe.ellipsoid.cartographicToCartesian(cm);
  40815. return cp;
  40816. }
  40817. getLonLat(cartesian) {
  40818. var cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  40819. cartographic.height = this.viewer.scene.globe.getHeight(cartographic);
  40820. var pos = {
  40821. lon: cartographic.longitude,
  40822. lat: cartographic.latitude,
  40823. alt: cartographic.height
  40824. };
  40825. pos.lon = this.Cesium.Math.toDegrees(pos.lon);
  40826. pos.lat = this.Cesium.Math.toDegrees(pos.lat);
  40827. return pos;
  40828. }
  40829. LatlngTocartesian(latlng) {
  40830. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  40831. return cartesian3;
  40832. }
  40833. lonLatToMercator(Latlng) {
  40834. var E2 = Latlng[0];
  40835. var N2 = Latlng[1];
  40836. var x = E2 * 2003750834e-2 / 180;
  40837. var y = Math.log(Math.tan((90 + N2) * Math.PI / 360)) / (Math.PI / 180);
  40838. y = y * 2003750834e-2 / 180;
  40839. return [x, y];
  40840. }
  40841. WebMercator2lonLat(mercator) {
  40842. let x = mercator[0] / 2003750834e-2 * 180;
  40843. let ly = mercator[1] / 2003750834e-2 * 180;
  40844. let y = 180 / Math.PI * (2 * Math.atan(Math.exp(ly * Math.PI / 180)) - Math.PI / 2);
  40845. return [x, y];
  40846. }
  40847. getCircleCenterOfThreePoints(point1, point2, point3) {
  40848. let pntA = [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
  40849. let pntB = [pntA[0] - point1[1] + point2[1], pntA[1] + point1[0] - point2[0]];
  40850. let pntC = [(point1[0] + point3[0]) / 2, (point1[1] + point3[1]) / 2];
  40851. let pntD = [pntC[0] - point1[1] + point3[1], pntC[1] + point1[0] - point3[0]];
  40852. return this.getIntersectPoint(pntA, pntB, pntC, pntD);
  40853. }
  40854. getIntersectPoint(pntA, pntB, pntC, pntD) {
  40855. if (pntA[1] === pntB[1]) {
  40856. let f2 = (pntD[0] - pntC[0]) / (pntD[1] - pntC[1]);
  40857. let x2 = f2 * (pntA[1] - pntC[1]) + pntC[0];
  40858. let y2 = pntA[1];
  40859. return [x2, y2];
  40860. }
  40861. if (pntC[1] === pntD[1]) {
  40862. let e2 = (pntB[0] - pntA[0]) / (pntB[1] - pntA[1]);
  40863. let x2 = e2 * (pntC[1] - pntA[1]) + pntA[0];
  40864. let y2 = pntC[1];
  40865. return [x2, y2];
  40866. }
  40867. let e = (pntB[0] - pntA[0]) / (pntB[1] - pntA[1]);
  40868. let f = (pntD[0] - pntC[0]) / (pntD[1] - pntC[1]);
  40869. let y = (e * pntA[1] - pntA[0] - f * pntC[1] + pntC[0]) / (e - f);
  40870. let x = e * y - e * pntA[1] + pntA[0];
  40871. return [x, y];
  40872. }
  40873. MathDistance(pnt1, pnt2) {
  40874. return Math.sqrt(Math.pow(pnt1[0] - pnt2[0], 2) + Math.pow(pnt1[1] - pnt2[1], 2));
  40875. }
  40876. getAzimuth(startPoint, endPoint) {
  40877. let azimuth;
  40878. let angle = Math.asin(Math.abs(endPoint[1] - startPoint[1]) / this.MathDistance(startPoint, endPoint));
  40879. if (endPoint[1] >= startPoint[1] && endPoint[0] >= startPoint[0]) {
  40880. azimuth = angle + Math.PI;
  40881. } else if (endPoint[1] >= startPoint[1] && endPoint[0] < startPoint[0]) {
  40882. azimuth = Math.PI * 2 - angle;
  40883. } else if (endPoint[1] < startPoint[1] && endPoint[0] < startPoint[0]) {
  40884. azimuth = angle;
  40885. } else if (endPoint[1] < startPoint[1] && endPoint[0] >= startPoint[0]) {
  40886. azimuth = Math.PI - angle;
  40887. }
  40888. return azimuth;
  40889. }
  40890. isClockWise(pnt1, pnt2, pnt3) {
  40891. return (pnt3[1] - pnt1[1]) * (pnt2[0] - pnt1[0]) > (pnt2[1] - pnt1[1]) * (pnt3[0] - pnt1[0]);
  40892. }
  40893. getArcPoints(center2, radius, startAngle, endAngle) {
  40894. let [x, y, pnts, angleDiff] = [null, null, [], endAngle - startAngle];
  40895. angleDiff = angleDiff < 0 ? angleDiff + Math.PI * 2 : angleDiff;
  40896. for (let i2 = 0; i2 <= 100; i2++) {
  40897. let angle = startAngle + angleDiff * i2 / 100;
  40898. x = center2[0] + radius * Math.cos(angle);
  40899. y = center2[1] + radius * Math.sin(angle);
  40900. pnts.push([x, y]);
  40901. }
  40902. return pnts;
  40903. }
  40904. }
  40905. class DrawCurve {
  40906. constructor(arg) {
  40907. this.viewer = arg.viewer;
  40908. this.Cesium = arg.Cesium;
  40909. this.floatingPoint = null;
  40910. this._curveline = null;
  40911. this._curvelineLast = null;
  40912. this._positions = [];
  40913. this._entities_point = [];
  40914. this._entities_line = [];
  40915. this._curvelineData = null;
  40916. this.DrawStartEvent = new Cesium.Event();
  40917. this.DrawEndEvent = new Cesium.Event();
  40918. this.ZERO_TOLERANCE = 1e-4;
  40919. this.FITTING_COUNT = 100;
  40920. this.t = 0.3;
  40921. this._param = {
  40922. id: "DrawStraightArrow",
  40923. polygonColor: "rgba(0,255,0,0.5)",
  40924. outlineColor: "rgba(255, 255, 255, 1)",
  40925. outlineWidth: 1
  40926. };
  40927. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  40928. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  40929. }
  40930. get curveline() {
  40931. return this._curvelineLast;
  40932. }
  40933. getData() {
  40934. return this._curvelineData;
  40935. }
  40936. addload(data) {
  40937. var $this = this;
  40938. let pnts = [];
  40939. for (let p = 0; p < data.length; p++) {
  40940. pnts.push($this.lonLatToMercator(data[p]));
  40941. }
  40942. let CurvePoints = $this.getCurvePoints(pnts);
  40943. let point2 = [];
  40944. for (let i2 = 0; i2 < CurvePoints.length; i2++) {
  40945. point2.push($this.LatlngTocartesian($this.WebMercator2lonLat(CurvePoints[i2])));
  40946. }
  40947. var polyline = this.viewer.entities.add({
  40948. Type: "DrawCurve",
  40949. Position: data,
  40950. id: data.id || $this.objId,
  40951. polyline: {
  40952. positions: point2,
  40953. show: true,
  40954. material: $this.Cesium.Color.YELLOW,
  40955. width: 3,
  40956. clampToGround: true
  40957. }
  40958. });
  40959. return polyline;
  40960. }
  40961. computePosition(data) {
  40962. let pnts = [];
  40963. let position2 = [];
  40964. for (let p = 0; p < data.length; p++) {
  40965. position2.push(this.cartesianToLatlng(data[p]));
  40966. pnts.push(this.lonLatToMercator(this.cartesianToLatlng(data[p])));
  40967. }
  40968. this._curvelineData = position2;
  40969. let CurvePoints = this.getCurvePoints(pnts);
  40970. let point2 = [];
  40971. for (let i2 = 0; i2 < CurvePoints.length; i2++) {
  40972. point2.push(this.LatlngTocartesian(this.WebMercator2lonLat(CurvePoints[i2])));
  40973. }
  40974. return point2;
  40975. }
  40976. startCreate(drawType) {
  40977. this.drawType = drawType;
  40978. var $this = this;
  40979. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  40980. this.handler.setInputAction(function(evt) {
  40981. var cartesian = $this.getCatesian3FromPX(evt.position);
  40982. if ($this._positions.length == 0) {
  40983. $this._positions.push(cartesian.clone());
  40984. $this.floatingPoint = $this.createPoint(cartesian);
  40985. $this.createPoint(cartesian);
  40986. }
  40987. $this._positions.push(cartesian);
  40988. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  40989. this.handler.setInputAction(function(evt) {
  40990. if ($this._positions.length < 3)
  40991. return;
  40992. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  40993. if (!$this.Cesium.defined($this._curveline)) {
  40994. $this._curveline = $this.createCurveline();
  40995. }
  40996. $this.floatingPoint.position.setValue(cartesian);
  40997. if ($this._curveline) {
  40998. $this._positions.pop();
  40999. $this._positions.push(cartesian);
  41000. }
  41001. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  41002. this.handler.setInputAction(function(evt) {
  41003. if (!$this._curveline)
  41004. return;
  41005. var cartesian = $this.getCatesian3FromPX(evt.position);
  41006. $this._positions.pop();
  41007. $this._positions.push(cartesian);
  41008. $this.createPoint(cartesian);
  41009. $this._curvelineData = $this._positions.concat();
  41010. $this.viewer.entities.remove($this._curveline);
  41011. $this._curveline = null;
  41012. $this._positions = [];
  41013. $this.floatingPoint.position.setValue(cartesian);
  41014. let lnglatArr = [];
  41015. for (var i2 = 0; i2 < $this._curvelineData.length; i2++) {
  41016. var lnglat = $this.cartesianToLatlng($this._curvelineData[i2]);
  41017. lnglatArr.push(lnglat);
  41018. }
  41019. $this._curvelineData = lnglatArr;
  41020. var line = $this.addload($this._curvelineData);
  41021. $this._entities_line.push(line);
  41022. $this._curvelineLast = line;
  41023. $this.clearPoint();
  41024. $this.destroy();
  41025. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  41026. }
  41027. createPoint(cartesian) {
  41028. var $this = this;
  41029. var point2 = this.viewer.entities.add({
  41030. position: cartesian,
  41031. point: {
  41032. pixelSize: 10,
  41033. color: $this.Cesium.Color.RED,
  41034. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  41035. }
  41036. });
  41037. $this._entities_point.push(point2);
  41038. return point2;
  41039. }
  41040. createCurveline() {
  41041. var $this = this;
  41042. var polyline = this.viewer.entities.add({
  41043. polyline: {
  41044. positions: new $this.Cesium.CallbackProperty(function() {
  41045. let pnts = [];
  41046. for (let p = 0; p < $this._positions.length; p++) {
  41047. pnts.push($this.lonLatToMercator($this.cartesianToLatlng($this._positions[p])));
  41048. }
  41049. let CurvePoints = $this.getCurvePoints(pnts);
  41050. let point2 = [];
  41051. for (let i2 = 0; i2 < CurvePoints.length; i2++) {
  41052. point2.push($this.LatlngTocartesian($this.WebMercator2lonLat(CurvePoints[i2])));
  41053. }
  41054. return point2;
  41055. }, false),
  41056. show: true,
  41057. material: $this.Cesium.Color.YELLOW,
  41058. width: 3,
  41059. clampToGround: true
  41060. }
  41061. });
  41062. $this._entities_line.push(polyline);
  41063. return polyline;
  41064. }
  41065. clearPoint() {
  41066. this.DrawEndEvent.raiseEvent(this._curvelineLast, this._curvelineData, this.drawType);
  41067. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  41068. this.viewer.entities.remove(this._entities_point[i2]);
  41069. }
  41070. this._entities_point = [];
  41071. }
  41072. destroy() {
  41073. if (this.handler) {
  41074. this.handler.destroy();
  41075. this.handler = null;
  41076. }
  41077. }
  41078. clear() {
  41079. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  41080. this.viewer.entities.remove(this._entities_point[i2]);
  41081. }
  41082. for (var i2 = 0; i2 < this._entities_line.length; i2++) {
  41083. this.viewer.entities.remove(this._entities_line[i2]);
  41084. }
  41085. this.floatingPoint = null;
  41086. this._curveline = null;
  41087. this._curvelineLast = null;
  41088. this._positions = [];
  41089. this._entities_point = [];
  41090. this._entities_line = [];
  41091. this._curvelineData = null;
  41092. }
  41093. getCatesian3FromPX(px) {
  41094. var cartesian;
  41095. var ray = this.viewer.camera.getPickRay(px);
  41096. if (!ray)
  41097. return null;
  41098. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  41099. return cartesian;
  41100. }
  41101. cartesianToLatlng(cartesian) {
  41102. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  41103. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  41104. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  41105. return [lng, lat];
  41106. }
  41107. LatlngTocartesian(latlng) {
  41108. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  41109. return cartesian3;
  41110. }
  41111. lonLatToMercator(Latlng) {
  41112. var E2 = Latlng[0];
  41113. var N2 = Latlng[1];
  41114. var x = E2 * 2003750834e-2 / 180;
  41115. var y = Math.log(Math.tan((90 + N2) * Math.PI / 360)) / (Math.PI / 180);
  41116. y = y * 2003750834e-2 / 180;
  41117. return [x, y];
  41118. }
  41119. WebMercator2lonLat(mercator) {
  41120. let x = mercator[0] / 2003750834e-2 * 180;
  41121. let ly = mercator[1] / 2003750834e-2 * 180;
  41122. let y = 180 / Math.PI * (2 * Math.atan(Math.exp(ly * Math.PI / 180)) - Math.PI / 2);
  41123. return [x, y];
  41124. }
  41125. getCurvePoints(controlPoints) {
  41126. let leftControl = this.getLeftMostControlPoint(controlPoints, this.t);
  41127. let [pnt1, pnt2, pnt3, normals, points2] = [null, null, null, [leftControl], []];
  41128. for (let i2 = 0; i2 < controlPoints.length - 2; i2++) {
  41129. [pnt1, pnt2, pnt3] = [controlPoints[i2], controlPoints[i2 + 1], controlPoints[i2 + 2]];
  41130. let normalPoints = this.getBisectorNormals(this.t, pnt1, pnt2, pnt3);
  41131. normals = normals.concat(normalPoints);
  41132. }
  41133. let rightControl = this.getRightMostControlPoint(controlPoints, this.t);
  41134. if (rightControl) {
  41135. normals.push(rightControl);
  41136. }
  41137. for (let i2 = 0; i2 < controlPoints.length - 1; i2++) {
  41138. pnt1 = controlPoints[i2];
  41139. pnt2 = controlPoints[i2 + 1];
  41140. points2.push(pnt1);
  41141. for (let t2 = 0; t2 < this.FITTING_COUNT; t2++) {
  41142. let pnt = this.getCubicValue(t2 / this.FITTING_COUNT, pnt1, normals[i2 * 2], normals[i2 * 2 + 1], pnt2);
  41143. points2.push(pnt);
  41144. }
  41145. points2.push(pnt2);
  41146. }
  41147. return points2;
  41148. }
  41149. getLeftMostControlPoint(controlPoints, t2) {
  41150. let [pnt1, pnt2, pnt3, controlX, controlY] = [controlPoints[0], controlPoints[1], controlPoints[2], null, null];
  41151. let pnts = this.getBisectorNormals(0, pnt1, pnt2, pnt3);
  41152. let normalRight = pnts[0];
  41153. let normal = this.getNormal(pnt1, pnt2, pnt3);
  41154. let dist = Math.sqrt(normal[0] * normal[0] + normal[1] * normal[1]);
  41155. if (dist > this.ZERO_TOLERANCE) {
  41156. let mid = this.Mid(pnt1, pnt2);
  41157. let pX = pnt1[0] - mid[0];
  41158. let pY = pnt1[1] - mid[1];
  41159. let d1 = this.MathDistance(pnt1, pnt2);
  41160. let n = 2 / d1;
  41161. let nX = -n * pY;
  41162. let nY = n * pX;
  41163. let a11 = nX * nX - nY * nY;
  41164. let a12 = 2 * nX * nY;
  41165. let a22 = nY * nY - nX * nX;
  41166. let dX = normalRight[0] - mid[0];
  41167. let dY = normalRight[1] - mid[1];
  41168. controlX = mid[0] + a11 * dX + a12 * dY;
  41169. controlY = mid[1] + a12 * dX + a22 * dY;
  41170. } else {
  41171. controlX = pnt1[0] + t2 * (pnt2[0] - pnt1[0]);
  41172. controlY = pnt1[1] + t2 * (pnt2[1] - pnt1[1]);
  41173. }
  41174. return [controlX, controlY];
  41175. }
  41176. getBisectorNormals(t2, pnt1, pnt2, pnt3) {
  41177. let normal = this.getNormal(pnt1, pnt2, pnt3);
  41178. let [bisectorNormalRight, bisectorNormalLeft, dt2, x, y] = [null, null, null, null, null];
  41179. let dist = Math.sqrt(normal[0] * normal[0] + normal[1] * normal[1]);
  41180. let uX = normal[0] / dist;
  41181. let uY = normal[1] / dist;
  41182. let d1 = this.MathDistance(pnt1, pnt2);
  41183. let d2 = this.MathDistance(pnt2, pnt3);
  41184. if (dist > this.ZERO_TOLERANCE) {
  41185. if (this.isClockWise(pnt1, pnt2, pnt3)) {
  41186. dt2 = t2 * d1;
  41187. x = pnt2[0] - dt2 * uY;
  41188. y = pnt2[1] + dt2 * uX;
  41189. bisectorNormalRight = [x, y];
  41190. dt2 = t2 * d2;
  41191. x = pnt2[0] + dt2 * uY;
  41192. y = pnt2[1] - dt2 * uX;
  41193. bisectorNormalLeft = [x, y];
  41194. } else {
  41195. dt2 = t2 * d1;
  41196. x = pnt2[0] + dt2 * uY;
  41197. y = pnt2[1] - dt2 * uX;
  41198. bisectorNormalRight = [x, y];
  41199. dt2 = t2 * d2;
  41200. x = pnt2[0] - dt2 * uY;
  41201. y = pnt2[1] + dt2 * uX;
  41202. bisectorNormalLeft = [x, y];
  41203. }
  41204. } else {
  41205. x = pnt2[0] + t2 * (pnt1[0] - pnt2[0]);
  41206. y = pnt2[1] + t2 * (pnt1[1] - pnt2[1]);
  41207. bisectorNormalRight = [x, y];
  41208. x = pnt2[0] + t2 * (pnt3[0] - pnt2[0]);
  41209. y = pnt2[1] + t2 * (pnt3[1] - pnt2[1]);
  41210. bisectorNormalLeft = [x, y];
  41211. }
  41212. return [bisectorNormalRight, bisectorNormalLeft];
  41213. }
  41214. getNormal(pnt1, pnt2, pnt3) {
  41215. let dX1 = pnt1[0] - pnt2[0];
  41216. let dY1 = pnt1[1] - pnt2[1];
  41217. let d1 = Math.sqrt(dX1 * dX1 + dY1 * dY1);
  41218. dX1 /= d1;
  41219. dY1 /= d1;
  41220. let dX2 = pnt3[0] - pnt2[0];
  41221. let dY2 = pnt3[1] - pnt2[1];
  41222. let d2 = Math.sqrt(dX2 * dX2 + dY2 * dY2);
  41223. dX2 /= d2;
  41224. dY2 /= d2;
  41225. let uX = dX1 + dX2;
  41226. let uY = dY1 + dY2;
  41227. return [uX, uY];
  41228. }
  41229. isClockWise(pnt1, pnt2, pnt3) {
  41230. return (pnt3[1] - pnt1[1]) * (pnt2[0] - pnt1[0]) > (pnt2[1] - pnt1[1]) * (pnt3[0] - pnt1[0]);
  41231. }
  41232. Mid(point1, point2) {
  41233. return [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
  41234. }
  41235. MathDistance(pnt1, pnt2) {
  41236. return Math.sqrt(Math.pow(pnt1[0] - pnt2[0], 2) + Math.pow(pnt1[1] - pnt2[1], 2));
  41237. }
  41238. getRightMostControlPoint(controlPoints, t2) {
  41239. let count = controlPoints.length;
  41240. let pnt1 = controlPoints[count - 3];
  41241. let pnt2 = controlPoints[count - 2];
  41242. let pnt3 = controlPoints[count - 1];
  41243. let pnts = this.getBisectorNormals(0, pnt1, pnt2, pnt3);
  41244. let normalLeft = pnts[1];
  41245. let normal = this.getNormal(pnt1, pnt2, pnt3);
  41246. let dist = Math.sqrt(normal[0] * normal[0] + normal[1] * normal[1]);
  41247. let [controlX, controlY] = [null, null];
  41248. if (dist > this.ZERO_TOLERANCE) {
  41249. let mid = this.Mid(pnt2, pnt3);
  41250. let pX = pnt3[0] - mid[0];
  41251. let pY = pnt3[1] - mid[1];
  41252. let d1 = this.MathDistance(pnt2, pnt3);
  41253. let n = 2 / d1;
  41254. let nX = -n * pY;
  41255. let nY = n * pX;
  41256. let a11 = nX * nX - nY * nY;
  41257. let a12 = 2 * nX * nY;
  41258. let a22 = nY * nY - nX * nX;
  41259. let dX = normalLeft[0] - mid[0];
  41260. let dY = normalLeft[1] - mid[1];
  41261. controlX = mid[0] + a11 * dX + a12 * dY;
  41262. controlY = mid[1] + a12 * dX + a22 * dY;
  41263. } else {
  41264. controlX = pnt3[0] + t2 * (pnt2[0] - pnt3[0]);
  41265. controlY = pnt3[1] + t2 * (pnt2[1] - pnt3[1]);
  41266. }
  41267. return [controlX, controlY];
  41268. }
  41269. getCubicValue(t2, startPnt, cPnt1, cPnt2, endPnt) {
  41270. t2 = Math.max(Math.min(t2, 1), 0);
  41271. let [tp, t22] = [1 - t2, t2 * t2];
  41272. let t3 = t22 * t2;
  41273. let tp2 = tp * tp;
  41274. let tp3 = tp2 * tp;
  41275. let x = tp3 * startPnt[0] + 3 * tp2 * t2 * cPnt1[0] + 3 * tp * t22 * cPnt2[0] + t3 * endPnt[0];
  41276. let y = tp3 * startPnt[1] + 3 * tp2 * t2 * cPnt1[1] + 3 * tp * t22 * cPnt2[1] + t3 * endPnt[1];
  41277. return [x, y];
  41278. }
  41279. }
  41280. class DrawCurveFlag {
  41281. constructor(arg) {
  41282. this.viewer = arg.viewer;
  41283. this.Cesium = arg.Cesium;
  41284. this.identificationPoint = null;
  41285. this.CurveFlag = null;
  41286. this.CurveFlagLast = null;
  41287. this.positions = [];
  41288. this.entitiesPoint = [];
  41289. this.entitiesCurveFlag = [];
  41290. this.CurveFlagData = null;
  41291. this.DrawStartEvent = new Cesium.Event();
  41292. this.DrawEndEvent = new Cesium.Event();
  41293. this._param = {
  41294. id: "DrawStraightArrow",
  41295. polygonColor: "rgba(0,255,0,0.5)",
  41296. outlineColor: "rgba(255, 255, 255, 1)",
  41297. outlineWidth: 1
  41298. };
  41299. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  41300. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  41301. }
  41302. getData() {
  41303. return this.CurveFlagData;
  41304. }
  41305. computePosition(data) {
  41306. let $this = this;
  41307. var lnglatArr = [];
  41308. for (var i2 = 0; i2 < data.length; i2++) {
  41309. var lnglat = $this.cartesianToLatlng(data[i2]);
  41310. lnglatArr.push(lnglat);
  41311. }
  41312. let startPoint = lnglatArr[0];
  41313. let endPoint = lnglatArr[lnglatArr.length - 1];
  41314. let point1 = startPoint;
  41315. let point2 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41316. let point3 = [(startPoint[0] + endPoint[0]) / 2, startPoint[1]];
  41317. let point4 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], -(endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41318. let point5 = [endPoint[0], startPoint[1]];
  41319. let point6 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41320. let point7 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 3 / 8 + startPoint[1]];
  41321. let point8 = [(startPoint[0] + endPoint[0]) / 2, (startPoint[1] + endPoint[1]) / 2];
  41322. let point9 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 5 / 8 + startPoint[1]];
  41323. let point10 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41324. let point11 = [startPoint[0], endPoint[1]];
  41325. let curve1 = $this.getBezierPoints([point1, point2, point3, point4, point5]);
  41326. let curve2 = $this.getBezierPoints([point6, point7, point8, point9, point10]);
  41327. let componentspolygon = [];
  41328. componentspolygon = curve1.concat(curve2);
  41329. let PolygonHierarchy = new $this.Cesium.PolygonHierarchy(componentspolygon);
  41330. let componentspolyline = [];
  41331. componentspolyline = curve1.concat(curve2);
  41332. componentspolyline.push($this.LatlngTocartesian(point1));
  41333. componentspolyline.push($this.LatlngTocartesian(point11));
  41334. $this.CurveFlagData = lnglatArr;
  41335. return [PolygonHierarchy, componentspolyline];
  41336. }
  41337. addload(data) {
  41338. var $this = this;
  41339. if (data.length < 2)
  41340. return;
  41341. let startPoint = data[0];
  41342. let endPoint = data[data.length - 1];
  41343. let point1 = startPoint;
  41344. let point2 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41345. let point3 = [(startPoint[0] + endPoint[0]) / 2, startPoint[1]];
  41346. let point4 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], -(endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41347. let point5 = [endPoint[0], startPoint[1]];
  41348. let point6 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41349. let point7 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 3 / 8 + startPoint[1]];
  41350. let point8 = [(startPoint[0] + endPoint[0]) / 2, (startPoint[1] + endPoint[1]) / 2];
  41351. let point9 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 5 / 8 + startPoint[1]];
  41352. let point10 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41353. let point11 = [startPoint[0], endPoint[1]];
  41354. let curve1 = $this.getBezierPoints([point1, point2, point3, point4, point5]);
  41355. let curve2 = $this.getBezierPoints([point6, point7, point8, point9, point10]);
  41356. let componentspolygon = [];
  41357. componentspolygon = curve1.concat(curve2);
  41358. let componentspolyline = [];
  41359. componentspolyline = curve1.concat(curve2);
  41360. componentspolyline.push($this.LatlngTocartesian(point1));
  41361. componentspolyline.push($this.LatlngTocartesian(point11));
  41362. var shape = this.viewer.entities.add({
  41363. Type: "DrawCurveFlag",
  41364. Position: data,
  41365. id: data.id || $this.objId,
  41366. polygon: {
  41367. hierarchy: new $this.Cesium.PolygonHierarchy(componentspolygon),
  41368. extrudedHeight: 1,
  41369. material: $this.Cesium.Color.RED
  41370. },
  41371. polyline: {
  41372. positions: componentspolyline,
  41373. show: true,
  41374. material: $this.Cesium.Color.YELLOW,
  41375. width: 5,
  41376. clampToGround: true
  41377. }
  41378. });
  41379. $this.entitiesCurveFlag.push(shape);
  41380. return shape;
  41381. }
  41382. startCreate(drawType) {
  41383. this.drawType = drawType;
  41384. var $this = this;
  41385. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  41386. this.handler.setInputAction(function(evt) {
  41387. var cartesian = $this.getCatesian3FromPX(evt.position);
  41388. if ($this.positions.length == 0) {
  41389. $this.positions.push(cartesian.clone());
  41390. $this.identificationPoint = $this.createPoint(cartesian);
  41391. $this.createPoint(cartesian);
  41392. $this.positions.push(cartesian);
  41393. }
  41394. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  41395. this.handler.setInputAction(function(evt) {
  41396. if ($this.positions.length < 2)
  41397. return;
  41398. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  41399. if (!$this.Cesium.defined($this.CurveFlag)) {
  41400. $this.CurveFlag = $this.createCurveFlag();
  41401. }
  41402. $this.identificationPoint.position.setValue(cartesian);
  41403. if ($this.CurveFlag) {
  41404. $this.positions.pop();
  41405. $this.positions.push(cartesian);
  41406. }
  41407. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  41408. this.handler.setInputAction(function(evt) {
  41409. if (!$this.CurveFlag)
  41410. return;
  41411. var cartesian = $this.getCatesian3FromPX(evt.position);
  41412. $this.positions.pop();
  41413. $this.positions.push(cartesian);
  41414. $this.createPoint(cartesian);
  41415. $this.CurveFlagData = $this.positions.concat();
  41416. $this.viewer.entities.remove($this.CurveFlag);
  41417. $this.CurveFlag = null;
  41418. $this.positions = [];
  41419. $this.identificationPoint.position.setValue(cartesian);
  41420. var lnglatArr = [];
  41421. for (var i2 = 0; i2 < $this.CurveFlagData.length; i2++) {
  41422. var lnglat = $this.cartesianToLatlng($this.CurveFlagData[i2]);
  41423. lnglatArr.push(lnglat);
  41424. }
  41425. $this.CurveFlagData = lnglatArr;
  41426. var CurveFlag = $this.addload([$this.CurveFlagData[0], $this.CurveFlagData[$this.CurveFlagData.length - 1]]);
  41427. $this.entitiesCurveFlag.push(CurveFlag);
  41428. $this.CurveFlagLast = CurveFlag;
  41429. $this.clearPoint();
  41430. $this.destroy();
  41431. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  41432. }
  41433. createPoint(cartesian) {
  41434. var $this = this;
  41435. var point2 = this.viewer.entities.add({
  41436. position: cartesian,
  41437. point: {
  41438. pixelSize: 10,
  41439. color: $this.Cesium.Color.RED,
  41440. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  41441. }
  41442. });
  41443. $this.entitiesPoint.push(point2);
  41444. return point2;
  41445. }
  41446. createCurveFlag() {
  41447. var $this = this;
  41448. var polygon2 = this.viewer.entities.add({
  41449. polygon: {
  41450. hierarchy: new $this.Cesium.CallbackProperty(function() {
  41451. if ($this.positions.length < 2)
  41452. return;
  41453. let lonlat = [];
  41454. let components = [];
  41455. let length = $this.positions.length;
  41456. for (let i2 = 0; i2 < length; i2++) {
  41457. lonlat.push($this.cartesianToLatlng($this.positions[i2]));
  41458. }
  41459. let startPoint = lonlat[0];
  41460. let endPoint = lonlat[lonlat.length - 1];
  41461. let point1 = startPoint;
  41462. let point2 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41463. let point3 = [(startPoint[0] + endPoint[0]) / 2, startPoint[1]];
  41464. let point4 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], -(endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41465. let point5 = [endPoint[0], startPoint[1]];
  41466. let point6 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41467. let point7 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 3 / 8 + startPoint[1]];
  41468. let point8 = [(startPoint[0] + endPoint[0]) / 2, (startPoint[1] + endPoint[1]) / 2];
  41469. let point9 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 5 / 8 + startPoint[1]];
  41470. let point10 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41471. [startPoint[0], endPoint[1]];
  41472. let curve1 = $this.getBezierPoints([point1, point2, point3, point4, point5]);
  41473. let curve2 = $this.getBezierPoints([point6, point7, point8, point9, point10]);
  41474. components = curve1.concat(curve2);
  41475. return new $this.Cesium.PolygonHierarchy(components);
  41476. }, false),
  41477. extrudedHeight: 1,
  41478. material: $this.Cesium.Color.RED
  41479. },
  41480. polyline: {
  41481. positions: new $this.Cesium.CallbackProperty(function() {
  41482. if ($this.positions.length < 2)
  41483. return;
  41484. let lonlat = [];
  41485. let components = [];
  41486. let length = $this.positions.length;
  41487. for (let i2 = 0; i2 < length; i2++) {
  41488. lonlat.push($this.cartesianToLatlng($this.positions[i2]));
  41489. }
  41490. let startPoint = lonlat[0];
  41491. let endPoint = lonlat[lonlat.length - 1];
  41492. let point1 = startPoint;
  41493. let point2 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41494. let point3 = [(startPoint[0] + endPoint[0]) / 2, startPoint[1]];
  41495. let point4 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], -(endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41496. let point5 = [endPoint[0], startPoint[1]];
  41497. let point6 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41498. let point7 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 3 / 8 + startPoint[1]];
  41499. let point8 = [(startPoint[0] + endPoint[0]) / 2, (startPoint[1] + endPoint[1]) / 2];
  41500. let point9 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 5 / 8 + startPoint[1]];
  41501. let point10 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41502. let point11 = [startPoint[0], endPoint[1]];
  41503. let curve1 = $this.getBezierPoints([point1, point2, point3, point4, point5]);
  41504. let curve2 = $this.getBezierPoints([point6, point7, point8, point9, point10]);
  41505. components = curve1.concat(curve2);
  41506. components.push($this.LatlngTocartesian(point1));
  41507. components.push($this.LatlngTocartesian(point11));
  41508. return components;
  41509. }, false),
  41510. show: true,
  41511. material: $this.Cesium.Color.YELLOW,
  41512. width: 5,
  41513. clampToGround: true
  41514. }
  41515. });
  41516. $this.entitiesCurveFlag.push(polygon2);
  41517. return polygon2;
  41518. }
  41519. cartesianToLatlng(cartesian) {
  41520. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  41521. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  41522. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  41523. return [lng, lat];
  41524. }
  41525. LatlngTocartesian(latlng) {
  41526. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  41527. return cartesian3;
  41528. }
  41529. clearPoint() {
  41530. this.DrawEndEvent.raiseEvent(this.CurveFlagLast, [this.CurveFlagData[0], this.CurveFlagData[this.CurveFlagData.length - 1]], this.drawType);
  41531. for (var i2 = 0; i2 < this.entitiesPoint.length; i2++) {
  41532. this.viewer.entities.remove(this.entitiesPoint[i2]);
  41533. }
  41534. this.entitiesPoint = [];
  41535. }
  41536. destroy() {
  41537. if (this.handler) {
  41538. this.handler.destroy();
  41539. this.handler = null;
  41540. }
  41541. }
  41542. clear() {
  41543. for (var i2 = 0; i2 < this.entitiesPoint.length; i2++) {
  41544. this.viewer.entities.remove(this.entitiesPoint[i2]);
  41545. }
  41546. for (var i2 = 0; i2 < this.entitiesCurveFlag.length; i2++) {
  41547. this.viewer.entities.remove(this.entitiesCurveFlag[i2]);
  41548. }
  41549. this.identificationPoint = null;
  41550. this.CurveFlag = null;
  41551. this.CurveFlagLast = null;
  41552. this.positions = [];
  41553. this.entitiesPoint = [];
  41554. this.entitiesCurveFlag = [];
  41555. this.CurveFlagData = null;
  41556. }
  41557. getCatesian3FromPX(px) {
  41558. var cartesian;
  41559. var ray = this.viewer.camera.getPickRay(px);
  41560. if (!ray)
  41561. return null;
  41562. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  41563. return cartesian;
  41564. }
  41565. getBezierPoints(points2) {
  41566. let $this = this;
  41567. if (points2.length <= 2) {
  41568. return points2;
  41569. } else {
  41570. let bezierPoints = [];
  41571. let n = points2.length - 1;
  41572. for (let t2 = 0; t2 <= 1; t2 += 0.01) {
  41573. let [x, y] = [0, 0];
  41574. for (let index2 = 0; index2 <= n; index2++) {
  41575. let factor = $this.getBinomialFactor(n, index2);
  41576. let a = Math.pow(t2, index2);
  41577. let b = Math.pow(1 - t2, n - index2);
  41578. x += factor * a * b * points2[index2][0];
  41579. y += factor * a * b * points2[index2][1];
  41580. }
  41581. bezierPoints.push($this.LatlngTocartesian([x, y]));
  41582. }
  41583. bezierPoints.push($this.LatlngTocartesian(points2[n]));
  41584. return bezierPoints;
  41585. }
  41586. }
  41587. getBinomialFactor(n, index2) {
  41588. return this.getFactorial(n) / (this.getFactorial(index2) * this.getFactorial(n - index2));
  41589. }
  41590. getFactorial(n) {
  41591. let result = 1;
  41592. switch (n) {
  41593. case n <= 1:
  41594. result = 1;
  41595. break;
  41596. case n === 2:
  41597. result = 2;
  41598. break;
  41599. case n === 3:
  41600. result = 6;
  41601. break;
  41602. case n === 24:
  41603. result = 24;
  41604. break;
  41605. case n === 5:
  41606. result = 120;
  41607. break;
  41608. default:
  41609. for (let i2 = 1; i2 <= n; i2++) {
  41610. result *= i2;
  41611. }
  41612. break;
  41613. }
  41614. return result;
  41615. }
  41616. }
  41617. class DrawRectFlag {
  41618. constructor(arg) {
  41619. this.viewer = arg.viewer;
  41620. this.Cesium = arg.Cesium;
  41621. this.identificationPoint = null;
  41622. this.RectFlag = null;
  41623. this.RectFlagLast = null;
  41624. this.positions = [];
  41625. this.entitiesPoint = [];
  41626. this.entitiesRectFlag = [];
  41627. this.RectFlagData = null;
  41628. this.DrawStartEvent = new Cesium.Event();
  41629. this.DrawEndEvent = new Cesium.Event();
  41630. this._param = {
  41631. id: "DrawStraightArrow",
  41632. polygonColor: "rgba(0,255,0,0.5)",
  41633. outlineColor: "rgba(255, 255, 255, 1)",
  41634. outlineWidth: 1
  41635. };
  41636. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  41637. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  41638. }
  41639. getData() {
  41640. return this.RectFlagData;
  41641. }
  41642. computePosition(data) {
  41643. let $this = this;
  41644. var lnglatArr = [];
  41645. for (var i2 = 0; i2 < data.length; i2++) {
  41646. var lnglat = $this.cartesianToLatlng(data[i2]);
  41647. lnglatArr.push(lnglat);
  41648. }
  41649. let startPoint = lnglatArr[0];
  41650. let endPoint = lnglatArr[lnglatArr.length - 1];
  41651. let point0 = lnglatArr[0];
  41652. var point1 = [endPoint[0], startPoint[1]];
  41653. var point2 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41654. var point3 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41655. var point4 = [startPoint[0], endPoint[1]];
  41656. let componentspolygon = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point3, ...point0]);
  41657. let componentspolyline = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point3, ...point0, ...point4]);
  41658. let PolygonHierarchy = new $this.Cesium.PolygonHierarchy(componentspolygon);
  41659. $this.RectFlagData = lnglatArr;
  41660. console.log([PolygonHierarchy, componentspolyline]);
  41661. return [PolygonHierarchy, componentspolyline];
  41662. }
  41663. addload(data) {
  41664. var $this = this;
  41665. if (data.length < 2)
  41666. return;
  41667. let startPoint = data[0];
  41668. let endPoint = data[data.length - 1];
  41669. let point0 = data[0];
  41670. var point1 = [endPoint[0], startPoint[1]];
  41671. var point2 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41672. var point3 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41673. var point4 = [startPoint[0], endPoint[1]];
  41674. let componentspolygon = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point3, ...point0]);
  41675. let componentspolyline = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point3, ...point0, ...point4]);
  41676. var shape = this.viewer.entities.add({
  41677. Type: "DrawRectFlag",
  41678. Position: data,
  41679. id: data.id || $this.objId,
  41680. polygon: {
  41681. hierarchy: new $this.Cesium.PolygonHierarchy(componentspolygon),
  41682. extrudedHeight: 1,
  41683. material: $this.Cesium.Color.RED
  41684. },
  41685. polyline: {
  41686. positions: componentspolyline,
  41687. show: true,
  41688. material: $this.Cesium.Color.YELLOW,
  41689. width: 5,
  41690. clampToGround: true
  41691. }
  41692. });
  41693. $this.entitiesRectFlag.push(shape);
  41694. return shape;
  41695. }
  41696. startCreate(drawType) {
  41697. this.drawType = drawType;
  41698. var $this = this;
  41699. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  41700. this.handler.setInputAction(function(evt) {
  41701. var cartesian = $this.getCatesian3FromPX(evt.position);
  41702. if ($this.positions.length == 0) {
  41703. $this.positions.push(cartesian.clone());
  41704. $this.identificationPoint = $this.createPoint(cartesian);
  41705. $this.createPoint(cartesian);
  41706. $this.positions.push(cartesian);
  41707. }
  41708. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  41709. this.handler.setInputAction(function(evt) {
  41710. if ($this.positions.length < 2)
  41711. return;
  41712. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  41713. if (!$this.Cesium.defined($this.RectFlag)) {
  41714. $this.RectFlag = $this.createRectFlag();
  41715. }
  41716. $this.identificationPoint.position.setValue(cartesian);
  41717. if ($this.RectFlag) {
  41718. $this.positions.pop();
  41719. $this.positions.push(cartesian);
  41720. }
  41721. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  41722. this.handler.setInputAction(function(evt) {
  41723. if (!$this.RectFlag)
  41724. return;
  41725. var cartesian = $this.getCatesian3FromPX(evt.position);
  41726. $this.positions.pop();
  41727. $this.positions.push(cartesian);
  41728. $this.createPoint(cartesian);
  41729. $this.RectFlagData = $this.positions.concat();
  41730. $this.viewer.entities.remove($this.RectFlag);
  41731. $this.RectFlag = null;
  41732. $this.positions = [];
  41733. $this.identificationPoint.position.setValue(cartesian);
  41734. var lnglatArr = [];
  41735. for (var i2 = 0; i2 < $this.RectFlagData.length; i2++) {
  41736. var lnglat = $this.cartesianToLatlng($this.RectFlagData[i2]);
  41737. lnglatArr.push(lnglat);
  41738. }
  41739. $this.RectFlagData = lnglatArr;
  41740. var RectFlag = $this.addload([$this.RectFlagData[0], $this.RectFlagData[$this.RectFlagData.length - 1]]);
  41741. $this.entitiesRectFlag.push(RectFlag);
  41742. $this.RectFlagLast = RectFlag;
  41743. $this.clearPoint();
  41744. $this.destroy();
  41745. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  41746. }
  41747. createPoint(cartesian) {
  41748. var $this = this;
  41749. var point2 = this.viewer.entities.add({
  41750. position: cartesian,
  41751. point: {
  41752. pixelSize: 10,
  41753. color: $this.Cesium.Color.RED,
  41754. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  41755. }
  41756. });
  41757. $this.entitiesPoint.push(point2);
  41758. return point2;
  41759. }
  41760. createRectFlag() {
  41761. console.log("232323");
  41762. var $this = this;
  41763. var polygon2 = this.viewer.entities.add({
  41764. polygon: {
  41765. hierarchy: new $this.Cesium.CallbackProperty(function() {
  41766. if ($this.positions.length < 2)
  41767. return;
  41768. let lonlat = [];
  41769. let length = $this.positions.length;
  41770. for (let i2 = 0; i2 < length; i2++) {
  41771. lonlat.push($this.cartesianToLatlng($this.positions[i2]));
  41772. }
  41773. let startPoint = lonlat[0];
  41774. let endPoint = lonlat[lonlat.length - 1];
  41775. let point0 = lonlat[0];
  41776. var point1 = [endPoint[0], startPoint[1]];
  41777. var point2 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41778. var point3 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41779. [startPoint[0], endPoint[1]];
  41780. let components = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point3, ...point0]);
  41781. return new $this.Cesium.PolygonHierarchy(components);
  41782. }, false),
  41783. extrudedHeight: 1,
  41784. material: $this.Cesium.Color.RED
  41785. },
  41786. polyline: {
  41787. positions: new $this.Cesium.CallbackProperty(function() {
  41788. if ($this.positions.length < 2)
  41789. return;
  41790. let lonlat = [];
  41791. let length = $this.positions.length;
  41792. for (let i2 = 0; i2 < length; i2++) {
  41793. lonlat.push($this.cartesianToLatlng($this.positions[i2]));
  41794. }
  41795. let startPoint = lonlat[0];
  41796. let endPoint = lonlat[lonlat.length - 1];
  41797. let point0 = lonlat[0];
  41798. var point1 = [endPoint[0], startPoint[1]];
  41799. var point2 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41800. var point3 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41801. var point4 = [startPoint[0], endPoint[1]];
  41802. let components = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point3, ...point0, ...point4]);
  41803. return components;
  41804. }, false),
  41805. show: true,
  41806. material: $this.Cesium.Color.YELLOW,
  41807. width: 5,
  41808. clampToGround: true
  41809. }
  41810. });
  41811. $this.entitiesRectFlag.push(polygon2);
  41812. return polygon2;
  41813. }
  41814. cartesianToLatlng(cartesian) {
  41815. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  41816. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  41817. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  41818. return [lng, lat];
  41819. }
  41820. LatlngTocartesian(latlng) {
  41821. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  41822. return cartesian3;
  41823. }
  41824. clearPoint() {
  41825. this.DrawEndEvent.raiseEvent(this.RectFlagLast, [this.RectFlagData[0], this.RectFlagData[this.RectFlagData.length - 1]], this.drawType);
  41826. for (var i2 = 0; i2 < this.entitiesPoint.length; i2++) {
  41827. this.viewer.entities.remove(this.entitiesPoint[i2]);
  41828. }
  41829. this.entitiesPoint = [];
  41830. }
  41831. destroy() {
  41832. if (this.handler) {
  41833. this.handler.destroy();
  41834. this.handler = null;
  41835. }
  41836. }
  41837. clear() {
  41838. for (var i2 = 0; i2 < this.entitiesPoint.length; i2++) {
  41839. this.viewer.entities.remove(this.entitiesPoint[i2]);
  41840. }
  41841. for (var i2 = 0; i2 < this.entitiesRectFlag.length; i2++) {
  41842. this.viewer.entities.remove(this.entitiesRectFlag[i2]);
  41843. }
  41844. this.identificationPoint = null;
  41845. this.RectFlag = null;
  41846. this.RectFlagLast = null;
  41847. this.positions = [];
  41848. this.entitiesPoint = [];
  41849. this.entitiesRectFlag = [];
  41850. this.RectFlagData = null;
  41851. }
  41852. getCatesian3FromPX(px) {
  41853. var cartesian;
  41854. var ray = this.viewer.camera.getPickRay(px);
  41855. if (!ray)
  41856. return null;
  41857. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  41858. return cartesian;
  41859. }
  41860. }
  41861. class DrawTriangleFlag {
  41862. constructor(arg) {
  41863. this.viewer = arg.viewer;
  41864. this.Cesium = arg.Cesium;
  41865. this.identificationPoint = null;
  41866. this.TriangleFlag = null;
  41867. this.TriangleFlagLast = null;
  41868. this.positions = [];
  41869. this.entitiesPoint = [];
  41870. this.entitiesTriangleFlag = [];
  41871. this.TriangleFlagData = null;
  41872. this.DrawStartEvent = new Cesium.Event();
  41873. this.DrawEndEvent = new Cesium.Event();
  41874. this._param = {
  41875. id: "DrawStraightArrow",
  41876. polygonColor: "rgba(0,255,0,0.5)",
  41877. outlineColor: "rgba(255, 255, 255, 1)",
  41878. outlineWidth: 1
  41879. };
  41880. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  41881. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  41882. }
  41883. getData() {
  41884. return this.TriangleFlagData;
  41885. }
  41886. computePosition(data) {
  41887. let $this = this;
  41888. var lnglatArr = [];
  41889. for (var i2 = 0; i2 < data.length; i2++) {
  41890. var lnglat = $this.cartesianToLatlng(data[i2]);
  41891. lnglatArr.push(lnglat);
  41892. }
  41893. let startPoint = lnglatArr[0];
  41894. let endPoint = lnglatArr[lnglatArr.length - 1];
  41895. let point0 = lnglatArr[0];
  41896. var point1 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41897. var point2 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41898. var point3 = [startPoint[0], endPoint[1]];
  41899. let componentspolygon = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point0]);
  41900. let componentspolyline = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point0, ...point3]);
  41901. let PolygonHierarchy = new $this.Cesium.PolygonHierarchy(componentspolygon);
  41902. $this.TriangleFlagData = lnglatArr;
  41903. console.log([PolygonHierarchy, componentspolyline]);
  41904. return [PolygonHierarchy, componentspolyline];
  41905. }
  41906. addload(data) {
  41907. var $this = this;
  41908. if (data.length < 2)
  41909. return;
  41910. let startPoint = data[0];
  41911. let endPoint = data[data.length - 1];
  41912. let point0 = data[0];
  41913. var point1 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41914. var point2 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41915. var point3 = [startPoint[0], endPoint[1]];
  41916. let componentspolygon = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point0]);
  41917. let componentspolyline = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point0, ...point3]);
  41918. var shape = this.viewer.entities.add({
  41919. Type: "DrawTriangleFlag",
  41920. Position: data,
  41921. id: data.id || $this.objId,
  41922. polygon: {
  41923. hierarchy: new $this.Cesium.PolygonHierarchy(componentspolygon),
  41924. extrudedHeight: 1,
  41925. material: $this.Cesium.Color.RED
  41926. },
  41927. polyline: {
  41928. positions: componentspolyline,
  41929. show: true,
  41930. material: $this.Cesium.Color.YELLOW,
  41931. width: 5,
  41932. clampToGround: true
  41933. }
  41934. });
  41935. $this.entitiesTriangleFlag.push(shape);
  41936. return shape;
  41937. }
  41938. startCreate(drawType) {
  41939. this.drawType = drawType;
  41940. var $this = this;
  41941. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  41942. this.handler.setInputAction(function(evt) {
  41943. var cartesian = $this.getCatesian3FromPX(evt.position);
  41944. if ($this.positions.length == 0) {
  41945. $this.positions.push(cartesian.clone());
  41946. $this.identificationPoint = $this.createPoint(cartesian);
  41947. $this.createPoint(cartesian);
  41948. $this.positions.push(cartesian);
  41949. }
  41950. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  41951. this.handler.setInputAction(function(evt) {
  41952. if ($this.positions.length < 2)
  41953. return;
  41954. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  41955. if (!$this.Cesium.defined($this.TriangleFlag)) {
  41956. $this.TriangleFlag = $this.createTriangleFlag();
  41957. }
  41958. $this.identificationPoint.position.setValue(cartesian);
  41959. if ($this.TriangleFlag) {
  41960. $this.positions.pop();
  41961. $this.positions.push(cartesian);
  41962. }
  41963. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  41964. this.handler.setInputAction(function(evt) {
  41965. if (!$this.TriangleFlag)
  41966. return;
  41967. var cartesian = $this.getCatesian3FromPX(evt.position);
  41968. $this.positions.pop();
  41969. $this.positions.push(cartesian);
  41970. $this.createPoint(cartesian);
  41971. $this.TriangleFlagData = $this.positions.concat();
  41972. $this.viewer.entities.remove($this.TriangleFlag);
  41973. $this.TriangleFlag = null;
  41974. $this.positions = [];
  41975. $this.identificationPoint.position.setValue(cartesian);
  41976. var lnglatArr = [];
  41977. for (var i2 = 0; i2 < $this.TriangleFlagData.length; i2++) {
  41978. var lnglat = $this.cartesianToLatlng($this.TriangleFlagData[i2]);
  41979. lnglatArr.push(lnglat);
  41980. }
  41981. $this.TriangleFlagData = lnglatArr;
  41982. var TriangleFlag = $this.addload([$this.TriangleFlagData[0], $this.TriangleFlagData[$this.TriangleFlagData.length - 1]]);
  41983. $this.entitiesTriangleFlag.push(TriangleFlag);
  41984. $this.TriangleFlagLast = TriangleFlag;
  41985. $this.clearPoint();
  41986. $this.destroy();
  41987. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  41988. }
  41989. createPoint(cartesian) {
  41990. var $this = this;
  41991. var point2 = this.viewer.entities.add({
  41992. position: cartesian,
  41993. point: {
  41994. pixelSize: 10,
  41995. color: $this.Cesium.Color.RED,
  41996. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  41997. }
  41998. });
  41999. $this.entitiesPoint.push(point2);
  42000. return point2;
  42001. }
  42002. createTriangleFlag() {
  42003. console.log("232323");
  42004. var $this = this;
  42005. var polygon2 = this.viewer.entities.add({
  42006. polygon: {
  42007. hierarchy: new $this.Cesium.CallbackProperty(function() {
  42008. if ($this.positions.length < 2)
  42009. return;
  42010. let lonlat = [];
  42011. let length = $this.positions.length;
  42012. for (let i2 = 0; i2 < length; i2++) {
  42013. lonlat.push($this.cartesianToLatlng($this.positions[i2]));
  42014. }
  42015. let startPoint = lonlat[0];
  42016. let endPoint = lonlat[lonlat.length - 1];
  42017. let point0 = lonlat[0];
  42018. var point1 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  42019. var point2 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  42020. [startPoint[0], endPoint[1]];
  42021. let components = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point0]);
  42022. return new $this.Cesium.PolygonHierarchy(components);
  42023. }, false),
  42024. extrudedHeight: 1,
  42025. material: $this.Cesium.Color.RED
  42026. },
  42027. polyline: {
  42028. positions: new $this.Cesium.CallbackProperty(function() {
  42029. if ($this.positions.length < 2)
  42030. return;
  42031. let lonlat = [];
  42032. let length = $this.positions.length;
  42033. for (let i2 = 0; i2 < length; i2++) {
  42034. lonlat.push($this.cartesianToLatlng($this.positions[i2]));
  42035. }
  42036. let startPoint = lonlat[0];
  42037. let endPoint = lonlat[lonlat.length - 1];
  42038. let point0 = lonlat[0];
  42039. var point1 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  42040. var point2 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  42041. var point3 = [startPoint[0], endPoint[1]];
  42042. let components = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point0, ...point3]);
  42043. return components;
  42044. }, false),
  42045. show: true,
  42046. material: $this.Cesium.Color.YELLOW,
  42047. width: 5,
  42048. clampToGround: true
  42049. }
  42050. });
  42051. $this.entitiesTriangleFlag.push(polygon2);
  42052. return polygon2;
  42053. }
  42054. cartesianToLatlng(cartesian) {
  42055. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  42056. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  42057. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  42058. return [lng, lat];
  42059. }
  42060. LatlngTocartesian(latlng) {
  42061. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  42062. return cartesian3;
  42063. }
  42064. clearPoint() {
  42065. this.DrawEndEvent.raiseEvent(this.TriangleFlagLast, [this.TriangleFlagData[0], this.TriangleFlagData[this.TriangleFlagData.length - 1]], this.drawType);
  42066. for (var i2 = 0; i2 < this.entitiesPoint.length; i2++) {
  42067. this.viewer.entities.remove(this.entitiesPoint[i2]);
  42068. }
  42069. this.entitiesPoint = [];
  42070. }
  42071. destroy() {
  42072. if (this.handler) {
  42073. this.handler.destroy();
  42074. this.handler = null;
  42075. }
  42076. }
  42077. clear() {
  42078. for (var i2 = 0; i2 < this.entitiesPoint.length; i2++) {
  42079. this.viewer.entities.remove(this.entitiesPoint[i2]);
  42080. }
  42081. for (var i2 = 0; i2 < this.entitiesTriangleFlag.length; i2++) {
  42082. this.viewer.entities.remove(this.entitiesTriangleFlag[i2]);
  42083. }
  42084. this.identificationPoint = null;
  42085. this.TriangleFlag = null;
  42086. this.TriangleFlagLast = null;
  42087. this.positions = [];
  42088. this.entitiesPoint = [];
  42089. this.entitiesTriangleFlag = [];
  42090. this.TriangleFlagData = null;
  42091. }
  42092. getCatesian3FromPX(px) {
  42093. var cartesian;
  42094. var ray = this.viewer.camera.getPickRay(px);
  42095. if (!ray)
  42096. return null;
  42097. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  42098. return cartesian;
  42099. }
  42100. }
  42101. class DrawPoint$1 {
  42102. constructor(arg) {
  42103. this.viewer = arg.viewer;
  42104. this.Cesium = arg.Cesium;
  42105. this._point = null;
  42106. this._pointData = null;
  42107. this._entities = [];
  42108. this.DrawStartEvent = new Cesium.Event();
  42109. this.DrawEndEvent = new Cesium.Event();
  42110. this._param = {
  42111. id: "DrawStraightArrow",
  42112. polygonColor: "rgba(0,255,0,0.5)",
  42113. outlineColor: "rgba(255, 255, 255, 1)",
  42114. outlineWidth: 1
  42115. };
  42116. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  42117. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  42118. }
  42119. get point() {
  42120. return this._point;
  42121. }
  42122. addload(data) {
  42123. return this.createPoint(data);
  42124. }
  42125. getData() {
  42126. return this._pointData;
  42127. }
  42128. computePosition(data) {
  42129. let $this = this;
  42130. var lnglatArr = [];
  42131. for (var i2 = 0; i2 < data.length; i2++) {
  42132. var lnglat = $this.cartesianToLatlng(data[i2]);
  42133. lnglatArr.push(lnglat);
  42134. }
  42135. $this._pointData = lnglatArr;
  42136. let point2 = lnglatArr[0];
  42137. return $this.Cesium.Cartesian3.fromDegrees(point2[0], point2[1]);
  42138. }
  42139. startCreate(drawType) {
  42140. this.drawType = drawType;
  42141. var $this = this;
  42142. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  42143. this.handler.setInputAction(function(evt) {
  42144. var cartesian = $this.getCatesian3FromPX(evt.position);
  42145. if (!cartesian)
  42146. return;
  42147. let latlon = $this.cartesianToLatlng(cartesian);
  42148. var point2 = $this.createPoint(latlon);
  42149. $this._pointData = cartesian;
  42150. $this._point = point2;
  42151. $this.DrawEndEvent.raiseEvent($this._point, latlon, $this.drawType);
  42152. $this.destroy();
  42153. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  42154. }
  42155. createPoint(cartesian) {
  42156. var $this = this;
  42157. var point2 = this.viewer.entities.add({
  42158. Type: "DrawPoint",
  42159. Position: [cartesian],
  42160. position: $this.Cesium.Cartesian3.fromDegrees(cartesian[0], cartesian[1]),
  42161. id: cartesian.id || $this.objId,
  42162. billboard: {
  42163. image: "./static/poi2.png",
  42164. verticalOrigin: Cesium.VerticalOrigin.BOTTOM
  42165. }
  42166. });
  42167. $this._entities.push(point2);
  42168. return point2;
  42169. }
  42170. cartesianToLatlng(cartesian) {
  42171. let ellipsoid = this.viewer.scene.globe.ellipsoid;
  42172. let cartographic = ellipsoid.cartesianToCartographic(cartesian);
  42173. let lat = Cesium.Math.toDegrees(cartographic.latitude);
  42174. let lng = Cesium.Math.toDegrees(cartographic.longitude);
  42175. return [lng, lat];
  42176. }
  42177. destroy() {
  42178. if (this.handler) {
  42179. this.handler.destroy();
  42180. this.handler = null;
  42181. }
  42182. }
  42183. clear() {
  42184. for (var i2 = 0; i2 < this._entities.length; i2++) {
  42185. this.viewer.entities.remove(this._entities[i2]);
  42186. }
  42187. this._entities = [];
  42188. this._point = null;
  42189. }
  42190. getCatesian3FromPX(px) {
  42191. var cartesian;
  42192. var ray = this.viewer.camera.getPickRay(px);
  42193. if (!ray)
  42194. return null;
  42195. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  42196. return cartesian;
  42197. }
  42198. }
  42199. class DrawPolyline {
  42200. constructor(arg) {
  42201. this.viewer = arg.viewer;
  42202. this.Cesium = arg.Cesium;
  42203. this._polyline = null;
  42204. this._polylineLast = null;
  42205. this._positions = [];
  42206. this._entities_point = [];
  42207. this._entities_line = [];
  42208. this._polylineData = null;
  42209. this.DrawStartEvent = new Cesium.Event();
  42210. this.DrawEndEvent = new Cesium.Event();
  42211. this._param = {
  42212. id: "DrawStraightArrow",
  42213. polygonColor: "rgba(0,255,0,0.5)",
  42214. outlineColor: "rgba(255, 255, 255, 1)",
  42215. outlineWidth: 1
  42216. };
  42217. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  42218. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  42219. }
  42220. get line() {
  42221. return this._polylineLast;
  42222. }
  42223. getData() {
  42224. return this._polylineData;
  42225. }
  42226. computePosition(data) {
  42227. let $this = this;
  42228. var lnglatArr = [];
  42229. for (var i2 = 0; i2 < data.length; i2++) {
  42230. var lnglat = $this.cartesianToLatlng(data[i2]);
  42231. lnglatArr.push(lnglat);
  42232. }
  42233. $this._polylineData = lnglatArr;
  42234. return data;
  42235. }
  42236. addload(data) {
  42237. var $this = this;
  42238. var lnglatArr = [];
  42239. for (var i2 = 0; i2 < data.length; i2++) {
  42240. var lnglat = $this.LatlngTocartesian(data[i2]);
  42241. lnglatArr.push(lnglat);
  42242. }
  42243. var polyline = this.viewer.entities.add({
  42244. Type: "DrawPolyline",
  42245. Position: data,
  42246. id: data.id || $this.objId,
  42247. polyline: {
  42248. positions: lnglatArr,
  42249. show: true,
  42250. material: $this.Cesium.Color.RED,
  42251. width: 3,
  42252. clampToGround: true
  42253. }
  42254. });
  42255. return polyline;
  42256. }
  42257. startCreate(drawType) {
  42258. this.drawType = drawType;
  42259. var $this = this;
  42260. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  42261. this.handler.setInputAction(function(evt) {
  42262. var cartesian = $this.getCatesian3FromPX(evt.position);
  42263. if ($this._positions.length == 0) {
  42264. $this._positions.push(cartesian.clone());
  42265. }
  42266. $this._positions.push(cartesian);
  42267. $this.createPoint(cartesian);
  42268. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  42269. this.handler.setInputAction(function(evt) {
  42270. if ($this._positions.length < 1)
  42271. return;
  42272. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  42273. if (!$this.Cesium.defined($this._polyline)) {
  42274. $this._polyline = $this.createPolyline();
  42275. }
  42276. if ($this._polyline) {
  42277. $this._positions.pop();
  42278. $this._positions.push(cartesian);
  42279. }
  42280. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  42281. this.handler.setInputAction(function(evt) {
  42282. if (!$this._polyline)
  42283. return;
  42284. var cartesian = $this.getCatesian3FromPX(evt.position);
  42285. $this._positions.pop();
  42286. $this.createPoint(cartesian);
  42287. $this._polylineData = $this._positions.concat();
  42288. $this.viewer.entities.remove($this._polyline);
  42289. $this._polyline = null;
  42290. $this._positions = [];
  42291. var lnglatArr = [];
  42292. for (var i2 = 0; i2 < $this._polylineData.length; i2++) {
  42293. var lnglat = $this.cartesianToLatlng($this._polylineData[i2]);
  42294. lnglatArr.push(lnglat);
  42295. }
  42296. $this._polylineData = lnglatArr;
  42297. var line = $this.addload($this._polylineData);
  42298. $this._entities_line.push(line);
  42299. $this._polylineLast = line;
  42300. $this.clearPoint();
  42301. $this.destroy();
  42302. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  42303. }
  42304. createPoint(cartesian) {
  42305. var $this = this;
  42306. var point2 = this.viewer.entities.add({
  42307. position: cartesian,
  42308. point: {
  42309. pixelSize: 10,
  42310. color: $this.Cesium.Color.RED,
  42311. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  42312. }
  42313. });
  42314. $this._entities_point.push(point2);
  42315. return point2;
  42316. }
  42317. createPolyline() {
  42318. var $this = this;
  42319. var polyline = this.viewer.entities.add({
  42320. polyline: {
  42321. positions: new $this.Cesium.CallbackProperty(function() {
  42322. return $this._positions;
  42323. }, false),
  42324. show: true,
  42325. material: $this.Cesium.Color.RED,
  42326. width: 3,
  42327. clampToGround: true
  42328. }
  42329. });
  42330. $this._entities_line.push(polyline);
  42331. return polyline;
  42332. }
  42333. cartesianToLatlng(cartesian) {
  42334. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  42335. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  42336. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  42337. return [lng, lat];
  42338. }
  42339. LatlngTocartesian(latlng) {
  42340. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  42341. return cartesian3;
  42342. }
  42343. clearPoint() {
  42344. this.DrawEndEvent.raiseEvent(this._polylineLast, this._polylineData, this.drawType);
  42345. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42346. this.viewer.entities.remove(this._entities_point[i2]);
  42347. }
  42348. this._entities_point = [];
  42349. }
  42350. destroy() {
  42351. if (this.handler) {
  42352. this.handler.destroy();
  42353. this.handler = null;
  42354. }
  42355. }
  42356. clear() {
  42357. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42358. this.viewer.entities.remove(this._entities_point[i2]);
  42359. }
  42360. for (var i2 = 0; i2 < this._entities_line.length; i2++) {
  42361. this.viewer.entities.remove(this._entities_line[i2]);
  42362. }
  42363. this._polyline = null;
  42364. this._positions = [];
  42365. this._entities_point = [];
  42366. this._entities_line = [];
  42367. this._polylineData = null;
  42368. this._polylineLast = null;
  42369. }
  42370. getCatesian3FromPX(px) {
  42371. var cartesian;
  42372. var ray = this.viewer.camera.getPickRay(px);
  42373. if (!ray)
  42374. return null;
  42375. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  42376. return cartesian;
  42377. }
  42378. }
  42379. class DrawPolygon {
  42380. constructor(arg) {
  42381. this.viewer = arg.viewer;
  42382. this.Cesium = arg.Cesium;
  42383. this._polygon = null;
  42384. this._polygonLast = null;
  42385. this._positions = [];
  42386. this._entities_point = [];
  42387. this._entities_polygon = [];
  42388. this._polygonData = null;
  42389. this.DrawStartEvent = new Cesium.Event();
  42390. this.DrawEndEvent = new Cesium.Event();
  42391. this._param = {
  42392. id: "DrawStraightArrow",
  42393. polygonColor: "rgba(0,255,0,0.5)",
  42394. outlineColor: "rgba(255, 255, 255, 1)",
  42395. outlineWidth: 1
  42396. };
  42397. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  42398. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  42399. }
  42400. get polygon() {
  42401. return this._polygonLast;
  42402. }
  42403. getData() {
  42404. return this._polygonData;
  42405. }
  42406. computePosition(data) {
  42407. let $this = this;
  42408. var lnglatArr = [];
  42409. for (var i2 = 0; i2 < data.length; i2++) {
  42410. var lnglat = $this.cartesianToLatlng(data[i2]);
  42411. lnglatArr.push(lnglat);
  42412. }
  42413. $this._polygonData = lnglatArr;
  42414. return new $this.Cesium.PolygonHierarchy(data);
  42415. }
  42416. addload(data) {
  42417. var $this = this;
  42418. var lnglatArr = [];
  42419. for (var i2 = 0; i2 < data.length; i2++) {
  42420. var lnglat = $this.LatlngTocartesian(data[i2]);
  42421. lnglatArr.push(lnglat);
  42422. }
  42423. return this.viewer.entities.add({
  42424. Type: "DrawPolygon",
  42425. Position: data,
  42426. id: data.id || $this.objId,
  42427. polygon: {
  42428. hierarchy: new $this.Cesium.PolygonHierarchy(lnglatArr),
  42429. clampToGround: true,
  42430. show: true,
  42431. fill: true,
  42432. material: $this.Cesium.Color.RED.withAlpha(0.9),
  42433. width: 3,
  42434. outlineColor: $this.Cesium.Color.BLACK,
  42435. outlineWidth: 1,
  42436. outline: false
  42437. }
  42438. });
  42439. }
  42440. startCreate(drawType) {
  42441. this.drawType = drawType;
  42442. var $this = this;
  42443. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  42444. this.handler.setInputAction(function(evt) {
  42445. var cartesian = $this.getCatesian3FromPX(evt.position);
  42446. if ($this._positions.length == 0) {
  42447. $this._positions.push(cartesian.clone());
  42448. }
  42449. $this.createPoint(cartesian);
  42450. $this._positions.push(cartesian);
  42451. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  42452. this.handler.setInputAction(function(evt) {
  42453. if ($this._positions.length < 1)
  42454. return;
  42455. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  42456. if ($this._positions.length == 3) {
  42457. if (!$this.Cesium.defined($this._polygon)) {
  42458. $this._polygon = $this.createPolygon();
  42459. }
  42460. }
  42461. $this._positions.pop();
  42462. $this._positions.push(cartesian);
  42463. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  42464. this.handler.setInputAction(function(evt) {
  42465. if (!$this._polygon)
  42466. return;
  42467. var cartesian = $this.getCatesian3FromPX(evt.position);
  42468. $this._positions.pop();
  42469. $this.createPoint(cartesian);
  42470. $this._polygonData = $this._positions.concat();
  42471. $this.viewer.entities.remove($this._positions);
  42472. $this._positions = null;
  42473. $this._positions = [];
  42474. var lnglatArr = [];
  42475. for (var i2 = 0; i2 < $this._polygonData.length; i2++) {
  42476. var lnglat = $this.cartesianToLatlng($this._polygonData[i2]);
  42477. lnglatArr.push(lnglat);
  42478. }
  42479. $this._polygonData = lnglatArr;
  42480. var Polygon = $this.addload($this._polygonData);
  42481. $this._entities_polygon.push(Polygon);
  42482. $this._polygonLast = Polygon;
  42483. $this.clearPoint();
  42484. $this.destroy();
  42485. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  42486. }
  42487. createPolygon() {
  42488. var $this = this;
  42489. var polygon2 = this.viewer.entities.add({
  42490. polygon: {
  42491. hierarchy: new $this.Cesium.CallbackProperty(function() {
  42492. return new $this.Cesium.PolygonHierarchy($this._positions);
  42493. }, false),
  42494. clampToGround: true,
  42495. show: true,
  42496. fill: true,
  42497. material: $this.Cesium.Color.RED.withAlpha(0.5),
  42498. width: 3,
  42499. outlineColor: $this.Cesium.Color.BLACK,
  42500. outlineWidth: 1,
  42501. outline: false
  42502. }
  42503. });
  42504. $this._entities_polygon.push(polygon2);
  42505. return polygon2;
  42506. }
  42507. cartesianToLatlng(cartesian) {
  42508. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  42509. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  42510. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  42511. return [lng, lat];
  42512. }
  42513. LatlngTocartesian(latlng) {
  42514. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  42515. return cartesian3;
  42516. }
  42517. clearPoint() {
  42518. this.DrawEndEvent.raiseEvent(this._polygonLast, this._polygonData, this.drawType);
  42519. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42520. this.viewer.entities.remove(this._entities_point[i2]);
  42521. }
  42522. this._entities_point = [];
  42523. }
  42524. createPoint(cartesian) {
  42525. var $this = this;
  42526. var point2 = this.viewer.entities.add({
  42527. position: cartesian,
  42528. point: {
  42529. pixelSize: 10,
  42530. color: $this.Cesium.Color.RED,
  42531. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  42532. }
  42533. });
  42534. $this._entities_point.push(point2);
  42535. return point2;
  42536. }
  42537. destroy() {
  42538. if (this.handler) {
  42539. this.handler.destroy();
  42540. this.handler = null;
  42541. }
  42542. }
  42543. clear() {
  42544. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42545. this.viewer.entities.remove(this._entities_point[i2]);
  42546. }
  42547. for (var i2 = 0; i2 < this._entities_polygon.length; i2++) {
  42548. this.viewer.entities.remove(this._entities_polygon[i2]);
  42549. }
  42550. this._polygon = null;
  42551. this._polygonLast = null;
  42552. this._positions = [];
  42553. this._entities_point = [];
  42554. this._entities_polygon = [];
  42555. this._polygonData = null;
  42556. }
  42557. getCatesian3FromPX(px) {
  42558. var cartesian;
  42559. var ray = this.viewer.camera.getPickRay(px);
  42560. if (!ray)
  42561. return null;
  42562. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  42563. return cartesian;
  42564. }
  42565. }
  42566. class DrawRectangle {
  42567. constructor(arg) {
  42568. this.viewer = arg.viewer;
  42569. this.Cesium = arg.Cesium;
  42570. this.floatingPoint = null;
  42571. this._rectangle = null;
  42572. this._rectangleLast = null;
  42573. this._positions = [];
  42574. this._entities_point = [];
  42575. this._entities_rectangle = [];
  42576. this._rectangleData = null;
  42577. this.DrawStartEvent = new Cesium.Event();
  42578. this.DrawEndEvent = new Cesium.Event();
  42579. this._param = {
  42580. id: "DrawStraightArrow",
  42581. polygonColor: "rgba(0,255,0,0.5)",
  42582. outlineColor: "rgba(255, 255, 255, 1)",
  42583. outlineWidth: 1
  42584. };
  42585. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  42586. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  42587. }
  42588. get line() {
  42589. return this._rectangleLast;
  42590. }
  42591. getData() {
  42592. return this._rectangleData;
  42593. }
  42594. computePosition(data) {
  42595. let $this = this;
  42596. var lnglatArr = [];
  42597. for (var i2 = 0; i2 < data.length; i2++) {
  42598. var lnglat = $this.cartesianToLatlng(data[i2]);
  42599. lnglatArr.push(lnglat);
  42600. }
  42601. $this._rectangleData = lnglatArr;
  42602. return new $this.Cesium.Rectangle.fromCartesianArray(data);
  42603. }
  42604. addload(data) {
  42605. var $this = this;
  42606. var lnglatArr = [];
  42607. for (var i2 = 0; i2 < data.length; i2++) {
  42608. var lnglat = $this.LatlngTocartesian(data[i2]);
  42609. lnglatArr.push(lnglat);
  42610. }
  42611. var shape = this.viewer.entities.add({
  42612. Type: "DrawRectangle",
  42613. Position: data,
  42614. id: data.id || $this.objId,
  42615. rectangle: {
  42616. coordinates: $this.Cesium.Rectangle.fromCartesianArray(lnglatArr),
  42617. material: $this.Cesium.Color.RED.withAlpha(0.9)
  42618. }
  42619. });
  42620. $this._entities_rectangle.push(shape);
  42621. return shape;
  42622. }
  42623. startCreate(drawType) {
  42624. this.drawType = drawType;
  42625. var $this = this;
  42626. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  42627. this.handler.setInputAction(function(evt) {
  42628. var cartesian = $this.getCatesian3FromPX(evt.position);
  42629. if ($this._positions.length == 0) {
  42630. $this._positions.push(cartesian.clone());
  42631. $this.floatingPoint = $this.createPoint(cartesian);
  42632. $this.createPoint(cartesian);
  42633. $this._positions.push(cartesian);
  42634. }
  42635. if ($this._positions.length == 2) {
  42636. $this._positions.push(cartesian);
  42637. }
  42638. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  42639. this.handler.setInputAction(function(evt) {
  42640. if ($this._positions.length < 3)
  42641. return;
  42642. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  42643. if (!$this.Cesium.defined($this._rectangle)) {
  42644. $this._rectangle = $this.createRectangle();
  42645. }
  42646. $this.floatingPoint.position.setValue(cartesian);
  42647. if ($this._rectangle) {
  42648. $this._positions.pop();
  42649. $this._positions.push(cartesian);
  42650. }
  42651. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  42652. this.handler.setInputAction(function(evt) {
  42653. if (!$this._rectangle)
  42654. return;
  42655. var cartesian = $this.getCatesian3FromPX(evt.position);
  42656. $this._positions.pop();
  42657. $this._positions.push(cartesian);
  42658. $this.createPoint(cartesian);
  42659. $this._rectangleData = $this._positions.concat();
  42660. $this.viewer.entities.remove($this._rectangle);
  42661. $this._rectangle = null;
  42662. $this._positions = [];
  42663. $this.floatingPoint.position.setValue(cartesian);
  42664. var lnglatArr = [];
  42665. for (var i2 = 0; i2 < $this._rectangleData.length; i2++) {
  42666. var lnglat = $this.cartesianToLatlng($this._rectangleData[i2]);
  42667. lnglatArr.push(lnglat);
  42668. }
  42669. $this._rectangleData = lnglatArr;
  42670. var rectangle = $this.addload([$this._rectangleData[0], $this._rectangleData[$this._rectangleData.length - 1]]);
  42671. $this._entities_rectangle.push(rectangle);
  42672. $this._rectangleLast = rectangle;
  42673. $this.clearPoint();
  42674. $this.destroy();
  42675. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  42676. }
  42677. createPoint(cartesian) {
  42678. var $this = this;
  42679. var point2 = this.viewer.entities.add({
  42680. position: cartesian,
  42681. point: {
  42682. pixelSize: 10,
  42683. color: $this.Cesium.Color.RED,
  42684. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  42685. }
  42686. });
  42687. $this._entities_point.push(point2);
  42688. return point2;
  42689. }
  42690. createRectangle() {
  42691. var $this = this;
  42692. var shape = this.viewer.entities.add({
  42693. name: "rectangle",
  42694. rectangle: {
  42695. coordinates: new $this.Cesium.CallbackProperty(function() {
  42696. var obj = $this.Cesium.Rectangle.fromCartesianArray($this._positions);
  42697. return obj;
  42698. }, false),
  42699. material: $this.Cesium.Color.RED.withAlpha(0.5)
  42700. }
  42701. });
  42702. $this._entities_rectangle.push(shape);
  42703. return shape;
  42704. }
  42705. cartesianToLatlng(cartesian) {
  42706. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  42707. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  42708. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  42709. return [lng, lat];
  42710. }
  42711. LatlngTocartesian(latlng) {
  42712. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  42713. return cartesian3;
  42714. }
  42715. clearPoint() {
  42716. this.DrawEndEvent.raiseEvent(this._rectangleLast, [this._rectangleData[0], this._rectangleData[this._rectangleData.length - 1]], this.drawType);
  42717. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42718. this.viewer.entities.remove(this._entities_point[i2]);
  42719. }
  42720. this._entities_point = [];
  42721. }
  42722. destroy() {
  42723. if (this.handler) {
  42724. this.handler.destroy();
  42725. this.handler = null;
  42726. }
  42727. }
  42728. clear() {
  42729. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42730. this.viewer.entities.remove(this._entities_point[i2]);
  42731. }
  42732. for (var i2 = 0; i2 < this._entities_rectangle.length; i2++) {
  42733. this.viewer.entities.remove(this._entities_rectangle[i2]);
  42734. }
  42735. this.floatingPoint = null;
  42736. this._rectangle = null;
  42737. this._rectangleLast = null;
  42738. this._positions = [];
  42739. this._entities_point = [];
  42740. this._entities_rectangle = [];
  42741. this._rectangleData = null;
  42742. }
  42743. getCatesian3FromPX(px) {
  42744. var cartesian;
  42745. var ray = this.viewer.camera.getPickRay(px);
  42746. if (!ray)
  42747. return null;
  42748. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  42749. return cartesian;
  42750. }
  42751. }
  42752. class DrawCircle {
  42753. constructor(arg) {
  42754. this.viewer = arg.viewer;
  42755. this.Cesium = arg.Cesium;
  42756. this._cicle = null;
  42757. this.floatingPoint = null;
  42758. this._cicleLast = null;
  42759. this._positions = [];
  42760. this._entities_point = [];
  42761. this._entities_cicle = [];
  42762. this._cicleData = null;
  42763. this.DrawStartEvent = new Cesium.Event();
  42764. this.DrawEndEvent = new Cesium.Event();
  42765. this._param = {
  42766. id: "DrawStraightArrow",
  42767. polygonColor: "rgba(0,255,0,0.5)",
  42768. outlineColor: "rgba(255, 255, 255, 1)",
  42769. outlineWidth: 1
  42770. };
  42771. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  42772. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  42773. }
  42774. get cicle() {
  42775. return this._cicleLast;
  42776. }
  42777. addload(data) {
  42778. var that = this;
  42779. let lnglatArr = [];
  42780. for (var i2 = 0; i2 < data.length; i2++) {
  42781. var lnglat = that.LatlngTocartesian(data[i2]);
  42782. lnglatArr.push(lnglat);
  42783. }
  42784. var value = lnglatArr;
  42785. var r2 = Math.sqrt(
  42786. Math.pow(value[0].x - value[value.length - 1].x, 2) + Math.pow(value[0].y - value[value.length - 1].y, 2)
  42787. );
  42788. var position2 = value[0];
  42789. var shape = that.viewer.entities.add({
  42790. Type: "DrawCircle",
  42791. Position: [data[0], data[data.length - 1]],
  42792. position: position2,
  42793. id: data.id || that.objId,
  42794. ellipse: {
  42795. semiMinorAxis: r2,
  42796. semiMajorAxis: r2,
  42797. material: that.Cesium.Color.RED.withAlpha(0.9),
  42798. show: true,
  42799. clampToGround: true
  42800. }
  42801. });
  42802. return shape;
  42803. }
  42804. getData() {
  42805. return this._cicleData;
  42806. }
  42807. computePosition(data) {
  42808. var that = this;
  42809. let lnglatArr = [];
  42810. for (var i2 = 0; i2 < data.length; i2++) {
  42811. var lnglat = that.cartesianToLatlng(data[i2]);
  42812. lnglatArr.push(lnglat);
  42813. }
  42814. that._cicleData = lnglatArr;
  42815. var value = data;
  42816. var r2 = Math.sqrt(
  42817. Math.pow(value[0].x - value[value.length - 1].x, 2) + Math.pow(value[0].y - value[value.length - 1].y, 2)
  42818. );
  42819. var position2 = value[0];
  42820. return { position: position2, r: r2 };
  42821. }
  42822. startCreate(drawType) {
  42823. this.drawType = drawType;
  42824. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  42825. this.viewer.scene.globe.depthTestAgainstTerrain = true;
  42826. var $this = this;
  42827. this.handler.setInputAction(function(evt) {
  42828. $this.viewer.scene.globe.depthTestAgainstTerrain = true;
  42829. var cartesian = $this.getCatesian3FromPX(evt.position);
  42830. if ($this._positions.length == 0) {
  42831. $this._positions.push(cartesian.clone());
  42832. $this.floatingPoint = $this.createPoint(cartesian);
  42833. $this._positions.push(cartesian);
  42834. }
  42835. if (!$this._cicle) {
  42836. $this.createPoint(cartesian);
  42837. }
  42838. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  42839. this.handler.setInputAction(function(evt) {
  42840. if ($this._positions.length < 1)
  42841. return;
  42842. var cartesian = $this.viewer.scene.pickPosition(evt.endPosition);
  42843. if (!$this.Cesium.defined($this._cicle)) {
  42844. $this._cicle = $this.createCicle();
  42845. }
  42846. $this.floatingPoint.position.setValue(cartesian);
  42847. if ($this._cicle) {
  42848. $this._positions.pop();
  42849. $this._positions.push(cartesian);
  42850. }
  42851. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  42852. this.handler.setInputAction(function(evt) {
  42853. if (!$this._cicle)
  42854. return;
  42855. $this.viewer.scene.globe.depthTestAgainstTerrain = false;
  42856. var cartesian = $this.viewer.scene.pickPosition(evt.position);
  42857. $this._positions.pop();
  42858. $this._positions.push(cartesian);
  42859. $this._cicleData = $this._positions.concat();
  42860. $this.viewer.entities.remove($this._cicle);
  42861. $this._cicle = null;
  42862. $this._positions = [];
  42863. $this.floatingPoint.position.setValue(cartesian);
  42864. let lnglatArr = [];
  42865. for (var i2 = 0; i2 < $this._cicleData.length; i2++) {
  42866. var lnglat = $this.cartesianToLatlng($this._cicleData[i2]);
  42867. lnglatArr.push(lnglat);
  42868. }
  42869. $this._cicleData = lnglatArr;
  42870. var cicle = $this.addload($this._cicleData);
  42871. $this._entities_cicle.push(cicle);
  42872. $this._cicleLast = cicle;
  42873. $this.clearPoint();
  42874. $this.destroy();
  42875. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  42876. }
  42877. createCicle() {
  42878. var that = this;
  42879. var shape = this.viewer.entities.add({
  42880. position: that._positions[0],
  42881. ellipse: {
  42882. semiMinorAxis: new that.Cesium.CallbackProperty(function() {
  42883. var r2 = Math.sqrt(
  42884. Math.pow(that._positions[0].x - that._positions[that._positions.length - 1].x, 2) + Math.pow(that._positions[0].y - that._positions[that._positions.length - 1].y, 2)
  42885. );
  42886. return r2 ? r2 : r2 + 1;
  42887. }, false),
  42888. semiMajorAxis: new that.Cesium.CallbackProperty(function() {
  42889. var r2 = Math.sqrt(
  42890. Math.pow(that._positions[0].x - that._positions[that._positions.length - 1].x, 2) + Math.pow(that._positions[0].y - that._positions[that._positions.length - 1].y, 2)
  42891. );
  42892. return r2 ? r2 : r2 + 1;
  42893. }, false),
  42894. material: that.Cesium.Color.RED.withAlpha(0.5),
  42895. outline: true
  42896. }
  42897. });
  42898. that._entities_cicle.push(shape);
  42899. return shape;
  42900. }
  42901. createPoint(cartesian) {
  42902. var $this = this;
  42903. var point2 = this.viewer.entities.add({
  42904. position: cartesian,
  42905. point: {
  42906. pixelSize: 10,
  42907. color: $this.Cesium.Color.RED,
  42908. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  42909. }
  42910. });
  42911. $this._entities_point.push(point2);
  42912. return point2;
  42913. }
  42914. getCatesian3FromPX(px) {
  42915. var cartesian;
  42916. var ray = this.viewer.camera.getPickRay(px);
  42917. if (!ray)
  42918. return null;
  42919. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  42920. return cartesian;
  42921. }
  42922. cartesianToLatlng(cartesian) {
  42923. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  42924. let lat = this.Cesium.Math.toDegrees(cartographic.latitude);
  42925. let lng = this.Cesium.Math.toDegrees(cartographic.longitude);
  42926. cartographic.height;
  42927. return [lng, lat];
  42928. }
  42929. LatlngTocartesian(latlng) {
  42930. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1], 0);
  42931. return cartesian3;
  42932. }
  42933. destroy() {
  42934. if (this.handler) {
  42935. this.handler.destroy();
  42936. this.handler = null;
  42937. }
  42938. }
  42939. clearPoint() {
  42940. this.DrawEndEvent.raiseEvent(this._cicleLast, this._cicleData, this.drawType);
  42941. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42942. this.viewer.entities.remove(this._entities_point[i2]);
  42943. }
  42944. this._entities_point = [];
  42945. }
  42946. clear() {
  42947. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42948. this.viewer.entities.remove(this._entities_point[i2]);
  42949. }
  42950. for (var i2 = 0; i2 < this._entities_cicle.length; i2++) {
  42951. this.viewer.entities.remove(this._entities_cicle[i2]);
  42952. }
  42953. this._cicle = null;
  42954. this.floatingPoint = null;
  42955. this._cicleLast = null;
  42956. this._positions = [];
  42957. this._entities_point = [];
  42958. this._entities_cicle = [];
  42959. this._cicleData = null;
  42960. }
  42961. }
  42962. let MilitaryPlot = {
  42963. DrawStraightArrow,
  42964. DrawAttackArrow,
  42965. DrawPincerArrow,
  42966. DrawGatheringPlace,
  42967. DrawClosedCurve,
  42968. DrawSector,
  42969. DrawBowLine,
  42970. DrawBowPlane,
  42971. DrawCurve,
  42972. DrawCurveFlag,
  42973. DrawRectFlag,
  42974. DrawTriangleFlag,
  42975. DrawPoint: DrawPoint$1,
  42976. DrawPolyline,
  42977. DrawPolygon,
  42978. DrawRectangle,
  42979. DrawCircle
  42980. };
  42981. class EntityEdit {
  42982. constructor(viewer2) {
  42983. this.viewer = viewer2;
  42984. this.DrawExample = "";
  42985. this.midVertexEntities = [];
  42986. this.initEventHandler();
  42987. }
  42988. initEventHandler() {
  42989. this.eventHandler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  42990. this.EditEndEvent = new Cesium.Event();
  42991. this.EditEndEntity = new Cesium.Event();
  42992. }
  42993. activate() {
  42994. this.deactivate();
  42995. this.initLeftClickEventHandler();
  42996. }
  42997. deactivate() {
  42998. this.DrawExample = "";
  42999. this.eventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
  43000. this.unRegisterEvents();
  43001. this.clearAllEditVertex();
  43002. }
  43003. clearAllEditVertex() {
  43004. this.clearEditVertex();
  43005. this.clearMidVertex();
  43006. }
  43007. initLeftClickEventHandler() {
  43008. this.eventHandler.setInputAction((e) => {
  43009. let id = this.viewer.scene.pick(e.position);
  43010. if (!id || !id.id) {
  43011. this.handleEditEntity();
  43012. return;
  43013. }
  43014. if (!id.id || !id.id.Type)
  43015. return;
  43016. if (this.editEntity && this.editEntity.id == id.id.id)
  43017. return;
  43018. this.handleEditEntity();
  43019. this.handlePickEditEntity(id.id);
  43020. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  43021. }
  43022. handleEditEntity() {
  43023. this.unRegisterEvents();
  43024. this.clearAllEditVertex();
  43025. let editEntity = this.editEntity;
  43026. if (!editEntity)
  43027. return;
  43028. this.closeEntityEditMode();
  43029. this.editEntity = void 0;
  43030. if (!this.isEdited)
  43031. return;
  43032. this.EditEndEvent.raiseEvent(editEntity);
  43033. this.isEdited = false;
  43034. this.isEditing = false;
  43035. }
  43036. handlePickEditEntity(pickId) {
  43037. const EditableTypes = ["DrawAttackArrow", "DrawCircle", "DrawCurve", "DrawPincerArrow", "DrawPoint", "DrawPolygon", "DrawPolyline", "DrawRectangle", "DrawStraightArrow", "DrawGatheringPlace", "DrawSector", "DrawClosedCurve", "DrawBowLine", "DrawBowPlane", "DrawRectFlag", "DrawTriangleFlag", "DrawCurveFlag"];
  43038. if (EditableTypes.indexOf(pickId.Type) == -1)
  43039. return;
  43040. this.editEntity = pickId;
  43041. this.EditEndEntity.raiseEvent(this.editEntity);
  43042. this.isEditing = false;
  43043. this.isEdited = false;
  43044. this.editPositions = this.getEditEntityPositions();
  43045. this.EditMoveCenterPositoin = this.getCenterPosition();
  43046. this.openEntityEditModel();
  43047. this.clearAllEditVertex();
  43048. this.unRegisterEvents();
  43049. this.createEditVertex();
  43050. this.createMidVertex();
  43051. this.registerEvents();
  43052. }
  43053. openEntityEditModel() {
  43054. if (this.DrawExample == "")
  43055. return;
  43056. switch (this.editEntity.Type) {
  43057. case "DrawStraightArrow":
  43058. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43059. return this.DrawExample.computePosition(this.editPositions);
  43060. }, false);
  43061. break;
  43062. case "DrawAttackArrow":
  43063. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43064. return this.DrawExample.computePosition(this.editPositions);
  43065. }, false);
  43066. break;
  43067. case "DrawPincerArrow":
  43068. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43069. return this.DrawExample.computePosition(this.editPositions);
  43070. }, false);
  43071. break;
  43072. case "DrawGatheringPlace":
  43073. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43074. return this.DrawExample.computePosition(this.editPositions);
  43075. }, false);
  43076. break;
  43077. case "DrawClosedCurve":
  43078. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43079. return this.DrawExample.computePosition(this.editPositions).PolygonHierarchy;
  43080. }, false);
  43081. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  43082. return this.DrawExample.computePosition(this.editPositions).pList;
  43083. }, false);
  43084. break;
  43085. case "DrawCircle":
  43086. this.editEntity.position = new Cesium.CallbackProperty((e) => {
  43087. return this.DrawExample.computePosition(this.editPositions).position;
  43088. }, false);
  43089. this.editEntity.ellipse.semiMinorAxis = new Cesium.CallbackProperty((e) => {
  43090. return this.DrawExample.computePosition(this.editPositions).r;
  43091. }, false);
  43092. this.editEntity.ellipse.semiMajorAxis = new Cesium.CallbackProperty((e) => {
  43093. return this.DrawExample.computePosition(this.editPositions).r;
  43094. }, false);
  43095. break;
  43096. case "DrawCurve":
  43097. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  43098. return this.DrawExample.computePosition(this.editPositions);
  43099. }, false);
  43100. break;
  43101. case "DrawPoint":
  43102. this.editEntity.position = new Cesium.CallbackProperty((e) => {
  43103. return this.editPositions[0];
  43104. }, false);
  43105. break;
  43106. case "DrawPolygon":
  43107. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43108. return this.DrawExample.computePosition(this.editPositions);
  43109. }, false);
  43110. break;
  43111. case "DrawPolyline":
  43112. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  43113. return this.DrawExample.computePosition(this.editPositions);
  43114. }, false);
  43115. break;
  43116. case "DrawRectangle":
  43117. this.editEntity.rectangle.coordinates = new Cesium.CallbackProperty((e) => {
  43118. return this.DrawExample.computePosition(this.editPositions);
  43119. }, false);
  43120. break;
  43121. case "DrawSector":
  43122. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43123. return this.DrawExample.computePosition(this.editPositions);
  43124. }, false);
  43125. break;
  43126. case "DrawBowLine":
  43127. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  43128. return this.DrawExample.computePosition(this.editPositions);
  43129. }, false);
  43130. break;
  43131. case "DrawBowPlane":
  43132. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43133. return this.DrawExample.computePosition(this.editPositions);
  43134. }, false);
  43135. break;
  43136. case "DrawRectFlag":
  43137. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43138. return this.DrawExample.computePosition(this.editPositions)[0];
  43139. }, false);
  43140. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  43141. return this.DrawExample.computePosition(this.editPositions)[1];
  43142. }, false);
  43143. break;
  43144. case "DrawTriangleFlag":
  43145. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43146. return this.DrawExample.computePosition(this.editPositions)[0];
  43147. }, false);
  43148. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  43149. return this.DrawExample.computePosition(this.editPositions)[1];
  43150. }, false);
  43151. break;
  43152. case "DrawCurveFlag":
  43153. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43154. return this.DrawExample.computePosition(this.editPositions)[0];
  43155. }, false);
  43156. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  43157. return this.DrawExample.computePosition(this.editPositions)[1];
  43158. }, false);
  43159. break;
  43160. }
  43161. }
  43162. closeEntityEditMode() {
  43163. if (this.DrawExample == "")
  43164. return;
  43165. let position2 = "";
  43166. switch (this.editEntity.Type) {
  43167. case "DrawStraightArrow":
  43168. position2 = this.DrawExample.computePosition(this.editPositions);
  43169. this.editEntity.polygon.hierarchy = position2;
  43170. this.editEntity.Position = this.DrawExample.getData();
  43171. break;
  43172. case "DrawAttackArrow":
  43173. position2 = this.DrawExample.computePosition(this.editPositions);
  43174. this.editEntity.polygon.hierarchy = position2;
  43175. this.editEntity.Position = this.DrawExample.getData();
  43176. break;
  43177. case "DrawPincerArrow":
  43178. position2 = this.DrawExample.computePosition(this.editPositions);
  43179. this.editEntity.polygon.hierarchy = position2;
  43180. this.editEntity.Position = this.DrawExample.getData();
  43181. break;
  43182. case "DrawGatheringPlace":
  43183. position2 = this.DrawExample.computePosition(this.editPositions);
  43184. this.editEntity.polygon.hierarchy = position2;
  43185. this.editEntity.Position = this.DrawExample.getData();
  43186. break;
  43187. case "DrawClosedCurve":
  43188. position2 = this.DrawExample.computePosition(this.editPositions);
  43189. this.editEntity.polygon.hierarchy = position2.PolygonHierarchy;
  43190. this.editEntity.polyline.positions = position2.pList;
  43191. this.editEntity.Position = this.DrawExample.getData();
  43192. break;
  43193. case "DrawCircle":
  43194. position2 = this.DrawExample.computePosition(this.editPositions);
  43195. this.editEntity.position = position2.position;
  43196. this.editEntity.ellipse.semiMinorAxis = position2.r;
  43197. this.editEntity.ellipse.semiMajorAxis = position2.r;
  43198. this.editEntity.Position = this.DrawExample.getData();
  43199. break;
  43200. case "DrawCurve":
  43201. position2 = this.DrawExample.computePosition(this.editPositions);
  43202. this.editEntity.polyline.positions = position2;
  43203. this.editEntity.Position = this.DrawExample.getData();
  43204. break;
  43205. case "DrawPoint":
  43206. position2 = this.DrawExample.computePosition(this.editPositions);
  43207. this.editEntity.position = position2;
  43208. this.editEntity.Position = this.DrawExample.getData();
  43209. break;
  43210. case "DrawPolygon":
  43211. position2 = this.DrawExample.computePosition(this.editPositions);
  43212. this.editEntity.polygon.hierarchy = position2;
  43213. this.editEntity.Position = this.DrawExample.getData();
  43214. break;
  43215. case "DrawPolyline":
  43216. position2 = this.DrawExample.computePosition(this.editPositions);
  43217. this.editEntity.polyline.positions = position2;
  43218. this.editEntity.Position = this.DrawExample.getData();
  43219. break;
  43220. case "DrawRectangle":
  43221. position2 = this.DrawExample.computePosition(this.editPositions);
  43222. this.editEntity.rectangle.coordinates = position2;
  43223. this.editEntity.Position = this.DrawExample.getData();
  43224. break;
  43225. case "DrawSector":
  43226. position2 = this.DrawExample.computePosition(this.editPositions);
  43227. this.editEntity.polygon.hierarchy = position2;
  43228. this.editEntity.Position = this.DrawExample.getData();
  43229. break;
  43230. case "DrawBowLine":
  43231. position2 = this.DrawExample.computePosition(this.editPositions);
  43232. this.editEntity.polyline.positions = position2;
  43233. this.editEntity.Position = this.DrawExample.getData();
  43234. break;
  43235. case "DrawBowPlane":
  43236. position2 = this.DrawExample.computePosition(this.editPositions);
  43237. this.editEntity.polygon.hierarchy = position2;
  43238. this.editEntity.Position = this.DrawExample.getData();
  43239. break;
  43240. case "DrawRectFlag":
  43241. position2 = this.DrawExample.computePosition(this.editPositions);
  43242. this.editEntity.polygon.hierarchy = position2[0];
  43243. this.editEntity.polyline.positions = position2[1];
  43244. this.editEntity.Position = this.DrawExample.getData();
  43245. break;
  43246. case "DrawTriangleFlag":
  43247. position2 = this.DrawExample.computePosition(this.editPositions);
  43248. this.editEntity.polygon.hierarchy = position2[0];
  43249. this.editEntity.polyline.positions = position2[1];
  43250. this.editEntity.Position = this.DrawExample.getData();
  43251. break;
  43252. case "DrawCurveFlag":
  43253. position2 = this.DrawExample.computePosition(this.editPositions);
  43254. this.editEntity.polygon.hierarchy = position2[0];
  43255. this.editEntity.polyline.positions = position2[1];
  43256. this.editEntity.Position = this.DrawExample.getData();
  43257. break;
  43258. }
  43259. }
  43260. getEditEntityPositions() {
  43261. let position2 = this.editEntity.Position;
  43262. let positionArr = [];
  43263. switch (this.editEntity.Type) {
  43264. case "DrawAttackArrow":
  43265. for (let i2 = 0; i2 < position2.length; i2++) {
  43266. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43267. }
  43268. return positionArr;
  43269. case "DrawCircle":
  43270. for (let i2 = 0; i2 < position2.length; i2++) {
  43271. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43272. }
  43273. return positionArr;
  43274. case "DrawCurve":
  43275. for (let i2 = 0; i2 < position2.length; i2++) {
  43276. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43277. }
  43278. return positionArr;
  43279. case "DrawPincerArrow":
  43280. for (let i2 = 0; i2 < position2.length; i2++) {
  43281. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43282. }
  43283. return positionArr;
  43284. case "DrawPoint":
  43285. for (let i2 = 0; i2 < position2.length; i2++) {
  43286. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43287. }
  43288. return positionArr;
  43289. case "DrawPolygon":
  43290. for (let i2 = 0; i2 < position2.length; i2++) {
  43291. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43292. }
  43293. return positionArr;
  43294. case "DrawPolyline":
  43295. for (let i2 = 0; i2 < position2.length; i2++) {
  43296. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43297. }
  43298. return positionArr;
  43299. case "DrawRectangle":
  43300. for (let i2 = 0; i2 < position2.length; i2++) {
  43301. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43302. }
  43303. return positionArr;
  43304. case "DrawStraightArrow":
  43305. for (let i2 = 0; i2 < position2.length; i2++) {
  43306. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43307. }
  43308. return positionArr;
  43309. case "DrawGatheringPlace":
  43310. for (let i2 = 0; i2 < position2.length; i2++) {
  43311. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43312. }
  43313. return positionArr;
  43314. case "DrawSector":
  43315. for (let i2 = 0; i2 < position2.length; i2++) {
  43316. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43317. }
  43318. return positionArr;
  43319. case "DrawClosedCurve":
  43320. for (let i2 = 0; i2 < position2.length; i2++) {
  43321. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43322. }
  43323. return positionArr;
  43324. case "DrawBowLine":
  43325. for (let i2 = 0; i2 < position2.length; i2++) {
  43326. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43327. }
  43328. return positionArr;
  43329. case "DrawBowPlane":
  43330. for (let i2 = 0; i2 < position2.length; i2++) {
  43331. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43332. }
  43333. return positionArr;
  43334. case "DrawRectFlag":
  43335. for (let i2 = 0; i2 < position2.length; i2++) {
  43336. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43337. }
  43338. return positionArr;
  43339. case "DrawTriangleFlag":
  43340. for (let i2 = 0; i2 < position2.length; i2++) {
  43341. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43342. }
  43343. return positionArr;
  43344. case "DrawCurveFlag":
  43345. for (let i2 = 0; i2 < position2.length; i2++) {
  43346. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43347. }
  43348. return positionArr;
  43349. }
  43350. }
  43351. registerEvents() {
  43352. this.initLeftDownEventHandler();
  43353. this.initMouseMoveEventHandler();
  43354. this.initLeftUpEventHandler();
  43355. }
  43356. unRegisterEvents() {
  43357. this.eventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOWN);
  43358. this.eventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_UP);
  43359. this.eventHandler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  43360. }
  43361. initLeftDownEventHandler() {
  43362. this.eventHandler.setInputAction((e) => {
  43363. let id = this.viewer.scene.pick(e.position);
  43364. if (!id || !id.id || !id.id.type)
  43365. return;
  43366. if (id.id.type == "EditVertex" || id.id.type == "EditMove") {
  43367. this.isEditing = true;
  43368. this.viewer.scene.screenSpaceCameraController.enableRotate = false;
  43369. this.viewer.enableCursorStyle = false;
  43370. this.viewer._element.style.cursor = "";
  43371. document.body.style.cursor = "move";
  43372. this.editVertext = id.id;
  43373. this.editVertext.show = false;
  43374. this.clearMidVertex();
  43375. } else if (id.id.type == "EditMidVertex") {
  43376. this.editPositions.splice(id.id.vertexIndex, 0, id.id.position._value);
  43377. this.clearAllEditVertex();
  43378. this.createEditVertex();
  43379. this.createMidVertex();
  43380. this.isEdited = true;
  43381. } else {
  43382. return;
  43383. }
  43384. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  43385. }
  43386. initLeftUpEventHandler() {
  43387. this.eventHandler.setInputAction((e) => {
  43388. if (!this.isEditing)
  43389. return;
  43390. this.viewer.enableCursorStyle = true;
  43391. document.body.style.cursor = "default";
  43392. this.viewer.scene.screenSpaceCameraController.enableRotate = true;
  43393. this.editVertext.show = true;
  43394. this.isEditing = false;
  43395. this.clearMidVertex();
  43396. this.createMidVertex();
  43397. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  43398. }
  43399. initMouseMoveEventHandler() {
  43400. this.eventHandler.setInputAction((e) => {
  43401. var position2 = e.endPosition;
  43402. var ray = this.viewer.scene.camera.getPickRay(position2);
  43403. var cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  43404. if (!cartesian)
  43405. return;
  43406. if (!this.isEditing)
  43407. return;
  43408. if (this.editVertext.type == "EditMove") {
  43409. let startPosition = this.EditMoveCenterPositoin;
  43410. if (!startPosition)
  43411. return;
  43412. this.moveEntityByOffset(startPosition, cartesian);
  43413. } else if (this.editVertext.type == "EditVertex" || this.editVertext.type == "EditMidVertex") {
  43414. this.editPositions[this.editVertext.vertexIndex] = cartesian;
  43415. }
  43416. this.isEdited = true;
  43417. this.EditMoveCenterPositoin = this.getCenterPosition();
  43418. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  43419. }
  43420. getCenterPosition() {
  43421. let points2 = [];
  43422. let maxHeight = 0;
  43423. if (this.editEntity.Type == "DrawCircle" || this.editEntity.Type == "DrawPoint" || this.editEntity.Type == "DrawSector") {
  43424. return this.editPositions[0];
  43425. }
  43426. this.editPositions.forEach((position2) => {
  43427. const point3d = this.cartesian3ToPoint3D(position2);
  43428. points2.push([point3d.x, point3d.y]);
  43429. if (maxHeight < point3d.z)
  43430. maxHeight = point3d.z;
  43431. });
  43432. let geo = lineString(points2);
  43433. let bbox2 = bbox$1(geo);
  43434. let bboxPolygon$1 = bboxPolygon(bbox2);
  43435. let pointOnFeature = center(bboxPolygon$1);
  43436. let lonLat = pointOnFeature.geometry.coordinates;
  43437. return Cesium.Cartesian3.fromDegrees(lonLat[0], lonLat[1], maxHeight);
  43438. }
  43439. moveEntityByOffset(startPosition, endPosition) {
  43440. let startPoint3d = this.cartesian3ToPoint3D(startPosition);
  43441. let endPoint3d = this.cartesian3ToPoint3D(endPosition);
  43442. let offsetX = endPoint3d.x - startPoint3d.x;
  43443. let offsetY = endPoint3d.y - startPoint3d.y;
  43444. let element;
  43445. for (let i2 = 0; i2 < this.editPositions.length; i2++) {
  43446. element = this.cartesian3ToPoint3D(this.editPositions[i2]);
  43447. element.x += offsetX;
  43448. element.y += offsetY;
  43449. this.editPositions[i2] = Cesium.Cartesian3.fromDegrees(element.x, element.y, element.z);
  43450. }
  43451. }
  43452. createEditVertex() {
  43453. this.vertexEntities = [];
  43454. this.editPositions.forEach((p, index2) => {
  43455. const entity = this.viewer.entities.add({
  43456. position: new Cesium.CallbackProperty((e) => {
  43457. return this.editPositions[index2];
  43458. }, false),
  43459. type: "EditVertex",
  43460. vertexIndex: index2,
  43461. point: {
  43462. show: true,
  43463. pixelSize: 10,
  43464. color: new Cesium.Color(0, 0, 1, 1),
  43465. outlineWidth: 1,
  43466. outlineColor: new Cesium.Color(1, 1, 1, 1),
  43467. disableDepthTestDistance: 15e11,
  43468. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  43469. }
  43470. });
  43471. this.vertexEntities.push(entity);
  43472. });
  43473. if (this.editEntity.Type == "DrawCircle") {
  43474. this.vertexEntities[0].show = false;
  43475. }
  43476. if (this.editPositions.length == 1) {
  43477. return;
  43478. }
  43479. this.createEditMoveCenterEntity();
  43480. }
  43481. createEditMoveCenterEntity() {
  43482. this.EditMoveCenterEntity = this.viewer.entities.add({
  43483. position: new Cesium.CallbackProperty((e) => {
  43484. return this.EditMoveCenterPositoin;
  43485. }, false),
  43486. type: "EditMove",
  43487. point: {
  43488. show: true,
  43489. pixelSize: 12,
  43490. color: new Cesium.Color(0, 1, 0, 0.1),
  43491. outlineWidth: 2,
  43492. outlineColor: new Cesium.Color(1, 1, 1, 1),
  43493. disableDepthTestDistance: 15e11,
  43494. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  43495. }
  43496. });
  43497. }
  43498. clearEditVertex() {
  43499. if (this.vertexEntities) {
  43500. this.vertexEntities.forEach((item) => {
  43501. this.viewer.entities.remove(item);
  43502. });
  43503. }
  43504. this.vertexEntities = [];
  43505. this.viewer.entities.remove(this.EditMoveCenterEntity);
  43506. }
  43507. createMidVertex() {
  43508. if (this.editEntity.Type == "DrawCircle" || this.editEntity.Type == "DrawPincerArrow" || this.editEntity.Type == "DrawRectangle" || this.editEntity.Type == "DrawStraightArrow" || this.editEntity.Type == "DrawGatheringPlace" || this.editEntity.Type == "DrawSector" || this.editEntity.Type == "DrawBowLine" || this.editEntity.Type == "DrawBowPlane" || this.editEntity.Type == "DrawRectFlag" || this.editEntity.Type == "DrawTriangleFlag" || this.editEntity.Type == "DrawCurveFlag") {
  43509. return;
  43510. }
  43511. this.midVertexEntities = [];
  43512. for (let i2 = 0; i2 < this.editPositions.length; i2++) {
  43513. const p1 = this.editPositions[i2];
  43514. const p2 = this.editPositions[i2 + 1];
  43515. let mideP = this.midPosition(p1, p2);
  43516. const entity = this.viewer.entities.add({
  43517. position: mideP,
  43518. type: "EditMidVertex",
  43519. vertexIndex: i2 + 1,
  43520. point: {
  43521. show: true,
  43522. pixelSize: 10,
  43523. color: new Cesium.Color(0, 1, 0, 1),
  43524. outlineWidth: 1,
  43525. outlineColor: new Cesium.Color(1, 1, 1, 1),
  43526. disableDepthTestDistance: 15e11,
  43527. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  43528. }
  43529. });
  43530. this.midVertexEntities.push(entity);
  43531. }
  43532. }
  43533. clearMidVertex() {
  43534. if (this.midVertexEntities) {
  43535. this.midVertexEntities.forEach((item) => {
  43536. this.viewer.entities.remove(item);
  43537. });
  43538. }
  43539. this.midVertexEntities = [];
  43540. }
  43541. cartesian3ToPoint3D(position2) {
  43542. const cartographic = Cesium.Cartographic.fromCartesian(position2);
  43543. const lon = Cesium.Math.toDegrees(cartographic.longitude);
  43544. const lat = Cesium.Math.toDegrees(cartographic.latitude);
  43545. return {
  43546. x: lon,
  43547. y: lat,
  43548. z: cartographic.height
  43549. };
  43550. }
  43551. midPosition(first, second) {
  43552. if (!first || !second)
  43553. return null;
  43554. let point3d1 = this.cartesian3ToPoint3D(first);
  43555. let point3d2 = this.cartesian3ToPoint3D(second);
  43556. let midLonLat = {
  43557. x: (point3d1.x + point3d2.x) / 2,
  43558. y: (point3d1.y + point3d2.y) / 2,
  43559. z: (point3d1.z + point3d2.z) / 2
  43560. };
  43561. return Cesium.Cartesian3.fromDegrees(midLonLat.x, midLonLat.y, midLonLat.z);
  43562. }
  43563. cartesianToLatlng(cartesian) {
  43564. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  43565. let lat = new Cesium.Math.toDegrees(cartographic.latitude);
  43566. let lng = new Cesium.Math.toDegrees(cartographic.longitude);
  43567. cartographic.height;
  43568. return [lng, lat];
  43569. }
  43570. LatlngTocartesian(latlng) {
  43571. let cartesian3 = new Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  43572. return cartesian3;
  43573. }
  43574. }
  43575. var _style_0$1 = `@charset "UTF-8";:root{--el-color-white:#ffffff;--el-color-black:#000000;--el-color-primary-rgb:64,158,255;--el-color-success-rgb:103,194,58;--el-color-warning-rgb:230,162,60;--el-color-danger-rgb:245,108,108;--el-color-error-rgb:245,108,108;--el-color-info-rgb:144,147,153;--el-font-size-extra-large:20px;--el-font-size-large:18px;--el-font-size-medium:16px;--el-font-size-base:14px;--el-font-size-small:13px;--el-font-size-extra-small:12px;--el-font-family:"Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","\\5fae\\8f6f\\96c5\\9ed1",Arial,sans-serif;--el-font-weight-primary:500;--el-font-line-height-primary:24px;--el-index-normal:1;--el-index-top:1000;--el-index-popper:2000;--el-border-radius-base:4px;--el-border-radius-small:2px;--el-border-radius-round:20px;--el-border-radius-circle:100%;--el-transition-duration:.3s;--el-transition-duration-fast:.2s;--el-transition-function-ease-in-out-bezier:cubic-bezier(.645, .045, .355, 1);--el-transition-function-fast-bezier:cubic-bezier(.23, 1, .32, 1);--el-transition-all:all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);--el-transition-fade:opacity var(--el-transition-duration) var(--el-transition-function-fast-bezier);--el-transition-md-fade:transform var(--el-transition-duration) var(--el-transition-function-fast-bezier),opacity var(--el-transition-duration) var(--el-transition-function-fast-bezier);--el-transition-fade-linear:opacity var(--el-transition-duration-fast) linear;--el-transition-border:border-color var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-transition-box-shadow:box-shadow var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-transition-color:color var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-component-size-large:40px;--el-component-size:32px;--el-component-size-small:24px}:root{color-scheme:light;--el-color-white:#ffffff;--el-color-black:#000000;--el-color-primary:#409eff;--el-color-primary-light-3:#79bbff;--el-color-primary-light-5:#a0cfff;--el-color-primary-light-7:#c6e2ff;--el-color-primary-light-8:#d9ecff;--el-color-primary-light-9:#ecf5ff;--el-color-primary-dark-2:#337ecc;--el-color-success:#67c23a;--el-color-success-light-3:#95d475;--el-color-success-light-5:#b3e19d;--el-color-success-light-7:#d1edc4;--el-color-success-light-8:#e1f3d8;--el-color-success-light-9:#f0f9eb;--el-color-success-dark-2:#529b2e;--el-color-warning:#e6a23c;--el-color-warning-light-3:#eebe77;--el-color-warning-light-5:#f3d19e;--el-color-warning-light-7:#f8e3c5;--el-color-warning-light-8:#faecd8;--el-color-warning-light-9:#fdf6ec;--el-color-warning-dark-2:#b88230;--el-color-danger:#f56c6c;--el-color-danger-light-3:#f89898;--el-color-danger-light-5:#fab6b6;--el-color-danger-light-7:#fcd3d3;--el-color-danger-light-8:#fde2e2;--el-color-danger-light-9:#fef0f0;--el-color-danger-dark-2:#c45656;--el-color-error:#f56c6c;--el-color-error-light-3:#f89898;--el-color-error-light-5:#fab6b6;--el-color-error-light-7:#fcd3d3;--el-color-error-light-8:#fde2e2;--el-color-error-light-9:#fef0f0;--el-color-error-dark-2:#c45656;--el-color-info:#909399;--el-color-info-light-3:#b1b3b8;--el-color-info-light-5:#c8c9cc;--el-color-info-light-7:#dedfe0;--el-color-info-light-8:#e9e9eb;--el-color-info-light-9:#f4f4f5;--el-color-info-dark-2:#73767a;--el-bg-color:#ffffff;--el-bg-color-page:#f2f3f5;--el-bg-color-overlay:#ffffff;--el-text-color-primary:#303133;--el-text-color-regular:#606266;--el-text-color-secondary:#909399;--el-text-color-placeholder:#a8abb2;--el-text-color-disabled:#c0c4cc;--el-border-color:#dcdfe6;--el-border-color-light:#e4e7ed;--el-border-color-lighter:#ebeef5;--el-border-color-extra-light:#f2f6fc;--el-border-color-dark:#d4d7de;--el-border-color-darker:#cdd0d6;--el-fill-color:#f0f2f5;--el-fill-color-light:#f5f7fa;--el-fill-color-lighter:#fafafa;--el-fill-color-extra-light:#fafcff;--el-fill-color-dark:#ebedf0;--el-fill-color-darker:#e6e8eb;--el-fill-color-blank:#ffffff;--el-box-shadow:0px 12px 32px 4px rgba(0, 0, 0, .04),0px 8px 20px rgba(0, 0, 0, .08);--el-box-shadow-light:0px 0px 12px rgba(0, 0, 0, .12);--el-box-shadow-lighter:0px 0px 6px rgba(0, 0, 0, .12);--el-box-shadow-dark:0px 16px 48px 16px rgba(0, 0, 0, .08),0px 12px 32px rgba(0, 0, 0, .12),0px 8px 16px -8px rgba(0, 0, 0, .16);--el-disabled-bg-color:var(--el-fill-color-light);--el-disabled-text-color:var(--el-text-color-placeholder);--el-disabled-border-color:var(--el-border-color-light);--el-overlay-color:rgba(0, 0, 0, .8);--el-overlay-color-light:rgba(0, 0, 0, .7);--el-overlay-color-lighter:rgba(0, 0, 0, .5);--el-mask-color:rgba(255, 255, 255, .9);--el-mask-color-extra-light:rgba(255, 255, 255, .3);--el-border-width:1px;--el-border-style:solid;--el-border-color-hover:var(--el-text-color-disabled);--el-border:var(--el-border-width) var(--el-border-style) var(--el-border-color);--el-svg-monochrome-grey:var(--el-border-color)}.fade-in-linear-enter-active,.fade-in-linear-leave-active{transition:var(--el-transition-fade-linear)}.fade-in-linear-enter-from,.fade-in-linear-leave-to{opacity:0}.el-fade-in-linear-enter-active,.el-fade-in-linear-leave-active{transition:var(--el-transition-fade-linear)}.el-fade-in-linear-enter-from,.el-fade-in-linear-leave-to{opacity:0}.el-fade-in-enter-active,.el-fade-in-leave-active{transition:all var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-fade-in-enter-from,.el-fade-in-leave-active{opacity:0}.el-zoom-in-center-enter-active,.el-zoom-in-center-leave-active{transition:all var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-zoom-in-center-enter-from,.el-zoom-in-center-leave-active{opacity:0;transform:scaleX(0)}.el-zoom-in-top-enter-active,.el-zoom-in-top-leave-active{opacity:1;transform:scaleY(1);transition:var(--el-transition-md-fade);transform-origin:center top}.el-zoom-in-top-enter-active[data-popper-placement^=top],.el-zoom-in-top-leave-active[data-popper-placement^=top]{transform-origin:center bottom}.el-zoom-in-top-enter-from,.el-zoom-in-top-leave-active{opacity:0;transform:scaleY(0)}.el-zoom-in-bottom-enter-active,.el-zoom-in-bottom-leave-active{opacity:1;transform:scaleY(1);transition:var(--el-transition-md-fade);transform-origin:center bottom}.el-zoom-in-bottom-enter-from,.el-zoom-in-bottom-leave-active{opacity:0;transform:scaleY(0)}.el-zoom-in-left-enter-active,.el-zoom-in-left-leave-active{opacity:1;transform:scale(1);transition:var(--el-transition-md-fade);transform-origin:top left}.el-zoom-in-left-enter-from,.el-zoom-in-left-leave-active{opacity:0;transform:scale(.45)}.collapse-transition{transition:var(--el-transition-duration) height ease-in-out,var(--el-transition-duration) padding-top ease-in-out,var(--el-transition-duration) padding-bottom ease-in-out}.el-collapse-transition-enter-active,.el-collapse-transition-leave-active{transition:var(--el-transition-duration) max-height ease-in-out,var(--el-transition-duration) padding-top ease-in-out,var(--el-transition-duration) padding-bottom ease-in-out}.horizontal-collapse-transition{transition:var(--el-transition-duration) width ease-in-out,var(--el-transition-duration) padding-left ease-in-out,var(--el-transition-duration) padding-right ease-in-out}.el-list-enter-active,.el-list-leave-active{transition:all 1s}.el-list-enter-from,.el-list-leave-to{opacity:0;transform:translateY(-30px)}.el-list-leave-active{position:absolute!important}.el-opacity-transition{transition:opacity var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-icon-loading{-webkit-animation:rotating 2s linear infinite;animation:rotating 2s linear infinite}.el-icon--right{margin-left:5px}.el-icon--left{margin-right:5px}@-webkit-keyframes rotating{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes rotating{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.el-icon{--color:inherit;height:1em;width:1em;line-height:1em;display:inline-flex;justify-content:center;align-items:center;position:relative;fill:currentColor;color:var(--color);font-size:inherit}.el-icon.is-loading{-webkit-animation:rotating 2s linear infinite;animation:rotating 2s linear infinite}.el-icon svg{height:1em;width:1em}.el-affix--fixed{position:fixed}.el-alert{--el-alert-padding:8px 16px;--el-alert-border-radius-base:var(--el-border-radius-base);--el-alert-title-font-size:13px;--el-alert-description-font-size:12px;--el-alert-close-font-size:12px;--el-alert-close-customed-font-size:13px;--el-alert-icon-size:16px;--el-alert-icon-large-size:28px;width:100%;padding:var(--el-alert-padding);margin:0;box-sizing:border-box;border-radius:var(--el-alert-border-radius-base);position:relative;background-color:var(--el-color-white);overflow:hidden;opacity:1;display:flex;align-items:center;transition:opacity var(--el-transition-duration-fast)}.el-alert.is-light .el-alert__close-btn{color:var(--el-text-color-placeholder)}.el-alert.is-dark .el-alert__close-btn,.el-alert.is-dark .el-alert__description{color:var(--el-color-white)}.el-alert.is-center{justify-content:center}.el-alert--success{--el-alert-bg-color:var(--el-color-success-light-9)}.el-alert--success.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-success)}.el-alert--success.is-light .el-alert__description{color:var(--el-color-success)}.el-alert--success.is-dark{background-color:var(--el-color-success);color:var(--el-color-white)}.el-alert--info{--el-alert-bg-color:var(--el-color-info-light-9)}.el-alert--info.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-info)}.el-alert--info.is-light .el-alert__description{color:var(--el-color-info)}.el-alert--info.is-dark{background-color:var(--el-color-info);color:var(--el-color-white)}.el-alert--warning{--el-alert-bg-color:var(--el-color-warning-light-9)}.el-alert--warning.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-warning)}.el-alert--warning.is-light .el-alert__description{color:var(--el-color-warning)}.el-alert--warning.is-dark{background-color:var(--el-color-warning);color:var(--el-color-white)}.el-alert--error{--el-alert-bg-color:var(--el-color-error-light-9)}.el-alert--error.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-error)}.el-alert--error.is-light .el-alert__description{color:var(--el-color-error)}.el-alert--error.is-dark{background-color:var(--el-color-error);color:var(--el-color-white)}.el-alert__content{display:table-cell;padding:0 8px}.el-alert .el-alert__icon{font-size:var(--el-alert-icon-size);width:var(--el-alert-icon-size)}.el-alert .el-alert__icon.is-big{font-size:var(--el-alert-icon-large-size);width:var(--el-alert-icon-large-size)}.el-alert__title{font-size:var(--el-alert-title-font-size);line-height:18px;vertical-align:text-top}.el-alert__title.is-bold{font-weight:700}.el-alert .el-alert__description{font-size:var(--el-alert-description-font-size);margin:5px 0 0}.el-alert .el-alert__close-btn{font-size:var(--el-alert-close-font-size);opacity:1;position:absolute;top:12px;right:15px;cursor:pointer}.el-alert .el-alert__close-btn.is-customed{font-style:normal;font-size:var(--el-alert-close-customed-font-size);top:9px}.el-alert-fade-enter-from,.el-alert-fade-leave-active{opacity:0}.el-aside{overflow:auto;box-sizing:border-box;flex-shrink:0;width:var(--el-aside-width,300px)}.el-autocomplete{position:relative;display:inline-block}.el-autocomplete__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-box-shadow-light)}.el-autocomplete__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-autocomplete__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-autocomplete__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-autocomplete__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-autocomplete__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-autocomplete-suggestion{border-radius:var(--el-border-radius-base);box-sizing:border-box}.el-autocomplete-suggestion__wrap{max-height:280px;padding:10px 0;box-sizing:border-box}.el-autocomplete-suggestion__list{margin:0;padding:0}.el-autocomplete-suggestion li{padding:0 20px;margin:0;line-height:34px;cursor:pointer;color:var(--el-text-color-regular);font-size:var(--el-font-size-base);list-style:none;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.el-autocomplete-suggestion li:hover,.el-autocomplete-suggestion li.highlighted{background-color:var(--el-fill-color-light)}.el-autocomplete-suggestion li.divider{margin-top:6px;border-top:1px solid var(--el-color-black)}.el-autocomplete-suggestion li.divider:last-child{margin-bottom:-6px}.el-autocomplete-suggestion.is-loading li{text-align:center;height:100px;line-height:100px;font-size:20px;color:var(--el-text-color-secondary)}.el-autocomplete-suggestion.is-loading li:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-autocomplete-suggestion.is-loading li:hover{background-color:var(--el-bg-color-overlay)}.el-autocomplete-suggestion.is-loading .el-icon-loading{vertical-align:middle}.el-avatar{--el-avatar-text-color:var(--el-color-white);--el-avatar-bg-color:var(--el-text-color-disabled);--el-avatar-text-size:14px;--el-avatar-icon-size:18px;--el-avatar-border-radius:var(--el-border-radius-base);--el-avatar-size-large:56px;--el-avatar-size-small:24px;--el-avatar-size:40px;display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;text-align:center;overflow:hidden;color:var(--el-avatar-text-color);background:var(--el-avatar-bg-color);width:var(--el-avatar-size);height:var(--el-avatar-size);font-size:var(--el-avatar-text-size)}.el-avatar>img{display:block;height:100%}.el-avatar--circle{border-radius:50%}.el-avatar--square{border-radius:var(--el-avatar-border-radius)}.el-avatar--icon{font-size:var(--el-avatar-icon-size)}.el-avatar--small{--el-avatar-size:24px}.el-avatar--large{--el-avatar-size:56px}.el-backtop{--el-backtop-bg-color:var(--el-bg-color-overlay);--el-backtop-text-color:var(--el-color-primary);--el-backtop-hover-bg-color:var(--el-border-color-extra-light);position:fixed;background-color:var(--el-backtop-bg-color);width:40px;height:40px;border-radius:50%;color:var(--el-backtop-text-color);display:flex;align-items:center;justify-content:center;font-size:20px;box-shadow:var(--el-box-shadow-lighter);cursor:pointer;z-index:5}.el-backtop:hover{background-color:var(--el-backtop-hover-bg-color)}.el-backtop__icon{font-size:20px}.el-badge{--el-badge-bg-color:var(--el-color-danger);--el-badge-radius:10px;--el-badge-font-size:12px;--el-badge-padding:6px;--el-badge-size:18px;position:relative;vertical-align:middle;display:inline-block;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.el-badge__content{background-color:var(--el-badge-bg-color);border-radius:var(--el-badge-radius);color:var(--el-color-white);display:inline-flex;justify-content:center;align-items:center;font-size:var(--el-badge-font-size);height:var(--el-badge-size);padding:0 var(--el-badge-padding);white-space:nowrap;border:1px solid var(--el-bg-color)}.el-badge__content.is-fixed{position:absolute;top:0;right:calc(1px + var(--el-badge-size)/ 2);transform:translateY(-50%) translate(100%);z-index:var(--el-index-normal)}.el-badge__content.is-fixed.is-dot{right:5px}.el-badge__content.is-dot{height:8px;width:8px;padding:0;right:0;border-radius:50%}.el-badge__content--primary{background-color:var(--el-color-primary)}.el-badge__content--success{background-color:var(--el-color-success)}.el-badge__content--warning{background-color:var(--el-color-warning)}.el-badge__content--info{background-color:var(--el-color-info)}.el-badge__content--danger{background-color:var(--el-color-danger)}.el-breadcrumb{font-size:14px;line-height:1}.el-breadcrumb:after,.el-breadcrumb:before{display:table;content:""}.el-breadcrumb:after{clear:both}.el-breadcrumb__separator{margin:0 9px;font-weight:700;color:var(--el-text-color-placeholder)}.el-breadcrumb__separator.el-icon{margin:0 6px;font-weight:400}.el-breadcrumb__separator.el-icon svg{vertical-align:middle}.el-breadcrumb__item{float:left;display:inline-flex;align-items:center}.el-breadcrumb__inner{color:var(--el-text-color-regular)}.el-breadcrumb__inner a,.el-breadcrumb__inner.is-link{font-weight:700;text-decoration:none;transition:var(--el-transition-color);color:var(--el-text-color-primary)}.el-breadcrumb__inner a:hover,.el-breadcrumb__inner.is-link:hover{color:var(--el-color-primary);cursor:pointer}.el-breadcrumb__item:last-child .el-breadcrumb__inner,.el-breadcrumb__item:last-child .el-breadcrumb__inner a,.el-breadcrumb__item:last-child .el-breadcrumb__inner a:hover,.el-breadcrumb__item:last-child .el-breadcrumb__inner:hover{font-weight:400;color:var(--el-text-color-regular);cursor:text}.el-breadcrumb__item:last-child .el-breadcrumb__separator{display:none}.el-button-group{display:inline-block;vertical-align:middle}.el-button-group:after,.el-button-group:before{display:table;content:""}.el-button-group:after{clear:both}.el-button-group>.el-button{float:left;position:relative}.el-button-group>.el-button+.el-button{margin-left:0}.el-button-group>.el-button:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.el-button-group>.el-button:last-child{border-top-left-radius:0;border-bottom-left-radius:0}.el-button-group>.el-button:first-child:last-child{border-top-right-radius:var(--el-border-radius-base);border-bottom-right-radius:var(--el-border-radius-base);border-top-left-radius:var(--el-border-radius-base);border-bottom-left-radius:var(--el-border-radius-base)}.el-button-group>.el-button:first-child:last-child.is-round{border-radius:var(--el-border-radius-round)}.el-button-group>.el-button:first-child:last-child.is-circle{border-radius:50%}.el-button-group>.el-button:not(:first-child):not(:last-child){border-radius:0}.el-button-group>.el-button:not(:last-child){margin-right:-1px}.el-button-group>.el-button:active,.el-button-group>.el-button:focus,.el-button-group>.el-button:hover{z-index:1}.el-button-group>.el-button.is-active{z-index:1}.el-button-group>.el-dropdown>.el-button{border-top-left-radius:0;border-bottom-left-radius:0;border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--primary:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--primary:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--primary:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--success:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--success:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--success:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--warning:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--warning:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--warning:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--danger:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--danger:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--danger:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--info:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--info:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--info:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button{--el-button-font-weight:var(--el-font-weight-primary);--el-button-border-color:var(--el-border-color);--el-button-bg-color:var(--el-fill-color-blank);--el-button-text-color:var(--el-text-color-regular);--el-button-disabled-text-color:var(--el-disabled-text-color);--el-button-disabled-bg-color:var(--el-fill-color-blank);--el-button-disabled-border-color:var(--el-border-color-light);--el-button-divide-border-color:rgba(255, 255, 255, .5);--el-button-hover-text-color:var(--el-color-primary);--el-button-hover-bg-color:var(--el-color-primary-light-9);--el-button-hover-border-color:var(--el-color-primary-light-7);--el-button-active-text-color:var(--el-button-hover-text-color);--el-button-active-border-color:var(--el-color-primary);--el-button-active-bg-color:var(--el-button-hover-bg-color);--el-button-outline-color:var(--el-color-primary-light-5);--el-button-hover-link-text-color:var(--el-color-info);--el-button-active-color:var(--el-text-color-primary)}.el-button{display:inline-flex;justify-content:center;align-items:center;line-height:1;height:32px;white-space:nowrap;cursor:pointer;color:var(--el-button-text-color);text-align:center;box-sizing:border-box;outline:0;transition:.1s;font-weight:var(--el-button-font-weight);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;-webkit-appearance:none;background-color:var(--el-button-bg-color);border:var(--el-border);border-color:var(--el-button-border-color);padding:8px 15px;font-size:var(--el-font-size-base);border-radius:var(--el-border-radius-base)}.el-button:focus,.el-button:hover{color:var(--el-button-hover-text-color);border-color:var(--el-button-hover-border-color);background-color:var(--el-button-hover-bg-color);outline:0}.el-button:active{color:var(--el-button-active-text-color);border-color:var(--el-button-active-border-color);background-color:var(--el-button-active-bg-color);outline:0}.el-button:focus-visible{outline:2px solid var(--el-button-outline-color);outline-offset:1px}.el-button>span{display:inline-flex;align-items:center}.el-button+.el-button{margin-left:12px}.el-button.is-round{padding:8px 15px}.el-button::-moz-focus-inner{border:0}.el-button [class*=el-icon]+span{margin-left:6px}.el-button [class*=el-icon] svg{vertical-align:bottom}.el-button.is-plain{--el-button-hover-text-color:var(--el-color-primary);--el-button-hover-bg-color:var(--el-fill-color-blank);--el-button-hover-border-color:var(--el-color-primary)}.el-button.is-active{color:var(--el-button-active-text-color);border-color:var(--el-button-active-border-color);background-color:var(--el-button-active-bg-color);outline:0}.el-button.is-disabled,.el-button.is-disabled:focus,.el-button.is-disabled:hover{color:var(--el-button-disabled-text-color);cursor:not-allowed;background-image:none;background-color:var(--el-button-disabled-bg-color);border-color:var(--el-button-disabled-border-color)}.el-button.is-loading{position:relative;pointer-events:none}.el-button.is-loading:before{z-index:1;pointer-events:none;content:"";position:absolute;left:-1px;top:-1px;right:-1px;bottom:-1px;border-radius:inherit;background-color:var(--el-mask-color-extra-light)}.el-button.is-round{border-radius:var(--el-border-radius-round)}.el-button.is-circle{border-radius:50%;padding:8px}.el-button.is-text{color:var(--el-button-text-color);border:0 solid transparent;background-color:transparent}.el-button.is-text.is-disabled{color:var(--el-button-disabled-text-color);background-color:transparent!important}.el-button.is-text:not(.is-disabled):focus,.el-button.is-text:not(.is-disabled):hover{background-color:var(--el-fill-color-light)}.el-button.is-text:not(.is-disabled):focus-visible{outline:2px solid var(--el-button-outline-color);outline-offset:1px}.el-button.is-text:not(.is-disabled):active{background-color:var(--el-fill-color)}.el-button.is-text:not(.is-disabled).is-has-bg{background-color:var(--el-fill-color-light)}.el-button.is-text:not(.is-disabled).is-has-bg:focus,.el-button.is-text:not(.is-disabled).is-has-bg:hover{background-color:var(--el-fill-color)}.el-button.is-text:not(.is-disabled).is-has-bg:active{background-color:var(--el-fill-color-dark)}.el-button__text--expand{letter-spacing:.3em;margin-right:-.3em}.el-button.is-link{border-color:transparent;color:var(--el-button-text-color);background:0 0;padding:2px;height:auto}.el-button.is-link:focus,.el-button.is-link:hover{color:var(--el-button-hover-link-text-color)}.el-button.is-link.is-disabled{color:var(--el-button-disabled-text-color);background-color:transparent!important;border-color:transparent!important}.el-button.is-link:not(.is-disabled):focus,.el-button.is-link:not(.is-disabled):hover{border-color:transparent;background-color:transparent}.el-button.is-link:not(.is-disabled):active{color:var(--el-button-active-color);border-color:transparent;background-color:transparent}.el-button--text{border-color:transparent;background:0 0;color:var(--el-color-primary);padding-left:0;padding-right:0}.el-button--text.is-disabled{color:var(--el-button-disabled-text-color);background-color:transparent!important;border-color:transparent!important}.el-button--text:not(.is-disabled):focus,.el-button--text:not(.is-disabled):hover{color:var(--el-color-primary-light-3);border-color:transparent;background-color:transparent}.el-button--text:not(.is-disabled):active{color:var(--el-color-primary-dark-2);border-color:transparent;background-color:transparent}.el-button__link--expand{letter-spacing:.3em;margin-right:-.3em}.el-button--primary{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-primary);--el-button-border-color:var(--el-color-primary);--el-button-outline-color:var(--el-color-primary-light-5);--el-button-active-color:var(--el-color-primary-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-primary-light-5);--el-button-hover-bg-color:var(--el-color-primary-light-3);--el-button-hover-border-color:var(--el-color-primary-light-3);--el-button-active-bg-color:var(--el-color-primary-dark-2);--el-button-active-border-color:var(--el-color-primary-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-primary-light-5);--el-button-disabled-border-color:var(--el-color-primary-light-5)}.el-button--primary.is-link,.el-button--primary.is-plain,.el-button--primary.is-text{--el-button-text-color:var(--el-color-primary);--el-button-bg-color:var(--el-color-primary-light-9);--el-button-border-color:var(--el-color-primary-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-primary);--el-button-hover-border-color:var(--el-color-primary);--el-button-active-text-color:var(--el-color-white)}.el-button--primary.is-link.is-disabled,.el-button--primary.is-link.is-disabled:active,.el-button--primary.is-link.is-disabled:focus,.el-button--primary.is-link.is-disabled:hover,.el-button--primary.is-plain.is-disabled,.el-button--primary.is-plain.is-disabled:active,.el-button--primary.is-plain.is-disabled:focus,.el-button--primary.is-plain.is-disabled:hover,.el-button--primary.is-text.is-disabled,.el-button--primary.is-text.is-disabled:active,.el-button--primary.is-text.is-disabled:focus,.el-button--primary.is-text.is-disabled:hover{color:var(--el-color-primary-light-5);background-color:var(--el-color-primary-light-9);border-color:var(--el-color-primary-light-8)}.el-button--success{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-success);--el-button-border-color:var(--el-color-success);--el-button-outline-color:var(--el-color-success-light-5);--el-button-active-color:var(--el-color-success-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-success-light-5);--el-button-hover-bg-color:var(--el-color-success-light-3);--el-button-hover-border-color:var(--el-color-success-light-3);--el-button-active-bg-color:var(--el-color-success-dark-2);--el-button-active-border-color:var(--el-color-success-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-success-light-5);--el-button-disabled-border-color:var(--el-color-success-light-5)}.el-button--success.is-link,.el-button--success.is-plain,.el-button--success.is-text{--el-button-text-color:var(--el-color-success);--el-button-bg-color:var(--el-color-success-light-9);--el-button-border-color:var(--el-color-success-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-success);--el-button-hover-border-color:var(--el-color-success);--el-button-active-text-color:var(--el-color-white)}.el-button--success.is-link.is-disabled,.el-button--success.is-link.is-disabled:active,.el-button--success.is-link.is-disabled:focus,.el-button--success.is-link.is-disabled:hover,.el-button--success.is-plain.is-disabled,.el-button--success.is-plain.is-disabled:active,.el-button--success.is-plain.is-disabled:focus,.el-button--success.is-plain.is-disabled:hover,.el-button--success.is-text.is-disabled,.el-button--success.is-text.is-disabled:active,.el-button--success.is-text.is-disabled:focus,.el-button--success.is-text.is-disabled:hover{color:var(--el-color-success-light-5);background-color:var(--el-color-success-light-9);border-color:var(--el-color-success-light-8)}.el-button--warning{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-warning);--el-button-border-color:var(--el-color-warning);--el-button-outline-color:var(--el-color-warning-light-5);--el-button-active-color:var(--el-color-warning-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-warning-light-5);--el-button-hover-bg-color:var(--el-color-warning-light-3);--el-button-hover-border-color:var(--el-color-warning-light-3);--el-button-active-bg-color:var(--el-color-warning-dark-2);--el-button-active-border-color:var(--el-color-warning-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-warning-light-5);--el-button-disabled-border-color:var(--el-color-warning-light-5)}.el-button--warning.is-link,.el-button--warning.is-plain,.el-button--warning.is-text{--el-button-text-color:var(--el-color-warning);--el-button-bg-color:var(--el-color-warning-light-9);--el-button-border-color:var(--el-color-warning-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-warning);--el-button-hover-border-color:var(--el-color-warning);--el-button-active-text-color:var(--el-color-white)}.el-button--warning.is-link.is-disabled,.el-button--warning.is-link.is-disabled:active,.el-button--warning.is-link.is-disabled:focus,.el-button--warning.is-link.is-disabled:hover,.el-button--warning.is-plain.is-disabled,.el-button--warning.is-plain.is-disabled:active,.el-button--warning.is-plain.is-disabled:focus,.el-button--warning.is-plain.is-disabled:hover,.el-button--warning.is-text.is-disabled,.el-button--warning.is-text.is-disabled:active,.el-button--warning.is-text.is-disabled:focus,.el-button--warning.is-text.is-disabled:hover{color:var(--el-color-warning-light-5);background-color:var(--el-color-warning-light-9);border-color:var(--el-color-warning-light-8)}.el-button--danger{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-danger);--el-button-border-color:var(--el-color-danger);--el-button-outline-color:var(--el-color-danger-light-5);--el-button-active-color:var(--el-color-danger-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-danger-light-5);--el-button-hover-bg-color:var(--el-color-danger-light-3);--el-button-hover-border-color:var(--el-color-danger-light-3);--el-button-active-bg-color:var(--el-color-danger-dark-2);--el-button-active-border-color:var(--el-color-danger-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-danger-light-5);--el-button-disabled-border-color:var(--el-color-danger-light-5)}.el-button--danger.is-link,.el-button--danger.is-plain,.el-button--danger.is-text{--el-button-text-color:var(--el-color-danger);--el-button-bg-color:var(--el-color-danger-light-9);--el-button-border-color:var(--el-color-danger-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-danger);--el-button-hover-border-color:var(--el-color-danger);--el-button-active-text-color:var(--el-color-white)}.el-button--danger.is-link.is-disabled,.el-button--danger.is-link.is-disabled:active,.el-button--danger.is-link.is-disabled:focus,.el-button--danger.is-link.is-disabled:hover,.el-button--danger.is-plain.is-disabled,.el-button--danger.is-plain.is-disabled:active,.el-button--danger.is-plain.is-disabled:focus,.el-button--danger.is-plain.is-disabled:hover,.el-button--danger.is-text.is-disabled,.el-button--danger.is-text.is-disabled:active,.el-button--danger.is-text.is-disabled:focus,.el-button--danger.is-text.is-disabled:hover{color:var(--el-color-danger-light-5);background-color:var(--el-color-danger-light-9);border-color:var(--el-color-danger-light-8)}.el-button--info{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-info);--el-button-border-color:var(--el-color-info);--el-button-outline-color:var(--el-color-info-light-5);--el-button-active-color:var(--el-color-info-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-info-light-5);--el-button-hover-bg-color:var(--el-color-info-light-3);--el-button-hover-border-color:var(--el-color-info-light-3);--el-button-active-bg-color:var(--el-color-info-dark-2);--el-button-active-border-color:var(--el-color-info-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-info-light-5);--el-button-disabled-border-color:var(--el-color-info-light-5)}.el-button--info.is-link,.el-button--info.is-plain,.el-button--info.is-text{--el-button-text-color:var(--el-color-info);--el-button-bg-color:var(--el-color-info-light-9);--el-button-border-color:var(--el-color-info-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-info);--el-button-hover-border-color:var(--el-color-info);--el-button-active-text-color:var(--el-color-white)}.el-button--info.is-link.is-disabled,.el-button--info.is-link.is-disabled:active,.el-button--info.is-link.is-disabled:focus,.el-button--info.is-link.is-disabled:hover,.el-button--info.is-plain.is-disabled,.el-button--info.is-plain.is-disabled:active,.el-button--info.is-plain.is-disabled:focus,.el-button--info.is-plain.is-disabled:hover,.el-button--info.is-text.is-disabled,.el-button--info.is-text.is-disabled:active,.el-button--info.is-text.is-disabled:focus,.el-button--info.is-text.is-disabled:hover{color:var(--el-color-info-light-5);background-color:var(--el-color-info-light-9);border-color:var(--el-color-info-light-8)}.el-button--large{--el-button-size:40px;height:var(--el-button-size);padding:12px 19px;font-size:var(--el-font-size-base);border-radius:var(--el-border-radius-base)}.el-button--large [class*=el-icon]+span{margin-left:8px}.el-button--large.is-round{padding:12px 19px}.el-button--large.is-circle{width:var(--el-button-size);padding:12px}.el-button--small{--el-button-size:24px;height:var(--el-button-size);padding:5px 11px;font-size:12px;border-radius:calc(var(--el-border-radius-base) - 1px)}.el-button--small [class*=el-icon]+span{margin-left:4px}.el-button--small.is-round{padding:5px 11px}.el-button--small.is-circle{width:var(--el-button-size);padding:5px}.el-calendar{--el-calendar-border:var(--el-table-border, 1px solid var(--el-border-color-lighter));--el-calendar-header-border-bottom:var(--el-calendar-border);--el-calendar-selected-bg-color:var(--el-color-primary-light-9);--el-calendar-cell-width:85px;background-color:var(--el-fill-color-blank)}.el-calendar__header{display:flex;justify-content:space-between;padding:12px 20px;border-bottom:var(--el-calendar-header-border-bottom)}.el-calendar__title{color:var(--el-text-color);align-self:center}.el-calendar__body{padding:12px 20px 35px}.el-calendar-table{table-layout:fixed;width:100%}.el-calendar-table thead th{padding:12px 0;color:var(--el-text-color-regular);font-weight:400}.el-calendar-table:not(.is-range) td.next,.el-calendar-table:not(.is-range) td.prev{color:var(--el-text-color-placeholder)}.el-calendar-table td{border-bottom:var(--el-calendar-border);border-right:var(--el-calendar-border);vertical-align:top;transition:background-color var(--el-transition-duration-fast) ease}.el-calendar-table td.is-selected{background-color:var(--el-calendar-selected-bg-color)}.el-calendar-table td.is-today{color:var(--el-color-primary)}.el-calendar-table tr:first-child td{border-top:var(--el-calendar-border)}.el-calendar-table tr td:first-child{border-left:var(--el-calendar-border)}.el-calendar-table tr.el-calendar-table__row--hide-border td{border-top:none}.el-calendar-table .el-calendar-day{box-sizing:border-box;padding:8px;height:var(--el-calendar-cell-width)}.el-calendar-table .el-calendar-day:hover{cursor:pointer;background-color:var(--el-calendar-selected-bg-color)}.el-card{--el-card-border-color:var(--el-border-color-light);--el-card-border-radius:4px;--el-card-padding:20px;--el-card-bg-color:var(--el-fill-color-blank)}.el-card{border-radius:var(--el-card-border-radius);border:1px solid var(--el-card-border-color);background-color:var(--el-card-bg-color);overflow:hidden;color:var(--el-text-color-primary);transition:var(--el-transition-duration)}.el-card.is-always-shadow{box-shadow:var(--el-box-shadow-light)}.el-card.is-hover-shadow:focus,.el-card.is-hover-shadow:hover{box-shadow:var(--el-box-shadow-light)}.el-card__header{padding:calc(var(--el-card-padding) - 2px) var(--el-card-padding);border-bottom:1px solid var(--el-card-border-color);box-sizing:border-box}.el-card__body{padding:var(--el-card-padding)}.el-carousel__item{position:absolute;top:0;left:0;width:100%;height:100%;display:inline-block;overflow:hidden;z-index:calc(var(--el-index-normal) - 1)}.el-carousel__item.is-active{z-index:calc(var(--el-index-normal) - 1)}.el-carousel__item.is-animating{transition:transform .4s ease-in-out}.el-carousel__item--card{width:50%;transition:transform .4s ease-in-out}.el-carousel__item--card.is-in-stage{cursor:pointer;z-index:var(--el-index-normal)}.el-carousel__item--card.is-in-stage.is-hover .el-carousel__mask,.el-carousel__item--card.is-in-stage:hover .el-carousel__mask{opacity:.12}.el-carousel__item--card.is-active{z-index:calc(var(--el-index-normal) + 1)}.el-carousel__mask{position:absolute;width:100%;height:100%;top:0;left:0;background-color:var(--el-color-white);opacity:.24;transition:var(--el-transition-duration-fast)}.el-carousel{--el-carousel-arrow-font-size:12px;--el-carousel-arrow-size:36px;--el-carousel-arrow-background:rgba(31, 45, 61, .11);--el-carousel-arrow-hover-background:rgba(31, 45, 61, .23);--el-carousel-indicator-width:30px;--el-carousel-indicator-height:2px;--el-carousel-indicator-padding-horizontal:4px;--el-carousel-indicator-padding-vertical:12px;--el-carousel-indicator-out-color:var(--el-border-color-hover);position:relative}.el-carousel--horizontal{overflow-x:hidden}.el-carousel--vertical{overflow-y:hidden}.el-carousel__container{position:relative;height:300px}.el-carousel__arrow{border:none;outline:0;padding:0;margin:0;height:var(--el-carousel-arrow-size);width:var(--el-carousel-arrow-size);cursor:pointer;transition:var(--el-transition-duration);border-radius:50%;background-color:var(--el-carousel-arrow-background);color:#fff;position:absolute;top:50%;z-index:10;transform:translateY(-50%);text-align:center;font-size:var(--el-carousel-arrow-font-size);display:inline-flex;justify-content:center;align-items:center}.el-carousel__arrow--left{left:16px}.el-carousel__arrow--right{right:16px}.el-carousel__arrow:hover{background-color:var(--el-carousel-arrow-hover-background)}.el-carousel__arrow i{cursor:pointer}.el-carousel__indicators{position:absolute;list-style:none;margin:0;padding:0;z-index:calc(var(--el-index-normal) + 1)}.el-carousel__indicators--horizontal{bottom:0;left:50%;transform:translate(-50%)}.el-carousel__indicators--vertical{right:0;top:50%;transform:translateY(-50%)}.el-carousel__indicators--outside{bottom:calc(var(--el-carousel-indicator-height) + var(--el-carousel-indicator-padding-vertical) * 2);text-align:center;position:static;transform:none}.el-carousel__indicators--outside .el-carousel__indicator:hover button{opacity:.64}.el-carousel__indicators--outside button{background-color:var(--el-carousel-indicator-out-color);opacity:.24}.el-carousel__indicators--labels{left:0;right:0;transform:none;text-align:center}.el-carousel__indicators--labels .el-carousel__button{height:auto;width:auto;padding:2px 18px;font-size:12px;color:#000}.el-carousel__indicators--labels .el-carousel__indicator{padding:6px 4px}.el-carousel__indicator{background-color:transparent;cursor:pointer}.el-carousel__indicator:hover button{opacity:.72}.el-carousel__indicator--horizontal{display:inline-block;padding:var(--el-carousel-indicator-padding-vertical) var(--el-carousel-indicator-padding-horizontal)}.el-carousel__indicator--vertical{padding:var(--el-carousel-indicator-padding-horizontal) var(--el-carousel-indicator-padding-vertical)}.el-carousel__indicator--vertical .el-carousel__button{width:var(--el-carousel-indicator-height);height:calc(var(--el-carousel-indicator-width)/ 2)}.el-carousel__indicator.is-active button{opacity:1}.el-carousel__button{display:block;opacity:.48;width:var(--el-carousel-indicator-width);height:var(--el-carousel-indicator-height);background-color:#fff;border:none;outline:0;padding:0;margin:0;cursor:pointer;transition:var(--el-transition-duration)}.carousel-arrow-left-enter-from,.carousel-arrow-left-leave-active{transform:translateY(-50%) translate(-10px);opacity:0}.carousel-arrow-right-enter-from,.carousel-arrow-right-leave-active{transform:translateY(-50%) translate(10px);opacity:0}.el-cascader-panel{--el-cascader-menu-text-color:var(--el-text-color-regular);--el-cascader-menu-selected-text-color:var(--el-color-primary);--el-cascader-menu-fill:var(--el-bg-color-overlay);--el-cascader-menu-font-size:var(--el-font-size-base);--el-cascader-menu-radius:var(--el-border-radius-base);--el-cascader-menu-border:solid 1px var(--el-border-color-light);--el-cascader-menu-shadow:var(--el-box-shadow-light);--el-cascader-node-background-hover:var(--el-fill-color-light);--el-cascader-node-color-disabled:var(--el-text-color-placeholder);--el-cascader-color-empty:var(--el-text-color-placeholder);--el-cascader-tag-background:var(--el-fill-color)}.el-cascader-panel{display:flex;border-radius:var(--el-cascader-menu-radius);font-size:var(--el-cascader-menu-font-size)}.el-cascader-panel.is-bordered{border:var(--el-cascader-menu-border);border-radius:var(--el-cascader-menu-radius)}.el-cascader-menu{min-width:180px;box-sizing:border-box;color:var(--el-cascader-menu-text-color);border-right:var(--el-cascader-menu-border)}.el-cascader-menu:last-child{border-right:none}.el-cascader-menu:last-child .el-cascader-node{padding-right:20px}.el-cascader-menu__wrap.el-scrollbar__wrap{height:204px}.el-cascader-menu__list{position:relative;min-height:100%;margin:0;padding:6px 0;list-style:none;box-sizing:border-box}.el-cascader-menu__hover-zone{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none}.el-cascader-menu__empty-text{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);display:flex;align-items:center;color:var(--el-cascader-color-empty)}.el-cascader-menu__empty-text .is-loading{margin-right:2px}.el-cascader-node{position:relative;display:flex;align-items:center;padding:0 30px 0 20px;height:34px;line-height:34px;outline:0}.el-cascader-node.is-selectable.in-active-path{color:var(--el-cascader-menu-text-color)}.el-cascader-node.in-active-path,.el-cascader-node.is-active,.el-cascader-node.is-selectable.in-checked-path{color:var(--el-cascader-menu-selected-text-color);font-weight:700}.el-cascader-node:not(.is-disabled){cursor:pointer}.el-cascader-node:not(.is-disabled):focus,.el-cascader-node:not(.is-disabled):hover{background:var(--el-cascader-node-background-hover)}.el-cascader-node.is-disabled{color:var(--el-cascader-node-color-disabled);cursor:not-allowed}.el-cascader-node__prefix{position:absolute;left:10px}.el-cascader-node__postfix{position:absolute;right:10px}.el-cascader-node__label{flex:1;text-align:left;padding:0 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.el-cascader-node>.el-checkbox{margin-right:0}.el-cascader-node>.el-radio{margin-right:0}.el-cascader-node>.el-radio .el-radio__label{padding-left:0}.el-cascader{--el-cascader-menu-text-color:var(--el-text-color-regular);--el-cascader-menu-selected-text-color:var(--el-color-primary);--el-cascader-menu-fill:var(--el-bg-color-overlay);--el-cascader-menu-font-size:var(--el-font-size-base);--el-cascader-menu-radius:var(--el-border-radius-base);--el-cascader-menu-border:solid 1px var(--el-border-color-light);--el-cascader-menu-shadow:var(--el-box-shadow-light);--el-cascader-node-background-hover:var(--el-fill-color-light);--el-cascader-node-color-disabled:var(--el-text-color-placeholder);--el-cascader-color-empty:var(--el-text-color-placeholder);--el-cascader-tag-background:var(--el-fill-color);display:inline-block;vertical-align:middle;position:relative;font-size:var(--el-font-size-base);line-height:32px;outline:0}.el-cascader:not(.is-disabled):hover .el-input__wrapper{cursor:pointer;box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-cascader .el-input{display:flex;cursor:pointer}.el-cascader .el-input .el-input__inner{text-overflow:ellipsis;cursor:pointer}.el-cascader .el-input .el-input__suffix-inner .el-icon{height:calc(100% - 2px)}.el-cascader .el-input .el-input__suffix-inner .el-icon svg{vertical-align:middle}.el-cascader .el-input .icon-arrow-down{transition:transform var(--el-transition-duration);font-size:14px}.el-cascader .el-input .icon-arrow-down.is-reverse{transform:rotate(180deg)}.el-cascader .el-input .icon-circle-close:hover{color:var(--el-input-clear-hover-color,var(--el-text-color-secondary))}.el-cascader .el-input.is-focus .el-input__wrapper{box-shadow:0 0 0 1px var(--el-input-focus-border-color,var(--el-color-primary)) inset}.el-cascader--large{font-size:14px;line-height:40px}.el-cascader--small{font-size:12px;line-height:24px}.el-cascader.is-disabled .el-cascader__label{z-index:calc(var(--el-index-normal) + 1);color:var(--el-disabled-text-color)}.el-cascader__dropdown{--el-cascader-menu-text-color:var(--el-text-color-regular);--el-cascader-menu-selected-text-color:var(--el-color-primary);--el-cascader-menu-fill:var(--el-bg-color-overlay);--el-cascader-menu-font-size:var(--el-font-size-base);--el-cascader-menu-radius:var(--el-border-radius-base);--el-cascader-menu-border:solid 1px var(--el-border-color-light);--el-cascader-menu-shadow:var(--el-box-shadow-light);--el-cascader-node-background-hover:var(--el-fill-color-light);--el-cascader-node-color-disabled:var(--el-text-color-placeholder);--el-cascader-color-empty:var(--el-text-color-placeholder);--el-cascader-tag-background:var(--el-fill-color)}.el-cascader__dropdown{font-size:var(--el-cascader-menu-font-size);border-radius:var(--el-cascader-menu-radius)}.el-cascader__dropdown.el-popper{background:var(--el-cascader-menu-fill);border:var(--el-cascader-menu-border);box-shadow:var(--el-cascader-menu-shadow)}.el-cascader__dropdown.el-popper .el-popper__arrow:before{border:var(--el-cascader-menu-border)}.el-cascader__dropdown.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-cascader__dropdown.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-cascader__dropdown.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-cascader__dropdown.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-cascader__dropdown.el-popper{box-shadow:var(--el-cascader-menu-shadow)}.el-cascader__tags{position:absolute;left:0;right:30px;top:50%;transform:translateY(-50%);display:flex;flex-wrap:wrap;line-height:normal;text-align:left;box-sizing:border-box}.el-cascader__tags .el-tag{display:inline-flex;align-items:center;max-width:100%;margin:2px 0 2px 6px;text-overflow:ellipsis;background:var(--el-cascader-tag-background)}.el-cascader__tags .el-tag:not(.is-hit){border-color:transparent}.el-cascader__tags .el-tag>span{flex:1;overflow:hidden;text-overflow:ellipsis}.el-cascader__tags .el-tag .el-icon-close{flex:none;background-color:var(--el-text-color-placeholder);color:var(--el-color-white)}.el-cascader__tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-cascader__collapse-tags{white-space:normal;z-index:var(--el-index-normal)}.el-cascader__collapse-tags .el-tag{display:inline-flex;align-items:center;max-width:100%;margin:2px 0 2px 6px;text-overflow:ellipsis;background:var(--el-fill-color)}.el-cascader__collapse-tags .el-tag:not(.is-hit){border-color:transparent}.el-cascader__collapse-tags .el-tag>span{flex:1;overflow:hidden;text-overflow:ellipsis}.el-cascader__collapse-tags .el-tag .el-icon-close{flex:none;background-color:var(--el-text-color-placeholder);color:var(--el-color-white)}.el-cascader__collapse-tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-cascader__suggestion-panel{border-radius:var(--el-cascader-menu-radius)}.el-cascader__suggestion-list{max-height:204px;margin:0;padding:6px 0;font-size:var(--el-font-size-base);color:var(--el-cascader-menu-text-color);text-align:center}.el-cascader__suggestion-item{display:flex;justify-content:space-between;align-items:center;height:34px;padding:0 15px;text-align:left;outline:0;cursor:pointer}.el-cascader__suggestion-item:focus,.el-cascader__suggestion-item:hover{background:var(--el-cascader-node-background-hover)}.el-cascader__suggestion-item.is-checked{color:var(--el-cascader-menu-selected-text-color);font-weight:700}.el-cascader__suggestion-item>span{margin-right:10px}.el-cascader__empty-text{margin:10px 0;color:var(--el-cascader-color-empty)}.el-cascader__search-input{flex:1;height:24px;min-width:60px;margin:2px 0 2px 11px;padding:0;color:var(--el-cascader-menu-text-color);border:none;outline:0;box-sizing:border-box;background:0 0}.el-cascader__search-input::-moz-placeholder{color:transparent}.el-cascader__search-input:-ms-input-placeholder{color:transparent}.el-cascader__search-input::placeholder{color:transparent}.el-check-tag{background-color:var(--el-color-info-light-9);border-radius:var(--el-border-radius-base);color:var(--el-color-info);cursor:pointer;display:inline-block;font-size:var(--el-font-size-base);line-height:var(--el-font-size-base);padding:7px 15px;transition:var(--el-transition-all);font-weight:700}.el-check-tag:hover{background-color:var(--el-color-info-light-7)}.el-check-tag.is-checked{background-color:var(--el-color-primary-light-8);color:var(--el-color-primary)}.el-check-tag.is-checked:hover{background-color:var(--el-color-primary-light-7)}.el-checkbox-button{--el-checkbox-button-checked-bg-color:var(--el-color-primary);--el-checkbox-button-checked-text-color:var(--el-color-white);--el-checkbox-button-checked-border-color:var(--el-color-primary)}.el-checkbox-button{position:relative;display:inline-block}.el-checkbox-button__inner{display:inline-block;line-height:1;font-weight:var(--el-checkbox-font-weight);white-space:nowrap;vertical-align:middle;cursor:pointer;background:var(--el-button-bg-color,var(--el-fill-color-blank));border:var(--el-border);border-left:0;color:var(--el-button-text-color,var(--el-text-color-regular));-webkit-appearance:none;text-align:center;box-sizing:border-box;outline:0;margin:0;position:relative;transition:var(--el-transition-all);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:8px 15px;font-size:var(--el-font-size-base);border-radius:0}.el-checkbox-button__inner.is-round{padding:8px 15px}.el-checkbox-button__inner:hover{color:var(--el-color-primary)}.el-checkbox-button__inner [class*=el-icon-]{line-height:.9}.el-checkbox-button__inner [class*=el-icon-]+span{margin-left:5px}.el-checkbox-button__original{opacity:0;outline:0;position:absolute;margin:0;z-index:-1}.el-checkbox-button.is-checked .el-checkbox-button__inner{color:var(--el-checkbox-button-checked-text-color);background-color:var(--el-checkbox-button-checked-bg-color);border-color:var(--el-checkbox-button-checked-border-color);box-shadow:-1px 0 0 0 var(--el-color-primary-light-7)}.el-checkbox-button.is-checked:first-child .el-checkbox-button__inner{border-left-color:var(--el-checkbox-button-checked-border-color)}.el-checkbox-button.is-disabled .el-checkbox-button__inner{color:var(--el-disabled-text-color);cursor:not-allowed;background-image:none;background-color:var(--el-button-disabled-bg-color,var(--el-fill-color-blank));border-color:var(--el-button-disabled-border-color,var(--el-border-color-light));box-shadow:none}.el-checkbox-button.is-disabled:first-child .el-checkbox-button__inner{border-left-color:var(--el-button-disabled-border-color,var(--el-border-color-light))}.el-checkbox-button:first-child .el-checkbox-button__inner{border-left:var(--el-border);border-top-left-radius:var(--el-border-radius-base);border-bottom-left-radius:var(--el-border-radius-base);box-shadow:none!important}.el-checkbox-button.is-focus .el-checkbox-button__inner{border-color:var(--el-checkbox-button-checked-border-color)}.el-checkbox-button:last-child .el-checkbox-button__inner{border-top-right-radius:var(--el-border-radius-base);border-bottom-right-radius:var(--el-border-radius-base)}.el-checkbox-button--large .el-checkbox-button__inner{padding:12px 19px;font-size:var(--el-font-size-base);border-radius:0}.el-checkbox-button--large .el-checkbox-button__inner.is-round{padding:12px 19px}.el-checkbox-button--small .el-checkbox-button__inner{padding:5px 11px;font-size:12px;border-radius:0}.el-checkbox-button--small .el-checkbox-button__inner.is-round{padding:5px 11px}.el-checkbox-group{font-size:0;line-height:0}.el-checkbox{--el-checkbox-font-size:14px;--el-checkbox-font-weight:var(--el-font-weight-primary);--el-checkbox-text-color:var(--el-text-color-regular);--el-checkbox-input-height:14px;--el-checkbox-input-width:14px;--el-checkbox-border-radius:var(--el-border-radius-small);--el-checkbox-bg-color:var(--el-fill-color-blank);--el-checkbox-input-border:var(--el-border);--el-checkbox-disabled-border-color:var(--el-border-color);--el-checkbox-disabled-input-fill:var(--el-fill-color-light);--el-checkbox-disabled-icon-color:var(--el-text-color-placeholder);--el-checkbox-disabled-checked-input-fill:var(--el-border-color-extra-light);--el-checkbox-disabled-checked-input-border-color:var(--el-border-color);--el-checkbox-disabled-checked-icon-color:var(--el-text-color-placeholder);--el-checkbox-checked-text-color:var(--el-color-primary);--el-checkbox-checked-input-border-color:var(--el-color-primary);--el-checkbox-checked-bg-color:var(--el-color-primary);--el-checkbox-checked-icon-color:var(--el-color-white);--el-checkbox-input-border-color-hover:var(--el-color-primary)}.el-checkbox{color:var(--el-checkbox-text-color);font-weight:var(--el-checkbox-font-weight);font-size:var(--el-font-size-base);position:relative;cursor:pointer;display:inline-flex;align-items:center;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;margin-right:30px;height:32px}.el-checkbox.is-disabled{cursor:not-allowed}.el-checkbox.is-bordered{padding:0 15px 0 9px;border-radius:var(--el-border-radius-base);border:var(--el-border);box-sizing:border-box}.el-checkbox.is-bordered.is-checked{border-color:var(--el-color-primary)}.el-checkbox.is-bordered.is-disabled{border-color:var(--el-border-color-lighter)}.el-checkbox.is-bordered.el-checkbox--large{padding:0 19px 0 11px;border-radius:var(--el-border-radius-base)}.el-checkbox.is-bordered.el-checkbox--large .el-checkbox__label{font-size:var(--el-font-size-base)}.el-checkbox.is-bordered.el-checkbox--large .el-checkbox__inner{height:14px;width:14px}.el-checkbox.is-bordered.el-checkbox--small{padding:0 11px 0 7px;border-radius:calc(var(--el-border-radius-base) - 1px)}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__label{font-size:12px}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__inner{height:12px;width:12px}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__inner:after{height:6px;width:2px}.el-checkbox input:focus-visible+.el-checkbox__inner{outline:2px solid var(--el-checkbox-input-border-color-hover);outline-offset:1px;border-radius:var(--el-checkbox-border-radius)}.el-checkbox__input{white-space:nowrap;cursor:pointer;outline:0;display:inline-flex;position:relative}.el-checkbox__input.is-disabled .el-checkbox__inner{background-color:var(--el-checkbox-disabled-input-fill);border-color:var(--el-checkbox-disabled-border-color);cursor:not-allowed}.el-checkbox__input.is-disabled .el-checkbox__inner:after{cursor:not-allowed;border-color:var(--el-checkbox-disabled-icon-color)}.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner{background-color:var(--el-checkbox-disabled-checked-input-fill);border-color:var(--el-checkbox-disabled-checked-input-border-color)}.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner:after{border-color:var(--el-checkbox-disabled-checked-icon-color)}.el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner{background-color:var(--el-checkbox-disabled-checked-input-fill);border-color:var(--el-checkbox-disabled-checked-input-border-color)}.el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner:before{background-color:var(--el-checkbox-disabled-checked-icon-color);border-color:var(--el-checkbox-disabled-checked-icon-color)}.el-checkbox__input.is-disabled+span.el-checkbox__label{color:var(--el-disabled-text-color);cursor:not-allowed}.el-checkbox__input.is-checked .el-checkbox__inner{background-color:var(--el-checkbox-checked-bg-color);border-color:var(--el-checkbox-checked-input-border-color)}.el-checkbox__input.is-checked .el-checkbox__inner:after{transform:rotate(45deg) scaleY(1)}.el-checkbox__input.is-checked+.el-checkbox__label{color:var(--el-checkbox-checked-text-color)}.el-checkbox__input.is-focus:not(.is-checked) .el-checkbox__original:not(:focus-visible){border-color:var(--el-checkbox-input-border-color-hover)}.el-checkbox__input.is-indeterminate .el-checkbox__inner{background-color:var(--el-checkbox-checked-bg-color);border-color:var(--el-checkbox-checked-input-border-color)}.el-checkbox__input.is-indeterminate .el-checkbox__inner:before{content:"";position:absolute;display:block;background-color:var(--el-checkbox-checked-icon-color);height:2px;transform:scale(.5);left:0;right:0;top:5px}.el-checkbox__input.is-indeterminate .el-checkbox__inner:after{display:none}.el-checkbox__inner{display:inline-block;position:relative;border:var(--el-checkbox-input-border);border-radius:var(--el-checkbox-border-radius);box-sizing:border-box;width:var(--el-checkbox-input-width);height:var(--el-checkbox-input-height);background-color:var(--el-checkbox-bg-color);z-index:var(--el-index-normal);transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46),outline .25s cubic-bezier(.71,-.46,.29,1.46)}.el-checkbox__inner:hover{border-color:var(--el-checkbox-input-border-color-hover)}.el-checkbox__inner:after{box-sizing:content-box;content:"";border:1px solid var(--el-checkbox-checked-icon-color);border-left:0;border-top:0;height:7px;left:4px;position:absolute;top:1px;transform:rotate(45deg) scaleY(0);width:3px;transition:transform .15s ease-in 50ms;transform-origin:center}.el-checkbox__original{opacity:0;outline:0;position:absolute;margin:0;width:0;height:0;z-index:-1}.el-checkbox__label{display:inline-block;padding-left:8px;line-height:1;font-size:var(--el-checkbox-font-size)}.el-checkbox.el-checkbox--large{height:40px}.el-checkbox.el-checkbox--large .el-checkbox__label{font-size:14px}.el-checkbox.el-checkbox--large .el-checkbox__inner{width:14px;height:14px}.el-checkbox.el-checkbox--small{height:24px}.el-checkbox.el-checkbox--small .el-checkbox__label{font-size:12px}.el-checkbox.el-checkbox--small .el-checkbox__inner{width:12px;height:12px}.el-checkbox.el-checkbox--small .el-checkbox__input.is-indeterminate .el-checkbox__inner:before{top:4px}.el-checkbox.el-checkbox--small .el-checkbox__inner:after{width:2px;height:6px}.el-checkbox:last-of-type{margin-right:0}[class*=el-col-]{box-sizing:border-box}[class*=el-col-].is-guttered{display:block;min-height:1px}.el-col-0,.el-col-0.is-guttered{display:none}.el-col-0{max-width:0%;flex:0 0 0%}.el-col-offset-0{margin-left:0}.el-col-pull-0{position:relative;right:0}.el-col-push-0{position:relative;left:0}.el-col-1{max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-offset-1{margin-left:4.1666666667%}.el-col-pull-1{position:relative;right:4.1666666667%}.el-col-push-1{position:relative;left:4.1666666667%}.el-col-2{max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-offset-2{margin-left:8.3333333333%}.el-col-pull-2{position:relative;right:8.3333333333%}.el-col-push-2{position:relative;left:8.3333333333%}.el-col-3{max-width:12.5%;flex:0 0 12.5%}.el-col-offset-3{margin-left:12.5%}.el-col-pull-3{position:relative;right:12.5%}.el-col-push-3{position:relative;left:12.5%}.el-col-4{max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-offset-4{margin-left:16.6666666667%}.el-col-pull-4{position:relative;right:16.6666666667%}.el-col-push-4{position:relative;left:16.6666666667%}.el-col-5{max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-offset-5{margin-left:20.8333333333%}.el-col-pull-5{position:relative;right:20.8333333333%}.el-col-push-5{position:relative;left:20.8333333333%}.el-col-6{max-width:25%;flex:0 0 25%}.el-col-offset-6{margin-left:25%}.el-col-pull-6{position:relative;right:25%}.el-col-push-6{position:relative;left:25%}.el-col-7{max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-offset-7{margin-left:29.1666666667%}.el-col-pull-7{position:relative;right:29.1666666667%}.el-col-push-7{position:relative;left:29.1666666667%}.el-col-8{max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-offset-8{margin-left:33.3333333333%}.el-col-pull-8{position:relative;right:33.3333333333%}.el-col-push-8{position:relative;left:33.3333333333%}.el-col-9{max-width:37.5%;flex:0 0 37.5%}.el-col-offset-9{margin-left:37.5%}.el-col-pull-9{position:relative;right:37.5%}.el-col-push-9{position:relative;left:37.5%}.el-col-10{max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-offset-10{margin-left:41.6666666667%}.el-col-pull-10{position:relative;right:41.6666666667%}.el-col-push-10{position:relative;left:41.6666666667%}.el-col-11{max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-offset-11{margin-left:45.8333333333%}.el-col-pull-11{position:relative;right:45.8333333333%}.el-col-push-11{position:relative;left:45.8333333333%}.el-col-12{max-width:50%;flex:0 0 50%}.el-col-offset-12{margin-left:50%}.el-col-pull-12{position:relative;right:50%}.el-col-push-12{position:relative;left:50%}.el-col-13{max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-offset-13{margin-left:54.1666666667%}.el-col-pull-13{position:relative;right:54.1666666667%}.el-col-push-13{position:relative;left:54.1666666667%}.el-col-14{max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-offset-14{margin-left:58.3333333333%}.el-col-pull-14{position:relative;right:58.3333333333%}.el-col-push-14{position:relative;left:58.3333333333%}.el-col-15{max-width:62.5%;flex:0 0 62.5%}.el-col-offset-15{margin-left:62.5%}.el-col-pull-15{position:relative;right:62.5%}.el-col-push-15{position:relative;left:62.5%}.el-col-16{max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-offset-16{margin-left:66.6666666667%}.el-col-pull-16{position:relative;right:66.6666666667%}.el-col-push-16{position:relative;left:66.6666666667%}.el-col-17{max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-offset-17{margin-left:70.8333333333%}.el-col-pull-17{position:relative;right:70.8333333333%}.el-col-push-17{position:relative;left:70.8333333333%}.el-col-18{max-width:75%;flex:0 0 75%}.el-col-offset-18{margin-left:75%}.el-col-pull-18{position:relative;right:75%}.el-col-push-18{position:relative;left:75%}.el-col-19{max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-offset-19{margin-left:79.1666666667%}.el-col-pull-19{position:relative;right:79.1666666667%}.el-col-push-19{position:relative;left:79.1666666667%}.el-col-20{max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-offset-20{margin-left:83.3333333333%}.el-col-pull-20{position:relative;right:83.3333333333%}.el-col-push-20{position:relative;left:83.3333333333%}.el-col-21{max-width:87.5%;flex:0 0 87.5%}.el-col-offset-21{margin-left:87.5%}.el-col-pull-21{position:relative;right:87.5%}.el-col-push-21{position:relative;left:87.5%}.el-col-22{max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-offset-22{margin-left:91.6666666667%}.el-col-pull-22{position:relative;right:91.6666666667%}.el-col-push-22{position:relative;left:91.6666666667%}.el-col-23{max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-offset-23{margin-left:95.8333333333%}.el-col-pull-23{position:relative;right:95.8333333333%}.el-col-push-23{position:relative;left:95.8333333333%}.el-col-24{max-width:100%;flex:0 0 100%}.el-col-offset-24{margin-left:100%}.el-col-pull-24{position:relative;right:100%}.el-col-push-24{position:relative;left:100%}@media only screen and (max-width:768px){.el-col-xs-0,.el-col-xs-0.is-guttered{display:none}.el-col-xs-0{max-width:0%;flex:0 0 0%}.el-col-xs-offset-0{margin-left:0}.el-col-xs-pull-0{position:relative;right:0}.el-col-xs-push-0{position:relative;left:0}.el-col-xs-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-xs-offset-1{margin-left:4.1666666667%}.el-col-xs-pull-1{position:relative;right:4.1666666667%}.el-col-xs-push-1{position:relative;left:4.1666666667%}.el-col-xs-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-xs-offset-2{margin-left:8.3333333333%}.el-col-xs-pull-2{position:relative;right:8.3333333333%}.el-col-xs-push-2{position:relative;left:8.3333333333%}.el-col-xs-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-xs-offset-3{margin-left:12.5%}.el-col-xs-pull-3{position:relative;right:12.5%}.el-col-xs-push-3{position:relative;left:12.5%}.el-col-xs-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-xs-offset-4{margin-left:16.6666666667%}.el-col-xs-pull-4{position:relative;right:16.6666666667%}.el-col-xs-push-4{position:relative;left:16.6666666667%}.el-col-xs-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-xs-offset-5{margin-left:20.8333333333%}.el-col-xs-pull-5{position:relative;right:20.8333333333%}.el-col-xs-push-5{position:relative;left:20.8333333333%}.el-col-xs-6{display:block;max-width:25%;flex:0 0 25%}.el-col-xs-offset-6{margin-left:25%}.el-col-xs-pull-6{position:relative;right:25%}.el-col-xs-push-6{position:relative;left:25%}.el-col-xs-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-xs-offset-7{margin-left:29.1666666667%}.el-col-xs-pull-7{position:relative;right:29.1666666667%}.el-col-xs-push-7{position:relative;left:29.1666666667%}.el-col-xs-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-xs-offset-8{margin-left:33.3333333333%}.el-col-xs-pull-8{position:relative;right:33.3333333333%}.el-col-xs-push-8{position:relative;left:33.3333333333%}.el-col-xs-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-xs-offset-9{margin-left:37.5%}.el-col-xs-pull-9{position:relative;right:37.5%}.el-col-xs-push-9{position:relative;left:37.5%}.el-col-xs-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-xs-offset-10{margin-left:41.6666666667%}.el-col-xs-pull-10{position:relative;right:41.6666666667%}.el-col-xs-push-10{position:relative;left:41.6666666667%}.el-col-xs-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-xs-offset-11{margin-left:45.8333333333%}.el-col-xs-pull-11{position:relative;right:45.8333333333%}.el-col-xs-push-11{position:relative;left:45.8333333333%}.el-col-xs-12{display:block;max-width:50%;flex:0 0 50%}.el-col-xs-offset-12{margin-left:50%}.el-col-xs-pull-12{position:relative;right:50%}.el-col-xs-push-12{position:relative;left:50%}.el-col-xs-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-xs-offset-13{margin-left:54.1666666667%}.el-col-xs-pull-13{position:relative;right:54.1666666667%}.el-col-xs-push-13{position:relative;left:54.1666666667%}.el-col-xs-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-xs-offset-14{margin-left:58.3333333333%}.el-col-xs-pull-14{position:relative;right:58.3333333333%}.el-col-xs-push-14{position:relative;left:58.3333333333%}.el-col-xs-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-xs-offset-15{margin-left:62.5%}.el-col-xs-pull-15{position:relative;right:62.5%}.el-col-xs-push-15{position:relative;left:62.5%}.el-col-xs-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-xs-offset-16{margin-left:66.6666666667%}.el-col-xs-pull-16{position:relative;right:66.6666666667%}.el-col-xs-push-16{position:relative;left:66.6666666667%}.el-col-xs-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-xs-offset-17{margin-left:70.8333333333%}.el-col-xs-pull-17{position:relative;right:70.8333333333%}.el-col-xs-push-17{position:relative;left:70.8333333333%}.el-col-xs-18{display:block;max-width:75%;flex:0 0 75%}.el-col-xs-offset-18{margin-left:75%}.el-col-xs-pull-18{position:relative;right:75%}.el-col-xs-push-18{position:relative;left:75%}.el-col-xs-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-xs-offset-19{margin-left:79.1666666667%}.el-col-xs-pull-19{position:relative;right:79.1666666667%}.el-col-xs-push-19{position:relative;left:79.1666666667%}.el-col-xs-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-xs-offset-20{margin-left:83.3333333333%}.el-col-xs-pull-20{position:relative;right:83.3333333333%}.el-col-xs-push-20{position:relative;left:83.3333333333%}.el-col-xs-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-xs-offset-21{margin-left:87.5%}.el-col-xs-pull-21{position:relative;right:87.5%}.el-col-xs-push-21{position:relative;left:87.5%}.el-col-xs-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-xs-offset-22{margin-left:91.6666666667%}.el-col-xs-pull-22{position:relative;right:91.6666666667%}.el-col-xs-push-22{position:relative;left:91.6666666667%}.el-col-xs-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-xs-offset-23{margin-left:95.8333333333%}.el-col-xs-pull-23{position:relative;right:95.8333333333%}.el-col-xs-push-23{position:relative;left:95.8333333333%}.el-col-xs-24{display:block;max-width:100%;flex:0 0 100%}.el-col-xs-offset-24{margin-left:100%}.el-col-xs-pull-24{position:relative;right:100%}.el-col-xs-push-24{position:relative;left:100%}}@media only screen and (min-width:768px){.el-col-sm-0,.el-col-sm-0.is-guttered{display:none}.el-col-sm-0{max-width:0%;flex:0 0 0%}.el-col-sm-offset-0{margin-left:0}.el-col-sm-pull-0{position:relative;right:0}.el-col-sm-push-0{position:relative;left:0}.el-col-sm-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-sm-offset-1{margin-left:4.1666666667%}.el-col-sm-pull-1{position:relative;right:4.1666666667%}.el-col-sm-push-1{position:relative;left:4.1666666667%}.el-col-sm-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-sm-offset-2{margin-left:8.3333333333%}.el-col-sm-pull-2{position:relative;right:8.3333333333%}.el-col-sm-push-2{position:relative;left:8.3333333333%}.el-col-sm-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-sm-offset-3{margin-left:12.5%}.el-col-sm-pull-3{position:relative;right:12.5%}.el-col-sm-push-3{position:relative;left:12.5%}.el-col-sm-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-sm-offset-4{margin-left:16.6666666667%}.el-col-sm-pull-4{position:relative;right:16.6666666667%}.el-col-sm-push-4{position:relative;left:16.6666666667%}.el-col-sm-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-sm-offset-5{margin-left:20.8333333333%}.el-col-sm-pull-5{position:relative;right:20.8333333333%}.el-col-sm-push-5{position:relative;left:20.8333333333%}.el-col-sm-6{display:block;max-width:25%;flex:0 0 25%}.el-col-sm-offset-6{margin-left:25%}.el-col-sm-pull-6{position:relative;right:25%}.el-col-sm-push-6{position:relative;left:25%}.el-col-sm-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-sm-offset-7{margin-left:29.1666666667%}.el-col-sm-pull-7{position:relative;right:29.1666666667%}.el-col-sm-push-7{position:relative;left:29.1666666667%}.el-col-sm-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-sm-offset-8{margin-left:33.3333333333%}.el-col-sm-pull-8{position:relative;right:33.3333333333%}.el-col-sm-push-8{position:relative;left:33.3333333333%}.el-col-sm-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-sm-offset-9{margin-left:37.5%}.el-col-sm-pull-9{position:relative;right:37.5%}.el-col-sm-push-9{position:relative;left:37.5%}.el-col-sm-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-sm-offset-10{margin-left:41.6666666667%}.el-col-sm-pull-10{position:relative;right:41.6666666667%}.el-col-sm-push-10{position:relative;left:41.6666666667%}.el-col-sm-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-sm-offset-11{margin-left:45.8333333333%}.el-col-sm-pull-11{position:relative;right:45.8333333333%}.el-col-sm-push-11{position:relative;left:45.8333333333%}.el-col-sm-12{display:block;max-width:50%;flex:0 0 50%}.el-col-sm-offset-12{margin-left:50%}.el-col-sm-pull-12{position:relative;right:50%}.el-col-sm-push-12{position:relative;left:50%}.el-col-sm-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-sm-offset-13{margin-left:54.1666666667%}.el-col-sm-pull-13{position:relative;right:54.1666666667%}.el-col-sm-push-13{position:relative;left:54.1666666667%}.el-col-sm-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-sm-offset-14{margin-left:58.3333333333%}.el-col-sm-pull-14{position:relative;right:58.3333333333%}.el-col-sm-push-14{position:relative;left:58.3333333333%}.el-col-sm-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-sm-offset-15{margin-left:62.5%}.el-col-sm-pull-15{position:relative;right:62.5%}.el-col-sm-push-15{position:relative;left:62.5%}.el-col-sm-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-sm-offset-16{margin-left:66.6666666667%}.el-col-sm-pull-16{position:relative;right:66.6666666667%}.el-col-sm-push-16{position:relative;left:66.6666666667%}.el-col-sm-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-sm-offset-17{margin-left:70.8333333333%}.el-col-sm-pull-17{position:relative;right:70.8333333333%}.el-col-sm-push-17{position:relative;left:70.8333333333%}.el-col-sm-18{display:block;max-width:75%;flex:0 0 75%}.el-col-sm-offset-18{margin-left:75%}.el-col-sm-pull-18{position:relative;right:75%}.el-col-sm-push-18{position:relative;left:75%}.el-col-sm-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-sm-offset-19{margin-left:79.1666666667%}.el-col-sm-pull-19{position:relative;right:79.1666666667%}.el-col-sm-push-19{position:relative;left:79.1666666667%}.el-col-sm-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-sm-offset-20{margin-left:83.3333333333%}.el-col-sm-pull-20{position:relative;right:83.3333333333%}.el-col-sm-push-20{position:relative;left:83.3333333333%}.el-col-sm-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-sm-offset-21{margin-left:87.5%}.el-col-sm-pull-21{position:relative;right:87.5%}.el-col-sm-push-21{position:relative;left:87.5%}.el-col-sm-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-sm-offset-22{margin-left:91.6666666667%}.el-col-sm-pull-22{position:relative;right:91.6666666667%}.el-col-sm-push-22{position:relative;left:91.6666666667%}.el-col-sm-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-sm-offset-23{margin-left:95.8333333333%}.el-col-sm-pull-23{position:relative;right:95.8333333333%}.el-col-sm-push-23{position:relative;left:95.8333333333%}.el-col-sm-24{display:block;max-width:100%;flex:0 0 100%}.el-col-sm-offset-24{margin-left:100%}.el-col-sm-pull-24{position:relative;right:100%}.el-col-sm-push-24{position:relative;left:100%}}@media only screen and (min-width:992px){.el-col-md-0,.el-col-md-0.is-guttered{display:none}.el-col-md-0{max-width:0%;flex:0 0 0%}.el-col-md-offset-0{margin-left:0}.el-col-md-pull-0{position:relative;right:0}.el-col-md-push-0{position:relative;left:0}.el-col-md-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-md-offset-1{margin-left:4.1666666667%}.el-col-md-pull-1{position:relative;right:4.1666666667%}.el-col-md-push-1{position:relative;left:4.1666666667%}.el-col-md-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-md-offset-2{margin-left:8.3333333333%}.el-col-md-pull-2{position:relative;right:8.3333333333%}.el-col-md-push-2{position:relative;left:8.3333333333%}.el-col-md-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-md-offset-3{margin-left:12.5%}.el-col-md-pull-3{position:relative;right:12.5%}.el-col-md-push-3{position:relative;left:12.5%}.el-col-md-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-md-offset-4{margin-left:16.6666666667%}.el-col-md-pull-4{position:relative;right:16.6666666667%}.el-col-md-push-4{position:relative;left:16.6666666667%}.el-col-md-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-md-offset-5{margin-left:20.8333333333%}.el-col-md-pull-5{position:relative;right:20.8333333333%}.el-col-md-push-5{position:relative;left:20.8333333333%}.el-col-md-6{display:block;max-width:25%;flex:0 0 25%}.el-col-md-offset-6{margin-left:25%}.el-col-md-pull-6{position:relative;right:25%}.el-col-md-push-6{position:relative;left:25%}.el-col-md-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-md-offset-7{margin-left:29.1666666667%}.el-col-md-pull-7{position:relative;right:29.1666666667%}.el-col-md-push-7{position:relative;left:29.1666666667%}.el-col-md-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-md-offset-8{margin-left:33.3333333333%}.el-col-md-pull-8{position:relative;right:33.3333333333%}.el-col-md-push-8{position:relative;left:33.3333333333%}.el-col-md-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-md-offset-9{margin-left:37.5%}.el-col-md-pull-9{position:relative;right:37.5%}.el-col-md-push-9{position:relative;left:37.5%}.el-col-md-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-md-offset-10{margin-left:41.6666666667%}.el-col-md-pull-10{position:relative;right:41.6666666667%}.el-col-md-push-10{position:relative;left:41.6666666667%}.el-col-md-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-md-offset-11{margin-left:45.8333333333%}.el-col-md-pull-11{position:relative;right:45.8333333333%}.el-col-md-push-11{position:relative;left:45.8333333333%}.el-col-md-12{display:block;max-width:50%;flex:0 0 50%}.el-col-md-offset-12{margin-left:50%}.el-col-md-pull-12{position:relative;right:50%}.el-col-md-push-12{position:relative;left:50%}.el-col-md-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-md-offset-13{margin-left:54.1666666667%}.el-col-md-pull-13{position:relative;right:54.1666666667%}.el-col-md-push-13{position:relative;left:54.1666666667%}.el-col-md-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-md-offset-14{margin-left:58.3333333333%}.el-col-md-pull-14{position:relative;right:58.3333333333%}.el-col-md-push-14{position:relative;left:58.3333333333%}.el-col-md-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-md-offset-15{margin-left:62.5%}.el-col-md-pull-15{position:relative;right:62.5%}.el-col-md-push-15{position:relative;left:62.5%}.el-col-md-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-md-offset-16{margin-left:66.6666666667%}.el-col-md-pull-16{position:relative;right:66.6666666667%}.el-col-md-push-16{position:relative;left:66.6666666667%}.el-col-md-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-md-offset-17{margin-left:70.8333333333%}.el-col-md-pull-17{position:relative;right:70.8333333333%}.el-col-md-push-17{position:relative;left:70.8333333333%}.el-col-md-18{display:block;max-width:75%;flex:0 0 75%}.el-col-md-offset-18{margin-left:75%}.el-col-md-pull-18{position:relative;right:75%}.el-col-md-push-18{position:relative;left:75%}.el-col-md-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-md-offset-19{margin-left:79.1666666667%}.el-col-md-pull-19{position:relative;right:79.1666666667%}.el-col-md-push-19{position:relative;left:79.1666666667%}.el-col-md-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-md-offset-20{margin-left:83.3333333333%}.el-col-md-pull-20{position:relative;right:83.3333333333%}.el-col-md-push-20{position:relative;left:83.3333333333%}.el-col-md-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-md-offset-21{margin-left:87.5%}.el-col-md-pull-21{position:relative;right:87.5%}.el-col-md-push-21{position:relative;left:87.5%}.el-col-md-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-md-offset-22{margin-left:91.6666666667%}.el-col-md-pull-22{position:relative;right:91.6666666667%}.el-col-md-push-22{position:relative;left:91.6666666667%}.el-col-md-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-md-offset-23{margin-left:95.8333333333%}.el-col-md-pull-23{position:relative;right:95.8333333333%}.el-col-md-push-23{position:relative;left:95.8333333333%}.el-col-md-24{display:block;max-width:100%;flex:0 0 100%}.el-col-md-offset-24{margin-left:100%}.el-col-md-pull-24{position:relative;right:100%}.el-col-md-push-24{position:relative;left:100%}}@media only screen and (min-width:1200px){.el-col-lg-0,.el-col-lg-0.is-guttered{display:none}.el-col-lg-0{max-width:0%;flex:0 0 0%}.el-col-lg-offset-0{margin-left:0}.el-col-lg-pull-0{position:relative;right:0}.el-col-lg-push-0{position:relative;left:0}.el-col-lg-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-lg-offset-1{margin-left:4.1666666667%}.el-col-lg-pull-1{position:relative;right:4.1666666667%}.el-col-lg-push-1{position:relative;left:4.1666666667%}.el-col-lg-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-lg-offset-2{margin-left:8.3333333333%}.el-col-lg-pull-2{position:relative;right:8.3333333333%}.el-col-lg-push-2{position:relative;left:8.3333333333%}.el-col-lg-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-lg-offset-3{margin-left:12.5%}.el-col-lg-pull-3{position:relative;right:12.5%}.el-col-lg-push-3{position:relative;left:12.5%}.el-col-lg-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-lg-offset-4{margin-left:16.6666666667%}.el-col-lg-pull-4{position:relative;right:16.6666666667%}.el-col-lg-push-4{position:relative;left:16.6666666667%}.el-col-lg-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-lg-offset-5{margin-left:20.8333333333%}.el-col-lg-pull-5{position:relative;right:20.8333333333%}.el-col-lg-push-5{position:relative;left:20.8333333333%}.el-col-lg-6{display:block;max-width:25%;flex:0 0 25%}.el-col-lg-offset-6{margin-left:25%}.el-col-lg-pull-6{position:relative;right:25%}.el-col-lg-push-6{position:relative;left:25%}.el-col-lg-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-lg-offset-7{margin-left:29.1666666667%}.el-col-lg-pull-7{position:relative;right:29.1666666667%}.el-col-lg-push-7{position:relative;left:29.1666666667%}.el-col-lg-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-lg-offset-8{margin-left:33.3333333333%}.el-col-lg-pull-8{position:relative;right:33.3333333333%}.el-col-lg-push-8{position:relative;left:33.3333333333%}.el-col-lg-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-lg-offset-9{margin-left:37.5%}.el-col-lg-pull-9{position:relative;right:37.5%}.el-col-lg-push-9{position:relative;left:37.5%}.el-col-lg-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-lg-offset-10{margin-left:41.6666666667%}.el-col-lg-pull-10{position:relative;right:41.6666666667%}.el-col-lg-push-10{position:relative;left:41.6666666667%}.el-col-lg-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-lg-offset-11{margin-left:45.8333333333%}.el-col-lg-pull-11{position:relative;right:45.8333333333%}.el-col-lg-push-11{position:relative;left:45.8333333333%}.el-col-lg-12{display:block;max-width:50%;flex:0 0 50%}.el-col-lg-offset-12{margin-left:50%}.el-col-lg-pull-12{position:relative;right:50%}.el-col-lg-push-12{position:relative;left:50%}.el-col-lg-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-lg-offset-13{margin-left:54.1666666667%}.el-col-lg-pull-13{position:relative;right:54.1666666667%}.el-col-lg-push-13{position:relative;left:54.1666666667%}.el-col-lg-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-lg-offset-14{margin-left:58.3333333333%}.el-col-lg-pull-14{position:relative;right:58.3333333333%}.el-col-lg-push-14{position:relative;left:58.3333333333%}.el-col-lg-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-lg-offset-15{margin-left:62.5%}.el-col-lg-pull-15{position:relative;right:62.5%}.el-col-lg-push-15{position:relative;left:62.5%}.el-col-lg-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-lg-offset-16{margin-left:66.6666666667%}.el-col-lg-pull-16{position:relative;right:66.6666666667%}.el-col-lg-push-16{position:relative;left:66.6666666667%}.el-col-lg-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-lg-offset-17{margin-left:70.8333333333%}.el-col-lg-pull-17{position:relative;right:70.8333333333%}.el-col-lg-push-17{position:relative;left:70.8333333333%}.el-col-lg-18{display:block;max-width:75%;flex:0 0 75%}.el-col-lg-offset-18{margin-left:75%}.el-col-lg-pull-18{position:relative;right:75%}.el-col-lg-push-18{position:relative;left:75%}.el-col-lg-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-lg-offset-19{margin-left:79.1666666667%}.el-col-lg-pull-19{position:relative;right:79.1666666667%}.el-col-lg-push-19{position:relative;left:79.1666666667%}.el-col-lg-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-lg-offset-20{margin-left:83.3333333333%}.el-col-lg-pull-20{position:relative;right:83.3333333333%}.el-col-lg-push-20{position:relative;left:83.3333333333%}.el-col-lg-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-lg-offset-21{margin-left:87.5%}.el-col-lg-pull-21{position:relative;right:87.5%}.el-col-lg-push-21{position:relative;left:87.5%}.el-col-lg-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-lg-offset-22{margin-left:91.6666666667%}.el-col-lg-pull-22{position:relative;right:91.6666666667%}.el-col-lg-push-22{position:relative;left:91.6666666667%}.el-col-lg-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-lg-offset-23{margin-left:95.8333333333%}.el-col-lg-pull-23{position:relative;right:95.8333333333%}.el-col-lg-push-23{position:relative;left:95.8333333333%}.el-col-lg-24{display:block;max-width:100%;flex:0 0 100%}.el-col-lg-offset-24{margin-left:100%}.el-col-lg-pull-24{position:relative;right:100%}.el-col-lg-push-24{position:relative;left:100%}}@media only screen and (min-width:1920px){.el-col-xl-0,.el-col-xl-0.is-guttered{display:none}.el-col-xl-0{max-width:0%;flex:0 0 0%}.el-col-xl-offset-0{margin-left:0}.el-col-xl-pull-0{position:relative;right:0}.el-col-xl-push-0{position:relative;left:0}.el-col-xl-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-xl-offset-1{margin-left:4.1666666667%}.el-col-xl-pull-1{position:relative;right:4.1666666667%}.el-col-xl-push-1{position:relative;left:4.1666666667%}.el-col-xl-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-xl-offset-2{margin-left:8.3333333333%}.el-col-xl-pull-2{position:relative;right:8.3333333333%}.el-col-xl-push-2{position:relative;left:8.3333333333%}.el-col-xl-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-xl-offset-3{margin-left:12.5%}.el-col-xl-pull-3{position:relative;right:12.5%}.el-col-xl-push-3{position:relative;left:12.5%}.el-col-xl-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-xl-offset-4{margin-left:16.6666666667%}.el-col-xl-pull-4{position:relative;right:16.6666666667%}.el-col-xl-push-4{position:relative;left:16.6666666667%}.el-col-xl-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-xl-offset-5{margin-left:20.8333333333%}.el-col-xl-pull-5{position:relative;right:20.8333333333%}.el-col-xl-push-5{position:relative;left:20.8333333333%}.el-col-xl-6{display:block;max-width:25%;flex:0 0 25%}.el-col-xl-offset-6{margin-left:25%}.el-col-xl-pull-6{position:relative;right:25%}.el-col-xl-push-6{position:relative;left:25%}.el-col-xl-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-xl-offset-7{margin-left:29.1666666667%}.el-col-xl-pull-7{position:relative;right:29.1666666667%}.el-col-xl-push-7{position:relative;left:29.1666666667%}.el-col-xl-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-xl-offset-8{margin-left:33.3333333333%}.el-col-xl-pull-8{position:relative;right:33.3333333333%}.el-col-xl-push-8{position:relative;left:33.3333333333%}.el-col-xl-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-xl-offset-9{margin-left:37.5%}.el-col-xl-pull-9{position:relative;right:37.5%}.el-col-xl-push-9{position:relative;left:37.5%}.el-col-xl-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-xl-offset-10{margin-left:41.6666666667%}.el-col-xl-pull-10{position:relative;right:41.6666666667%}.el-col-xl-push-10{position:relative;left:41.6666666667%}.el-col-xl-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-xl-offset-11{margin-left:45.8333333333%}.el-col-xl-pull-11{position:relative;right:45.8333333333%}.el-col-xl-push-11{position:relative;left:45.8333333333%}.el-col-xl-12{display:block;max-width:50%;flex:0 0 50%}.el-col-xl-offset-12{margin-left:50%}.el-col-xl-pull-12{position:relative;right:50%}.el-col-xl-push-12{position:relative;left:50%}.el-col-xl-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-xl-offset-13{margin-left:54.1666666667%}.el-col-xl-pull-13{position:relative;right:54.1666666667%}.el-col-xl-push-13{position:relative;left:54.1666666667%}.el-col-xl-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-xl-offset-14{margin-left:58.3333333333%}.el-col-xl-pull-14{position:relative;right:58.3333333333%}.el-col-xl-push-14{position:relative;left:58.3333333333%}.el-col-xl-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-xl-offset-15{margin-left:62.5%}.el-col-xl-pull-15{position:relative;right:62.5%}.el-col-xl-push-15{position:relative;left:62.5%}.el-col-xl-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-xl-offset-16{margin-left:66.6666666667%}.el-col-xl-pull-16{position:relative;right:66.6666666667%}.el-col-xl-push-16{position:relative;left:66.6666666667%}.el-col-xl-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-xl-offset-17{margin-left:70.8333333333%}.el-col-xl-pull-17{position:relative;right:70.8333333333%}.el-col-xl-push-17{position:relative;left:70.8333333333%}.el-col-xl-18{display:block;max-width:75%;flex:0 0 75%}.el-col-xl-offset-18{margin-left:75%}.el-col-xl-pull-18{position:relative;right:75%}.el-col-xl-push-18{position:relative;left:75%}.el-col-xl-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-xl-offset-19{margin-left:79.1666666667%}.el-col-xl-pull-19{position:relative;right:79.1666666667%}.el-col-xl-push-19{position:relative;left:79.1666666667%}.el-col-xl-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-xl-offset-20{margin-left:83.3333333333%}.el-col-xl-pull-20{position:relative;right:83.3333333333%}.el-col-xl-push-20{position:relative;left:83.3333333333%}.el-col-xl-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-xl-offset-21{margin-left:87.5%}.el-col-xl-pull-21{position:relative;right:87.5%}.el-col-xl-push-21{position:relative;left:87.5%}.el-col-xl-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-xl-offset-22{margin-left:91.6666666667%}.el-col-xl-pull-22{position:relative;right:91.6666666667%}.el-col-xl-push-22{position:relative;left:91.6666666667%}.el-col-xl-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-xl-offset-23{margin-left:95.8333333333%}.el-col-xl-pull-23{position:relative;right:95.8333333333%}.el-col-xl-push-23{position:relative;left:95.8333333333%}.el-col-xl-24{display:block;max-width:100%;flex:0 0 100%}.el-col-xl-offset-24{margin-left:100%}.el-col-xl-pull-24{position:relative;right:100%}.el-col-xl-push-24{position:relative;left:100%}}.el-collapse{--el-collapse-border-color:var(--el-border-color-lighter);--el-collapse-header-height:48px;--el-collapse-header-bg-color:var(--el-fill-color-blank);--el-collapse-header-text-color:var(--el-text-color-primary);--el-collapse-header-font-size:13px;--el-collapse-content-bg-color:var(--el-fill-color-blank);--el-collapse-content-font-size:13px;--el-collapse-content-text-color:var(--el-text-color-primary);border-top:1px solid var(--el-collapse-border-color);border-bottom:1px solid var(--el-collapse-border-color)}.el-collapse-item.is-disabled .el-collapse-item__header{color:var(--el-text-color-disabled);cursor:not-allowed}.el-collapse-item__header{display:flex;align-items:center;height:var(--el-collapse-header-height);line-height:var(--el-collapse-header-height);background-color:var(--el-collapse-header-bg-color);color:var(--el-collapse-header-text-color);cursor:pointer;border-bottom:1px solid var(--el-collapse-border-color);font-size:var(--el-collapse-header-font-size);font-weight:500;transition:border-bottom-color var(--el-transition-duration);outline:0}.el-collapse-item__arrow{margin:0 8px 0 auto;transition:transform var(--el-transition-duration);font-weight:300}.el-collapse-item__arrow.is-active{transform:rotate(90deg)}.el-collapse-item__header.focusing:focus:not(:hover){color:var(--el-color-primary)}.el-collapse-item__header.is-active{border-bottom-color:transparent}.el-collapse-item__wrap{will-change:height;background-color:var(--el-collapse-content-bg-color);overflow:hidden;box-sizing:border-box;border-bottom:1px solid var(--el-collapse-border-color)}.el-collapse-item__content{padding-bottom:25px;font-size:var(--el-collapse-content-font-size);color:var(--el-collapse-content-text-color);line-height:1.7692307692}.el-collapse-item:last-child{margin-bottom:-1px}.el-color-predefine{display:flex;font-size:12px;margin-top:8px;width:280px}.el-color-predefine__colors{display:flex;flex:1;flex-wrap:wrap}.el-color-predefine__color-selector{margin:0 0 8px 8px;width:20px;height:20px;border-radius:4px;cursor:pointer}.el-color-predefine__color-selector:nth-child(10n+1){margin-left:0}.el-color-predefine__color-selector.selected{box-shadow:0 0 3px 2px var(--el-color-primary)}.el-color-predefine__color-selector>div{display:flex;height:100%;border-radius:3px}.el-color-predefine__color-selector.is-alpha{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.el-color-hue-slider{position:relative;box-sizing:border-box;width:280px;height:12px;background-color:red;padding:0 2px;float:right}.el-color-hue-slider__bar{position:relative;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%);height:100%}.el-color-hue-slider__thumb{position:absolute;cursor:pointer;box-sizing:border-box;left:0;top:0;width:4px;height:100%;border-radius:1px;background:#fff;border:1px solid var(--el-border-color-lighter);box-shadow:0 0 2px #0009;z-index:1}.el-color-hue-slider.is-vertical{width:12px;height:180px;padding:2px 0}.el-color-hue-slider.is-vertical .el-color-hue-slider__bar{background:linear-gradient(to bottom,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}.el-color-hue-slider.is-vertical .el-color-hue-slider__thumb{left:0;top:0;width:100%;height:4px}.el-color-svpanel{position:relative;width:280px;height:180px}.el-color-svpanel__black,.el-color-svpanel__white{position:absolute;top:0;left:0;right:0;bottom:0}.el-color-svpanel__white{background:linear-gradient(to right,#fff,rgba(255,255,255,0))}.el-color-svpanel__black{background:linear-gradient(to top,#000,rgba(0,0,0,0))}.el-color-svpanel__cursor{position:absolute}.el-color-svpanel__cursor>div{cursor:head;width:4px;height:4px;box-shadow:0 0 0 1.5px #fff,inset 0 0 1px 1px #0000004d,0 0 1px 2px #0006;border-radius:50%;transform:translate(-2px,-2px)}.el-color-alpha-slider{position:relative;box-sizing:border-box;width:280px;height:12px;background-image:linear-gradient(45deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(45deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%);background-size:12px 12px;background-position:0 0,6px 0,6px -6px,0 6px}.el-color-alpha-slider__bar{position:relative;background:linear-gradient(to right,rgba(255,255,255,0) 0,var(--el-bg-color) 100%);height:100%}.el-color-alpha-slider__thumb{position:absolute;cursor:pointer;box-sizing:border-box;left:0;top:0;width:4px;height:100%;border-radius:1px;background:#fff;border:1px solid var(--el-border-color-lighter);box-shadow:0 0 2px #0009;z-index:1}.el-color-alpha-slider.is-vertical{width:20px;height:180px}.el-color-alpha-slider.is-vertical .el-color-alpha-slider__bar{background:linear-gradient(to bottom,rgba(255,255,255,0) 0,#fff 100%)}.el-color-alpha-slider.is-vertical .el-color-alpha-slider__thumb{left:0;top:0;width:100%;height:4px}.el-color-dropdown{width:300px}.el-color-dropdown__main-wrapper{margin-bottom:6px}.el-color-dropdown__main-wrapper:after{content:"";display:table;clear:both}.el-color-dropdown__btns{margin-top:12px;text-align:right}.el-color-dropdown__value{float:left;line-height:26px;font-size:12px;color:#000;width:160px}.el-color-picker{display:inline-block;position:relative;line-height:normal;outline:0}.el-color-picker:hover:not(.is-disabled) .el-color-picker__trigger{border:1px solid var(--el-border-color-hover)}.el-color-picker:focus-visible:not(.is-disabled) .el-color-picker__trigger{outline:2px solid var(--el-color-primary);outline-offset:1px}.el-color-picker.is-disabled .el-color-picker__trigger{cursor:not-allowed}.el-color-picker--large{height:40px}.el-color-picker--large .el-color-picker__trigger{height:40px;width:40px}.el-color-picker--large .el-color-picker__mask{height:38px;width:38px}.el-color-picker--small{height:24px}.el-color-picker--small .el-color-picker__trigger{height:24px;width:24px}.el-color-picker--small .el-color-picker__mask{height:22px;width:22px}.el-color-picker--small .el-color-picker__empty,.el-color-picker--small .el-color-picker__icon{transform:scale(.8)}.el-color-picker__mask{height:30px;width:30px;border-radius:4px;position:absolute;top:1px;left:1px;z-index:1;cursor:not-allowed;background-color:#ffffffb3}.el-color-picker__trigger{display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;height:32px;width:32px;padding:4px;border:1px solid var(--el-border-color);border-radius:4px;font-size:0;position:relative;cursor:pointer}.el-color-picker__color{position:relative;display:block;box-sizing:border-box;border:1px solid var(--el-text-color-secondary);border-radius:var(--el-border-radius-small);width:100%;height:100%;text-align:center}.el-color-picker__color.is-alpha{background-image:linear-gradient(45deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(45deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%);background-size:12px 12px;background-position:0 0,6px 0,6px -6px,0 6px}.el-color-picker__color-inner{display:inline-flex;justify-content:center;align-items:center;width:100%;height:100%}.el-color-picker .el-color-picker__empty{font-size:12px;color:var(--el-text-color-secondary)}.el-color-picker .el-color-picker__icon{display:inline-flex;justify-content:center;align-items:center;color:#fff;font-size:12px}.el-color-picker__panel{position:absolute;z-index:10;padding:6px;box-sizing:content-box;background-color:#fff;border-radius:var(--el-border-radius-base);box-shadow:var(--el-box-shadow-light)}.el-color-picker__panel.el-popper{border:1px solid var(--el-border-color-lighter)}.el-color-picker,.el-color-picker__panel{--el-color-picker-alpha-bg-a:#ccc;--el-color-picker-alpha-bg-b:transparent}.dark .el-color-picker,.dark .el-color-picker__panel{--el-color-picker-alpha-bg-a:#333333}.el-container{display:flex;flex-direction:row;flex:1;flex-basis:auto;box-sizing:border-box;min-width:0}.el-container.is-vertical{flex-direction:column}.el-date-table{font-size:12px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-date-table.is-week-mode .el-date-table__row:hover .el-date-table-cell{background-color:var(--el-datepicker-inrange-bg-color)}.el-date-table.is-week-mode .el-date-table__row:hover td.available:hover{color:var(--el-datepicker-text-color)}.el-date-table.is-week-mode .el-date-table__row:hover td:first-child .el-date-table-cell{margin-left:5px;border-top-left-radius:15px;border-bottom-left-radius:15px}.el-date-table.is-week-mode .el-date-table__row:hover td:last-child .el-date-table-cell{margin-right:5px;border-top-right-radius:15px;border-bottom-right-radius:15px}.el-date-table.is-week-mode .el-date-table__row.current .el-date-table-cell{background-color:var(--el-datepicker-inrange-bg-color)}.el-date-table td{width:32px;height:30px;padding:4px 0;box-sizing:border-box;text-align:center;cursor:pointer;position:relative}.el-date-table td .el-date-table-cell{height:30px;padding:3px 0;box-sizing:border-box}.el-date-table td .el-date-table-cell .el-date-table-cell__text{width:24px;height:24px;display:block;margin:0 auto;line-height:24px;position:absolute;left:50%;transform:translate(-50%);border-radius:50%}.el-date-table td.next-month,.el-date-table td.prev-month{color:var(--el-datepicker-off-text-color)}.el-date-table td.today{position:relative}.el-date-table td.today .el-date-table-cell__text{color:var(--el-color-primary);font-weight:700}.el-date-table td.today.end-date .el-date-table-cell__text,.el-date-table td.today.start-date .el-date-table-cell__text{color:#fff}.el-date-table td.available:hover{color:var(--el-datepicker-hover-text-color)}.el-date-table td.in-range .el-date-table-cell{background-color:var(--el-datepicker-inrange-bg-color)}.el-date-table td.in-range .el-date-table-cell:hover{background-color:var(--el-datepicker-inrange-hover-bg-color)}.el-date-table td.current:not(.disabled) .el-date-table-cell__text{color:#fff;background-color:var(--el-datepicker-active-color)}.el-date-table td.current:not(.disabled):focus-visible .el-date-table-cell__text{outline:2px solid var(--el-datepicker-active-color);outline-offset:1px}.el-date-table td.end-date .el-date-table-cell,.el-date-table td.start-date .el-date-table-cell{color:#fff}.el-date-table td.end-date .el-date-table-cell__text,.el-date-table td.start-date .el-date-table-cell__text{background-color:var(--el-datepicker-active-color)}.el-date-table td.start-date .el-date-table-cell{margin-left:5px;border-top-left-radius:15px;border-bottom-left-radius:15px}.el-date-table td.end-date .el-date-table-cell{margin-right:5px;border-top-right-radius:15px;border-bottom-right-radius:15px}.el-date-table td.disabled .el-date-table-cell{background-color:var(--el-fill-color-light);opacity:1;cursor:not-allowed;color:var(--el-text-color-placeholder)}.el-date-table td.selected .el-date-table-cell{margin-left:5px;margin-right:5px;background-color:var(--el-datepicker-inrange-bg-color);border-radius:15px}.el-date-table td.selected .el-date-table-cell:hover{background-color:var(--el-datepicker-inrange-hover-bg-color)}.el-date-table td.selected .el-date-table-cell__text{background-color:var(--el-datepicker-active-color);color:#fff;border-radius:15px}.el-date-table td.week{font-size:80%;color:var(--el-datepicker-header-text-color)}.el-date-table td:focus{outline:0}.el-date-table th{padding:5px;color:var(--el-datepicker-header-text-color);font-weight:400;border-bottom:solid 1px var(--el-border-color-lighter)}.el-month-table{font-size:12px;margin:-1px;border-collapse:collapse}.el-month-table td{text-align:center;padding:8px 0;cursor:pointer}.el-month-table td div{height:48px;padding:6px 0;box-sizing:border-box}.el-month-table td.today .cell{color:var(--el-color-primary);font-weight:700}.el-month-table td.today.end-date .cell,.el-month-table td.today.start-date .cell{color:#fff}.el-month-table td.disabled .cell{background-color:var(--el-fill-color-light);cursor:not-allowed;color:var(--el-text-color-placeholder)}.el-month-table td.disabled .cell:hover{color:var(--el-text-color-placeholder)}.el-month-table td .cell{width:60px;height:36px;display:block;line-height:36px;color:var(--el-datepicker-text-color);margin:0 auto;border-radius:18px}.el-month-table td .cell:hover{color:var(--el-datepicker-hover-text-color)}.el-month-table td.in-range div{background-color:var(--el-datepicker-inrange-bg-color)}.el-month-table td.in-range div:hover{background-color:var(--el-datepicker-inrange-hover-bg-color)}.el-month-table td.end-date div,.el-month-table td.start-date div{color:#fff}.el-month-table td.end-date .cell,.el-month-table td.start-date .cell{color:#fff;background-color:var(--el-datepicker-active-color)}.el-month-table td.start-date div{border-top-left-radius:24px;border-bottom-left-radius:24px}.el-month-table td.end-date div{border-top-right-radius:24px;border-bottom-right-radius:24px}.el-month-table td.current:not(.disabled) .cell{color:var(--el-datepicker-active-color)}.el-month-table td:focus-visible{outline:0}.el-month-table td:focus-visible .cell{outline:2px solid var(--el-datepicker-active-color)}.el-year-table{font-size:12px;margin:-1px;border-collapse:collapse}.el-year-table .el-icon{color:var(--el-datepicker-icon-color)}.el-year-table td{text-align:center;padding:20px 3px;cursor:pointer}.el-year-table td.today .cell{color:var(--el-color-primary);font-weight:700}.el-year-table td.disabled .cell{background-color:var(--el-fill-color-light);cursor:not-allowed;color:var(--el-text-color-placeholder)}.el-year-table td.disabled .cell:hover{color:var(--el-text-color-placeholder)}.el-year-table td .cell{width:48px;height:36px;display:block;line-height:36px;color:var(--el-datepicker-text-color);border-radius:18px;margin:0 auto}.el-year-table td .cell:hover{color:var(--el-datepicker-hover-text-color)}.el-year-table td.current:not(.disabled) .cell{color:var(--el-datepicker-active-color)}.el-year-table td:focus-visible{outline:0}.el-year-table td:focus-visible .cell{outline:2px solid var(--el-datepicker-active-color)}.el-time-spinner.has-seconds .el-time-spinner__wrapper{width:33.3%}.el-time-spinner__wrapper{max-height:192px;overflow:auto;display:inline-block;width:50%;vertical-align:top;position:relative}.el-time-spinner__wrapper.el-scrollbar__wrap:not(.el-scrollbar__wrap--hidden-default){padding-bottom:15px}.el-time-spinner__wrapper.is-arrow{box-sizing:border-box;text-align:center;overflow:hidden}.el-time-spinner__wrapper.is-arrow .el-time-spinner__list{transform:translateY(-32px)}.el-time-spinner__wrapper.is-arrow .el-time-spinner__item:hover:not(.is-disabled):not(.is-active){background:var(--el-fill-color-light);cursor:default}.el-time-spinner__arrow{font-size:12px;color:var(--el-text-color-secondary);position:absolute;left:0;width:100%;z-index:var(--el-index-normal);text-align:center;height:30px;line-height:30px;cursor:pointer}.el-time-spinner__arrow:hover{color:var(--el-color-primary)}.el-time-spinner__arrow.arrow-up{top:10px}.el-time-spinner__arrow.arrow-down{bottom:10px}.el-time-spinner__input.el-input{width:70%}.el-time-spinner__input.el-input .el-input__inner{padding:0;text-align:center}.el-time-spinner__list{padding:0;margin:0;list-style:none;text-align:center}.el-time-spinner__list:after,.el-time-spinner__list:before{content:"";display:block;width:100%;height:80px}.el-time-spinner__item{height:32px;line-height:32px;font-size:12px;color:var(--el-text-color-regular)}.el-time-spinner__item:hover:not(.is-disabled):not(.is-active){background:var(--el-fill-color-light);cursor:pointer}.el-time-spinner__item.is-active:not(.is-disabled){color:var(--el-text-color-primary);font-weight:700}.el-time-spinner__item.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-picker__popper{--el-datepicker-border-color:var(--el-disabled-border-color)}.el-picker__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-datepicker-border-color);box-shadow:var(--el-box-shadow-light)}.el-picker__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-datepicker-border-color)}.el-picker__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-picker__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-picker__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-picker__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-date-editor{--el-date-editor-width:220px;--el-date-editor-monthrange-width:300px;--el-date-editor-daterange-width:350px;--el-date-editor-datetimerange-width:400px;--el-input-text-color:var(--el-text-color-regular);--el-input-border:var(--el-border);--el-input-hover-border:var(--el-border-color-hover);--el-input-focus-border:var(--el-color-primary);--el-input-transparent-border:0 0 0 1px transparent inset;--el-input-border-color:var(--el-border-color);--el-input-border-radius:var(--el-border-radius-base);--el-input-bg-color:var(--el-fill-color-blank);--el-input-icon-color:var(--el-text-color-placeholder);--el-input-placeholder-color:var(--el-text-color-placeholder);--el-input-hover-border-color:var(--el-border-color-hover);--el-input-clear-hover-color:var(--el-text-color-secondary);--el-input-focus-border-color:var(--el-color-primary);position:relative;display:inline-block;text-align:left}.el-date-editor.el-input__wrapper{box-shadow:0 0 0 1px var(--el-input-border-color,var(--el-border-color)) inset}.el-date-editor.el-input__wrapper:hover{box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-date-editor.el-input,.el-date-editor.el-input__wrapper{width:var(--el-date-editor-width);height:var(--el-input-height,var(--el-component-size))}.el-date-editor--monthrange{--el-date-editor-width:var(--el-date-editor-monthrange-width)}.el-date-editor--daterange,.el-date-editor--timerange{--el-date-editor-width:var(--el-date-editor-daterange-width)}.el-date-editor--datetimerange{--el-date-editor-width:var(--el-date-editor-datetimerange-width)}.el-date-editor--dates .el-input__wrapper{text-overflow:ellipsis;white-space:nowrap}.el-date-editor .close-icon,.el-date-editor .clear-icon{cursor:pointer}.el-date-editor .clear-icon:hover{color:var(--el-text-color-secondary)}.el-date-editor .el-range__icon{height:inherit;font-size:14px;color:var(--el-text-color-placeholder);float:left}.el-date-editor .el-range__icon svg{vertical-align:middle}.el-date-editor .el-range-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;outline:0;display:inline-block;height:30px;line-height:30px;margin:0;padding:0;width:39%;text-align:center;font-size:var(--el-font-size-base);color:var(--el-text-color-regular);background-color:transparent}.el-date-editor .el-range-input::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-date-editor .el-range-input:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-date-editor .el-range-input::placeholder{color:var(--el-text-color-placeholder)}.el-date-editor .el-range-separator{flex:1;display:inline-flex;justify-content:center;align-items:center;height:100%;padding:0 5px;margin:0;font-size:14px;word-break:keep-all;color:var(--el-text-color-primary)}.el-date-editor .el-range__close-icon{font-size:14px;color:var(--el-text-color-placeholder);height:inherit;width:unset;cursor:pointer}.el-date-editor .el-range__close-icon:hover{color:var(--el-text-color-secondary)}.el-date-editor .el-range__close-icon svg{vertical-align:middle}.el-date-editor .el-range__close-icon--hidden{opacity:0;visibility:hidden}.el-range-editor.el-input__wrapper{display:inline-flex;align-items:center;padding:0 10px}.el-range-editor.is-active,.el-range-editor.is-active:hover{box-shadow:0 0 0 1px var(--el-input-focus-border-color) inset}.el-range-editor--large{line-height:var(--el-component-size-large)}.el-range-editor--large.el-input__wrapper{height:var(--el-component-size-large)}.el-range-editor--large .el-range-separator{line-height:40px;font-size:14px}.el-range-editor--large .el-range-input{height:38px;line-height:38px;font-size:14px}.el-range-editor--small{line-height:var(--el-component-size-small)}.el-range-editor--small.el-input__wrapper{height:var(--el-component-size-small)}.el-range-editor--small .el-range-separator{line-height:24px;font-size:12px}.el-range-editor--small .el-range-input{height:22px;line-height:22px;font-size:12px}.el-range-editor.is-disabled{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color);color:var(--el-disabled-text-color);cursor:not-allowed}.el-range-editor.is-disabled:focus,.el-range-editor.is-disabled:hover{border-color:var(--el-disabled-border-color)}.el-range-editor.is-disabled input{background-color:var(--el-disabled-bg-color);color:var(--el-disabled-text-color);cursor:not-allowed}.el-range-editor.is-disabled input::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-range-editor.is-disabled input:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-range-editor.is-disabled input::placeholder{color:var(--el-text-color-placeholder)}.el-range-editor.is-disabled .el-range-separator{color:var(--el-disabled-text-color)}.el-picker-panel{color:var(--el-text-color-regular);background:var(--el-bg-color-overlay);border-radius:var(--el-border-radius-base);line-height:30px}.el-picker-panel .el-time-panel{margin:5px 0;border:solid 1px var(--el-datepicker-border-color);background-color:var(--el-bg-color-overlay);box-shadow:var(--el-box-shadow-light)}.el-picker-panel__body-wrapper:after,.el-picker-panel__body:after{content:"";display:table;clear:both}.el-picker-panel__content{position:relative;margin:15px}.el-picker-panel__footer{border-top:1px solid var(--el-datepicker-inner-border-color);padding:4px 12px;text-align:right;background-color:var(--el-bg-color-overlay);position:relative;font-size:0}.el-picker-panel__shortcut{display:block;width:100%;border:0;background-color:transparent;line-height:28px;font-size:14px;color:var(--el-datepicker-text-color);padding-left:12px;text-align:left;outline:0;cursor:pointer}.el-picker-panel__shortcut:hover{color:var(--el-datepicker-hover-text-color)}.el-picker-panel__shortcut.active{background-color:#e6f1fe;color:var(--el-datepicker-active-color)}.el-picker-panel__btn{border:1px solid var(--el-fill-color-darker);color:var(--el-text-color-primary);line-height:24px;border-radius:2px;padding:0 20px;cursor:pointer;background-color:transparent;outline:0;font-size:12px}.el-picker-panel__btn[disabled]{color:var(--el-text-color-disabled);cursor:not-allowed}.el-picker-panel__icon-btn{font-size:12px;color:var(--el-datepicker-icon-color);border:0;background:0 0;cursor:pointer;outline:0;margin-top:8px}.el-picker-panel__icon-btn:hover{color:var(--el-datepicker-hover-text-color)}.el-picker-panel__icon-btn:focus-visible{color:var(--el-datepicker-hover-text-color)}.el-picker-panel__icon-btn.is-disabled{color:var(--el-text-color-disabled)}.el-picker-panel__icon-btn.is-disabled:hover{cursor:not-allowed}.el-picker-panel__icon-btn .el-icon{cursor:pointer;font-size:inherit}.el-picker-panel__link-btn{vertical-align:middle}.el-picker-panel [slot=sidebar],.el-picker-panel__sidebar{position:absolute;top:0;bottom:0;width:110px;border-right:1px solid var(--el-datepicker-inner-border-color);box-sizing:border-box;padding-top:6px;background-color:var(--el-bg-color-overlay);overflow:auto}.el-picker-panel [slot=sidebar]+.el-picker-panel__body,.el-picker-panel__sidebar+.el-picker-panel__body{margin-left:110px}.el-date-picker{--el-datepicker-text-color:var(--el-text-color-regular);--el-datepicker-off-text-color:var(--el-text-color-placeholder);--el-datepicker-header-text-color:var(--el-text-color-regular);--el-datepicker-icon-color:var(--el-text-color-primary);--el-datepicker-border-color:var(--el-disabled-border-color);--el-datepicker-inner-border-color:var(--el-border-color-light);--el-datepicker-inrange-bg-color:var(--el-border-color-extra-light);--el-datepicker-inrange-hover-bg-color:var(--el-border-color-extra-light);--el-datepicker-active-color:var(--el-color-primary);--el-datepicker-hover-text-color:var(--el-color-primary)}.el-date-picker{width:322px}.el-date-picker.has-sidebar.has-time{width:434px}.el-date-picker.has-sidebar{width:438px}.el-date-picker.has-time .el-picker-panel__body-wrapper{position:relative}.el-date-picker .el-picker-panel__content{width:292px}.el-date-picker table{table-layout:fixed;width:100%}.el-date-picker__editor-wrap{position:relative;display:table-cell;padding:0 5px}.el-date-picker__time-header{position:relative;border-bottom:1px solid var(--el-datepicker-inner-border-color);font-size:12px;padding:8px 5px 5px;display:table;width:100%;box-sizing:border-box}.el-date-picker__header{margin:12px;text-align:center}.el-date-picker__header--bordered{margin-bottom:0;padding-bottom:12px;border-bottom:solid 1px var(--el-border-color-lighter)}.el-date-picker__header--bordered+.el-picker-panel__content{margin-top:0}.el-date-picker__header-label{font-size:16px;font-weight:500;padding:0 5px;line-height:22px;text-align:center;cursor:pointer;color:var(--el-text-color-regular)}.el-date-picker__header-label:hover{color:var(--el-datepicker-hover-text-color)}.el-date-picker__header-label:focus-visible{outline:0;color:var(--el-datepicker-hover-text-color)}.el-date-picker__header-label.active{color:var(--el-datepicker-active-color)}.el-date-picker__prev-btn{float:left}.el-date-picker__next-btn{float:right}.el-date-picker__time-wrap{padding:10px;text-align:center}.el-date-picker__time-label{float:left;cursor:pointer;line-height:30px;margin-left:10px}.el-date-picker .el-time-panel{position:absolute}.el-date-range-picker{--el-datepicker-text-color:var(--el-text-color-regular);--el-datepicker-off-text-color:var(--el-text-color-placeholder);--el-datepicker-header-text-color:var(--el-text-color-regular);--el-datepicker-icon-color:var(--el-text-color-primary);--el-datepicker-border-color:var(--el-disabled-border-color);--el-datepicker-inner-border-color:var(--el-border-color-light);--el-datepicker-inrange-bg-color:var(--el-border-color-extra-light);--el-datepicker-inrange-hover-bg-color:var(--el-border-color-extra-light);--el-datepicker-active-color:var(--el-color-primary);--el-datepicker-hover-text-color:var(--el-color-primary)}.el-date-range-picker{width:646px}.el-date-range-picker.has-sidebar{width:756px}.el-date-range-picker.has-time .el-picker-panel__body-wrapper{position:relative}.el-date-range-picker table{table-layout:fixed;width:100%}.el-date-range-picker .el-picker-panel__body{min-width:513px}.el-date-range-picker .el-picker-panel__content{margin:0}.el-date-range-picker__header{position:relative;text-align:center;height:28px}.el-date-range-picker__header [class*=arrow-left]{float:left}.el-date-range-picker__header [class*=arrow-right]{float:right}.el-date-range-picker__header div{font-size:16px;font-weight:500;margin-right:50px}.el-date-range-picker__content{float:left;width:50%;box-sizing:border-box;margin:0;padding:16px}.el-date-range-picker__content.is-left{border-right:1px solid var(--el-datepicker-inner-border-color)}.el-date-range-picker__content .el-date-range-picker__header div{margin-left:50px;margin-right:50px}.el-date-range-picker__editors-wrap{box-sizing:border-box;display:table-cell}.el-date-range-picker__editors-wrap.is-right{text-align:right}.el-date-range-picker__time-header{position:relative;border-bottom:1px solid var(--el-datepicker-inner-border-color);font-size:12px;padding:8px 5px 5px;display:table;width:100%;box-sizing:border-box}.el-date-range-picker__time-header>.el-icon-arrow-right{font-size:20px;vertical-align:middle;display:table-cell;color:var(--el-datepicker-icon-color)}.el-date-range-picker__time-picker-wrap{position:relative;display:table-cell;padding:0 5px}.el-date-range-picker__time-picker-wrap .el-picker-panel{position:absolute;top:13px;right:0;z-index:1;background:#fff}.el-date-range-picker__time-picker-wrap .el-time-panel{position:absolute}.el-time-range-picker{width:354px;overflow:visible}.el-time-range-picker__content{position:relative;text-align:center;padding:10px;z-index:1}.el-time-range-picker__cell{box-sizing:border-box;margin:0;padding:4px 7px 7px;width:50%;display:inline-block}.el-time-range-picker__header{margin-bottom:5px;text-align:center;font-size:14px}.el-time-range-picker__body{border-radius:2px;border:1px solid var(--el-datepicker-border-color)}.el-time-panel{border-radius:2px;position:relative;width:180px;left:0;z-index:var(--el-index-top);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:content-box}.el-time-panel__content{font-size:0;position:relative;overflow:hidden}.el-time-panel__content:after,.el-time-panel__content:before{content:"";top:50%;position:absolute;margin-top:-16px;height:32px;z-index:-1;left:0;right:0;box-sizing:border-box;padding-top:6px;text-align:left}.el-time-panel__content:after{left:50%;margin-left:12%;margin-right:12%}.el-time-panel__content:before{padding-left:50%;margin-right:12%;margin-left:12%;border-top:1px solid var(--el-border-color-light);border-bottom:1px solid var(--el-border-color-light)}.el-time-panel__content.has-seconds:after{left:66.6666666667%}.el-time-panel__content.has-seconds:before{padding-left:33.3333333333%}.el-time-panel__footer{border-top:1px solid var(--el-timepicker-inner-border-color,var(--el-border-color-light));padding:4px;height:36px;line-height:25px;text-align:right;box-sizing:border-box}.el-time-panel__btn{border:none;line-height:28px;padding:0 5px;margin:0 5px;cursor:pointer;background-color:transparent;outline:0;font-size:12px;color:var(--el-text-color-primary)}.el-time-panel__btn.confirm{font-weight:800;color:var(--el-timepicker-active-color,var(--el-color-primary))}.el-descriptions{--el-descriptions-table-border:1px solid var(--el-border-color-lighter);--el-descriptions-item-bordered-label-background:var(--el-fill-color-light);box-sizing:border-box;font-size:var(--el-font-size-base);color:var(--el-text-color-primary)}.el-descriptions__header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.el-descriptions__title{color:var(--el-text-color-primary);font-size:16px;font-weight:700}.el-descriptions__body{background-color:var(--el-fill-color-blank)}.el-descriptions__body .el-descriptions__table{border-collapse:collapse;width:100%}.el-descriptions__body .el-descriptions__table .el-descriptions__cell{box-sizing:border-box;text-align:left;font-weight:400;line-height:23px;font-size:14px}.el-descriptions__body .el-descriptions__table .el-descriptions__cell.is-left{text-align:left}.el-descriptions__body .el-descriptions__table .el-descriptions__cell.is-center{text-align:center}.el-descriptions__body .el-descriptions__table .el-descriptions__cell.is-right{text-align:right}.el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell{border:var(--el-descriptions-table-border);padding:8px 11px}.el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell{padding-bottom:12px}.el-descriptions--large{font-size:14px}.el-descriptions--large .el-descriptions__header{margin-bottom:20px}.el-descriptions--large .el-descriptions__header .el-descriptions__title{font-size:16px}.el-descriptions--large .el-descriptions__body .el-descriptions__table .el-descriptions__cell{font-size:14px}.el-descriptions--large .el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell{padding:12px 15px}.el-descriptions--large .el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell{padding-bottom:16px}.el-descriptions--small{font-size:12px}.el-descriptions--small .el-descriptions__header{margin-bottom:12px}.el-descriptions--small .el-descriptions__header .el-descriptions__title{font-size:14px}.el-descriptions--small .el-descriptions__body .el-descriptions__table .el-descriptions__cell{font-size:12px}.el-descriptions--small .el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell{padding:4px 7px}.el-descriptions--small .el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell{padding-bottom:8px}.el-descriptions__label.el-descriptions__cell.is-bordered-label{font-weight:700;color:var(--el-text-color-regular);background:var(--el-descriptions-item-bordered-label-background)}.el-descriptions__label:not(.is-bordered-label){color:var(--el-text-color-primary);margin-right:16px}.el-descriptions__label.el-descriptions__cell:not(.is-bordered-label).is-vertical-label{padding-bottom:6px}.el-descriptions__content.el-descriptions__cell.is-bordered-content{color:var(--el-text-color-primary)}.el-descriptions__content:not(.is-bordered-label){color:var(--el-text-color-regular)}.el-descriptions--large .el-descriptions__label:not(.is-bordered-label){margin-right:16px}.el-descriptions--large .el-descriptions__label.el-descriptions__cell:not(.is-bordered-label).is-vertical-label{padding-bottom:8px}.el-descriptions--small .el-descriptions__label:not(.is-bordered-label){margin-right:12px}.el-descriptions--small .el-descriptions__label.el-descriptions__cell:not(.is-bordered-label).is-vertical-label{padding-bottom:4px}:root{--el-popup-modal-bg-color:var(--el-color-black);--el-popup-modal-opacity:.5}.v-modal-enter{-webkit-animation:v-modal-in var(--el-transition-duration-fast) ease;animation:v-modal-in var(--el-transition-duration-fast) ease}.v-modal-leave{-webkit-animation:v-modal-out var(--el-transition-duration-fast) ease forwards;animation:v-modal-out var(--el-transition-duration-fast) ease forwards}@-webkit-keyframes v-modal-in{0%{opacity:0}}@keyframes v-modal-in{0%{opacity:0}}@-webkit-keyframes v-modal-out{to{opacity:0}}@keyframes v-modal-out{to{opacity:0}}.v-modal{position:fixed;left:0;top:0;width:100%;height:100%;opacity:var(--el-popup-modal-opacity);background:var(--el-popup-modal-bg-color)}.el-popup-parent--hidden{overflow:hidden}.el-dialog{--el-dialog-width:50%;--el-dialog-margin-top:15vh;--el-dialog-bg-color:var(--el-bg-color);--el-dialog-box-shadow:var(--el-box-shadow);--el-dialog-title-font-size:var(--el-font-size-large);--el-dialog-content-font-size:14px;--el-dialog-font-line-height:var(--el-font-line-height-primary);--el-dialog-padding-primary:20px;--el-dialog-border-radius:var(--el-border-radius-small);position:relative;margin:var(--el-dialog-margin-top,15vh) auto 50px;background:var(--el-dialog-bg-color);border-radius:var(--el-dialog-border-radius);box-shadow:var(--el-dialog-box-shadow);box-sizing:border-box;width:var(--el-dialog-width,50%)}.el-dialog:focus{outline:0!important}.el-dialog.is-align-center{margin:auto}.el-dialog.is-fullscreen{--el-dialog-width:100%;--el-dialog-margin-top:0;margin-bottom:0;height:100%;overflow:auto}.el-dialog__wrapper{position:fixed;top:0;right:0;bottom:0;left:0;overflow:auto;margin:0}.el-dialog.is-draggable .el-dialog__header{cursor:move;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-dialog__header{padding:var(--el-dialog-padding-primary);padding-bottom:10px;margin-right:16px}.el-dialog__headerbtn{position:absolute;top:6px;right:0;padding:0;width:54px;height:54px;background:0 0;border:none;outline:0;cursor:pointer;font-size:var(--el-message-close-size,16px)}.el-dialog__headerbtn .el-dialog__close{color:var(--el-color-info);font-size:inherit}.el-dialog__headerbtn:focus .el-dialog__close,.el-dialog__headerbtn:hover .el-dialog__close{color:var(--el-color-primary)}.el-dialog__title{line-height:var(--el-dialog-font-line-height);font-size:var(--el-dialog-title-font-size);color:var(--el-text-color-primary)}.el-dialog__body{padding:calc(var(--el-dialog-padding-primary) + 10px) var(--el-dialog-padding-primary);color:var(--el-text-color-regular);font-size:var(--el-dialog-content-font-size)}.el-dialog__footer{padding:var(--el-dialog-padding-primary);padding-top:10px;text-align:right;box-sizing:border-box}.el-dialog--center{text-align:center}.el-dialog--center .el-dialog__body{text-align:initial;padding:25px calc(var(--el-dialog-padding-primary) + 5px) 30px}.el-dialog--center .el-dialog__footer{text-align:inherit}.el-overlay-dialog{position:fixed;top:0;right:0;bottom:0;left:0;overflow:auto}.dialog-fade-enter-active{-webkit-animation:modal-fade-in var(--el-transition-duration);animation:modal-fade-in var(--el-transition-duration)}.dialog-fade-enter-active .el-overlay-dialog{-webkit-animation:dialog-fade-in var(--el-transition-duration);animation:dialog-fade-in var(--el-transition-duration)}.dialog-fade-leave-active{-webkit-animation:modal-fade-out var(--el-transition-duration);animation:modal-fade-out var(--el-transition-duration)}.dialog-fade-leave-active .el-overlay-dialog{-webkit-animation:dialog-fade-out var(--el-transition-duration);animation:dialog-fade-out var(--el-transition-duration)}@-webkit-keyframes dialog-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@keyframes dialog-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@-webkit-keyframes dialog-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@keyframes dialog-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@-webkit-keyframes modal-fade-in{0%{opacity:0}to{opacity:1}}@keyframes modal-fade-in{0%{opacity:0}to{opacity:1}}@-webkit-keyframes modal-fade-out{0%{opacity:1}to{opacity:0}}@keyframes modal-fade-out{0%{opacity:1}to{opacity:0}}.el-divider{position:relative}.el-divider--horizontal{display:block;height:1px;width:100%;margin:24px 0;border-top:1px var(--el-border-color) var(--el-border-style)}.el-divider--vertical{display:inline-block;width:1px;height:1em;margin:0 8px;vertical-align:middle;position:relative;border-left:1px var(--el-border-color) var(--el-border-style)}.el-divider__text{position:absolute;background-color:var(--el-bg-color);padding:0 20px;font-weight:500;color:var(--el-text-color-primary);font-size:14px}.el-divider__text.is-left{left:20px;transform:translateY(-50%)}.el-divider__text.is-center{left:50%;transform:translate(-50%) translateY(-50%)}.el-divider__text.is-right{right:20px;transform:translateY(-50%)}.el-drawer{--el-drawer-bg-color:var(--el-dialog-bg-color, var(--el-bg-color));--el-drawer-padding-primary:var(--el-dialog-padding-primary, 20px)}.el-drawer{position:absolute;box-sizing:border-box;background-color:var(--el-drawer-bg-color);display:flex;flex-direction:column;box-shadow:var(--el-box-shadow-dark);overflow:hidden;transition:all var(--el-transition-duration)}.el-drawer .rtl,.el-drawer .ltr,.el-drawer .ttb,.el-drawer .btt{transform:translate(0)}.el-drawer__sr-focus:focus{outline:0!important}.el-drawer__header{align-items:center;color:#72767b;display:flex;margin-bottom:32px;padding:var(--el-drawer-padding-primary);padding-bottom:0}.el-drawer__header>:first-child{flex:1}.el-drawer__title{margin:0;flex:1;line-height:inherit;font-size:1rem}.el-drawer__footer{padding:var(--el-drawer-padding-primary);padding-top:10px;text-align:right}.el-drawer__close-btn{display:inline-flex;border:none;cursor:pointer;font-size:var(--el-font-size-extra-large);color:inherit;background-color:transparent;outline:0}.el-drawer__close-btn:focus i,.el-drawer__close-btn:hover i{color:var(--el-color-primary)}.el-drawer__body{flex:1;padding:var(--el-drawer-padding-primary);overflow:auto}.el-drawer__body>*{box-sizing:border-box}.el-drawer.ltr,.el-drawer.rtl{height:100%;top:0;bottom:0}.el-drawer.btt,.el-drawer.ttb{width:100%;left:0;right:0}.el-drawer.ltr{left:0}.el-drawer.rtl{right:0}.el-drawer.ttb{top:0}.el-drawer.btt{bottom:0}.el-drawer-fade-enter-active,.el-drawer-fade-leave-active{transition:all var(--el-transition-duration)}.el-drawer-fade-enter-active,.el-drawer-fade-enter-from,.el-drawer-fade-enter-to,.el-drawer-fade-leave-active,.el-drawer-fade-leave-from,.el-drawer-fade-leave-to{overflow:hidden!important}.el-drawer-fade-enter-from,.el-drawer-fade-leave-to{opacity:0}.el-drawer-fade-enter-to,.el-drawer-fade-leave-from{opacity:1}.el-drawer-fade-enter-from .rtl,.el-drawer-fade-leave-to .rtl{transform:translate(100%)}.el-drawer-fade-enter-from .ltr,.el-drawer-fade-leave-to .ltr{transform:translate(-100%)}.el-drawer-fade-enter-from .ttb,.el-drawer-fade-leave-to .ttb{transform:translateY(-100%)}.el-drawer-fade-enter-from .btt,.el-drawer-fade-leave-to .btt{transform:translateY(100%)}.el-dropdown{--el-dropdown-menu-box-shadow:var(--el-box-shadow-light);--el-dropdown-menuItem-hover-fill:var(--el-color-primary-light-9);--el-dropdown-menuItem-hover-color:var(--el-color-primary);--el-dropdown-menu-index:10;display:inline-flex;position:relative;color:var(--el-text-color-regular);font-size:var(--el-font-size-base);line-height:1;vertical-align:top}.el-dropdown.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-dropdown__popper{--el-dropdown-menu-box-shadow:var(--el-box-shadow-light);--el-dropdown-menuItem-hover-fill:var(--el-color-primary-light-9);--el-dropdown-menuItem-hover-color:var(--el-color-primary);--el-dropdown-menu-index:10}.el-dropdown__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-dropdown-menu-box-shadow)}.el-dropdown__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-dropdown__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-dropdown__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-dropdown__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-dropdown__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-dropdown__popper .el-dropdown-menu{border:none}.el-dropdown__popper .el-dropdown__popper-selfdefine{outline:0}.el-dropdown__popper .el-scrollbar__bar{z-index:calc(var(--el-dropdown-menu-index) + 1)}.el-dropdown__popper .el-dropdown__list{list-style:none;padding:0;margin:0;box-sizing:border-box}.el-dropdown .el-dropdown__caret-button{padding-left:0;padding-right:0;display:inline-flex;justify-content:center;align-items:center;width:32px;border-left:none}.el-dropdown .el-dropdown__caret-button>span{display:inline-flex}.el-dropdown .el-dropdown__caret-button:before{content:"";position:absolute;display:block;width:1px;top:-1px;bottom:-1px;left:0;background:var(--el-overlay-color-lighter)}.el-dropdown .el-dropdown__caret-button.el-button:before{background:var(--el-border-color);opacity:.5}.el-dropdown .el-dropdown__caret-button .el-dropdown__icon{font-size:inherit;padding-left:0}.el-dropdown .el-dropdown-selfdefine{outline:0}.el-dropdown--large .el-dropdown__caret-button{width:40px}.el-dropdown--small .el-dropdown__caret-button{width:24px}.el-dropdown-menu{position:relative;top:0;left:0;z-index:var(--el-dropdown-menu-index);padding:5px 0;margin:0;background-color:var(--el-bg-color-overlay);border:none;border-radius:var(--el-border-radius-base);box-shadow:none;list-style:none}.el-dropdown-menu__item{display:flex;align-items:center;white-space:nowrap;list-style:none;line-height:22px;padding:5px 16px;margin:0;font-size:var(--el-font-size-base);color:var(--el-text-color-regular);cursor:pointer;outline:0}.el-dropdown-menu__item:not(.is-disabled):focus{background-color:var(--el-dropdown-menuItem-hover-fill);color:var(--el-dropdown-menuItem-hover-color)}.el-dropdown-menu__item i{margin-right:5px}.el-dropdown-menu__item--divided{margin:6px 0;border-top:1px solid var(--el-border-color-lighter)}.el-dropdown-menu__item.is-disabled{cursor:not-allowed;color:var(--el-text-color-disabled)}.el-dropdown-menu--large{padding:7px 0}.el-dropdown-menu--large .el-dropdown-menu__item{padding:7px 20px;line-height:22px;font-size:14px}.el-dropdown-menu--large .el-dropdown-menu__item--divided{margin:8px 0}.el-dropdown-menu--small{padding:3px 0}.el-dropdown-menu--small .el-dropdown-menu__item{padding:2px 12px;line-height:20px;font-size:12px}.el-dropdown-menu--small .el-dropdown-menu__item--divided{margin:4px 0}.el-empty{--el-empty-padding:40px 0;--el-empty-image-width:160px;--el-empty-description-margin-top:20px;--el-empty-bottom-margin-top:20px;--el-empty-fill-color-0:var(--el-color-white);--el-empty-fill-color-1:#fcfcfd;--el-empty-fill-color-2:#f8f9fb;--el-empty-fill-color-3:#f7f8fc;--el-empty-fill-color-4:#eeeff3;--el-empty-fill-color-5:#edeef2;--el-empty-fill-color-6:#e9ebef;--el-empty-fill-color-7:#e5e7e9;--el-empty-fill-color-8:#e0e3e9;--el-empty-fill-color-9:#d5d7de;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;box-sizing:border-box;padding:var(--el-empty-padding)}.el-empty__image{width:var(--el-empty-image-width)}.el-empty__image img{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%;height:100%;vertical-align:top;-o-object-fit:contain;object-fit:contain}.el-empty__image svg{color:var(--el-svg-monochrome-grey);fill:currentColor;width:100%;height:100%;vertical-align:top}.el-empty__description{margin-top:var(--el-empty-description-margin-top)}.el-empty__description p{margin:0;font-size:var(--el-font-size-base);color:var(--el-text-color-secondary)}.el-empty__bottom{margin-top:var(--el-empty-bottom-margin-top)}.el-footer{--el-footer-padding:0 20px;--el-footer-height:60px;padding:var(--el-footer-padding);box-sizing:border-box;flex-shrink:0;height:var(--el-footer-height)}.el-form{--el-form-label-font-size:var(--el-font-size-base)}.el-form--label-left .el-form-item__label{justify-content:flex-start}.el-form--label-top .el-form-item{display:block}.el-form--label-top .el-form-item .el-form-item__label{display:block;height:auto;text-align:left;margin-bottom:8px;line-height:22px}.el-form--inline .el-form-item{display:inline-flex;vertical-align:middle;margin-right:32px}.el-form--inline.el-form--label-top{display:flex;flex-wrap:wrap}.el-form--inline.el-form--label-top .el-form-item{display:block}.el-form--large.el-form--label-top .el-form-item .el-form-item__label{margin-bottom:12px;line-height:22px}.el-form--default.el-form--label-top .el-form-item .el-form-item__label{margin-bottom:8px;line-height:22px}.el-form--small.el-form--label-top .el-form-item .el-form-item__label{margin-bottom:4px;line-height:20px}.el-form-item{display:flex;--font-size:14px;margin-bottom:18px}.el-form-item .el-form-item{margin-bottom:0}.el-form-item .el-input__validateIcon{display:none}.el-form-item--large{--font-size:14px;--el-form-label-font-size:var(--font-size);margin-bottom:22px}.el-form-item--large .el-form-item__label{height:40px;line-height:40px}.el-form-item--large .el-form-item__content{line-height:40px}.el-form-item--large .el-form-item__error{padding-top:4px}.el-form-item--default{--font-size:14px;--el-form-label-font-size:var(--font-size);margin-bottom:18px}.el-form-item--default .el-form-item__label{height:32px;line-height:32px}.el-form-item--default .el-form-item__content{line-height:32px}.el-form-item--default .el-form-item__error{padding-top:2px}.el-form-item--small{--font-size:12px;--el-form-label-font-size:var(--font-size);margin-bottom:18px}.el-form-item--small .el-form-item__label{height:24px;line-height:24px}.el-form-item--small .el-form-item__content{line-height:24px}.el-form-item--small .el-form-item__error{padding-top:2px}.el-form-item__label-wrap{display:flex}.el-form-item__label{display:inline-flex;justify-content:flex-end;align-items:flex-start;flex:0 0 auto;font-size:var(--el-form-label-font-size);color:var(--el-text-color-regular);height:32px;line-height:32px;padding:0 12px 0 0;box-sizing:border-box}.el-form-item__content{display:flex;flex-wrap:wrap;align-items:center;flex:1;line-height:32px;position:relative;font-size:var(--font-size);min-width:0}.el-form-item__content .el-input-group{vertical-align:top}.el-form-item__error{color:var(--el-color-danger);font-size:12px;line-height:1;padding-top:2px;position:absolute;top:100%;left:0}.el-form-item__error--inline{position:relative;top:auto;left:auto;display:inline-block;margin-left:10px}.el-form-item.is-required:not(.is-no-asterisk).asterisk-left>.el-form-item__label-wrap>.el-form-item__label:before,.el-form-item.is-required:not(.is-no-asterisk).asterisk-left>.el-form-item__label:before{content:"*";color:var(--el-color-danger);margin-right:4px}.el-form-item.is-required:not(.is-no-asterisk).asterisk-right>.el-form-item__label-wrap>.el-form-item__label:after,.el-form-item.is-required:not(.is-no-asterisk).asterisk-right>.el-form-item__label:after{content:"*";color:var(--el-color-danger);margin-left:4px}.el-form-item.is-error .el-select-v2__wrapper,.el-form-item.is-error .el-select-v2__wrapper:focus,.el-form-item.is-error .el-textarea__inner,.el-form-item.is-error .el-textarea__inner:focus{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-form-item.is-error .el-input__wrapper{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-form-item.is-error .el-input-group__append .el-input__wrapper,.el-form-item.is-error .el-input-group__prepend .el-input__wrapper{box-shadow:0 0 0 1px transparent inset}.el-form-item.is-error .el-input__validateIcon{color:var(--el-color-danger)}.el-form-item--feedback .el-input__validateIcon{display:inline-flex}.el-header{--el-header-padding:0 20px;--el-header-height:60px;padding:var(--el-header-padding);box-sizing:border-box;flex-shrink:0;height:var(--el-header-height)}.el-image-viewer__wrapper{position:fixed;top:0;right:0;bottom:0;left:0}.el-image-viewer__btn{position:absolute;z-index:1;display:flex;align-items:center;justify-content:center;border-radius:50%;opacity:.8;cursor:pointer;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-image-viewer__btn .el-icon{font-size:inherit;cursor:pointer}.el-image-viewer__close{top:40px;right:40px;width:40px;height:40px;font-size:40px}.el-image-viewer__canvas{position:static;width:100%;height:100%;display:flex;justify-content:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-image-viewer__actions{left:50%;bottom:30px;transform:translate(-50%);width:282px;height:44px;padding:0 23px;background-color:var(--el-text-color-regular);border-color:#fff;border-radius:22px}.el-image-viewer__actions__inner{width:100%;height:100%;text-align:justify;cursor:default;font-size:23px;color:#fff;display:flex;align-items:center;justify-content:space-around}.el-image-viewer__prev{top:50%;transform:translateY(-50%);left:40px;width:44px;height:44px;font-size:24px;color:#fff;background-color:var(--el-text-color-regular);border-color:#fff}.el-image-viewer__next{top:50%;transform:translateY(-50%);right:40px;text-indent:2px;width:44px;height:44px;font-size:24px;color:#fff;background-color:var(--el-text-color-regular);border-color:#fff}.el-image-viewer__close{width:44px;height:44px;font-size:24px;color:#fff;background-color:var(--el-text-color-regular);border-color:#fff}.el-image-viewer__mask{position:absolute;width:100%;height:100%;top:0;left:0;opacity:.5;background:#000}.viewer-fade-enter-active{-webkit-animation:viewer-fade-in var(--el-transition-duration);animation:viewer-fade-in var(--el-transition-duration)}.viewer-fade-leave-active{-webkit-animation:viewer-fade-out var(--el-transition-duration);animation:viewer-fade-out var(--el-transition-duration)}@-webkit-keyframes viewer-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@keyframes viewer-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@-webkit-keyframes viewer-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@keyframes viewer-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}.el-image__error,.el-image__inner,.el-image__placeholder,.el-image__wrapper{width:100%;height:100%}.el-image{position:relative;display:inline-block;overflow:hidden}.el-image__inner{vertical-align:top;opacity:1}.el-image__inner.is-loading{opacity:0}.el-image__wrapper{position:absolute;top:0;left:0}.el-image__placeholder{background:var(--el-fill-color-light)}.el-image__error{display:flex;justify-content:center;align-items:center;font-size:14px;background:var(--el-fill-color-light);color:var(--el-text-color-placeholder);vertical-align:middle}.el-image__preview{cursor:pointer}.el-input-number{position:relative;display:inline-flex;width:150px;line-height:30px}.el-input-number .el-input__wrapper{padding-left:42px;padding-right:42px}.el-input-number .el-input__inner{-webkit-appearance:none;-moz-appearance:textfield;text-align:center;line-height:1}.el-input-number .el-input__inner::-webkit-inner-spin-button,.el-input-number .el-input__inner::-webkit-outer-spin-button{margin:0;-webkit-appearance:none}.el-input-number__decrease,.el-input-number__increase{display:flex;justify-content:center;align-items:center;height:auto;position:absolute;z-index:1;top:1px;bottom:1px;width:32px;background:var(--el-fill-color-light);color:var(--el-text-color-regular);cursor:pointer;font-size:13px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-input-number__decrease:hover,.el-input-number__increase:hover{color:var(--el-color-primary)}.el-input-number__decrease:hover~.el-input:not(.is-disabled) .el-input_wrapper,.el-input-number__increase:hover~.el-input:not(.is-disabled) .el-input_wrapper{box-shadow:0 0 0 1px var(--el-input-focus-border-color,var(--el-color-primary)) inset}.el-input-number__decrease.is-disabled,.el-input-number__increase.is-disabled{color:var(--el-disabled-text-color);cursor:not-allowed}.el-input-number__increase{right:1px;border-radius:0 var(--el-border-radius-base) var(--el-border-radius-base) 0;border-left:var(--el-border)}.el-input-number__decrease{left:1px;border-radius:var(--el-border-radius-base) 0 0 var(--el-border-radius-base);border-right:var(--el-border)}.el-input-number.is-disabled .el-input-number__decrease,.el-input-number.is-disabled .el-input-number__increase{border-color:var(--el-disabled-border-color);color:var(--el-disabled-border-color)}.el-input-number.is-disabled .el-input-number__decrease:hover,.el-input-number.is-disabled .el-input-number__increase:hover{color:var(--el-disabled-border-color);cursor:not-allowed}.el-input-number--large{width:180px;line-height:38px}.el-input-number--large .el-input-number__decrease,.el-input-number--large .el-input-number__increase{width:40px;font-size:14px}.el-input-number--large .el-input__wrapper{padding-left:47px;padding-right:47px}.el-input-number--small{width:120px;line-height:22px}.el-input-number--small .el-input-number__decrease,.el-input-number--small .el-input-number__increase{width:24px;font-size:12px}.el-input-number--small .el-input__wrapper{padding-left:31px;padding-right:31px}.el-input-number--small .el-input-number__decrease [class*=el-icon],.el-input-number--small .el-input-number__increase [class*=el-icon]{transform:scale(.9)}.el-input-number.is-without-controls .el-input__wrapper{padding-left:15px;padding-right:15px}.el-input-number.is-controls-right .el-input__wrapper{padding-left:15px;padding-right:42px}.el-input-number.is-controls-right .el-input-number__decrease,.el-input-number.is-controls-right .el-input-number__increase{--el-input-number-controls-height:15px;height:var(--el-input-number-controls-height);line-height:var(--el-input-number-controls-height)}.el-input-number.is-controls-right .el-input-number__decrease [class*=el-icon],.el-input-number.is-controls-right .el-input-number__increase [class*=el-icon]{transform:scale(.8)}.el-input-number.is-controls-right .el-input-number__increase{bottom:auto;left:auto;border-radius:0 var(--el-border-radius-base) 0 0;border-bottom:var(--el-border)}.el-input-number.is-controls-right .el-input-number__decrease{right:1px;top:auto;left:auto;border-right:none;border-left:var(--el-border);border-radius:0 0 var(--el-border-radius-base) 0}.el-input-number.is-controls-right[class*=large] [class*=decrease],.el-input-number.is-controls-right[class*=large] [class*=increase]{--el-input-number-controls-height:19px}.el-input-number.is-controls-right[class*=small] [class*=decrease],.el-input-number.is-controls-right[class*=small] [class*=increase]{--el-input-number-controls-height:11px}.el-textarea{--el-input-text-color:var(--el-text-color-regular);--el-input-border:var(--el-border);--el-input-hover-border:var(--el-border-color-hover);--el-input-focus-border:var(--el-color-primary);--el-input-transparent-border:0 0 0 1px transparent inset;--el-input-border-color:var(--el-border-color);--el-input-border-radius:var(--el-border-radius-base);--el-input-bg-color:var(--el-fill-color-blank);--el-input-icon-color:var(--el-text-color-placeholder);--el-input-placeholder-color:var(--el-text-color-placeholder);--el-input-hover-border-color:var(--el-border-color-hover);--el-input-clear-hover-color:var(--el-text-color-secondary);--el-input-focus-border-color:var(--el-color-primary)}.el-textarea{position:relative;display:inline-block;width:100%;vertical-align:bottom;font-size:var(--el-font-size-base)}.el-textarea__inner{position:relative;display:block;resize:vertical;padding:5px 11px;line-height:1.5;box-sizing:border-box;width:100%;font-size:inherit;font-family:inherit;color:var(--el-input-text-color,var(--el-text-color-regular));background-color:var(--el-input-bg-color,var(--el-fill-color-blank));background-image:none;-webkit-appearance:none;box-shadow:0 0 0 1px var(--el-input-border-color,var(--el-border-color)) inset;border-radius:var(--el-input-border-radius,var(--el-border-radius-base));transition:var(--el-transition-box-shadow);border:none}.el-textarea__inner::-moz-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-textarea__inner:-ms-input-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-textarea__inner::placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-textarea__inner:hover{box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-textarea__inner:focus{outline:0;box-shadow:0 0 0 1px var(--el-input-focus-border-color) inset}.el-textarea .el-input__count{color:var(--el-color-info);background:var(--el-fill-color-blank);position:absolute;font-size:12px;line-height:14px;bottom:5px;right:10px}.el-textarea.is-disabled .el-textarea__inner{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color);color:var(--el-disabled-text-color);cursor:not-allowed}.el-textarea.is-disabled .el-textarea__inner::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-textarea.is-disabled .el-textarea__inner:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-textarea.is-disabled .el-textarea__inner::placeholder{color:var(--el-text-color-placeholder)}.el-textarea.is-exceed .el-textarea__inner{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-textarea.is-exceed .el-input__count{color:var(--el-color-danger)}.el-input{--el-input-text-color:var(--el-text-color-regular);--el-input-border:var(--el-border);--el-input-hover-border:var(--el-border-color-hover);--el-input-focus-border:var(--el-color-primary);--el-input-transparent-border:0 0 0 1px transparent inset;--el-input-border-color:var(--el-border-color);--el-input-border-radius:var(--el-border-radius-base);--el-input-bg-color:var(--el-fill-color-blank);--el-input-icon-color:var(--el-text-color-placeholder);--el-input-placeholder-color:var(--el-text-color-placeholder);--el-input-hover-border-color:var(--el-border-color-hover);--el-input-clear-hover-color:var(--el-text-color-secondary);--el-input-focus-border-color:var(--el-color-primary)}.el-input{--el-input-height:var(--el-component-size);position:relative;font-size:var(--el-font-size-base);display:inline-flex;width:100%;line-height:var(--el-input-height);box-sizing:border-box;vertical-align:middle}.el-input::-webkit-scrollbar{z-index:11;width:6px}.el-input::-webkit-scrollbar:horizontal{height:6px}.el-input::-webkit-scrollbar-thumb{border-radius:5px;width:6px;background:var(--el-text-color-disabled)}.el-input::-webkit-scrollbar-corner{background:var(--el-fill-color-blank)}.el-input::-webkit-scrollbar-track{background:var(--el-fill-color-blank)}.el-input::-webkit-scrollbar-track-piece{background:var(--el-fill-color-blank);width:6px}.el-input .el-input__clear,.el-input .el-input__password{color:var(--el-input-icon-color);font-size:14px;cursor:pointer}.el-input .el-input__clear:hover,.el-input .el-input__password:hover{color:var(--el-input-clear-hover-color)}.el-input .el-input__count{height:100%;display:inline-flex;align-items:center;color:var(--el-color-info);font-size:12px}.el-input .el-input__count .el-input__count-inner{background:var(--el-fill-color-blank);line-height:initial;display:inline-block;padding-left:8px}.el-input__wrapper{display:inline-flex;flex-grow:1;align-items:center;justify-content:center;padding:1px 11px;background-color:var(--el-input-bg-color,var(--el-fill-color-blank));background-image:none;border-radius:var(--el-input-border-radius,var(--el-border-radius-base));transition:var(--el-transition-box-shadow);transform:translateZ(0);box-shadow:0 0 0 1px var(--el-input-border-color,var(--el-border-color)) inset}.el-input__wrapper:hover{box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-input__wrapper.is-focus{box-shadow:0 0 0 1px var(--el-input-focus-border-color) inset}.el-input__inner{--el-input-inner-height:calc(var(--el-input-height, 32px) - 2px);width:100%;flex-grow:1;-webkit-appearance:none;color:var(--el-input-text-color,var(--el-text-color-regular));font-size:inherit;height:var(--el-input-inner-height);line-height:var(--el-input-inner-height);padding:0;outline:0;border:none;background:0 0;box-sizing:border-box}.el-input__inner:focus{outline:0}.el-input__inner::-moz-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-input__inner:-ms-input-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-input__inner::placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-input__inner[type=password]::-ms-reveal{display:none}.el-input__prefix{display:inline-flex;white-space:nowrap;flex-shrink:0;flex-wrap:nowrap;height:100%;text-align:center;color:var(--el-input-icon-color,var(--el-text-color-placeholder));transition:all var(--el-transition-duration);pointer-events:none}.el-input__prefix-inner{pointer-events:all;display:inline-flex;align-items:center;justify-content:center}.el-input__prefix-inner>:last-child{margin-right:8px}.el-input__prefix-inner>:first-child,.el-input__prefix-inner>:first-child.el-input__icon{margin-left:0}.el-input__suffix{display:inline-flex;white-space:nowrap;flex-shrink:0;flex-wrap:nowrap;height:100%;text-align:center;color:var(--el-input-icon-color,var(--el-text-color-placeholder));transition:all var(--el-transition-duration);pointer-events:none}.el-input__suffix-inner{pointer-events:all;display:inline-flex;align-items:center;justify-content:center}.el-input__suffix-inner>:first-child{margin-left:8px}.el-input .el-input__icon{height:inherit;line-height:inherit;display:flex;justify-content:center;align-items:center;transition:all var(--el-transition-duration);margin-left:8px}.el-input__validateIcon{pointer-events:none}.el-input.is-active .el-input__wrapper{box-shadow:0 0 0 1px var(--el-input-focus-color,) inset}.el-input.is-disabled{cursor:not-allowed}.el-input.is-disabled .el-input__wrapper{background-color:var(--el-disabled-bg-color);box-shadow:0 0 0 1px var(--el-disabled-border-color) inset}.el-input.is-disabled .el-input__inner{color:var(--el-disabled-text-color);-webkit-text-fill-color:var(--el-disabled-text-color);cursor:not-allowed}.el-input.is-disabled .el-input__inner::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-input.is-disabled .el-input__inner:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-input.is-disabled .el-input__inner::placeholder{color:var(--el-text-color-placeholder)}.el-input.is-disabled .el-input__icon{cursor:not-allowed}.el-input.is-exceed .el-input__wrapper{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-input.is-exceed .el-input__suffix .el-input__count{color:var(--el-color-danger)}.el-input--large{--el-input-height:var(--el-component-size-large);font-size:14px}.el-input--large .el-input__wrapper{padding:1px 15px}.el-input--large .el-input__inner{--el-input-inner-height:calc(var(--el-input-height, 40px) - 2px)}.el-input--small{--el-input-height:var(--el-component-size-small);font-size:12px}.el-input--small .el-input__wrapper{padding:1px 7px}.el-input--small .el-input__inner{--el-input-inner-height:calc(var(--el-input-height, 24px) - 2px)}.el-input-group{display:inline-flex;width:100%;align-items:stretch}.el-input-group__append,.el-input-group__prepend{background-color:var(--el-fill-color-light);color:var(--el-color-info);position:relative;display:inline-flex;align-items:center;justify-content:center;min-height:100%;border-radius:var(--el-input-border-radius);padding:0 20px;white-space:nowrap}.el-input-group__append:focus,.el-input-group__prepend:focus{outline:0}.el-input-group__append .el-button,.el-input-group__append .el-select,.el-input-group__prepend .el-button,.el-input-group__prepend .el-select{display:inline-block;margin:0 -20px}.el-input-group__append button.el-button,.el-input-group__append button.el-button:hover,.el-input-group__append div.el-select .el-input__wrapper,.el-input-group__append div.el-select:hover .el-input__wrapper,.el-input-group__prepend button.el-button,.el-input-group__prepend button.el-button:hover,.el-input-group__prepend div.el-select .el-input__wrapper,.el-input-group__prepend div.el-select:hover .el-input__wrapper{border-color:transparent;background-color:transparent;color:inherit}.el-input-group__append .el-button,.el-input-group__append .el-input,.el-input-group__prepend .el-button,.el-input-group__prepend .el-input{font-size:inherit}.el-input-group__prepend{border-right:0;border-top-right-radius:0;border-bottom-right-radius:0;box-shadow:1px 0 0 0 var(--el-input-border-color) inset,0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset}.el-input-group__append{border-left:0;border-top-left-radius:0;border-bottom-left-radius:0;box-shadow:0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset,-1px 0 0 0 var(--el-input-border-color) inset}.el-input-group--prepend>.el-input__wrapper{border-top-left-radius:0;border-bottom-left-radius:0}.el-input-group--prepend .el-input-group__prepend .el-select .el-input .el-input__inner{box-shadow:none!important}.el-input-group--prepend .el-input-group__prepend .el-select .el-input .el-input__wrapper{border-top-right-radius:0;border-bottom-right-radius:0;box-shadow:1px 0 0 0 var(--el-input-border-color) inset,0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset}.el-input-group--prepend .el-input-group__prepend .el-select .el-input.is-focus .el-input__inner{box-shadow:none!important}.el-input-group--prepend .el-input-group__prepend .el-select .el-input.is-focus .el-input__wrapper{box-shadow:1px 0 0 0 var(--el-input-focus-border-color) inset,1px 0 0 0 var(--el-input-focus-border-color),0 1px 0 0 var(--el-input-focus-border-color) inset,0 -1px 0 0 var(--el-input-focus-border-color) inset!important;z-index:2}.el-input-group--prepend .el-input-group__prepend .el-select .el-input.is-focus .el-input__wrapper:focus{outline:0;z-index:2;box-shadow:1px 0 0 0 var(--el-input-focus-border-color) inset,1px 0 0 0 var(--el-input-focus-border-color),0 1px 0 0 var(--el-input-focus-border-color) inset,0 -1px 0 0 var(--el-input-focus-border-color) inset!important}.el-input-group--prepend .el-input-group__prepend .el-select:hover .el-input__inner{box-shadow:none!important}.el-input-group--prepend .el-input-group__prepend .el-select:hover .el-input__wrapper{z-index:1;box-shadow:1px 0 0 0 var(--el-input-hover-border-color) inset,1px 0 0 0 var(--el-input-hover-border-color),0 1px 0 0 var(--el-input-hover-border-color) inset,0 -1px 0 0 var(--el-input-hover-border-color) inset!important}.el-input-group--append>.el-input__wrapper{border-top-right-radius:0;border-bottom-right-radius:0}.el-input-group--append .el-input-group__append .el-select .el-input .el-input__inner{box-shadow:none!important}.el-input-group--append .el-input-group__append .el-select .el-input .el-input__wrapper{border-top-left-radius:0;border-bottom-left-radius:0;box-shadow:0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset,-1px 0 0 0 var(--el-input-border-color) inset}.el-input-group--append .el-input-group__append .el-select .el-input.is-focus .el-input__inner{box-shadow:none!important}.el-input-group--append .el-input-group__append .el-select .el-input.is-focus .el-input__wrapper{z-index:2;box-shadow:-1px 0 0 0 var(--el-input-focus-border-color),-1px 0 0 0 var(--el-input-focus-border-color) inset,0 1px 0 0 var(--el-input-focus-border-color) inset,0 -1px 0 0 var(--el-input-focus-border-color) inset!important}.el-input-group--append .el-input-group__append .el-select:hover .el-input__inner{box-shadow:none!important}.el-input-group--append .el-input-group__append .el-select:hover .el-input__wrapper{z-index:1;box-shadow:-1px 0 0 0 var(--el-input-hover-border-color),-1px 0 0 0 var(--el-input-hover-border-color) inset,0 1px 0 0 var(--el-input-hover-border-color) inset,0 -1px 0 0 var(--el-input-hover-border-color) inset!important}.el-link{--el-link-font-size:var(--el-font-size-base);--el-link-font-weight:var(--el-font-weight-primary);--el-link-text-color:var(--el-text-color-regular);--el-link-hover-text-color:var(--el-color-primary);--el-link-disabled-text-color:var(--el-text-color-placeholder)}.el-link{display:inline-flex;flex-direction:row;align-items:center;justify-content:center;vertical-align:middle;position:relative;text-decoration:none;outline:0;cursor:pointer;padding:0;font-size:var(--el-link-font-size);font-weight:var(--el-link-font-weight);color:var(--el-link-text-color)}.el-link:hover{color:var(--el-link-hover-text-color)}.el-link.is-underline:hover:after{content:"";position:absolute;left:0;right:0;height:0;bottom:0;border-bottom:1px solid var(--el-link-hover-text-color)}.el-link.is-disabled{color:var(--el-link-disabled-text-color);cursor:not-allowed}.el-link [class*=el-icon-]+span{margin-left:5px}.el-link.el-link--default:after{border-color:var(--el-link-hover-text-color)}.el-link__inner{display:inline-flex;justify-content:center;align-items:center}.el-link.el-link--primary{--el-link-text-color:var(--el-color-primary);--el-link-hover-text-color:var(--el-color-primary-light-3);--el-link-disabled-text-color:var(--el-color-primary-light-5)}.el-link.el-link--primary:after{border-color:var(--el-link-text-color)}.el-link.el-link--primary.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--success{--el-link-text-color:var(--el-color-success);--el-link-hover-text-color:var(--el-color-success-light-3);--el-link-disabled-text-color:var(--el-color-success-light-5)}.el-link.el-link--success:after{border-color:var(--el-link-text-color)}.el-link.el-link--success.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--warning{--el-link-text-color:var(--el-color-warning);--el-link-hover-text-color:var(--el-color-warning-light-3);--el-link-disabled-text-color:var(--el-color-warning-light-5)}.el-link.el-link--warning:after{border-color:var(--el-link-text-color)}.el-link.el-link--warning.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--danger{--el-link-text-color:var(--el-color-danger);--el-link-hover-text-color:var(--el-color-danger-light-3);--el-link-disabled-text-color:var(--el-color-danger-light-5)}.el-link.el-link--danger:after{border-color:var(--el-link-text-color)}.el-link.el-link--danger.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--error{--el-link-text-color:var(--el-color-error);--el-link-hover-text-color:var(--el-color-error-light-3);--el-link-disabled-text-color:var(--el-color-error-light-5)}.el-link.el-link--error:after{border-color:var(--el-link-text-color)}.el-link.el-link--error.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--info{--el-link-text-color:var(--el-color-info);--el-link-hover-text-color:var(--el-color-info-light-3);--el-link-disabled-text-color:var(--el-color-info-light-5)}.el-link.el-link--info:after{border-color:var(--el-link-text-color)}.el-link.el-link--info.is-underline:hover:after{border-color:var(--el-link-text-color)}:root{--el-loading-spinner-size:42px;--el-loading-fullscreen-spinner-size:50px}.el-loading-parent--relative{position:relative!important}.el-loading-parent--hidden{overflow:hidden!important}.el-loading-mask{position:absolute;z-index:2000;background-color:var(--el-mask-color);margin:0;top:0;right:0;bottom:0;left:0;transition:opacity var(--el-transition-duration)}.el-loading-mask.is-fullscreen{position:fixed}.el-loading-mask.is-fullscreen .el-loading-spinner{margin-top:calc((0px - var(--el-loading-fullscreen-spinner-size))/ 2)}.el-loading-mask.is-fullscreen .el-loading-spinner .circular{height:var(--el-loading-fullscreen-spinner-size);width:var(--el-loading-fullscreen-spinner-size)}.el-loading-spinner{top:50%;margin-top:calc((0px - var(--el-loading-spinner-size))/ 2);width:100%;text-align:center;position:absolute}.el-loading-spinner .el-loading-text{color:var(--el-color-primary);margin:3px 0;font-size:14px}.el-loading-spinner .circular{display:inline;height:var(--el-loading-spinner-size);width:var(--el-loading-spinner-size);-webkit-animation:loading-rotate 2s linear infinite;animation:loading-rotate 2s linear infinite}.el-loading-spinner .path{-webkit-animation:loading-dash 1.5s ease-in-out infinite;animation:loading-dash 1.5s ease-in-out infinite;stroke-dasharray:90,150;stroke-dashoffset:0;stroke-width:2;stroke:var(--el-color-primary);stroke-linecap:round}.el-loading-spinner i{color:var(--el-color-primary)}.el-loading-fade-enter-from,.el-loading-fade-leave-to{opacity:0}@-webkit-keyframes loading-rotate{to{transform:rotate(360deg)}}@keyframes loading-rotate{to{transform:rotate(360deg)}}@-webkit-keyframes loading-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40px}to{stroke-dasharray:90,150;stroke-dashoffset:-120px}}@keyframes loading-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40px}to{stroke-dasharray:90,150;stroke-dashoffset:-120px}}.el-main{--el-main-padding:20px;display:block;flex:1;flex-basis:auto;overflow:auto;box-sizing:border-box;padding:var(--el-main-padding)}:root{--el-menu-active-color:var(--el-color-primary);--el-menu-text-color:var(--el-text-color-primary);--el-menu-hover-text-color:var(--el-color-primary);--el-menu-bg-color:var(--el-fill-color-blank);--el-menu-hover-bg-color:var(--el-color-primary-light-9);--el-menu-item-height:56px;--el-menu-sub-item-height:calc(var(--el-menu-item-height) - 6px);--el-menu-horizontal-sub-item-height:36px;--el-menu-item-font-size:var(--el-font-size-base);--el-menu-item-hover-fill:var(--el-color-primary-light-9);--el-menu-border-color:var(--el-border-color);--el-menu-base-level-padding:20px;--el-menu-level-padding:20px;--el-menu-icon-width:24px}.el-menu{border-right:solid 1px var(--el-menu-border-color);list-style:none;position:relative;margin:0;padding-left:0;background-color:var(--el-menu-bg-color);box-sizing:border-box}.el-menu--vertical:not(.el-menu--collapse):not(.el-menu--popup-container) .el-menu-item,.el-menu--vertical:not(.el-menu--collapse):not(.el-menu--popup-container) .el-menu-item-group__title,.el-menu--vertical:not(.el-menu--collapse):not(.el-menu--popup-container) .el-sub-menu__title{white-space:nowrap;padding-left:calc(var(--el-menu-base-level-padding) + var(--el-menu-level) * var(--el-menu-level-padding))}.el-menu--horizontal{display:flex;flex-wrap:nowrap;border-bottom:solid 1px var(--el-menu-border-color);border-right:none}.el-menu--horizontal>.el-menu-item{display:inline-flex;justify-content:center;align-items:center;height:100%;margin:0;border-bottom:2px solid transparent;color:var(--el-menu-text-color)}.el-menu--horizontal>.el-menu-item a,.el-menu--horizontal>.el-menu-item a:hover{color:inherit}.el-menu--horizontal>.el-menu-item:not(.is-disabled):focus,.el-menu--horizontal>.el-menu-item:not(.is-disabled):hover{background-color:#fff}.el-menu--horizontal>.el-sub-menu:focus,.el-menu--horizontal>.el-sub-menu:hover{outline:0}.el-menu--horizontal>.el-sub-menu:hover .el-sub-menu__title{color:var(--el-menu-hover-text-color)}.el-menu--horizontal>.el-sub-menu.is-active .el-sub-menu__title{border-bottom:2px solid var(--el-menu-active-color);color:var(--el-menu-active-color)}.el-menu--horizontal>.el-sub-menu .el-sub-menu__title{height:100%;border-bottom:2px solid transparent;color:var(--el-menu-text-color)}.el-menu--horizontal>.el-sub-menu .el-sub-menu__title:hover{background-color:var(--el-bg-color-overlay)}.el-menu--horizontal .el-menu .el-menu-item,.el-menu--horizontal .el-menu .el-sub-menu__title{background-color:var(--el-menu-bg-color);display:flex;align-items:center;height:var(--el-menu-horizontal-sub-item-height);line-height:var(--el-menu-horizontal-sub-item-height);padding:0 10px;color:var(--el-menu-text-color)}.el-menu--horizontal .el-menu .el-sub-menu__title{padding-right:40px}.el-menu--horizontal .el-menu .el-menu-item.is-active,.el-menu--horizontal .el-menu .el-sub-menu.is-active>.el-sub-menu__title{color:var(--el-menu-active-color)}.el-menu--horizontal .el-menu-item:not(.is-disabled):focus,.el-menu--horizontal .el-menu-item:not(.is-disabled):hover{outline:0;color:var(--el-menu-hover-text-color);background-color:var(--el-menu-hover-bg-color)}.el-menu--horizontal>.el-menu-item.is-active{border-bottom:2px solid var(--el-menu-active-color);color:var(--el-menu-active-color)!important}.el-menu--collapse{width:calc(var(--el-menu-icon-width) + var(--el-menu-base-level-padding) * 2)}.el-menu--collapse>.el-menu-item [class^=el-icon],.el-menu--collapse>.el-menu-item-group>ul>.el-sub-menu>.el-sub-menu__title [class^=el-icon],.el-menu--collapse>.el-sub-menu>.el-sub-menu__title [class^=el-icon]{margin:0;vertical-align:middle;width:var(--el-menu-icon-width);text-align:center}.el-menu--collapse>.el-menu-item .el-sub-menu__icon-arrow,.el-menu--collapse>.el-menu-item-group>ul>.el-sub-menu>.el-sub-menu__title .el-sub-menu__icon-arrow,.el-menu--collapse>.el-sub-menu>.el-sub-menu__title .el-sub-menu__icon-arrow{display:none}.el-menu--collapse>.el-menu-item-group>ul>.el-sub-menu>.el-sub-menu__title>span,.el-menu--collapse>.el-menu-item>span,.el-menu--collapse>.el-sub-menu>.el-sub-menu__title>span{height:0;width:0;overflow:hidden;visibility:hidden;display:inline-block}.el-menu--collapse>.el-menu-item.is-active i{color:inherit}.el-menu--collapse .el-menu .el-sub-menu{min-width:200px}.el-menu--popup{z-index:100;min-width:200px;border:none;padding:5px 0;border-radius:var(--el-border-radius-small);box-shadow:var(--el-box-shadow-light)}.el-menu .el-icon{flex-shrink:0}.el-menu-item{display:flex;align-items:center;height:var(--el-menu-item-height);line-height:var(--el-menu-item-height);font-size:var(--el-menu-item-font-size);color:var(--el-menu-text-color);padding:0 var(--el-menu-base-level-padding);list-style:none;cursor:pointer;position:relative;transition:border-color var(--el-transition-duration),background-color var(--el-transition-duration),color var(--el-transition-duration);box-sizing:border-box;white-space:nowrap}.el-menu-item *{vertical-align:bottom}.el-menu-item i{color:inherit}.el-menu-item:focus,.el-menu-item:hover{outline:0}.el-menu-item:hover{background-color:var(--el-menu-hover-bg-color)}.el-menu-item.is-disabled{opacity:.25;cursor:not-allowed;background:0 0!important}.el-menu-item [class^=el-icon]{margin-right:5px;width:var(--el-menu-icon-width);text-align:center;font-size:18px;vertical-align:middle}.el-menu-item.is-active{color:var(--el-menu-active-color)}.el-menu-item.is-active i{color:inherit}.el-menu-item .el-menu-tooltip__trigger{position:absolute;left:0;top:0;height:100%;width:100%;display:inline-flex;align-items:center;box-sizing:border-box;padding:0 var(--el-menu-base-level-padding)}.el-sub-menu{list-style:none;margin:0;padding-left:0}.el-sub-menu__title{display:flex;align-items:center;height:var(--el-menu-item-height);line-height:var(--el-menu-item-height);font-size:var(--el-menu-item-font-size);color:var(--el-menu-text-color);padding:0 var(--el-menu-base-level-padding);list-style:none;cursor:pointer;position:relative;transition:border-color var(--el-transition-duration),background-color var(--el-transition-duration),color var(--el-transition-duration);box-sizing:border-box;white-space:nowrap;padding-right:calc(var(--el-menu-base-level-padding) + var(--el-menu-icon-width))}.el-sub-menu__title *{vertical-align:bottom}.el-sub-menu__title i{color:inherit}.el-sub-menu__title:focus,.el-sub-menu__title:hover{outline:0}.el-sub-menu__title.is-disabled{opacity:.25;cursor:not-allowed;background:0 0!important}.el-sub-menu__title:hover{background-color:var(--el-menu-hover-bg-color)}.el-sub-menu .el-menu{border:none}.el-sub-menu .el-menu-item{height:var(--el-menu-sub-item-height);line-height:var(--el-menu-sub-item-height)}.el-sub-menu__hide-arrow .el-sub-menu__icon-arrow{display:none!important}.el-sub-menu.is-active .el-sub-menu__title{border-bottom-color:var(--el-menu-active-color)}.el-sub-menu.is-disabled .el-menu-item,.el-sub-menu.is-disabled .el-sub-menu__title{opacity:.25;cursor:not-allowed;background:0 0!important}.el-sub-menu .el-icon{vertical-align:middle;margin-right:5px;width:var(--el-menu-icon-width);text-align:center;font-size:18px}.el-sub-menu .el-icon.el-sub-menu__icon-more{margin-right:0!important}.el-sub-menu .el-sub-menu__icon-arrow{position:absolute;top:50%;right:var(--el-menu-base-level-padding);margin-top:-6px;transition:transform var(--el-transition-duration);font-size:12px;margin-right:0;width:inherit}.el-menu-item-group>ul{padding:0}.el-menu-item-group__title{padding:7px 0 7px var(--el-menu-base-level-padding);line-height:normal;font-size:12px;color:var(--el-text-color-secondary)}.horizontal-collapse-transition .el-sub-menu__title .el-sub-menu__icon-arrow{transition:var(--el-transition-duration-fast);opacity:0}.el-message-box{--el-messagebox-title-color:var(--el-text-color-primary);--el-messagebox-width:420px;--el-messagebox-border-radius:4px;--el-messagebox-font-size:var(--el-font-size-large);--el-messagebox-content-font-size:var(--el-font-size-base);--el-messagebox-content-color:var(--el-text-color-regular);--el-messagebox-error-font-size:12px;--el-messagebox-padding-primary:15px}.el-message-box{display:inline-block;max-width:var(--el-messagebox-width);width:100%;padding-bottom:10px;vertical-align:middle;background-color:var(--el-bg-color);border-radius:var(--el-messagebox-border-radius);border:1px solid var(--el-border-color-lighter);font-size:var(--el-messagebox-font-size);box-shadow:var(--el-box-shadow-light);text-align:left;overflow:hidden;-webkit-backface-visibility:hidden;backface-visibility:hidden;box-sizing:border-box}.el-message-box:focus{outline:0!important}.el-overlay.is-message-box .el-overlay-message-box{text-align:center;position:fixed;top:0;right:0;bottom:0;left:0;padding:16px;overflow:auto}.el-overlay.is-message-box .el-overlay-message-box:after{content:"";display:inline-block;height:100%;width:0;vertical-align:middle}.el-message-box.is-draggable .el-message-box__header{cursor:move;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-message-box__header{position:relative;padding:var(--el-messagebox-padding-primary);padding-bottom:10px}.el-message-box__title{padding-left:0;margin-bottom:0;font-size:var(--el-messagebox-font-size);line-height:1;color:var(--el-messagebox-title-color)}.el-message-box__headerbtn{position:absolute;top:var(--el-messagebox-padding-primary);right:var(--el-messagebox-padding-primary);padding:0;border:none;outline:0;background:0 0;font-size:var(--el-message-close-size,16px);cursor:pointer}.el-message-box__headerbtn .el-message-box__close{color:var(--el-color-info);font-size:inherit}.el-message-box__headerbtn:focus .el-message-box__close,.el-message-box__headerbtn:hover .el-message-box__close{color:var(--el-color-primary)}.el-message-box__content{padding:10px var(--el-messagebox-padding-primary);color:var(--el-messagebox-content-color);font-size:var(--el-messagebox-content-font-size)}.el-message-box__container{position:relative}.el-message-box__input{padding-top:15px}.el-message-box__input div.invalid>input{border-color:var(--el-color-error)}.el-message-box__input div.invalid>input:focus{border-color:var(--el-color-error)}.el-message-box__status{position:absolute;top:50%;transform:translateY(-50%);font-size:24px!important}.el-message-box__status:before{padding-left:1px}.el-message-box__status.el-icon{position:absolute}.el-message-box__status+.el-message-box__message{padding-left:36px;padding-right:12px;word-break:break-word}.el-message-box__status.el-message-box-icon--success{--el-messagebox-color:var(--el-color-success);color:var(--el-messagebox-color)}.el-message-box__status.el-message-box-icon--info{--el-messagebox-color:var(--el-color-info);color:var(--el-messagebox-color)}.el-message-box__status.el-message-box-icon--warning{--el-messagebox-color:var(--el-color-warning);color:var(--el-messagebox-color)}.el-message-box__status.el-message-box-icon--error{--el-messagebox-color:var(--el-color-error);color:var(--el-messagebox-color)}.el-message-box__message{margin:0}.el-message-box__message p{margin:0;line-height:24px}.el-message-box__errormsg{color:var(--el-color-error);font-size:var(--el-messagebox-error-font-size);min-height:18px;margin-top:2px}.el-message-box__btns{padding:5px 15px 0;display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center}.el-message-box__btns button:nth-child(2){margin-left:10px}.el-message-box__btns-reverse{flex-direction:row-reverse}.el-message-box--center .el-message-box__title{position:relative;display:flex;align-items:center;justify-content:center}.el-message-box--center .el-message-box__status{position:relative;top:auto;padding-right:5px;text-align:center;transform:translateY(-1px)}.el-message-box--center .el-message-box__message{margin-left:0}.el-message-box--center .el-message-box__btns{justify-content:center}.el-message-box--center .el-message-box__content{padding-left:calc(var(--el-messagebox-padding-primary) + 12px);padding-right:calc(var(--el-messagebox-padding-primary) + 12px);text-align:center}.fade-in-linear-enter-active .el-overlay-message-box{-webkit-animation:msgbox-fade-in var(--el-transition-duration);animation:msgbox-fade-in var(--el-transition-duration)}.fade-in-linear-leave-active .el-overlay-message-box{animation:msgbox-fade-in var(--el-transition-duration) reverse}@-webkit-keyframes msgbox-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@keyframes msgbox-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@-webkit-keyframes msgbox-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@keyframes msgbox-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}.el-message{--el-message-bg-color:var(--el-color-info-light-9);--el-message-border-color:var(--el-border-color-lighter);--el-message-padding:15px 19px;--el-message-close-size:16px;--el-message-close-icon-color:var(--el-text-color-placeholder);--el-message-close-hover-color:var(--el-text-color-secondary)}.el-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;max-width:calc(100% - 32px);box-sizing:border-box;border-radius:var(--el-border-radius-base);border-width:var(--el-border-width);border-style:var(--el-border-style);border-color:var(--el-message-border-color);position:fixed;left:50%;top:20px;transform:translate(-50%);background-color:var(--el-message-bg-color);transition:opacity var(--el-transition-duration),transform .4s,top .4s;padding:var(--el-message-padding);display:flex;align-items:center}.el-message.is-center{justify-content:center}.el-message.is-closable .el-message__content{padding-right:31px}.el-message p{margin:0}.el-message--success{--el-message-bg-color:var(--el-color-success-light-9);--el-message-border-color:var(--el-color-success-light-8);--el-message-text-color:var(--el-color-success)}.el-message--success .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--success{color:var(--el-message-text-color)}.el-message--info{--el-message-bg-color:var(--el-color-info-light-9);--el-message-border-color:var(--el-color-info-light-8);--el-message-text-color:var(--el-color-info)}.el-message--info .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--info{color:var(--el-message-text-color)}.el-message--warning{--el-message-bg-color:var(--el-color-warning-light-9);--el-message-border-color:var(--el-color-warning-light-8);--el-message-text-color:var(--el-color-warning)}.el-message--warning .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--warning{color:var(--el-message-text-color)}.el-message--error{--el-message-bg-color:var(--el-color-error-light-9);--el-message-border-color:var(--el-color-error-light-8);--el-message-text-color:var(--el-color-error)}.el-message--error .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--error{color:var(--el-message-text-color)}.el-message__icon{margin-right:10px}.el-message .el-message__badge{position:absolute;top:-8px;right:-8px}.el-message__content{padding:0;font-size:14px;line-height:1}.el-message__content:focus{outline-width:0}.el-message .el-message__closeBtn{position:absolute;top:50%;right:19px;transform:translateY(-50%);cursor:pointer;color:var(--el-message-close-icon-color);font-size:var(--el-message-close-size)}.el-message .el-message__closeBtn:focus{outline-width:0}.el-message .el-message__closeBtn:hover{color:var(--el-message-close-hover-color)}.el-message-fade-enter-from,.el-message-fade-leave-to{opacity:0;transform:translate(-50%,-100%)}.el-notification{--el-notification-width:330px;--el-notification-padding:14px 26px 14px 13px;--el-notification-radius:8px;--el-notification-shadow:var(--el-box-shadow-light);--el-notification-border-color:var(--el-border-color-lighter);--el-notification-icon-size:24px;--el-notification-close-font-size:var(--el-message-close-size, 16px);--el-notification-group-margin-left:13px;--el-notification-group-margin-right:8px;--el-notification-content-font-size:var(--el-font-size-base);--el-notification-content-color:var(--el-text-color-regular);--el-notification-title-font-size:16px;--el-notification-title-color:var(--el-text-color-primary);--el-notification-close-color:var(--el-text-color-secondary);--el-notification-close-hover-color:var(--el-text-color-regular)}.el-notification{display:flex;width:var(--el-notification-width);padding:var(--el-notification-padding);border-radius:var(--el-notification-radius);box-sizing:border-box;border:1px solid var(--el-notification-border-color);position:fixed;background-color:var(--el-bg-color-overlay);box-shadow:var(--el-notification-shadow);transition:opacity var(--el-transition-duration),transform var(--el-transition-duration),left var(--el-transition-duration),right var(--el-transition-duration),top .4s,bottom var(--el-transition-duration);overflow-wrap:anywhere;overflow:hidden;z-index:9999}.el-notification.right{right:16px}.el-notification.left{left:16px}.el-notification__group{margin-left:var(--el-notification-group-margin-left);margin-right:var(--el-notification-group-margin-right)}.el-notification__title{font-weight:700;font-size:var(--el-notification-title-font-size);line-height:var(--el-notification-icon-size);color:var(--el-notification-title-color);margin:0}.el-notification__content{font-size:var(--el-notification-content-font-size);line-height:24px;margin:6px 0 0;color:var(--el-notification-content-color);text-align:justify}.el-notification__content p{margin:0}.el-notification .el-notification__icon{height:var(--el-notification-icon-size);width:var(--el-notification-icon-size);font-size:var(--el-notification-icon-size)}.el-notification .el-notification__closeBtn{position:absolute;top:18px;right:15px;cursor:pointer;color:var(--el-notification-close-color);font-size:var(--el-notification-close-font-size)}.el-notification .el-notification__closeBtn:hover{color:var(--el-notification-close-hover-color)}.el-notification .el-notification--success{--el-notification-icon-color:var(--el-color-success);color:var(--el-notification-icon-color)}.el-notification .el-notification--info{--el-notification-icon-color:var(--el-color-info);color:var(--el-notification-icon-color)}.el-notification .el-notification--warning{--el-notification-icon-color:var(--el-color-warning);color:var(--el-notification-icon-color)}.el-notification .el-notification--error{--el-notification-icon-color:var(--el-color-error);color:var(--el-notification-icon-color)}.el-notification-fade-enter-from.right{right:0;transform:translate(100%)}.el-notification-fade-enter-from.left{left:0;transform:translate(-100%)}.el-notification-fade-leave-to{opacity:0}.el-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;height:100%;background-color:var(--el-overlay-color-lighter);overflow:auto}.el-overlay .el-overlay-root{height:0}.el-page-header.is-contentful .el-page-header__main{border-top:1px solid var(--el-border-color-light);margin-top:16px}.el-page-header__header{display:flex;align-items:center;justify-content:space-between;line-height:24px}.el-page-header__left{display:flex;align-items:center;margin-right:40px;position:relative}.el-page-header__back{display:flex;align-items:center;cursor:pointer}.el-page-header__left .el-divider--vertical{margin:0 16px}.el-page-header__icon{font-size:16px;margin-right:10px;display:flex;align-items:center}.el-page-header__icon .el-icon{font-size:inherit}.el-page-header__title{font-size:14px;font-weight:500}.el-page-header__content{font-size:18px;color:var(--el-text-color-primary)}.el-page-header__breadcrumb{margin-bottom:16px}.el-pagination{--el-pagination-font-size:14px;--el-pagination-bg-color:var(--el-fill-color-blank);--el-pagination-text-color:var(--el-text-color-primary);--el-pagination-border-radius:2px;--el-pagination-button-color:var(--el-text-color-primary);--el-pagination-button-width:32px;--el-pagination-button-height:32px;--el-pagination-button-disabled-color:var(--el-text-color-placeholder);--el-pagination-button-disabled-bg-color:var(--el-fill-color-blank);--el-pagination-button-bg-color:var(--el-fill-color);--el-pagination-hover-color:var(--el-color-primary);--el-pagination-font-size-small:12px;--el-pagination-button-width-small:24px;--el-pagination-button-height-small:24px;--el-pagination-item-gap:16px;white-space:nowrap;color:var(--el-pagination-text-color);font-size:var(--el-pagination-font-size);font-weight:400;display:flex;align-items:center}.el-pagination .el-input__inner{text-align:center;-moz-appearance:textfield}.el-pagination .el-select .el-input{width:128px}.el-pagination button{display:flex;justify-content:center;align-items:center;font-size:var(--el-pagination-font-size);min-width:var(--el-pagination-button-width);height:var(--el-pagination-button-height);line-height:var(--el-pagination-button-height);color:var(--el-pagination-button-color);background:var(--el-pagination-bg-color);padding:0 4px;border:none;border-radius:var(--el-pagination-border-radius);cursor:pointer;text-align:center;box-sizing:border-box}.el-pagination button *{pointer-events:none}.el-pagination button:focus{outline:0}.el-pagination button:hover{color:var(--el-pagination-hover-color)}.el-pagination button.is-active{color:var(--el-pagination-hover-color);cursor:default;font-weight:700}.el-pagination button.is-active.is-disabled{font-weight:700;color:var(--el-text-color-secondary)}.el-pagination button.is-disabled,.el-pagination button:disabled{color:var(--el-pagination-button-disabled-color);background-color:var(--el-pagination-button-disabled-bg-color);cursor:not-allowed}.el-pagination button:focus-visible{outline:1px solid var(--el-pagination-hover-color);outline-offset:-1px}.el-pagination .btn-next .el-icon,.el-pagination .btn-prev .el-icon{display:block;font-size:12px;font-weight:700;width:inherit}.el-pagination>.is-first{margin-left:0!important}.el-pagination>.is-last{margin-right:0!important}.el-pagination .btn-prev{margin-left:var(--el-pagination-item-gap)}.el-pagination__sizes,.el-pagination__total{margin-left:var(--el-pagination-item-gap);font-weight:400;color:var(--el-text-color-regular)}.el-pagination__total[disabled=true]{color:var(--el-text-color-placeholder)}.el-pagination__jump{display:flex;align-items:center;margin-left:var(--el-pagination-item-gap);font-weight:400;color:var(--el-text-color-regular)}.el-pagination__jump[disabled=true]{color:var(--el-text-color-placeholder)}.el-pagination__goto{margin-right:8px}.el-pagination__editor{text-align:center;box-sizing:border-box}.el-pagination__editor.el-input{width:56px}.el-pagination__editor .el-input__inner::-webkit-inner-spin-button,.el-pagination__editor .el-input__inner::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.el-pagination__classifier{margin-left:8px}.el-pagination__rightwrapper{flex:1;display:flex;align-items:center;justify-content:flex-end}.el-pagination.is-background .btn-next,.el-pagination.is-background .btn-prev,.el-pagination.is-background .el-pager li{margin:0 4px;background-color:var(--el-pagination-button-bg-color)}.el-pagination.is-background .btn-next.is-active,.el-pagination.is-background .btn-prev.is-active,.el-pagination.is-background .el-pager li.is-active{background-color:var(--el-color-primary);color:var(--el-color-white)}.el-pagination.is-background .btn-next.is-disabled,.el-pagination.is-background .btn-next:disabled,.el-pagination.is-background .btn-prev.is-disabled,.el-pagination.is-background .btn-prev:disabled,.el-pagination.is-background .el-pager li.is-disabled,.el-pagination.is-background .el-pager li:disabled{color:var(--el-text-color-placeholder);background-color:var(--el-disabled-bg-color)}.el-pagination.is-background .btn-next.is-disabled.is-active,.el-pagination.is-background .btn-next:disabled.is-active,.el-pagination.is-background .btn-prev.is-disabled.is-active,.el-pagination.is-background .btn-prev:disabled.is-active,.el-pagination.is-background .el-pager li.is-disabled.is-active,.el-pagination.is-background .el-pager li:disabled.is-active{color:var(--el-text-color-secondary);background-color:var(--el-fill-color-dark)}.el-pagination.is-background .btn-prev{margin-left:var(--el-pagination-item-gap)}.el-pagination--small .btn-next,.el-pagination--small .btn-prev,.el-pagination--small .el-pager li{height:var(--el-pagination-button-height-small);line-height:var(--el-pagination-button-height-small);font-size:var(--el-pagination-font-size-small);min-width:var(--el-pagination-button-width-small)}.el-pagination--small button,.el-pagination--small span:not([class*=suffix]){font-size:var(--el-pagination-font-size-small)}.el-pagination--small .el-select .el-input{width:100px}.el-pager{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;list-style:none;font-size:0;padding:0;margin:0;display:flex;align-items:center}.el-pager li{display:flex;justify-content:center;align-items:center;font-size:var(--el-pagination-font-size);min-width:var(--el-pagination-button-width);height:var(--el-pagination-button-height);line-height:var(--el-pagination-button-height);color:var(--el-pagination-button-color);background:var(--el-pagination-bg-color);padding:0 4px;border:none;border-radius:var(--el-pagination-border-radius);cursor:pointer;text-align:center;box-sizing:border-box}.el-pager li *{pointer-events:none}.el-pager li:focus{outline:0}.el-pager li:hover{color:var(--el-pagination-hover-color)}.el-pager li.is-active{color:var(--el-pagination-hover-color);cursor:default;font-weight:700}.el-pager li.is-active.is-disabled{font-weight:700;color:var(--el-text-color-secondary)}.el-pager li.is-disabled,.el-pager li:disabled{color:var(--el-pagination-button-disabled-color);background-color:var(--el-pagination-button-disabled-bg-color);cursor:not-allowed}.el-pager li:focus-visible{outline:1px solid var(--el-pagination-hover-color);outline-offset:-1px}.el-popconfirm__main{display:flex;align-items:center}.el-popconfirm__icon{margin-right:5px}.el-popconfirm__action{text-align:right;margin-top:8px}.el-popover{--el-popover-bg-color:var(--el-bg-color-overlay);--el-popover-font-size:var(--el-font-size-base);--el-popover-border-color:var(--el-border-color-lighter);--el-popover-padding:12px;--el-popover-padding-large:18px 20px;--el-popover-title-font-size:16px;--el-popover-title-text-color:var(--el-text-color-primary);--el-popover-border-radius:4px}.el-popover.el-popper{background:var(--el-popover-bg-color);min-width:150px;border-radius:var(--el-popover-border-radius);border:1px solid var(--el-popover-border-color);padding:var(--el-popover-padding);z-index:var(--el-index-popper);color:var(--el-text-color-regular);line-height:1.4;text-align:justify;font-size:var(--el-popover-font-size);box-shadow:var(--el-box-shadow-light);word-break:break-all;box-sizing:border-box}.el-popover.el-popper--plain{padding:var(--el-popover-padding-large)}.el-popover__title{color:var(--el-popover-title-text-color);font-size:var(--el-popover-title-font-size);line-height:1;margin-bottom:12px}.el-popover__reference:focus:hover,.el-popover__reference:focus:not(.focusing){outline-width:0}.el-popover.el-popper.is-dark{--el-popover-bg-color:var(--el-text-color-primary);--el-popover-border-color:var(--el-text-color-primary);--el-popover-title-text-color:var(--el-bg-color);color:var(--el-bg-color)}.el-popover.el-popper:focus,.el-popover.el-popper:focus:active{outline-width:0}.el-progress{position:relative;line-height:1;display:flex;align-items:center}.el-progress__text{font-size:14px;color:var(--el-text-color-regular);margin-left:5px;min-width:50px;line-height:1}.el-progress__text i{vertical-align:middle;display:block}.el-progress--circle,.el-progress--dashboard{display:inline-block}.el-progress--circle .el-progress__text,.el-progress--dashboard .el-progress__text{position:absolute;top:50%;left:0;width:100%;text-align:center;margin:0;transform:translateY(-50%)}.el-progress--circle .el-progress__text i,.el-progress--dashboard .el-progress__text i{vertical-align:middle;display:inline-block}.el-progress--without-text .el-progress__text{display:none}.el-progress--without-text .el-progress-bar{padding-right:0;margin-right:0;display:block}.el-progress--text-inside .el-progress-bar{padding-right:0;margin-right:0}.el-progress.is-success .el-progress-bar__inner{background-color:var(--el-color-success)}.el-progress.is-success .el-progress__text{color:var(--el-color-success)}.el-progress.is-warning .el-progress-bar__inner{background-color:var(--el-color-warning)}.el-progress.is-warning .el-progress__text{color:var(--el-color-warning)}.el-progress.is-exception .el-progress-bar__inner{background-color:var(--el-color-danger)}.el-progress.is-exception .el-progress__text{color:var(--el-color-danger)}.el-progress-bar{flex-grow:1;box-sizing:border-box}.el-progress-bar__outer{height:6px;border-radius:100px;background-color:var(--el-border-color-lighter);overflow:hidden;position:relative;vertical-align:middle}.el-progress-bar__inner{position:absolute;left:0;top:0;height:100%;background-color:var(--el-color-primary);text-align:right;border-radius:100px;line-height:1;white-space:nowrap;transition:width .6s ease}.el-progress-bar__inner:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-progress-bar__inner--indeterminate{transform:translateZ(0);-webkit-animation:indeterminate 3s infinite;animation:indeterminate 3s infinite}.el-progress-bar__inner--striped{background-image:linear-gradient(45deg,rgba(0,0,0,.1) 25%,transparent 25%,transparent 50%,rgba(0,0,0,.1) 50%,rgba(0,0,0,.1) 75%,transparent 75%,transparent);background-size:1.25em 1.25em}.el-progress-bar__inner--striped.el-progress-bar__inner--striped-flow{-webkit-animation:striped-flow 3s linear infinite;animation:striped-flow 3s linear infinite}.el-progress-bar__innerText{display:inline-block;vertical-align:middle;color:#fff;font-size:12px;margin:0 5px}@-webkit-keyframes progress{0%{background-position:0 0}to{background-position:32px 0}}@keyframes progress{0%{background-position:0 0}to{background-position:32px 0}}@-webkit-keyframes indeterminate{0%{left:-100%}to{left:100%}}@keyframes indeterminate{0%{left:-100%}to{left:100%}}@-webkit-keyframes striped-flow{0%{background-position:-100%}to{background-position:100%}}@keyframes striped-flow{0%{background-position:-100%}to{background-position:100%}}.el-radio-button{--el-radio-button-checked-bg-color:var(--el-color-primary);--el-radio-button-checked-text-color:var(--el-color-white);--el-radio-button-checked-border-color:var(--el-color-primary);--el-radio-button-disabled-checked-fill:var(--el-border-color-extra-light)}.el-radio-button{position:relative;display:inline-block;outline:0}.el-radio-button__inner{display:inline-block;line-height:1;white-space:nowrap;vertical-align:middle;background:var(--el-button-bg-color,var(--el-fill-color-blank));border:var(--el-border);font-weight:var(--el-button-font-weight,var(--el-font-weight-primary));border-left:0;color:var(--el-button-text-color,var(--el-text-color-regular));-webkit-appearance:none;text-align:center;box-sizing:border-box;outline:0;margin:0;position:relative;cursor:pointer;transition:var(--el-transition-all);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:8px 15px;font-size:var(--el-font-size-base);border-radius:0}.el-radio-button__inner.is-round{padding:8px 15px}.el-radio-button__inner:hover{color:var(--el-color-primary)}.el-radio-button__inner [class*=el-icon-]{line-height:.9}.el-radio-button__inner [class*=el-icon-]+span{margin-left:5px}.el-radio-button:first-child .el-radio-button__inner{border-left:var(--el-border);border-radius:var(--el-border-radius-base) 0 0 var(--el-border-radius-base);box-shadow:none!important}.el-radio-button__original-radio{opacity:0;outline:0;position:absolute;z-index:-1}.el-radio-button__original-radio:checked+.el-radio-button__inner{color:var(--el-radio-button-checked-text-color,var(--el-color-white));background-color:var(--el-radio-button-checked-bg-color,var(--el-color-primary));border-color:var(--el-radio-button-checked-border-color,var(--el-color-primary));box-shadow:-1px 0 0 0 var(--el-radio-button-checked-border-color,var(--el-color-primary))}.el-radio-button__original-radio:focus-visible+.el-radio-button__inner{border-left:var(--el-border);border-left-color:var(--el-radio-button-checked-border-color,var(--el-color-primary));outline:2px solid var(--el-radio-button-checked-border-color);outline-offset:1px;z-index:2;border-radius:var(--el-border-radius-base);box-shadow:none}.el-radio-button__original-radio:disabled+.el-radio-button__inner{color:var(--el-disabled-text-color);cursor:not-allowed;background-image:none;background-color:var(--el-button-disabled-bg-color,var(--el-fill-color-blank));border-color:var(--el-button-disabled-border-color,var(--el-border-color-light));box-shadow:none}.el-radio-button__original-radio:disabled:checked+.el-radio-button__inner{background-color:var(--el-radio-button-disabled-checked-fill)}.el-radio-button:last-child .el-radio-button__inner{border-radius:0 var(--el-border-radius-base) var(--el-border-radius-base) 0}.el-radio-button:first-child:last-child .el-radio-button__inner{border-radius:var(--el-border-radius-base)}.el-radio-button--large .el-radio-button__inner{padding:12px 19px;font-size:var(--el-font-size-base);border-radius:0}.el-radio-button--large .el-radio-button__inner.is-round{padding:12px 19px}.el-radio-button--small .el-radio-button__inner{padding:5px 11px;font-size:12px;border-radius:0}.el-radio-button--small .el-radio-button__inner.is-round{padding:5px 11px}.el-radio-group{display:inline-flex;align-items:center;flex-wrap:wrap;font-size:0}.el-radio{--el-radio-font-size:var(--el-font-size-base);--el-radio-text-color:var(--el-text-color-regular);--el-radio-font-weight:var(--el-font-weight-primary);--el-radio-input-height:14px;--el-radio-input-width:14px;--el-radio-input-border-radius:var(--el-border-radius-circle);--el-radio-input-bg-color:var(--el-fill-color-blank);--el-radio-input-border:var(--el-border);--el-radio-input-border-color:var(--el-border-color);--el-radio-input-border-color-hover:var(--el-color-primary)}.el-radio{color:var(--el-radio-text-color);font-weight:var(--el-radio-font-weight);position:relative;cursor:pointer;display:inline-flex;align-items:center;white-space:nowrap;outline:0;font-size:var(--el-font-size-base);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;margin-right:32px;height:32px}.el-radio.el-radio--large{height:40px}.el-radio.el-radio--small{height:24px}.el-radio.is-bordered{padding:0 15px 0 9px;border-radius:var(--el-border-radius-base);border:var(--el-border);box-sizing:border-box}.el-radio.is-bordered.is-checked{border-color:var(--el-color-primary)}.el-radio.is-bordered.is-disabled{cursor:not-allowed;border-color:var(--el-border-color-lighter)}.el-radio.is-bordered.el-radio--large{padding:0 19px 0 11px;border-radius:var(--el-border-radius-base)}.el-radio.is-bordered.el-radio--large .el-radio__label{font-size:var(--el-font-size-base)}.el-radio.is-bordered.el-radio--large .el-radio__inner{height:14px;width:14px}.el-radio.is-bordered.el-radio--small{padding:0 11px 0 7px;border-radius:var(--el-border-radius-base)}.el-radio.is-bordered.el-radio--small .el-radio__label{font-size:12px}.el-radio.is-bordered.el-radio--small .el-radio__inner{height:12px;width:12px}.el-radio:last-child{margin-right:0}.el-radio__input{white-space:nowrap;cursor:pointer;outline:0;display:inline-flex;position:relative;vertical-align:middle}.el-radio__input.is-disabled .el-radio__inner{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color);cursor:not-allowed}.el-radio__input.is-disabled .el-radio__inner:after{cursor:not-allowed;background-color:var(--el-disabled-bg-color)}.el-radio__input.is-disabled .el-radio__inner+.el-radio__label{cursor:not-allowed}.el-radio__input.is-disabled.is-checked .el-radio__inner{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color)}.el-radio__input.is-disabled.is-checked .el-radio__inner:after{background-color:var(--el-text-color-placeholder)}.el-radio__input.is-disabled+span.el-radio__label{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-radio__input.is-checked .el-radio__inner{border-color:var(--el-color-primary);background:var(--el-color-primary)}.el-radio__input.is-checked .el-radio__inner:after{transform:translate(-50%,-50%) scale(1)}.el-radio__input.is-checked+.el-radio__label{color:var(--el-color-primary)}.el-radio__input.is-focus .el-radio__inner{border-color:var(--el-radio-input-border-color-hover)}.el-radio__inner{border:var(--el-radio-input-border);border-radius:var(--el-radio-input-border-radius);width:var(--el-radio-input-width);height:var(--el-radio-input-height);background-color:var(--el-radio-input-bg-color);position:relative;cursor:pointer;display:inline-block;box-sizing:border-box}.el-radio__inner:hover{border-color:var(--el-radio-input-border-color-hover)}.el-radio__inner:after{width:4px;height:4px;border-radius:var(--el-radio-input-border-radius);background-color:var(--el-color-white);content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%) scale(0);transition:transform .15s ease-in}.el-radio__original{opacity:0;outline:0;position:absolute;z-index:-1;top:0;left:0;right:0;bottom:0;margin:0}.el-radio__original:focus-visible+.el-radio__inner{outline:2px solid var(--el-radio-input-border-color-hover);outline-offset:1px;border-radius:var(--el-radio-input-border-radius)}.el-radio:focus:not(:focus-visible):not(.is-focus):not(:active):not(.is-disabled) .el-radio__inner{box-shadow:0 0 2px 2px var(--el-radio-input-border-color-hover)}.el-radio__label{font-size:var(--el-radio-font-size);padding-left:8px}.el-radio.el-radio--large .el-radio__label{font-size:14px}.el-radio.el-radio--large .el-radio__inner{width:14px;height:14px}.el-radio.el-radio--small .el-radio__label{font-size:12px}.el-radio.el-radio--small .el-radio__inner{width:12px;height:12px}.el-rate{--el-rate-height:20px;--el-rate-font-size:var(--el-font-size-base);--el-rate-icon-size:18px;--el-rate-icon-margin:6px;--el-rate-void-color:var(--el-border-color-darker);--el-rate-fill-color:#f7ba2a;--el-rate-disabled-void-color:var(--el-fill-color);--el-rate-text-color:var(--el-text-color-primary)}.el-rate{display:inline-flex;align-items:center;height:32px}.el-rate:active,.el-rate:focus{outline:0}.el-rate__item{cursor:pointer;display:inline-block;position:relative;font-size:0;vertical-align:middle;color:var(--el-rate-void-color);line-height:normal}.el-rate .el-rate__icon{position:relative;display:inline-block;font-size:var(--el-rate-icon-size);margin-right:var(--el-rate-icon-margin);transition:var(--el-transition-duration)}.el-rate .el-rate__icon.hover{transform:scale(1.15)}.el-rate .el-rate__icon .path2{position:absolute;left:0;top:0}.el-rate .el-rate__icon.is-active{color:var(--el-rate-fill-color)}.el-rate__decimal{position:absolute;top:0;left:0;display:inline-block;overflow:hidden;color:var(--el-rate-fill-color)}.el-rate__text{font-size:var(--el-rate-font-size);vertical-align:middle;color:var(--el-rate-text-color)}.el-rate--large{height:40px}.el-rate--small{height:24px}.el-rate--small .el-rate__icon{font-size:14px}.el-rate.is-disabled .el-rate__item{cursor:auto;color:var(--el-rate-disabled-void-color)}.el-result{--el-result-padding:40px 30px;--el-result-icon-font-size:64px;--el-result-title-font-size:20px;--el-result-title-margin-top:20px;--el-result-subtitle-margin-top:10px;--el-result-extra-margin-top:30px}.el-result{display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;box-sizing:border-box;padding:var(--el-result-padding)}.el-result__icon svg{width:var(--el-result-icon-font-size);height:var(--el-result-icon-font-size)}.el-result__title{margin-top:var(--el-result-title-margin-top)}.el-result__title p{margin:0;font-size:var(--el-result-title-font-size);color:var(--el-text-color-primary);line-height:1.3}.el-result__subtitle{margin-top:var(--el-result-subtitle-margin-top)}.el-result__subtitle p{margin:0;font-size:var(--el-font-size-base);color:var(--el-text-color-regular);line-height:1.3}.el-result__extra{margin-top:var(--el-result-extra-margin-top)}.el-result .icon-primary{--el-result-color:var(--el-color-primary);color:var(--el-result-color)}.el-result .icon-success{--el-result-color:var(--el-color-success);color:var(--el-result-color)}.el-result .icon-warning{--el-result-color:var(--el-color-warning);color:var(--el-result-color)}.el-result .icon-danger{--el-result-color:var(--el-color-danger);color:var(--el-result-color)}.el-result .icon-error{--el-result-color:var(--el-color-error);color:var(--el-result-color)}.el-result .icon-info{--el-result-color:var(--el-color-info);color:var(--el-result-color)}.el-row{display:flex;flex-wrap:wrap;position:relative;box-sizing:border-box}.el-row.is-justify-center{justify-content:center}.el-row.is-justify-end{justify-content:flex-end}.el-row.is-justify-space-between{justify-content:space-between}.el-row.is-justify-space-around{justify-content:space-around}.el-row.is-justify-space-evenly{justify-content:space-evenly}.el-row.is-align-middle{align-items:center}.el-row.is-align-bottom{align-items:flex-end}.el-scrollbar{--el-scrollbar-opacity:.3;--el-scrollbar-bg-color:var(--el-text-color-secondary);--el-scrollbar-hover-opacity:.5;--el-scrollbar-hover-bg-color:var(--el-text-color-secondary)}.el-scrollbar{overflow:hidden;position:relative;height:100%}.el-scrollbar__wrap{overflow:auto;height:100%}.el-scrollbar__wrap--hidden-default{scrollbar-width:none}.el-scrollbar__wrap--hidden-default::-webkit-scrollbar{display:none}.el-scrollbar__thumb{position:relative;display:block;width:0;height:0;cursor:pointer;border-radius:inherit;background-color:var(--el-scrollbar-bg-color,var(--el-text-color-secondary));transition:var(--el-transition-duration) background-color;opacity:var(--el-scrollbar-opacity,.3)}.el-scrollbar__thumb:hover{background-color:var(--el-scrollbar-hover-bg-color,var(--el-text-color-secondary));opacity:var(--el-scrollbar-hover-opacity,.5)}.el-scrollbar__bar{position:absolute;right:2px;bottom:2px;z-index:1;border-radius:4px}.el-scrollbar__bar.is-vertical{width:6px;top:2px}.el-scrollbar__bar.is-vertical>div{width:100%}.el-scrollbar__bar.is-horizontal{height:6px;left:2px}.el-scrollbar__bar.is-horizontal>div{height:100%}.el-scrollbar-fade-enter-active{transition:opacity .34s ease-out}.el-scrollbar-fade-leave-active{transition:opacity .12s ease-out}.el-scrollbar-fade-enter-from,.el-scrollbar-fade-leave-active{opacity:0}.el-select-dropdown{z-index:calc(var(--el-index-top) + 1);border-radius:var(--el-border-radius-base);box-sizing:border-box}.el-select-dropdown .el-scrollbar.is-empty .el-select-dropdown__list{padding:0}.el-select-dropdown__option-item.is-selected:not(.is-multiple).is-disabled{color:var(--el-text-color-disabled)}.el-select-dropdown__option-item.is-selected:not(.is-multiple).is-disabled:after{background-color:var(--el-text-color-disabled)}.el-select-dropdown__option-item:hover:not(.hover){background-color:transparent}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-disabled.is-selected{color:var(--el-text-color-disabled)}.el-select-dropdown__empty{padding:10px 0;margin:0;text-align:center;color:var(--el-text-color-secondary);font-size:var(--el-select-font-size)}.el-select-dropdown__wrap{max-height:274px}.el-select-dropdown__list{list-style:none;margin:6px 0!important;padding:0!important;box-sizing:border-box}.el-select-dropdown__option-item{font-size:var(--el-select-font-size);padding:0 32px 0 20px;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--el-text-color-regular);height:34px;line-height:34px;box-sizing:border-box;cursor:pointer}.el-select-dropdown__option-item.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-select-dropdown__option-item.is-disabled:hover{background-color:var(--el-bg-color)}.el-select-dropdown__option-item.is-selected{background-color:var(--el-fill-color-light);font-weight:700}.el-select-dropdown__option-item.is-selected:not(.is-multiple){color:var(--el-color-primary)}.el-select-dropdown__option-item.hover{background-color:var(--el-fill-color-light)!important}.el-select-dropdown__option-item:hover{background-color:var(--el-fill-color-light)}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-selected{color:var(--el-color-primary);background-color:var(--el-bg-color-overlay)}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-selected .el-icon{position:absolute;right:20px;top:0;height:inherit;font-size:12px}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-selected .el-icon svg{height:inherit;vertical-align:middle}.el-select-group{margin:0;padding:0}.el-select-group__wrap{position:relative;list-style:none;margin:0;padding:0}.el-select-group__wrap:not(:last-of-type){padding-bottom:24px}.el-select-group__wrap:not(:last-of-type):after{content:"";position:absolute;display:block;left:20px;right:20px;bottom:12px;height:1px;background:var(--el-border-color-light)}.el-select-group__split-dash{position:absolute;left:20px;right:20px;height:1px;background:var(--el-border-color-light)}.el-select-group__title{padding-left:20px;font-size:12px;color:var(--el-color-info);line-height:30px}.el-select-group .el-select-dropdown__item{padding-left:20px}.el-select-v2{--el-select-border-color-hover:var(--el-border-color-hover);--el-select-disabled-border:var(--el-disabled-border-color);--el-select-font-size:var(--el-font-size-base);--el-select-close-hover-color:var(--el-text-color-secondary);--el-select-input-color:var(--el-text-color-placeholder);--el-select-multiple-input-color:var(--el-text-color-regular);--el-select-input-focus-border-color:var(--el-color-primary);--el-select-input-font-size:14px}.el-select-v2{display:inline-block;position:relative;vertical-align:middle;font-size:14px}.el-select-v2__wrapper{display:flex;align-items:center;flex-wrap:wrap;position:relative;box-sizing:border-box;cursor:pointer;padding:1px 30px 1px 0;border:1px solid var(--el-border-color);border-radius:var(--el-border-radius-base);background-color:var(--el-fill-color-blank);transition:var(--el-transition-duration)}.el-select-v2__wrapper:hover{border-color:var(--el-text-color-placeholder)}.el-select-v2__wrapper.is-filterable{cursor:text}.el-select-v2__wrapper.is-focused{border-color:var(--el-color-primary)}.el-select-v2__wrapper.is-hovering:not(.is-focused){border-color:var(--el-border-color-hover)}.el-select-v2__wrapper.is-disabled{cursor:not-allowed;background-color:var(--el-fill-color-light);color:var(--el-text-color-placeholder);border-color:var(--el-select-disabled-border)}.el-select-v2__wrapper.is-disabled:hover{border-color:var(--el-select-disabled-border)}.el-select-v2__wrapper.is-disabled.is-focus{border-color:var(--el-input-focus-border-color)}.el-select-v2__wrapper.is-disabled .is-transparent{opacity:1;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-select-v2__wrapper.is-disabled .el-select-v2__caret,.el-select-v2__wrapper.is-disabled .el-select-v2__combobox-input{cursor:not-allowed}.el-select-v2__wrapper .el-select-v2__input-wrapper{box-sizing:border-box;position:relative;-webkit-margin-start:12px;margin-inline-start:12px;max-width:100%;overflow:hidden}.el-select-v2__wrapper,.el-select-v2__wrapper .el-select-v2__input-wrapper{line-height:32px}.el-select-v2__wrapper .el-select-v2__input-wrapper input{--el-input-inner-height:calc(var(--el-component-size, 32px) - 8px);height:var(--el-input-inner-height);line-height:var(--el-input-inner-height);min-width:4px;width:100%;background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:0 0;border:none;margin:2px 0;outline:0;padding:0}.el-select-v2 .el-select-v2__tags-text{display:inline-block;line-height:normal;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-select-v2__empty{padding:10px 0;margin:0;text-align:center;color:var(--el-text-color-secondary);font-size:14px}.el-select-v2__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-box-shadow-light)}.el-select-v2__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-select-v2__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-select-v2__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-select-v2__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-select-v2__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-select-v2--large .el-select-v2__wrapper .el-select-v2__combobox-input{height:32px}.el-select-v2--large .el-select-v2__caret,.el-select-v2--large .el-select-v2__suffix{height:40px}.el-select-v2--large .el-select-v2__placeholder{font-size:14px;line-height:40px}.el-select-v2--small .el-select-v2__wrapper .el-select-v2__combobox-input{height:16px}.el-select-v2--small .el-select-v2__caret,.el-select-v2--small .el-select-v2__suffix{height:24px}.el-select-v2--small .el-select-v2__placeholder{font-size:12px;line-height:24px}.el-select-v2 .el-select-v2__selection>span{display:inline-block}.el-select-v2:hover .el-select-v2__combobox-input{border-color:var(--el-select-border-color-hover)}.el-select-v2 .el-select__selection-text{text-overflow:ellipsis;display:inline-block;overflow-x:hidden;vertical-align:bottom}.el-select-v2 .el-select-v2__combobox-input{padding-right:35px;display:block;color:var(--el-text-color-regular)}.el-select-v2 .el-select-v2__combobox-input:focus{border-color:var(--el-select-input-focus-border-color)}.el-select-v2__input{border:none;outline:0;padding:0;margin-left:15px;color:var(--el-select-multiple-input-color);font-size:var(--el-select-font-size);-webkit-appearance:none;-moz-appearance:none;appearance:none;height:28px}.el-select-v2__input.is-small{height:14px}.el-select-v2__close{cursor:pointer;position:absolute;top:8px;z-index:var(--el-index-top);right:25px;color:var(--el-select-input-color);line-height:18px;font-size:var(--el-select-input-font-size)}.el-select-v2__close:hover{color:var(--el-select-close-hover-color)}.el-select-v2__suffix{display:inline-flex;position:absolute;right:12px;height:32px;top:50%;transform:translateY(-50%);color:var(--el-input-icon-color,var(--el-text-color-placeholder))}.el-select-v2__suffix .el-input__icon{height:inherit}.el-select-v2__suffix .el-input__icon:not(:first-child){margin-left:8px}.el-select-v2__caret{color:var(--el-select-input-color);font-size:var(--el-select-input-font-size);transition:var(--el-transition-duration);transform:rotate(180deg);cursor:pointer}.el-select-v2__caret.is-reverse{transform:rotate(0)}.el-select-v2__caret.is-show-close{font-size:var(--el-select-font-size);text-align:center;transform:rotate(180deg);border-radius:var(--el-border-radius-circle);color:var(--el-select-input-color);transition:var(--el-transition-color)}.el-select-v2__caret.is-show-close:hover{color:var(--el-select-close-hover-color)}.el-select-v2__caret.el-icon{height:inherit}.el-select-v2__caret.el-icon svg{vertical-align:middle}.el-select-v2__selection{white-space:normal;z-index:var(--el-index-normal);display:flex;align-items:center;flex-wrap:wrap;width:100%}.el-select-v2__input-calculator{left:0;position:absolute;top:0;visibility:hidden;white-space:pre;z-index:999}.el-select-v2__selected-item{line-height:inherit;height:inherit;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-wrap:wrap}.el-select-v2__placeholder{position:absolute;top:50%;transform:translateY(-50%);-webkit-margin-start:12px;margin-inline-start:12px;width:calc(100% - 52px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--el-input-text-color,var(--el-text-color-regular))}.el-select-v2__placeholder.is-transparent{color:var(--el-text-color-placeholder)}.el-select-v2 .el-select-v2__selection .el-tag{box-sizing:border-box;border-color:transparent;margin:2px 0 2px 6px;background-color:var(--el-fill-color)}.el-select-v2 .el-select-v2__selection .el-tag .el-icon-close{background-color:var(--el-text-color-placeholder);right:-7px;color:var(--el-color-white)}.el-select-v2 .el-select-v2__selection .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-select-v2 .el-select-v2__selection .el-tag .el-icon-close:before{display:block;transform:translateY(.5px)}.el-select-v2.el-select-v2--small .el-select-v2__selection .el-tag{margin:1px 0 1px 6px;height:18px}.el-select-dropdown{z-index:calc(var(--el-index-top) + 1);border-radius:var(--el-border-radius-base);box-sizing:border-box}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected{color:var(--el-color-primary);background-color:var(--el-bg-color-overlay)}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected.hover{background-color:var(--el-fill-color-light)}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected:after{content:"";position:absolute;top:50%;right:20px;border-top:none;border-right:none;background-repeat:no-repeat;background-position:center;background-color:var(--el-color-primary);-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask-size:100% 100%;-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;-webkit-mask-size:100% 100%;transform:translateY(-50%);width:12px;height:12px}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected.is-disabled:after{background-color:var(--el-text-color-disabled)}.el-select-dropdown .el-select-dropdown__option-item.is-selected:after{content:"";position:absolute;top:50%;right:20px;border-top:none;border-right:none;background-repeat:no-repeat;background-position:center;background-color:var(--el-color-primary);-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask-size:100% 100%;-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;-webkit-mask-size:100% 100%;transform:translateY(-50%);width:12px;height:12px}.el-select-dropdown .el-scrollbar.is-empty .el-select-dropdown__list{padding:0}.el-select-dropdown .el-select-dropdown__item.is-disabled:hover{background-color:unset}.el-select-dropdown .el-select-dropdown__item.is-disabled.selected{color:var(--el-text-color-disabled)}.el-select-dropdown__empty{padding:10px 0;margin:0;text-align:center;color:var(--el-text-color-secondary);font-size:var(--el-select-font-size)}.el-select-dropdown__wrap{max-height:274px}.el-select-dropdown__list{list-style:none;padding:6px 0;margin:0;box-sizing:border-box}.el-select{--el-select-border-color-hover:var(--el-border-color-hover);--el-select-disabled-border:var(--el-disabled-border-color);--el-select-font-size:var(--el-font-size-base);--el-select-close-hover-color:var(--el-text-color-secondary);--el-select-input-color:var(--el-text-color-placeholder);--el-select-multiple-input-color:var(--el-text-color-regular);--el-select-input-focus-border-color:var(--el-color-primary);--el-select-input-font-size:14px}.el-select{display:inline-block;position:relative;vertical-align:middle;line-height:32px}.el-select__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-box-shadow-light)}.el-select__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-select__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-select__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-select__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-select__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-select .el-select-tags-wrapper.has-prefix{margin-left:6px}.el-select--large{line-height:40px}.el-select--large .el-select-tags-wrapper.has-prefix{margin-left:8px}.el-select--small{line-height:24px}.el-select--small .el-select-tags-wrapper.has-prefix{margin-left:4px}.el-select .el-select__tags>span{display:inline-block}.el-select:hover:not(.el-select--disabled) .el-input__wrapper{box-shadow:0 0 0 1px var(--el-select-border-color-hover) inset}.el-select .el-select__tags-text{display:inline-block;line-height:normal;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-select .el-input__wrapper{cursor:pointer}.el-select .el-input__wrapper.is-focus{box-shadow:0 0 0 1px var(--el-select-input-focus-border-color) inset!important}.el-select .el-input__inner{cursor:pointer}.el-select .el-input{display:flex}.el-select .el-input .el-select__caret{color:var(--el-select-input-color);font-size:var(--el-select-input-font-size);transition:transform var(--el-transition-duration);transform:rotate(0);cursor:pointer}.el-select .el-input .el-select__caret.is-reverse{transform:rotate(-180deg)}.el-select .el-input .el-select__caret.is-show-close{font-size:var(--el-select-font-size);text-align:center;transform:rotate(0);border-radius:var(--el-border-radius-circle);color:var(--el-select-input-color);transition:var(--el-transition-color)}.el-select .el-input .el-select__caret.is-show-close:hover{color:var(--el-select-close-hover-color)}.el-select .el-input .el-select__caret.el-icon{position:relative;height:inherit;z-index:2}.el-select .el-input.is-disabled .el-input__wrapper{cursor:not-allowed}.el-select .el-input.is-disabled .el-input__wrapper:hover{box-shadow:0 0 0 1px var(--el-select-disabled-border) inset}.el-select .el-input.is-disabled .el-input__inner,.el-select .el-input.is-disabled .el-select__caret{cursor:not-allowed}.el-select .el-input.is-focus .el-input__wrapper{box-shadow:0 0 0 1px var(--el-select-input-focus-border-color) inset!important}.el-select__input{border:none;outline:0;padding:0;margin-left:15px;color:var(--el-select-multiple-input-color);font-size:var(--el-select-font-size);-webkit-appearance:none;-moz-appearance:none;appearance:none;height:28px;background-color:transparent}.el-select__input.is-disabled{cursor:not-allowed}.el-select__input--iOS{position:absolute;left:0;top:0;z-index:6}.el-select__input.is-small{height:14px}.el-select__close{cursor:pointer;position:absolute;top:8px;z-index:var(--el-index-top);right:25px;color:var(--el-select-input-color);line-height:18px;font-size:var(--el-select-input-font-size)}.el-select__close:hover{color:var(--el-select-close-hover-color)}.el-select__tags{position:absolute;line-height:normal;top:50%;transform:translateY(-50%);white-space:normal;z-index:var(--el-index-normal);display:flex;align-items:center;flex-wrap:wrap;cursor:pointer}.el-select__tags .el-tag{box-sizing:border-box;border-color:transparent;margin:2px 6px 2px 0}.el-select__tags .el-tag:last-child{margin-right:0}.el-select__tags .el-tag .el-icon-close{background-color:var(--el-text-color-placeholder);right:-7px;top:0;color:#fff}.el-select__tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-select__tags .el-tag .el-icon-close:before{display:block;transform:translateY(.5px)}.el-select__tags .el-tag--info{background-color:var(--el-fill-color)}.el-select__tags.is-disabled{cursor:not-allowed}.el-select__collapse-tags{white-space:normal;z-index:var(--el-index-normal);display:flex;align-items:center;flex-wrap:wrap;cursor:pointer}.el-select__collapse-tags .el-tag{box-sizing:border-box;border-color:transparent;margin:2px 6px 2px 0}.el-select__collapse-tags .el-tag:last-child{margin-right:0}.el-select__collapse-tags .el-tag .el-icon-close{background-color:var(--el-text-color-placeholder);right:-7px;top:0;color:#fff}.el-select__collapse-tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-select__collapse-tags .el-tag .el-icon-close:before{display:block;transform:translateY(.5px)}.el-select__collapse-tags .el-tag--info{background-color:var(--el-fill-color)}.el-select__collapse-tag{line-height:inherit;height:inherit;display:flex}.el-skeleton{--el-skeleton-circle-size:var(--el-avatar-size)}.el-skeleton__item{background:var(--el-skeleton-color);display:inline-block;height:16px;border-radius:var(--el-border-radius-base);width:100%}.el-skeleton__circle{border-radius:50%;width:var(--el-skeleton-circle-size);height:var(--el-skeleton-circle-size);line-height:var(--el-skeleton-circle-size)}.el-skeleton__button{height:40px;width:64px;border-radius:4px}.el-skeleton__p{width:100%}.el-skeleton__p.is-last{width:61%}.el-skeleton__p.is-first{width:33%}.el-skeleton__text{width:100%;height:var(--el-font-size-small)}.el-skeleton__caption{height:var(--el-font-size-extra-small)}.el-skeleton__h1{height:var(--el-font-size-extra-large)}.el-skeleton__h3{height:var(--el-font-size-large)}.el-skeleton__h5{height:var(--el-font-size-medium)}.el-skeleton__image{width:unset;display:flex;align-items:center;justify-content:center;border-radius:0}.el-skeleton__image svg{color:var(--el-svg-monochrome-grey);fill:currentColor;width:22%;height:22%}.el-skeleton{--el-skeleton-color:var(--el-fill-color);--el-skeleton-to-color:var(--el-fill-color-darker)}@-webkit-keyframes el-skeleton-loading{0%{background-position:100% 50%}to{background-position:0 50%}}@keyframes el-skeleton-loading{0%{background-position:100% 50%}to{background-position:0 50%}}.el-skeleton{width:100%}.el-skeleton__first-line,.el-skeleton__paragraph{height:16px;margin-top:16px;background:var(--el-skeleton-color)}.el-skeleton.is-animated .el-skeleton__item{background:linear-gradient(90deg,var(--el-skeleton-color) 25%,var(--el-skeleton-to-color) 37%,var(--el-skeleton-color) 63%);background-size:400% 100%;-webkit-animation:el-skeleton-loading 1.4s ease infinite;animation:el-skeleton-loading 1.4s ease infinite}.el-slider{--el-slider-main-bg-color:var(--el-color-primary);--el-slider-runway-bg-color:var(--el-border-color-light);--el-slider-stop-bg-color:var(--el-color-white);--el-slider-disabled-color:var(--el-text-color-placeholder);--el-slider-border-radius:3px;--el-slider-height:6px;--el-slider-button-size:20px;--el-slider-button-wrapper-size:36px;--el-slider-button-wrapper-offset:-15px}.el-slider{width:100%;height:32px;display:flex;align-items:center}.el-slider__runway{flex:1;height:var(--el-slider-height);background-color:var(--el-slider-runway-bg-color);border-radius:var(--el-slider-border-radius);position:relative;cursor:pointer}.el-slider__runway.show-input{margin-right:30px;width:auto}.el-slider__runway.is-disabled{cursor:default}.el-slider__runway.is-disabled .el-slider__bar{background-color:var(--el-slider-disabled-color)}.el-slider__runway.is-disabled .el-slider__button{border-color:var(--el-slider-disabled-color)}.el-slider__runway.is-disabled .el-slider__button-wrapper.hover,.el-slider__runway.is-disabled .el-slider__button-wrapper:hover,.el-slider__runway.is-disabled .el-slider__button-wrapper.dragging{cursor:not-allowed}.el-slider__runway.is-disabled .el-slider__button.dragging,.el-slider__runway.is-disabled .el-slider__button.hover,.el-slider__runway.is-disabled .el-slider__button:hover{transform:scale(1)}.el-slider__runway.is-disabled .el-slider__button.hover,.el-slider__runway.is-disabled .el-slider__button:hover,.el-slider__runway.is-disabled .el-slider__button.dragging{cursor:not-allowed}.el-slider__input{flex-shrink:0;width:130px}.el-slider__bar{height:var(--el-slider-height);background-color:var(--el-slider-main-bg-color);border-top-left-radius:var(--el-slider-border-radius);border-bottom-left-radius:var(--el-slider-border-radius);position:absolute}.el-slider__button-wrapper{height:var(--el-slider-button-wrapper-size);width:var(--el-slider-button-wrapper-size);position:absolute;z-index:1;top:var(--el-slider-button-wrapper-offset);transform:translate(-50%);background-color:transparent;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;line-height:normal;outline:0}.el-slider__button-wrapper:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-slider__button-wrapper.hover,.el-slider__button-wrapper:hover{cursor:-webkit-grab;cursor:grab}.el-slider__button-wrapper.dragging{cursor:-webkit-grabbing;cursor:grabbing}.el-slider__button{display:inline-block;width:var(--el-slider-button-size);height:var(--el-slider-button-size);vertical-align:middle;border:solid 2px var(--el-slider-main-bg-color);background-color:var(--el-color-white);border-radius:50%;box-sizing:border-box;transition:var(--el-transition-duration-fast);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-slider__button.dragging,.el-slider__button.hover,.el-slider__button:hover{transform:scale(1.2)}.el-slider__button.hover,.el-slider__button:hover{cursor:-webkit-grab;cursor:grab}.el-slider__button.dragging{cursor:-webkit-grabbing;cursor:grabbing}.el-slider__stop{position:absolute;height:var(--el-slider-height);width:var(--el-slider-height);border-radius:var(--el-border-radius-circle);background-color:var(--el-slider-stop-bg-color);transform:translate(-50%)}.el-slider__marks{top:0;left:12px;width:18px;height:100%}.el-slider__marks-text{position:absolute;transform:translate(-50%);font-size:14px;color:var(--el-color-info);margin-top:15px;white-space:pre}.el-slider.is-vertical{position:relative;display:inline-flex;width:auto;height:100%;flex:0}.el-slider.is-vertical .el-slider__runway{width:var(--el-slider-height);height:100%;margin:0 16px}.el-slider.is-vertical .el-slider__bar{width:var(--el-slider-height);height:auto;border-radius:0 0 3px 3px}.el-slider.is-vertical .el-slider__button-wrapper{top:auto;left:var(--el-slider-button-wrapper-offset);transform:translateY(50%)}.el-slider.is-vertical .el-slider__stop{transform:translateY(50%)}.el-slider.is-vertical .el-slider__marks-text{margin-top:0;left:15px;transform:translateY(50%)}.el-slider--large{height:40px}.el-slider--small{height:24px}.el-space{display:inline-flex;vertical-align:top}.el-space__item{display:flex;flex-wrap:wrap}.el-space__item>*{flex:1}.el-space--vertical{flex-direction:column}.el-time-spinner{width:100%;white-space:nowrap}.el-spinner{display:inline-block;vertical-align:middle}.el-spinner-inner{-webkit-animation:rotate 2s linear infinite;animation:rotate 2s linear infinite;width:50px;height:50px}.el-spinner-inner .path{stroke:var(--el-border-color-lighter);stroke-linecap:round;-webkit-animation:dash 1.5s ease-in-out infinite;animation:dash 1.5s ease-in-out infinite}@-webkit-keyframes rotate{to{transform:rotate(360deg)}}@keyframes rotate{to{transform:rotate(360deg)}}@-webkit-keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}.el-step{position:relative;flex-shrink:1}.el-step:last-of-type .el-step__line{display:none}.el-step:last-of-type.is-flex{flex-basis:auto!important;flex-shrink:0;flex-grow:0}.el-step:last-of-type .el-step__description,.el-step:last-of-type .el-step__main{padding-right:0}.el-step__head{position:relative;width:100%}.el-step__head.is-process{color:var(--el-text-color-primary);border-color:var(--el-text-color-primary)}.el-step__head.is-wait{color:var(--el-text-color-placeholder);border-color:var(--el-text-color-placeholder)}.el-step__head.is-success{color:var(--el-color-success);border-color:var(--el-color-success)}.el-step__head.is-error{color:var(--el-color-danger);border-color:var(--el-color-danger)}.el-step__head.is-finish{color:var(--el-color-primary);border-color:var(--el-color-primary)}.el-step__icon{position:relative;z-index:1;display:inline-flex;justify-content:center;align-items:center;width:24px;height:24px;font-size:14px;box-sizing:border-box;background:var(--el-bg-color);transition:.15s ease-out}.el-step__icon.is-text{border-radius:50%;border:2px solid;border-color:inherit}.el-step__icon.is-icon{width:40px}.el-step__icon-inner{display:inline-block;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-align:center;font-weight:700;line-height:1;color:inherit}.el-step__icon-inner[class*=el-icon]:not(.is-status){font-size:25px;font-weight:400}.el-step__icon-inner.is-status{transform:translateY(1px)}.el-step__line{position:absolute;border-color:inherit;background-color:var(--el-text-color-placeholder)}.el-step__line-inner{display:block;border-width:1px;border-style:solid;border-color:inherit;transition:.15s ease-out;box-sizing:border-box;width:0;height:0}.el-step__main{white-space:normal;text-align:left}.el-step__title{font-size:16px;line-height:38px}.el-step__title.is-process{font-weight:700;color:var(--el-text-color-primary)}.el-step__title.is-wait{color:var(--el-text-color-placeholder)}.el-step__title.is-success{color:var(--el-color-success)}.el-step__title.is-error{color:var(--el-color-danger)}.el-step__title.is-finish{color:var(--el-color-primary)}.el-step__description{padding-right:10%;margin-top:-5px;font-size:12px;line-height:20px;font-weight:400}.el-step__description.is-process{color:var(--el-text-color-primary)}.el-step__description.is-wait{color:var(--el-text-color-placeholder)}.el-step__description.is-success{color:var(--el-color-success)}.el-step__description.is-error{color:var(--el-color-danger)}.el-step__description.is-finish{color:var(--el-color-primary)}.el-step.is-horizontal{display:inline-block}.el-step.is-horizontal .el-step__line{height:2px;top:11px;left:0;right:0}.el-step.is-vertical{display:flex}.el-step.is-vertical .el-step__head{flex-grow:0;width:24px}.el-step.is-vertical .el-step__main{padding-left:10px;flex-grow:1}.el-step.is-vertical .el-step__title{line-height:24px;padding-bottom:8px}.el-step.is-vertical .el-step__line{width:2px;top:0;bottom:0;left:11px}.el-step.is-vertical .el-step__icon.is-icon{width:24px}.el-step.is-center .el-step__head,.el-step.is-center .el-step__main{text-align:center}.el-step.is-center .el-step__description{padding-left:20%;padding-right:20%}.el-step.is-center .el-step__line{left:50%;right:-50%}.el-step.is-simple{display:flex;align-items:center}.el-step.is-simple .el-step__head{width:auto;font-size:0;padding-right:10px}.el-step.is-simple .el-step__icon{background:0 0;width:16px;height:16px;font-size:12px}.el-step.is-simple .el-step__icon-inner[class*=el-icon]:not(.is-status){font-size:18px}.el-step.is-simple .el-step__icon-inner.is-status{transform:scale(.8) translateY(1px)}.el-step.is-simple .el-step__main{position:relative;display:flex;align-items:stretch;flex-grow:1}.el-step.is-simple .el-step__title{font-size:16px;line-height:20px}.el-step.is-simple:not(:last-of-type) .el-step__title{max-width:50%;word-break:break-all}.el-step.is-simple .el-step__arrow{flex-grow:1;display:flex;align-items:center;justify-content:center}.el-step.is-simple .el-step__arrow:after,.el-step.is-simple .el-step__arrow:before{content:"";display:inline-block;position:absolute;height:15px;width:1px;background:var(--el-text-color-placeholder)}.el-step.is-simple .el-step__arrow:before{transform:rotate(-45deg) translateY(-4px);transform-origin:0 0}.el-step.is-simple .el-step__arrow:after{transform:rotate(45deg) translateY(4px);transform-origin:100% 100%}.el-step.is-simple:last-of-type .el-step__arrow{display:none}.el-steps{display:flex}.el-steps--simple{padding:13px 8%;border-radius:4px;background:var(--el-fill-color-light)}.el-steps--horizontal{white-space:nowrap}.el-steps--vertical{height:100%;flex-flow:column}.el-switch{--el-switch-on-color:var(--el-color-primary);--el-switch-off-color:var(--el-border-color)}.el-switch{display:inline-flex;align-items:center;position:relative;font-size:14px;line-height:20px;height:32px;vertical-align:middle}.el-switch.is-disabled .el-switch__core,.el-switch.is-disabled .el-switch__label{cursor:not-allowed}.el-switch__label{transition:var(--el-transition-duration-fast);height:20px;display:inline-block;font-size:14px;font-weight:500;cursor:pointer;vertical-align:middle;color:var(--el-text-color-primary)}.el-switch__label.is-active{color:var(--el-color-primary)}.el-switch__label--left{margin-right:10px}.el-switch__label--right{margin-left:10px}.el-switch__label *{line-height:1;font-size:14px;display:inline-block}.el-switch__label .el-icon{height:inherit}.el-switch__label .el-icon svg{vertical-align:middle}.el-switch__input{position:absolute;width:0;height:0;opacity:0;margin:0}.el-switch__input:focus-visible~.el-switch__core{outline:2px solid var(--el-switch-on-color);outline-offset:1px}.el-switch__core{display:inline-flex;position:relative;align-items:center;min-width:40px;height:20px;border:1px solid var(--el-switch-border-color,var(--el-switch-off-color));outline:0;border-radius:10px;box-sizing:border-box;background:var(--el-switch-off-color);cursor:pointer;transition:border-color var(--el-transition-duration),background-color var(--el-transition-duration)}.el-switch__core .el-switch__inner{width:100%;transition:all var(--el-transition-duration);height:16px;display:flex;justify-content:center;align-items:center;overflow:hidden;padding:0 4px 0 18px}.el-switch__core .el-switch__inner .is-icon,.el-switch__core .el-switch__inner .is-text{font-size:12px;color:var(--el-color-white);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-switch__core .el-switch__action{position:absolute;left:1px;border-radius:var(--el-border-radius-circle);transition:all var(--el-transition-duration);width:16px;height:16px;background-color:var(--el-color-white);display:flex;justify-content:center;align-items:center;color:var(--el-switch-off-color)}.el-switch.is-checked .el-switch__core{border-color:var(--el-switch-border-color,var(--el-switch-on-color));background-color:var(--el-switch-on-color)}.el-switch.is-checked .el-switch__core .el-switch__action{left:calc(100% - 17px);color:var(--el-switch-on-color)}.el-switch.is-checked .el-switch__core .el-switch__inner{padding:0 18px 0 4px}.el-switch.is-disabled{opacity:.6}.el-switch--wide .el-switch__label.el-switch__label--left span{left:10px}.el-switch--wide .el-switch__label.el-switch__label--right span{right:10px}.el-switch .label-fade-enter-from,.el-switch .label-fade-leave-active{opacity:0}.el-switch--large{font-size:14px;line-height:24px;height:40px}.el-switch--large .el-switch__label{height:24px;font-size:14px}.el-switch--large .el-switch__label *{font-size:14px}.el-switch--large .el-switch__core{min-width:50px;height:24px;border-radius:12px}.el-switch--large .el-switch__core .el-switch__inner{height:20px;padding:0 6px 0 22px}.el-switch--large .el-switch__core .el-switch__action{width:20px;height:20px}.el-switch--large.is-checked .el-switch__core .el-switch__action{left:calc(100% - 21px)}.el-switch--large.is-checked .el-switch__core .el-switch__inner{padding:0 22px 0 6px}.el-switch--small{font-size:12px;line-height:16px;height:24px}.el-switch--small .el-switch__label{height:16px;font-size:12px}.el-switch--small .el-switch__label *{font-size:12px}.el-switch--small .el-switch__core{min-width:30px;height:16px;border-radius:8px}.el-switch--small .el-switch__core .el-switch__inner{height:12px;padding:0 2px 0 14px}.el-switch--small .el-switch__core .el-switch__action{width:12px;height:12px}.el-switch--small.is-checked .el-switch__core .el-switch__action{left:calc(100% - 13px)}.el-switch--small.is-checked .el-switch__core .el-switch__inner{padding:0 14px 0 2px}.el-table-column--selection .cell{padding-left:14px;padding-right:14px}.el-table-filter{border:solid 1px var(--el-border-color-lighter);border-radius:2px;background-color:#fff;box-shadow:var(--el-box-shadow-light);box-sizing:border-box}.el-table-filter__list{padding:5px 0;margin:0;list-style:none;min-width:100px}.el-table-filter__list-item{line-height:36px;padding:0 10px;cursor:pointer;font-size:var(--el-font-size-base)}.el-table-filter__list-item:hover{background-color:var(--el-color-primary-light-9);color:var(--el-color-primary)}.el-table-filter__list-item.is-active{background-color:var(--el-color-primary);color:#fff}.el-table-filter__content{min-width:100px}.el-table-filter__bottom{border-top:1px solid var(--el-border-color-lighter);padding:8px}.el-table-filter__bottom button{background:0 0;border:none;color:var(--el-text-color-regular);cursor:pointer;font-size:var(--el-font-size-small);padding:0 3px}.el-table-filter__bottom button:hover{color:var(--el-color-primary)}.el-table-filter__bottom button:focus{outline:0}.el-table-filter__bottom button.is-disabled{color:var(--el-disabled-text-color);cursor:not-allowed}.el-table-filter__wrap{max-height:280px}.el-table-filter__checkbox-group{padding:10px}.el-table-filter__checkbox-group label.el-checkbox{display:flex;align-items:center;margin-right:5px;margin-bottom:12px;margin-left:5px;height:unset}.el-table-filter__checkbox-group .el-checkbox:last-child{margin-bottom:0}.el-table{--el-table-border-color:var(--el-border-color-lighter);--el-table-border:1px solid var(--el-table-border-color);--el-table-text-color:var(--el-text-color-regular);--el-table-header-text-color:var(--el-text-color-secondary);--el-table-row-hover-bg-color:var(--el-fill-color-light);--el-table-current-row-bg-color:var(--el-color-primary-light-9);--el-table-header-bg-color:var(--el-bg-color);--el-table-fixed-box-shadow:var(--el-box-shadow-light);--el-table-bg-color:var(--el-fill-color-blank);--el-table-tr-bg-color:var(--el-fill-color-blank);--el-table-expanded-cell-bg-color:var(--el-fill-color-blank);--el-table-fixed-left-column:inset 10px 0 10px -10px rgba(0, 0, 0, .15);--el-table-fixed-right-column:inset -10px 0 10px -10px rgba(0, 0, 0, .15)}.el-table{position:relative;overflow:hidden;box-sizing:border-box;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:100%;max-width:100%;background-color:var(--el-table-bg-color);font-size:14px;color:var(--el-table-text-color)}.el-table__inner-wrapper{position:relative;display:flex;flex-direction:column;height:100%}.el-table__inner-wrapper:before{left:0;bottom:0;width:100%;height:1px}.el-table.has-footer.el-table--fluid-height tr:last-child td.el-table__cell,.el-table.has-footer.el-table--scrollable-y tr:last-child td.el-table__cell{border-bottom-color:transparent}.el-table__empty-block{position:-webkit-sticky;position:sticky;left:0;min-height:60px;text-align:center;width:100%;display:flex;justify-content:center;align-items:center}.el-table__empty-text{line-height:60px;width:50%;color:var(--el-text-color-secondary)}.el-table__expand-column .cell{padding:0;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-table__expand-icon{position:relative;cursor:pointer;color:var(--el-text-color-regular);font-size:12px;transition:transform var(--el-transition-duration-fast) ease-in-out;height:20px}.el-table__expand-icon--expanded{transform:rotate(90deg)}.el-table__expand-icon>.el-icon{font-size:12px}.el-table__expanded-cell{background-color:var(--el-table-expanded-cell-bg-color)}.el-table__expanded-cell[class*=cell]{padding:20px 50px}.el-table__expanded-cell:hover{background-color:transparent!important}.el-table__placeholder{display:inline-block;width:20px}.el-table__append-wrapper{overflow:hidden}.el-table--fit{border-right:0;border-bottom:0}.el-table--fit .el-table__cell.gutter{border-right-width:1px}.el-table thead{color:var(--el-table-header-text-color);font-weight:500}.el-table thead.is-group th.el-table__cell{background:var(--el-fill-color-light)}.el-table .el-table__cell{padding:8px 0;min-width:0;box-sizing:border-box;text-overflow:ellipsis;vertical-align:middle;position:relative;text-align:left;z-index:1}.el-table .el-table__cell.is-center{text-align:center}.el-table .el-table__cell.is-right{text-align:right}.el-table .el-table__cell.gutter{width:15px;border-right-width:0;border-bottom-width:0;padding:0}.el-table .el-table__cell.is-hidden>*{visibility:hidden}.el-table .cell{box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:normal;word-break:break-all;line-height:23px;padding:0 12px}.el-table .cell.el-tooltip{white-space:nowrap;min-width:50px}.el-table--large{font-size:var(--el-font-size-base)}.el-table--large .el-table__cell{padding:12px 0}.el-table--large .cell{padding:0 16px}.el-table--default{font-size:14px}.el-table--default .el-table__cell{padding:8px 0}.el-table--default .cell{padding:0 12px}.el-table--small{font-size:12px}.el-table--small .el-table__cell{padding:4px 0}.el-table--small .cell{padding:0 8px}.el-table tr{background-color:var(--el-table-tr-bg-color)}.el-table tr input[type=checkbox]{margin:0}.el-table td.el-table__cell,.el-table th.el-table__cell.is-leaf{border-bottom:var(--el-table-border)}.el-table th.el-table__cell.is-sortable{cursor:pointer}.el-table th.el-table__cell{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:var(--el-table-header-bg-color)}.el-table th.el-table__cell>.cell.highlight{color:var(--el-color-primary)}.el-table th.el-table__cell.required>div:before{display:inline-block;content:"";width:8px;height:8px;border-radius:50%;background:#ff4d51;margin-right:5px;vertical-align:middle}.el-table td.el-table__cell div{box-sizing:border-box}.el-table td.el-table__cell.gutter{width:0}.el-table__footer-wrapper{border-top:var(--el-table-border)}.el-table--border .el-table__inner-wrapper:after,.el-table--border:after,.el-table--border:before,.el-table__inner-wrapper:before{content:"";position:absolute;background-color:var(--el-table-border-color);z-index:3}.el-table--border .el-table__inner-wrapper:after{left:0;top:0;width:100%;height:1px}.el-table--border:before{top:-1px;left:0;width:1px;height:100%}.el-table--border:after{top:-1px;right:0;width:1px;height:100%}.el-table--border .el-table__inner-wrapper{border-right:none;border-bottom:none}.el-table--border .el-table__footer-wrapper{position:relative;flex-shrink:0}.el-table--border .el-table__cell{border-right:var(--el-table-border)}.el-table--border th.el-table__cell.gutter:last-of-type{border-bottom:var(--el-table-border);border-bottom-width:1px}.el-table--border th.el-table__cell{border-bottom:var(--el-table-border)}.el-table--hidden{visibility:hidden}.el-table__body-wrapper,.el-table__footer-wrapper,.el-table__header-wrapper{width:100%}.el-table__body-wrapper tr td.el-table-fixed-column--left,.el-table__body-wrapper tr td.el-table-fixed-column--right,.el-table__body-wrapper tr th.el-table-fixed-column--left,.el-table__body-wrapper tr th.el-table-fixed-column--right,.el-table__footer-wrapper tr td.el-table-fixed-column--left,.el-table__footer-wrapper tr td.el-table-fixed-column--right,.el-table__footer-wrapper tr th.el-table-fixed-column--left,.el-table__footer-wrapper tr th.el-table-fixed-column--right,.el-table__header-wrapper tr td.el-table-fixed-column--left,.el-table__header-wrapper tr td.el-table-fixed-column--right,.el-table__header-wrapper tr th.el-table-fixed-column--left,.el-table__header-wrapper tr th.el-table-fixed-column--right{position:-webkit-sticky!important;position:sticky!important;z-index:2;background:var(--el-bg-color)}.el-table__body-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-last-column:before{content:"";position:absolute;top:0;width:10px;bottom:-1px;overflow-x:hidden;overflow-y:hidden;box-shadow:none;touch-action:none;pointer-events:none}.el-table__body-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-first-column:before{left:-10px}.el-table__body-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-last-column:before{right:-10px;box-shadow:none}.el-table__body-wrapper tr td.el-table__fixed-right-patch,.el-table__body-wrapper tr th.el-table__fixed-right-patch,.el-table__footer-wrapper tr td.el-table__fixed-right-patch,.el-table__footer-wrapper tr th.el-table__fixed-right-patch,.el-table__header-wrapper tr td.el-table__fixed-right-patch,.el-table__header-wrapper tr th.el-table__fixed-right-patch{position:-webkit-sticky!important;position:sticky!important;z-index:2;background:#fff;right:0}.el-table__header-wrapper{flex-shrink:0}.el-table__header-wrapper tr th.el-table-fixed-column--left,.el-table__header-wrapper tr th.el-table-fixed-column--right{background-color:var(--el-table-header-bg-color)}.el-table__body,.el-table__footer,.el-table__header{table-layout:fixed;border-collapse:separate}.el-table__footer-wrapper,.el-table__header-wrapper{overflow:hidden}.el-table__footer-wrapper tbody td.el-table__cell,.el-table__header-wrapper tbody td.el-table__cell{background-color:var(--el-table-row-hover-bg-color);color:var(--el-table-text-color)}.el-table__body-wrapper .el-table-column--selection>.cell,.el-table__header-wrapper .el-table-column--selection>.cell{display:inline-flex;align-items:center;height:23px}.el-table__body-wrapper .el-table-column--selection .el-checkbox,.el-table__header-wrapper .el-table-column--selection .el-checkbox{height:unset}.el-table.is-scrolling-left .el-table-fixed-column--right.is-first-column:before{box-shadow:var(--el-table-fixed-right-column)}.el-table.is-scrolling-left.el-table--border .el-table-fixed-column--left.is-last-column.el-table__cell{border-right:var(--el-table-border)}.el-table.is-scrolling-left th.el-table-fixed-column--left{background-color:var(--el-table-header-bg-color)}.el-table.is-scrolling-right .el-table-fixed-column--left.is-last-column:before{box-shadow:var(--el-table-fixed-left-column)}.el-table.is-scrolling-right .el-table-fixed-column--left.is-last-column.el-table__cell{border-right:none}.el-table.is-scrolling-right th.el-table-fixed-column--right{background-color:var(--el-table-header-bg-color)}.el-table.is-scrolling-middle .el-table-fixed-column--left.is-last-column.el-table__cell{border-right:none}.el-table.is-scrolling-middle .el-table-fixed-column--right.is-first-column:before{box-shadow:var(--el-table-fixed-right-column)}.el-table.is-scrolling-middle .el-table-fixed-column--left.is-last-column:before{box-shadow:var(--el-table-fixed-left-column)}.el-table.is-scrolling-none .el-table-fixed-column--left.is-first-column:before,.el-table.is-scrolling-none .el-table-fixed-column--left.is-last-column:before,.el-table.is-scrolling-none .el-table-fixed-column--right.is-first-column:before,.el-table.is-scrolling-none .el-table-fixed-column--right.is-last-column:before{box-shadow:none}.el-table.is-scrolling-none th.el-table-fixed-column--left,.el-table.is-scrolling-none th.el-table-fixed-column--right{background-color:var(--el-table-header-bg-color)}.el-table__body-wrapper{overflow:hidden;position:relative;flex:1}.el-table__body-wrapper .el-scrollbar__bar{z-index:2}.el-table .caret-wrapper{display:inline-flex;flex-direction:column;align-items:center;height:14px;width:24px;vertical-align:middle;cursor:pointer;overflow:initial;position:relative}.el-table .sort-caret{width:0;height:0;border:solid 5px transparent;position:absolute;left:7px}.el-table .sort-caret.ascending{border-bottom-color:var(--el-text-color-placeholder);top:-5px}.el-table .sort-caret.descending{border-top-color:var(--el-text-color-placeholder);bottom:-3px}.el-table .ascending .sort-caret.ascending{border-bottom-color:var(--el-color-primary)}.el-table .descending .sort-caret.descending{border-top-color:var(--el-color-primary)}.el-table .hidden-columns{visibility:hidden;position:absolute;z-index:-1}.el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell{background:var(--el-fill-color-lighter)}.el-table--striped .el-table__body tr.el-table__row--striped.current-row td.el-table__cell{background-color:var(--el-table-current-row-bg-color)}.el-table__body tr.hover-row.current-row>td.el-table__cell,.el-table__body tr.hover-row.el-table__row--striped.current-row>td.el-table__cell,.el-table__body tr.hover-row.el-table__row--striped>td.el-table__cell,.el-table__body tr.hover-row>td.el-table__cell{background-color:var(--el-table-row-hover-bg-color)}.el-table__body tr.current-row>td.el-table__cell{background-color:var(--el-table-current-row-bg-color)}.el-table__column-resize-proxy{position:absolute;left:200px;top:0;bottom:0;width:0;border-left:var(--el-table-border);z-index:10}.el-table__column-filter-trigger{display:inline-block;cursor:pointer}.el-table__column-filter-trigger i{color:var(--el-color-info);font-size:14px;vertical-align:middle}.el-table__border-left-patch{top:0;left:0;width:1px;height:100%;z-index:3;position:absolute;background-color:var(--el-table-border-color)}.el-table__border-bottom-patch{left:0;height:1px;z-index:3;position:absolute;background-color:var(--el-table-border-color)}.el-table__border-right-patch{top:0;height:100%;width:1px;z-index:3;position:absolute;background-color:var(--el-table-border-color)}.el-table--enable-row-transition .el-table__body td.el-table__cell{transition:background-color .25s ease}.el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell{background-color:var(--el-table-row-hover-bg-color)}.el-table [class*=el-table__row--level] .el-table__expand-icon{display:inline-block;width:12px;line-height:12px;height:12px;text-align:center;margin-right:8px}.el-table .el-table.el-table--border .el-table__cell{border-right:var(--el-table-border)}.el-table:not(.el-table--border) .el-table__cell{border-right:none}.el-table:not(.el-table--border)>.el-table__inner-wrapper:after{content:none}.el-table-v2{--el-table-border-color:var(--el-border-color-lighter);--el-table-border:1px solid var(--el-table-border-color);--el-table-text-color:var(--el-text-color-regular);--el-table-header-text-color:var(--el-text-color-secondary);--el-table-row-hover-bg-color:var(--el-fill-color-light);--el-table-current-row-bg-color:var(--el-color-primary-light-9);--el-table-header-bg-color:var(--el-bg-color);--el-table-fixed-box-shadow:var(--el-box-shadow-light);--el-table-bg-color:var(--el-fill-color-blank);--el-table-tr-bg-color:var(--el-fill-color-blank);--el-table-expanded-cell-bg-color:var(--el-fill-color-blank);--el-table-fixed-left-column:inset 10px 0 10px -10px rgba(0, 0, 0, .15);--el-table-fixed-right-column:inset -10px 0 10px -10px rgba(0, 0, 0, .15)}.el-table-v2{font-size:14px}.el-table-v2 *{box-sizing:border-box}.el-table-v2__root{position:relative}.el-table-v2__root:hover .el-table-v2__main .el-virtual-scrollbar{opacity:1}.el-table-v2__main{display:flex;flex-direction:column-reverse;position:absolute;overflow:hidden;top:0;background-color:var(--el-bg-color);left:0}.el-table-v2__main .el-vl__horizontal,.el-table-v2__main .el-vl__vertical{z-index:2}.el-table-v2__left{display:flex;flex-direction:column-reverse;position:absolute;overflow:hidden;top:0;background-color:var(--el-bg-color);left:0;box-shadow:2px 0 4px #0000000f}.el-table-v2__left .el-virtual-scrollbar{opacity:0}.el-table-v2__left .el-vl__horizontal,.el-table-v2__left .el-vl__vertical{z-index:-1}.el-table-v2__right{display:flex;flex-direction:column-reverse;position:absolute;overflow:hidden;top:0;background-color:var(--el-bg-color);right:0;box-shadow:-2px 0 4px #0000000f}.el-table-v2__right .el-virtual-scrollbar{opacity:0}.el-table-v2__right .el-vl__horizontal,.el-table-v2__right .el-vl__vertical{z-index:-1}.el-table-v2__header-row,.el-table-v2__row{-webkit-padding-end:var(--el-table-scrollbar-size);padding-inline-end:var(--el-table-scrollbar-size)}.el-table-v2__header-wrapper{overflow:hidden}.el-table-v2__header{position:relative;overflow:hidden}.el-table-v2__footer{position:absolute;left:0;right:0;bottom:0;overflow:hidden}.el-table-v2__empty{position:absolute;left:0}.el-table-v2__overlay{position:absolute;left:0;right:0;top:0;bottom:0;z-index:9999}.el-table-v2__header-row{display:flex;border-bottom:var(--el-table-border)}.el-table-v2__header-cell{display:flex;align-items:center;padding:0 8px;height:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;background-color:var(--el-table-header-bg-color);color:var(--el-table-header-text-color);font-weight:700}.el-table-v2__header-cell.is-align-center{justify-content:center;text-align:center}.el-table-v2__header-cell.is-align-right{justify-content:flex-end;text-align:right}.el-table-v2__header-cell.is-sortable{cursor:pointer}.el-table-v2__header-cell:hover .el-icon{display:block}.el-table-v2__sort-icon{transition:opacity,display var(--el-transition-duration);opacity:.6;display:none}.el-table-v2__sort-icon.is-sorting{display:block;opacity:1}.el-table-v2__row{border-bottom:var(--el-table-border);display:flex;align-items:center;transition:background-color var(--el-transition-duration)}.el-table-v2__row.is-hovered,.el-table-v2__row:hover{background-color:var(--el-table-row-hover-bg-color)}.el-table-v2__row-cell{height:100%;overflow:hidden;display:flex;align-items:center;padding:0 8px}.el-table-v2__row-cell.is-align-center{justify-content:center;text-align:center}.el-table-v2__row-cell.is-align-right{justify-content:flex-end;text-align:right}.el-table-v2__expand-icon{margin:0 4px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-table-v2__expand-icon svg{transition:transform var(--el-transition-duration)}.el-table-v2__expand-icon.is-expanded svg{transform:rotate(90deg)}.el-table-v2:not(.is-dynamic) .el-table-v2__cell-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-table-v2.is-dynamic .el-table-v2__row{overflow:hidden;align-items:stretch}.el-table-v2.is-dynamic .el-table-v2__row .el-table-v2__row-cell{word-break:break-all}.el-tabs{--el-tabs-header-height:40px}.el-tabs__header{padding:0;position:relative;margin:0 0 15px}.el-tabs__active-bar{position:absolute;bottom:0;left:0;height:2px;background-color:var(--el-color-primary);z-index:1;transition:width var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier),transform var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);list-style:none}.el-tabs__new-tab{display:flex;align-items:center;justify-content:center;float:right;border:1px solid var(--el-border-color);height:20px;width:20px;line-height:20px;margin:10px 0 10px 10px;border-radius:3px;text-align:center;font-size:12px;color:var(--el-text-color-primary);cursor:pointer;transition:all .15s}.el-tabs__new-tab .is-icon-plus{height:inherit;width:inherit;transform:scale(.8)}.el-tabs__new-tab .is-icon-plus svg{vertical-align:middle}.el-tabs__new-tab:hover{color:var(--el-color-primary)}.el-tabs__nav-wrap{overflow:hidden;margin-bottom:-1px;position:relative}.el-tabs__nav-wrap:after{content:"";position:absolute;left:0;bottom:0;width:100%;height:2px;background-color:var(--el-border-color-light);z-index:var(--el-index-normal)}.el-tabs__nav-wrap.is-scrollable{padding:0 20px;box-sizing:border-box}.el-tabs__nav-scroll{overflow:hidden}.el-tabs__nav-next,.el-tabs__nav-prev{position:absolute;cursor:pointer;line-height:44px;font-size:12px;color:var(--el-text-color-secondary);width:20px;text-align:center}.el-tabs__nav-next{right:0}.el-tabs__nav-prev{left:0}.el-tabs__nav{display:flex;white-space:nowrap;position:relative;transition:transform var(--el-transition-duration);float:left;z-index:calc(var(--el-index-normal) + 1)}.el-tabs__nav.is-stretch{min-width:100%;display:flex}.el-tabs__nav.is-stretch>*{flex:1;text-align:center}.el-tabs__item{padding:0 20px;height:var(--el-tabs-header-height);box-sizing:border-box;display:flex;align-items:center;justify-content:center;list-style:none;font-size:var(--el-font-size-base);font-weight:500;color:var(--el-text-color-primary);position:relative}.el-tabs__item:focus,.el-tabs__item:focus:active{outline:0}.el-tabs__item:focus-visible{box-shadow:0 0 2px 2px var(--el-color-primary) inset;border-radius:3px}.el-tabs__item .is-icon-close{border-radius:50%;text-align:center;transition:all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);margin-left:5px}.el-tabs__item .is-icon-close:before{transform:scale(.9);display:inline-block}.el-tabs__item .is-icon-close:hover{background-color:var(--el-text-color-placeholder);color:#fff}.el-tabs__item.is-active{color:var(--el-color-primary)}.el-tabs__item:hover{color:var(--el-color-primary);cursor:pointer}.el-tabs__item.is-disabled{color:var(--el-disabled-text-color);cursor:not-allowed}.el-tabs__content{overflow:hidden;position:relative}.el-tabs--card>.el-tabs__header{border-bottom:1px solid var(--el-border-color-light);height:var(--el-tabs-header-height)}.el-tabs--card>.el-tabs__header .el-tabs__nav-wrap:after{content:none}.el-tabs--card>.el-tabs__header .el-tabs__nav{border:1px solid var(--el-border-color-light);border-bottom:none;border-radius:4px 4px 0 0;box-sizing:border-box}.el-tabs--card>.el-tabs__header .el-tabs__active-bar{display:none}.el-tabs--card>.el-tabs__header .el-tabs__item .is-icon-close{position:relative;font-size:12px;width:0;height:14px;overflow:hidden;right:-2px;transform-origin:100% 50%}.el-tabs--card>.el-tabs__header .el-tabs__item{border-bottom:1px solid transparent;border-left:1px solid var(--el-border-color-light);transition:color var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier),padding var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier)}.el-tabs--card>.el-tabs__header .el-tabs__item:first-child{border-left:none}.el-tabs--card>.el-tabs__header .el-tabs__item.is-closable:hover{padding-left:13px;padding-right:13px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-closable:hover .is-icon-close{width:14px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active{border-bottom-color:var(--el-bg-color)}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active.is-closable{padding-left:20px;padding-right:20px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active.is-closable .is-icon-close{width:14px}.el-tabs--border-card{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color)}.el-tabs--border-card>.el-tabs__content{padding:15px}.el-tabs--border-card>.el-tabs__header{background-color:var(--el-fill-color-light);border-bottom:1px solid var(--el-border-color-light);margin:0}.el-tabs--border-card>.el-tabs__header .el-tabs__nav-wrap:after{content:none}.el-tabs--border-card>.el-tabs__header .el-tabs__item{transition:all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);border:1px solid transparent;margin-top:-1px;color:var(--el-text-color-secondary)}.el-tabs--border-card>.el-tabs__header .el-tabs__item:first-child{margin-left:-1px}.el-tabs--border-card>.el-tabs__header .el-tabs__item+.el-tabs__item{margin-left:-1px}.el-tabs--border-card>.el-tabs__header .el-tabs__item.is-active{color:var(--el-color-primary);background-color:var(--el-bg-color-overlay);border-right-color:var(--el-border-color);border-left-color:var(--el-border-color)}.el-tabs--border-card>.el-tabs__header .el-tabs__item:not(.is-disabled):hover{color:var(--el-color-primary)}.el-tabs--border-card>.el-tabs__header .el-tabs__item.is-disabled{color:var(--el-disabled-text-color)}.el-tabs--border-card>.el-tabs__header .is-scrollable .el-tabs__item:first-child{margin-left:0}.el-tabs--bottom .el-tabs__item.is-bottom:nth-child(2),.el-tabs--bottom .el-tabs__item.is-top:nth-child(2),.el-tabs--top .el-tabs__item.is-bottom:nth-child(2),.el-tabs--top .el-tabs__item.is-top:nth-child(2){padding-left:0}.el-tabs--bottom .el-tabs__item.is-bottom:last-child,.el-tabs--bottom .el-tabs__item.is-top:last-child,.el-tabs--top .el-tabs__item.is-bottom:last-child,.el-tabs--top .el-tabs__item.is-top:last-child{padding-right:0}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2){padding-left:20px}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover{padding-left:13px}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:last-child{padding-right:20px}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover{padding-right:13px}.el-tabs--bottom .el-tabs__header.is-bottom{margin-bottom:0;margin-top:10px}.el-tabs--bottom.el-tabs--border-card .el-tabs__header.is-bottom{border-bottom:0;border-top:1px solid var(--el-border-color)}.el-tabs--bottom.el-tabs--border-card .el-tabs__nav-wrap.is-bottom{margin-top:-1px;margin-bottom:0}.el-tabs--bottom.el-tabs--border-card .el-tabs__item.is-bottom:not(.is-active){border:1px solid transparent}.el-tabs--bottom.el-tabs--border-card .el-tabs__item.is-bottom{margin:0 -1px -1px}.el-tabs--left,.el-tabs--right{overflow:hidden}.el-tabs--left .el-tabs__header.is-left,.el-tabs--left .el-tabs__header.is-right,.el-tabs--left .el-tabs__nav-scroll,.el-tabs--left .el-tabs__nav-wrap.is-left,.el-tabs--left .el-tabs__nav-wrap.is-right,.el-tabs--right .el-tabs__header.is-left,.el-tabs--right .el-tabs__header.is-right,.el-tabs--right .el-tabs__nav-scroll,.el-tabs--right .el-tabs__nav-wrap.is-left,.el-tabs--right .el-tabs__nav-wrap.is-right{height:100%}.el-tabs--left .el-tabs__active-bar.is-left,.el-tabs--left .el-tabs__active-bar.is-right,.el-tabs--right .el-tabs__active-bar.is-left,.el-tabs--right .el-tabs__active-bar.is-right{top:0;bottom:auto;width:2px;height:auto}.el-tabs--left .el-tabs__nav-wrap.is-left,.el-tabs--left .el-tabs__nav-wrap.is-right,.el-tabs--right .el-tabs__nav-wrap.is-left,.el-tabs--right .el-tabs__nav-wrap.is-right{margin-bottom:0}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev{height:30px;line-height:30px;width:100%;text-align:center;cursor:pointer}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next i,.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev i,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next i,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev i,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next i,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev i,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next i,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev i{transform:rotate(90deg)}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev{left:auto;top:0}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next{right:auto;bottom:0}.el-tabs--left .el-tabs__nav-wrap.is-left.is-scrollable,.el-tabs--left .el-tabs__nav-wrap.is-right.is-scrollable,.el-tabs--right .el-tabs__nav-wrap.is-left.is-scrollable,.el-tabs--right .el-tabs__nav-wrap.is-right.is-scrollable{padding:30px 0}.el-tabs--left .el-tabs__nav-wrap.is-left:after,.el-tabs--left .el-tabs__nav-wrap.is-right:after,.el-tabs--right .el-tabs__nav-wrap.is-left:after,.el-tabs--right .el-tabs__nav-wrap.is-right:after{height:100%;width:2px;bottom:auto;top:0}.el-tabs--left .el-tabs__nav.is-left,.el-tabs--left .el-tabs__nav.is-right,.el-tabs--right .el-tabs__nav.is-left,.el-tabs--right .el-tabs__nav.is-right{flex-direction:column}.el-tabs--left .el-tabs__item.is-left,.el-tabs--right .el-tabs__item.is-left{justify-content:flex-end}.el-tabs--left .el-tabs__item.is-right,.el-tabs--right .el-tabs__item.is-right{justify-content:flex-start}.el-tabs--left .el-tabs__header.is-left{float:left;margin-bottom:0;margin-right:10px}.el-tabs--left .el-tabs__nav-wrap.is-left{margin-right:-1px}.el-tabs--left .el-tabs__nav-wrap.is-left:after{left:auto;right:0}.el-tabs--left .el-tabs__active-bar.is-left{right:0;left:auto}.el-tabs--left .el-tabs__item.is-left{text-align:right}.el-tabs--left.el-tabs--card .el-tabs__active-bar.is-left{display:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left{border-left:none;border-right:1px solid var(--el-border-color-light);border-bottom:none;border-top:1px solid var(--el-border-color-light);text-align:left}.el-tabs--left.el-tabs--card .el-tabs__item.is-left:first-child{border-right:1px solid var(--el-border-color-light);border-top:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active{border:1px solid var(--el-border-color-light);border-right-color:#fff;border-left:none;border-bottom:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active:first-child{border-top:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active:last-child{border-bottom:none}.el-tabs--left.el-tabs--card .el-tabs__nav{border-radius:4px 0 0 4px;border-bottom:1px solid var(--el-border-color-light);border-right:none}.el-tabs--left.el-tabs--card .el-tabs__new-tab{float:none}.el-tabs--left.el-tabs--border-card .el-tabs__header.is-left{border-right:1px solid var(--el-border-color)}.el-tabs--left.el-tabs--border-card .el-tabs__item.is-left{border:1px solid transparent;margin:-1px 0 -1px -1px}.el-tabs--left.el-tabs--border-card .el-tabs__item.is-left.is-active{border-color:transparent;border-top-color:#d1dbe5;border-bottom-color:#d1dbe5}.el-tabs--right .el-tabs__header.is-right{float:right;margin-bottom:0;margin-left:10px}.el-tabs--right .el-tabs__nav-wrap.is-right{margin-left:-1px}.el-tabs--right .el-tabs__nav-wrap.is-right:after{left:0;right:auto}.el-tabs--right .el-tabs__active-bar.is-right{left:0}.el-tabs--right.el-tabs--card .el-tabs__active-bar.is-right{display:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right{border-bottom:none;border-top:1px solid var(--el-border-color-light)}.el-tabs--right.el-tabs--card .el-tabs__item.is-right:first-child{border-left:1px solid var(--el-border-color-light);border-top:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active{border:1px solid var(--el-border-color-light);border-left-color:#fff;border-right:none;border-bottom:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active:first-child{border-top:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active:last-child{border-bottom:none}.el-tabs--right.el-tabs--card .el-tabs__nav{border-radius:0 4px 4px 0;border-bottom:1px solid var(--el-border-color-light);border-left:none}.el-tabs--right.el-tabs--border-card .el-tabs__header.is-right{border-left:1px solid var(--el-border-color)}.el-tabs--right.el-tabs--border-card .el-tabs__item.is-right{border:1px solid transparent;margin:-1px -1px -1px 0}.el-tabs--right.el-tabs--border-card .el-tabs__item.is-right.is-active{border-color:transparent;border-top-color:#d1dbe5;border-bottom-color:#d1dbe5}.slideInLeft-transition,.slideInRight-transition{display:inline-block}.slideInRight-enter{-webkit-animation:slideInRight-enter var(--el-transition-duration);animation:slideInRight-enter var(--el-transition-duration)}.slideInRight-leave{position:absolute;left:0;right:0;-webkit-animation:slideInRight-leave var(--el-transition-duration);animation:slideInRight-leave var(--el-transition-duration)}.slideInLeft-enter{-webkit-animation:slideInLeft-enter var(--el-transition-duration);animation:slideInLeft-enter var(--el-transition-duration)}.slideInLeft-leave{position:absolute;left:0;right:0;-webkit-animation:slideInLeft-leave var(--el-transition-duration);animation:slideInLeft-leave var(--el-transition-duration)}@-webkit-keyframes slideInRight-enter{0%{opacity:0;transform-origin:0 0;transform:translate(100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@keyframes slideInRight-enter{0%{opacity:0;transform-origin:0 0;transform:translate(100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@-webkit-keyframes slideInRight-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(100%);opacity:0}}@keyframes slideInRight-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(100%);opacity:0}}@-webkit-keyframes slideInLeft-enter{0%{opacity:0;transform-origin:0 0;transform:translate(-100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@keyframes slideInLeft-enter{0%{opacity:0;transform-origin:0 0;transform:translate(-100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@-webkit-keyframes slideInLeft-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(-100%);opacity:0}}@keyframes slideInLeft-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(-100%);opacity:0}}.el-tag{--el-tag-font-size:12px;--el-tag-border-radius:4px;--el-tag-border-radius-rounded:9999px}.el-tag{--el-tag-bg-color:var(--el-color-primary-light-9);--el-tag-border-color:var(--el-color-primary-light-8);--el-tag-hover-color:var(--el-color-primary);--el-tag-text-color:var(--el-color-primary);background-color:var(--el-tag-bg-color);border-color:var(--el-tag-border-color);color:var(--el-tag-text-color);display:inline-flex;justify-content:center;align-items:center;height:24px;padding:0 9px;font-size:var(--el-tag-font-size);line-height:1;border-width:1px;border-style:solid;border-radius:var(--el-tag-border-radius);box-sizing:border-box;white-space:nowrap;--el-icon-size:14px}.el-tag.el-tag--primary{--el-tag-bg-color:var(--el-color-primary-light-9);--el-tag-border-color:var(--el-color-primary-light-8);--el-tag-hover-color:var(--el-color-primary)}.el-tag.el-tag--success{--el-tag-bg-color:var(--el-color-success-light-9);--el-tag-border-color:var(--el-color-success-light-8);--el-tag-hover-color:var(--el-color-success)}.el-tag.el-tag--warning{--el-tag-bg-color:var(--el-color-warning-light-9);--el-tag-border-color:var(--el-color-warning-light-8);--el-tag-hover-color:var(--el-color-warning)}.el-tag.el-tag--danger{--el-tag-bg-color:var(--el-color-danger-light-9);--el-tag-border-color:var(--el-color-danger-light-8);--el-tag-hover-color:var(--el-color-danger)}.el-tag.el-tag--error{--el-tag-bg-color:var(--el-color-error-light-9);--el-tag-border-color:var(--el-color-error-light-8);--el-tag-hover-color:var(--el-color-error)}.el-tag.el-tag--info{--el-tag-bg-color:var(--el-color-info-light-9);--el-tag-border-color:var(--el-color-info-light-8);--el-tag-hover-color:var(--el-color-info)}.el-tag.el-tag--primary{--el-tag-text-color:var(--el-color-primary)}.el-tag.el-tag--success{--el-tag-text-color:var(--el-color-success)}.el-tag.el-tag--warning{--el-tag-text-color:var(--el-color-warning)}.el-tag.el-tag--danger{--el-tag-text-color:var(--el-color-danger)}.el-tag.el-tag--error{--el-tag-text-color:var(--el-color-error)}.el-tag.el-tag--info{--el-tag-text-color:var(--el-color-info)}.el-tag.is-hit{border-color:var(--el-color-primary)}.el-tag.is-round{border-radius:var(--el-tag-border-radius-rounded)}.el-tag .el-tag__close{color:var(--el-tag-text-color)}.el-tag .el-tag__close:hover{color:var(--el-color-white);background-color:var(--el-tag-hover-color)}.el-tag .el-icon{border-radius:50%;cursor:pointer;font-size:calc(var(--el-icon-size) - 2px);height:var(--el-icon-size);width:var(--el-icon-size)}.el-tag .el-tag__close{margin-left:6px}.el-tag--dark{--el-tag-bg-color:var(--el-color-primary);--el-tag-border-color:var(--el-color-primary);--el-tag-hover-color:var(--el-color-primary-light-3);--el-tag-text-color:var(--el-color-white)}.el-tag--dark.el-tag--primary{--el-tag-bg-color:var(--el-color-primary);--el-tag-border-color:var(--el-color-primary);--el-tag-hover-color:var(--el-color-primary-light-3)}.el-tag--dark.el-tag--success{--el-tag-bg-color:var(--el-color-success);--el-tag-border-color:var(--el-color-success);--el-tag-hover-color:var(--el-color-success-light-3)}.el-tag--dark.el-tag--warning{--el-tag-bg-color:var(--el-color-warning);--el-tag-border-color:var(--el-color-warning);--el-tag-hover-color:var(--el-color-warning-light-3)}.el-tag--dark.el-tag--danger{--el-tag-bg-color:var(--el-color-danger);--el-tag-border-color:var(--el-color-danger);--el-tag-hover-color:var(--el-color-danger-light-3)}.el-tag--dark.el-tag--error{--el-tag-bg-color:var(--el-color-error);--el-tag-border-color:var(--el-color-error);--el-tag-hover-color:var(--el-color-error-light-3)}.el-tag--dark.el-tag--info{--el-tag-bg-color:var(--el-color-info);--el-tag-border-color:var(--el-color-info);--el-tag-hover-color:var(--el-color-info-light-3)}.el-tag--dark.el-tag--primary,.el-tag--dark.el-tag--success,.el-tag--dark.el-tag--warning,.el-tag--dark.el-tag--danger,.el-tag--dark.el-tag--error,.el-tag--dark.el-tag--info{--el-tag-text-color:var(--el-color-white)}.el-tag--plain{--el-tag-border-color:var(--el-color-primary-light-5);--el-tag-hover-color:var(--el-color-primary);--el-tag-bg-color:var(--el-fill-color-blank)}.el-tag--plain.el-tag--primary{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-primary-light-5);--el-tag-hover-color:var(--el-color-primary)}.el-tag--plain.el-tag--success{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-success-light-5);--el-tag-hover-color:var(--el-color-success)}.el-tag--plain.el-tag--warning{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-warning-light-5);--el-tag-hover-color:var(--el-color-warning)}.el-tag--plain.el-tag--danger{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-danger-light-5);--el-tag-hover-color:var(--el-color-danger)}.el-tag--plain.el-tag--error{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-error-light-5);--el-tag-hover-color:var(--el-color-error)}.el-tag--plain.el-tag--info{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-info-light-5);--el-tag-hover-color:var(--el-color-info)}.el-tag.is-closable{padding-right:5px}.el-tag--large{padding:0 11px;height:32px;--el-icon-size:16px}.el-tag--large .el-tag__close{margin-left:8px}.el-tag--large.is-closable{padding-right:7px}.el-tag--small{padding:0 7px;height:20px;--el-icon-size:12px}.el-tag--small .el-tag__close{margin-left:4px}.el-tag--small.is-closable{padding-right:3px}.el-tag--small .el-icon-close{transform:scale(.8)}.el-tag.el-tag--primary.is-hit{border-color:var(--el-color-primary)}.el-tag.el-tag--success.is-hit{border-color:var(--el-color-success)}.el-tag.el-tag--warning.is-hit{border-color:var(--el-color-warning)}.el-tag.el-tag--danger.is-hit{border-color:var(--el-color-danger)}.el-tag.el-tag--error.is-hit{border-color:var(--el-color-error)}.el-tag.el-tag--info.is-hit{border-color:var(--el-color-info)}.el-text{--el-text-font-size:var(--el-font-size-base);--el-text-color:var(--el-text-color-regular)}.el-text{align-self:center;margin:0;padding:0;font-size:var(--el-text-font-size);color:var(--el-text-color);word-break:break-all}.el-text.is-truncated{display:inline-block;max-width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.el-text--large{--el-text-font-size:var(--el-font-size-medium)}.el-text--default{--el-text-font-size:var(--el-font-size-base)}.el-text--small{--el-text-font-size:var(--el-font-size-extra-small)}.el-text.el-text--primary{--el-text-color:var(--el-color-primary)}.el-text.el-text--success{--el-text-color:var(--el-color-success)}.el-text.el-text--warning{--el-text-color:var(--el-color-warning)}.el-text.el-text--danger{--el-text-color:var(--el-color-danger)}.el-text.el-text--error{--el-text-color:var(--el-color-error)}.el-text.el-text--info{--el-text-color:var(--el-color-info)}.el-text>.el-icon{vertical-align:-2px}.time-select{margin:5px 0;min-width:0}.time-select .el-picker-panel__content{max-height:200px;margin:0}.time-select-item{padding:8px 10px;font-size:14px;line-height:20px}.time-select-item.disabled{color:var(--el-datepicker-border-color);cursor:not-allowed}.time-select-item:hover{background-color:var(--el-fill-color-light);font-weight:700;cursor:pointer}.time-select .time-select-item.selected:not(.disabled){color:var(--el-color-primary);font-weight:700}.el-timeline-item{position:relative;padding-bottom:20px}.el-timeline-item__wrapper{position:relative;padding-left:28px;top:-3px}.el-timeline-item__tail{position:absolute;left:4px;height:100%;border-left:2px solid var(--el-timeline-node-color)}.el-timeline-item .el-timeline-item__icon{color:var(--el-color-white);font-size:var(--el-font-size-small)}.el-timeline-item__node{position:absolute;background-color:var(--el-timeline-node-color);border-color:var(--el-timeline-node-color);border-radius:50%;box-sizing:border-box;display:flex;justify-content:center;align-items:center}.el-timeline-item__node--normal{left:-1px;width:var(--el-timeline-node-size-normal);height:var(--el-timeline-node-size-normal)}.el-timeline-item__node--large{left:-2px;width:var(--el-timeline-node-size-large);height:var(--el-timeline-node-size-large)}.el-timeline-item__node.is-hollow{background:var(--el-color-white);border-style:solid;border-width:2px}.el-timeline-item__node--primary{background-color:var(--el-color-primary);border-color:var(--el-color-primary)}.el-timeline-item__node--success{background-color:var(--el-color-success);border-color:var(--el-color-success)}.el-timeline-item__node--warning{background-color:var(--el-color-warning);border-color:var(--el-color-warning)}.el-timeline-item__node--danger{background-color:var(--el-color-danger);border-color:var(--el-color-danger)}.el-timeline-item__node--info{background-color:var(--el-color-info);border-color:var(--el-color-info)}.el-timeline-item__dot{position:absolute;display:flex;justify-content:center;align-items:center}.el-timeline-item__content{color:var(--el-text-color-primary)}.el-timeline-item__timestamp{color:var(--el-text-color-secondary);line-height:1;font-size:var(--el-font-size-small)}.el-timeline-item__timestamp.is-top{margin-bottom:8px;padding-top:4px}.el-timeline-item__timestamp.is-bottom{margin-top:8px}.el-timeline{--el-timeline-node-size-normal:12px;--el-timeline-node-size-large:14px;--el-timeline-node-color:var(--el-border-color-light)}.el-timeline{margin:0;font-size:var(--el-font-size-base);list-style:none}.el-timeline .el-timeline-item:last-child .el-timeline-item__tail{display:none}.el-timeline .el-timeline-item__center{display:flex;align-items:center}.el-timeline .el-timeline-item__center .el-timeline-item__wrapper{width:100%}.el-timeline .el-timeline-item__center .el-timeline-item__tail{top:0}.el-timeline .el-timeline-item__center:first-child .el-timeline-item__tail{height:calc(50% + 10px);top:calc(50% - 10px)}.el-timeline .el-timeline-item__center:last-child .el-timeline-item__tail{display:block;height:calc(50% - 10px)}.el-tooltip-v2__content{--el-tooltip-v2-padding:5px 10px;--el-tooltip-v2-border-radius:4px;--el-tooltip-v2-border-color:var(--el-border-color);border-radius:var(--el-tooltip-v2-border-radius);color:var(--el-color-black);background-color:var(--el-color-white);padding:var(--el-tooltip-v2-padding);border:1px solid var(--el-border-color)}.el-tooltip-v2__arrow{position:absolute;color:var(--el-color-white);width:var(--el-tooltip-v2-arrow-width);height:var(--el-tooltip-v2-arrow-height);pointer-events:none;left:var(--el-tooltip-v2-arrow-x);top:var(--el-tooltip-v2-arrow-y)}.el-tooltip-v2__arrow:before{content:"";width:0;height:0;border:var(--el-tooltip-v2-arrow-border-width) solid transparent;position:absolute}.el-tooltip-v2__arrow:after{content:"";width:0;height:0;border:var(--el-tooltip-v2-arrow-border-width) solid transparent;position:absolute}.el-tooltip-v2__content[data-side^=top] .el-tooltip-v2__arrow{bottom:0}.el-tooltip-v2__content[data-side^=top] .el-tooltip-v2__arrow:before{border-top-color:var(--el-color-white);border-top-width:var(--el-tooltip-v2-arrow-border-width);border-bottom:0;top:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=top] .el-tooltip-v2__arrow:after{border-top-color:var(--el-border-color);border-top-width:var(--el-tooltip-v2-arrow-border-width);border-bottom:0;top:100%;z-index:-1}.el-tooltip-v2__content[data-side^=bottom] .el-tooltip-v2__arrow{top:0}.el-tooltip-v2__content[data-side^=bottom] .el-tooltip-v2__arrow:before{border-bottom-color:var(--el-color-white);border-bottom-width:var(--el-tooltip-v2-arrow-border-width);border-top:0;bottom:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=bottom] .el-tooltip-v2__arrow:after{border-bottom-color:var(--el-border-color);border-bottom-width:var(--el-tooltip-v2-arrow-border-width);border-top:0;bottom:100%;z-index:-1}.el-tooltip-v2__content[data-side^=left] .el-tooltip-v2__arrow{right:0}.el-tooltip-v2__content[data-side^=left] .el-tooltip-v2__arrow:before{border-left-color:var(--el-color-white);border-left-width:var(--el-tooltip-v2-arrow-border-width);border-right:0;left:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=left] .el-tooltip-v2__arrow:after{border-left-color:var(--el-border-color);border-left-width:var(--el-tooltip-v2-arrow-border-width);border-right:0;left:100%;z-index:-1}.el-tooltip-v2__content[data-side^=right] .el-tooltip-v2__arrow{left:0}.el-tooltip-v2__content[data-side^=right] .el-tooltip-v2__arrow:before{border-right-color:var(--el-color-white);border-right-width:var(--el-tooltip-v2-arrow-border-width);border-left:0;right:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=right] .el-tooltip-v2__arrow:after{border-right-color:var(--el-border-color);border-right-width:var(--el-tooltip-v2-arrow-border-width);border-left:0;right:100%;z-index:-1}.el-tooltip-v2__content.is-dark{--el-tooltip-v2-border-color:transparent;background-color:var(--el-color-black);color:var(--el-color-white);border-color:transparent}.el-tooltip-v2__content.is-dark .el-tooltip-v2__arrow{background-color:var(--el-color-black);border-color:transparent}.el-transfer{--el-transfer-border-color:var(--el-border-color-lighter);--el-transfer-border-radius:var(--el-border-radius-base);--el-transfer-panel-width:200px;--el-transfer-panel-header-height:40px;--el-transfer-panel-header-bg-color:var(--el-fill-color-light);--el-transfer-panel-footer-height:40px;--el-transfer-panel-body-height:278px;--el-transfer-item-height:30px;--el-transfer-filter-height:32px}.el-transfer{font-size:var(--el-font-size-base)}.el-transfer__buttons{display:inline-block;vertical-align:middle;padding:0 30px}.el-transfer__button{vertical-align:top}.el-transfer__button:nth-child(2){margin:0 0 0 10px}.el-transfer__button i,.el-transfer__button span{font-size:14px}.el-transfer__button .el-icon+span{margin-left:0}.el-transfer-panel{overflow:hidden;background:var(--el-bg-color-overlay);display:inline-block;text-align:left;vertical-align:middle;width:var(--el-transfer-panel-width);max-height:100%;box-sizing:border-box;position:relative}.el-transfer-panel__body{height:var(--el-transfer-panel-body-height);border-left:1px solid var(--el-transfer-border-color);border-right:1px solid var(--el-transfer-border-color);border-bottom:1px solid var(--el-transfer-border-color);border-bottom-left-radius:var(--el-transfer-border-radius);border-bottom-right-radius:var(--el-transfer-border-radius);overflow:hidden}.el-transfer-panel__body.is-with-footer{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.el-transfer-panel__list{margin:0;padding:6px 0;list-style:none;height:var(--el-transfer-panel-body-height);overflow:auto;box-sizing:border-box}.el-transfer-panel__list.is-filterable{height:calc(100% - var(--el-transfer-filter-height) - 30px);padding-top:0}.el-transfer-panel__item{height:var(--el-transfer-item-height);line-height:var(--el-transfer-item-height);padding-left:15px;display:block!important}.el-transfer-panel__item+.el-transfer-panel__item{margin-left:0}.el-transfer-panel__item.el-checkbox{color:var(--el-text-color-regular)}.el-transfer-panel__item:hover{color:var(--el-color-primary)}.el-transfer-panel__item.el-checkbox .el-checkbox__label{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;box-sizing:border-box;padding-left:22px;line-height:var(--el-transfer-item-height)}.el-transfer-panel__item .el-checkbox__input{position:absolute;top:8px}.el-transfer-panel__filter{text-align:center;padding:15px;box-sizing:border-box}.el-transfer-panel__filter .el-input__inner{height:var(--el-transfer-filter-height);width:100%;font-size:12px;display:inline-block;box-sizing:border-box;border-radius:calc(var(--el-transfer-filter-height)/ 2)}.el-transfer-panel__filter .el-icon-circle-close{cursor:pointer}.el-transfer-panel .el-transfer-panel__header{display:flex;align-items:center;height:var(--el-transfer-panel-header-height);background:var(--el-transfer-panel-header-bg-color);margin:0;padding-left:15px;border:1px solid var(--el-transfer-border-color);border-top-left-radius:var(--el-transfer-border-radius);border-top-right-radius:var(--el-transfer-border-radius);box-sizing:border-box;color:var(--el-color-black)}.el-transfer-panel .el-transfer-panel__header .el-checkbox{position:relative;display:flex;width:100%;align-items:center}.el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label{font-size:16px;color:var(--el-text-color-primary);font-weight:400}.el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label span{position:absolute;right:15px;top:50%;transform:translate3d(0,-50%,0);color:var(--el-text-color-secondary);font-size:12px;font-weight:400}.el-transfer-panel .el-transfer-panel__footer{height:var(--el-transfer-panel-footer-height);background:var(--el-bg-color-overlay);margin:0;padding:0;border:1px solid var(--el-transfer-border-color);border-bottom-left-radius:var(--el-transfer-border-radius);border-bottom-right-radius:var(--el-transfer-border-radius)}.el-transfer-panel .el-transfer-panel__footer:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-transfer-panel .el-transfer-panel__footer .el-checkbox{padding-left:20px;color:var(--el-text-color-regular)}.el-transfer-panel .el-transfer-panel__empty{margin:0;height:var(--el-transfer-item-height);line-height:var(--el-transfer-item-height);padding:6px 15px 0;color:var(--el-text-color-secondary);text-align:center}.el-transfer-panel .el-checkbox__label{padding-left:8px}.el-transfer-panel .el-checkbox__inner{height:14px;width:14px;border-radius:3px}.el-transfer-panel .el-checkbox__inner:after{height:6px;width:3px;left:4px}.el-tree{--el-tree-node-hover-bg-color:var(--el-fill-color-light);--el-tree-text-color:var(--el-text-color-regular);--el-tree-expand-icon-color:var(--el-text-color-placeholder)}.el-tree{position:relative;cursor:default;background:var(--el-fill-color-blank);color:var(--el-tree-text-color);font-size:var(--el-font-size-base)}.el-tree__empty-block{position:relative;min-height:60px;text-align:center;width:100%;height:100%}.el-tree__empty-text{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);color:var(--el-text-color-secondary);font-size:var(--el-font-size-base)}.el-tree__drop-indicator{position:absolute;left:0;right:0;height:1px;background-color:var(--el-color-primary)}.el-tree-node{white-space:nowrap;outline:0}.el-tree-node:focus>.el-tree-node__content{background-color:var(--el-tree-node-hover-bg-color)}.el-tree-node.is-drop-inner>.el-tree-node__content .el-tree-node__label{background-color:var(--el-color-primary);color:#fff}.el-tree-node__content{display:flex;align-items:center;height:26px;cursor:pointer}.el-tree-node__content>.el-tree-node__expand-icon{padding:6px;box-sizing:content-box}.el-tree-node__content>label.el-checkbox{margin-right:8px}.el-tree-node__content:hover{background-color:var(--el-tree-node-hover-bg-color)}.el-tree.is-dragging .el-tree-node__content{cursor:move}.el-tree.is-dragging .el-tree-node__content *{pointer-events:none}.el-tree.is-dragging.is-drop-not-allow .el-tree-node__content{cursor:not-allowed}.el-tree-node__expand-icon{cursor:pointer;color:var(--el-tree-expand-icon-color);font-size:12px;transform:rotate(0);transition:transform var(--el-transition-duration) ease-in-out}.el-tree-node__expand-icon.expanded{transform:rotate(90deg)}.el-tree-node__expand-icon.is-leaf{color:transparent;cursor:default}.el-tree-node__expand-icon.is-hidden{visibility:hidden}.el-tree-node__loading-icon{margin-right:8px;font-size:var(--el-font-size-base);color:var(--el-tree-expand-icon-color)}.el-tree-node>.el-tree-node__children{overflow:hidden;background-color:transparent}.el-tree-node.is-expanded>.el-tree-node__children{display:block}.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content{background-color:var(--el-color-primary-light-9)}.el-tree-select{--el-tree-node-hover-bg-color:var(--el-fill-color-light);--el-tree-text-color:var(--el-text-color-regular);--el-tree-expand-icon-color:var(--el-text-color-placeholder)}.el-tree-select__popper .el-tree-node__expand-icon{margin-left:8px}.el-tree-select__popper .el-tree-node.is-checked>.el-tree-node__content .el-select-dropdown__item.selected:after{content:none}.el-tree-select__popper .el-select-dropdown__item{flex:1;background:0 0!important;padding-left:0;height:20px;line-height:20px}.el-upload{--el-upload-dragger-padding-horizontal:40px;--el-upload-dragger-padding-vertical:10px}.el-upload{display:inline-flex;justify-content:center;align-items:center;cursor:pointer;outline:0}.el-upload__input{display:none}.el-upload__tip{font-size:12px;color:var(--el-text-color-regular);margin-top:7px}.el-upload iframe{position:absolute;z-index:-1;top:0;left:0;opacity:0}.el-upload--picture-card{--el-upload-picture-card-size:148px;background-color:var(--el-fill-color-lighter);border:1px dashed var(--el-border-color-darker);border-radius:6px;box-sizing:border-box;width:var(--el-upload-picture-card-size);height:var(--el-upload-picture-card-size);cursor:pointer;vertical-align:top;display:inline-flex;justify-content:center;align-items:center}.el-upload--picture-card i{font-size:28px;color:var(--el-text-color-secondary)}.el-upload--picture-card:hover{border-color:var(--el-color-primary);color:var(--el-color-primary)}.el-upload.is-drag{display:block}.el-upload:focus{border-color:var(--el-color-primary);color:var(--el-color-primary)}.el-upload:focus .el-upload-dragger{border-color:var(--el-color-primary)}.el-upload-dragger{padding:var(--el-upload-dragger-padding-horizontal) var(--el-upload-dragger-padding-vertical);background-color:var(--el-fill-color-blank);border:1px dashed var(--el-border-color);border-radius:6px;box-sizing:border-box;text-align:center;cursor:pointer;position:relative;overflow:hidden}.el-upload-dragger .el-icon--upload{font-size:67px;color:var(--el-text-color-placeholder);margin-bottom:16px;line-height:50px}.el-upload-dragger+.el-upload__tip{text-align:center}.el-upload-dragger~.el-upload__files{border-top:var(--el-border);margin-top:7px;padding-top:5px}.el-upload-dragger .el-upload__text{color:var(--el-text-color-regular);font-size:14px;text-align:center}.el-upload-dragger .el-upload__text em{color:var(--el-color-primary);font-style:normal}.el-upload-dragger:hover{border-color:var(--el-color-primary)}.el-upload-dragger.is-dragover{padding:calc(var(--el-upload-dragger-padding-horizontal) - 1px) calc(var(--el-upload-dragger-padding-vertical) - 1px);background-color:var(--el-color-primary-light-9);border:2px dashed var(--el-color-primary)}.el-upload-list{margin:10px 0 0;padding:0;list-style:none;position:relative}.el-upload-list__item{transition:all .5s cubic-bezier(.55,0,.1,1);font-size:14px;color:var(--el-text-color-regular);margin-bottom:5px;position:relative;box-sizing:border-box;border-radius:4px;width:100%}.el-upload-list__item .el-progress{position:absolute;top:20px;width:100%}.el-upload-list__item .el-progress__text{position:absolute;right:0;top:-13px}.el-upload-list__item .el-progress-bar{margin-right:0;padding-right:0}.el-upload-list__item .el-icon--upload-success{color:var(--el-color-success)}.el-upload-list__item .el-icon--close{display:none;position:absolute;right:5px;top:50%;cursor:pointer;opacity:.75;color:var(--el-text-color-regular);transition:opacity var(--el-transition-duration);transform:translateY(-50%)}.el-upload-list__item .el-icon--close:hover{opacity:1;color:var(--el-color-primary)}.el-upload-list__item .el-icon--close-tip{display:none;position:absolute;top:1px;right:5px;font-size:12px;cursor:pointer;opacity:1;color:var(--el-color-primary);font-style:normal}.el-upload-list__item:hover{background-color:var(--el-fill-color-light)}.el-upload-list__item:hover .el-icon--close{display:inline-flex}.el-upload-list__item:hover .el-progress__text{display:none}.el-upload-list__item .el-upload-list__item-info{display:inline-flex;justify-content:center;flex-direction:column;width:calc(100% - 30px);margin-left:4px}.el-upload-list__item.is-success .el-upload-list__item-status-label{display:inline-flex}.el-upload-list__item.is-success .el-upload-list__item-name:focus,.el-upload-list__item.is-success .el-upload-list__item-name:hover{color:var(--el-color-primary);cursor:pointer}.el-upload-list__item.is-success:focus:not(:hover) .el-icon--close-tip{display:inline-block}.el-upload-list__item.is-success:active,.el-upload-list__item.is-success:not(.focusing):focus{outline-width:0}.el-upload-list__item.is-success:active .el-icon--close-tip,.el-upload-list__item.is-success:not(.focusing):focus .el-icon--close-tip{display:none}.el-upload-list__item.is-success:focus .el-upload-list__item-status-label,.el-upload-list__item.is-success:hover .el-upload-list__item-status-label{display:none;opacity:0}.el-upload-list__item-name{color:var(--el-text-color-regular);display:inline-flex;text-align:center;align-items:center;padding:0 4px;transition:color var(--el-transition-duration);font-size:var(--el-font-size-base)}.el-upload-list__item-name .el-icon{margin-right:6px;color:var(--el-text-color-secondary)}.el-upload-list__item-file-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-upload-list__item-status-label{position:absolute;right:5px;top:0;line-height:inherit;display:none;height:100%;justify-content:center;align-items:center;transition:opacity var(--el-transition-duration)}.el-upload-list__item-delete{position:absolute;right:10px;top:0;font-size:12px;color:var(--el-text-color-regular);display:none}.el-upload-list__item-delete:hover{color:var(--el-color-primary)}.el-upload-list--picture-card{--el-upload-list-picture-card-size:148px;display:inline-flex;flex-wrap:wrap;margin:0}.el-upload-list--picture-card .el-upload-list__item{overflow:hidden;background-color:var(--el-fill-color-blank);border:1px solid var(--el-border-color);border-radius:6px;box-sizing:border-box;width:var(--el-upload-list-picture-card-size);height:var(--el-upload-list-picture-card-size);margin:0 8px 8px 0;padding:0;display:inline-flex}.el-upload-list--picture-card .el-upload-list__item .el-icon--check,.el-upload-list--picture-card .el-upload-list__item .el-icon--circle-check{color:#fff}.el-upload-list--picture-card .el-upload-list__item .el-icon--close{display:none}.el-upload-list--picture-card .el-upload-list__item:hover .el-upload-list__item-status-label{opacity:0;display:block}.el-upload-list--picture-card .el-upload-list__item:hover .el-progress__text{display:block}.el-upload-list--picture-card .el-upload-list__item .el-upload-list__item-name{display:none}.el-upload-list--picture-card .el-upload-list__item-thumbnail{width:100%;height:100%;-o-object-fit:contain;object-fit:contain}.el-upload-list--picture-card .el-upload-list__item-status-label{right:-15px;top:-6px;width:40px;height:24px;background:var(--el-color-success);text-align:center;transform:rotate(45deg)}.el-upload-list--picture-card .el-upload-list__item-status-label i{font-size:12px;margin-top:11px;transform:rotate(-45deg)}.el-upload-list--picture-card .el-upload-list__item-actions{position:absolute;width:100%;height:100%;left:0;top:0;cursor:default;display:inline-flex;justify-content:center;align-items:center;color:#fff;opacity:0;font-size:20px;background-color:var(--el-overlay-color-lighter);transition:opacity var(--el-transition-duration)}.el-upload-list--picture-card .el-upload-list__item-actions span{display:none;cursor:pointer}.el-upload-list--picture-card .el-upload-list__item-actions span+span{margin-left:1rem}.el-upload-list--picture-card .el-upload-list__item-actions .el-upload-list__item-delete{position:static;font-size:inherit;color:inherit}.el-upload-list--picture-card .el-upload-list__item-actions:hover{opacity:1}.el-upload-list--picture-card .el-upload-list__item-actions:hover span{display:inline-flex}.el-upload-list--picture-card .el-progress{top:50%;left:50%;transform:translate(-50%,-50%);bottom:auto;width:126px}.el-upload-list--picture-card .el-progress .el-progress__text{top:50%}.el-upload-list--picture .el-upload-list__item{overflow:hidden;z-index:0;background-color:var(--el-fill-color-blank);border:1px solid var(--el-border-color);border-radius:6px;box-sizing:border-box;margin-top:10px;padding:10px;display:flex;align-items:center}.el-upload-list--picture .el-upload-list__item .el-icon--check,.el-upload-list--picture .el-upload-list__item .el-icon--circle-check{color:#fff}.el-upload-list--picture .el-upload-list__item:hover .el-upload-list__item-status-label{opacity:0;display:inline-flex}.el-upload-list--picture .el-upload-list__item:hover .el-progress__text{display:block}.el-upload-list--picture .el-upload-list__item.is-success .el-upload-list__item-name i{display:none}.el-upload-list--picture .el-upload-list__item .el-icon--close{top:5px;transform:translateY(0)}.el-upload-list--picture .el-upload-list__item-thumbnail{display:inline-flex;justify-content:center;align-items:center;width:70px;height:70px;-o-object-fit:contain;object-fit:contain;position:relative;z-index:1;background-color:var(--el-color-white)}.el-upload-list--picture .el-upload-list__item-status-label{position:absolute;right:-17px;top:-7px;width:46px;height:26px;background:var(--el-color-success);text-align:center;transform:rotate(45deg)}.el-upload-list--picture .el-upload-list__item-status-label i{font-size:12px;margin-top:12px;transform:rotate(-45deg)}.el-upload-list--picture .el-progress{position:relative;top:-7px}.el-upload-cover{position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden;z-index:10;cursor:default}.el-upload-cover:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-upload-cover img{display:block;width:100%;height:100%}.el-upload-cover__label{right:-15px;top:-6px;width:40px;height:24px;background:var(--el-color-success);text-align:center;transform:rotate(45deg)}.el-upload-cover__label i{font-size:12px;margin-top:11px;transform:rotate(-45deg);color:#fff}.el-upload-cover__progress{display:inline-block;vertical-align:middle;position:static;width:243px}.el-upload-cover__progress+.el-upload__inner{opacity:0}.el-upload-cover__content{position:absolute;top:0;left:0;width:100%;height:100%}.el-upload-cover__interact{position:absolute;bottom:0;left:0;width:100%;height:100%;background-color:var(--el-overlay-color-light);text-align:center}.el-upload-cover__interact .btn{display:inline-block;color:#fff;font-size:14px;cursor:pointer;vertical-align:middle;transition:var(--el-transition-md-fade);margin-top:60px}.el-upload-cover__interact .btn i{margin-top:0}.el-upload-cover__interact .btn span{opacity:0;transition:opacity .15s linear}.el-upload-cover__interact .btn:not(:first-child){margin-left:35px}.el-upload-cover__interact .btn:hover{transform:translateY(-13px)}.el-upload-cover__interact .btn:hover span{opacity:1}.el-upload-cover__interact .btn i{color:#fff;display:block;font-size:24px;line-height:inherit;margin:0 auto 5px}.el-upload-cover__title{position:absolute;bottom:0;left:0;background-color:#fff;height:36px;width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:400;text-align:left;padding:0 10px;margin:0;line-height:36px;font-size:14px;color:var(--el-text-color-primary)}.el-upload-cover+.el-upload__inner{opacity:0;position:relative;z-index:1}.el-vl__wrapper{position:relative}.el-vl__wrapper:hover .el-virtual-scrollbar,.el-vl__wrapper.always-on .el-virtual-scrollbar{opacity:1}.el-vl__window{scrollbar-width:none}.el-vl__window::-webkit-scrollbar{display:none}.el-virtual-scrollbar{opacity:0;transition:opacity .34s ease-out}.el-virtual-scrollbar.always-on{opacity:1}.el-vg__wrapper{position:relative}.el-popper{--el-popper-border-radius:var(--el-popover-border-radius, 4px)}.el-popper{position:absolute;border-radius:var(--el-popper-border-radius);padding:5px 11px;z-index:2000;font-size:12px;line-height:20px;min-width:10px;word-wrap:break-word;visibility:visible}.el-popper.is-dark{color:var(--el-bg-color);background:var(--el-text-color-primary);border:1px solid var(--el-text-color-primary)}.el-popper.is-dark .el-popper__arrow:before{border:1px solid var(--el-text-color-primary);background:var(--el-text-color-primary);right:0}.el-popper.is-light{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light)}.el-popper.is-light .el-popper__arrow:before{border:1px solid var(--el-border-color-light);background:var(--el-bg-color-overlay);right:0}.el-popper.is-pure{padding:0}.el-popper__arrow{position:absolute;width:10px;height:10px;z-index:-1}.el-popper__arrow:before{position:absolute;width:10px;height:10px;z-index:-1;content:" ";transform:rotate(45deg);background:var(--el-text-color-primary);box-sizing:border-box}.el-popper[data-popper-placement^=top]>.el-popper__arrow{bottom:-5px}.el-popper[data-popper-placement^=top]>.el-popper__arrow:before{border-bottom-right-radius:2px}.el-popper[data-popper-placement^=bottom]>.el-popper__arrow{top:-5px}.el-popper[data-popper-placement^=bottom]>.el-popper__arrow:before{border-top-left-radius:2px}.el-popper[data-popper-placement^=left]>.el-popper__arrow{right:-5px}.el-popper[data-popper-placement^=left]>.el-popper__arrow:before{border-top-right-radius:2px}.el-popper[data-popper-placement^=right]>.el-popper__arrow{left:-5px}.el-popper[data-popper-placement^=right]>.el-popper__arrow:before{border-bottom-left-radius:2px}.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent!important;border-left-color:transparent!important}.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent!important;border-right-color:transparent!important}.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent!important;border-bottom-color:transparent!important}.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent!important;border-top-color:transparent!important}.el-select-dropdown__item{font-size:var(--el-font-size-base);padding:0 32px 0 20px;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--el-text-color-regular);height:34px;line-height:34px;box-sizing:border-box;cursor:pointer}.el-select-dropdown__item.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-select-dropdown__item.hover,.el-select-dropdown__item:hover{background-color:var(--el-fill-color-light)}.el-select-dropdown__item.selected{color:var(--el-color-primary);font-weight:700}.el-statistic{--el-statistic-title-font-weight:400;--el-statistic-title-font-size:var(--el-font-size-extra-small);--el-statistic-title-color:var(--el-text-color-regular);--el-statistic-content-font-weight:400;--el-statistic-content-font-size:var(--el-font-size-extra-large);--el-statistic-content-color:var(--el-text-color-primary)}.el-statistic__head{font-weight:var(--el-statistic-title-font-weight);font-size:var(--el-statistic-title-font-size);color:var(--el-statistic-title-color);line-height:20px;margin-bottom:4px}.el-statistic__content{font-weight:var(--el-statistic-content-font-weight);font-size:var(--el-statistic-content-font-size);color:var(--el-statistic-content-color)}.el-statistic__value{display:inline-block}.el-statistic__prefix{margin-right:4px;display:inline-block}.el-statistic__suffix{margin-left:4px;display:inline-block}.el-button{height:32rem!important;padding:8rem 15rem!important;font-size:14rem!important}.el-input__wrapper{padding:1rem 11rem!important}.el-input{height:32rem!important;font-size:14rem!important}.jt-drawing-row .col-left{font-size:14rem!important}.el-color-picker__trigger{height:32rem!important;padding:4rem!important}.el-radio-button__inner{padding:8rem 15rem!important;font-size:14rem}.el-textarea__inner{padding:5rem 11rem!important;font-size:14rem}.el-input__inner{height:32rem!important;font-size:14rem!important}.jt-drawing-row{display:flex;flex-direction:row;height:40rem;align-items:center}.jt-drawing-row .col-left{display:flex;align-items:center;justify-content:right;width:60rem;font-family:Alimama_ShuHeiTi_Bold;font-weight:700;margin-right:8rem}.jt-drawing-row .col-main{flex:1;display:flex;flex-direction:row}.jt-drawing-row .col-main .el-input--suffix{background-color:#fff0}.jt-drawing-row .col-main .el-input--suffix *{background-color:#fff0;color:#fff}.jt-drawing-row .col-main .el-input-number__decrease,.jt-drawing-row .col-main .el-input-number__increase{background-color:#3489ff;color:#fff}.jt-drawing-dialog{pointer-events:none}.jt-drawing-dialog .el-dialog{pointer-events:auto;position:absolute!important;background:rgba(5,45,155,.7);min-width:280rem;overflow:hidden;margin-top:0rem}.jt-drawing-dialog .el-dialog .el-dialog__header{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyCAIAAAD9fhrKAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo4NTc1YTY2Yi1hY2U5LTUyNDctODM5MS01MGJjMjM4MDkxMDkiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RDY4MTUxMzk2RDM1MTFFRDkzM0JDNEQ5N0IwQTIxRjYiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RDY4MTUxMzg2RDM1MTFFRDkzM0JDNEQ5N0IwQTIxRjYiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6YjZlNTUzODYtMzRjZC02NDQyLWI4OTktODY4YTdiYTNkMzgyIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjg1NzVhNjZiLWFjZTktNTI0Ny04MzkxLTUwYmMyMzgwOTEwOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Po+VQtwAACdUSURBVHja7H1bluM4kiUMfEjuHpFZtY4+/TGLmQ3MmTMbnf1MdUX6QyIJ2MAAAjC8+JB7ZHZXh7LKQ6IoECSBy2sXFwb4/X/+X2FfEqDv5dh35mXeC+k2CzD/+XfxL72BeVbv04KI7uP6ByD7pZTy6ToMnUTwv3f7rgWG/cNXrhz7AcVtUfOiwP/kOg6mLGRVoq1JUewjsAoLWJQ2RdlTg7CD+y+eJW3MziVU1dfK/wV2LIhXJpQJ/nQhOUFWWxDJRYjnwnfItkB2Z8w/yC7sr9fnXpj8Y/9d27hw/2D4zm/0/4V92EcRtq+bMP9J+AX98UdadxN8oy/D/tXdBeWAvsBQM7/FvwklxzemJ0xyfrflu6JG1T+Hc1mrhKEA/wfTQ9BfAD119x9Ca2R1ZjuEqwdq/Kb7C9vO3oQzZJ9AKdAzqDuoGVC5r3r3j8Gp62XoJaT9g3WBDK3crwwIdfB+mxUmyJP0HXNGAj/uM1zNQWTs8MChMOvJEQYMuDxdepBAQGM7810t2MHIioItnEqwbOx66GBadMSXHHQiCgBHFmDV8h+rJcQPEUaLk+WIFi5YDnyQXPoUs0R+oyTfEWvdkKFaskPYju0t1RLCDrxM/luoHejIm+0qbZ9g6+P2/snOBWDRQVPAggLOgMEBFRh7PoY+DPaJvUIYIvjeb3eG9b39tH6zFoL0Q9eHzVt6A1qOKMdYE7cD+lsBDCtdya7B2QINBEj1YZqMxSAwIKL7J3DVdI0WHbWgY4HdyIp2Z7d+lvreTa+hfHep/M/ZhZS9Gr7pbthqXsmtsdXpepS9MHXTi5xf5XIzX3XXf/tfBkmer2MHkPKdGr0SOckyXGzoO60IYIGBUcEdYFZKSuikFMBLT7pxQprYwXrifAZwtfto3pi9bVEcXVKSVcKtPYT5lSnMlOAaQMKKUobEv2UXF9a7kx4vbkRWnGsxAKxnAIRnrPAtg9FFYM8l93Pg/YA9A31zZCeJfOOBv3znykOv2KG6W/YVpu+xtlHUjlvWXGzu3Dqd6rflx/ZRkH+0vEFofssYCXAbtSNB7O6gxylGfNhRGFFJOdT6jbbFR4jEcHa4EqKrlkOsD2LKs2J9AlGKdVtucv4I9TdQpftrrH88BUSO3QVHI7RaboRWiJW7zy+zoW/jd4Ie0b472y+Q2F+AwHXuXv79f39/GiHr3pCgXQpSxaMeYOx7cxYGBHIKkHIKQhxJ6MOimxQI25jVdWBCy0Up941DSE4JAfKQtUURDcqawrT21YUUnVHkUVoJfByheE0DCGLysIiwkiEX6zwZctkHb3JHofU0ivee7aJx/QoxOTT6b2OVMCmE/0RU0SctOfsqnOz6rS9KszI5Umh2dJHWNjsFXSsw+7nIcCEtKuys2VfILxcWwIf8TdGrI3wxQpQHU/zi5JEjD8HWclhMxX4ecMHgi4ZesOgyBGsZWokCrWD5kPM9otXwbOLK9OphesYiOWvWFA3qddNbivHFc81iq7r8ZrrvJ2Jz/zjuRqnuvQm46rtmsFO0Yaql4w7U4fH5YuJD+JiWsB3Dj9HRYdp0J81LGE7nySMmPZfxflbAemw6wGW42RLMj+bZHEtcL1145NmiPEMWGKmNAwOMkYchZyaenRYiWmgpLx0xcGfXrjwXdMw5xSG/3ZJ/5LKXa0D++I4+R9gKVwwtuVrpNzj6HS7syt/Fuj+E5ghJAAblHeFxG2rhzyWNfgRrZ2HPNDDCVjQm2P4ltPk9kZUfRRmssXRMgzGIhftL7zdCpBuClYxYi02LC7KWwK+JSH4Yj5tEhZiyjLwfBaiq4lSKGonKgzUBK5xdQr5C9wfT/5HCfx5vJhcRkQtYKVrN77BMnjtJPT5pGHK4LCCKHSBidDe/rzQt2S+7CEINL4bBsX7XiNURcTdot5/18NIPXVfiFK8GNB/tGZYhiWBSvt/n8gnN7+9kEccCJSSH4Ai4fsG+stU3BzDI+OEPMS/K7GXgz0foAf6wgVkiYIkJMk2F7/NimBayADDClrZIJDCHLUQBGTdCcKAsPXcKWqODsqABuJPFJApGpx+sskHE20jmINK6KFuAbxvgmR2cCoTE3le5KAoeODNymG7ZKP/IcbdjNrEZTmzVfzMaySEojcE3QeokTnEoYVCFCSxGAT4e3uCU7i/oxMokDCzQKq8MFeTRyv1OquEZoU/pURFgisp1oFhnfiWaxgYCkkEGH8SZMJDi1kBadlvEEcol+x6q4tQ2TwMGw8ClHzF2snu6vN0nFx4mwOUAyILQNNPY4tN1WKUeKDAr/Cj/Cg3QPBnMmhxm4bKoD1PUSML8SmcCZmCmC+dUCwizumlWobYFbEWUs3o8psoXijTeElqsCBeCVE+4wFcEIQsVg9IZNC3hyZhgI7AY1LUVv9KWFJhM/SZioY23iHN1O6bsJGd2lS1VZra/AzY0/HatTsQXG6Vl75MOhoySNjhIHlCzvq6xxMEmVCXH4sSms9wKMmLFeA0bHMxEK9Nl5jehZrEerTM8BUHmaIU5WvHzCvWW06u0NC2pJSZohXJQw3eUXfOZggX1wYMwhn1xU2EfqjZfHYhv1/F9MhGbZjw9xIkrAM0GJG6zoUs5ZhUHRR+PhWCKMGscDDlaNPUUgzcf9+V6IUVLJFSLUSp+ahC3m/9f+v6+UHDoQ9EYCAewWu81rILXyrY4cYMkdHfEyjNNYONMPOLDVd3L1MqVeWGmSqVgiyJ1j2AYptSYtACA2Haz94jN1gOprhSLFbEThhIAErkEIO7TIkOhwPA3+6EQ9cNhUUnEdAvW+0A4SnYdmCiZGhdwHfZCkTMpjlDZD9t8KtlFp+4ATNSuyJjcc1T2KC/rOGQmtIs04uc7uC+0MtxK6GVFFei14VY0QFiEfZipdpiVCajl/RXU1Azi7DaS2HoCRNzlVOmFzTt949XvwlMlKqzoWYnqZIDjZRxvcrkZJiWYkuUwa90NDUi836fn67h2X4dZWHKi+JMANJIMWf1tMphlbj4obTFr7GjokGNSEo95LMIUtgAvfTct2haFERQgYAF6FuMxCDzaoR+rDvQOfIQc+6Af0XaCFPjWYDvV+pEPVmCizfvxv3DqfqgA07sb9sRjARdgfVS/UoLHR31svBBwn/aHa8WPlf8Q07rh1pM6KZBHytXSMB1cx1z+YnQoFYOygQjMhB6RGaZ4ed6jkIRgmuNUihYrWg0erdoxYM7+AlotFAnqZQUxOej+2QNfDa0QK5aOiFZ/gKVp6eGTM9Xjt5UJihpdrYfsFbjKHxWHAAtqStYeyUKv0Zj+dB36DoCcpVHAQd+DV2xaFnz7mEyIZ5AmpeWV2DCQHS8rCcOzDGaZkI7uDmEW6Vl2FBIjI8mU+IxFetgiRZ94n2LUA1Cu5peAm8IjUgA17nnx7qqIXLGXeG0fU9sHYm5eozMNJg9kmldiOsn516qC4TGjS/JgwEQWxYY0iqWqDbVYK2tnpddKJPeCl4O1nbG0TImKmSyOdWJxUuXZ8aFMVp9Ej6/7G3MWUIv4ivFELH7H+UsyIBf0b3qZzt8NmPC1TaiKLlZBZkuDVqjWAcFuxP4pRSseyWJlWNAfjmxQ0ysQTcvFdX6t1OW3fMyxQZ8OhO/YstLtM6xtLEuCAshgEkcDWXbo0KBJMnDDBHIb0M3Xceh7mQwacg0+CEAx1lsDNYN1Xn2nb2/3ZRz70WEWRHaUR4jZaVgY6SU5/KdZRRjSvDH7wUR/wyCQJe/bWI9WQ66oka8RIUMAiD67YDFksV6ira3UD6E+BhLHBDBvIomCE4Ij1vigaFbY3hh/y0+zRLBsH5Ect8nUjo0MZKcTY3NMj4gN8QsTXplrzFgPUhKvQC42p0JVWVobpxjbWiFNWrOVzmkIYhEAZo4EZw1dPhC1R6sLmv8hVAc9c90qPTUTA8r5DbQSVZP/GjF1epXYGSVtaZen4WsHsA4oVbgl0kc6Zv8MUkrrRZiUghSzwqGUJiv8FXuac4NxxKuCWVl4aPe72LlE93mxCIP3aca+uww976xHYMsAUkeeMhMeLkyLYtw1nUyUMAQdmVGIFpPBO0g4R2YchsTXtQ5HYsmngY0JZJxLeDK4WiYgC+fdxvVvwTggMW/7UNmF6aLYjuxYfh+Moj/E5p55rzBy8Ky1MLkwfw85ugh+UrGqaRzBL0V5IhBHNzBUOF6ZFmxhJU5JFHRRM3ChyKV0kUlOLFa0rZogBvpV6joCVWzqDCw3WO4GrcRqtnrScvScvDaMkGIU307AZ2mawIo1awW6/qJ6O+aYjH4WV6+lTNQC9w0w6wvqdHjcBWqerHwECq0MDzS9ZobJYgp3ZoEnSuZBcrPB42iBJlItZM5xfmUhkhZYA7r+Ns3OFzUtNPPIY9YGbHE6sApMvZ1UeafpRrhq2SH049okePiARMLw4lIAL2+CwGAYxSihQxwKTQbbgJ011EZTEmoAcVQxzo7wY4eiFo1gHtIhYh7YAVblTxRYcehAnYwgYJPwM+kzfx/tEsmbvLbpr4oZfuifDeysoer+wvwnDfE3g5u8f2Y6OvPclsyljPKCkkWRoOhyt0DFXZXSGdcXlg+DVqFwsi/IIYw9J7/dGBB0bUfdOppvqEVuTGWiVfesB6ptKwKsq1e1GL3p0jrAsKLWzW9wLmPhASeE35nG9WiqItzmmd/LBLNMQDfRCRPQ+EaZ+rASfYYNLNJbwiwraaEdXnHOCRNpMmBKzYIJT0oIlzWoyvuiHacOdxWCuB4mzMTJW4nOFWLGCF7pYBRzKXD+hWGnAsICPEM6oue9W7w34THCvTHf5SxZx5PbDz5Rsb3bkXrioYd2qz6lnbIYjShoVKmgi9b0acyIp30nSbSGrjL8V8BNIue75mDYkJoCoBDxkSNW5nLvo5UkT/yHcEpO6hwL2K/6b6K/rA6JClDhgYaHVVfABnj1BzlU3XNQkqzcDRBVGYrdCFTgY55pvJYZHSJh0po8oQ5ooPSOlkJLgAp6axDxeumtFZ5uyETWCXwaRyjHgJyzPM4ByglXJ+DSy7stAeIMU4xhIvg5oOEmQp6IghEBhBBCCREjx/wWOgTiJ4pMiq8RaEgTNZz1JW37m6pTnOEMhMGmEWx746PGmkdk2WzAZ2e0HUuUryBUVfAqQS3wF9nbSLDjc4MqlIr7DxjsyOkN1OIIEUppw7Qh82okgSd/yKVfyflNqpufv5Wq7KsPVSJNZh7Z3Kl8TAL3BpMfe/WfuvEbnsAc19ZJ3yOZ4ccPa9bkGBSAyZIjUtBX/3qCSpXRw2yH3lK526Jc+cus3jWNQoJzfmKpH6/IVRAuh1n95CxagkndGI0O6wgiJBHOqnuDV6OK0EzkdlAGupzeBh7lpHRZPLggxqxRAn+AFlV9KgcF8W0sOGhiP96yP9no8djVEJsUoKQPmDHcAqRSllZKQuQ5IPtCJ1JOk5ujcs+XC9A0KU1q9o/VTnWJqFSyqhaxstbQN7ncc6s741ZU1eEbTWbG2nAg7t2kDXp1GrCSYReoh4TbjyYW9jByxNUW4kHP43BfFhqP416H4KhEpOk7Gp+crbROtZpsy7C4a9/d7Pij2dcAzjtSUVIyACiTiTCsCFFXZxX9SSwmvgRgNIrxRwZegXn5CxbAy2teXCjn/IsBNwsMRRxQDUOWaazPGJmom+MqTKe1s6i5FHaHXDAxdjSfZAefbdtjO9sqRHV/qPgudmgjxqmKUNGxMm6CdUcRZrQMc5BiGKENBHQOrbASVWFuSk06vFYWrRYvufc2Euwy2wH3WGEWikZzAxVl0UpkM28i3HVXbcvPoRMrcWc9Kj/+9Dnnwzry5IQ2Zomq+LXyF8KUwZAheZ/mKOMB8PDQORWeiJJBMhWw9D2kwz8UgUthMOtu0MoG4d450TtbaUKpMoWLcS53LHPwsTO332b+g6hkIRTBMpefgcdqq8GCtTsoc/ghcNMApn6FypjgCvIC6mmudjnLKennBCU5ecQjT1k8+ZOW4HWcNmI+Oo9lbFUFstT/WTHxYq4cYTcSt0KZKWIlXytN8zZRFFlDPfe5rBK4LghdVgBmDIuK6pwEJnJraMA7pMnMV+2n9TTQCnG/gT3Ok0+EhFsToUVNzCoHiZidU4LBLJK0bjQrMEkesMIWwEqOKAuqDIbPQoxnT1X2OLVW+O4+WS+ozWxDVvih7zvws5UxyWNTm0kQQjea9oNioudYbpVKfVJ8XF9wR3Uy5TKQMiZrMU9DRClg4335nYYGSgFUmkU546r8Nkxtyaa5ZGUC7Nz96v6t7aIyKbV+lPIn6cDpVgnVw7X2wdzqpetDXylyYdkVOWyl7CiOsl3IyM5mHdVxKnMMrKN4s1wMWik/zc9wn6sFvtKBgQW3S6bjmKI6MlstCUtMJHZJLvZ+jLkLt9Fq+/nBc5N8FrCwkavveGBYbC80+FWutvP4ZCfHt/uEGvPgyB5LUeIr7CqD+QXbKgY3zR+DiQagboasadPs1IfWhmcNfZdoWJlchKkRwu9mqJ6JESfL+9bWHow/btoKBPk+72+BOsYLBd51EHP9CZ6lETMuloBYDIErwyDVprDdPrI5vVgkOWq9P/IIPVjO9semovRogYjtjRW2VSFVWCN+WAwL5mN03BNwNWhFG3RuW03izAwf3SieJoeUWHO6CdU/CWlzOeRDmY0AUGS2We2Cyhx2HHEzR7v8roNoVUrseKxl7KpX+ABgcR4koFQNEsxqznfnuVFCT8x+yNKzZVZk5hd9smb5vDLMLs/dAbnt3v4ldjarkAQFsOEVcbmrWrTL/mS0ye7vk4rPniwNRGqPggihMXrlwI18HDAHKEhd2lAMswtRptvHhgiFNcnpSBIF3EztUOYthk0hbEM/2tCnWukcoK277Ra7e5VEKyVKYbMSMQNaBZ5SM0FoDXp4sjmOM3cw1jTskrqhz4bqDi0RHPepCVVZYIiVM6P8CuPzmuU9y7EVjG8t/MdCad/RCo6hFZ4OCc8PIO8NG5eYdZvUnXIuhPAoWpjJDHXpx76LFwViGJVJrPlIov/e8CE7P9qlVKYg0TCudlDJ8CZNehXwC8Is1liLkGwP02uHmIOsiIlmipCk9HGJIidpYV/AChAkOUiTjIgs711mCYN0lLNIQ1oLlwW3rSTWxNp2URwUoTEqB7VsL1D0lXTkBCE95W37FbsgmOUmbJAsgaK0QebyFFZOByu2hyhKlOGeaKf6ZMRHw4D9C9lEcTE8S06vujcIOKSzeEoZqyqHU0NE+YSDpDmD2WIZ1K5VN/3Q3RNl46tEvXhC2dyXT/FhDasJPznuiE2exakWwywT6H3cab5OktvXN8K+k7Q6Tj4jmvdkyJNGBsnMZz2YFj3Ns7K4YOK5y2BFdxS5vsZM862Hc8gX6JKUQvZcTrCWJXthaQCAz5CJxApZsIciW0YIc7isdKZKVFjLebCT/a6aL6GWGXd3GgXUdJzyPWw0zloNoWa5Fzmgi329t9WxzgUplVwCmOdbqIANf5Dod+gvdtLMBkhhbXzAcy8YoAfKdaUXsUw03a9/CtOPMZsSVD/v5DsNF4NZ3fSHsGJWUn2tpDIHUoRZ0InD8nqJ4J/0pRxjWHjU0d4IHDDDLEN8XJaFJE+m7+WDW8JnYzA7S7fHx/j80/U2zwawHFEywHexqSO22l8ZWjKVyZRzV2omHwYKkSZ9BagkFUe+gg3E7HcpdeISdAWReQIErmQlEnLE3Gya3iMv/MS3x/cR5+1U+BPK3H7I46Z81p6+k/OxQujxd3ghkVsqaxaVB0Eqe2Bo0RHPwndKqqdMgW+yWwwVQoBK1dpQxeynvRq/Ww/qvWCUKOcPA4uqt8FsKwzcGhHG/cv+IGDt+WgSHf3Qz6O6ZEiKiQSVc/1DYByr/D0OPVkZoKmF1YplUAVonjS3ZVkIXOzSXkN3GX1i1Wpa8SQzShYJWkVT4X1Wi8s8k156nhVUlOv1IE+7VxqF0gm5KVEFwGRr1jSgblKqDMtycnTKCYXHrOdiM4dnS9jaaGDbrvcjVqwjRxENh1ruvMIkC01xZXErCMIKVPGWa5q+fpdEW+J0nJyLYK3HJ8I5YRaSt/2D0vVpO25oMCtbpWYTp/hhNPQ4fpMTgLpVfrvcpV7IimXqvE2jTyVmOOxceSQkPB0bhmtheMq83OcF+SoyEH95HbqrAxcshr22YCsSk2XBm4nc1LryoCnQzabO5ihB3gqbwa8piuA1DCqloniZHymP5yCBLpHYqlBUkoqKQn7HjTpCNjdxe07fWSfU2TmJu213e4mn4673I/U5mPm9PtbHODSyYBObqCU2+EbT1uCm/N0Is9zKXfVflzJ/VhqgzczXLR/W9X4HpZUT9RvCXAlVKcBKZTBr7uJiq5we6MWEjdrAljkEdIemamJtXtmW2vDJkPAx3T0Fl0Vpw1MmZ78sVFiyTQ09raZTldghs97Uqzk5CV+vdIfQqu8SjZytiZPKQ9kzdd3bxICGrPFlXIJ7NZtIA4xUlY2YLQ+RZrKCjWud5bfL3sY1Lb4+KPr1arCPkvI0o5qG36IeFS0zmIDOhFrdRbQTrOLm0hhIijjYbDAa1NQh6U0GB7cEsupEGj+mQY55w9+Wd9TlUdFimbKu92FniAPxAUf7YwyrETqJzdiwHCo2UKJMGOgn5XGvlX3XSfl06Ya+q1A2n4evrulCSMsviLstyolWPZBoZTX7QqHHVB1PleCgYZmazospcEGsqeDFslIY85pm05DrRIyFnGno1zDBQf4M2EjP8cCz5fO9G35m+X8BWNXPBkUtrKqB3J7PO0cKraV+050yoda6jncp7Vdni7LPWl7FADC909ChWqR+FR3BFgpZ54QNW1l4q4dn4hKL85TmR5XLjXyS4zMdt41Wpy82PgBYZ6bLb9vfHZTcbLKXPGSyb/uOsmX1UlbCTN4OIGUUTJNSdIh5nZloE4f6RMkF2c2MEal2HhoIha6TmgMZLBJyYmEyh4L05USswqegGjnklzcTs1p3B44/sHiEA5sL11eZelWmqu5/ZK345orxj76gfeiNyYQHw0aWB34/LK3pXFk3jhEomKck6HehFeUyZpLWIe+431XDKAbZza+gZ1vgm9XI7OzCwzjFi9X9BcDZHWZRRA9mY3f/Q/SuzrIJzQcHOg60gv44MLW+qpMsu4lWxpkWytvX8JTaAUGPVjG/diW3ZKbVBPVn1vo+LbNPwWxiwKdxoOmH22pXJtUzVFpIYrcqmEi9YZgDZco+sSRighsgdtOmQyaOQ1yTFFpaSQZtojqvqJiXgmxjdVXBZHSKz9sJBB8gtka2Q2Uwvz2T50S2qnLWULtwTGtbXTMxmdBbu0QHKMF2KpVKYFjrnLEeIafVTSpF4Vg3tPVEbFaHWkuvhu9SvIKdxgzzh8EsNbxg1MiwyYGwgriUV/7yrfNDh8U56lXS6l+i0i+OORjw6ODgkZDwXARQMqN50WsamYokj26yyxNN0gOBVb26mNaTA6JBFn2b5yBaDUP/vGr2KAAqFxfaiqmFuHnSVgXLGBmnL1AfWhJ1CzqKRk2iEgk5LysXXqjhWnEfYGM2S2aPxWxNp222EYxumoVFNYnmgUlBTQ5X3DinJCazTnGr8Gq1N/bE0hNbUiRo3sdC1cYd6G3zOJrZp/6gUIskLWhL+yV8+V1BquGbFNKuz2xiECdpvawZrNp8qv7coL49WLuDlMtH9daa7WCo3PBijWAHiBUbADuFWUcWoajj04aehda78GHgJNONg2nIoNXQPV+GZtNOO3nJuQykGGL1MS1hcayL9UM0L3uJGmn9tc3DdbNJnKHiVQ2F5E0tXdXmKJAxRoQbD+forirjTcECT8RzefV2Ap9jfOin6UWHdI1Thi98qFolHOoDkCRaeYLZt43RRr4GDS2r1S+pAlU3SDTwizALSYanoUOhlFR/iOHJurTkgcGFgsFBZzCLlkxf3vMUo+tk7KnTCw7fRHfRZXh4JBh8XMP6xEtR1lCS2JM6MBphut86ILg1fQxbQGPAS9tI826Xt6GpmTZpHy2fkyQ2SDt5uawmbx2UnXmenQoGdcjn+dmrpyYKrYy5w6pcCXfVQww+1a2ui4fUzUPyT4KPWJH095+HrX2SpSK+6JWtT5EVDnztyXz1sc9VBvER2N0FiLRYks8NBHQ81MJ2eZVy7EKE0i57o0mUn96sDP9sC9yoRusj0JLOVOA7CFXjerq7/9DDM5Dj4euxZQ+wiuG8xrfxtVjX0ryoFiOTkhZtNvRquxwhapqXAxdafpXSgLrfdlIaptb3sBHrVfwB7GLPBH8+dG3oDlUU8ws0ayhWOcuJD1ak5nwAYaOVAx7puzvi44EYP1mlAo49Dzf2Sd2bmKX4hXOaQ6N1NNa/SD+2ltIol7eoD0VUq3cojT3iQcirajqmdvNdmqZpuJKVtHD7oVWNU8nZAHJ6FZp6JSzW9jW+RNvXSdg1oSUtezC/0lhkRfgSNkWXUiNTzeoaIB5F+UcZViM29AIQpa8yYaBuNva+k08XP0Nwo6OCaA032MWi55CfyBT4fLVzbtLHbHuIh0MYwYC13S+6EbXBtk4BqbyYS0pBs2jEKNC8SblJO2eLmyu+PUZfHo65Ho7IPj8N6EvqeTz7YO74PXB8bPbJ0k5fy6jlJS39TxPf6f4iBGzDU7XZazni+BuN9Nn8fLTU4E0Jg1mmQISj15P7J8iaL+X0B+i53oDVvbstNoXWRZTDcY+ilXl1f/8f/+fQo7uJJS60x2kitEJs7mxw6sUm/dwOglrfart41/stHsKU9Xwdu2q0DBUqlNeZbPcktCFurrN4dBvDISzoVmNqFWD726zc/6KWpn/JF+7lLMd16cA85MS2nrWj5KAd8gM78bg+utLy2fuZ0pI4GhkdLM8y4aG6U5sysSHA+cCWfPVCjiZidQXW+og5xI26nuxESFL6uQcPoDobZ1biN7cManQtFVWg8bu+f74OsL1OQftbskcEp5WdczN23ZMpsFS7anythHMT0X9MNDs616NKqo9Qj4ZbQNZSlPJhr4biDq1blYW3B7D+1+vLEOpAXFwfIdWPcMSGhEQ5ZPSC/bOQ/S5C1YLNTo2/CfFKsw4tdJKkZYf2cr3piOuV3O4dXn43PIsvWpH92ESOAhfdf3My3Ofly/7Q5awjEdgw0MRok9bYCusMulyG7skPCDYDt3ZU6MJA5Z1WNk9p/3Tpd5577eeGKertvkTRih0RK1DUQKeaAoV7UAK7T+m6hgWNFAK/wOunw9ODPOtIqZtTqutaLrm0KNQK8hCeOwtSzUnSIncCtX/rVl/U5TdaE0wcwqm0E0h1+V3AD1OOKNF5lbToEHr8rkiGg58PWO1TuM+LgZKNLiMNWo1+hmBDmm3mXLZ/5sVFmhgKvI6DHRDc66hY84zbRXTephmx6kwvbnViJoQWfxQbcJaVcyYchlN949c8wv9UyIbtBz9ugtg2sKGVtG7/VG15aLcyZHcgBeqN1qAn3jH3t3+o4beiQDzYuAxxQ+i6+U20GKVe5O0fOH5HK379fMAqerehVB/TdPcpXCrhonMbXNIBwRZXrSEXUk6r5WOKgNjR+mDjMMidltFAAeu0IutWGcU14WKbaycCaGvZLAH7I0rH0O0Xk/oLkQmOjR5ud/At/wmeePCg6u7/BPWih+fcVAWHRjN090wJv0k1t92B7Aj/Afgtc2kdfwiauJLmBJsCUbVmi6+G+PEFoXv4Qds/cO9MMPV2CzFarmqtKUMNuDiJ/fgQNUMujWiIVZgeKOyA4MuVkqrvx0Glux1dgtPZ5oqAY0/JDZ0bjksHtWRKsF3j3Zw+p3EL/nT+Be2nAB77yfbHLyz50PXBnbykR4ZNTtPhHdGAco3ioofvO/2/UQwlDrx0BviEXjkBTK/QKcwA5ThmUYYs2U0/nN2hqunZZX4mikDlg+HhOcBy67+/TxPiltA1kNvAgstDUsuiVHRa2V/0fWfQSsIBbKrdYFLBDMLyyR01negw48cDJwJnpIttgBON9RK+WpT5E4Kl40s6f2YtQnGyKPyiM8SvukxHi5LLfVWgilTLW304TAQ1+HT5m7z/sHYHl4Dhw3Audflet1Dt1Ra7UV3/1q0FNhq4XvqPf5hDGDb3AGYdsDUEBEVhSArFaLglKhta9e3pIuWBqtQggjSmSN/sgODQPz8NUC5ceuxKzrZAvfEQ3C0Pzj8K4Iv3+/X6VxK4HgG4RgMGJIOCgRo7DAe7vy3GwIHyMZh/9ZIUCJ1N8ACn6k9eDvJPXIJ/onWSZKqgSSrDqc51wtagNL7ZjFZ5XdOEwmPfv1yHo1ZlzMWg+7x8cBUf8DoOmWZfzrHYuMW3UOCGnWo/1sDTcIYPNesvgK9treVsOAQNEotbttctblhmkoF2lpvqQbEotrry9cEz/dLkNp9nsrsOr/p2bSM7ZdNXPZDREdZJgiG/KGlk/yHwe1lgC6dSEHRDh3/YqddNKmoN8bMaf09yPHw+JAwkBbGd2Mx2WwMuT2N/JlqL+66L6Ni5x2FlwKeLHRA8pnyVtz5RwfCEHHTunuNJV+fGI+ULYjc8GZKd9ZufNdTjsXL2AkKopk/HM+e1a4v8OZHzTxjhrfq27OQb63h4SIFyQ4edKcRXuLOSfCwQT/Q+KnAFwbfqLBGPlHN/+39qLAYoHwYscwjDULKZzOVOkiT2YV1DsFlSs0KLxne7LkVS4MXEgg+OgCbzDc83lyPmg0+kJv6ijgH/ncLJv9C0keXi+vk1x0eLIlOVVqcVqKD59M800nf/4ewOlgRZSWv8LSvwoP/TgmDfTT/EhoHWDVDqFzV+O4JZWxqWpjAwGaqrXyYJ3wy56rozcU3cycSZbx+TinmjaT7zt6dLZRJPK85IX4YPvt5mrfVfoBnBA/X9RB8+wjAOrb/0ic6En/7JLh3ELzovPEDpML28eIC2HrsAcNa39VgDjApU/0AtDb5gdwE1gYeYtUDZafkIcbMFDrBMsIn1JjaUlJdiFJsuLVrStQVY86JfOetpMbSuDS4HOqjhbm+3iZ/KYDX7TsJDV4eSZL3f5p+COn8F0ok9XefX68+hd3AcVfBPq1TzK5rEBwI3nOXtBTpJNe+vJJmjih1ruQk3G/GBChr07A0IzrA5UcmAEc2XlP0G1DZF948pEb9bL0OrXi4jwIFLCnWN6e5EK7/rZbBTDh+6gYaivVNSK/VpFMIvw5gvPSb+Jf3i1+vPu9rngHEn7pleBU2I+W3XWV7JvQNyuf7eTa8kw4e4Z/pheJAev+8UiHWepa5/l5OdwbNNoG7/EON3sqG2GFK5JI9hKNOidq8IgctlAHjksUPB5n3KNKansb9eBmhGyFsAobNBzPI3B1dmgD+hDVeHun69/lWZGZ4Zf8RzrW+zYC9p/a7lA1owOFGJZi/HAp1L63e3pMU5LyBITVOvIUmyXFWpbNYaC7WVAcr/L8AA+dSd3OMf2BsAAAAASUVORK5CYII=) no-repeat;background-size:100%;margin-right:0rem;padding:6rem;text-align:center}.jt-drawing-dialog .el-dialog .el-dialog__headerbtn{height:34rem}.jt-drawing-dialog .el-dialog .el-dialog__body{padding:10rem;color:#fff}.jt-drawing-dialog .el-dialog .el-color-picker__trigger{width:120rem}.jt-drawing-dialog .el-dialog .el-body-foot{position:absolute;bottom:8rem;right:8rem;width:calc(100% - 16rem)}.jt-drawing-dialog .el-dialog .el-body-foot .el-button-group{display:flex}.jt-drawing-dialog .el-dialog .el-body-foot .el-button-group .el-button{border:solid 0rem rgb(255,0,0);flex:1}
  43576. `;
  43577. const _hoisted_1$1 = { class: "jt-drawing-dialog" };
  43578. const _hoisted_2$1 = {
  43579. slot: "title",
  43580. class: "header-title"
  43581. };
  43582. const _hoisted_3$1 = { style: { "line-height": "24rem", "font-size": "16rem", "color": "#fff", "font-family": "'Alimama_ShuHeiTi_Bold'" } };
  43583. const _hoisted_4$1 = { class: "odin-dialog__content" };
  43584. const _hoisted_5$1 = { class: "jt-drawing-row" };
  43585. const _hoisted_6$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u989C\u8272", -1);
  43586. const _hoisted_7$1 = { class: "col-main" };
  43587. const _hoisted_8$1 = { class: "el-body-foot" };
  43588. const _sfc_main$1 = {
  43589. __name: "CrEditProperty_MilitaryPlot.ce",
  43590. props: {
  43591. params: {
  43592. id: {
  43593. type: String,
  43594. default: () => void 0
  43595. },
  43596. color: {
  43597. type: String,
  43598. default: () => "255,255,0,0.9"
  43599. },
  43600. outlineWidth: {
  43601. type: Number,
  43602. default: () => 0
  43603. },
  43604. outlineColor: {
  43605. type: String,
  43606. default: () => "255,255,0,0.9"
  43607. }
  43608. },
  43609. showDialog: {
  43610. type: Boolean,
  43611. default: () => false
  43612. }
  43613. },
  43614. emits: ["submit", "update:showDialog", "update:params", "remove"],
  43615. setup(__props, { expose: __expose, emit }) {
  43616. const props = __props;
  43617. const language = ref("zh-cn");
  43618. const locale = computed$1(() => language.value === "zh-cn" ? zhCn : en);
  43619. const {
  43620. proxy
  43621. } = getCurrentInstance();
  43622. const predefineColors = ref([
  43623. "#ff4500",
  43624. "#ff8c00",
  43625. "#ffd700",
  43626. "#90ee90",
  43627. "#00ced1",
  43628. "#1e90ff",
  43629. "#c71585",
  43630. "rgba(255, 69, 0, 0.68)",
  43631. "rgb(255, 120, 0)",
  43632. "hsv(51, 100, 98)",
  43633. "hsva(120, 40, 94, 0.5)",
  43634. "hsl(181, 100%, 37%)",
  43635. "hsla(209, 100%, 56%, 0.73)",
  43636. "#c7158577"
  43637. ]);
  43638. const title = ref("\u5C5E\u6027\u7F16\u8F91");
  43639. const dialogVisible = ref(props.showDialog);
  43640. ref(false);
  43641. const color2 = ref(props.params.color);
  43642. const outlineWidth = ref(0);
  43643. const outlineColor = ref(props.params.outlineColor);
  43644. updateParams(props.params);
  43645. function updateParams(params) {
  43646. proxy._params = params;
  43647. switch (params.id) {
  43648. case "DrawStraightArrow":
  43649. title.value = "\u7ED8\u5236\u76F4\u7EBF\u7BAD\u5934";
  43650. break;
  43651. case "DrawAttackArrow":
  43652. title.value = "\u7ED8\u5236\u653B\u51FB\u7BAD\u5934";
  43653. break;
  43654. case "DrawPincerArrow":
  43655. title.value = "\u7ED8\u5236\u94B3\u51FB\u7BAD\u5934";
  43656. break;
  43657. case "DrawGatheringPlace":
  43658. title.value = "\u7ED8\u5236\u96C6\u7ED3\u5730";
  43659. break;
  43660. case "DrawClosedCurve":
  43661. title.value = "\u7ED8\u5236\u95ED\u5408\u66F2\u9762";
  43662. break;
  43663. case "DrawSector":
  43664. title.value = "\u7ED8\u5236\u6247\u5F62";
  43665. break;
  43666. case "DrawBowLine":
  43667. title.value = "\u7ED8\u5236\u5F13\u5F62\u7EBF";
  43668. break;
  43669. case "DrawLune":
  43670. title.value = "\u7ED8\u5236\u5F13\u5F62\u9762";
  43671. break;
  43672. case "DrawCurve":
  43673. title.value = "\u7ED8\u5236\u66F2\u7EBF";
  43674. break;
  43675. case "DrawCurveFlag":
  43676. title.value = "\u7ED8\u5236\u66F2\u7EBF\u65D7\u5E1C";
  43677. break;
  43678. case "DrawRectFlag":
  43679. title.value = "\u7ED8\u5236\u77E9\u5F62\u76F4\u89D2\u65D7\u5E1C";
  43680. break;
  43681. case "DrawTriangleFlag":
  43682. title.value = "\u7ED8\u5236\u4E09\u89D2\u65D7\u5E1C";
  43683. break;
  43684. }
  43685. color2.value = params.color;
  43686. outlineColor.value = params.outlineColor;
  43687. outlineWidth.value = params.outlineWidth;
  43688. }
  43689. __expose({});
  43690. function submit() {
  43691. let outParam = proxy._params;
  43692. outParam.color = color2.value;
  43693. outParam.outlineColor = outlineColor.value;
  43694. outParam.outlineWidth = outlineWidth.value;
  43695. emit("submit", outParam);
  43696. }
  43697. function close() {
  43698. dialogVisible.value = false;
  43699. }
  43700. function remove2() {
  43701. emit("remove", {});
  43702. dialogVisible.value = false;
  43703. }
  43704. function closeDialog() {
  43705. emit("update:showDialog", false);
  43706. }
  43707. function openDialog() {
  43708. updateParams(props.params);
  43709. }
  43710. return (_ctx, _cache) => {
  43711. return openBlock(), createElementBlock("div", _hoisted_1$1, [
  43712. createVNode(unref(ElDialog), {
  43713. modal: false,
  43714. "destroy-on-close": false,
  43715. modelValue: dialogVisible.value,
  43716. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => dialogVisible.value = $event),
  43717. title: title.value,
  43718. style: normalizeStyle({ left: "10rem", background: "rgb(0 44 126 / 68%)", height: "calc(100% - 175rem)", width: "180rem", top: "125rem" }),
  43719. onClose: closeDialog,
  43720. onOpen: openDialog,
  43721. "show-close": false
  43722. }, {
  43723. header: withCtx(() => [
  43724. createElementVNode("div", _hoisted_2$1, [
  43725. createElementVNode("span", _hoisted_3$1, toDisplayString(title.value), 1)
  43726. ])
  43727. ]),
  43728. default: withCtx(() => [
  43729. createElementVNode("div", _hoisted_4$1, [
  43730. createElementVNode("div", _hoisted_5$1, [
  43731. _hoisted_6$1,
  43732. createElementVNode("div", _hoisted_7$1, [
  43733. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  43734. default: withCtx(() => [
  43735. createVNode(unref(ElColorPicker), {
  43736. modelValue: color2.value,
  43737. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => color2.value = $event),
  43738. "show-alpha": "",
  43739. predefine: predefineColors.value,
  43740. label: "12"
  43741. }, null, 8, ["modelValue", "predefine"])
  43742. ]),
  43743. _: 1
  43744. }, 8, ["locale"])
  43745. ])
  43746. ]),
  43747. createElementVNode("div", _hoisted_8$1, [
  43748. createVNode(unref(ElButtonGroup), null, {
  43749. default: withCtx(() => [
  43750. createVNode(unref(ElButton), {
  43751. type: "primary",
  43752. icon: unref(edit_default),
  43753. onClick: _cache[1] || (_cache[1] = ($event) => submit())
  43754. }, {
  43755. default: withCtx(() => [
  43756. createTextVNode("\u4FEE\u6539")
  43757. ]),
  43758. _: 1
  43759. }, 8, ["icon"]),
  43760. createVNode(unref(ElButton), {
  43761. type: "primary",
  43762. style: { "background-color": "rgb(222, 146, 47)" },
  43763. icon: unref(delete_default),
  43764. onClick: _cache[2] || (_cache[2] = ($event) => remove2())
  43765. }, {
  43766. default: withCtx(() => [
  43767. createTextVNode("\u5220\u9664")
  43768. ]),
  43769. _: 1
  43770. }, 8, ["icon"]),
  43771. createVNode(unref(ElButton), {
  43772. type: "primary",
  43773. style: { "background-color": "rgb(126, 128, 135)" },
  43774. icon: unref(close_default),
  43775. onClick: _cache[3] || (_cache[3] = ($event) => close())
  43776. }, {
  43777. default: withCtx(() => [
  43778. createTextVNode("\u5173\u95ED")
  43779. ]),
  43780. _: 1
  43781. }, 8, ["icon"])
  43782. ]),
  43783. _: 1
  43784. })
  43785. ])
  43786. ])
  43787. ]),
  43788. _: 1
  43789. }, 8, ["modelValue", "title", "style"])
  43790. ]);
  43791. };
  43792. }
  43793. };
  43794. var DialogEditProperty$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["styles", [_style_0$1]]]);
  43795. Cesium.Entity.prototype.setParams = function(params) {
  43796. this._params = params;
  43797. };
  43798. Cesium.Entity.prototype.getParams = function() {
  43799. return this._params;
  43800. };
  43801. Cesium.Entity.prototype.setIsEdit = function(isEdit) {
  43802. this._isEdit = isEdit;
  43803. };
  43804. Cesium.Entity.prototype.getIsEdit = function() {
  43805. return this._isEdit;
  43806. };
  43807. class DrawMilitaryPlot {
  43808. constructor(options2) {
  43809. if (!options2.viewer)
  43810. throw new DeveloperError("no options.viewer object!");
  43811. if (!options2.Cesium)
  43812. throw new DeveloperError("no options.Cesium object!");
  43813. this._viewer = options2.viewer;
  43814. this.cesium = options2.Cesium;
  43815. this.drawArr = [];
  43816. this.Draw = "";
  43817. this.edit = new EntityEdit(this._viewer);
  43818. this.edit.activate();
  43819. this.edit.EditEndEntity.addEventListener((result) => {
  43820. if (result.Type) {
  43821. this.handleFirstPosition(result.Type);
  43822. this.edit.DrawExample = this.Draw;
  43823. }
  43824. this._editEntity = result;
  43825. });
  43826. }
  43827. static initEditPropertyParams() {
  43828. return {
  43829. id: void 0,
  43830. color: "rgba(0,255,0,0.75)",
  43831. outlineWidth: 0,
  43832. outlineColor: "rgba(255,255,255,1)"
  43833. };
  43834. }
  43835. editActivate() {
  43836. return this.edit;
  43837. }
  43838. handleFirstPosition(type2) {
  43839. this._viewer.scene.globe.depthTestAgainstTerrain = true;
  43840. switch (type2) {
  43841. case "DrawStraightArrow":
  43842. this.Draw = new MilitaryPlot.DrawStraightArrow({
  43843. viewer: this._viewer,
  43844. Cesium: this.cesium
  43845. });
  43846. break;
  43847. case "DrawAttackArrow":
  43848. this.Draw = new MilitaryPlot.DrawAttackArrow({
  43849. viewer: this._viewer,
  43850. Cesium: this.cesium
  43851. });
  43852. break;
  43853. case "DrawPincerArrow":
  43854. this.Draw = new MilitaryPlot.DrawPincerArrow({
  43855. viewer: this._viewer,
  43856. Cesium: this.cesium
  43857. });
  43858. break;
  43859. case "DrawGatheringPlace":
  43860. this.Draw = new MilitaryPlot.DrawGatheringPlace({
  43861. viewer: this._viewer,
  43862. Cesium: this.cesium
  43863. });
  43864. break;
  43865. case "DrawClosedCurve":
  43866. this.Draw = new MilitaryPlot.DrawClosedCurve({
  43867. viewer: this._viewer,
  43868. Cesium: this.cesium
  43869. });
  43870. break;
  43871. case "DrawSector":
  43872. this.Draw = new MilitaryPlot.DrawSector({
  43873. viewer: this._viewer,
  43874. Cesium: this.cesium
  43875. });
  43876. break;
  43877. case "DrawBowLine":
  43878. this.Draw = new MilitaryPlot.DrawBowLine({
  43879. viewer: this._viewer,
  43880. Cesium: this.cesium
  43881. });
  43882. break;
  43883. case "DrawBowPlane":
  43884. this.Draw = new MilitaryPlot.DrawBowPlane({
  43885. viewer: this._viewer,
  43886. Cesium: this.cesium
  43887. });
  43888. break;
  43889. case "DrawCurve":
  43890. this.Draw = new MilitaryPlot.DrawCurve({
  43891. viewer: this._viewer,
  43892. Cesium: this.cesium
  43893. });
  43894. break;
  43895. case "DrawCurveFlag":
  43896. this.Draw = new MilitaryPlot.DrawCurveFlag({
  43897. viewer: this._viewer,
  43898. Cesium: this.cesium
  43899. });
  43900. break;
  43901. case "DrawRectFlag":
  43902. this.Draw = new MilitaryPlot.DrawRectFlag({
  43903. viewer: this._viewer,
  43904. Cesium: this.cesium
  43905. });
  43906. break;
  43907. case "DrawTriangleFlag":
  43908. this.Draw = new MilitaryPlot.DrawTriangleFlag({
  43909. viewer: this._viewer,
  43910. Cesium: this.cesium
  43911. });
  43912. break;
  43913. case "DrawPoint":
  43914. this.Draw = new MilitaryPlot.DrawPoint({
  43915. viewer: this._viewer,
  43916. Cesium: this.cesium
  43917. });
  43918. break;
  43919. case "DrawPolyline":
  43920. this.Draw = new MilitaryPlot.DrawPolyline({
  43921. viewer: this._viewer,
  43922. Cesium: this.cesium
  43923. });
  43924. break;
  43925. case "DrawPolygon":
  43926. this.Draw = new MilitaryPlot.DrawPolygon({
  43927. viewer: this._viewer,
  43928. Cesium: this.cesium
  43929. });
  43930. break;
  43931. case "DrawRectangle":
  43932. this.Draw = new MilitaryPlot.DrawRectangle({
  43933. viewer: this._viewer,
  43934. Cesium: this.cesium
  43935. });
  43936. break;
  43937. case "DrawCircle":
  43938. this.Draw = new MilitaryPlot.DrawCircle({
  43939. viewer: this._viewer,
  43940. Cesium: this.cesium
  43941. });
  43942. break;
  43943. }
  43944. }
  43945. addEntity(data) {
  43946. this.handleFirstPosition(data.type);
  43947. if (this.Draw) {
  43948. let entity = this.Draw.addload(data.position);
  43949. entity._id = data.id;
  43950. return entity;
  43951. }
  43952. }
  43953. }
  43954. Object.assign(DrawMilitaryPlot.prototype, {
  43955. _setMousePointerStyle() {
  43956. document.querySelector("body").style.cursor = "crosshair";
  43957. },
  43958. _setMouseDefaultStyle() {
  43959. document.querySelector("body").style.cursor = "default";
  43960. },
  43961. _registerLeftClickEvent(handler, callChange) {
  43962. let _self = this;
  43963. if (!handler)
  43964. return;
  43965. handler.setInputAction(function(event2) {
  43966. _self._lock = true;
  43967. clearTimeout(_self._timer);
  43968. _self._timer = setTimeout(function() {
  43969. if (callChange)
  43970. callChange(event2);
  43971. _self._lock = false;
  43972. }, 200);
  43973. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  43974. },
  43975. _registerMouseMoveEvent(handler, callChange) {
  43976. let _self = this;
  43977. if (!handler)
  43978. return;
  43979. handler.setInputAction(function(event2) {
  43980. if (_self._lock === void 0 || _self._lock === false) {
  43981. if (callChange)
  43982. callChange(event2);
  43983. }
  43984. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  43985. },
  43986. _registerLeftDownEvent(handler, callChange) {
  43987. if (!handler)
  43988. return;
  43989. handler.setInputAction(function(event2) {
  43990. if (callChange)
  43991. callChange(event2);
  43992. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  43993. },
  43994. _registerLeftUpEvent(handler, callChange) {
  43995. if (!handler)
  43996. return;
  43997. handler.setInputAction(function(event2) {
  43998. if (callChange)
  43999. callChange(event2);
  44000. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  44001. },
  44002. _clearEvent(handler) {
  44003. if (!handler)
  44004. return;
  44005. handler.destroy();
  44006. handler = null;
  44007. }
  44008. });
  44009. Object.assign(DrawMilitaryPlot.prototype, {
  44010. _setEntityIsEdit(entity) {
  44011. let _self = this;
  44012. this._closePropertyEditDialog();
  44013. entity.setIsEdit(true);
  44014. this.edit.handlePickEditEntity(entity);
  44015. this._sendShowPropertyDialog(entity);
  44016. let handler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  44017. this._registerLeftClickEvent(handler, function(event2) {
  44018. _self._closePropertyEditDialog();
  44019. let feature2 = _self._viewer.scene.pick(event2.position);
  44020. if (feature2 !== void 0 && feature2.id instanceof Cesium.Entity) {
  44021. let editEntity = feature2.id;
  44022. if (editEntity.Type == "DrawStraightArrow" || editEntity.Type == "DrawAttackArrow" || editEntity.Type == "DrawPincerArrow" || editEntity.Type == "DrawGatheringPlace" || editEntity.Type == "DrawClosedCurve" || editEntity.Type == "DrawSector" || editEntity.Type == "DrawBowLine" || editEntity.Type == "DrawBowPlane" || editEntity.Type == "DrawCurve" || editEntity.Type == "DrawCurveFlag" || editEntity.Type == "DrawRectFlag" || editEntity.Type == "DrawTriangleFlag" || editEntity.Type == "DrawPoint" || editEntity.Type == "DrawPolyline" || editEntity.Type == "DrawPolygon" || editEntity.Type == "DrawRectangle" || editEntity.Type == "DrawCircle") {
  44023. _self._sendShowPropertyDialog(feature2.id);
  44024. }
  44025. }
  44026. });
  44027. },
  44028. _sendShowPropertyDialog(entity) {
  44029. let _self = this;
  44030. let editEntityType = entity.Type;
  44031. if (entity.getIsEdit() === void 0 || entity.getIsEdit() === false || editEntityType === void 0) {
  44032. return;
  44033. }
  44034. let editProperty = entity.getParams();
  44035. if (editProperty !== void 0 && this.onEditProperty !== void 0) {
  44036. editProperty.id = editEntityType;
  44037. _self._openPropertyEditDialog(
  44038. editProperty,
  44039. function(params) {
  44040. _self.updateEditEntityProperty(params);
  44041. },
  44042. function() {
  44043. _self._viewer.entities.remove(entity);
  44044. _self.edit.clearAllEditVertex();
  44045. }
  44046. );
  44047. }
  44048. },
  44049. updateEditEntityProperty: function(params) {
  44050. if (this._editEntity === void 0)
  44051. return;
  44052. if (this._editEntity.getIsEdit() === void 0 || this._editEntity.getIsEdit() === false)
  44053. return;
  44054. let editEntityType = this._editEntity.Type;
  44055. if (editEntityType === void 0)
  44056. return;
  44057. let material = this._editEntity.polygon.material;
  44058. if (material instanceof Cesium.ColorMaterialProperty) {
  44059. let newMaterial = this._materialColorProperty({
  44060. color: params.color
  44061. });
  44062. this._editEntity.polygon.material = newMaterial;
  44063. }
  44064. if (this._editEntity.polyline !== void 0) {
  44065. let newMaterial = this._materialColorProperty({
  44066. color: params.outlineColor
  44067. });
  44068. this._editEntity.polyline.material = newMaterial;
  44069. this._editEntity.polyline.width = parseFloat(params.outlineWidth);
  44070. }
  44071. this._editEntity.setParams(params);
  44072. },
  44073. _materialColorProperty(options2) {
  44074. let mColor = "rgba(0,255,0,1)";
  44075. if (options2 !== void 0 && options2.color !== void 0)
  44076. mColor = options2.color;
  44077. let colorMaterial = new Cesium.ColorMaterialProperty(Cesium.Color.fromCssColorString(mColor));
  44078. colorMaterial._param = {
  44079. color: mColor
  44080. };
  44081. return colorMaterial;
  44082. }
  44083. });
  44084. Object.assign(DrawMilitaryPlot.prototype, {
  44085. drawActivate(type2) {
  44086. this._setMousePointerStyle();
  44087. this.handleFirstPosition(type2);
  44088. this.Draw.startCreate(type2);
  44089. this.Draw.DrawEndEvent.addEventListener((entity, positions, drawType) => {
  44090. console.log({
  44091. entity,
  44092. positions,
  44093. drawType
  44094. });
  44095. this._setMouseDefaultStyle();
  44096. if (entity) {
  44097. let entityParam = DrawMilitaryPlot.initEditPropertyParams();
  44098. entity.setParams(entityParam);
  44099. this._setEntityIsEdit(entity);
  44100. }
  44101. });
  44102. this.drawArr.push(this.Draw);
  44103. return this.Draw;
  44104. },
  44105. clearOne: function() {
  44106. this.Draw.clear();
  44107. },
  44108. clearAll: function() {
  44109. for (var i2 = 0; i2 < this.drawArr.length; i2++) {
  44110. this.drawArr[i2].clear();
  44111. }
  44112. this.edit.deactivate();
  44113. this._closePropertyEditDialog();
  44114. let buttonDiv = document.getElementById("drawButtonDiv");
  44115. if (buttonDiv) {
  44116. document.body.removeChild(buttonDiv);
  44117. }
  44118. }
  44119. });
  44120. Object.assign(DrawMilitaryPlot.prototype, {
  44121. _openPropertyEditDialog: function(params, callEdit, callRemove) {
  44122. this._editPropertyDialogDomId = "dialog-property-dom-militaryplot";
  44123. this._registerDOMPropertyEdit = "dialog-edit-property-militaryplot";
  44124. let PropertyEditComponent = customElements.get(this._registerDOMPropertyEdit);
  44125. if (PropertyEditComponent === void 0) {
  44126. PropertyEditComponent = defineCustomElement(DialogEditProperty$1);
  44127. customElements.define(this._registerDOMPropertyEdit, PropertyEditComponent);
  44128. }
  44129. this._closePropertyEditDialog();
  44130. let dialogPropertyElement = new PropertyEditComponent({
  44131. params
  44132. });
  44133. dialogPropertyElement.id = this._editPropertyDialogDomId;
  44134. dialogPropertyElement.showDialog = true;
  44135. document.body.appendChild(dialogPropertyElement);
  44136. dialogPropertyElement.addEventListener(
  44137. "submit",
  44138. (e) => {
  44139. if (callEdit)
  44140. callEdit(e.detail[0]);
  44141. },
  44142. false
  44143. );
  44144. dialogPropertyElement.addEventListener(
  44145. "remove",
  44146. (e) => {
  44147. if (callRemove)
  44148. callRemove();
  44149. },
  44150. false
  44151. );
  44152. },
  44153. _closePropertyEditDialog() {
  44154. let dom2 = document.getElementById(this._editPropertyDialogDomId);
  44155. if (dom2 !== null && dom2 !== void 0) {
  44156. document.body.removeChild(dom2);
  44157. }
  44158. }
  44159. });
  44160. var _style_0 = `@charset "UTF-8";:root{--el-color-white:#ffffff;--el-color-black:#000000;--el-color-primary-rgb:64,158,255;--el-color-success-rgb:103,194,58;--el-color-warning-rgb:230,162,60;--el-color-danger-rgb:245,108,108;--el-color-error-rgb:245,108,108;--el-color-info-rgb:144,147,153;--el-font-size-extra-large:20px;--el-font-size-large:18px;--el-font-size-medium:16px;--el-font-size-base:14px;--el-font-size-small:13px;--el-font-size-extra-small:12px;--el-font-family:"Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","\\5fae\\8f6f\\96c5\\9ed1",Arial,sans-serif;--el-font-weight-primary:500;--el-font-line-height-primary:24px;--el-index-normal:1;--el-index-top:1000;--el-index-popper:2000;--el-border-radius-base:4px;--el-border-radius-small:2px;--el-border-radius-round:20px;--el-border-radius-circle:100%;--el-transition-duration:.3s;--el-transition-duration-fast:.2s;--el-transition-function-ease-in-out-bezier:cubic-bezier(.645, .045, .355, 1);--el-transition-function-fast-bezier:cubic-bezier(.23, 1, .32, 1);--el-transition-all:all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);--el-transition-fade:opacity var(--el-transition-duration) var(--el-transition-function-fast-bezier);--el-transition-md-fade:transform var(--el-transition-duration) var(--el-transition-function-fast-bezier),opacity var(--el-transition-duration) var(--el-transition-function-fast-bezier);--el-transition-fade-linear:opacity var(--el-transition-duration-fast) linear;--el-transition-border:border-color var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-transition-box-shadow:box-shadow var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-transition-color:color var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-component-size-large:40px;--el-component-size:32px;--el-component-size-small:24px}:root{color-scheme:light;--el-color-white:#ffffff;--el-color-black:#000000;--el-color-primary:#409eff;--el-color-primary-light-3:#79bbff;--el-color-primary-light-5:#a0cfff;--el-color-primary-light-7:#c6e2ff;--el-color-primary-light-8:#d9ecff;--el-color-primary-light-9:#ecf5ff;--el-color-primary-dark-2:#337ecc;--el-color-success:#67c23a;--el-color-success-light-3:#95d475;--el-color-success-light-5:#b3e19d;--el-color-success-light-7:#d1edc4;--el-color-success-light-8:#e1f3d8;--el-color-success-light-9:#f0f9eb;--el-color-success-dark-2:#529b2e;--el-color-warning:#e6a23c;--el-color-warning-light-3:#eebe77;--el-color-warning-light-5:#f3d19e;--el-color-warning-light-7:#f8e3c5;--el-color-warning-light-8:#faecd8;--el-color-warning-light-9:#fdf6ec;--el-color-warning-dark-2:#b88230;--el-color-danger:#f56c6c;--el-color-danger-light-3:#f89898;--el-color-danger-light-5:#fab6b6;--el-color-danger-light-7:#fcd3d3;--el-color-danger-light-8:#fde2e2;--el-color-danger-light-9:#fef0f0;--el-color-danger-dark-2:#c45656;--el-color-error:#f56c6c;--el-color-error-light-3:#f89898;--el-color-error-light-5:#fab6b6;--el-color-error-light-7:#fcd3d3;--el-color-error-light-8:#fde2e2;--el-color-error-light-9:#fef0f0;--el-color-error-dark-2:#c45656;--el-color-info:#909399;--el-color-info-light-3:#b1b3b8;--el-color-info-light-5:#c8c9cc;--el-color-info-light-7:#dedfe0;--el-color-info-light-8:#e9e9eb;--el-color-info-light-9:#f4f4f5;--el-color-info-dark-2:#73767a;--el-bg-color:#ffffff;--el-bg-color-page:#f2f3f5;--el-bg-color-overlay:#ffffff;--el-text-color-primary:#303133;--el-text-color-regular:#606266;--el-text-color-secondary:#909399;--el-text-color-placeholder:#a8abb2;--el-text-color-disabled:#c0c4cc;--el-border-color:#dcdfe6;--el-border-color-light:#e4e7ed;--el-border-color-lighter:#ebeef5;--el-border-color-extra-light:#f2f6fc;--el-border-color-dark:#d4d7de;--el-border-color-darker:#cdd0d6;--el-fill-color:#f0f2f5;--el-fill-color-light:#f5f7fa;--el-fill-color-lighter:#fafafa;--el-fill-color-extra-light:#fafcff;--el-fill-color-dark:#ebedf0;--el-fill-color-darker:#e6e8eb;--el-fill-color-blank:#ffffff;--el-box-shadow:0px 12px 32px 4px rgba(0, 0, 0, .04),0px 8px 20px rgba(0, 0, 0, .08);--el-box-shadow-light:0px 0px 12px rgba(0, 0, 0, .12);--el-box-shadow-lighter:0px 0px 6px rgba(0, 0, 0, .12);--el-box-shadow-dark:0px 16px 48px 16px rgba(0, 0, 0, .08),0px 12px 32px rgba(0, 0, 0, .12),0px 8px 16px -8px rgba(0, 0, 0, .16);--el-disabled-bg-color:var(--el-fill-color-light);--el-disabled-text-color:var(--el-text-color-placeholder);--el-disabled-border-color:var(--el-border-color-light);--el-overlay-color:rgba(0, 0, 0, .8);--el-overlay-color-light:rgba(0, 0, 0, .7);--el-overlay-color-lighter:rgba(0, 0, 0, .5);--el-mask-color:rgba(255, 255, 255, .9);--el-mask-color-extra-light:rgba(255, 255, 255, .3);--el-border-width:1px;--el-border-style:solid;--el-border-color-hover:var(--el-text-color-disabled);--el-border:var(--el-border-width) var(--el-border-style) var(--el-border-color);--el-svg-monochrome-grey:var(--el-border-color)}.fade-in-linear-enter-active,.fade-in-linear-leave-active{transition:var(--el-transition-fade-linear)}.fade-in-linear-enter-from,.fade-in-linear-leave-to{opacity:0}.el-fade-in-linear-enter-active,.el-fade-in-linear-leave-active{transition:var(--el-transition-fade-linear)}.el-fade-in-linear-enter-from,.el-fade-in-linear-leave-to{opacity:0}.el-fade-in-enter-active,.el-fade-in-leave-active{transition:all var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-fade-in-enter-from,.el-fade-in-leave-active{opacity:0}.el-zoom-in-center-enter-active,.el-zoom-in-center-leave-active{transition:all var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-zoom-in-center-enter-from,.el-zoom-in-center-leave-active{opacity:0;transform:scaleX(0)}.el-zoom-in-top-enter-active,.el-zoom-in-top-leave-active{opacity:1;transform:scaleY(1);transition:var(--el-transition-md-fade);transform-origin:center top}.el-zoom-in-top-enter-active[data-popper-placement^=top],.el-zoom-in-top-leave-active[data-popper-placement^=top]{transform-origin:center bottom}.el-zoom-in-top-enter-from,.el-zoom-in-top-leave-active{opacity:0;transform:scaleY(0)}.el-zoom-in-bottom-enter-active,.el-zoom-in-bottom-leave-active{opacity:1;transform:scaleY(1);transition:var(--el-transition-md-fade);transform-origin:center bottom}.el-zoom-in-bottom-enter-from,.el-zoom-in-bottom-leave-active{opacity:0;transform:scaleY(0)}.el-zoom-in-left-enter-active,.el-zoom-in-left-leave-active{opacity:1;transform:scale(1);transition:var(--el-transition-md-fade);transform-origin:top left}.el-zoom-in-left-enter-from,.el-zoom-in-left-leave-active{opacity:0;transform:scale(.45)}.collapse-transition{transition:var(--el-transition-duration) height ease-in-out,var(--el-transition-duration) padding-top ease-in-out,var(--el-transition-duration) padding-bottom ease-in-out}.el-collapse-transition-enter-active,.el-collapse-transition-leave-active{transition:var(--el-transition-duration) max-height ease-in-out,var(--el-transition-duration) padding-top ease-in-out,var(--el-transition-duration) padding-bottom ease-in-out}.horizontal-collapse-transition{transition:var(--el-transition-duration) width ease-in-out,var(--el-transition-duration) padding-left ease-in-out,var(--el-transition-duration) padding-right ease-in-out}.el-list-enter-active,.el-list-leave-active{transition:all 1s}.el-list-enter-from,.el-list-leave-to{opacity:0;transform:translateY(-30px)}.el-list-leave-active{position:absolute!important}.el-opacity-transition{transition:opacity var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-icon-loading{-webkit-animation:rotating 2s linear infinite;animation:rotating 2s linear infinite}.el-icon--right{margin-left:5px}.el-icon--left{margin-right:5px}@-webkit-keyframes rotating{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes rotating{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.el-icon{--color:inherit;height:1em;width:1em;line-height:1em;display:inline-flex;justify-content:center;align-items:center;position:relative;fill:currentColor;color:var(--color);font-size:inherit}.el-icon.is-loading{-webkit-animation:rotating 2s linear infinite;animation:rotating 2s linear infinite}.el-icon svg{height:1em;width:1em}.el-affix--fixed{position:fixed}.el-alert{--el-alert-padding:8px 16px;--el-alert-border-radius-base:var(--el-border-radius-base);--el-alert-title-font-size:13px;--el-alert-description-font-size:12px;--el-alert-close-font-size:12px;--el-alert-close-customed-font-size:13px;--el-alert-icon-size:16px;--el-alert-icon-large-size:28px;width:100%;padding:var(--el-alert-padding);margin:0;box-sizing:border-box;border-radius:var(--el-alert-border-radius-base);position:relative;background-color:var(--el-color-white);overflow:hidden;opacity:1;display:flex;align-items:center;transition:opacity var(--el-transition-duration-fast)}.el-alert.is-light .el-alert__close-btn{color:var(--el-text-color-placeholder)}.el-alert.is-dark .el-alert__close-btn,.el-alert.is-dark .el-alert__description{color:var(--el-color-white)}.el-alert.is-center{justify-content:center}.el-alert--success{--el-alert-bg-color:var(--el-color-success-light-9)}.el-alert--success.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-success)}.el-alert--success.is-light .el-alert__description{color:var(--el-color-success)}.el-alert--success.is-dark{background-color:var(--el-color-success);color:var(--el-color-white)}.el-alert--info{--el-alert-bg-color:var(--el-color-info-light-9)}.el-alert--info.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-info)}.el-alert--info.is-light .el-alert__description{color:var(--el-color-info)}.el-alert--info.is-dark{background-color:var(--el-color-info);color:var(--el-color-white)}.el-alert--warning{--el-alert-bg-color:var(--el-color-warning-light-9)}.el-alert--warning.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-warning)}.el-alert--warning.is-light .el-alert__description{color:var(--el-color-warning)}.el-alert--warning.is-dark{background-color:var(--el-color-warning);color:var(--el-color-white)}.el-alert--error{--el-alert-bg-color:var(--el-color-error-light-9)}.el-alert--error.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-error)}.el-alert--error.is-light .el-alert__description{color:var(--el-color-error)}.el-alert--error.is-dark{background-color:var(--el-color-error);color:var(--el-color-white)}.el-alert__content{display:table-cell;padding:0 8px}.el-alert .el-alert__icon{font-size:var(--el-alert-icon-size);width:var(--el-alert-icon-size)}.el-alert .el-alert__icon.is-big{font-size:var(--el-alert-icon-large-size);width:var(--el-alert-icon-large-size)}.el-alert__title{font-size:var(--el-alert-title-font-size);line-height:18px;vertical-align:text-top}.el-alert__title.is-bold{font-weight:700}.el-alert .el-alert__description{font-size:var(--el-alert-description-font-size);margin:5px 0 0}.el-alert .el-alert__close-btn{font-size:var(--el-alert-close-font-size);opacity:1;position:absolute;top:12px;right:15px;cursor:pointer}.el-alert .el-alert__close-btn.is-customed{font-style:normal;font-size:var(--el-alert-close-customed-font-size);top:9px}.el-alert-fade-enter-from,.el-alert-fade-leave-active{opacity:0}.el-aside{overflow:auto;box-sizing:border-box;flex-shrink:0;width:var(--el-aside-width,300px)}.el-autocomplete{position:relative;display:inline-block}.el-autocomplete__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-box-shadow-light)}.el-autocomplete__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-autocomplete__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-autocomplete__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-autocomplete__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-autocomplete__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-autocomplete-suggestion{border-radius:var(--el-border-radius-base);box-sizing:border-box}.el-autocomplete-suggestion__wrap{max-height:280px;padding:10px 0;box-sizing:border-box}.el-autocomplete-suggestion__list{margin:0;padding:0}.el-autocomplete-suggestion li{padding:0 20px;margin:0;line-height:34px;cursor:pointer;color:var(--el-text-color-regular);font-size:var(--el-font-size-base);list-style:none;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.el-autocomplete-suggestion li:hover,.el-autocomplete-suggestion li.highlighted{background-color:var(--el-fill-color-light)}.el-autocomplete-suggestion li.divider{margin-top:6px;border-top:1px solid var(--el-color-black)}.el-autocomplete-suggestion li.divider:last-child{margin-bottom:-6px}.el-autocomplete-suggestion.is-loading li{text-align:center;height:100px;line-height:100px;font-size:20px;color:var(--el-text-color-secondary)}.el-autocomplete-suggestion.is-loading li:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-autocomplete-suggestion.is-loading li:hover{background-color:var(--el-bg-color-overlay)}.el-autocomplete-suggestion.is-loading .el-icon-loading{vertical-align:middle}.el-avatar{--el-avatar-text-color:var(--el-color-white);--el-avatar-bg-color:var(--el-text-color-disabled);--el-avatar-text-size:14px;--el-avatar-icon-size:18px;--el-avatar-border-radius:var(--el-border-radius-base);--el-avatar-size-large:56px;--el-avatar-size-small:24px;--el-avatar-size:40px;display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;text-align:center;overflow:hidden;color:var(--el-avatar-text-color);background:var(--el-avatar-bg-color);width:var(--el-avatar-size);height:var(--el-avatar-size);font-size:var(--el-avatar-text-size)}.el-avatar>img{display:block;height:100%}.el-avatar--circle{border-radius:50%}.el-avatar--square{border-radius:var(--el-avatar-border-radius)}.el-avatar--icon{font-size:var(--el-avatar-icon-size)}.el-avatar--small{--el-avatar-size:24px}.el-avatar--large{--el-avatar-size:56px}.el-backtop{--el-backtop-bg-color:var(--el-bg-color-overlay);--el-backtop-text-color:var(--el-color-primary);--el-backtop-hover-bg-color:var(--el-border-color-extra-light);position:fixed;background-color:var(--el-backtop-bg-color);width:40px;height:40px;border-radius:50%;color:var(--el-backtop-text-color);display:flex;align-items:center;justify-content:center;font-size:20px;box-shadow:var(--el-box-shadow-lighter);cursor:pointer;z-index:5}.el-backtop:hover{background-color:var(--el-backtop-hover-bg-color)}.el-backtop__icon{font-size:20px}.el-badge{--el-badge-bg-color:var(--el-color-danger);--el-badge-radius:10px;--el-badge-font-size:12px;--el-badge-padding:6px;--el-badge-size:18px;position:relative;vertical-align:middle;display:inline-block;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.el-badge__content{background-color:var(--el-badge-bg-color);border-radius:var(--el-badge-radius);color:var(--el-color-white);display:inline-flex;justify-content:center;align-items:center;font-size:var(--el-badge-font-size);height:var(--el-badge-size);padding:0 var(--el-badge-padding);white-space:nowrap;border:1px solid var(--el-bg-color)}.el-badge__content.is-fixed{position:absolute;top:0;right:calc(1px + var(--el-badge-size)/ 2);transform:translateY(-50%) translate(100%);z-index:var(--el-index-normal)}.el-badge__content.is-fixed.is-dot{right:5px}.el-badge__content.is-dot{height:8px;width:8px;padding:0;right:0;border-radius:50%}.el-badge__content--primary{background-color:var(--el-color-primary)}.el-badge__content--success{background-color:var(--el-color-success)}.el-badge__content--warning{background-color:var(--el-color-warning)}.el-badge__content--info{background-color:var(--el-color-info)}.el-badge__content--danger{background-color:var(--el-color-danger)}.el-breadcrumb{font-size:14px;line-height:1}.el-breadcrumb:after,.el-breadcrumb:before{display:table;content:""}.el-breadcrumb:after{clear:both}.el-breadcrumb__separator{margin:0 9px;font-weight:700;color:var(--el-text-color-placeholder)}.el-breadcrumb__separator.el-icon{margin:0 6px;font-weight:400}.el-breadcrumb__separator.el-icon svg{vertical-align:middle}.el-breadcrumb__item{float:left;display:inline-flex;align-items:center}.el-breadcrumb__inner{color:var(--el-text-color-regular)}.el-breadcrumb__inner a,.el-breadcrumb__inner.is-link{font-weight:700;text-decoration:none;transition:var(--el-transition-color);color:var(--el-text-color-primary)}.el-breadcrumb__inner a:hover,.el-breadcrumb__inner.is-link:hover{color:var(--el-color-primary);cursor:pointer}.el-breadcrumb__item:last-child .el-breadcrumb__inner,.el-breadcrumb__item:last-child .el-breadcrumb__inner a,.el-breadcrumb__item:last-child .el-breadcrumb__inner a:hover,.el-breadcrumb__item:last-child .el-breadcrumb__inner:hover{font-weight:400;color:var(--el-text-color-regular);cursor:text}.el-breadcrumb__item:last-child .el-breadcrumb__separator{display:none}.el-button-group{display:inline-block;vertical-align:middle}.el-button-group:after,.el-button-group:before{display:table;content:""}.el-button-group:after{clear:both}.el-button-group>.el-button{float:left;position:relative}.el-button-group>.el-button+.el-button{margin-left:0}.el-button-group>.el-button:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.el-button-group>.el-button:last-child{border-top-left-radius:0;border-bottom-left-radius:0}.el-button-group>.el-button:first-child:last-child{border-top-right-radius:var(--el-border-radius-base);border-bottom-right-radius:var(--el-border-radius-base);border-top-left-radius:var(--el-border-radius-base);border-bottom-left-radius:var(--el-border-radius-base)}.el-button-group>.el-button:first-child:last-child.is-round{border-radius:var(--el-border-radius-round)}.el-button-group>.el-button:first-child:last-child.is-circle{border-radius:50%}.el-button-group>.el-button:not(:first-child):not(:last-child){border-radius:0}.el-button-group>.el-button:not(:last-child){margin-right:-1px}.el-button-group>.el-button:active,.el-button-group>.el-button:focus,.el-button-group>.el-button:hover{z-index:1}.el-button-group>.el-button.is-active{z-index:1}.el-button-group>.el-dropdown>.el-button{border-top-left-radius:0;border-bottom-left-radius:0;border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--primary:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--primary:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--primary:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--success:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--success:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--success:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--warning:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--warning:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--warning:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--danger:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--danger:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--danger:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--info:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--info:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--info:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button{--el-button-font-weight:var(--el-font-weight-primary);--el-button-border-color:var(--el-border-color);--el-button-bg-color:var(--el-fill-color-blank);--el-button-text-color:var(--el-text-color-regular);--el-button-disabled-text-color:var(--el-disabled-text-color);--el-button-disabled-bg-color:var(--el-fill-color-blank);--el-button-disabled-border-color:var(--el-border-color-light);--el-button-divide-border-color:rgba(255, 255, 255, .5);--el-button-hover-text-color:var(--el-color-primary);--el-button-hover-bg-color:var(--el-color-primary-light-9);--el-button-hover-border-color:var(--el-color-primary-light-7);--el-button-active-text-color:var(--el-button-hover-text-color);--el-button-active-border-color:var(--el-color-primary);--el-button-active-bg-color:var(--el-button-hover-bg-color);--el-button-outline-color:var(--el-color-primary-light-5);--el-button-hover-link-text-color:var(--el-color-info);--el-button-active-color:var(--el-text-color-primary)}.el-button{display:inline-flex;justify-content:center;align-items:center;line-height:1;height:32px;white-space:nowrap;cursor:pointer;color:var(--el-button-text-color);text-align:center;box-sizing:border-box;outline:0;transition:.1s;font-weight:var(--el-button-font-weight);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;-webkit-appearance:none;background-color:var(--el-button-bg-color);border:var(--el-border);border-color:var(--el-button-border-color);padding:8px 15px;font-size:var(--el-font-size-base);border-radius:var(--el-border-radius-base)}.el-button:focus,.el-button:hover{color:var(--el-button-hover-text-color);border-color:var(--el-button-hover-border-color);background-color:var(--el-button-hover-bg-color);outline:0}.el-button:active{color:var(--el-button-active-text-color);border-color:var(--el-button-active-border-color);background-color:var(--el-button-active-bg-color);outline:0}.el-button:focus-visible{outline:2px solid var(--el-button-outline-color);outline-offset:1px}.el-button>span{display:inline-flex;align-items:center}.el-button+.el-button{margin-left:12px}.el-button.is-round{padding:8px 15px}.el-button::-moz-focus-inner{border:0}.el-button [class*=el-icon]+span{margin-left:6px}.el-button [class*=el-icon] svg{vertical-align:bottom}.el-button.is-plain{--el-button-hover-text-color:var(--el-color-primary);--el-button-hover-bg-color:var(--el-fill-color-blank);--el-button-hover-border-color:var(--el-color-primary)}.el-button.is-active{color:var(--el-button-active-text-color);border-color:var(--el-button-active-border-color);background-color:var(--el-button-active-bg-color);outline:0}.el-button.is-disabled,.el-button.is-disabled:focus,.el-button.is-disabled:hover{color:var(--el-button-disabled-text-color);cursor:not-allowed;background-image:none;background-color:var(--el-button-disabled-bg-color);border-color:var(--el-button-disabled-border-color)}.el-button.is-loading{position:relative;pointer-events:none}.el-button.is-loading:before{z-index:1;pointer-events:none;content:"";position:absolute;left:-1px;top:-1px;right:-1px;bottom:-1px;border-radius:inherit;background-color:var(--el-mask-color-extra-light)}.el-button.is-round{border-radius:var(--el-border-radius-round)}.el-button.is-circle{border-radius:50%;padding:8px}.el-button.is-text{color:var(--el-button-text-color);border:0 solid transparent;background-color:transparent}.el-button.is-text.is-disabled{color:var(--el-button-disabled-text-color);background-color:transparent!important}.el-button.is-text:not(.is-disabled):focus,.el-button.is-text:not(.is-disabled):hover{background-color:var(--el-fill-color-light)}.el-button.is-text:not(.is-disabled):focus-visible{outline:2px solid var(--el-button-outline-color);outline-offset:1px}.el-button.is-text:not(.is-disabled):active{background-color:var(--el-fill-color)}.el-button.is-text:not(.is-disabled).is-has-bg{background-color:var(--el-fill-color-light)}.el-button.is-text:not(.is-disabled).is-has-bg:focus,.el-button.is-text:not(.is-disabled).is-has-bg:hover{background-color:var(--el-fill-color)}.el-button.is-text:not(.is-disabled).is-has-bg:active{background-color:var(--el-fill-color-dark)}.el-button__text--expand{letter-spacing:.3em;margin-right:-.3em}.el-button.is-link{border-color:transparent;color:var(--el-button-text-color);background:0 0;padding:2px;height:auto}.el-button.is-link:focus,.el-button.is-link:hover{color:var(--el-button-hover-link-text-color)}.el-button.is-link.is-disabled{color:var(--el-button-disabled-text-color);background-color:transparent!important;border-color:transparent!important}.el-button.is-link:not(.is-disabled):focus,.el-button.is-link:not(.is-disabled):hover{border-color:transparent;background-color:transparent}.el-button.is-link:not(.is-disabled):active{color:var(--el-button-active-color);border-color:transparent;background-color:transparent}.el-button--text{border-color:transparent;background:0 0;color:var(--el-color-primary);padding-left:0;padding-right:0}.el-button--text.is-disabled{color:var(--el-button-disabled-text-color);background-color:transparent!important;border-color:transparent!important}.el-button--text:not(.is-disabled):focus,.el-button--text:not(.is-disabled):hover{color:var(--el-color-primary-light-3);border-color:transparent;background-color:transparent}.el-button--text:not(.is-disabled):active{color:var(--el-color-primary-dark-2);border-color:transparent;background-color:transparent}.el-button__link--expand{letter-spacing:.3em;margin-right:-.3em}.el-button--primary{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-primary);--el-button-border-color:var(--el-color-primary);--el-button-outline-color:var(--el-color-primary-light-5);--el-button-active-color:var(--el-color-primary-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-primary-light-5);--el-button-hover-bg-color:var(--el-color-primary-light-3);--el-button-hover-border-color:var(--el-color-primary-light-3);--el-button-active-bg-color:var(--el-color-primary-dark-2);--el-button-active-border-color:var(--el-color-primary-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-primary-light-5);--el-button-disabled-border-color:var(--el-color-primary-light-5)}.el-button--primary.is-link,.el-button--primary.is-plain,.el-button--primary.is-text{--el-button-text-color:var(--el-color-primary);--el-button-bg-color:var(--el-color-primary-light-9);--el-button-border-color:var(--el-color-primary-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-primary);--el-button-hover-border-color:var(--el-color-primary);--el-button-active-text-color:var(--el-color-white)}.el-button--primary.is-link.is-disabled,.el-button--primary.is-link.is-disabled:active,.el-button--primary.is-link.is-disabled:focus,.el-button--primary.is-link.is-disabled:hover,.el-button--primary.is-plain.is-disabled,.el-button--primary.is-plain.is-disabled:active,.el-button--primary.is-plain.is-disabled:focus,.el-button--primary.is-plain.is-disabled:hover,.el-button--primary.is-text.is-disabled,.el-button--primary.is-text.is-disabled:active,.el-button--primary.is-text.is-disabled:focus,.el-button--primary.is-text.is-disabled:hover{color:var(--el-color-primary-light-5);background-color:var(--el-color-primary-light-9);border-color:var(--el-color-primary-light-8)}.el-button--success{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-success);--el-button-border-color:var(--el-color-success);--el-button-outline-color:var(--el-color-success-light-5);--el-button-active-color:var(--el-color-success-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-success-light-5);--el-button-hover-bg-color:var(--el-color-success-light-3);--el-button-hover-border-color:var(--el-color-success-light-3);--el-button-active-bg-color:var(--el-color-success-dark-2);--el-button-active-border-color:var(--el-color-success-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-success-light-5);--el-button-disabled-border-color:var(--el-color-success-light-5)}.el-button--success.is-link,.el-button--success.is-plain,.el-button--success.is-text{--el-button-text-color:var(--el-color-success);--el-button-bg-color:var(--el-color-success-light-9);--el-button-border-color:var(--el-color-success-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-success);--el-button-hover-border-color:var(--el-color-success);--el-button-active-text-color:var(--el-color-white)}.el-button--success.is-link.is-disabled,.el-button--success.is-link.is-disabled:active,.el-button--success.is-link.is-disabled:focus,.el-button--success.is-link.is-disabled:hover,.el-button--success.is-plain.is-disabled,.el-button--success.is-plain.is-disabled:active,.el-button--success.is-plain.is-disabled:focus,.el-button--success.is-plain.is-disabled:hover,.el-button--success.is-text.is-disabled,.el-button--success.is-text.is-disabled:active,.el-button--success.is-text.is-disabled:focus,.el-button--success.is-text.is-disabled:hover{color:var(--el-color-success-light-5);background-color:var(--el-color-success-light-9);border-color:var(--el-color-success-light-8)}.el-button--warning{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-warning);--el-button-border-color:var(--el-color-warning);--el-button-outline-color:var(--el-color-warning-light-5);--el-button-active-color:var(--el-color-warning-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-warning-light-5);--el-button-hover-bg-color:var(--el-color-warning-light-3);--el-button-hover-border-color:var(--el-color-warning-light-3);--el-button-active-bg-color:var(--el-color-warning-dark-2);--el-button-active-border-color:var(--el-color-warning-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-warning-light-5);--el-button-disabled-border-color:var(--el-color-warning-light-5)}.el-button--warning.is-link,.el-button--warning.is-plain,.el-button--warning.is-text{--el-button-text-color:var(--el-color-warning);--el-button-bg-color:var(--el-color-warning-light-9);--el-button-border-color:var(--el-color-warning-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-warning);--el-button-hover-border-color:var(--el-color-warning);--el-button-active-text-color:var(--el-color-white)}.el-button--warning.is-link.is-disabled,.el-button--warning.is-link.is-disabled:active,.el-button--warning.is-link.is-disabled:focus,.el-button--warning.is-link.is-disabled:hover,.el-button--warning.is-plain.is-disabled,.el-button--warning.is-plain.is-disabled:active,.el-button--warning.is-plain.is-disabled:focus,.el-button--warning.is-plain.is-disabled:hover,.el-button--warning.is-text.is-disabled,.el-button--warning.is-text.is-disabled:active,.el-button--warning.is-text.is-disabled:focus,.el-button--warning.is-text.is-disabled:hover{color:var(--el-color-warning-light-5);background-color:var(--el-color-warning-light-9);border-color:var(--el-color-warning-light-8)}.el-button--danger{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-danger);--el-button-border-color:var(--el-color-danger);--el-button-outline-color:var(--el-color-danger-light-5);--el-button-active-color:var(--el-color-danger-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-danger-light-5);--el-button-hover-bg-color:var(--el-color-danger-light-3);--el-button-hover-border-color:var(--el-color-danger-light-3);--el-button-active-bg-color:var(--el-color-danger-dark-2);--el-button-active-border-color:var(--el-color-danger-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-danger-light-5);--el-button-disabled-border-color:var(--el-color-danger-light-5)}.el-button--danger.is-link,.el-button--danger.is-plain,.el-button--danger.is-text{--el-button-text-color:var(--el-color-danger);--el-button-bg-color:var(--el-color-danger-light-9);--el-button-border-color:var(--el-color-danger-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-danger);--el-button-hover-border-color:var(--el-color-danger);--el-button-active-text-color:var(--el-color-white)}.el-button--danger.is-link.is-disabled,.el-button--danger.is-link.is-disabled:active,.el-button--danger.is-link.is-disabled:focus,.el-button--danger.is-link.is-disabled:hover,.el-button--danger.is-plain.is-disabled,.el-button--danger.is-plain.is-disabled:active,.el-button--danger.is-plain.is-disabled:focus,.el-button--danger.is-plain.is-disabled:hover,.el-button--danger.is-text.is-disabled,.el-button--danger.is-text.is-disabled:active,.el-button--danger.is-text.is-disabled:focus,.el-button--danger.is-text.is-disabled:hover{color:var(--el-color-danger-light-5);background-color:var(--el-color-danger-light-9);border-color:var(--el-color-danger-light-8)}.el-button--info{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-info);--el-button-border-color:var(--el-color-info);--el-button-outline-color:var(--el-color-info-light-5);--el-button-active-color:var(--el-color-info-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-info-light-5);--el-button-hover-bg-color:var(--el-color-info-light-3);--el-button-hover-border-color:var(--el-color-info-light-3);--el-button-active-bg-color:var(--el-color-info-dark-2);--el-button-active-border-color:var(--el-color-info-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-info-light-5);--el-button-disabled-border-color:var(--el-color-info-light-5)}.el-button--info.is-link,.el-button--info.is-plain,.el-button--info.is-text{--el-button-text-color:var(--el-color-info);--el-button-bg-color:var(--el-color-info-light-9);--el-button-border-color:var(--el-color-info-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-info);--el-button-hover-border-color:var(--el-color-info);--el-button-active-text-color:var(--el-color-white)}.el-button--info.is-link.is-disabled,.el-button--info.is-link.is-disabled:active,.el-button--info.is-link.is-disabled:focus,.el-button--info.is-link.is-disabled:hover,.el-button--info.is-plain.is-disabled,.el-button--info.is-plain.is-disabled:active,.el-button--info.is-plain.is-disabled:focus,.el-button--info.is-plain.is-disabled:hover,.el-button--info.is-text.is-disabled,.el-button--info.is-text.is-disabled:active,.el-button--info.is-text.is-disabled:focus,.el-button--info.is-text.is-disabled:hover{color:var(--el-color-info-light-5);background-color:var(--el-color-info-light-9);border-color:var(--el-color-info-light-8)}.el-button--large{--el-button-size:40px;height:var(--el-button-size);padding:12px 19px;font-size:var(--el-font-size-base);border-radius:var(--el-border-radius-base)}.el-button--large [class*=el-icon]+span{margin-left:8px}.el-button--large.is-round{padding:12px 19px}.el-button--large.is-circle{width:var(--el-button-size);padding:12px}.el-button--small{--el-button-size:24px;height:var(--el-button-size);padding:5px 11px;font-size:12px;border-radius:calc(var(--el-border-radius-base) - 1px)}.el-button--small [class*=el-icon]+span{margin-left:4px}.el-button--small.is-round{padding:5px 11px}.el-button--small.is-circle{width:var(--el-button-size);padding:5px}.el-calendar{--el-calendar-border:var(--el-table-border, 1px solid var(--el-border-color-lighter));--el-calendar-header-border-bottom:var(--el-calendar-border);--el-calendar-selected-bg-color:var(--el-color-primary-light-9);--el-calendar-cell-width:85px;background-color:var(--el-fill-color-blank)}.el-calendar__header{display:flex;justify-content:space-between;padding:12px 20px;border-bottom:var(--el-calendar-header-border-bottom)}.el-calendar__title{color:var(--el-text-color);align-self:center}.el-calendar__body{padding:12px 20px 35px}.el-calendar-table{table-layout:fixed;width:100%}.el-calendar-table thead th{padding:12px 0;color:var(--el-text-color-regular);font-weight:400}.el-calendar-table:not(.is-range) td.next,.el-calendar-table:not(.is-range) td.prev{color:var(--el-text-color-placeholder)}.el-calendar-table td{border-bottom:var(--el-calendar-border);border-right:var(--el-calendar-border);vertical-align:top;transition:background-color var(--el-transition-duration-fast) ease}.el-calendar-table td.is-selected{background-color:var(--el-calendar-selected-bg-color)}.el-calendar-table td.is-today{color:var(--el-color-primary)}.el-calendar-table tr:first-child td{border-top:var(--el-calendar-border)}.el-calendar-table tr td:first-child{border-left:var(--el-calendar-border)}.el-calendar-table tr.el-calendar-table__row--hide-border td{border-top:none}.el-calendar-table .el-calendar-day{box-sizing:border-box;padding:8px;height:var(--el-calendar-cell-width)}.el-calendar-table .el-calendar-day:hover{cursor:pointer;background-color:var(--el-calendar-selected-bg-color)}.el-card{--el-card-border-color:var(--el-border-color-light);--el-card-border-radius:4px;--el-card-padding:20px;--el-card-bg-color:var(--el-fill-color-blank)}.el-card{border-radius:var(--el-card-border-radius);border:1px solid var(--el-card-border-color);background-color:var(--el-card-bg-color);overflow:hidden;color:var(--el-text-color-primary);transition:var(--el-transition-duration)}.el-card.is-always-shadow{box-shadow:var(--el-box-shadow-light)}.el-card.is-hover-shadow:focus,.el-card.is-hover-shadow:hover{box-shadow:var(--el-box-shadow-light)}.el-card__header{padding:calc(var(--el-card-padding) - 2px) var(--el-card-padding);border-bottom:1px solid var(--el-card-border-color);box-sizing:border-box}.el-card__body{padding:var(--el-card-padding)}.el-carousel__item{position:absolute;top:0;left:0;width:100%;height:100%;display:inline-block;overflow:hidden;z-index:calc(var(--el-index-normal) - 1)}.el-carousel__item.is-active{z-index:calc(var(--el-index-normal) - 1)}.el-carousel__item.is-animating{transition:transform .4s ease-in-out}.el-carousel__item--card{width:50%;transition:transform .4s ease-in-out}.el-carousel__item--card.is-in-stage{cursor:pointer;z-index:var(--el-index-normal)}.el-carousel__item--card.is-in-stage.is-hover .el-carousel__mask,.el-carousel__item--card.is-in-stage:hover .el-carousel__mask{opacity:.12}.el-carousel__item--card.is-active{z-index:calc(var(--el-index-normal) + 1)}.el-carousel__mask{position:absolute;width:100%;height:100%;top:0;left:0;background-color:var(--el-color-white);opacity:.24;transition:var(--el-transition-duration-fast)}.el-carousel{--el-carousel-arrow-font-size:12px;--el-carousel-arrow-size:36px;--el-carousel-arrow-background:rgba(31, 45, 61, .11);--el-carousel-arrow-hover-background:rgba(31, 45, 61, .23);--el-carousel-indicator-width:30px;--el-carousel-indicator-height:2px;--el-carousel-indicator-padding-horizontal:4px;--el-carousel-indicator-padding-vertical:12px;--el-carousel-indicator-out-color:var(--el-border-color-hover);position:relative}.el-carousel--horizontal{overflow-x:hidden}.el-carousel--vertical{overflow-y:hidden}.el-carousel__container{position:relative;height:300px}.el-carousel__arrow{border:none;outline:0;padding:0;margin:0;height:var(--el-carousel-arrow-size);width:var(--el-carousel-arrow-size);cursor:pointer;transition:var(--el-transition-duration);border-radius:50%;background-color:var(--el-carousel-arrow-background);color:#fff;position:absolute;top:50%;z-index:10;transform:translateY(-50%);text-align:center;font-size:var(--el-carousel-arrow-font-size);display:inline-flex;justify-content:center;align-items:center}.el-carousel__arrow--left{left:16px}.el-carousel__arrow--right{right:16px}.el-carousel__arrow:hover{background-color:var(--el-carousel-arrow-hover-background)}.el-carousel__arrow i{cursor:pointer}.el-carousel__indicators{position:absolute;list-style:none;margin:0;padding:0;z-index:calc(var(--el-index-normal) + 1)}.el-carousel__indicators--horizontal{bottom:0;left:50%;transform:translate(-50%)}.el-carousel__indicators--vertical{right:0;top:50%;transform:translateY(-50%)}.el-carousel__indicators--outside{bottom:calc(var(--el-carousel-indicator-height) + var(--el-carousel-indicator-padding-vertical) * 2);text-align:center;position:static;transform:none}.el-carousel__indicators--outside .el-carousel__indicator:hover button{opacity:.64}.el-carousel__indicators--outside button{background-color:var(--el-carousel-indicator-out-color);opacity:.24}.el-carousel__indicators--labels{left:0;right:0;transform:none;text-align:center}.el-carousel__indicators--labels .el-carousel__button{height:auto;width:auto;padding:2px 18px;font-size:12px;color:#000}.el-carousel__indicators--labels .el-carousel__indicator{padding:6px 4px}.el-carousel__indicator{background-color:transparent;cursor:pointer}.el-carousel__indicator:hover button{opacity:.72}.el-carousel__indicator--horizontal{display:inline-block;padding:var(--el-carousel-indicator-padding-vertical) var(--el-carousel-indicator-padding-horizontal)}.el-carousel__indicator--vertical{padding:var(--el-carousel-indicator-padding-horizontal) var(--el-carousel-indicator-padding-vertical)}.el-carousel__indicator--vertical .el-carousel__button{width:var(--el-carousel-indicator-height);height:calc(var(--el-carousel-indicator-width)/ 2)}.el-carousel__indicator.is-active button{opacity:1}.el-carousel__button{display:block;opacity:.48;width:var(--el-carousel-indicator-width);height:var(--el-carousel-indicator-height);background-color:#fff;border:none;outline:0;padding:0;margin:0;cursor:pointer;transition:var(--el-transition-duration)}.carousel-arrow-left-enter-from,.carousel-arrow-left-leave-active{transform:translateY(-50%) translate(-10px);opacity:0}.carousel-arrow-right-enter-from,.carousel-arrow-right-leave-active{transform:translateY(-50%) translate(10px);opacity:0}.el-cascader-panel{--el-cascader-menu-text-color:var(--el-text-color-regular);--el-cascader-menu-selected-text-color:var(--el-color-primary);--el-cascader-menu-fill:var(--el-bg-color-overlay);--el-cascader-menu-font-size:var(--el-font-size-base);--el-cascader-menu-radius:var(--el-border-radius-base);--el-cascader-menu-border:solid 1px var(--el-border-color-light);--el-cascader-menu-shadow:var(--el-box-shadow-light);--el-cascader-node-background-hover:var(--el-fill-color-light);--el-cascader-node-color-disabled:var(--el-text-color-placeholder);--el-cascader-color-empty:var(--el-text-color-placeholder);--el-cascader-tag-background:var(--el-fill-color)}.el-cascader-panel{display:flex;border-radius:var(--el-cascader-menu-radius);font-size:var(--el-cascader-menu-font-size)}.el-cascader-panel.is-bordered{border:var(--el-cascader-menu-border);border-radius:var(--el-cascader-menu-radius)}.el-cascader-menu{min-width:180px;box-sizing:border-box;color:var(--el-cascader-menu-text-color);border-right:var(--el-cascader-menu-border)}.el-cascader-menu:last-child{border-right:none}.el-cascader-menu:last-child .el-cascader-node{padding-right:20px}.el-cascader-menu__wrap.el-scrollbar__wrap{height:204px}.el-cascader-menu__list{position:relative;min-height:100%;margin:0;padding:6px 0;list-style:none;box-sizing:border-box}.el-cascader-menu__hover-zone{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none}.el-cascader-menu__empty-text{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);display:flex;align-items:center;color:var(--el-cascader-color-empty)}.el-cascader-menu__empty-text .is-loading{margin-right:2px}.el-cascader-node{position:relative;display:flex;align-items:center;padding:0 30px 0 20px;height:34px;line-height:34px;outline:0}.el-cascader-node.is-selectable.in-active-path{color:var(--el-cascader-menu-text-color)}.el-cascader-node.in-active-path,.el-cascader-node.is-active,.el-cascader-node.is-selectable.in-checked-path{color:var(--el-cascader-menu-selected-text-color);font-weight:700}.el-cascader-node:not(.is-disabled){cursor:pointer}.el-cascader-node:not(.is-disabled):focus,.el-cascader-node:not(.is-disabled):hover{background:var(--el-cascader-node-background-hover)}.el-cascader-node.is-disabled{color:var(--el-cascader-node-color-disabled);cursor:not-allowed}.el-cascader-node__prefix{position:absolute;left:10px}.el-cascader-node__postfix{position:absolute;right:10px}.el-cascader-node__label{flex:1;text-align:left;padding:0 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.el-cascader-node>.el-checkbox{margin-right:0}.el-cascader-node>.el-radio{margin-right:0}.el-cascader-node>.el-radio .el-radio__label{padding-left:0}.el-cascader{--el-cascader-menu-text-color:var(--el-text-color-regular);--el-cascader-menu-selected-text-color:var(--el-color-primary);--el-cascader-menu-fill:var(--el-bg-color-overlay);--el-cascader-menu-font-size:var(--el-font-size-base);--el-cascader-menu-radius:var(--el-border-radius-base);--el-cascader-menu-border:solid 1px var(--el-border-color-light);--el-cascader-menu-shadow:var(--el-box-shadow-light);--el-cascader-node-background-hover:var(--el-fill-color-light);--el-cascader-node-color-disabled:var(--el-text-color-placeholder);--el-cascader-color-empty:var(--el-text-color-placeholder);--el-cascader-tag-background:var(--el-fill-color);display:inline-block;vertical-align:middle;position:relative;font-size:var(--el-font-size-base);line-height:32px;outline:0}.el-cascader:not(.is-disabled):hover .el-input__wrapper{cursor:pointer;box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-cascader .el-input{display:flex;cursor:pointer}.el-cascader .el-input .el-input__inner{text-overflow:ellipsis;cursor:pointer}.el-cascader .el-input .el-input__suffix-inner .el-icon{height:calc(100% - 2px)}.el-cascader .el-input .el-input__suffix-inner .el-icon svg{vertical-align:middle}.el-cascader .el-input .icon-arrow-down{transition:transform var(--el-transition-duration);font-size:14px}.el-cascader .el-input .icon-arrow-down.is-reverse{transform:rotate(180deg)}.el-cascader .el-input .icon-circle-close:hover{color:var(--el-input-clear-hover-color,var(--el-text-color-secondary))}.el-cascader .el-input.is-focus .el-input__wrapper{box-shadow:0 0 0 1px var(--el-input-focus-border-color,var(--el-color-primary)) inset}.el-cascader--large{font-size:14px;line-height:40px}.el-cascader--small{font-size:12px;line-height:24px}.el-cascader.is-disabled .el-cascader__label{z-index:calc(var(--el-index-normal) + 1);color:var(--el-disabled-text-color)}.el-cascader__dropdown{--el-cascader-menu-text-color:var(--el-text-color-regular);--el-cascader-menu-selected-text-color:var(--el-color-primary);--el-cascader-menu-fill:var(--el-bg-color-overlay);--el-cascader-menu-font-size:var(--el-font-size-base);--el-cascader-menu-radius:var(--el-border-radius-base);--el-cascader-menu-border:solid 1px var(--el-border-color-light);--el-cascader-menu-shadow:var(--el-box-shadow-light);--el-cascader-node-background-hover:var(--el-fill-color-light);--el-cascader-node-color-disabled:var(--el-text-color-placeholder);--el-cascader-color-empty:var(--el-text-color-placeholder);--el-cascader-tag-background:var(--el-fill-color)}.el-cascader__dropdown{font-size:var(--el-cascader-menu-font-size);border-radius:var(--el-cascader-menu-radius)}.el-cascader__dropdown.el-popper{background:var(--el-cascader-menu-fill);border:var(--el-cascader-menu-border);box-shadow:var(--el-cascader-menu-shadow)}.el-cascader__dropdown.el-popper .el-popper__arrow:before{border:var(--el-cascader-menu-border)}.el-cascader__dropdown.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-cascader__dropdown.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-cascader__dropdown.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-cascader__dropdown.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-cascader__dropdown.el-popper{box-shadow:var(--el-cascader-menu-shadow)}.el-cascader__tags{position:absolute;left:0;right:30px;top:50%;transform:translateY(-50%);display:flex;flex-wrap:wrap;line-height:normal;text-align:left;box-sizing:border-box}.el-cascader__tags .el-tag{display:inline-flex;align-items:center;max-width:100%;margin:2px 0 2px 6px;text-overflow:ellipsis;background:var(--el-cascader-tag-background)}.el-cascader__tags .el-tag:not(.is-hit){border-color:transparent}.el-cascader__tags .el-tag>span{flex:1;overflow:hidden;text-overflow:ellipsis}.el-cascader__tags .el-tag .el-icon-close{flex:none;background-color:var(--el-text-color-placeholder);color:var(--el-color-white)}.el-cascader__tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-cascader__collapse-tags{white-space:normal;z-index:var(--el-index-normal)}.el-cascader__collapse-tags .el-tag{display:inline-flex;align-items:center;max-width:100%;margin:2px 0 2px 6px;text-overflow:ellipsis;background:var(--el-fill-color)}.el-cascader__collapse-tags .el-tag:not(.is-hit){border-color:transparent}.el-cascader__collapse-tags .el-tag>span{flex:1;overflow:hidden;text-overflow:ellipsis}.el-cascader__collapse-tags .el-tag .el-icon-close{flex:none;background-color:var(--el-text-color-placeholder);color:var(--el-color-white)}.el-cascader__collapse-tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-cascader__suggestion-panel{border-radius:var(--el-cascader-menu-radius)}.el-cascader__suggestion-list{max-height:204px;margin:0;padding:6px 0;font-size:var(--el-font-size-base);color:var(--el-cascader-menu-text-color);text-align:center}.el-cascader__suggestion-item{display:flex;justify-content:space-between;align-items:center;height:34px;padding:0 15px;text-align:left;outline:0;cursor:pointer}.el-cascader__suggestion-item:focus,.el-cascader__suggestion-item:hover{background:var(--el-cascader-node-background-hover)}.el-cascader__suggestion-item.is-checked{color:var(--el-cascader-menu-selected-text-color);font-weight:700}.el-cascader__suggestion-item>span{margin-right:10px}.el-cascader__empty-text{margin:10px 0;color:var(--el-cascader-color-empty)}.el-cascader__search-input{flex:1;height:24px;min-width:60px;margin:2px 0 2px 11px;padding:0;color:var(--el-cascader-menu-text-color);border:none;outline:0;box-sizing:border-box;background:0 0}.el-cascader__search-input::-moz-placeholder{color:transparent}.el-cascader__search-input:-ms-input-placeholder{color:transparent}.el-cascader__search-input::placeholder{color:transparent}.el-check-tag{background-color:var(--el-color-info-light-9);border-radius:var(--el-border-radius-base);color:var(--el-color-info);cursor:pointer;display:inline-block;font-size:var(--el-font-size-base);line-height:var(--el-font-size-base);padding:7px 15px;transition:var(--el-transition-all);font-weight:700}.el-check-tag:hover{background-color:var(--el-color-info-light-7)}.el-check-tag.is-checked{background-color:var(--el-color-primary-light-8);color:var(--el-color-primary)}.el-check-tag.is-checked:hover{background-color:var(--el-color-primary-light-7)}.el-checkbox-button{--el-checkbox-button-checked-bg-color:var(--el-color-primary);--el-checkbox-button-checked-text-color:var(--el-color-white);--el-checkbox-button-checked-border-color:var(--el-color-primary)}.el-checkbox-button{position:relative;display:inline-block}.el-checkbox-button__inner{display:inline-block;line-height:1;font-weight:var(--el-checkbox-font-weight);white-space:nowrap;vertical-align:middle;cursor:pointer;background:var(--el-button-bg-color,var(--el-fill-color-blank));border:var(--el-border);border-left:0;color:var(--el-button-text-color,var(--el-text-color-regular));-webkit-appearance:none;text-align:center;box-sizing:border-box;outline:0;margin:0;position:relative;transition:var(--el-transition-all);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:8px 15px;font-size:var(--el-font-size-base);border-radius:0}.el-checkbox-button__inner.is-round{padding:8px 15px}.el-checkbox-button__inner:hover{color:var(--el-color-primary)}.el-checkbox-button__inner [class*=el-icon-]{line-height:.9}.el-checkbox-button__inner [class*=el-icon-]+span{margin-left:5px}.el-checkbox-button__original{opacity:0;outline:0;position:absolute;margin:0;z-index:-1}.el-checkbox-button.is-checked .el-checkbox-button__inner{color:var(--el-checkbox-button-checked-text-color);background-color:var(--el-checkbox-button-checked-bg-color);border-color:var(--el-checkbox-button-checked-border-color);box-shadow:-1px 0 0 0 var(--el-color-primary-light-7)}.el-checkbox-button.is-checked:first-child .el-checkbox-button__inner{border-left-color:var(--el-checkbox-button-checked-border-color)}.el-checkbox-button.is-disabled .el-checkbox-button__inner{color:var(--el-disabled-text-color);cursor:not-allowed;background-image:none;background-color:var(--el-button-disabled-bg-color,var(--el-fill-color-blank));border-color:var(--el-button-disabled-border-color,var(--el-border-color-light));box-shadow:none}.el-checkbox-button.is-disabled:first-child .el-checkbox-button__inner{border-left-color:var(--el-button-disabled-border-color,var(--el-border-color-light))}.el-checkbox-button:first-child .el-checkbox-button__inner{border-left:var(--el-border);border-top-left-radius:var(--el-border-radius-base);border-bottom-left-radius:var(--el-border-radius-base);box-shadow:none!important}.el-checkbox-button.is-focus .el-checkbox-button__inner{border-color:var(--el-checkbox-button-checked-border-color)}.el-checkbox-button:last-child .el-checkbox-button__inner{border-top-right-radius:var(--el-border-radius-base);border-bottom-right-radius:var(--el-border-radius-base)}.el-checkbox-button--large .el-checkbox-button__inner{padding:12px 19px;font-size:var(--el-font-size-base);border-radius:0}.el-checkbox-button--large .el-checkbox-button__inner.is-round{padding:12px 19px}.el-checkbox-button--small .el-checkbox-button__inner{padding:5px 11px;font-size:12px;border-radius:0}.el-checkbox-button--small .el-checkbox-button__inner.is-round{padding:5px 11px}.el-checkbox-group{font-size:0;line-height:0}.el-checkbox{--el-checkbox-font-size:14px;--el-checkbox-font-weight:var(--el-font-weight-primary);--el-checkbox-text-color:var(--el-text-color-regular);--el-checkbox-input-height:14px;--el-checkbox-input-width:14px;--el-checkbox-border-radius:var(--el-border-radius-small);--el-checkbox-bg-color:var(--el-fill-color-blank);--el-checkbox-input-border:var(--el-border);--el-checkbox-disabled-border-color:var(--el-border-color);--el-checkbox-disabled-input-fill:var(--el-fill-color-light);--el-checkbox-disabled-icon-color:var(--el-text-color-placeholder);--el-checkbox-disabled-checked-input-fill:var(--el-border-color-extra-light);--el-checkbox-disabled-checked-input-border-color:var(--el-border-color);--el-checkbox-disabled-checked-icon-color:var(--el-text-color-placeholder);--el-checkbox-checked-text-color:var(--el-color-primary);--el-checkbox-checked-input-border-color:var(--el-color-primary);--el-checkbox-checked-bg-color:var(--el-color-primary);--el-checkbox-checked-icon-color:var(--el-color-white);--el-checkbox-input-border-color-hover:var(--el-color-primary)}.el-checkbox{color:var(--el-checkbox-text-color);font-weight:var(--el-checkbox-font-weight);font-size:var(--el-font-size-base);position:relative;cursor:pointer;display:inline-flex;align-items:center;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;margin-right:30px;height:32px}.el-checkbox.is-disabled{cursor:not-allowed}.el-checkbox.is-bordered{padding:0 15px 0 9px;border-radius:var(--el-border-radius-base);border:var(--el-border);box-sizing:border-box}.el-checkbox.is-bordered.is-checked{border-color:var(--el-color-primary)}.el-checkbox.is-bordered.is-disabled{border-color:var(--el-border-color-lighter)}.el-checkbox.is-bordered.el-checkbox--large{padding:0 19px 0 11px;border-radius:var(--el-border-radius-base)}.el-checkbox.is-bordered.el-checkbox--large .el-checkbox__label{font-size:var(--el-font-size-base)}.el-checkbox.is-bordered.el-checkbox--large .el-checkbox__inner{height:14px;width:14px}.el-checkbox.is-bordered.el-checkbox--small{padding:0 11px 0 7px;border-radius:calc(var(--el-border-radius-base) - 1px)}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__label{font-size:12px}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__inner{height:12px;width:12px}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__inner:after{height:6px;width:2px}.el-checkbox input:focus-visible+.el-checkbox__inner{outline:2px solid var(--el-checkbox-input-border-color-hover);outline-offset:1px;border-radius:var(--el-checkbox-border-radius)}.el-checkbox__input{white-space:nowrap;cursor:pointer;outline:0;display:inline-flex;position:relative}.el-checkbox__input.is-disabled .el-checkbox__inner{background-color:var(--el-checkbox-disabled-input-fill);border-color:var(--el-checkbox-disabled-border-color);cursor:not-allowed}.el-checkbox__input.is-disabled .el-checkbox__inner:after{cursor:not-allowed;border-color:var(--el-checkbox-disabled-icon-color)}.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner{background-color:var(--el-checkbox-disabled-checked-input-fill);border-color:var(--el-checkbox-disabled-checked-input-border-color)}.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner:after{border-color:var(--el-checkbox-disabled-checked-icon-color)}.el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner{background-color:var(--el-checkbox-disabled-checked-input-fill);border-color:var(--el-checkbox-disabled-checked-input-border-color)}.el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner:before{background-color:var(--el-checkbox-disabled-checked-icon-color);border-color:var(--el-checkbox-disabled-checked-icon-color)}.el-checkbox__input.is-disabled+span.el-checkbox__label{color:var(--el-disabled-text-color);cursor:not-allowed}.el-checkbox__input.is-checked .el-checkbox__inner{background-color:var(--el-checkbox-checked-bg-color);border-color:var(--el-checkbox-checked-input-border-color)}.el-checkbox__input.is-checked .el-checkbox__inner:after{transform:rotate(45deg) scaleY(1)}.el-checkbox__input.is-checked+.el-checkbox__label{color:var(--el-checkbox-checked-text-color)}.el-checkbox__input.is-focus:not(.is-checked) .el-checkbox__original:not(:focus-visible){border-color:var(--el-checkbox-input-border-color-hover)}.el-checkbox__input.is-indeterminate .el-checkbox__inner{background-color:var(--el-checkbox-checked-bg-color);border-color:var(--el-checkbox-checked-input-border-color)}.el-checkbox__input.is-indeterminate .el-checkbox__inner:before{content:"";position:absolute;display:block;background-color:var(--el-checkbox-checked-icon-color);height:2px;transform:scale(.5);left:0;right:0;top:5px}.el-checkbox__input.is-indeterminate .el-checkbox__inner:after{display:none}.el-checkbox__inner{display:inline-block;position:relative;border:var(--el-checkbox-input-border);border-radius:var(--el-checkbox-border-radius);box-sizing:border-box;width:var(--el-checkbox-input-width);height:var(--el-checkbox-input-height);background-color:var(--el-checkbox-bg-color);z-index:var(--el-index-normal);transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46),outline .25s cubic-bezier(.71,-.46,.29,1.46)}.el-checkbox__inner:hover{border-color:var(--el-checkbox-input-border-color-hover)}.el-checkbox__inner:after{box-sizing:content-box;content:"";border:1px solid var(--el-checkbox-checked-icon-color);border-left:0;border-top:0;height:7px;left:4px;position:absolute;top:1px;transform:rotate(45deg) scaleY(0);width:3px;transition:transform .15s ease-in 50ms;transform-origin:center}.el-checkbox__original{opacity:0;outline:0;position:absolute;margin:0;width:0;height:0;z-index:-1}.el-checkbox__label{display:inline-block;padding-left:8px;line-height:1;font-size:var(--el-checkbox-font-size)}.el-checkbox.el-checkbox--large{height:40px}.el-checkbox.el-checkbox--large .el-checkbox__label{font-size:14px}.el-checkbox.el-checkbox--large .el-checkbox__inner{width:14px;height:14px}.el-checkbox.el-checkbox--small{height:24px}.el-checkbox.el-checkbox--small .el-checkbox__label{font-size:12px}.el-checkbox.el-checkbox--small .el-checkbox__inner{width:12px;height:12px}.el-checkbox.el-checkbox--small .el-checkbox__input.is-indeterminate .el-checkbox__inner:before{top:4px}.el-checkbox.el-checkbox--small .el-checkbox__inner:after{width:2px;height:6px}.el-checkbox:last-of-type{margin-right:0}[class*=el-col-]{box-sizing:border-box}[class*=el-col-].is-guttered{display:block;min-height:1px}.el-col-0,.el-col-0.is-guttered{display:none}.el-col-0{max-width:0%;flex:0 0 0%}.el-col-offset-0{margin-left:0}.el-col-pull-0{position:relative;right:0}.el-col-push-0{position:relative;left:0}.el-col-1{max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-offset-1{margin-left:4.1666666667%}.el-col-pull-1{position:relative;right:4.1666666667%}.el-col-push-1{position:relative;left:4.1666666667%}.el-col-2{max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-offset-2{margin-left:8.3333333333%}.el-col-pull-2{position:relative;right:8.3333333333%}.el-col-push-2{position:relative;left:8.3333333333%}.el-col-3{max-width:12.5%;flex:0 0 12.5%}.el-col-offset-3{margin-left:12.5%}.el-col-pull-3{position:relative;right:12.5%}.el-col-push-3{position:relative;left:12.5%}.el-col-4{max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-offset-4{margin-left:16.6666666667%}.el-col-pull-4{position:relative;right:16.6666666667%}.el-col-push-4{position:relative;left:16.6666666667%}.el-col-5{max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-offset-5{margin-left:20.8333333333%}.el-col-pull-5{position:relative;right:20.8333333333%}.el-col-push-5{position:relative;left:20.8333333333%}.el-col-6{max-width:25%;flex:0 0 25%}.el-col-offset-6{margin-left:25%}.el-col-pull-6{position:relative;right:25%}.el-col-push-6{position:relative;left:25%}.el-col-7{max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-offset-7{margin-left:29.1666666667%}.el-col-pull-7{position:relative;right:29.1666666667%}.el-col-push-7{position:relative;left:29.1666666667%}.el-col-8{max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-offset-8{margin-left:33.3333333333%}.el-col-pull-8{position:relative;right:33.3333333333%}.el-col-push-8{position:relative;left:33.3333333333%}.el-col-9{max-width:37.5%;flex:0 0 37.5%}.el-col-offset-9{margin-left:37.5%}.el-col-pull-9{position:relative;right:37.5%}.el-col-push-9{position:relative;left:37.5%}.el-col-10{max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-offset-10{margin-left:41.6666666667%}.el-col-pull-10{position:relative;right:41.6666666667%}.el-col-push-10{position:relative;left:41.6666666667%}.el-col-11{max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-offset-11{margin-left:45.8333333333%}.el-col-pull-11{position:relative;right:45.8333333333%}.el-col-push-11{position:relative;left:45.8333333333%}.el-col-12{max-width:50%;flex:0 0 50%}.el-col-offset-12{margin-left:50%}.el-col-pull-12{position:relative;right:50%}.el-col-push-12{position:relative;left:50%}.el-col-13{max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-offset-13{margin-left:54.1666666667%}.el-col-pull-13{position:relative;right:54.1666666667%}.el-col-push-13{position:relative;left:54.1666666667%}.el-col-14{max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-offset-14{margin-left:58.3333333333%}.el-col-pull-14{position:relative;right:58.3333333333%}.el-col-push-14{position:relative;left:58.3333333333%}.el-col-15{max-width:62.5%;flex:0 0 62.5%}.el-col-offset-15{margin-left:62.5%}.el-col-pull-15{position:relative;right:62.5%}.el-col-push-15{position:relative;left:62.5%}.el-col-16{max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-offset-16{margin-left:66.6666666667%}.el-col-pull-16{position:relative;right:66.6666666667%}.el-col-push-16{position:relative;left:66.6666666667%}.el-col-17{max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-offset-17{margin-left:70.8333333333%}.el-col-pull-17{position:relative;right:70.8333333333%}.el-col-push-17{position:relative;left:70.8333333333%}.el-col-18{max-width:75%;flex:0 0 75%}.el-col-offset-18{margin-left:75%}.el-col-pull-18{position:relative;right:75%}.el-col-push-18{position:relative;left:75%}.el-col-19{max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-offset-19{margin-left:79.1666666667%}.el-col-pull-19{position:relative;right:79.1666666667%}.el-col-push-19{position:relative;left:79.1666666667%}.el-col-20{max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-offset-20{margin-left:83.3333333333%}.el-col-pull-20{position:relative;right:83.3333333333%}.el-col-push-20{position:relative;left:83.3333333333%}.el-col-21{max-width:87.5%;flex:0 0 87.5%}.el-col-offset-21{margin-left:87.5%}.el-col-pull-21{position:relative;right:87.5%}.el-col-push-21{position:relative;left:87.5%}.el-col-22{max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-offset-22{margin-left:91.6666666667%}.el-col-pull-22{position:relative;right:91.6666666667%}.el-col-push-22{position:relative;left:91.6666666667%}.el-col-23{max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-offset-23{margin-left:95.8333333333%}.el-col-pull-23{position:relative;right:95.8333333333%}.el-col-push-23{position:relative;left:95.8333333333%}.el-col-24{max-width:100%;flex:0 0 100%}.el-col-offset-24{margin-left:100%}.el-col-pull-24{position:relative;right:100%}.el-col-push-24{position:relative;left:100%}@media only screen and (max-width:768px){.el-col-xs-0,.el-col-xs-0.is-guttered{display:none}.el-col-xs-0{max-width:0%;flex:0 0 0%}.el-col-xs-offset-0{margin-left:0}.el-col-xs-pull-0{position:relative;right:0}.el-col-xs-push-0{position:relative;left:0}.el-col-xs-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-xs-offset-1{margin-left:4.1666666667%}.el-col-xs-pull-1{position:relative;right:4.1666666667%}.el-col-xs-push-1{position:relative;left:4.1666666667%}.el-col-xs-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-xs-offset-2{margin-left:8.3333333333%}.el-col-xs-pull-2{position:relative;right:8.3333333333%}.el-col-xs-push-2{position:relative;left:8.3333333333%}.el-col-xs-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-xs-offset-3{margin-left:12.5%}.el-col-xs-pull-3{position:relative;right:12.5%}.el-col-xs-push-3{position:relative;left:12.5%}.el-col-xs-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-xs-offset-4{margin-left:16.6666666667%}.el-col-xs-pull-4{position:relative;right:16.6666666667%}.el-col-xs-push-4{position:relative;left:16.6666666667%}.el-col-xs-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-xs-offset-5{margin-left:20.8333333333%}.el-col-xs-pull-5{position:relative;right:20.8333333333%}.el-col-xs-push-5{position:relative;left:20.8333333333%}.el-col-xs-6{display:block;max-width:25%;flex:0 0 25%}.el-col-xs-offset-6{margin-left:25%}.el-col-xs-pull-6{position:relative;right:25%}.el-col-xs-push-6{position:relative;left:25%}.el-col-xs-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-xs-offset-7{margin-left:29.1666666667%}.el-col-xs-pull-7{position:relative;right:29.1666666667%}.el-col-xs-push-7{position:relative;left:29.1666666667%}.el-col-xs-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-xs-offset-8{margin-left:33.3333333333%}.el-col-xs-pull-8{position:relative;right:33.3333333333%}.el-col-xs-push-8{position:relative;left:33.3333333333%}.el-col-xs-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-xs-offset-9{margin-left:37.5%}.el-col-xs-pull-9{position:relative;right:37.5%}.el-col-xs-push-9{position:relative;left:37.5%}.el-col-xs-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-xs-offset-10{margin-left:41.6666666667%}.el-col-xs-pull-10{position:relative;right:41.6666666667%}.el-col-xs-push-10{position:relative;left:41.6666666667%}.el-col-xs-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-xs-offset-11{margin-left:45.8333333333%}.el-col-xs-pull-11{position:relative;right:45.8333333333%}.el-col-xs-push-11{position:relative;left:45.8333333333%}.el-col-xs-12{display:block;max-width:50%;flex:0 0 50%}.el-col-xs-offset-12{margin-left:50%}.el-col-xs-pull-12{position:relative;right:50%}.el-col-xs-push-12{position:relative;left:50%}.el-col-xs-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-xs-offset-13{margin-left:54.1666666667%}.el-col-xs-pull-13{position:relative;right:54.1666666667%}.el-col-xs-push-13{position:relative;left:54.1666666667%}.el-col-xs-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-xs-offset-14{margin-left:58.3333333333%}.el-col-xs-pull-14{position:relative;right:58.3333333333%}.el-col-xs-push-14{position:relative;left:58.3333333333%}.el-col-xs-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-xs-offset-15{margin-left:62.5%}.el-col-xs-pull-15{position:relative;right:62.5%}.el-col-xs-push-15{position:relative;left:62.5%}.el-col-xs-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-xs-offset-16{margin-left:66.6666666667%}.el-col-xs-pull-16{position:relative;right:66.6666666667%}.el-col-xs-push-16{position:relative;left:66.6666666667%}.el-col-xs-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-xs-offset-17{margin-left:70.8333333333%}.el-col-xs-pull-17{position:relative;right:70.8333333333%}.el-col-xs-push-17{position:relative;left:70.8333333333%}.el-col-xs-18{display:block;max-width:75%;flex:0 0 75%}.el-col-xs-offset-18{margin-left:75%}.el-col-xs-pull-18{position:relative;right:75%}.el-col-xs-push-18{position:relative;left:75%}.el-col-xs-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-xs-offset-19{margin-left:79.1666666667%}.el-col-xs-pull-19{position:relative;right:79.1666666667%}.el-col-xs-push-19{position:relative;left:79.1666666667%}.el-col-xs-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-xs-offset-20{margin-left:83.3333333333%}.el-col-xs-pull-20{position:relative;right:83.3333333333%}.el-col-xs-push-20{position:relative;left:83.3333333333%}.el-col-xs-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-xs-offset-21{margin-left:87.5%}.el-col-xs-pull-21{position:relative;right:87.5%}.el-col-xs-push-21{position:relative;left:87.5%}.el-col-xs-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-xs-offset-22{margin-left:91.6666666667%}.el-col-xs-pull-22{position:relative;right:91.6666666667%}.el-col-xs-push-22{position:relative;left:91.6666666667%}.el-col-xs-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-xs-offset-23{margin-left:95.8333333333%}.el-col-xs-pull-23{position:relative;right:95.8333333333%}.el-col-xs-push-23{position:relative;left:95.8333333333%}.el-col-xs-24{display:block;max-width:100%;flex:0 0 100%}.el-col-xs-offset-24{margin-left:100%}.el-col-xs-pull-24{position:relative;right:100%}.el-col-xs-push-24{position:relative;left:100%}}@media only screen and (min-width:768px){.el-col-sm-0,.el-col-sm-0.is-guttered{display:none}.el-col-sm-0{max-width:0%;flex:0 0 0%}.el-col-sm-offset-0{margin-left:0}.el-col-sm-pull-0{position:relative;right:0}.el-col-sm-push-0{position:relative;left:0}.el-col-sm-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-sm-offset-1{margin-left:4.1666666667%}.el-col-sm-pull-1{position:relative;right:4.1666666667%}.el-col-sm-push-1{position:relative;left:4.1666666667%}.el-col-sm-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-sm-offset-2{margin-left:8.3333333333%}.el-col-sm-pull-2{position:relative;right:8.3333333333%}.el-col-sm-push-2{position:relative;left:8.3333333333%}.el-col-sm-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-sm-offset-3{margin-left:12.5%}.el-col-sm-pull-3{position:relative;right:12.5%}.el-col-sm-push-3{position:relative;left:12.5%}.el-col-sm-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-sm-offset-4{margin-left:16.6666666667%}.el-col-sm-pull-4{position:relative;right:16.6666666667%}.el-col-sm-push-4{position:relative;left:16.6666666667%}.el-col-sm-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-sm-offset-5{margin-left:20.8333333333%}.el-col-sm-pull-5{position:relative;right:20.8333333333%}.el-col-sm-push-5{position:relative;left:20.8333333333%}.el-col-sm-6{display:block;max-width:25%;flex:0 0 25%}.el-col-sm-offset-6{margin-left:25%}.el-col-sm-pull-6{position:relative;right:25%}.el-col-sm-push-6{position:relative;left:25%}.el-col-sm-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-sm-offset-7{margin-left:29.1666666667%}.el-col-sm-pull-7{position:relative;right:29.1666666667%}.el-col-sm-push-7{position:relative;left:29.1666666667%}.el-col-sm-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-sm-offset-8{margin-left:33.3333333333%}.el-col-sm-pull-8{position:relative;right:33.3333333333%}.el-col-sm-push-8{position:relative;left:33.3333333333%}.el-col-sm-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-sm-offset-9{margin-left:37.5%}.el-col-sm-pull-9{position:relative;right:37.5%}.el-col-sm-push-9{position:relative;left:37.5%}.el-col-sm-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-sm-offset-10{margin-left:41.6666666667%}.el-col-sm-pull-10{position:relative;right:41.6666666667%}.el-col-sm-push-10{position:relative;left:41.6666666667%}.el-col-sm-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-sm-offset-11{margin-left:45.8333333333%}.el-col-sm-pull-11{position:relative;right:45.8333333333%}.el-col-sm-push-11{position:relative;left:45.8333333333%}.el-col-sm-12{display:block;max-width:50%;flex:0 0 50%}.el-col-sm-offset-12{margin-left:50%}.el-col-sm-pull-12{position:relative;right:50%}.el-col-sm-push-12{position:relative;left:50%}.el-col-sm-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-sm-offset-13{margin-left:54.1666666667%}.el-col-sm-pull-13{position:relative;right:54.1666666667%}.el-col-sm-push-13{position:relative;left:54.1666666667%}.el-col-sm-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-sm-offset-14{margin-left:58.3333333333%}.el-col-sm-pull-14{position:relative;right:58.3333333333%}.el-col-sm-push-14{position:relative;left:58.3333333333%}.el-col-sm-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-sm-offset-15{margin-left:62.5%}.el-col-sm-pull-15{position:relative;right:62.5%}.el-col-sm-push-15{position:relative;left:62.5%}.el-col-sm-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-sm-offset-16{margin-left:66.6666666667%}.el-col-sm-pull-16{position:relative;right:66.6666666667%}.el-col-sm-push-16{position:relative;left:66.6666666667%}.el-col-sm-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-sm-offset-17{margin-left:70.8333333333%}.el-col-sm-pull-17{position:relative;right:70.8333333333%}.el-col-sm-push-17{position:relative;left:70.8333333333%}.el-col-sm-18{display:block;max-width:75%;flex:0 0 75%}.el-col-sm-offset-18{margin-left:75%}.el-col-sm-pull-18{position:relative;right:75%}.el-col-sm-push-18{position:relative;left:75%}.el-col-sm-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-sm-offset-19{margin-left:79.1666666667%}.el-col-sm-pull-19{position:relative;right:79.1666666667%}.el-col-sm-push-19{position:relative;left:79.1666666667%}.el-col-sm-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-sm-offset-20{margin-left:83.3333333333%}.el-col-sm-pull-20{position:relative;right:83.3333333333%}.el-col-sm-push-20{position:relative;left:83.3333333333%}.el-col-sm-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-sm-offset-21{margin-left:87.5%}.el-col-sm-pull-21{position:relative;right:87.5%}.el-col-sm-push-21{position:relative;left:87.5%}.el-col-sm-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-sm-offset-22{margin-left:91.6666666667%}.el-col-sm-pull-22{position:relative;right:91.6666666667%}.el-col-sm-push-22{position:relative;left:91.6666666667%}.el-col-sm-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-sm-offset-23{margin-left:95.8333333333%}.el-col-sm-pull-23{position:relative;right:95.8333333333%}.el-col-sm-push-23{position:relative;left:95.8333333333%}.el-col-sm-24{display:block;max-width:100%;flex:0 0 100%}.el-col-sm-offset-24{margin-left:100%}.el-col-sm-pull-24{position:relative;right:100%}.el-col-sm-push-24{position:relative;left:100%}}@media only screen and (min-width:992px){.el-col-md-0,.el-col-md-0.is-guttered{display:none}.el-col-md-0{max-width:0%;flex:0 0 0%}.el-col-md-offset-0{margin-left:0}.el-col-md-pull-0{position:relative;right:0}.el-col-md-push-0{position:relative;left:0}.el-col-md-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-md-offset-1{margin-left:4.1666666667%}.el-col-md-pull-1{position:relative;right:4.1666666667%}.el-col-md-push-1{position:relative;left:4.1666666667%}.el-col-md-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-md-offset-2{margin-left:8.3333333333%}.el-col-md-pull-2{position:relative;right:8.3333333333%}.el-col-md-push-2{position:relative;left:8.3333333333%}.el-col-md-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-md-offset-3{margin-left:12.5%}.el-col-md-pull-3{position:relative;right:12.5%}.el-col-md-push-3{position:relative;left:12.5%}.el-col-md-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-md-offset-4{margin-left:16.6666666667%}.el-col-md-pull-4{position:relative;right:16.6666666667%}.el-col-md-push-4{position:relative;left:16.6666666667%}.el-col-md-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-md-offset-5{margin-left:20.8333333333%}.el-col-md-pull-5{position:relative;right:20.8333333333%}.el-col-md-push-5{position:relative;left:20.8333333333%}.el-col-md-6{display:block;max-width:25%;flex:0 0 25%}.el-col-md-offset-6{margin-left:25%}.el-col-md-pull-6{position:relative;right:25%}.el-col-md-push-6{position:relative;left:25%}.el-col-md-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-md-offset-7{margin-left:29.1666666667%}.el-col-md-pull-7{position:relative;right:29.1666666667%}.el-col-md-push-7{position:relative;left:29.1666666667%}.el-col-md-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-md-offset-8{margin-left:33.3333333333%}.el-col-md-pull-8{position:relative;right:33.3333333333%}.el-col-md-push-8{position:relative;left:33.3333333333%}.el-col-md-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-md-offset-9{margin-left:37.5%}.el-col-md-pull-9{position:relative;right:37.5%}.el-col-md-push-9{position:relative;left:37.5%}.el-col-md-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-md-offset-10{margin-left:41.6666666667%}.el-col-md-pull-10{position:relative;right:41.6666666667%}.el-col-md-push-10{position:relative;left:41.6666666667%}.el-col-md-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-md-offset-11{margin-left:45.8333333333%}.el-col-md-pull-11{position:relative;right:45.8333333333%}.el-col-md-push-11{position:relative;left:45.8333333333%}.el-col-md-12{display:block;max-width:50%;flex:0 0 50%}.el-col-md-offset-12{margin-left:50%}.el-col-md-pull-12{position:relative;right:50%}.el-col-md-push-12{position:relative;left:50%}.el-col-md-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-md-offset-13{margin-left:54.1666666667%}.el-col-md-pull-13{position:relative;right:54.1666666667%}.el-col-md-push-13{position:relative;left:54.1666666667%}.el-col-md-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-md-offset-14{margin-left:58.3333333333%}.el-col-md-pull-14{position:relative;right:58.3333333333%}.el-col-md-push-14{position:relative;left:58.3333333333%}.el-col-md-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-md-offset-15{margin-left:62.5%}.el-col-md-pull-15{position:relative;right:62.5%}.el-col-md-push-15{position:relative;left:62.5%}.el-col-md-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-md-offset-16{margin-left:66.6666666667%}.el-col-md-pull-16{position:relative;right:66.6666666667%}.el-col-md-push-16{position:relative;left:66.6666666667%}.el-col-md-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-md-offset-17{margin-left:70.8333333333%}.el-col-md-pull-17{position:relative;right:70.8333333333%}.el-col-md-push-17{position:relative;left:70.8333333333%}.el-col-md-18{display:block;max-width:75%;flex:0 0 75%}.el-col-md-offset-18{margin-left:75%}.el-col-md-pull-18{position:relative;right:75%}.el-col-md-push-18{position:relative;left:75%}.el-col-md-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-md-offset-19{margin-left:79.1666666667%}.el-col-md-pull-19{position:relative;right:79.1666666667%}.el-col-md-push-19{position:relative;left:79.1666666667%}.el-col-md-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-md-offset-20{margin-left:83.3333333333%}.el-col-md-pull-20{position:relative;right:83.3333333333%}.el-col-md-push-20{position:relative;left:83.3333333333%}.el-col-md-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-md-offset-21{margin-left:87.5%}.el-col-md-pull-21{position:relative;right:87.5%}.el-col-md-push-21{position:relative;left:87.5%}.el-col-md-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-md-offset-22{margin-left:91.6666666667%}.el-col-md-pull-22{position:relative;right:91.6666666667%}.el-col-md-push-22{position:relative;left:91.6666666667%}.el-col-md-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-md-offset-23{margin-left:95.8333333333%}.el-col-md-pull-23{position:relative;right:95.8333333333%}.el-col-md-push-23{position:relative;left:95.8333333333%}.el-col-md-24{display:block;max-width:100%;flex:0 0 100%}.el-col-md-offset-24{margin-left:100%}.el-col-md-pull-24{position:relative;right:100%}.el-col-md-push-24{position:relative;left:100%}}@media only screen and (min-width:1200px){.el-col-lg-0,.el-col-lg-0.is-guttered{display:none}.el-col-lg-0{max-width:0%;flex:0 0 0%}.el-col-lg-offset-0{margin-left:0}.el-col-lg-pull-0{position:relative;right:0}.el-col-lg-push-0{position:relative;left:0}.el-col-lg-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-lg-offset-1{margin-left:4.1666666667%}.el-col-lg-pull-1{position:relative;right:4.1666666667%}.el-col-lg-push-1{position:relative;left:4.1666666667%}.el-col-lg-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-lg-offset-2{margin-left:8.3333333333%}.el-col-lg-pull-2{position:relative;right:8.3333333333%}.el-col-lg-push-2{position:relative;left:8.3333333333%}.el-col-lg-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-lg-offset-3{margin-left:12.5%}.el-col-lg-pull-3{position:relative;right:12.5%}.el-col-lg-push-3{position:relative;left:12.5%}.el-col-lg-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-lg-offset-4{margin-left:16.6666666667%}.el-col-lg-pull-4{position:relative;right:16.6666666667%}.el-col-lg-push-4{position:relative;left:16.6666666667%}.el-col-lg-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-lg-offset-5{margin-left:20.8333333333%}.el-col-lg-pull-5{position:relative;right:20.8333333333%}.el-col-lg-push-5{position:relative;left:20.8333333333%}.el-col-lg-6{display:block;max-width:25%;flex:0 0 25%}.el-col-lg-offset-6{margin-left:25%}.el-col-lg-pull-6{position:relative;right:25%}.el-col-lg-push-6{position:relative;left:25%}.el-col-lg-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-lg-offset-7{margin-left:29.1666666667%}.el-col-lg-pull-7{position:relative;right:29.1666666667%}.el-col-lg-push-7{position:relative;left:29.1666666667%}.el-col-lg-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-lg-offset-8{margin-left:33.3333333333%}.el-col-lg-pull-8{position:relative;right:33.3333333333%}.el-col-lg-push-8{position:relative;left:33.3333333333%}.el-col-lg-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-lg-offset-9{margin-left:37.5%}.el-col-lg-pull-9{position:relative;right:37.5%}.el-col-lg-push-9{position:relative;left:37.5%}.el-col-lg-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-lg-offset-10{margin-left:41.6666666667%}.el-col-lg-pull-10{position:relative;right:41.6666666667%}.el-col-lg-push-10{position:relative;left:41.6666666667%}.el-col-lg-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-lg-offset-11{margin-left:45.8333333333%}.el-col-lg-pull-11{position:relative;right:45.8333333333%}.el-col-lg-push-11{position:relative;left:45.8333333333%}.el-col-lg-12{display:block;max-width:50%;flex:0 0 50%}.el-col-lg-offset-12{margin-left:50%}.el-col-lg-pull-12{position:relative;right:50%}.el-col-lg-push-12{position:relative;left:50%}.el-col-lg-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-lg-offset-13{margin-left:54.1666666667%}.el-col-lg-pull-13{position:relative;right:54.1666666667%}.el-col-lg-push-13{position:relative;left:54.1666666667%}.el-col-lg-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-lg-offset-14{margin-left:58.3333333333%}.el-col-lg-pull-14{position:relative;right:58.3333333333%}.el-col-lg-push-14{position:relative;left:58.3333333333%}.el-col-lg-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-lg-offset-15{margin-left:62.5%}.el-col-lg-pull-15{position:relative;right:62.5%}.el-col-lg-push-15{position:relative;left:62.5%}.el-col-lg-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-lg-offset-16{margin-left:66.6666666667%}.el-col-lg-pull-16{position:relative;right:66.6666666667%}.el-col-lg-push-16{position:relative;left:66.6666666667%}.el-col-lg-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-lg-offset-17{margin-left:70.8333333333%}.el-col-lg-pull-17{position:relative;right:70.8333333333%}.el-col-lg-push-17{position:relative;left:70.8333333333%}.el-col-lg-18{display:block;max-width:75%;flex:0 0 75%}.el-col-lg-offset-18{margin-left:75%}.el-col-lg-pull-18{position:relative;right:75%}.el-col-lg-push-18{position:relative;left:75%}.el-col-lg-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-lg-offset-19{margin-left:79.1666666667%}.el-col-lg-pull-19{position:relative;right:79.1666666667%}.el-col-lg-push-19{position:relative;left:79.1666666667%}.el-col-lg-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-lg-offset-20{margin-left:83.3333333333%}.el-col-lg-pull-20{position:relative;right:83.3333333333%}.el-col-lg-push-20{position:relative;left:83.3333333333%}.el-col-lg-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-lg-offset-21{margin-left:87.5%}.el-col-lg-pull-21{position:relative;right:87.5%}.el-col-lg-push-21{position:relative;left:87.5%}.el-col-lg-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-lg-offset-22{margin-left:91.6666666667%}.el-col-lg-pull-22{position:relative;right:91.6666666667%}.el-col-lg-push-22{position:relative;left:91.6666666667%}.el-col-lg-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-lg-offset-23{margin-left:95.8333333333%}.el-col-lg-pull-23{position:relative;right:95.8333333333%}.el-col-lg-push-23{position:relative;left:95.8333333333%}.el-col-lg-24{display:block;max-width:100%;flex:0 0 100%}.el-col-lg-offset-24{margin-left:100%}.el-col-lg-pull-24{position:relative;right:100%}.el-col-lg-push-24{position:relative;left:100%}}@media only screen and (min-width:1920px){.el-col-xl-0,.el-col-xl-0.is-guttered{display:none}.el-col-xl-0{max-width:0%;flex:0 0 0%}.el-col-xl-offset-0{margin-left:0}.el-col-xl-pull-0{position:relative;right:0}.el-col-xl-push-0{position:relative;left:0}.el-col-xl-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-xl-offset-1{margin-left:4.1666666667%}.el-col-xl-pull-1{position:relative;right:4.1666666667%}.el-col-xl-push-1{position:relative;left:4.1666666667%}.el-col-xl-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-xl-offset-2{margin-left:8.3333333333%}.el-col-xl-pull-2{position:relative;right:8.3333333333%}.el-col-xl-push-2{position:relative;left:8.3333333333%}.el-col-xl-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-xl-offset-3{margin-left:12.5%}.el-col-xl-pull-3{position:relative;right:12.5%}.el-col-xl-push-3{position:relative;left:12.5%}.el-col-xl-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-xl-offset-4{margin-left:16.6666666667%}.el-col-xl-pull-4{position:relative;right:16.6666666667%}.el-col-xl-push-4{position:relative;left:16.6666666667%}.el-col-xl-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-xl-offset-5{margin-left:20.8333333333%}.el-col-xl-pull-5{position:relative;right:20.8333333333%}.el-col-xl-push-5{position:relative;left:20.8333333333%}.el-col-xl-6{display:block;max-width:25%;flex:0 0 25%}.el-col-xl-offset-6{margin-left:25%}.el-col-xl-pull-6{position:relative;right:25%}.el-col-xl-push-6{position:relative;left:25%}.el-col-xl-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-xl-offset-7{margin-left:29.1666666667%}.el-col-xl-pull-7{position:relative;right:29.1666666667%}.el-col-xl-push-7{position:relative;left:29.1666666667%}.el-col-xl-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-xl-offset-8{margin-left:33.3333333333%}.el-col-xl-pull-8{position:relative;right:33.3333333333%}.el-col-xl-push-8{position:relative;left:33.3333333333%}.el-col-xl-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-xl-offset-9{margin-left:37.5%}.el-col-xl-pull-9{position:relative;right:37.5%}.el-col-xl-push-9{position:relative;left:37.5%}.el-col-xl-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-xl-offset-10{margin-left:41.6666666667%}.el-col-xl-pull-10{position:relative;right:41.6666666667%}.el-col-xl-push-10{position:relative;left:41.6666666667%}.el-col-xl-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-xl-offset-11{margin-left:45.8333333333%}.el-col-xl-pull-11{position:relative;right:45.8333333333%}.el-col-xl-push-11{position:relative;left:45.8333333333%}.el-col-xl-12{display:block;max-width:50%;flex:0 0 50%}.el-col-xl-offset-12{margin-left:50%}.el-col-xl-pull-12{position:relative;right:50%}.el-col-xl-push-12{position:relative;left:50%}.el-col-xl-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-xl-offset-13{margin-left:54.1666666667%}.el-col-xl-pull-13{position:relative;right:54.1666666667%}.el-col-xl-push-13{position:relative;left:54.1666666667%}.el-col-xl-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-xl-offset-14{margin-left:58.3333333333%}.el-col-xl-pull-14{position:relative;right:58.3333333333%}.el-col-xl-push-14{position:relative;left:58.3333333333%}.el-col-xl-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-xl-offset-15{margin-left:62.5%}.el-col-xl-pull-15{position:relative;right:62.5%}.el-col-xl-push-15{position:relative;left:62.5%}.el-col-xl-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-xl-offset-16{margin-left:66.6666666667%}.el-col-xl-pull-16{position:relative;right:66.6666666667%}.el-col-xl-push-16{position:relative;left:66.6666666667%}.el-col-xl-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-xl-offset-17{margin-left:70.8333333333%}.el-col-xl-pull-17{position:relative;right:70.8333333333%}.el-col-xl-push-17{position:relative;left:70.8333333333%}.el-col-xl-18{display:block;max-width:75%;flex:0 0 75%}.el-col-xl-offset-18{margin-left:75%}.el-col-xl-pull-18{position:relative;right:75%}.el-col-xl-push-18{position:relative;left:75%}.el-col-xl-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-xl-offset-19{margin-left:79.1666666667%}.el-col-xl-pull-19{position:relative;right:79.1666666667%}.el-col-xl-push-19{position:relative;left:79.1666666667%}.el-col-xl-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-xl-offset-20{margin-left:83.3333333333%}.el-col-xl-pull-20{position:relative;right:83.3333333333%}.el-col-xl-push-20{position:relative;left:83.3333333333%}.el-col-xl-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-xl-offset-21{margin-left:87.5%}.el-col-xl-pull-21{position:relative;right:87.5%}.el-col-xl-push-21{position:relative;left:87.5%}.el-col-xl-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-xl-offset-22{margin-left:91.6666666667%}.el-col-xl-pull-22{position:relative;right:91.6666666667%}.el-col-xl-push-22{position:relative;left:91.6666666667%}.el-col-xl-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-xl-offset-23{margin-left:95.8333333333%}.el-col-xl-pull-23{position:relative;right:95.8333333333%}.el-col-xl-push-23{position:relative;left:95.8333333333%}.el-col-xl-24{display:block;max-width:100%;flex:0 0 100%}.el-col-xl-offset-24{margin-left:100%}.el-col-xl-pull-24{position:relative;right:100%}.el-col-xl-push-24{position:relative;left:100%}}.el-collapse{--el-collapse-border-color:var(--el-border-color-lighter);--el-collapse-header-height:48px;--el-collapse-header-bg-color:var(--el-fill-color-blank);--el-collapse-header-text-color:var(--el-text-color-primary);--el-collapse-header-font-size:13px;--el-collapse-content-bg-color:var(--el-fill-color-blank);--el-collapse-content-font-size:13px;--el-collapse-content-text-color:var(--el-text-color-primary);border-top:1px solid var(--el-collapse-border-color);border-bottom:1px solid var(--el-collapse-border-color)}.el-collapse-item.is-disabled .el-collapse-item__header{color:var(--el-text-color-disabled);cursor:not-allowed}.el-collapse-item__header{display:flex;align-items:center;height:var(--el-collapse-header-height);line-height:var(--el-collapse-header-height);background-color:var(--el-collapse-header-bg-color);color:var(--el-collapse-header-text-color);cursor:pointer;border-bottom:1px solid var(--el-collapse-border-color);font-size:var(--el-collapse-header-font-size);font-weight:500;transition:border-bottom-color var(--el-transition-duration);outline:0}.el-collapse-item__arrow{margin:0 8px 0 auto;transition:transform var(--el-transition-duration);font-weight:300}.el-collapse-item__arrow.is-active{transform:rotate(90deg)}.el-collapse-item__header.focusing:focus:not(:hover){color:var(--el-color-primary)}.el-collapse-item__header.is-active{border-bottom-color:transparent}.el-collapse-item__wrap{will-change:height;background-color:var(--el-collapse-content-bg-color);overflow:hidden;box-sizing:border-box;border-bottom:1px solid var(--el-collapse-border-color)}.el-collapse-item__content{padding-bottom:25px;font-size:var(--el-collapse-content-font-size);color:var(--el-collapse-content-text-color);line-height:1.7692307692}.el-collapse-item:last-child{margin-bottom:-1px}.el-color-predefine{display:flex;font-size:12px;margin-top:8px;width:280px}.el-color-predefine__colors{display:flex;flex:1;flex-wrap:wrap}.el-color-predefine__color-selector{margin:0 0 8px 8px;width:20px;height:20px;border-radius:4px;cursor:pointer}.el-color-predefine__color-selector:nth-child(10n+1){margin-left:0}.el-color-predefine__color-selector.selected{box-shadow:0 0 3px 2px var(--el-color-primary)}.el-color-predefine__color-selector>div{display:flex;height:100%;border-radius:3px}.el-color-predefine__color-selector.is-alpha{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.el-color-hue-slider{position:relative;box-sizing:border-box;width:280px;height:12px;background-color:red;padding:0 2px;float:right}.el-color-hue-slider__bar{position:relative;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%);height:100%}.el-color-hue-slider__thumb{position:absolute;cursor:pointer;box-sizing:border-box;left:0;top:0;width:4px;height:100%;border-radius:1px;background:#fff;border:1px solid var(--el-border-color-lighter);box-shadow:0 0 2px #0009;z-index:1}.el-color-hue-slider.is-vertical{width:12px;height:180px;padding:2px 0}.el-color-hue-slider.is-vertical .el-color-hue-slider__bar{background:linear-gradient(to bottom,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}.el-color-hue-slider.is-vertical .el-color-hue-slider__thumb{left:0;top:0;width:100%;height:4px}.el-color-svpanel{position:relative;width:280px;height:180px}.el-color-svpanel__black,.el-color-svpanel__white{position:absolute;top:0;left:0;right:0;bottom:0}.el-color-svpanel__white{background:linear-gradient(to right,#fff,rgba(255,255,255,0))}.el-color-svpanel__black{background:linear-gradient(to top,#000,rgba(0,0,0,0))}.el-color-svpanel__cursor{position:absolute}.el-color-svpanel__cursor>div{cursor:head;width:4px;height:4px;box-shadow:0 0 0 1.5px #fff,inset 0 0 1px 1px #0000004d,0 0 1px 2px #0006;border-radius:50%;transform:translate(-2px,-2px)}.el-color-alpha-slider{position:relative;box-sizing:border-box;width:280px;height:12px;background-image:linear-gradient(45deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(45deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%);background-size:12px 12px;background-position:0 0,6px 0,6px -6px,0 6px}.el-color-alpha-slider__bar{position:relative;background:linear-gradient(to right,rgba(255,255,255,0) 0,var(--el-bg-color) 100%);height:100%}.el-color-alpha-slider__thumb{position:absolute;cursor:pointer;box-sizing:border-box;left:0;top:0;width:4px;height:100%;border-radius:1px;background:#fff;border:1px solid var(--el-border-color-lighter);box-shadow:0 0 2px #0009;z-index:1}.el-color-alpha-slider.is-vertical{width:20px;height:180px}.el-color-alpha-slider.is-vertical .el-color-alpha-slider__bar{background:linear-gradient(to bottom,rgba(255,255,255,0) 0,#fff 100%)}.el-color-alpha-slider.is-vertical .el-color-alpha-slider__thumb{left:0;top:0;width:100%;height:4px}.el-color-dropdown{width:300px}.el-color-dropdown__main-wrapper{margin-bottom:6px}.el-color-dropdown__main-wrapper:after{content:"";display:table;clear:both}.el-color-dropdown__btns{margin-top:12px;text-align:right}.el-color-dropdown__value{float:left;line-height:26px;font-size:12px;color:#000;width:160px}.el-color-picker{display:inline-block;position:relative;line-height:normal;outline:0}.el-color-picker:hover:not(.is-disabled) .el-color-picker__trigger{border:1px solid var(--el-border-color-hover)}.el-color-picker:focus-visible:not(.is-disabled) .el-color-picker__trigger{outline:2px solid var(--el-color-primary);outline-offset:1px}.el-color-picker.is-disabled .el-color-picker__trigger{cursor:not-allowed}.el-color-picker--large{height:40px}.el-color-picker--large .el-color-picker__trigger{height:40px;width:40px}.el-color-picker--large .el-color-picker__mask{height:38px;width:38px}.el-color-picker--small{height:24px}.el-color-picker--small .el-color-picker__trigger{height:24px;width:24px}.el-color-picker--small .el-color-picker__mask{height:22px;width:22px}.el-color-picker--small .el-color-picker__empty,.el-color-picker--small .el-color-picker__icon{transform:scale(.8)}.el-color-picker__mask{height:30px;width:30px;border-radius:4px;position:absolute;top:1px;left:1px;z-index:1;cursor:not-allowed;background-color:#ffffffb3}.el-color-picker__trigger{display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;height:32px;width:32px;padding:4px;border:1px solid var(--el-border-color);border-radius:4px;font-size:0;position:relative;cursor:pointer}.el-color-picker__color{position:relative;display:block;box-sizing:border-box;border:1px solid var(--el-text-color-secondary);border-radius:var(--el-border-radius-small);width:100%;height:100%;text-align:center}.el-color-picker__color.is-alpha{background-image:linear-gradient(45deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(45deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%);background-size:12px 12px;background-position:0 0,6px 0,6px -6px,0 6px}.el-color-picker__color-inner{display:inline-flex;justify-content:center;align-items:center;width:100%;height:100%}.el-color-picker .el-color-picker__empty{font-size:12px;color:var(--el-text-color-secondary)}.el-color-picker .el-color-picker__icon{display:inline-flex;justify-content:center;align-items:center;color:#fff;font-size:12px}.el-color-picker__panel{position:absolute;z-index:10;padding:6px;box-sizing:content-box;background-color:#fff;border-radius:var(--el-border-radius-base);box-shadow:var(--el-box-shadow-light)}.el-color-picker__panel.el-popper{border:1px solid var(--el-border-color-lighter)}.el-color-picker,.el-color-picker__panel{--el-color-picker-alpha-bg-a:#ccc;--el-color-picker-alpha-bg-b:transparent}.dark .el-color-picker,.dark .el-color-picker__panel{--el-color-picker-alpha-bg-a:#333333}.el-container{display:flex;flex-direction:row;flex:1;flex-basis:auto;box-sizing:border-box;min-width:0}.el-container.is-vertical{flex-direction:column}.el-date-table{font-size:12px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-date-table.is-week-mode .el-date-table__row:hover .el-date-table-cell{background-color:var(--el-datepicker-inrange-bg-color)}.el-date-table.is-week-mode .el-date-table__row:hover td.available:hover{color:var(--el-datepicker-text-color)}.el-date-table.is-week-mode .el-date-table__row:hover td:first-child .el-date-table-cell{margin-left:5px;border-top-left-radius:15px;border-bottom-left-radius:15px}.el-date-table.is-week-mode .el-date-table__row:hover td:last-child .el-date-table-cell{margin-right:5px;border-top-right-radius:15px;border-bottom-right-radius:15px}.el-date-table.is-week-mode .el-date-table__row.current .el-date-table-cell{background-color:var(--el-datepicker-inrange-bg-color)}.el-date-table td{width:32px;height:30px;padding:4px 0;box-sizing:border-box;text-align:center;cursor:pointer;position:relative}.el-date-table td .el-date-table-cell{height:30px;padding:3px 0;box-sizing:border-box}.el-date-table td .el-date-table-cell .el-date-table-cell__text{width:24px;height:24px;display:block;margin:0 auto;line-height:24px;position:absolute;left:50%;transform:translate(-50%);border-radius:50%}.el-date-table td.next-month,.el-date-table td.prev-month{color:var(--el-datepicker-off-text-color)}.el-date-table td.today{position:relative}.el-date-table td.today .el-date-table-cell__text{color:var(--el-color-primary);font-weight:700}.el-date-table td.today.end-date .el-date-table-cell__text,.el-date-table td.today.start-date .el-date-table-cell__text{color:#fff}.el-date-table td.available:hover{color:var(--el-datepicker-hover-text-color)}.el-date-table td.in-range .el-date-table-cell{background-color:var(--el-datepicker-inrange-bg-color)}.el-date-table td.in-range .el-date-table-cell:hover{background-color:var(--el-datepicker-inrange-hover-bg-color)}.el-date-table td.current:not(.disabled) .el-date-table-cell__text{color:#fff;background-color:var(--el-datepicker-active-color)}.el-date-table td.current:not(.disabled):focus-visible .el-date-table-cell__text{outline:2px solid var(--el-datepicker-active-color);outline-offset:1px}.el-date-table td.end-date .el-date-table-cell,.el-date-table td.start-date .el-date-table-cell{color:#fff}.el-date-table td.end-date .el-date-table-cell__text,.el-date-table td.start-date .el-date-table-cell__text{background-color:var(--el-datepicker-active-color)}.el-date-table td.start-date .el-date-table-cell{margin-left:5px;border-top-left-radius:15px;border-bottom-left-radius:15px}.el-date-table td.end-date .el-date-table-cell{margin-right:5px;border-top-right-radius:15px;border-bottom-right-radius:15px}.el-date-table td.disabled .el-date-table-cell{background-color:var(--el-fill-color-light);opacity:1;cursor:not-allowed;color:var(--el-text-color-placeholder)}.el-date-table td.selected .el-date-table-cell{margin-left:5px;margin-right:5px;background-color:var(--el-datepicker-inrange-bg-color);border-radius:15px}.el-date-table td.selected .el-date-table-cell:hover{background-color:var(--el-datepicker-inrange-hover-bg-color)}.el-date-table td.selected .el-date-table-cell__text{background-color:var(--el-datepicker-active-color);color:#fff;border-radius:15px}.el-date-table td.week{font-size:80%;color:var(--el-datepicker-header-text-color)}.el-date-table td:focus{outline:0}.el-date-table th{padding:5px;color:var(--el-datepicker-header-text-color);font-weight:400;border-bottom:solid 1px var(--el-border-color-lighter)}.el-month-table{font-size:12px;margin:-1px;border-collapse:collapse}.el-month-table td{text-align:center;padding:8px 0;cursor:pointer}.el-month-table td div{height:48px;padding:6px 0;box-sizing:border-box}.el-month-table td.today .cell{color:var(--el-color-primary);font-weight:700}.el-month-table td.today.end-date .cell,.el-month-table td.today.start-date .cell{color:#fff}.el-month-table td.disabled .cell{background-color:var(--el-fill-color-light);cursor:not-allowed;color:var(--el-text-color-placeholder)}.el-month-table td.disabled .cell:hover{color:var(--el-text-color-placeholder)}.el-month-table td .cell{width:60px;height:36px;display:block;line-height:36px;color:var(--el-datepicker-text-color);margin:0 auto;border-radius:18px}.el-month-table td .cell:hover{color:var(--el-datepicker-hover-text-color)}.el-month-table td.in-range div{background-color:var(--el-datepicker-inrange-bg-color)}.el-month-table td.in-range div:hover{background-color:var(--el-datepicker-inrange-hover-bg-color)}.el-month-table td.end-date div,.el-month-table td.start-date div{color:#fff}.el-month-table td.end-date .cell,.el-month-table td.start-date .cell{color:#fff;background-color:var(--el-datepicker-active-color)}.el-month-table td.start-date div{border-top-left-radius:24px;border-bottom-left-radius:24px}.el-month-table td.end-date div{border-top-right-radius:24px;border-bottom-right-radius:24px}.el-month-table td.current:not(.disabled) .cell{color:var(--el-datepicker-active-color)}.el-month-table td:focus-visible{outline:0}.el-month-table td:focus-visible .cell{outline:2px solid var(--el-datepicker-active-color)}.el-year-table{font-size:12px;margin:-1px;border-collapse:collapse}.el-year-table .el-icon{color:var(--el-datepicker-icon-color)}.el-year-table td{text-align:center;padding:20px 3px;cursor:pointer}.el-year-table td.today .cell{color:var(--el-color-primary);font-weight:700}.el-year-table td.disabled .cell{background-color:var(--el-fill-color-light);cursor:not-allowed;color:var(--el-text-color-placeholder)}.el-year-table td.disabled .cell:hover{color:var(--el-text-color-placeholder)}.el-year-table td .cell{width:48px;height:36px;display:block;line-height:36px;color:var(--el-datepicker-text-color);border-radius:18px;margin:0 auto}.el-year-table td .cell:hover{color:var(--el-datepicker-hover-text-color)}.el-year-table td.current:not(.disabled) .cell{color:var(--el-datepicker-active-color)}.el-year-table td:focus-visible{outline:0}.el-year-table td:focus-visible .cell{outline:2px solid var(--el-datepicker-active-color)}.el-time-spinner.has-seconds .el-time-spinner__wrapper{width:33.3%}.el-time-spinner__wrapper{max-height:192px;overflow:auto;display:inline-block;width:50%;vertical-align:top;position:relative}.el-time-spinner__wrapper.el-scrollbar__wrap:not(.el-scrollbar__wrap--hidden-default){padding-bottom:15px}.el-time-spinner__wrapper.is-arrow{box-sizing:border-box;text-align:center;overflow:hidden}.el-time-spinner__wrapper.is-arrow .el-time-spinner__list{transform:translateY(-32px)}.el-time-spinner__wrapper.is-arrow .el-time-spinner__item:hover:not(.is-disabled):not(.is-active){background:var(--el-fill-color-light);cursor:default}.el-time-spinner__arrow{font-size:12px;color:var(--el-text-color-secondary);position:absolute;left:0;width:100%;z-index:var(--el-index-normal);text-align:center;height:30px;line-height:30px;cursor:pointer}.el-time-spinner__arrow:hover{color:var(--el-color-primary)}.el-time-spinner__arrow.arrow-up{top:10px}.el-time-spinner__arrow.arrow-down{bottom:10px}.el-time-spinner__input.el-input{width:70%}.el-time-spinner__input.el-input .el-input__inner{padding:0;text-align:center}.el-time-spinner__list{padding:0;margin:0;list-style:none;text-align:center}.el-time-spinner__list:after,.el-time-spinner__list:before{content:"";display:block;width:100%;height:80px}.el-time-spinner__item{height:32px;line-height:32px;font-size:12px;color:var(--el-text-color-regular)}.el-time-spinner__item:hover:not(.is-disabled):not(.is-active){background:var(--el-fill-color-light);cursor:pointer}.el-time-spinner__item.is-active:not(.is-disabled){color:var(--el-text-color-primary);font-weight:700}.el-time-spinner__item.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-picker__popper{--el-datepicker-border-color:var(--el-disabled-border-color)}.el-picker__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-datepicker-border-color);box-shadow:var(--el-box-shadow-light)}.el-picker__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-datepicker-border-color)}.el-picker__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-picker__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-picker__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-picker__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-date-editor{--el-date-editor-width:220px;--el-date-editor-monthrange-width:300px;--el-date-editor-daterange-width:350px;--el-date-editor-datetimerange-width:400px;--el-input-text-color:var(--el-text-color-regular);--el-input-border:var(--el-border);--el-input-hover-border:var(--el-border-color-hover);--el-input-focus-border:var(--el-color-primary);--el-input-transparent-border:0 0 0 1px transparent inset;--el-input-border-color:var(--el-border-color);--el-input-border-radius:var(--el-border-radius-base);--el-input-bg-color:var(--el-fill-color-blank);--el-input-icon-color:var(--el-text-color-placeholder);--el-input-placeholder-color:var(--el-text-color-placeholder);--el-input-hover-border-color:var(--el-border-color-hover);--el-input-clear-hover-color:var(--el-text-color-secondary);--el-input-focus-border-color:var(--el-color-primary);position:relative;display:inline-block;text-align:left}.el-date-editor.el-input__wrapper{box-shadow:0 0 0 1px var(--el-input-border-color,var(--el-border-color)) inset}.el-date-editor.el-input__wrapper:hover{box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-date-editor.el-input,.el-date-editor.el-input__wrapper{width:var(--el-date-editor-width);height:var(--el-input-height,var(--el-component-size))}.el-date-editor--monthrange{--el-date-editor-width:var(--el-date-editor-monthrange-width)}.el-date-editor--daterange,.el-date-editor--timerange{--el-date-editor-width:var(--el-date-editor-daterange-width)}.el-date-editor--datetimerange{--el-date-editor-width:var(--el-date-editor-datetimerange-width)}.el-date-editor--dates .el-input__wrapper{text-overflow:ellipsis;white-space:nowrap}.el-date-editor .close-icon,.el-date-editor .clear-icon{cursor:pointer}.el-date-editor .clear-icon:hover{color:var(--el-text-color-secondary)}.el-date-editor .el-range__icon{height:inherit;font-size:14px;color:var(--el-text-color-placeholder);float:left}.el-date-editor .el-range__icon svg{vertical-align:middle}.el-date-editor .el-range-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;outline:0;display:inline-block;height:30px;line-height:30px;margin:0;padding:0;width:39%;text-align:center;font-size:var(--el-font-size-base);color:var(--el-text-color-regular);background-color:transparent}.el-date-editor .el-range-input::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-date-editor .el-range-input:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-date-editor .el-range-input::placeholder{color:var(--el-text-color-placeholder)}.el-date-editor .el-range-separator{flex:1;display:inline-flex;justify-content:center;align-items:center;height:100%;padding:0 5px;margin:0;font-size:14px;word-break:keep-all;color:var(--el-text-color-primary)}.el-date-editor .el-range__close-icon{font-size:14px;color:var(--el-text-color-placeholder);height:inherit;width:unset;cursor:pointer}.el-date-editor .el-range__close-icon:hover{color:var(--el-text-color-secondary)}.el-date-editor .el-range__close-icon svg{vertical-align:middle}.el-date-editor .el-range__close-icon--hidden{opacity:0;visibility:hidden}.el-range-editor.el-input__wrapper{display:inline-flex;align-items:center;padding:0 10px}.el-range-editor.is-active,.el-range-editor.is-active:hover{box-shadow:0 0 0 1px var(--el-input-focus-border-color) inset}.el-range-editor--large{line-height:var(--el-component-size-large)}.el-range-editor--large.el-input__wrapper{height:var(--el-component-size-large)}.el-range-editor--large .el-range-separator{line-height:40px;font-size:14px}.el-range-editor--large .el-range-input{height:38px;line-height:38px;font-size:14px}.el-range-editor--small{line-height:var(--el-component-size-small)}.el-range-editor--small.el-input__wrapper{height:var(--el-component-size-small)}.el-range-editor--small .el-range-separator{line-height:24px;font-size:12px}.el-range-editor--small .el-range-input{height:22px;line-height:22px;font-size:12px}.el-range-editor.is-disabled{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color);color:var(--el-disabled-text-color);cursor:not-allowed}.el-range-editor.is-disabled:focus,.el-range-editor.is-disabled:hover{border-color:var(--el-disabled-border-color)}.el-range-editor.is-disabled input{background-color:var(--el-disabled-bg-color);color:var(--el-disabled-text-color);cursor:not-allowed}.el-range-editor.is-disabled input::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-range-editor.is-disabled input:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-range-editor.is-disabled input::placeholder{color:var(--el-text-color-placeholder)}.el-range-editor.is-disabled .el-range-separator{color:var(--el-disabled-text-color)}.el-picker-panel{color:var(--el-text-color-regular);background:var(--el-bg-color-overlay);border-radius:var(--el-border-radius-base);line-height:30px}.el-picker-panel .el-time-panel{margin:5px 0;border:solid 1px var(--el-datepicker-border-color);background-color:var(--el-bg-color-overlay);box-shadow:var(--el-box-shadow-light)}.el-picker-panel__body-wrapper:after,.el-picker-panel__body:after{content:"";display:table;clear:both}.el-picker-panel__content{position:relative;margin:15px}.el-picker-panel__footer{border-top:1px solid var(--el-datepicker-inner-border-color);padding:4px 12px;text-align:right;background-color:var(--el-bg-color-overlay);position:relative;font-size:0}.el-picker-panel__shortcut{display:block;width:100%;border:0;background-color:transparent;line-height:28px;font-size:14px;color:var(--el-datepicker-text-color);padding-left:12px;text-align:left;outline:0;cursor:pointer}.el-picker-panel__shortcut:hover{color:var(--el-datepicker-hover-text-color)}.el-picker-panel__shortcut.active{background-color:#e6f1fe;color:var(--el-datepicker-active-color)}.el-picker-panel__btn{border:1px solid var(--el-fill-color-darker);color:var(--el-text-color-primary);line-height:24px;border-radius:2px;padding:0 20px;cursor:pointer;background-color:transparent;outline:0;font-size:12px}.el-picker-panel__btn[disabled]{color:var(--el-text-color-disabled);cursor:not-allowed}.el-picker-panel__icon-btn{font-size:12px;color:var(--el-datepicker-icon-color);border:0;background:0 0;cursor:pointer;outline:0;margin-top:8px}.el-picker-panel__icon-btn:hover{color:var(--el-datepicker-hover-text-color)}.el-picker-panel__icon-btn:focus-visible{color:var(--el-datepicker-hover-text-color)}.el-picker-panel__icon-btn.is-disabled{color:var(--el-text-color-disabled)}.el-picker-panel__icon-btn.is-disabled:hover{cursor:not-allowed}.el-picker-panel__icon-btn .el-icon{cursor:pointer;font-size:inherit}.el-picker-panel__link-btn{vertical-align:middle}.el-picker-panel [slot=sidebar],.el-picker-panel__sidebar{position:absolute;top:0;bottom:0;width:110px;border-right:1px solid var(--el-datepicker-inner-border-color);box-sizing:border-box;padding-top:6px;background-color:var(--el-bg-color-overlay);overflow:auto}.el-picker-panel [slot=sidebar]+.el-picker-panel__body,.el-picker-panel__sidebar+.el-picker-panel__body{margin-left:110px}.el-date-picker{--el-datepicker-text-color:var(--el-text-color-regular);--el-datepicker-off-text-color:var(--el-text-color-placeholder);--el-datepicker-header-text-color:var(--el-text-color-regular);--el-datepicker-icon-color:var(--el-text-color-primary);--el-datepicker-border-color:var(--el-disabled-border-color);--el-datepicker-inner-border-color:var(--el-border-color-light);--el-datepicker-inrange-bg-color:var(--el-border-color-extra-light);--el-datepicker-inrange-hover-bg-color:var(--el-border-color-extra-light);--el-datepicker-active-color:var(--el-color-primary);--el-datepicker-hover-text-color:var(--el-color-primary)}.el-date-picker{width:322px}.el-date-picker.has-sidebar.has-time{width:434px}.el-date-picker.has-sidebar{width:438px}.el-date-picker.has-time .el-picker-panel__body-wrapper{position:relative}.el-date-picker .el-picker-panel__content{width:292px}.el-date-picker table{table-layout:fixed;width:100%}.el-date-picker__editor-wrap{position:relative;display:table-cell;padding:0 5px}.el-date-picker__time-header{position:relative;border-bottom:1px solid var(--el-datepicker-inner-border-color);font-size:12px;padding:8px 5px 5px;display:table;width:100%;box-sizing:border-box}.el-date-picker__header{margin:12px;text-align:center}.el-date-picker__header--bordered{margin-bottom:0;padding-bottom:12px;border-bottom:solid 1px var(--el-border-color-lighter)}.el-date-picker__header--bordered+.el-picker-panel__content{margin-top:0}.el-date-picker__header-label{font-size:16px;font-weight:500;padding:0 5px;line-height:22px;text-align:center;cursor:pointer;color:var(--el-text-color-regular)}.el-date-picker__header-label:hover{color:var(--el-datepicker-hover-text-color)}.el-date-picker__header-label:focus-visible{outline:0;color:var(--el-datepicker-hover-text-color)}.el-date-picker__header-label.active{color:var(--el-datepicker-active-color)}.el-date-picker__prev-btn{float:left}.el-date-picker__next-btn{float:right}.el-date-picker__time-wrap{padding:10px;text-align:center}.el-date-picker__time-label{float:left;cursor:pointer;line-height:30px;margin-left:10px}.el-date-picker .el-time-panel{position:absolute}.el-date-range-picker{--el-datepicker-text-color:var(--el-text-color-regular);--el-datepicker-off-text-color:var(--el-text-color-placeholder);--el-datepicker-header-text-color:var(--el-text-color-regular);--el-datepicker-icon-color:var(--el-text-color-primary);--el-datepicker-border-color:var(--el-disabled-border-color);--el-datepicker-inner-border-color:var(--el-border-color-light);--el-datepicker-inrange-bg-color:var(--el-border-color-extra-light);--el-datepicker-inrange-hover-bg-color:var(--el-border-color-extra-light);--el-datepicker-active-color:var(--el-color-primary);--el-datepicker-hover-text-color:var(--el-color-primary)}.el-date-range-picker{width:646px}.el-date-range-picker.has-sidebar{width:756px}.el-date-range-picker.has-time .el-picker-panel__body-wrapper{position:relative}.el-date-range-picker table{table-layout:fixed;width:100%}.el-date-range-picker .el-picker-panel__body{min-width:513px}.el-date-range-picker .el-picker-panel__content{margin:0}.el-date-range-picker__header{position:relative;text-align:center;height:28px}.el-date-range-picker__header [class*=arrow-left]{float:left}.el-date-range-picker__header [class*=arrow-right]{float:right}.el-date-range-picker__header div{font-size:16px;font-weight:500;margin-right:50px}.el-date-range-picker__content{float:left;width:50%;box-sizing:border-box;margin:0;padding:16px}.el-date-range-picker__content.is-left{border-right:1px solid var(--el-datepicker-inner-border-color)}.el-date-range-picker__content .el-date-range-picker__header div{margin-left:50px;margin-right:50px}.el-date-range-picker__editors-wrap{box-sizing:border-box;display:table-cell}.el-date-range-picker__editors-wrap.is-right{text-align:right}.el-date-range-picker__time-header{position:relative;border-bottom:1px solid var(--el-datepicker-inner-border-color);font-size:12px;padding:8px 5px 5px;display:table;width:100%;box-sizing:border-box}.el-date-range-picker__time-header>.el-icon-arrow-right{font-size:20px;vertical-align:middle;display:table-cell;color:var(--el-datepicker-icon-color)}.el-date-range-picker__time-picker-wrap{position:relative;display:table-cell;padding:0 5px}.el-date-range-picker__time-picker-wrap .el-picker-panel{position:absolute;top:13px;right:0;z-index:1;background:#fff}.el-date-range-picker__time-picker-wrap .el-time-panel{position:absolute}.el-time-range-picker{width:354px;overflow:visible}.el-time-range-picker__content{position:relative;text-align:center;padding:10px;z-index:1}.el-time-range-picker__cell{box-sizing:border-box;margin:0;padding:4px 7px 7px;width:50%;display:inline-block}.el-time-range-picker__header{margin-bottom:5px;text-align:center;font-size:14px}.el-time-range-picker__body{border-radius:2px;border:1px solid var(--el-datepicker-border-color)}.el-time-panel{border-radius:2px;position:relative;width:180px;left:0;z-index:var(--el-index-top);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:content-box}.el-time-panel__content{font-size:0;position:relative;overflow:hidden}.el-time-panel__content:after,.el-time-panel__content:before{content:"";top:50%;position:absolute;margin-top:-16px;height:32px;z-index:-1;left:0;right:0;box-sizing:border-box;padding-top:6px;text-align:left}.el-time-panel__content:after{left:50%;margin-left:12%;margin-right:12%}.el-time-panel__content:before{padding-left:50%;margin-right:12%;margin-left:12%;border-top:1px solid var(--el-border-color-light);border-bottom:1px solid var(--el-border-color-light)}.el-time-panel__content.has-seconds:after{left:66.6666666667%}.el-time-panel__content.has-seconds:before{padding-left:33.3333333333%}.el-time-panel__footer{border-top:1px solid var(--el-timepicker-inner-border-color,var(--el-border-color-light));padding:4px;height:36px;line-height:25px;text-align:right;box-sizing:border-box}.el-time-panel__btn{border:none;line-height:28px;padding:0 5px;margin:0 5px;cursor:pointer;background-color:transparent;outline:0;font-size:12px;color:var(--el-text-color-primary)}.el-time-panel__btn.confirm{font-weight:800;color:var(--el-timepicker-active-color,var(--el-color-primary))}.el-descriptions{--el-descriptions-table-border:1px solid var(--el-border-color-lighter);--el-descriptions-item-bordered-label-background:var(--el-fill-color-light);box-sizing:border-box;font-size:var(--el-font-size-base);color:var(--el-text-color-primary)}.el-descriptions__header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.el-descriptions__title{color:var(--el-text-color-primary);font-size:16px;font-weight:700}.el-descriptions__body{background-color:var(--el-fill-color-blank)}.el-descriptions__body .el-descriptions__table{border-collapse:collapse;width:100%}.el-descriptions__body .el-descriptions__table .el-descriptions__cell{box-sizing:border-box;text-align:left;font-weight:400;line-height:23px;font-size:14px}.el-descriptions__body .el-descriptions__table .el-descriptions__cell.is-left{text-align:left}.el-descriptions__body .el-descriptions__table .el-descriptions__cell.is-center{text-align:center}.el-descriptions__body .el-descriptions__table .el-descriptions__cell.is-right{text-align:right}.el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell{border:var(--el-descriptions-table-border);padding:8px 11px}.el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell{padding-bottom:12px}.el-descriptions--large{font-size:14px}.el-descriptions--large .el-descriptions__header{margin-bottom:20px}.el-descriptions--large .el-descriptions__header .el-descriptions__title{font-size:16px}.el-descriptions--large .el-descriptions__body .el-descriptions__table .el-descriptions__cell{font-size:14px}.el-descriptions--large .el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell{padding:12px 15px}.el-descriptions--large .el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell{padding-bottom:16px}.el-descriptions--small{font-size:12px}.el-descriptions--small .el-descriptions__header{margin-bottom:12px}.el-descriptions--small .el-descriptions__header .el-descriptions__title{font-size:14px}.el-descriptions--small .el-descriptions__body .el-descriptions__table .el-descriptions__cell{font-size:12px}.el-descriptions--small .el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell{padding:4px 7px}.el-descriptions--small .el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell{padding-bottom:8px}.el-descriptions__label.el-descriptions__cell.is-bordered-label{font-weight:700;color:var(--el-text-color-regular);background:var(--el-descriptions-item-bordered-label-background)}.el-descriptions__label:not(.is-bordered-label){color:var(--el-text-color-primary);margin-right:16px}.el-descriptions__label.el-descriptions__cell:not(.is-bordered-label).is-vertical-label{padding-bottom:6px}.el-descriptions__content.el-descriptions__cell.is-bordered-content{color:var(--el-text-color-primary)}.el-descriptions__content:not(.is-bordered-label){color:var(--el-text-color-regular)}.el-descriptions--large .el-descriptions__label:not(.is-bordered-label){margin-right:16px}.el-descriptions--large .el-descriptions__label.el-descriptions__cell:not(.is-bordered-label).is-vertical-label{padding-bottom:8px}.el-descriptions--small .el-descriptions__label:not(.is-bordered-label){margin-right:12px}.el-descriptions--small .el-descriptions__label.el-descriptions__cell:not(.is-bordered-label).is-vertical-label{padding-bottom:4px}:root{--el-popup-modal-bg-color:var(--el-color-black);--el-popup-modal-opacity:.5}.v-modal-enter{-webkit-animation:v-modal-in var(--el-transition-duration-fast) ease;animation:v-modal-in var(--el-transition-duration-fast) ease}.v-modal-leave{-webkit-animation:v-modal-out var(--el-transition-duration-fast) ease forwards;animation:v-modal-out var(--el-transition-duration-fast) ease forwards}@-webkit-keyframes v-modal-in{0%{opacity:0}}@keyframes v-modal-in{0%{opacity:0}}@-webkit-keyframes v-modal-out{to{opacity:0}}@keyframes v-modal-out{to{opacity:0}}.v-modal{position:fixed;left:0;top:0;width:100%;height:100%;opacity:var(--el-popup-modal-opacity);background:var(--el-popup-modal-bg-color)}.el-popup-parent--hidden{overflow:hidden}.el-dialog{--el-dialog-width:50%;--el-dialog-margin-top:15vh;--el-dialog-bg-color:var(--el-bg-color);--el-dialog-box-shadow:var(--el-box-shadow);--el-dialog-title-font-size:var(--el-font-size-large);--el-dialog-content-font-size:14px;--el-dialog-font-line-height:var(--el-font-line-height-primary);--el-dialog-padding-primary:20px;--el-dialog-border-radius:var(--el-border-radius-small);position:relative;margin:var(--el-dialog-margin-top,15vh) auto 50px;background:var(--el-dialog-bg-color);border-radius:var(--el-dialog-border-radius);box-shadow:var(--el-dialog-box-shadow);box-sizing:border-box;width:var(--el-dialog-width,50%)}.el-dialog:focus{outline:0!important}.el-dialog.is-align-center{margin:auto}.el-dialog.is-fullscreen{--el-dialog-width:100%;--el-dialog-margin-top:0;margin-bottom:0;height:100%;overflow:auto}.el-dialog__wrapper{position:fixed;top:0;right:0;bottom:0;left:0;overflow:auto;margin:0}.el-dialog.is-draggable .el-dialog__header{cursor:move;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-dialog__header{padding:var(--el-dialog-padding-primary);padding-bottom:10px;margin-right:16px}.el-dialog__headerbtn{position:absolute;top:6px;right:0;padding:0;width:54px;height:54px;background:0 0;border:none;outline:0;cursor:pointer;font-size:var(--el-message-close-size,16px)}.el-dialog__headerbtn .el-dialog__close{color:var(--el-color-info);font-size:inherit}.el-dialog__headerbtn:focus .el-dialog__close,.el-dialog__headerbtn:hover .el-dialog__close{color:var(--el-color-primary)}.el-dialog__title{line-height:var(--el-dialog-font-line-height);font-size:var(--el-dialog-title-font-size);color:var(--el-text-color-primary)}.el-dialog__body{padding:calc(var(--el-dialog-padding-primary) + 10px) var(--el-dialog-padding-primary);color:var(--el-text-color-regular);font-size:var(--el-dialog-content-font-size)}.el-dialog__footer{padding:var(--el-dialog-padding-primary);padding-top:10px;text-align:right;box-sizing:border-box}.el-dialog--center{text-align:center}.el-dialog--center .el-dialog__body{text-align:initial;padding:25px calc(var(--el-dialog-padding-primary) + 5px) 30px}.el-dialog--center .el-dialog__footer{text-align:inherit}.el-overlay-dialog{position:fixed;top:0;right:0;bottom:0;left:0;overflow:auto}.dialog-fade-enter-active{-webkit-animation:modal-fade-in var(--el-transition-duration);animation:modal-fade-in var(--el-transition-duration)}.dialog-fade-enter-active .el-overlay-dialog{-webkit-animation:dialog-fade-in var(--el-transition-duration);animation:dialog-fade-in var(--el-transition-duration)}.dialog-fade-leave-active{-webkit-animation:modal-fade-out var(--el-transition-duration);animation:modal-fade-out var(--el-transition-duration)}.dialog-fade-leave-active .el-overlay-dialog{-webkit-animation:dialog-fade-out var(--el-transition-duration);animation:dialog-fade-out var(--el-transition-duration)}@-webkit-keyframes dialog-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@keyframes dialog-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@-webkit-keyframes dialog-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@keyframes dialog-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@-webkit-keyframes modal-fade-in{0%{opacity:0}to{opacity:1}}@keyframes modal-fade-in{0%{opacity:0}to{opacity:1}}@-webkit-keyframes modal-fade-out{0%{opacity:1}to{opacity:0}}@keyframes modal-fade-out{0%{opacity:1}to{opacity:0}}.el-divider{position:relative}.el-divider--horizontal{display:block;height:1px;width:100%;margin:24px 0;border-top:1px var(--el-border-color) var(--el-border-style)}.el-divider--vertical{display:inline-block;width:1px;height:1em;margin:0 8px;vertical-align:middle;position:relative;border-left:1px var(--el-border-color) var(--el-border-style)}.el-divider__text{position:absolute;background-color:var(--el-bg-color);padding:0 20px;font-weight:500;color:var(--el-text-color-primary);font-size:14px}.el-divider__text.is-left{left:20px;transform:translateY(-50%)}.el-divider__text.is-center{left:50%;transform:translate(-50%) translateY(-50%)}.el-divider__text.is-right{right:20px;transform:translateY(-50%)}.el-drawer{--el-drawer-bg-color:var(--el-dialog-bg-color, var(--el-bg-color));--el-drawer-padding-primary:var(--el-dialog-padding-primary, 20px)}.el-drawer{position:absolute;box-sizing:border-box;background-color:var(--el-drawer-bg-color);display:flex;flex-direction:column;box-shadow:var(--el-box-shadow-dark);overflow:hidden;transition:all var(--el-transition-duration)}.el-drawer .rtl,.el-drawer .ltr,.el-drawer .ttb,.el-drawer .btt{transform:translate(0)}.el-drawer__sr-focus:focus{outline:0!important}.el-drawer__header{align-items:center;color:#72767b;display:flex;margin-bottom:32px;padding:var(--el-drawer-padding-primary);padding-bottom:0}.el-drawer__header>:first-child{flex:1}.el-drawer__title{margin:0;flex:1;line-height:inherit;font-size:1rem}.el-drawer__footer{padding:var(--el-drawer-padding-primary);padding-top:10px;text-align:right}.el-drawer__close-btn{display:inline-flex;border:none;cursor:pointer;font-size:var(--el-font-size-extra-large);color:inherit;background-color:transparent;outline:0}.el-drawer__close-btn:focus i,.el-drawer__close-btn:hover i{color:var(--el-color-primary)}.el-drawer__body{flex:1;padding:var(--el-drawer-padding-primary);overflow:auto}.el-drawer__body>*{box-sizing:border-box}.el-drawer.ltr,.el-drawer.rtl{height:100%;top:0;bottom:0}.el-drawer.btt,.el-drawer.ttb{width:100%;left:0;right:0}.el-drawer.ltr{left:0}.el-drawer.rtl{right:0}.el-drawer.ttb{top:0}.el-drawer.btt{bottom:0}.el-drawer-fade-enter-active,.el-drawer-fade-leave-active{transition:all var(--el-transition-duration)}.el-drawer-fade-enter-active,.el-drawer-fade-enter-from,.el-drawer-fade-enter-to,.el-drawer-fade-leave-active,.el-drawer-fade-leave-from,.el-drawer-fade-leave-to{overflow:hidden!important}.el-drawer-fade-enter-from,.el-drawer-fade-leave-to{opacity:0}.el-drawer-fade-enter-to,.el-drawer-fade-leave-from{opacity:1}.el-drawer-fade-enter-from .rtl,.el-drawer-fade-leave-to .rtl{transform:translate(100%)}.el-drawer-fade-enter-from .ltr,.el-drawer-fade-leave-to .ltr{transform:translate(-100%)}.el-drawer-fade-enter-from .ttb,.el-drawer-fade-leave-to .ttb{transform:translateY(-100%)}.el-drawer-fade-enter-from .btt,.el-drawer-fade-leave-to .btt{transform:translateY(100%)}.el-dropdown{--el-dropdown-menu-box-shadow:var(--el-box-shadow-light);--el-dropdown-menuItem-hover-fill:var(--el-color-primary-light-9);--el-dropdown-menuItem-hover-color:var(--el-color-primary);--el-dropdown-menu-index:10;display:inline-flex;position:relative;color:var(--el-text-color-regular);font-size:var(--el-font-size-base);line-height:1;vertical-align:top}.el-dropdown.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-dropdown__popper{--el-dropdown-menu-box-shadow:var(--el-box-shadow-light);--el-dropdown-menuItem-hover-fill:var(--el-color-primary-light-9);--el-dropdown-menuItem-hover-color:var(--el-color-primary);--el-dropdown-menu-index:10}.el-dropdown__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-dropdown-menu-box-shadow)}.el-dropdown__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-dropdown__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-dropdown__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-dropdown__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-dropdown__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-dropdown__popper .el-dropdown-menu{border:none}.el-dropdown__popper .el-dropdown__popper-selfdefine{outline:0}.el-dropdown__popper .el-scrollbar__bar{z-index:calc(var(--el-dropdown-menu-index) + 1)}.el-dropdown__popper .el-dropdown__list{list-style:none;padding:0;margin:0;box-sizing:border-box}.el-dropdown .el-dropdown__caret-button{padding-left:0;padding-right:0;display:inline-flex;justify-content:center;align-items:center;width:32px;border-left:none}.el-dropdown .el-dropdown__caret-button>span{display:inline-flex}.el-dropdown .el-dropdown__caret-button:before{content:"";position:absolute;display:block;width:1px;top:-1px;bottom:-1px;left:0;background:var(--el-overlay-color-lighter)}.el-dropdown .el-dropdown__caret-button.el-button:before{background:var(--el-border-color);opacity:.5}.el-dropdown .el-dropdown__caret-button .el-dropdown__icon{font-size:inherit;padding-left:0}.el-dropdown .el-dropdown-selfdefine{outline:0}.el-dropdown--large .el-dropdown__caret-button{width:40px}.el-dropdown--small .el-dropdown__caret-button{width:24px}.el-dropdown-menu{position:relative;top:0;left:0;z-index:var(--el-dropdown-menu-index);padding:5px 0;margin:0;background-color:var(--el-bg-color-overlay);border:none;border-radius:var(--el-border-radius-base);box-shadow:none;list-style:none}.el-dropdown-menu__item{display:flex;align-items:center;white-space:nowrap;list-style:none;line-height:22px;padding:5px 16px;margin:0;font-size:var(--el-font-size-base);color:var(--el-text-color-regular);cursor:pointer;outline:0}.el-dropdown-menu__item:not(.is-disabled):focus{background-color:var(--el-dropdown-menuItem-hover-fill);color:var(--el-dropdown-menuItem-hover-color)}.el-dropdown-menu__item i{margin-right:5px}.el-dropdown-menu__item--divided{margin:6px 0;border-top:1px solid var(--el-border-color-lighter)}.el-dropdown-menu__item.is-disabled{cursor:not-allowed;color:var(--el-text-color-disabled)}.el-dropdown-menu--large{padding:7px 0}.el-dropdown-menu--large .el-dropdown-menu__item{padding:7px 20px;line-height:22px;font-size:14px}.el-dropdown-menu--large .el-dropdown-menu__item--divided{margin:8px 0}.el-dropdown-menu--small{padding:3px 0}.el-dropdown-menu--small .el-dropdown-menu__item{padding:2px 12px;line-height:20px;font-size:12px}.el-dropdown-menu--small .el-dropdown-menu__item--divided{margin:4px 0}.el-empty{--el-empty-padding:40px 0;--el-empty-image-width:160px;--el-empty-description-margin-top:20px;--el-empty-bottom-margin-top:20px;--el-empty-fill-color-0:var(--el-color-white);--el-empty-fill-color-1:#fcfcfd;--el-empty-fill-color-2:#f8f9fb;--el-empty-fill-color-3:#f7f8fc;--el-empty-fill-color-4:#eeeff3;--el-empty-fill-color-5:#edeef2;--el-empty-fill-color-6:#e9ebef;--el-empty-fill-color-7:#e5e7e9;--el-empty-fill-color-8:#e0e3e9;--el-empty-fill-color-9:#d5d7de;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;box-sizing:border-box;padding:var(--el-empty-padding)}.el-empty__image{width:var(--el-empty-image-width)}.el-empty__image img{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%;height:100%;vertical-align:top;-o-object-fit:contain;object-fit:contain}.el-empty__image svg{color:var(--el-svg-monochrome-grey);fill:currentColor;width:100%;height:100%;vertical-align:top}.el-empty__description{margin-top:var(--el-empty-description-margin-top)}.el-empty__description p{margin:0;font-size:var(--el-font-size-base);color:var(--el-text-color-secondary)}.el-empty__bottom{margin-top:var(--el-empty-bottom-margin-top)}.el-footer{--el-footer-padding:0 20px;--el-footer-height:60px;padding:var(--el-footer-padding);box-sizing:border-box;flex-shrink:0;height:var(--el-footer-height)}.el-form{--el-form-label-font-size:var(--el-font-size-base)}.el-form--label-left .el-form-item__label{justify-content:flex-start}.el-form--label-top .el-form-item{display:block}.el-form--label-top .el-form-item .el-form-item__label{display:block;height:auto;text-align:left;margin-bottom:8px;line-height:22px}.el-form--inline .el-form-item{display:inline-flex;vertical-align:middle;margin-right:32px}.el-form--inline.el-form--label-top{display:flex;flex-wrap:wrap}.el-form--inline.el-form--label-top .el-form-item{display:block}.el-form--large.el-form--label-top .el-form-item .el-form-item__label{margin-bottom:12px;line-height:22px}.el-form--default.el-form--label-top .el-form-item .el-form-item__label{margin-bottom:8px;line-height:22px}.el-form--small.el-form--label-top .el-form-item .el-form-item__label{margin-bottom:4px;line-height:20px}.el-form-item{display:flex;--font-size:14px;margin-bottom:18px}.el-form-item .el-form-item{margin-bottom:0}.el-form-item .el-input__validateIcon{display:none}.el-form-item--large{--font-size:14px;--el-form-label-font-size:var(--font-size);margin-bottom:22px}.el-form-item--large .el-form-item__label{height:40px;line-height:40px}.el-form-item--large .el-form-item__content{line-height:40px}.el-form-item--large .el-form-item__error{padding-top:4px}.el-form-item--default{--font-size:14px;--el-form-label-font-size:var(--font-size);margin-bottom:18px}.el-form-item--default .el-form-item__label{height:32px;line-height:32px}.el-form-item--default .el-form-item__content{line-height:32px}.el-form-item--default .el-form-item__error{padding-top:2px}.el-form-item--small{--font-size:12px;--el-form-label-font-size:var(--font-size);margin-bottom:18px}.el-form-item--small .el-form-item__label{height:24px;line-height:24px}.el-form-item--small .el-form-item__content{line-height:24px}.el-form-item--small .el-form-item__error{padding-top:2px}.el-form-item__label-wrap{display:flex}.el-form-item__label{display:inline-flex;justify-content:flex-end;align-items:flex-start;flex:0 0 auto;font-size:var(--el-form-label-font-size);color:var(--el-text-color-regular);height:32px;line-height:32px;padding:0 12px 0 0;box-sizing:border-box}.el-form-item__content{display:flex;flex-wrap:wrap;align-items:center;flex:1;line-height:32px;position:relative;font-size:var(--font-size);min-width:0}.el-form-item__content .el-input-group{vertical-align:top}.el-form-item__error{color:var(--el-color-danger);font-size:12px;line-height:1;padding-top:2px;position:absolute;top:100%;left:0}.el-form-item__error--inline{position:relative;top:auto;left:auto;display:inline-block;margin-left:10px}.el-form-item.is-required:not(.is-no-asterisk).asterisk-left>.el-form-item__label-wrap>.el-form-item__label:before,.el-form-item.is-required:not(.is-no-asterisk).asterisk-left>.el-form-item__label:before{content:"*";color:var(--el-color-danger);margin-right:4px}.el-form-item.is-required:not(.is-no-asterisk).asterisk-right>.el-form-item__label-wrap>.el-form-item__label:after,.el-form-item.is-required:not(.is-no-asterisk).asterisk-right>.el-form-item__label:after{content:"*";color:var(--el-color-danger);margin-left:4px}.el-form-item.is-error .el-select-v2__wrapper,.el-form-item.is-error .el-select-v2__wrapper:focus,.el-form-item.is-error .el-textarea__inner,.el-form-item.is-error .el-textarea__inner:focus{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-form-item.is-error .el-input__wrapper{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-form-item.is-error .el-input-group__append .el-input__wrapper,.el-form-item.is-error .el-input-group__prepend .el-input__wrapper{box-shadow:0 0 0 1px transparent inset}.el-form-item.is-error .el-input__validateIcon{color:var(--el-color-danger)}.el-form-item--feedback .el-input__validateIcon{display:inline-flex}.el-header{--el-header-padding:0 20px;--el-header-height:60px;padding:var(--el-header-padding);box-sizing:border-box;flex-shrink:0;height:var(--el-header-height)}.el-image-viewer__wrapper{position:fixed;top:0;right:0;bottom:0;left:0}.el-image-viewer__btn{position:absolute;z-index:1;display:flex;align-items:center;justify-content:center;border-radius:50%;opacity:.8;cursor:pointer;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-image-viewer__btn .el-icon{font-size:inherit;cursor:pointer}.el-image-viewer__close{top:40px;right:40px;width:40px;height:40px;font-size:40px}.el-image-viewer__canvas{position:static;width:100%;height:100%;display:flex;justify-content:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-image-viewer__actions{left:50%;bottom:30px;transform:translate(-50%);width:282px;height:44px;padding:0 23px;background-color:var(--el-text-color-regular);border-color:#fff;border-radius:22px}.el-image-viewer__actions__inner{width:100%;height:100%;text-align:justify;cursor:default;font-size:23px;color:#fff;display:flex;align-items:center;justify-content:space-around}.el-image-viewer__prev{top:50%;transform:translateY(-50%);left:40px;width:44px;height:44px;font-size:24px;color:#fff;background-color:var(--el-text-color-regular);border-color:#fff}.el-image-viewer__next{top:50%;transform:translateY(-50%);right:40px;text-indent:2px;width:44px;height:44px;font-size:24px;color:#fff;background-color:var(--el-text-color-regular);border-color:#fff}.el-image-viewer__close{width:44px;height:44px;font-size:24px;color:#fff;background-color:var(--el-text-color-regular);border-color:#fff}.el-image-viewer__mask{position:absolute;width:100%;height:100%;top:0;left:0;opacity:.5;background:#000}.viewer-fade-enter-active{-webkit-animation:viewer-fade-in var(--el-transition-duration);animation:viewer-fade-in var(--el-transition-duration)}.viewer-fade-leave-active{-webkit-animation:viewer-fade-out var(--el-transition-duration);animation:viewer-fade-out var(--el-transition-duration)}@-webkit-keyframes viewer-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@keyframes viewer-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@-webkit-keyframes viewer-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@keyframes viewer-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}.el-image__error,.el-image__inner,.el-image__placeholder,.el-image__wrapper{width:100%;height:100%}.el-image{position:relative;display:inline-block;overflow:hidden}.el-image__inner{vertical-align:top;opacity:1}.el-image__inner.is-loading{opacity:0}.el-image__wrapper{position:absolute;top:0;left:0}.el-image__placeholder{background:var(--el-fill-color-light)}.el-image__error{display:flex;justify-content:center;align-items:center;font-size:14px;background:var(--el-fill-color-light);color:var(--el-text-color-placeholder);vertical-align:middle}.el-image__preview{cursor:pointer}.el-input-number{position:relative;display:inline-flex;width:150px;line-height:30px}.el-input-number .el-input__wrapper{padding-left:42px;padding-right:42px}.el-input-number .el-input__inner{-webkit-appearance:none;-moz-appearance:textfield;text-align:center;line-height:1}.el-input-number .el-input__inner::-webkit-inner-spin-button,.el-input-number .el-input__inner::-webkit-outer-spin-button{margin:0;-webkit-appearance:none}.el-input-number__decrease,.el-input-number__increase{display:flex;justify-content:center;align-items:center;height:auto;position:absolute;z-index:1;top:1px;bottom:1px;width:32px;background:var(--el-fill-color-light);color:var(--el-text-color-regular);cursor:pointer;font-size:13px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-input-number__decrease:hover,.el-input-number__increase:hover{color:var(--el-color-primary)}.el-input-number__decrease:hover~.el-input:not(.is-disabled) .el-input_wrapper,.el-input-number__increase:hover~.el-input:not(.is-disabled) .el-input_wrapper{box-shadow:0 0 0 1px var(--el-input-focus-border-color,var(--el-color-primary)) inset}.el-input-number__decrease.is-disabled,.el-input-number__increase.is-disabled{color:var(--el-disabled-text-color);cursor:not-allowed}.el-input-number__increase{right:1px;border-radius:0 var(--el-border-radius-base) var(--el-border-radius-base) 0;border-left:var(--el-border)}.el-input-number__decrease{left:1px;border-radius:var(--el-border-radius-base) 0 0 var(--el-border-radius-base);border-right:var(--el-border)}.el-input-number.is-disabled .el-input-number__decrease,.el-input-number.is-disabled .el-input-number__increase{border-color:var(--el-disabled-border-color);color:var(--el-disabled-border-color)}.el-input-number.is-disabled .el-input-number__decrease:hover,.el-input-number.is-disabled .el-input-number__increase:hover{color:var(--el-disabled-border-color);cursor:not-allowed}.el-input-number--large{width:180px;line-height:38px}.el-input-number--large .el-input-number__decrease,.el-input-number--large .el-input-number__increase{width:40px;font-size:14px}.el-input-number--large .el-input__wrapper{padding-left:47px;padding-right:47px}.el-input-number--small{width:120px;line-height:22px}.el-input-number--small .el-input-number__decrease,.el-input-number--small .el-input-number__increase{width:24px;font-size:12px}.el-input-number--small .el-input__wrapper{padding-left:31px;padding-right:31px}.el-input-number--small .el-input-number__decrease [class*=el-icon],.el-input-number--small .el-input-number__increase [class*=el-icon]{transform:scale(.9)}.el-input-number.is-without-controls .el-input__wrapper{padding-left:15px;padding-right:15px}.el-input-number.is-controls-right .el-input__wrapper{padding-left:15px;padding-right:42px}.el-input-number.is-controls-right .el-input-number__decrease,.el-input-number.is-controls-right .el-input-number__increase{--el-input-number-controls-height:15px;height:var(--el-input-number-controls-height);line-height:var(--el-input-number-controls-height)}.el-input-number.is-controls-right .el-input-number__decrease [class*=el-icon],.el-input-number.is-controls-right .el-input-number__increase [class*=el-icon]{transform:scale(.8)}.el-input-number.is-controls-right .el-input-number__increase{bottom:auto;left:auto;border-radius:0 var(--el-border-radius-base) 0 0;border-bottom:var(--el-border)}.el-input-number.is-controls-right .el-input-number__decrease{right:1px;top:auto;left:auto;border-right:none;border-left:var(--el-border);border-radius:0 0 var(--el-border-radius-base) 0}.el-input-number.is-controls-right[class*=large] [class*=decrease],.el-input-number.is-controls-right[class*=large] [class*=increase]{--el-input-number-controls-height:19px}.el-input-number.is-controls-right[class*=small] [class*=decrease],.el-input-number.is-controls-right[class*=small] [class*=increase]{--el-input-number-controls-height:11px}.el-textarea{--el-input-text-color:var(--el-text-color-regular);--el-input-border:var(--el-border);--el-input-hover-border:var(--el-border-color-hover);--el-input-focus-border:var(--el-color-primary);--el-input-transparent-border:0 0 0 1px transparent inset;--el-input-border-color:var(--el-border-color);--el-input-border-radius:var(--el-border-radius-base);--el-input-bg-color:var(--el-fill-color-blank);--el-input-icon-color:var(--el-text-color-placeholder);--el-input-placeholder-color:var(--el-text-color-placeholder);--el-input-hover-border-color:var(--el-border-color-hover);--el-input-clear-hover-color:var(--el-text-color-secondary);--el-input-focus-border-color:var(--el-color-primary)}.el-textarea{position:relative;display:inline-block;width:100%;vertical-align:bottom;font-size:var(--el-font-size-base)}.el-textarea__inner{position:relative;display:block;resize:vertical;padding:5px 11px;line-height:1.5;box-sizing:border-box;width:100%;font-size:inherit;font-family:inherit;color:var(--el-input-text-color,var(--el-text-color-regular));background-color:var(--el-input-bg-color,var(--el-fill-color-blank));background-image:none;-webkit-appearance:none;box-shadow:0 0 0 1px var(--el-input-border-color,var(--el-border-color)) inset;border-radius:var(--el-input-border-radius,var(--el-border-radius-base));transition:var(--el-transition-box-shadow);border:none}.el-textarea__inner::-moz-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-textarea__inner:-ms-input-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-textarea__inner::placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-textarea__inner:hover{box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-textarea__inner:focus{outline:0;box-shadow:0 0 0 1px var(--el-input-focus-border-color) inset}.el-textarea .el-input__count{color:var(--el-color-info);background:var(--el-fill-color-blank);position:absolute;font-size:12px;line-height:14px;bottom:5px;right:10px}.el-textarea.is-disabled .el-textarea__inner{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color);color:var(--el-disabled-text-color);cursor:not-allowed}.el-textarea.is-disabled .el-textarea__inner::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-textarea.is-disabled .el-textarea__inner:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-textarea.is-disabled .el-textarea__inner::placeholder{color:var(--el-text-color-placeholder)}.el-textarea.is-exceed .el-textarea__inner{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-textarea.is-exceed .el-input__count{color:var(--el-color-danger)}.el-input{--el-input-text-color:var(--el-text-color-regular);--el-input-border:var(--el-border);--el-input-hover-border:var(--el-border-color-hover);--el-input-focus-border:var(--el-color-primary);--el-input-transparent-border:0 0 0 1px transparent inset;--el-input-border-color:var(--el-border-color);--el-input-border-radius:var(--el-border-radius-base);--el-input-bg-color:var(--el-fill-color-blank);--el-input-icon-color:var(--el-text-color-placeholder);--el-input-placeholder-color:var(--el-text-color-placeholder);--el-input-hover-border-color:var(--el-border-color-hover);--el-input-clear-hover-color:var(--el-text-color-secondary);--el-input-focus-border-color:var(--el-color-primary)}.el-input{--el-input-height:var(--el-component-size);position:relative;font-size:var(--el-font-size-base);display:inline-flex;width:100%;line-height:var(--el-input-height);box-sizing:border-box;vertical-align:middle}.el-input::-webkit-scrollbar{z-index:11;width:6px}.el-input::-webkit-scrollbar:horizontal{height:6px}.el-input::-webkit-scrollbar-thumb{border-radius:5px;width:6px;background:var(--el-text-color-disabled)}.el-input::-webkit-scrollbar-corner{background:var(--el-fill-color-blank)}.el-input::-webkit-scrollbar-track{background:var(--el-fill-color-blank)}.el-input::-webkit-scrollbar-track-piece{background:var(--el-fill-color-blank);width:6px}.el-input .el-input__clear,.el-input .el-input__password{color:var(--el-input-icon-color);font-size:14px;cursor:pointer}.el-input .el-input__clear:hover,.el-input .el-input__password:hover{color:var(--el-input-clear-hover-color)}.el-input .el-input__count{height:100%;display:inline-flex;align-items:center;color:var(--el-color-info);font-size:12px}.el-input .el-input__count .el-input__count-inner{background:var(--el-fill-color-blank);line-height:initial;display:inline-block;padding-left:8px}.el-input__wrapper{display:inline-flex;flex-grow:1;align-items:center;justify-content:center;padding:1px 11px;background-color:var(--el-input-bg-color,var(--el-fill-color-blank));background-image:none;border-radius:var(--el-input-border-radius,var(--el-border-radius-base));transition:var(--el-transition-box-shadow);transform:translateZ(0);box-shadow:0 0 0 1px var(--el-input-border-color,var(--el-border-color)) inset}.el-input__wrapper:hover{box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-input__wrapper.is-focus{box-shadow:0 0 0 1px var(--el-input-focus-border-color) inset}.el-input__inner{--el-input-inner-height:calc(var(--el-input-height, 32px) - 2px);width:100%;flex-grow:1;-webkit-appearance:none;color:var(--el-input-text-color,var(--el-text-color-regular));font-size:inherit;height:var(--el-input-inner-height);line-height:var(--el-input-inner-height);padding:0;outline:0;border:none;background:0 0;box-sizing:border-box}.el-input__inner:focus{outline:0}.el-input__inner::-moz-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-input__inner:-ms-input-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-input__inner::placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-input__inner[type=password]::-ms-reveal{display:none}.el-input__prefix{display:inline-flex;white-space:nowrap;flex-shrink:0;flex-wrap:nowrap;height:100%;text-align:center;color:var(--el-input-icon-color,var(--el-text-color-placeholder));transition:all var(--el-transition-duration);pointer-events:none}.el-input__prefix-inner{pointer-events:all;display:inline-flex;align-items:center;justify-content:center}.el-input__prefix-inner>:last-child{margin-right:8px}.el-input__prefix-inner>:first-child,.el-input__prefix-inner>:first-child.el-input__icon{margin-left:0}.el-input__suffix{display:inline-flex;white-space:nowrap;flex-shrink:0;flex-wrap:nowrap;height:100%;text-align:center;color:var(--el-input-icon-color,var(--el-text-color-placeholder));transition:all var(--el-transition-duration);pointer-events:none}.el-input__suffix-inner{pointer-events:all;display:inline-flex;align-items:center;justify-content:center}.el-input__suffix-inner>:first-child{margin-left:8px}.el-input .el-input__icon{height:inherit;line-height:inherit;display:flex;justify-content:center;align-items:center;transition:all var(--el-transition-duration);margin-left:8px}.el-input__validateIcon{pointer-events:none}.el-input.is-active .el-input__wrapper{box-shadow:0 0 0 1px var(--el-input-focus-color,) inset}.el-input.is-disabled{cursor:not-allowed}.el-input.is-disabled .el-input__wrapper{background-color:var(--el-disabled-bg-color);box-shadow:0 0 0 1px var(--el-disabled-border-color) inset}.el-input.is-disabled .el-input__inner{color:var(--el-disabled-text-color);-webkit-text-fill-color:var(--el-disabled-text-color);cursor:not-allowed}.el-input.is-disabled .el-input__inner::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-input.is-disabled .el-input__inner:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-input.is-disabled .el-input__inner::placeholder{color:var(--el-text-color-placeholder)}.el-input.is-disabled .el-input__icon{cursor:not-allowed}.el-input.is-exceed .el-input__wrapper{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-input.is-exceed .el-input__suffix .el-input__count{color:var(--el-color-danger)}.el-input--large{--el-input-height:var(--el-component-size-large);font-size:14px}.el-input--large .el-input__wrapper{padding:1px 15px}.el-input--large .el-input__inner{--el-input-inner-height:calc(var(--el-input-height, 40px) - 2px)}.el-input--small{--el-input-height:var(--el-component-size-small);font-size:12px}.el-input--small .el-input__wrapper{padding:1px 7px}.el-input--small .el-input__inner{--el-input-inner-height:calc(var(--el-input-height, 24px) - 2px)}.el-input-group{display:inline-flex;width:100%;align-items:stretch}.el-input-group__append,.el-input-group__prepend{background-color:var(--el-fill-color-light);color:var(--el-color-info);position:relative;display:inline-flex;align-items:center;justify-content:center;min-height:100%;border-radius:var(--el-input-border-radius);padding:0 20px;white-space:nowrap}.el-input-group__append:focus,.el-input-group__prepend:focus{outline:0}.el-input-group__append .el-button,.el-input-group__append .el-select,.el-input-group__prepend .el-button,.el-input-group__prepend .el-select{display:inline-block;margin:0 -20px}.el-input-group__append button.el-button,.el-input-group__append button.el-button:hover,.el-input-group__append div.el-select .el-input__wrapper,.el-input-group__append div.el-select:hover .el-input__wrapper,.el-input-group__prepend button.el-button,.el-input-group__prepend button.el-button:hover,.el-input-group__prepend div.el-select .el-input__wrapper,.el-input-group__prepend div.el-select:hover .el-input__wrapper{border-color:transparent;background-color:transparent;color:inherit}.el-input-group__append .el-button,.el-input-group__append .el-input,.el-input-group__prepend .el-button,.el-input-group__prepend .el-input{font-size:inherit}.el-input-group__prepend{border-right:0;border-top-right-radius:0;border-bottom-right-radius:0;box-shadow:1px 0 0 0 var(--el-input-border-color) inset,0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset}.el-input-group__append{border-left:0;border-top-left-radius:0;border-bottom-left-radius:0;box-shadow:0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset,-1px 0 0 0 var(--el-input-border-color) inset}.el-input-group--prepend>.el-input__wrapper{border-top-left-radius:0;border-bottom-left-radius:0}.el-input-group--prepend .el-input-group__prepend .el-select .el-input .el-input__inner{box-shadow:none!important}.el-input-group--prepend .el-input-group__prepend .el-select .el-input .el-input__wrapper{border-top-right-radius:0;border-bottom-right-radius:0;box-shadow:1px 0 0 0 var(--el-input-border-color) inset,0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset}.el-input-group--prepend .el-input-group__prepend .el-select .el-input.is-focus .el-input__inner{box-shadow:none!important}.el-input-group--prepend .el-input-group__prepend .el-select .el-input.is-focus .el-input__wrapper{box-shadow:1px 0 0 0 var(--el-input-focus-border-color) inset,1px 0 0 0 var(--el-input-focus-border-color),0 1px 0 0 var(--el-input-focus-border-color) inset,0 -1px 0 0 var(--el-input-focus-border-color) inset!important;z-index:2}.el-input-group--prepend .el-input-group__prepend .el-select .el-input.is-focus .el-input__wrapper:focus{outline:0;z-index:2;box-shadow:1px 0 0 0 var(--el-input-focus-border-color) inset,1px 0 0 0 var(--el-input-focus-border-color),0 1px 0 0 var(--el-input-focus-border-color) inset,0 -1px 0 0 var(--el-input-focus-border-color) inset!important}.el-input-group--prepend .el-input-group__prepend .el-select:hover .el-input__inner{box-shadow:none!important}.el-input-group--prepend .el-input-group__prepend .el-select:hover .el-input__wrapper{z-index:1;box-shadow:1px 0 0 0 var(--el-input-hover-border-color) inset,1px 0 0 0 var(--el-input-hover-border-color),0 1px 0 0 var(--el-input-hover-border-color) inset,0 -1px 0 0 var(--el-input-hover-border-color) inset!important}.el-input-group--append>.el-input__wrapper{border-top-right-radius:0;border-bottom-right-radius:0}.el-input-group--append .el-input-group__append .el-select .el-input .el-input__inner{box-shadow:none!important}.el-input-group--append .el-input-group__append .el-select .el-input .el-input__wrapper{border-top-left-radius:0;border-bottom-left-radius:0;box-shadow:0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset,-1px 0 0 0 var(--el-input-border-color) inset}.el-input-group--append .el-input-group__append .el-select .el-input.is-focus .el-input__inner{box-shadow:none!important}.el-input-group--append .el-input-group__append .el-select .el-input.is-focus .el-input__wrapper{z-index:2;box-shadow:-1px 0 0 0 var(--el-input-focus-border-color),-1px 0 0 0 var(--el-input-focus-border-color) inset,0 1px 0 0 var(--el-input-focus-border-color) inset,0 -1px 0 0 var(--el-input-focus-border-color) inset!important}.el-input-group--append .el-input-group__append .el-select:hover .el-input__inner{box-shadow:none!important}.el-input-group--append .el-input-group__append .el-select:hover .el-input__wrapper{z-index:1;box-shadow:-1px 0 0 0 var(--el-input-hover-border-color),-1px 0 0 0 var(--el-input-hover-border-color) inset,0 1px 0 0 var(--el-input-hover-border-color) inset,0 -1px 0 0 var(--el-input-hover-border-color) inset!important}.el-link{--el-link-font-size:var(--el-font-size-base);--el-link-font-weight:var(--el-font-weight-primary);--el-link-text-color:var(--el-text-color-regular);--el-link-hover-text-color:var(--el-color-primary);--el-link-disabled-text-color:var(--el-text-color-placeholder)}.el-link{display:inline-flex;flex-direction:row;align-items:center;justify-content:center;vertical-align:middle;position:relative;text-decoration:none;outline:0;cursor:pointer;padding:0;font-size:var(--el-link-font-size);font-weight:var(--el-link-font-weight);color:var(--el-link-text-color)}.el-link:hover{color:var(--el-link-hover-text-color)}.el-link.is-underline:hover:after{content:"";position:absolute;left:0;right:0;height:0;bottom:0;border-bottom:1px solid var(--el-link-hover-text-color)}.el-link.is-disabled{color:var(--el-link-disabled-text-color);cursor:not-allowed}.el-link [class*=el-icon-]+span{margin-left:5px}.el-link.el-link--default:after{border-color:var(--el-link-hover-text-color)}.el-link__inner{display:inline-flex;justify-content:center;align-items:center}.el-link.el-link--primary{--el-link-text-color:var(--el-color-primary);--el-link-hover-text-color:var(--el-color-primary-light-3);--el-link-disabled-text-color:var(--el-color-primary-light-5)}.el-link.el-link--primary:after{border-color:var(--el-link-text-color)}.el-link.el-link--primary.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--success{--el-link-text-color:var(--el-color-success);--el-link-hover-text-color:var(--el-color-success-light-3);--el-link-disabled-text-color:var(--el-color-success-light-5)}.el-link.el-link--success:after{border-color:var(--el-link-text-color)}.el-link.el-link--success.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--warning{--el-link-text-color:var(--el-color-warning);--el-link-hover-text-color:var(--el-color-warning-light-3);--el-link-disabled-text-color:var(--el-color-warning-light-5)}.el-link.el-link--warning:after{border-color:var(--el-link-text-color)}.el-link.el-link--warning.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--danger{--el-link-text-color:var(--el-color-danger);--el-link-hover-text-color:var(--el-color-danger-light-3);--el-link-disabled-text-color:var(--el-color-danger-light-5)}.el-link.el-link--danger:after{border-color:var(--el-link-text-color)}.el-link.el-link--danger.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--error{--el-link-text-color:var(--el-color-error);--el-link-hover-text-color:var(--el-color-error-light-3);--el-link-disabled-text-color:var(--el-color-error-light-5)}.el-link.el-link--error:after{border-color:var(--el-link-text-color)}.el-link.el-link--error.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--info{--el-link-text-color:var(--el-color-info);--el-link-hover-text-color:var(--el-color-info-light-3);--el-link-disabled-text-color:var(--el-color-info-light-5)}.el-link.el-link--info:after{border-color:var(--el-link-text-color)}.el-link.el-link--info.is-underline:hover:after{border-color:var(--el-link-text-color)}:root{--el-loading-spinner-size:42px;--el-loading-fullscreen-spinner-size:50px}.el-loading-parent--relative{position:relative!important}.el-loading-parent--hidden{overflow:hidden!important}.el-loading-mask{position:absolute;z-index:2000;background-color:var(--el-mask-color);margin:0;top:0;right:0;bottom:0;left:0;transition:opacity var(--el-transition-duration)}.el-loading-mask.is-fullscreen{position:fixed}.el-loading-mask.is-fullscreen .el-loading-spinner{margin-top:calc((0px - var(--el-loading-fullscreen-spinner-size))/ 2)}.el-loading-mask.is-fullscreen .el-loading-spinner .circular{height:var(--el-loading-fullscreen-spinner-size);width:var(--el-loading-fullscreen-spinner-size)}.el-loading-spinner{top:50%;margin-top:calc((0px - var(--el-loading-spinner-size))/ 2);width:100%;text-align:center;position:absolute}.el-loading-spinner .el-loading-text{color:var(--el-color-primary);margin:3px 0;font-size:14px}.el-loading-spinner .circular{display:inline;height:var(--el-loading-spinner-size);width:var(--el-loading-spinner-size);-webkit-animation:loading-rotate 2s linear infinite;animation:loading-rotate 2s linear infinite}.el-loading-spinner .path{-webkit-animation:loading-dash 1.5s ease-in-out infinite;animation:loading-dash 1.5s ease-in-out infinite;stroke-dasharray:90,150;stroke-dashoffset:0;stroke-width:2;stroke:var(--el-color-primary);stroke-linecap:round}.el-loading-spinner i{color:var(--el-color-primary)}.el-loading-fade-enter-from,.el-loading-fade-leave-to{opacity:0}@-webkit-keyframes loading-rotate{to{transform:rotate(360deg)}}@keyframes loading-rotate{to{transform:rotate(360deg)}}@-webkit-keyframes loading-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40px}to{stroke-dasharray:90,150;stroke-dashoffset:-120px}}@keyframes loading-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40px}to{stroke-dasharray:90,150;stroke-dashoffset:-120px}}.el-main{--el-main-padding:20px;display:block;flex:1;flex-basis:auto;overflow:auto;box-sizing:border-box;padding:var(--el-main-padding)}:root{--el-menu-active-color:var(--el-color-primary);--el-menu-text-color:var(--el-text-color-primary);--el-menu-hover-text-color:var(--el-color-primary);--el-menu-bg-color:var(--el-fill-color-blank);--el-menu-hover-bg-color:var(--el-color-primary-light-9);--el-menu-item-height:56px;--el-menu-sub-item-height:calc(var(--el-menu-item-height) - 6px);--el-menu-horizontal-sub-item-height:36px;--el-menu-item-font-size:var(--el-font-size-base);--el-menu-item-hover-fill:var(--el-color-primary-light-9);--el-menu-border-color:var(--el-border-color);--el-menu-base-level-padding:20px;--el-menu-level-padding:20px;--el-menu-icon-width:24px}.el-menu{border-right:solid 1px var(--el-menu-border-color);list-style:none;position:relative;margin:0;padding-left:0;background-color:var(--el-menu-bg-color);box-sizing:border-box}.el-menu--vertical:not(.el-menu--collapse):not(.el-menu--popup-container) .el-menu-item,.el-menu--vertical:not(.el-menu--collapse):not(.el-menu--popup-container) .el-menu-item-group__title,.el-menu--vertical:not(.el-menu--collapse):not(.el-menu--popup-container) .el-sub-menu__title{white-space:nowrap;padding-left:calc(var(--el-menu-base-level-padding) + var(--el-menu-level) * var(--el-menu-level-padding))}.el-menu--horizontal{display:flex;flex-wrap:nowrap;border-bottom:solid 1px var(--el-menu-border-color);border-right:none}.el-menu--horizontal>.el-menu-item{display:inline-flex;justify-content:center;align-items:center;height:100%;margin:0;border-bottom:2px solid transparent;color:var(--el-menu-text-color)}.el-menu--horizontal>.el-menu-item a,.el-menu--horizontal>.el-menu-item a:hover{color:inherit}.el-menu--horizontal>.el-menu-item:not(.is-disabled):focus,.el-menu--horizontal>.el-menu-item:not(.is-disabled):hover{background-color:#fff}.el-menu--horizontal>.el-sub-menu:focus,.el-menu--horizontal>.el-sub-menu:hover{outline:0}.el-menu--horizontal>.el-sub-menu:hover .el-sub-menu__title{color:var(--el-menu-hover-text-color)}.el-menu--horizontal>.el-sub-menu.is-active .el-sub-menu__title{border-bottom:2px solid var(--el-menu-active-color);color:var(--el-menu-active-color)}.el-menu--horizontal>.el-sub-menu .el-sub-menu__title{height:100%;border-bottom:2px solid transparent;color:var(--el-menu-text-color)}.el-menu--horizontal>.el-sub-menu .el-sub-menu__title:hover{background-color:var(--el-bg-color-overlay)}.el-menu--horizontal .el-menu .el-menu-item,.el-menu--horizontal .el-menu .el-sub-menu__title{background-color:var(--el-menu-bg-color);display:flex;align-items:center;height:var(--el-menu-horizontal-sub-item-height);line-height:var(--el-menu-horizontal-sub-item-height);padding:0 10px;color:var(--el-menu-text-color)}.el-menu--horizontal .el-menu .el-sub-menu__title{padding-right:40px}.el-menu--horizontal .el-menu .el-menu-item.is-active,.el-menu--horizontal .el-menu .el-sub-menu.is-active>.el-sub-menu__title{color:var(--el-menu-active-color)}.el-menu--horizontal .el-menu-item:not(.is-disabled):focus,.el-menu--horizontal .el-menu-item:not(.is-disabled):hover{outline:0;color:var(--el-menu-hover-text-color);background-color:var(--el-menu-hover-bg-color)}.el-menu--horizontal>.el-menu-item.is-active{border-bottom:2px solid var(--el-menu-active-color);color:var(--el-menu-active-color)!important}.el-menu--collapse{width:calc(var(--el-menu-icon-width) + var(--el-menu-base-level-padding) * 2)}.el-menu--collapse>.el-menu-item [class^=el-icon],.el-menu--collapse>.el-menu-item-group>ul>.el-sub-menu>.el-sub-menu__title [class^=el-icon],.el-menu--collapse>.el-sub-menu>.el-sub-menu__title [class^=el-icon]{margin:0;vertical-align:middle;width:var(--el-menu-icon-width);text-align:center}.el-menu--collapse>.el-menu-item .el-sub-menu__icon-arrow,.el-menu--collapse>.el-menu-item-group>ul>.el-sub-menu>.el-sub-menu__title .el-sub-menu__icon-arrow,.el-menu--collapse>.el-sub-menu>.el-sub-menu__title .el-sub-menu__icon-arrow{display:none}.el-menu--collapse>.el-menu-item-group>ul>.el-sub-menu>.el-sub-menu__title>span,.el-menu--collapse>.el-menu-item>span,.el-menu--collapse>.el-sub-menu>.el-sub-menu__title>span{height:0;width:0;overflow:hidden;visibility:hidden;display:inline-block}.el-menu--collapse>.el-menu-item.is-active i{color:inherit}.el-menu--collapse .el-menu .el-sub-menu{min-width:200px}.el-menu--popup{z-index:100;min-width:200px;border:none;padding:5px 0;border-radius:var(--el-border-radius-small);box-shadow:var(--el-box-shadow-light)}.el-menu .el-icon{flex-shrink:0}.el-menu-item{display:flex;align-items:center;height:var(--el-menu-item-height);line-height:var(--el-menu-item-height);font-size:var(--el-menu-item-font-size);color:var(--el-menu-text-color);padding:0 var(--el-menu-base-level-padding);list-style:none;cursor:pointer;position:relative;transition:border-color var(--el-transition-duration),background-color var(--el-transition-duration),color var(--el-transition-duration);box-sizing:border-box;white-space:nowrap}.el-menu-item *{vertical-align:bottom}.el-menu-item i{color:inherit}.el-menu-item:focus,.el-menu-item:hover{outline:0}.el-menu-item:hover{background-color:var(--el-menu-hover-bg-color)}.el-menu-item.is-disabled{opacity:.25;cursor:not-allowed;background:0 0!important}.el-menu-item [class^=el-icon]{margin-right:5px;width:var(--el-menu-icon-width);text-align:center;font-size:18px;vertical-align:middle}.el-menu-item.is-active{color:var(--el-menu-active-color)}.el-menu-item.is-active i{color:inherit}.el-menu-item .el-menu-tooltip__trigger{position:absolute;left:0;top:0;height:100%;width:100%;display:inline-flex;align-items:center;box-sizing:border-box;padding:0 var(--el-menu-base-level-padding)}.el-sub-menu{list-style:none;margin:0;padding-left:0}.el-sub-menu__title{display:flex;align-items:center;height:var(--el-menu-item-height);line-height:var(--el-menu-item-height);font-size:var(--el-menu-item-font-size);color:var(--el-menu-text-color);padding:0 var(--el-menu-base-level-padding);list-style:none;cursor:pointer;position:relative;transition:border-color var(--el-transition-duration),background-color var(--el-transition-duration),color var(--el-transition-duration);box-sizing:border-box;white-space:nowrap;padding-right:calc(var(--el-menu-base-level-padding) + var(--el-menu-icon-width))}.el-sub-menu__title *{vertical-align:bottom}.el-sub-menu__title i{color:inherit}.el-sub-menu__title:focus,.el-sub-menu__title:hover{outline:0}.el-sub-menu__title.is-disabled{opacity:.25;cursor:not-allowed;background:0 0!important}.el-sub-menu__title:hover{background-color:var(--el-menu-hover-bg-color)}.el-sub-menu .el-menu{border:none}.el-sub-menu .el-menu-item{height:var(--el-menu-sub-item-height);line-height:var(--el-menu-sub-item-height)}.el-sub-menu__hide-arrow .el-sub-menu__icon-arrow{display:none!important}.el-sub-menu.is-active .el-sub-menu__title{border-bottom-color:var(--el-menu-active-color)}.el-sub-menu.is-disabled .el-menu-item,.el-sub-menu.is-disabled .el-sub-menu__title{opacity:.25;cursor:not-allowed;background:0 0!important}.el-sub-menu .el-icon{vertical-align:middle;margin-right:5px;width:var(--el-menu-icon-width);text-align:center;font-size:18px}.el-sub-menu .el-icon.el-sub-menu__icon-more{margin-right:0!important}.el-sub-menu .el-sub-menu__icon-arrow{position:absolute;top:50%;right:var(--el-menu-base-level-padding);margin-top:-6px;transition:transform var(--el-transition-duration);font-size:12px;margin-right:0;width:inherit}.el-menu-item-group>ul{padding:0}.el-menu-item-group__title{padding:7px 0 7px var(--el-menu-base-level-padding);line-height:normal;font-size:12px;color:var(--el-text-color-secondary)}.horizontal-collapse-transition .el-sub-menu__title .el-sub-menu__icon-arrow{transition:var(--el-transition-duration-fast);opacity:0}.el-message-box{--el-messagebox-title-color:var(--el-text-color-primary);--el-messagebox-width:420px;--el-messagebox-border-radius:4px;--el-messagebox-font-size:var(--el-font-size-large);--el-messagebox-content-font-size:var(--el-font-size-base);--el-messagebox-content-color:var(--el-text-color-regular);--el-messagebox-error-font-size:12px;--el-messagebox-padding-primary:15px}.el-message-box{display:inline-block;max-width:var(--el-messagebox-width);width:100%;padding-bottom:10px;vertical-align:middle;background-color:var(--el-bg-color);border-radius:var(--el-messagebox-border-radius);border:1px solid var(--el-border-color-lighter);font-size:var(--el-messagebox-font-size);box-shadow:var(--el-box-shadow-light);text-align:left;overflow:hidden;-webkit-backface-visibility:hidden;backface-visibility:hidden;box-sizing:border-box}.el-message-box:focus{outline:0!important}.el-overlay.is-message-box .el-overlay-message-box{text-align:center;position:fixed;top:0;right:0;bottom:0;left:0;padding:16px;overflow:auto}.el-overlay.is-message-box .el-overlay-message-box:after{content:"";display:inline-block;height:100%;width:0;vertical-align:middle}.el-message-box.is-draggable .el-message-box__header{cursor:move;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-message-box__header{position:relative;padding:var(--el-messagebox-padding-primary);padding-bottom:10px}.el-message-box__title{padding-left:0;margin-bottom:0;font-size:var(--el-messagebox-font-size);line-height:1;color:var(--el-messagebox-title-color)}.el-message-box__headerbtn{position:absolute;top:var(--el-messagebox-padding-primary);right:var(--el-messagebox-padding-primary);padding:0;border:none;outline:0;background:0 0;font-size:var(--el-message-close-size,16px);cursor:pointer}.el-message-box__headerbtn .el-message-box__close{color:var(--el-color-info);font-size:inherit}.el-message-box__headerbtn:focus .el-message-box__close,.el-message-box__headerbtn:hover .el-message-box__close{color:var(--el-color-primary)}.el-message-box__content{padding:10px var(--el-messagebox-padding-primary);color:var(--el-messagebox-content-color);font-size:var(--el-messagebox-content-font-size)}.el-message-box__container{position:relative}.el-message-box__input{padding-top:15px}.el-message-box__input div.invalid>input{border-color:var(--el-color-error)}.el-message-box__input div.invalid>input:focus{border-color:var(--el-color-error)}.el-message-box__status{position:absolute;top:50%;transform:translateY(-50%);font-size:24px!important}.el-message-box__status:before{padding-left:1px}.el-message-box__status.el-icon{position:absolute}.el-message-box__status+.el-message-box__message{padding-left:36px;padding-right:12px;word-break:break-word}.el-message-box__status.el-message-box-icon--success{--el-messagebox-color:var(--el-color-success);color:var(--el-messagebox-color)}.el-message-box__status.el-message-box-icon--info{--el-messagebox-color:var(--el-color-info);color:var(--el-messagebox-color)}.el-message-box__status.el-message-box-icon--warning{--el-messagebox-color:var(--el-color-warning);color:var(--el-messagebox-color)}.el-message-box__status.el-message-box-icon--error{--el-messagebox-color:var(--el-color-error);color:var(--el-messagebox-color)}.el-message-box__message{margin:0}.el-message-box__message p{margin:0;line-height:24px}.el-message-box__errormsg{color:var(--el-color-error);font-size:var(--el-messagebox-error-font-size);min-height:18px;margin-top:2px}.el-message-box__btns{padding:5px 15px 0;display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center}.el-message-box__btns button:nth-child(2){margin-left:10px}.el-message-box__btns-reverse{flex-direction:row-reverse}.el-message-box--center .el-message-box__title{position:relative;display:flex;align-items:center;justify-content:center}.el-message-box--center .el-message-box__status{position:relative;top:auto;padding-right:5px;text-align:center;transform:translateY(-1px)}.el-message-box--center .el-message-box__message{margin-left:0}.el-message-box--center .el-message-box__btns{justify-content:center}.el-message-box--center .el-message-box__content{padding-left:calc(var(--el-messagebox-padding-primary) + 12px);padding-right:calc(var(--el-messagebox-padding-primary) + 12px);text-align:center}.fade-in-linear-enter-active .el-overlay-message-box{-webkit-animation:msgbox-fade-in var(--el-transition-duration);animation:msgbox-fade-in var(--el-transition-duration)}.fade-in-linear-leave-active .el-overlay-message-box{animation:msgbox-fade-in var(--el-transition-duration) reverse}@-webkit-keyframes msgbox-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@keyframes msgbox-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@-webkit-keyframes msgbox-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@keyframes msgbox-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}.el-message{--el-message-bg-color:var(--el-color-info-light-9);--el-message-border-color:var(--el-border-color-lighter);--el-message-padding:15px 19px;--el-message-close-size:16px;--el-message-close-icon-color:var(--el-text-color-placeholder);--el-message-close-hover-color:var(--el-text-color-secondary)}.el-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;max-width:calc(100% - 32px);box-sizing:border-box;border-radius:var(--el-border-radius-base);border-width:var(--el-border-width);border-style:var(--el-border-style);border-color:var(--el-message-border-color);position:fixed;left:50%;top:20px;transform:translate(-50%);background-color:var(--el-message-bg-color);transition:opacity var(--el-transition-duration),transform .4s,top .4s;padding:var(--el-message-padding);display:flex;align-items:center}.el-message.is-center{justify-content:center}.el-message.is-closable .el-message__content{padding-right:31px}.el-message p{margin:0}.el-message--success{--el-message-bg-color:var(--el-color-success-light-9);--el-message-border-color:var(--el-color-success-light-8);--el-message-text-color:var(--el-color-success)}.el-message--success .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--success{color:var(--el-message-text-color)}.el-message--info{--el-message-bg-color:var(--el-color-info-light-9);--el-message-border-color:var(--el-color-info-light-8);--el-message-text-color:var(--el-color-info)}.el-message--info .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--info{color:var(--el-message-text-color)}.el-message--warning{--el-message-bg-color:var(--el-color-warning-light-9);--el-message-border-color:var(--el-color-warning-light-8);--el-message-text-color:var(--el-color-warning)}.el-message--warning .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--warning{color:var(--el-message-text-color)}.el-message--error{--el-message-bg-color:var(--el-color-error-light-9);--el-message-border-color:var(--el-color-error-light-8);--el-message-text-color:var(--el-color-error)}.el-message--error .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--error{color:var(--el-message-text-color)}.el-message__icon{margin-right:10px}.el-message .el-message__badge{position:absolute;top:-8px;right:-8px}.el-message__content{padding:0;font-size:14px;line-height:1}.el-message__content:focus{outline-width:0}.el-message .el-message__closeBtn{position:absolute;top:50%;right:19px;transform:translateY(-50%);cursor:pointer;color:var(--el-message-close-icon-color);font-size:var(--el-message-close-size)}.el-message .el-message__closeBtn:focus{outline-width:0}.el-message .el-message__closeBtn:hover{color:var(--el-message-close-hover-color)}.el-message-fade-enter-from,.el-message-fade-leave-to{opacity:0;transform:translate(-50%,-100%)}.el-notification{--el-notification-width:330px;--el-notification-padding:14px 26px 14px 13px;--el-notification-radius:8px;--el-notification-shadow:var(--el-box-shadow-light);--el-notification-border-color:var(--el-border-color-lighter);--el-notification-icon-size:24px;--el-notification-close-font-size:var(--el-message-close-size, 16px);--el-notification-group-margin-left:13px;--el-notification-group-margin-right:8px;--el-notification-content-font-size:var(--el-font-size-base);--el-notification-content-color:var(--el-text-color-regular);--el-notification-title-font-size:16px;--el-notification-title-color:var(--el-text-color-primary);--el-notification-close-color:var(--el-text-color-secondary);--el-notification-close-hover-color:var(--el-text-color-regular)}.el-notification{display:flex;width:var(--el-notification-width);padding:var(--el-notification-padding);border-radius:var(--el-notification-radius);box-sizing:border-box;border:1px solid var(--el-notification-border-color);position:fixed;background-color:var(--el-bg-color-overlay);box-shadow:var(--el-notification-shadow);transition:opacity var(--el-transition-duration),transform var(--el-transition-duration),left var(--el-transition-duration),right var(--el-transition-duration),top .4s,bottom var(--el-transition-duration);overflow-wrap:anywhere;overflow:hidden;z-index:9999}.el-notification.right{right:16px}.el-notification.left{left:16px}.el-notification__group{margin-left:var(--el-notification-group-margin-left);margin-right:var(--el-notification-group-margin-right)}.el-notification__title{font-weight:700;font-size:var(--el-notification-title-font-size);line-height:var(--el-notification-icon-size);color:var(--el-notification-title-color);margin:0}.el-notification__content{font-size:var(--el-notification-content-font-size);line-height:24px;margin:6px 0 0;color:var(--el-notification-content-color);text-align:justify}.el-notification__content p{margin:0}.el-notification .el-notification__icon{height:var(--el-notification-icon-size);width:var(--el-notification-icon-size);font-size:var(--el-notification-icon-size)}.el-notification .el-notification__closeBtn{position:absolute;top:18px;right:15px;cursor:pointer;color:var(--el-notification-close-color);font-size:var(--el-notification-close-font-size)}.el-notification .el-notification__closeBtn:hover{color:var(--el-notification-close-hover-color)}.el-notification .el-notification--success{--el-notification-icon-color:var(--el-color-success);color:var(--el-notification-icon-color)}.el-notification .el-notification--info{--el-notification-icon-color:var(--el-color-info);color:var(--el-notification-icon-color)}.el-notification .el-notification--warning{--el-notification-icon-color:var(--el-color-warning);color:var(--el-notification-icon-color)}.el-notification .el-notification--error{--el-notification-icon-color:var(--el-color-error);color:var(--el-notification-icon-color)}.el-notification-fade-enter-from.right{right:0;transform:translate(100%)}.el-notification-fade-enter-from.left{left:0;transform:translate(-100%)}.el-notification-fade-leave-to{opacity:0}.el-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;height:100%;background-color:var(--el-overlay-color-lighter);overflow:auto}.el-overlay .el-overlay-root{height:0}.el-page-header.is-contentful .el-page-header__main{border-top:1px solid var(--el-border-color-light);margin-top:16px}.el-page-header__header{display:flex;align-items:center;justify-content:space-between;line-height:24px}.el-page-header__left{display:flex;align-items:center;margin-right:40px;position:relative}.el-page-header__back{display:flex;align-items:center;cursor:pointer}.el-page-header__left .el-divider--vertical{margin:0 16px}.el-page-header__icon{font-size:16px;margin-right:10px;display:flex;align-items:center}.el-page-header__icon .el-icon{font-size:inherit}.el-page-header__title{font-size:14px;font-weight:500}.el-page-header__content{font-size:18px;color:var(--el-text-color-primary)}.el-page-header__breadcrumb{margin-bottom:16px}.el-pagination{--el-pagination-font-size:14px;--el-pagination-bg-color:var(--el-fill-color-blank);--el-pagination-text-color:var(--el-text-color-primary);--el-pagination-border-radius:2px;--el-pagination-button-color:var(--el-text-color-primary);--el-pagination-button-width:32px;--el-pagination-button-height:32px;--el-pagination-button-disabled-color:var(--el-text-color-placeholder);--el-pagination-button-disabled-bg-color:var(--el-fill-color-blank);--el-pagination-button-bg-color:var(--el-fill-color);--el-pagination-hover-color:var(--el-color-primary);--el-pagination-font-size-small:12px;--el-pagination-button-width-small:24px;--el-pagination-button-height-small:24px;--el-pagination-item-gap:16px;white-space:nowrap;color:var(--el-pagination-text-color);font-size:var(--el-pagination-font-size);font-weight:400;display:flex;align-items:center}.el-pagination .el-input__inner{text-align:center;-moz-appearance:textfield}.el-pagination .el-select .el-input{width:128px}.el-pagination button{display:flex;justify-content:center;align-items:center;font-size:var(--el-pagination-font-size);min-width:var(--el-pagination-button-width);height:var(--el-pagination-button-height);line-height:var(--el-pagination-button-height);color:var(--el-pagination-button-color);background:var(--el-pagination-bg-color);padding:0 4px;border:none;border-radius:var(--el-pagination-border-radius);cursor:pointer;text-align:center;box-sizing:border-box}.el-pagination button *{pointer-events:none}.el-pagination button:focus{outline:0}.el-pagination button:hover{color:var(--el-pagination-hover-color)}.el-pagination button.is-active{color:var(--el-pagination-hover-color);cursor:default;font-weight:700}.el-pagination button.is-active.is-disabled{font-weight:700;color:var(--el-text-color-secondary)}.el-pagination button.is-disabled,.el-pagination button:disabled{color:var(--el-pagination-button-disabled-color);background-color:var(--el-pagination-button-disabled-bg-color);cursor:not-allowed}.el-pagination button:focus-visible{outline:1px solid var(--el-pagination-hover-color);outline-offset:-1px}.el-pagination .btn-next .el-icon,.el-pagination .btn-prev .el-icon{display:block;font-size:12px;font-weight:700;width:inherit}.el-pagination>.is-first{margin-left:0!important}.el-pagination>.is-last{margin-right:0!important}.el-pagination .btn-prev{margin-left:var(--el-pagination-item-gap)}.el-pagination__sizes,.el-pagination__total{margin-left:var(--el-pagination-item-gap);font-weight:400;color:var(--el-text-color-regular)}.el-pagination__total[disabled=true]{color:var(--el-text-color-placeholder)}.el-pagination__jump{display:flex;align-items:center;margin-left:var(--el-pagination-item-gap);font-weight:400;color:var(--el-text-color-regular)}.el-pagination__jump[disabled=true]{color:var(--el-text-color-placeholder)}.el-pagination__goto{margin-right:8px}.el-pagination__editor{text-align:center;box-sizing:border-box}.el-pagination__editor.el-input{width:56px}.el-pagination__editor .el-input__inner::-webkit-inner-spin-button,.el-pagination__editor .el-input__inner::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.el-pagination__classifier{margin-left:8px}.el-pagination__rightwrapper{flex:1;display:flex;align-items:center;justify-content:flex-end}.el-pagination.is-background .btn-next,.el-pagination.is-background .btn-prev,.el-pagination.is-background .el-pager li{margin:0 4px;background-color:var(--el-pagination-button-bg-color)}.el-pagination.is-background .btn-next.is-active,.el-pagination.is-background .btn-prev.is-active,.el-pagination.is-background .el-pager li.is-active{background-color:var(--el-color-primary);color:var(--el-color-white)}.el-pagination.is-background .btn-next.is-disabled,.el-pagination.is-background .btn-next:disabled,.el-pagination.is-background .btn-prev.is-disabled,.el-pagination.is-background .btn-prev:disabled,.el-pagination.is-background .el-pager li.is-disabled,.el-pagination.is-background .el-pager li:disabled{color:var(--el-text-color-placeholder);background-color:var(--el-disabled-bg-color)}.el-pagination.is-background .btn-next.is-disabled.is-active,.el-pagination.is-background .btn-next:disabled.is-active,.el-pagination.is-background .btn-prev.is-disabled.is-active,.el-pagination.is-background .btn-prev:disabled.is-active,.el-pagination.is-background .el-pager li.is-disabled.is-active,.el-pagination.is-background .el-pager li:disabled.is-active{color:var(--el-text-color-secondary);background-color:var(--el-fill-color-dark)}.el-pagination.is-background .btn-prev{margin-left:var(--el-pagination-item-gap)}.el-pagination--small .btn-next,.el-pagination--small .btn-prev,.el-pagination--small .el-pager li{height:var(--el-pagination-button-height-small);line-height:var(--el-pagination-button-height-small);font-size:var(--el-pagination-font-size-small);min-width:var(--el-pagination-button-width-small)}.el-pagination--small button,.el-pagination--small span:not([class*=suffix]){font-size:var(--el-pagination-font-size-small)}.el-pagination--small .el-select .el-input{width:100px}.el-pager{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;list-style:none;font-size:0;padding:0;margin:0;display:flex;align-items:center}.el-pager li{display:flex;justify-content:center;align-items:center;font-size:var(--el-pagination-font-size);min-width:var(--el-pagination-button-width);height:var(--el-pagination-button-height);line-height:var(--el-pagination-button-height);color:var(--el-pagination-button-color);background:var(--el-pagination-bg-color);padding:0 4px;border:none;border-radius:var(--el-pagination-border-radius);cursor:pointer;text-align:center;box-sizing:border-box}.el-pager li *{pointer-events:none}.el-pager li:focus{outline:0}.el-pager li:hover{color:var(--el-pagination-hover-color)}.el-pager li.is-active{color:var(--el-pagination-hover-color);cursor:default;font-weight:700}.el-pager li.is-active.is-disabled{font-weight:700;color:var(--el-text-color-secondary)}.el-pager li.is-disabled,.el-pager li:disabled{color:var(--el-pagination-button-disabled-color);background-color:var(--el-pagination-button-disabled-bg-color);cursor:not-allowed}.el-pager li:focus-visible{outline:1px solid var(--el-pagination-hover-color);outline-offset:-1px}.el-popconfirm__main{display:flex;align-items:center}.el-popconfirm__icon{margin-right:5px}.el-popconfirm__action{text-align:right;margin-top:8px}.el-popover{--el-popover-bg-color:var(--el-bg-color-overlay);--el-popover-font-size:var(--el-font-size-base);--el-popover-border-color:var(--el-border-color-lighter);--el-popover-padding:12px;--el-popover-padding-large:18px 20px;--el-popover-title-font-size:16px;--el-popover-title-text-color:var(--el-text-color-primary);--el-popover-border-radius:4px}.el-popover.el-popper{background:var(--el-popover-bg-color);min-width:150px;border-radius:var(--el-popover-border-radius);border:1px solid var(--el-popover-border-color);padding:var(--el-popover-padding);z-index:var(--el-index-popper);color:var(--el-text-color-regular);line-height:1.4;text-align:justify;font-size:var(--el-popover-font-size);box-shadow:var(--el-box-shadow-light);word-break:break-all;box-sizing:border-box}.el-popover.el-popper--plain{padding:var(--el-popover-padding-large)}.el-popover__title{color:var(--el-popover-title-text-color);font-size:var(--el-popover-title-font-size);line-height:1;margin-bottom:12px}.el-popover__reference:focus:hover,.el-popover__reference:focus:not(.focusing){outline-width:0}.el-popover.el-popper.is-dark{--el-popover-bg-color:var(--el-text-color-primary);--el-popover-border-color:var(--el-text-color-primary);--el-popover-title-text-color:var(--el-bg-color);color:var(--el-bg-color)}.el-popover.el-popper:focus,.el-popover.el-popper:focus:active{outline-width:0}.el-progress{position:relative;line-height:1;display:flex;align-items:center}.el-progress__text{font-size:14px;color:var(--el-text-color-regular);margin-left:5px;min-width:50px;line-height:1}.el-progress__text i{vertical-align:middle;display:block}.el-progress--circle,.el-progress--dashboard{display:inline-block}.el-progress--circle .el-progress__text,.el-progress--dashboard .el-progress__text{position:absolute;top:50%;left:0;width:100%;text-align:center;margin:0;transform:translateY(-50%)}.el-progress--circle .el-progress__text i,.el-progress--dashboard .el-progress__text i{vertical-align:middle;display:inline-block}.el-progress--without-text .el-progress__text{display:none}.el-progress--without-text .el-progress-bar{padding-right:0;margin-right:0;display:block}.el-progress--text-inside .el-progress-bar{padding-right:0;margin-right:0}.el-progress.is-success .el-progress-bar__inner{background-color:var(--el-color-success)}.el-progress.is-success .el-progress__text{color:var(--el-color-success)}.el-progress.is-warning .el-progress-bar__inner{background-color:var(--el-color-warning)}.el-progress.is-warning .el-progress__text{color:var(--el-color-warning)}.el-progress.is-exception .el-progress-bar__inner{background-color:var(--el-color-danger)}.el-progress.is-exception .el-progress__text{color:var(--el-color-danger)}.el-progress-bar{flex-grow:1;box-sizing:border-box}.el-progress-bar__outer{height:6px;border-radius:100px;background-color:var(--el-border-color-lighter);overflow:hidden;position:relative;vertical-align:middle}.el-progress-bar__inner{position:absolute;left:0;top:0;height:100%;background-color:var(--el-color-primary);text-align:right;border-radius:100px;line-height:1;white-space:nowrap;transition:width .6s ease}.el-progress-bar__inner:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-progress-bar__inner--indeterminate{transform:translateZ(0);-webkit-animation:indeterminate 3s infinite;animation:indeterminate 3s infinite}.el-progress-bar__inner--striped{background-image:linear-gradient(45deg,rgba(0,0,0,.1) 25%,transparent 25%,transparent 50%,rgba(0,0,0,.1) 50%,rgba(0,0,0,.1) 75%,transparent 75%,transparent);background-size:1.25em 1.25em}.el-progress-bar__inner--striped.el-progress-bar__inner--striped-flow{-webkit-animation:striped-flow 3s linear infinite;animation:striped-flow 3s linear infinite}.el-progress-bar__innerText{display:inline-block;vertical-align:middle;color:#fff;font-size:12px;margin:0 5px}@-webkit-keyframes progress{0%{background-position:0 0}to{background-position:32px 0}}@keyframes progress{0%{background-position:0 0}to{background-position:32px 0}}@-webkit-keyframes indeterminate{0%{left:-100%}to{left:100%}}@keyframes indeterminate{0%{left:-100%}to{left:100%}}@-webkit-keyframes striped-flow{0%{background-position:-100%}to{background-position:100%}}@keyframes striped-flow{0%{background-position:-100%}to{background-position:100%}}.el-radio-button{--el-radio-button-checked-bg-color:var(--el-color-primary);--el-radio-button-checked-text-color:var(--el-color-white);--el-radio-button-checked-border-color:var(--el-color-primary);--el-radio-button-disabled-checked-fill:var(--el-border-color-extra-light)}.el-radio-button{position:relative;display:inline-block;outline:0}.el-radio-button__inner{display:inline-block;line-height:1;white-space:nowrap;vertical-align:middle;background:var(--el-button-bg-color,var(--el-fill-color-blank));border:var(--el-border);font-weight:var(--el-button-font-weight,var(--el-font-weight-primary));border-left:0;color:var(--el-button-text-color,var(--el-text-color-regular));-webkit-appearance:none;text-align:center;box-sizing:border-box;outline:0;margin:0;position:relative;cursor:pointer;transition:var(--el-transition-all);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:8px 15px;font-size:var(--el-font-size-base);border-radius:0}.el-radio-button__inner.is-round{padding:8px 15px}.el-radio-button__inner:hover{color:var(--el-color-primary)}.el-radio-button__inner [class*=el-icon-]{line-height:.9}.el-radio-button__inner [class*=el-icon-]+span{margin-left:5px}.el-radio-button:first-child .el-radio-button__inner{border-left:var(--el-border);border-radius:var(--el-border-radius-base) 0 0 var(--el-border-radius-base);box-shadow:none!important}.el-radio-button__original-radio{opacity:0;outline:0;position:absolute;z-index:-1}.el-radio-button__original-radio:checked+.el-radio-button__inner{color:var(--el-radio-button-checked-text-color,var(--el-color-white));background-color:var(--el-radio-button-checked-bg-color,var(--el-color-primary));border-color:var(--el-radio-button-checked-border-color,var(--el-color-primary));box-shadow:-1px 0 0 0 var(--el-radio-button-checked-border-color,var(--el-color-primary))}.el-radio-button__original-radio:focus-visible+.el-radio-button__inner{border-left:var(--el-border);border-left-color:var(--el-radio-button-checked-border-color,var(--el-color-primary));outline:2px solid var(--el-radio-button-checked-border-color);outline-offset:1px;z-index:2;border-radius:var(--el-border-radius-base);box-shadow:none}.el-radio-button__original-radio:disabled+.el-radio-button__inner{color:var(--el-disabled-text-color);cursor:not-allowed;background-image:none;background-color:var(--el-button-disabled-bg-color,var(--el-fill-color-blank));border-color:var(--el-button-disabled-border-color,var(--el-border-color-light));box-shadow:none}.el-radio-button__original-radio:disabled:checked+.el-radio-button__inner{background-color:var(--el-radio-button-disabled-checked-fill)}.el-radio-button:last-child .el-radio-button__inner{border-radius:0 var(--el-border-radius-base) var(--el-border-radius-base) 0}.el-radio-button:first-child:last-child .el-radio-button__inner{border-radius:var(--el-border-radius-base)}.el-radio-button--large .el-radio-button__inner{padding:12px 19px;font-size:var(--el-font-size-base);border-radius:0}.el-radio-button--large .el-radio-button__inner.is-round{padding:12px 19px}.el-radio-button--small .el-radio-button__inner{padding:5px 11px;font-size:12px;border-radius:0}.el-radio-button--small .el-radio-button__inner.is-round{padding:5px 11px}.el-radio-group{display:inline-flex;align-items:center;flex-wrap:wrap;font-size:0}.el-radio{--el-radio-font-size:var(--el-font-size-base);--el-radio-text-color:var(--el-text-color-regular);--el-radio-font-weight:var(--el-font-weight-primary);--el-radio-input-height:14px;--el-radio-input-width:14px;--el-radio-input-border-radius:var(--el-border-radius-circle);--el-radio-input-bg-color:var(--el-fill-color-blank);--el-radio-input-border:var(--el-border);--el-radio-input-border-color:var(--el-border-color);--el-radio-input-border-color-hover:var(--el-color-primary)}.el-radio{color:var(--el-radio-text-color);font-weight:var(--el-radio-font-weight);position:relative;cursor:pointer;display:inline-flex;align-items:center;white-space:nowrap;outline:0;font-size:var(--el-font-size-base);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;margin-right:32px;height:32px}.el-radio.el-radio--large{height:40px}.el-radio.el-radio--small{height:24px}.el-radio.is-bordered{padding:0 15px 0 9px;border-radius:var(--el-border-radius-base);border:var(--el-border);box-sizing:border-box}.el-radio.is-bordered.is-checked{border-color:var(--el-color-primary)}.el-radio.is-bordered.is-disabled{cursor:not-allowed;border-color:var(--el-border-color-lighter)}.el-radio.is-bordered.el-radio--large{padding:0 19px 0 11px;border-radius:var(--el-border-radius-base)}.el-radio.is-bordered.el-radio--large .el-radio__label{font-size:var(--el-font-size-base)}.el-radio.is-bordered.el-radio--large .el-radio__inner{height:14px;width:14px}.el-radio.is-bordered.el-radio--small{padding:0 11px 0 7px;border-radius:var(--el-border-radius-base)}.el-radio.is-bordered.el-radio--small .el-radio__label{font-size:12px}.el-radio.is-bordered.el-radio--small .el-radio__inner{height:12px;width:12px}.el-radio:last-child{margin-right:0}.el-radio__input{white-space:nowrap;cursor:pointer;outline:0;display:inline-flex;position:relative;vertical-align:middle}.el-radio__input.is-disabled .el-radio__inner{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color);cursor:not-allowed}.el-radio__input.is-disabled .el-radio__inner:after{cursor:not-allowed;background-color:var(--el-disabled-bg-color)}.el-radio__input.is-disabled .el-radio__inner+.el-radio__label{cursor:not-allowed}.el-radio__input.is-disabled.is-checked .el-radio__inner{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color)}.el-radio__input.is-disabled.is-checked .el-radio__inner:after{background-color:var(--el-text-color-placeholder)}.el-radio__input.is-disabled+span.el-radio__label{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-radio__input.is-checked .el-radio__inner{border-color:var(--el-color-primary);background:var(--el-color-primary)}.el-radio__input.is-checked .el-radio__inner:after{transform:translate(-50%,-50%) scale(1)}.el-radio__input.is-checked+.el-radio__label{color:var(--el-color-primary)}.el-radio__input.is-focus .el-radio__inner{border-color:var(--el-radio-input-border-color-hover)}.el-radio__inner{border:var(--el-radio-input-border);border-radius:var(--el-radio-input-border-radius);width:var(--el-radio-input-width);height:var(--el-radio-input-height);background-color:var(--el-radio-input-bg-color);position:relative;cursor:pointer;display:inline-block;box-sizing:border-box}.el-radio__inner:hover{border-color:var(--el-radio-input-border-color-hover)}.el-radio__inner:after{width:4px;height:4px;border-radius:var(--el-radio-input-border-radius);background-color:var(--el-color-white);content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%) scale(0);transition:transform .15s ease-in}.el-radio__original{opacity:0;outline:0;position:absolute;z-index:-1;top:0;left:0;right:0;bottom:0;margin:0}.el-radio__original:focus-visible+.el-radio__inner{outline:2px solid var(--el-radio-input-border-color-hover);outline-offset:1px;border-radius:var(--el-radio-input-border-radius)}.el-radio:focus:not(:focus-visible):not(.is-focus):not(:active):not(.is-disabled) .el-radio__inner{box-shadow:0 0 2px 2px var(--el-radio-input-border-color-hover)}.el-radio__label{font-size:var(--el-radio-font-size);padding-left:8px}.el-radio.el-radio--large .el-radio__label{font-size:14px}.el-radio.el-radio--large .el-radio__inner{width:14px;height:14px}.el-radio.el-radio--small .el-radio__label{font-size:12px}.el-radio.el-radio--small .el-radio__inner{width:12px;height:12px}.el-rate{--el-rate-height:20px;--el-rate-font-size:var(--el-font-size-base);--el-rate-icon-size:18px;--el-rate-icon-margin:6px;--el-rate-void-color:var(--el-border-color-darker);--el-rate-fill-color:#f7ba2a;--el-rate-disabled-void-color:var(--el-fill-color);--el-rate-text-color:var(--el-text-color-primary)}.el-rate{display:inline-flex;align-items:center;height:32px}.el-rate:active,.el-rate:focus{outline:0}.el-rate__item{cursor:pointer;display:inline-block;position:relative;font-size:0;vertical-align:middle;color:var(--el-rate-void-color);line-height:normal}.el-rate .el-rate__icon{position:relative;display:inline-block;font-size:var(--el-rate-icon-size);margin-right:var(--el-rate-icon-margin);transition:var(--el-transition-duration)}.el-rate .el-rate__icon.hover{transform:scale(1.15)}.el-rate .el-rate__icon .path2{position:absolute;left:0;top:0}.el-rate .el-rate__icon.is-active{color:var(--el-rate-fill-color)}.el-rate__decimal{position:absolute;top:0;left:0;display:inline-block;overflow:hidden;color:var(--el-rate-fill-color)}.el-rate__text{font-size:var(--el-rate-font-size);vertical-align:middle;color:var(--el-rate-text-color)}.el-rate--large{height:40px}.el-rate--small{height:24px}.el-rate--small .el-rate__icon{font-size:14px}.el-rate.is-disabled .el-rate__item{cursor:auto;color:var(--el-rate-disabled-void-color)}.el-result{--el-result-padding:40px 30px;--el-result-icon-font-size:64px;--el-result-title-font-size:20px;--el-result-title-margin-top:20px;--el-result-subtitle-margin-top:10px;--el-result-extra-margin-top:30px}.el-result{display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;box-sizing:border-box;padding:var(--el-result-padding)}.el-result__icon svg{width:var(--el-result-icon-font-size);height:var(--el-result-icon-font-size)}.el-result__title{margin-top:var(--el-result-title-margin-top)}.el-result__title p{margin:0;font-size:var(--el-result-title-font-size);color:var(--el-text-color-primary);line-height:1.3}.el-result__subtitle{margin-top:var(--el-result-subtitle-margin-top)}.el-result__subtitle p{margin:0;font-size:var(--el-font-size-base);color:var(--el-text-color-regular);line-height:1.3}.el-result__extra{margin-top:var(--el-result-extra-margin-top)}.el-result .icon-primary{--el-result-color:var(--el-color-primary);color:var(--el-result-color)}.el-result .icon-success{--el-result-color:var(--el-color-success);color:var(--el-result-color)}.el-result .icon-warning{--el-result-color:var(--el-color-warning);color:var(--el-result-color)}.el-result .icon-danger{--el-result-color:var(--el-color-danger);color:var(--el-result-color)}.el-result .icon-error{--el-result-color:var(--el-color-error);color:var(--el-result-color)}.el-result .icon-info{--el-result-color:var(--el-color-info);color:var(--el-result-color)}.el-row{display:flex;flex-wrap:wrap;position:relative;box-sizing:border-box}.el-row.is-justify-center{justify-content:center}.el-row.is-justify-end{justify-content:flex-end}.el-row.is-justify-space-between{justify-content:space-between}.el-row.is-justify-space-around{justify-content:space-around}.el-row.is-justify-space-evenly{justify-content:space-evenly}.el-row.is-align-middle{align-items:center}.el-row.is-align-bottom{align-items:flex-end}.el-scrollbar{--el-scrollbar-opacity:.3;--el-scrollbar-bg-color:var(--el-text-color-secondary);--el-scrollbar-hover-opacity:.5;--el-scrollbar-hover-bg-color:var(--el-text-color-secondary)}.el-scrollbar{overflow:hidden;position:relative;height:100%}.el-scrollbar__wrap{overflow:auto;height:100%}.el-scrollbar__wrap--hidden-default{scrollbar-width:none}.el-scrollbar__wrap--hidden-default::-webkit-scrollbar{display:none}.el-scrollbar__thumb{position:relative;display:block;width:0;height:0;cursor:pointer;border-radius:inherit;background-color:var(--el-scrollbar-bg-color,var(--el-text-color-secondary));transition:var(--el-transition-duration) background-color;opacity:var(--el-scrollbar-opacity,.3)}.el-scrollbar__thumb:hover{background-color:var(--el-scrollbar-hover-bg-color,var(--el-text-color-secondary));opacity:var(--el-scrollbar-hover-opacity,.5)}.el-scrollbar__bar{position:absolute;right:2px;bottom:2px;z-index:1;border-radius:4px}.el-scrollbar__bar.is-vertical{width:6px;top:2px}.el-scrollbar__bar.is-vertical>div{width:100%}.el-scrollbar__bar.is-horizontal{height:6px;left:2px}.el-scrollbar__bar.is-horizontal>div{height:100%}.el-scrollbar-fade-enter-active{transition:opacity .34s ease-out}.el-scrollbar-fade-leave-active{transition:opacity .12s ease-out}.el-scrollbar-fade-enter-from,.el-scrollbar-fade-leave-active{opacity:0}.el-select-dropdown{z-index:calc(var(--el-index-top) + 1);border-radius:var(--el-border-radius-base);box-sizing:border-box}.el-select-dropdown .el-scrollbar.is-empty .el-select-dropdown__list{padding:0}.el-select-dropdown__option-item.is-selected:not(.is-multiple).is-disabled{color:var(--el-text-color-disabled)}.el-select-dropdown__option-item.is-selected:not(.is-multiple).is-disabled:after{background-color:var(--el-text-color-disabled)}.el-select-dropdown__option-item:hover:not(.hover){background-color:transparent}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-disabled.is-selected{color:var(--el-text-color-disabled)}.el-select-dropdown__empty{padding:10px 0;margin:0;text-align:center;color:var(--el-text-color-secondary);font-size:var(--el-select-font-size)}.el-select-dropdown__wrap{max-height:274px}.el-select-dropdown__list{list-style:none;margin:6px 0!important;padding:0!important;box-sizing:border-box}.el-select-dropdown__option-item{font-size:var(--el-select-font-size);padding:0 32px 0 20px;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--el-text-color-regular);height:34px;line-height:34px;box-sizing:border-box;cursor:pointer}.el-select-dropdown__option-item.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-select-dropdown__option-item.is-disabled:hover{background-color:var(--el-bg-color)}.el-select-dropdown__option-item.is-selected{background-color:var(--el-fill-color-light);font-weight:700}.el-select-dropdown__option-item.is-selected:not(.is-multiple){color:var(--el-color-primary)}.el-select-dropdown__option-item.hover{background-color:var(--el-fill-color-light)!important}.el-select-dropdown__option-item:hover{background-color:var(--el-fill-color-light)}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-selected{color:var(--el-color-primary);background-color:var(--el-bg-color-overlay)}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-selected .el-icon{position:absolute;right:20px;top:0;height:inherit;font-size:12px}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-selected .el-icon svg{height:inherit;vertical-align:middle}.el-select-group{margin:0;padding:0}.el-select-group__wrap{position:relative;list-style:none;margin:0;padding:0}.el-select-group__wrap:not(:last-of-type){padding-bottom:24px}.el-select-group__wrap:not(:last-of-type):after{content:"";position:absolute;display:block;left:20px;right:20px;bottom:12px;height:1px;background:var(--el-border-color-light)}.el-select-group__split-dash{position:absolute;left:20px;right:20px;height:1px;background:var(--el-border-color-light)}.el-select-group__title{padding-left:20px;font-size:12px;color:var(--el-color-info);line-height:30px}.el-select-group .el-select-dropdown__item{padding-left:20px}.el-select-v2{--el-select-border-color-hover:var(--el-border-color-hover);--el-select-disabled-border:var(--el-disabled-border-color);--el-select-font-size:var(--el-font-size-base);--el-select-close-hover-color:var(--el-text-color-secondary);--el-select-input-color:var(--el-text-color-placeholder);--el-select-multiple-input-color:var(--el-text-color-regular);--el-select-input-focus-border-color:var(--el-color-primary);--el-select-input-font-size:14px}.el-select-v2{display:inline-block;position:relative;vertical-align:middle;font-size:14px}.el-select-v2__wrapper{display:flex;align-items:center;flex-wrap:wrap;position:relative;box-sizing:border-box;cursor:pointer;padding:1px 30px 1px 0;border:1px solid var(--el-border-color);border-radius:var(--el-border-radius-base);background-color:var(--el-fill-color-blank);transition:var(--el-transition-duration)}.el-select-v2__wrapper:hover{border-color:var(--el-text-color-placeholder)}.el-select-v2__wrapper.is-filterable{cursor:text}.el-select-v2__wrapper.is-focused{border-color:var(--el-color-primary)}.el-select-v2__wrapper.is-hovering:not(.is-focused){border-color:var(--el-border-color-hover)}.el-select-v2__wrapper.is-disabled{cursor:not-allowed;background-color:var(--el-fill-color-light);color:var(--el-text-color-placeholder);border-color:var(--el-select-disabled-border)}.el-select-v2__wrapper.is-disabled:hover{border-color:var(--el-select-disabled-border)}.el-select-v2__wrapper.is-disabled.is-focus{border-color:var(--el-input-focus-border-color)}.el-select-v2__wrapper.is-disabled .is-transparent{opacity:1;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-select-v2__wrapper.is-disabled .el-select-v2__caret,.el-select-v2__wrapper.is-disabled .el-select-v2__combobox-input{cursor:not-allowed}.el-select-v2__wrapper .el-select-v2__input-wrapper{box-sizing:border-box;position:relative;-webkit-margin-start:12px;margin-inline-start:12px;max-width:100%;overflow:hidden}.el-select-v2__wrapper,.el-select-v2__wrapper .el-select-v2__input-wrapper{line-height:32px}.el-select-v2__wrapper .el-select-v2__input-wrapper input{--el-input-inner-height:calc(var(--el-component-size, 32px) - 8px);height:var(--el-input-inner-height);line-height:var(--el-input-inner-height);min-width:4px;width:100%;background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:0 0;border:none;margin:2px 0;outline:0;padding:0}.el-select-v2 .el-select-v2__tags-text{display:inline-block;line-height:normal;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-select-v2__empty{padding:10px 0;margin:0;text-align:center;color:var(--el-text-color-secondary);font-size:14px}.el-select-v2__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-box-shadow-light)}.el-select-v2__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-select-v2__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-select-v2__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-select-v2__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-select-v2__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-select-v2--large .el-select-v2__wrapper .el-select-v2__combobox-input{height:32px}.el-select-v2--large .el-select-v2__caret,.el-select-v2--large .el-select-v2__suffix{height:40px}.el-select-v2--large .el-select-v2__placeholder{font-size:14px;line-height:40px}.el-select-v2--small .el-select-v2__wrapper .el-select-v2__combobox-input{height:16px}.el-select-v2--small .el-select-v2__caret,.el-select-v2--small .el-select-v2__suffix{height:24px}.el-select-v2--small .el-select-v2__placeholder{font-size:12px;line-height:24px}.el-select-v2 .el-select-v2__selection>span{display:inline-block}.el-select-v2:hover .el-select-v2__combobox-input{border-color:var(--el-select-border-color-hover)}.el-select-v2 .el-select__selection-text{text-overflow:ellipsis;display:inline-block;overflow-x:hidden;vertical-align:bottom}.el-select-v2 .el-select-v2__combobox-input{padding-right:35px;display:block;color:var(--el-text-color-regular)}.el-select-v2 .el-select-v2__combobox-input:focus{border-color:var(--el-select-input-focus-border-color)}.el-select-v2__input{border:none;outline:0;padding:0;margin-left:15px;color:var(--el-select-multiple-input-color);font-size:var(--el-select-font-size);-webkit-appearance:none;-moz-appearance:none;appearance:none;height:28px}.el-select-v2__input.is-small{height:14px}.el-select-v2__close{cursor:pointer;position:absolute;top:8px;z-index:var(--el-index-top);right:25px;color:var(--el-select-input-color);line-height:18px;font-size:var(--el-select-input-font-size)}.el-select-v2__close:hover{color:var(--el-select-close-hover-color)}.el-select-v2__suffix{display:inline-flex;position:absolute;right:12px;height:32px;top:50%;transform:translateY(-50%);color:var(--el-input-icon-color,var(--el-text-color-placeholder))}.el-select-v2__suffix .el-input__icon{height:inherit}.el-select-v2__suffix .el-input__icon:not(:first-child){margin-left:8px}.el-select-v2__caret{color:var(--el-select-input-color);font-size:var(--el-select-input-font-size);transition:var(--el-transition-duration);transform:rotate(180deg);cursor:pointer}.el-select-v2__caret.is-reverse{transform:rotate(0)}.el-select-v2__caret.is-show-close{font-size:var(--el-select-font-size);text-align:center;transform:rotate(180deg);border-radius:var(--el-border-radius-circle);color:var(--el-select-input-color);transition:var(--el-transition-color)}.el-select-v2__caret.is-show-close:hover{color:var(--el-select-close-hover-color)}.el-select-v2__caret.el-icon{height:inherit}.el-select-v2__caret.el-icon svg{vertical-align:middle}.el-select-v2__selection{white-space:normal;z-index:var(--el-index-normal);display:flex;align-items:center;flex-wrap:wrap;width:100%}.el-select-v2__input-calculator{left:0;position:absolute;top:0;visibility:hidden;white-space:pre;z-index:999}.el-select-v2__selected-item{line-height:inherit;height:inherit;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-wrap:wrap}.el-select-v2__placeholder{position:absolute;top:50%;transform:translateY(-50%);-webkit-margin-start:12px;margin-inline-start:12px;width:calc(100% - 52px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--el-input-text-color,var(--el-text-color-regular))}.el-select-v2__placeholder.is-transparent{color:var(--el-text-color-placeholder)}.el-select-v2 .el-select-v2__selection .el-tag{box-sizing:border-box;border-color:transparent;margin:2px 0 2px 6px;background-color:var(--el-fill-color)}.el-select-v2 .el-select-v2__selection .el-tag .el-icon-close{background-color:var(--el-text-color-placeholder);right:-7px;color:var(--el-color-white)}.el-select-v2 .el-select-v2__selection .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-select-v2 .el-select-v2__selection .el-tag .el-icon-close:before{display:block;transform:translateY(.5px)}.el-select-v2.el-select-v2--small .el-select-v2__selection .el-tag{margin:1px 0 1px 6px;height:18px}.el-select-dropdown{z-index:calc(var(--el-index-top) + 1);border-radius:var(--el-border-radius-base);box-sizing:border-box}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected{color:var(--el-color-primary);background-color:var(--el-bg-color-overlay)}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected.hover{background-color:var(--el-fill-color-light)}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected:after{content:"";position:absolute;top:50%;right:20px;border-top:none;border-right:none;background-repeat:no-repeat;background-position:center;background-color:var(--el-color-primary);-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask-size:100% 100%;-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;-webkit-mask-size:100% 100%;transform:translateY(-50%);width:12px;height:12px}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected.is-disabled:after{background-color:var(--el-text-color-disabled)}.el-select-dropdown .el-select-dropdown__option-item.is-selected:after{content:"";position:absolute;top:50%;right:20px;border-top:none;border-right:none;background-repeat:no-repeat;background-position:center;background-color:var(--el-color-primary);-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask-size:100% 100%;-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;-webkit-mask-size:100% 100%;transform:translateY(-50%);width:12px;height:12px}.el-select-dropdown .el-scrollbar.is-empty .el-select-dropdown__list{padding:0}.el-select-dropdown .el-select-dropdown__item.is-disabled:hover{background-color:unset}.el-select-dropdown .el-select-dropdown__item.is-disabled.selected{color:var(--el-text-color-disabled)}.el-select-dropdown__empty{padding:10px 0;margin:0;text-align:center;color:var(--el-text-color-secondary);font-size:var(--el-select-font-size)}.el-select-dropdown__wrap{max-height:274px}.el-select-dropdown__list{list-style:none;padding:6px 0;margin:0;box-sizing:border-box}.el-select{--el-select-border-color-hover:var(--el-border-color-hover);--el-select-disabled-border:var(--el-disabled-border-color);--el-select-font-size:var(--el-font-size-base);--el-select-close-hover-color:var(--el-text-color-secondary);--el-select-input-color:var(--el-text-color-placeholder);--el-select-multiple-input-color:var(--el-text-color-regular);--el-select-input-focus-border-color:var(--el-color-primary);--el-select-input-font-size:14px}.el-select{display:inline-block;position:relative;vertical-align:middle;line-height:32px}.el-select__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-box-shadow-light)}.el-select__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-select__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-select__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-select__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-select__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-select .el-select-tags-wrapper.has-prefix{margin-left:6px}.el-select--large{line-height:40px}.el-select--large .el-select-tags-wrapper.has-prefix{margin-left:8px}.el-select--small{line-height:24px}.el-select--small .el-select-tags-wrapper.has-prefix{margin-left:4px}.el-select .el-select__tags>span{display:inline-block}.el-select:hover:not(.el-select--disabled) .el-input__wrapper{box-shadow:0 0 0 1px var(--el-select-border-color-hover) inset}.el-select .el-select__tags-text{display:inline-block;line-height:normal;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-select .el-input__wrapper{cursor:pointer}.el-select .el-input__wrapper.is-focus{box-shadow:0 0 0 1px var(--el-select-input-focus-border-color) inset!important}.el-select .el-input__inner{cursor:pointer}.el-select .el-input{display:flex}.el-select .el-input .el-select__caret{color:var(--el-select-input-color);font-size:var(--el-select-input-font-size);transition:transform var(--el-transition-duration);transform:rotate(0);cursor:pointer}.el-select .el-input .el-select__caret.is-reverse{transform:rotate(-180deg)}.el-select .el-input .el-select__caret.is-show-close{font-size:var(--el-select-font-size);text-align:center;transform:rotate(0);border-radius:var(--el-border-radius-circle);color:var(--el-select-input-color);transition:var(--el-transition-color)}.el-select .el-input .el-select__caret.is-show-close:hover{color:var(--el-select-close-hover-color)}.el-select .el-input .el-select__caret.el-icon{position:relative;height:inherit;z-index:2}.el-select .el-input.is-disabled .el-input__wrapper{cursor:not-allowed}.el-select .el-input.is-disabled .el-input__wrapper:hover{box-shadow:0 0 0 1px var(--el-select-disabled-border) inset}.el-select .el-input.is-disabled .el-input__inner,.el-select .el-input.is-disabled .el-select__caret{cursor:not-allowed}.el-select .el-input.is-focus .el-input__wrapper{box-shadow:0 0 0 1px var(--el-select-input-focus-border-color) inset!important}.el-select__input{border:none;outline:0;padding:0;margin-left:15px;color:var(--el-select-multiple-input-color);font-size:var(--el-select-font-size);-webkit-appearance:none;-moz-appearance:none;appearance:none;height:28px;background-color:transparent}.el-select__input.is-disabled{cursor:not-allowed}.el-select__input--iOS{position:absolute;left:0;top:0;z-index:6}.el-select__input.is-small{height:14px}.el-select__close{cursor:pointer;position:absolute;top:8px;z-index:var(--el-index-top);right:25px;color:var(--el-select-input-color);line-height:18px;font-size:var(--el-select-input-font-size)}.el-select__close:hover{color:var(--el-select-close-hover-color)}.el-select__tags{position:absolute;line-height:normal;top:50%;transform:translateY(-50%);white-space:normal;z-index:var(--el-index-normal);display:flex;align-items:center;flex-wrap:wrap;cursor:pointer}.el-select__tags .el-tag{box-sizing:border-box;border-color:transparent;margin:2px 6px 2px 0}.el-select__tags .el-tag:last-child{margin-right:0}.el-select__tags .el-tag .el-icon-close{background-color:var(--el-text-color-placeholder);right:-7px;top:0;color:#fff}.el-select__tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-select__tags .el-tag .el-icon-close:before{display:block;transform:translateY(.5px)}.el-select__tags .el-tag--info{background-color:var(--el-fill-color)}.el-select__tags.is-disabled{cursor:not-allowed}.el-select__collapse-tags{white-space:normal;z-index:var(--el-index-normal);display:flex;align-items:center;flex-wrap:wrap;cursor:pointer}.el-select__collapse-tags .el-tag{box-sizing:border-box;border-color:transparent;margin:2px 6px 2px 0}.el-select__collapse-tags .el-tag:last-child{margin-right:0}.el-select__collapse-tags .el-tag .el-icon-close{background-color:var(--el-text-color-placeholder);right:-7px;top:0;color:#fff}.el-select__collapse-tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-select__collapse-tags .el-tag .el-icon-close:before{display:block;transform:translateY(.5px)}.el-select__collapse-tags .el-tag--info{background-color:var(--el-fill-color)}.el-select__collapse-tag{line-height:inherit;height:inherit;display:flex}.el-skeleton{--el-skeleton-circle-size:var(--el-avatar-size)}.el-skeleton__item{background:var(--el-skeleton-color);display:inline-block;height:16px;border-radius:var(--el-border-radius-base);width:100%}.el-skeleton__circle{border-radius:50%;width:var(--el-skeleton-circle-size);height:var(--el-skeleton-circle-size);line-height:var(--el-skeleton-circle-size)}.el-skeleton__button{height:40px;width:64px;border-radius:4px}.el-skeleton__p{width:100%}.el-skeleton__p.is-last{width:61%}.el-skeleton__p.is-first{width:33%}.el-skeleton__text{width:100%;height:var(--el-font-size-small)}.el-skeleton__caption{height:var(--el-font-size-extra-small)}.el-skeleton__h1{height:var(--el-font-size-extra-large)}.el-skeleton__h3{height:var(--el-font-size-large)}.el-skeleton__h5{height:var(--el-font-size-medium)}.el-skeleton__image{width:unset;display:flex;align-items:center;justify-content:center;border-radius:0}.el-skeleton__image svg{color:var(--el-svg-monochrome-grey);fill:currentColor;width:22%;height:22%}.el-skeleton{--el-skeleton-color:var(--el-fill-color);--el-skeleton-to-color:var(--el-fill-color-darker)}@-webkit-keyframes el-skeleton-loading{0%{background-position:100% 50%}to{background-position:0 50%}}@keyframes el-skeleton-loading{0%{background-position:100% 50%}to{background-position:0 50%}}.el-skeleton{width:100%}.el-skeleton__first-line,.el-skeleton__paragraph{height:16px;margin-top:16px;background:var(--el-skeleton-color)}.el-skeleton.is-animated .el-skeleton__item{background:linear-gradient(90deg,var(--el-skeleton-color) 25%,var(--el-skeleton-to-color) 37%,var(--el-skeleton-color) 63%);background-size:400% 100%;-webkit-animation:el-skeleton-loading 1.4s ease infinite;animation:el-skeleton-loading 1.4s ease infinite}.el-slider{--el-slider-main-bg-color:var(--el-color-primary);--el-slider-runway-bg-color:var(--el-border-color-light);--el-slider-stop-bg-color:var(--el-color-white);--el-slider-disabled-color:var(--el-text-color-placeholder);--el-slider-border-radius:3px;--el-slider-height:6px;--el-slider-button-size:20px;--el-slider-button-wrapper-size:36px;--el-slider-button-wrapper-offset:-15px}.el-slider{width:100%;height:32px;display:flex;align-items:center}.el-slider__runway{flex:1;height:var(--el-slider-height);background-color:var(--el-slider-runway-bg-color);border-radius:var(--el-slider-border-radius);position:relative;cursor:pointer}.el-slider__runway.show-input{margin-right:30px;width:auto}.el-slider__runway.is-disabled{cursor:default}.el-slider__runway.is-disabled .el-slider__bar{background-color:var(--el-slider-disabled-color)}.el-slider__runway.is-disabled .el-slider__button{border-color:var(--el-slider-disabled-color)}.el-slider__runway.is-disabled .el-slider__button-wrapper.hover,.el-slider__runway.is-disabled .el-slider__button-wrapper:hover,.el-slider__runway.is-disabled .el-slider__button-wrapper.dragging{cursor:not-allowed}.el-slider__runway.is-disabled .el-slider__button.dragging,.el-slider__runway.is-disabled .el-slider__button.hover,.el-slider__runway.is-disabled .el-slider__button:hover{transform:scale(1)}.el-slider__runway.is-disabled .el-slider__button.hover,.el-slider__runway.is-disabled .el-slider__button:hover,.el-slider__runway.is-disabled .el-slider__button.dragging{cursor:not-allowed}.el-slider__input{flex-shrink:0;width:130px}.el-slider__bar{height:var(--el-slider-height);background-color:var(--el-slider-main-bg-color);border-top-left-radius:var(--el-slider-border-radius);border-bottom-left-radius:var(--el-slider-border-radius);position:absolute}.el-slider__button-wrapper{height:var(--el-slider-button-wrapper-size);width:var(--el-slider-button-wrapper-size);position:absolute;z-index:1;top:var(--el-slider-button-wrapper-offset);transform:translate(-50%);background-color:transparent;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;line-height:normal;outline:0}.el-slider__button-wrapper:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-slider__button-wrapper.hover,.el-slider__button-wrapper:hover{cursor:-webkit-grab;cursor:grab}.el-slider__button-wrapper.dragging{cursor:-webkit-grabbing;cursor:grabbing}.el-slider__button{display:inline-block;width:var(--el-slider-button-size);height:var(--el-slider-button-size);vertical-align:middle;border:solid 2px var(--el-slider-main-bg-color);background-color:var(--el-color-white);border-radius:50%;box-sizing:border-box;transition:var(--el-transition-duration-fast);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-slider__button.dragging,.el-slider__button.hover,.el-slider__button:hover{transform:scale(1.2)}.el-slider__button.hover,.el-slider__button:hover{cursor:-webkit-grab;cursor:grab}.el-slider__button.dragging{cursor:-webkit-grabbing;cursor:grabbing}.el-slider__stop{position:absolute;height:var(--el-slider-height);width:var(--el-slider-height);border-radius:var(--el-border-radius-circle);background-color:var(--el-slider-stop-bg-color);transform:translate(-50%)}.el-slider__marks{top:0;left:12px;width:18px;height:100%}.el-slider__marks-text{position:absolute;transform:translate(-50%);font-size:14px;color:var(--el-color-info);margin-top:15px;white-space:pre}.el-slider.is-vertical{position:relative;display:inline-flex;width:auto;height:100%;flex:0}.el-slider.is-vertical .el-slider__runway{width:var(--el-slider-height);height:100%;margin:0 16px}.el-slider.is-vertical .el-slider__bar{width:var(--el-slider-height);height:auto;border-radius:0 0 3px 3px}.el-slider.is-vertical .el-slider__button-wrapper{top:auto;left:var(--el-slider-button-wrapper-offset);transform:translateY(50%)}.el-slider.is-vertical .el-slider__stop{transform:translateY(50%)}.el-slider.is-vertical .el-slider__marks-text{margin-top:0;left:15px;transform:translateY(50%)}.el-slider--large{height:40px}.el-slider--small{height:24px}.el-space{display:inline-flex;vertical-align:top}.el-space__item{display:flex;flex-wrap:wrap}.el-space__item>*{flex:1}.el-space--vertical{flex-direction:column}.el-time-spinner{width:100%;white-space:nowrap}.el-spinner{display:inline-block;vertical-align:middle}.el-spinner-inner{-webkit-animation:rotate 2s linear infinite;animation:rotate 2s linear infinite;width:50px;height:50px}.el-spinner-inner .path{stroke:var(--el-border-color-lighter);stroke-linecap:round;-webkit-animation:dash 1.5s ease-in-out infinite;animation:dash 1.5s ease-in-out infinite}@-webkit-keyframes rotate{to{transform:rotate(360deg)}}@keyframes rotate{to{transform:rotate(360deg)}}@-webkit-keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}.el-step{position:relative;flex-shrink:1}.el-step:last-of-type .el-step__line{display:none}.el-step:last-of-type.is-flex{flex-basis:auto!important;flex-shrink:0;flex-grow:0}.el-step:last-of-type .el-step__description,.el-step:last-of-type .el-step__main{padding-right:0}.el-step__head{position:relative;width:100%}.el-step__head.is-process{color:var(--el-text-color-primary);border-color:var(--el-text-color-primary)}.el-step__head.is-wait{color:var(--el-text-color-placeholder);border-color:var(--el-text-color-placeholder)}.el-step__head.is-success{color:var(--el-color-success);border-color:var(--el-color-success)}.el-step__head.is-error{color:var(--el-color-danger);border-color:var(--el-color-danger)}.el-step__head.is-finish{color:var(--el-color-primary);border-color:var(--el-color-primary)}.el-step__icon{position:relative;z-index:1;display:inline-flex;justify-content:center;align-items:center;width:24px;height:24px;font-size:14px;box-sizing:border-box;background:var(--el-bg-color);transition:.15s ease-out}.el-step__icon.is-text{border-radius:50%;border:2px solid;border-color:inherit}.el-step__icon.is-icon{width:40px}.el-step__icon-inner{display:inline-block;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-align:center;font-weight:700;line-height:1;color:inherit}.el-step__icon-inner[class*=el-icon]:not(.is-status){font-size:25px;font-weight:400}.el-step__icon-inner.is-status{transform:translateY(1px)}.el-step__line{position:absolute;border-color:inherit;background-color:var(--el-text-color-placeholder)}.el-step__line-inner{display:block;border-width:1px;border-style:solid;border-color:inherit;transition:.15s ease-out;box-sizing:border-box;width:0;height:0}.el-step__main{white-space:normal;text-align:left}.el-step__title{font-size:16px;line-height:38px}.el-step__title.is-process{font-weight:700;color:var(--el-text-color-primary)}.el-step__title.is-wait{color:var(--el-text-color-placeholder)}.el-step__title.is-success{color:var(--el-color-success)}.el-step__title.is-error{color:var(--el-color-danger)}.el-step__title.is-finish{color:var(--el-color-primary)}.el-step__description{padding-right:10%;margin-top:-5px;font-size:12px;line-height:20px;font-weight:400}.el-step__description.is-process{color:var(--el-text-color-primary)}.el-step__description.is-wait{color:var(--el-text-color-placeholder)}.el-step__description.is-success{color:var(--el-color-success)}.el-step__description.is-error{color:var(--el-color-danger)}.el-step__description.is-finish{color:var(--el-color-primary)}.el-step.is-horizontal{display:inline-block}.el-step.is-horizontal .el-step__line{height:2px;top:11px;left:0;right:0}.el-step.is-vertical{display:flex}.el-step.is-vertical .el-step__head{flex-grow:0;width:24px}.el-step.is-vertical .el-step__main{padding-left:10px;flex-grow:1}.el-step.is-vertical .el-step__title{line-height:24px;padding-bottom:8px}.el-step.is-vertical .el-step__line{width:2px;top:0;bottom:0;left:11px}.el-step.is-vertical .el-step__icon.is-icon{width:24px}.el-step.is-center .el-step__head,.el-step.is-center .el-step__main{text-align:center}.el-step.is-center .el-step__description{padding-left:20%;padding-right:20%}.el-step.is-center .el-step__line{left:50%;right:-50%}.el-step.is-simple{display:flex;align-items:center}.el-step.is-simple .el-step__head{width:auto;font-size:0;padding-right:10px}.el-step.is-simple .el-step__icon{background:0 0;width:16px;height:16px;font-size:12px}.el-step.is-simple .el-step__icon-inner[class*=el-icon]:not(.is-status){font-size:18px}.el-step.is-simple .el-step__icon-inner.is-status{transform:scale(.8) translateY(1px)}.el-step.is-simple .el-step__main{position:relative;display:flex;align-items:stretch;flex-grow:1}.el-step.is-simple .el-step__title{font-size:16px;line-height:20px}.el-step.is-simple:not(:last-of-type) .el-step__title{max-width:50%;word-break:break-all}.el-step.is-simple .el-step__arrow{flex-grow:1;display:flex;align-items:center;justify-content:center}.el-step.is-simple .el-step__arrow:after,.el-step.is-simple .el-step__arrow:before{content:"";display:inline-block;position:absolute;height:15px;width:1px;background:var(--el-text-color-placeholder)}.el-step.is-simple .el-step__arrow:before{transform:rotate(-45deg) translateY(-4px);transform-origin:0 0}.el-step.is-simple .el-step__arrow:after{transform:rotate(45deg) translateY(4px);transform-origin:100% 100%}.el-step.is-simple:last-of-type .el-step__arrow{display:none}.el-steps{display:flex}.el-steps--simple{padding:13px 8%;border-radius:4px;background:var(--el-fill-color-light)}.el-steps--horizontal{white-space:nowrap}.el-steps--vertical{height:100%;flex-flow:column}.el-switch{--el-switch-on-color:var(--el-color-primary);--el-switch-off-color:var(--el-border-color)}.el-switch{display:inline-flex;align-items:center;position:relative;font-size:14px;line-height:20px;height:32px;vertical-align:middle}.el-switch.is-disabled .el-switch__core,.el-switch.is-disabled .el-switch__label{cursor:not-allowed}.el-switch__label{transition:var(--el-transition-duration-fast);height:20px;display:inline-block;font-size:14px;font-weight:500;cursor:pointer;vertical-align:middle;color:var(--el-text-color-primary)}.el-switch__label.is-active{color:var(--el-color-primary)}.el-switch__label--left{margin-right:10px}.el-switch__label--right{margin-left:10px}.el-switch__label *{line-height:1;font-size:14px;display:inline-block}.el-switch__label .el-icon{height:inherit}.el-switch__label .el-icon svg{vertical-align:middle}.el-switch__input{position:absolute;width:0;height:0;opacity:0;margin:0}.el-switch__input:focus-visible~.el-switch__core{outline:2px solid var(--el-switch-on-color);outline-offset:1px}.el-switch__core{display:inline-flex;position:relative;align-items:center;min-width:40px;height:20px;border:1px solid var(--el-switch-border-color,var(--el-switch-off-color));outline:0;border-radius:10px;box-sizing:border-box;background:var(--el-switch-off-color);cursor:pointer;transition:border-color var(--el-transition-duration),background-color var(--el-transition-duration)}.el-switch__core .el-switch__inner{width:100%;transition:all var(--el-transition-duration);height:16px;display:flex;justify-content:center;align-items:center;overflow:hidden;padding:0 4px 0 18px}.el-switch__core .el-switch__inner .is-icon,.el-switch__core .el-switch__inner .is-text{font-size:12px;color:var(--el-color-white);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-switch__core .el-switch__action{position:absolute;left:1px;border-radius:var(--el-border-radius-circle);transition:all var(--el-transition-duration);width:16px;height:16px;background-color:var(--el-color-white);display:flex;justify-content:center;align-items:center;color:var(--el-switch-off-color)}.el-switch.is-checked .el-switch__core{border-color:var(--el-switch-border-color,var(--el-switch-on-color));background-color:var(--el-switch-on-color)}.el-switch.is-checked .el-switch__core .el-switch__action{left:calc(100% - 17px);color:var(--el-switch-on-color)}.el-switch.is-checked .el-switch__core .el-switch__inner{padding:0 18px 0 4px}.el-switch.is-disabled{opacity:.6}.el-switch--wide .el-switch__label.el-switch__label--left span{left:10px}.el-switch--wide .el-switch__label.el-switch__label--right span{right:10px}.el-switch .label-fade-enter-from,.el-switch .label-fade-leave-active{opacity:0}.el-switch--large{font-size:14px;line-height:24px;height:40px}.el-switch--large .el-switch__label{height:24px;font-size:14px}.el-switch--large .el-switch__label *{font-size:14px}.el-switch--large .el-switch__core{min-width:50px;height:24px;border-radius:12px}.el-switch--large .el-switch__core .el-switch__inner{height:20px;padding:0 6px 0 22px}.el-switch--large .el-switch__core .el-switch__action{width:20px;height:20px}.el-switch--large.is-checked .el-switch__core .el-switch__action{left:calc(100% - 21px)}.el-switch--large.is-checked .el-switch__core .el-switch__inner{padding:0 22px 0 6px}.el-switch--small{font-size:12px;line-height:16px;height:24px}.el-switch--small .el-switch__label{height:16px;font-size:12px}.el-switch--small .el-switch__label *{font-size:12px}.el-switch--small .el-switch__core{min-width:30px;height:16px;border-radius:8px}.el-switch--small .el-switch__core .el-switch__inner{height:12px;padding:0 2px 0 14px}.el-switch--small .el-switch__core .el-switch__action{width:12px;height:12px}.el-switch--small.is-checked .el-switch__core .el-switch__action{left:calc(100% - 13px)}.el-switch--small.is-checked .el-switch__core .el-switch__inner{padding:0 14px 0 2px}.el-table-column--selection .cell{padding-left:14px;padding-right:14px}.el-table-filter{border:solid 1px var(--el-border-color-lighter);border-radius:2px;background-color:#fff;box-shadow:var(--el-box-shadow-light);box-sizing:border-box}.el-table-filter__list{padding:5px 0;margin:0;list-style:none;min-width:100px}.el-table-filter__list-item{line-height:36px;padding:0 10px;cursor:pointer;font-size:var(--el-font-size-base)}.el-table-filter__list-item:hover{background-color:var(--el-color-primary-light-9);color:var(--el-color-primary)}.el-table-filter__list-item.is-active{background-color:var(--el-color-primary);color:#fff}.el-table-filter__content{min-width:100px}.el-table-filter__bottom{border-top:1px solid var(--el-border-color-lighter);padding:8px}.el-table-filter__bottom button{background:0 0;border:none;color:var(--el-text-color-regular);cursor:pointer;font-size:var(--el-font-size-small);padding:0 3px}.el-table-filter__bottom button:hover{color:var(--el-color-primary)}.el-table-filter__bottom button:focus{outline:0}.el-table-filter__bottom button.is-disabled{color:var(--el-disabled-text-color);cursor:not-allowed}.el-table-filter__wrap{max-height:280px}.el-table-filter__checkbox-group{padding:10px}.el-table-filter__checkbox-group label.el-checkbox{display:flex;align-items:center;margin-right:5px;margin-bottom:12px;margin-left:5px;height:unset}.el-table-filter__checkbox-group .el-checkbox:last-child{margin-bottom:0}.el-table{--el-table-border-color:var(--el-border-color-lighter);--el-table-border:1px solid var(--el-table-border-color);--el-table-text-color:var(--el-text-color-regular);--el-table-header-text-color:var(--el-text-color-secondary);--el-table-row-hover-bg-color:var(--el-fill-color-light);--el-table-current-row-bg-color:var(--el-color-primary-light-9);--el-table-header-bg-color:var(--el-bg-color);--el-table-fixed-box-shadow:var(--el-box-shadow-light);--el-table-bg-color:var(--el-fill-color-blank);--el-table-tr-bg-color:var(--el-fill-color-blank);--el-table-expanded-cell-bg-color:var(--el-fill-color-blank);--el-table-fixed-left-column:inset 10px 0 10px -10px rgba(0, 0, 0, .15);--el-table-fixed-right-column:inset -10px 0 10px -10px rgba(0, 0, 0, .15)}.el-table{position:relative;overflow:hidden;box-sizing:border-box;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:100%;max-width:100%;background-color:var(--el-table-bg-color);font-size:14px;color:var(--el-table-text-color)}.el-table__inner-wrapper{position:relative;display:flex;flex-direction:column;height:100%}.el-table__inner-wrapper:before{left:0;bottom:0;width:100%;height:1px}.el-table.has-footer.el-table--fluid-height tr:last-child td.el-table__cell,.el-table.has-footer.el-table--scrollable-y tr:last-child td.el-table__cell{border-bottom-color:transparent}.el-table__empty-block{position:-webkit-sticky;position:sticky;left:0;min-height:60px;text-align:center;width:100%;display:flex;justify-content:center;align-items:center}.el-table__empty-text{line-height:60px;width:50%;color:var(--el-text-color-secondary)}.el-table__expand-column .cell{padding:0;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-table__expand-icon{position:relative;cursor:pointer;color:var(--el-text-color-regular);font-size:12px;transition:transform var(--el-transition-duration-fast) ease-in-out;height:20px}.el-table__expand-icon--expanded{transform:rotate(90deg)}.el-table__expand-icon>.el-icon{font-size:12px}.el-table__expanded-cell{background-color:var(--el-table-expanded-cell-bg-color)}.el-table__expanded-cell[class*=cell]{padding:20px 50px}.el-table__expanded-cell:hover{background-color:transparent!important}.el-table__placeholder{display:inline-block;width:20px}.el-table__append-wrapper{overflow:hidden}.el-table--fit{border-right:0;border-bottom:0}.el-table--fit .el-table__cell.gutter{border-right-width:1px}.el-table thead{color:var(--el-table-header-text-color);font-weight:500}.el-table thead.is-group th.el-table__cell{background:var(--el-fill-color-light)}.el-table .el-table__cell{padding:8px 0;min-width:0;box-sizing:border-box;text-overflow:ellipsis;vertical-align:middle;position:relative;text-align:left;z-index:1}.el-table .el-table__cell.is-center{text-align:center}.el-table .el-table__cell.is-right{text-align:right}.el-table .el-table__cell.gutter{width:15px;border-right-width:0;border-bottom-width:0;padding:0}.el-table .el-table__cell.is-hidden>*{visibility:hidden}.el-table .cell{box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:normal;word-break:break-all;line-height:23px;padding:0 12px}.el-table .cell.el-tooltip{white-space:nowrap;min-width:50px}.el-table--large{font-size:var(--el-font-size-base)}.el-table--large .el-table__cell{padding:12px 0}.el-table--large .cell{padding:0 16px}.el-table--default{font-size:14px}.el-table--default .el-table__cell{padding:8px 0}.el-table--default .cell{padding:0 12px}.el-table--small{font-size:12px}.el-table--small .el-table__cell{padding:4px 0}.el-table--small .cell{padding:0 8px}.el-table tr{background-color:var(--el-table-tr-bg-color)}.el-table tr input[type=checkbox]{margin:0}.el-table td.el-table__cell,.el-table th.el-table__cell.is-leaf{border-bottom:var(--el-table-border)}.el-table th.el-table__cell.is-sortable{cursor:pointer}.el-table th.el-table__cell{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:var(--el-table-header-bg-color)}.el-table th.el-table__cell>.cell.highlight{color:var(--el-color-primary)}.el-table th.el-table__cell.required>div:before{display:inline-block;content:"";width:8px;height:8px;border-radius:50%;background:#ff4d51;margin-right:5px;vertical-align:middle}.el-table td.el-table__cell div{box-sizing:border-box}.el-table td.el-table__cell.gutter{width:0}.el-table__footer-wrapper{border-top:var(--el-table-border)}.el-table--border .el-table__inner-wrapper:after,.el-table--border:after,.el-table--border:before,.el-table__inner-wrapper:before{content:"";position:absolute;background-color:var(--el-table-border-color);z-index:3}.el-table--border .el-table__inner-wrapper:after{left:0;top:0;width:100%;height:1px}.el-table--border:before{top:-1px;left:0;width:1px;height:100%}.el-table--border:after{top:-1px;right:0;width:1px;height:100%}.el-table--border .el-table__inner-wrapper{border-right:none;border-bottom:none}.el-table--border .el-table__footer-wrapper{position:relative;flex-shrink:0}.el-table--border .el-table__cell{border-right:var(--el-table-border)}.el-table--border th.el-table__cell.gutter:last-of-type{border-bottom:var(--el-table-border);border-bottom-width:1px}.el-table--border th.el-table__cell{border-bottom:var(--el-table-border)}.el-table--hidden{visibility:hidden}.el-table__body-wrapper,.el-table__footer-wrapper,.el-table__header-wrapper{width:100%}.el-table__body-wrapper tr td.el-table-fixed-column--left,.el-table__body-wrapper tr td.el-table-fixed-column--right,.el-table__body-wrapper tr th.el-table-fixed-column--left,.el-table__body-wrapper tr th.el-table-fixed-column--right,.el-table__footer-wrapper tr td.el-table-fixed-column--left,.el-table__footer-wrapper tr td.el-table-fixed-column--right,.el-table__footer-wrapper tr th.el-table-fixed-column--left,.el-table__footer-wrapper tr th.el-table-fixed-column--right,.el-table__header-wrapper tr td.el-table-fixed-column--left,.el-table__header-wrapper tr td.el-table-fixed-column--right,.el-table__header-wrapper tr th.el-table-fixed-column--left,.el-table__header-wrapper tr th.el-table-fixed-column--right{position:-webkit-sticky!important;position:sticky!important;z-index:2;background:var(--el-bg-color)}.el-table__body-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-last-column:before{content:"";position:absolute;top:0;width:10px;bottom:-1px;overflow-x:hidden;overflow-y:hidden;box-shadow:none;touch-action:none;pointer-events:none}.el-table__body-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-first-column:before{left:-10px}.el-table__body-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-last-column:before{right:-10px;box-shadow:none}.el-table__body-wrapper tr td.el-table__fixed-right-patch,.el-table__body-wrapper tr th.el-table__fixed-right-patch,.el-table__footer-wrapper tr td.el-table__fixed-right-patch,.el-table__footer-wrapper tr th.el-table__fixed-right-patch,.el-table__header-wrapper tr td.el-table__fixed-right-patch,.el-table__header-wrapper tr th.el-table__fixed-right-patch{position:-webkit-sticky!important;position:sticky!important;z-index:2;background:#fff;right:0}.el-table__header-wrapper{flex-shrink:0}.el-table__header-wrapper tr th.el-table-fixed-column--left,.el-table__header-wrapper tr th.el-table-fixed-column--right{background-color:var(--el-table-header-bg-color)}.el-table__body,.el-table__footer,.el-table__header{table-layout:fixed;border-collapse:separate}.el-table__footer-wrapper,.el-table__header-wrapper{overflow:hidden}.el-table__footer-wrapper tbody td.el-table__cell,.el-table__header-wrapper tbody td.el-table__cell{background-color:var(--el-table-row-hover-bg-color);color:var(--el-table-text-color)}.el-table__body-wrapper .el-table-column--selection>.cell,.el-table__header-wrapper .el-table-column--selection>.cell{display:inline-flex;align-items:center;height:23px}.el-table__body-wrapper .el-table-column--selection .el-checkbox,.el-table__header-wrapper .el-table-column--selection .el-checkbox{height:unset}.el-table.is-scrolling-left .el-table-fixed-column--right.is-first-column:before{box-shadow:var(--el-table-fixed-right-column)}.el-table.is-scrolling-left.el-table--border .el-table-fixed-column--left.is-last-column.el-table__cell{border-right:var(--el-table-border)}.el-table.is-scrolling-left th.el-table-fixed-column--left{background-color:var(--el-table-header-bg-color)}.el-table.is-scrolling-right .el-table-fixed-column--left.is-last-column:before{box-shadow:var(--el-table-fixed-left-column)}.el-table.is-scrolling-right .el-table-fixed-column--left.is-last-column.el-table__cell{border-right:none}.el-table.is-scrolling-right th.el-table-fixed-column--right{background-color:var(--el-table-header-bg-color)}.el-table.is-scrolling-middle .el-table-fixed-column--left.is-last-column.el-table__cell{border-right:none}.el-table.is-scrolling-middle .el-table-fixed-column--right.is-first-column:before{box-shadow:var(--el-table-fixed-right-column)}.el-table.is-scrolling-middle .el-table-fixed-column--left.is-last-column:before{box-shadow:var(--el-table-fixed-left-column)}.el-table.is-scrolling-none .el-table-fixed-column--left.is-first-column:before,.el-table.is-scrolling-none .el-table-fixed-column--left.is-last-column:before,.el-table.is-scrolling-none .el-table-fixed-column--right.is-first-column:before,.el-table.is-scrolling-none .el-table-fixed-column--right.is-last-column:before{box-shadow:none}.el-table.is-scrolling-none th.el-table-fixed-column--left,.el-table.is-scrolling-none th.el-table-fixed-column--right{background-color:var(--el-table-header-bg-color)}.el-table__body-wrapper{overflow:hidden;position:relative;flex:1}.el-table__body-wrapper .el-scrollbar__bar{z-index:2}.el-table .caret-wrapper{display:inline-flex;flex-direction:column;align-items:center;height:14px;width:24px;vertical-align:middle;cursor:pointer;overflow:initial;position:relative}.el-table .sort-caret{width:0;height:0;border:solid 5px transparent;position:absolute;left:7px}.el-table .sort-caret.ascending{border-bottom-color:var(--el-text-color-placeholder);top:-5px}.el-table .sort-caret.descending{border-top-color:var(--el-text-color-placeholder);bottom:-3px}.el-table .ascending .sort-caret.ascending{border-bottom-color:var(--el-color-primary)}.el-table .descending .sort-caret.descending{border-top-color:var(--el-color-primary)}.el-table .hidden-columns{visibility:hidden;position:absolute;z-index:-1}.el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell{background:var(--el-fill-color-lighter)}.el-table--striped .el-table__body tr.el-table__row--striped.current-row td.el-table__cell{background-color:var(--el-table-current-row-bg-color)}.el-table__body tr.hover-row.current-row>td.el-table__cell,.el-table__body tr.hover-row.el-table__row--striped.current-row>td.el-table__cell,.el-table__body tr.hover-row.el-table__row--striped>td.el-table__cell,.el-table__body tr.hover-row>td.el-table__cell{background-color:var(--el-table-row-hover-bg-color)}.el-table__body tr.current-row>td.el-table__cell{background-color:var(--el-table-current-row-bg-color)}.el-table__column-resize-proxy{position:absolute;left:200px;top:0;bottom:0;width:0;border-left:var(--el-table-border);z-index:10}.el-table__column-filter-trigger{display:inline-block;cursor:pointer}.el-table__column-filter-trigger i{color:var(--el-color-info);font-size:14px;vertical-align:middle}.el-table__border-left-patch{top:0;left:0;width:1px;height:100%;z-index:3;position:absolute;background-color:var(--el-table-border-color)}.el-table__border-bottom-patch{left:0;height:1px;z-index:3;position:absolute;background-color:var(--el-table-border-color)}.el-table__border-right-patch{top:0;height:100%;width:1px;z-index:3;position:absolute;background-color:var(--el-table-border-color)}.el-table--enable-row-transition .el-table__body td.el-table__cell{transition:background-color .25s ease}.el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell{background-color:var(--el-table-row-hover-bg-color)}.el-table [class*=el-table__row--level] .el-table__expand-icon{display:inline-block;width:12px;line-height:12px;height:12px;text-align:center;margin-right:8px}.el-table .el-table.el-table--border .el-table__cell{border-right:var(--el-table-border)}.el-table:not(.el-table--border) .el-table__cell{border-right:none}.el-table:not(.el-table--border)>.el-table__inner-wrapper:after{content:none}.el-table-v2{--el-table-border-color:var(--el-border-color-lighter);--el-table-border:1px solid var(--el-table-border-color);--el-table-text-color:var(--el-text-color-regular);--el-table-header-text-color:var(--el-text-color-secondary);--el-table-row-hover-bg-color:var(--el-fill-color-light);--el-table-current-row-bg-color:var(--el-color-primary-light-9);--el-table-header-bg-color:var(--el-bg-color);--el-table-fixed-box-shadow:var(--el-box-shadow-light);--el-table-bg-color:var(--el-fill-color-blank);--el-table-tr-bg-color:var(--el-fill-color-blank);--el-table-expanded-cell-bg-color:var(--el-fill-color-blank);--el-table-fixed-left-column:inset 10px 0 10px -10px rgba(0, 0, 0, .15);--el-table-fixed-right-column:inset -10px 0 10px -10px rgba(0, 0, 0, .15)}.el-table-v2{font-size:14px}.el-table-v2 *{box-sizing:border-box}.el-table-v2__root{position:relative}.el-table-v2__root:hover .el-table-v2__main .el-virtual-scrollbar{opacity:1}.el-table-v2__main{display:flex;flex-direction:column-reverse;position:absolute;overflow:hidden;top:0;background-color:var(--el-bg-color);left:0}.el-table-v2__main .el-vl__horizontal,.el-table-v2__main .el-vl__vertical{z-index:2}.el-table-v2__left{display:flex;flex-direction:column-reverse;position:absolute;overflow:hidden;top:0;background-color:var(--el-bg-color);left:0;box-shadow:2px 0 4px #0000000f}.el-table-v2__left .el-virtual-scrollbar{opacity:0}.el-table-v2__left .el-vl__horizontal,.el-table-v2__left .el-vl__vertical{z-index:-1}.el-table-v2__right{display:flex;flex-direction:column-reverse;position:absolute;overflow:hidden;top:0;background-color:var(--el-bg-color);right:0;box-shadow:-2px 0 4px #0000000f}.el-table-v2__right .el-virtual-scrollbar{opacity:0}.el-table-v2__right .el-vl__horizontal,.el-table-v2__right .el-vl__vertical{z-index:-1}.el-table-v2__header-row,.el-table-v2__row{-webkit-padding-end:var(--el-table-scrollbar-size);padding-inline-end:var(--el-table-scrollbar-size)}.el-table-v2__header-wrapper{overflow:hidden}.el-table-v2__header{position:relative;overflow:hidden}.el-table-v2__footer{position:absolute;left:0;right:0;bottom:0;overflow:hidden}.el-table-v2__empty{position:absolute;left:0}.el-table-v2__overlay{position:absolute;left:0;right:0;top:0;bottom:0;z-index:9999}.el-table-v2__header-row{display:flex;border-bottom:var(--el-table-border)}.el-table-v2__header-cell{display:flex;align-items:center;padding:0 8px;height:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;background-color:var(--el-table-header-bg-color);color:var(--el-table-header-text-color);font-weight:700}.el-table-v2__header-cell.is-align-center{justify-content:center;text-align:center}.el-table-v2__header-cell.is-align-right{justify-content:flex-end;text-align:right}.el-table-v2__header-cell.is-sortable{cursor:pointer}.el-table-v2__header-cell:hover .el-icon{display:block}.el-table-v2__sort-icon{transition:opacity,display var(--el-transition-duration);opacity:.6;display:none}.el-table-v2__sort-icon.is-sorting{display:block;opacity:1}.el-table-v2__row{border-bottom:var(--el-table-border);display:flex;align-items:center;transition:background-color var(--el-transition-duration)}.el-table-v2__row.is-hovered,.el-table-v2__row:hover{background-color:var(--el-table-row-hover-bg-color)}.el-table-v2__row-cell{height:100%;overflow:hidden;display:flex;align-items:center;padding:0 8px}.el-table-v2__row-cell.is-align-center{justify-content:center;text-align:center}.el-table-v2__row-cell.is-align-right{justify-content:flex-end;text-align:right}.el-table-v2__expand-icon{margin:0 4px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-table-v2__expand-icon svg{transition:transform var(--el-transition-duration)}.el-table-v2__expand-icon.is-expanded svg{transform:rotate(90deg)}.el-table-v2:not(.is-dynamic) .el-table-v2__cell-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-table-v2.is-dynamic .el-table-v2__row{overflow:hidden;align-items:stretch}.el-table-v2.is-dynamic .el-table-v2__row .el-table-v2__row-cell{word-break:break-all}.el-tabs{--el-tabs-header-height:40px}.el-tabs__header{padding:0;position:relative;margin:0 0 15px}.el-tabs__active-bar{position:absolute;bottom:0;left:0;height:2px;background-color:var(--el-color-primary);z-index:1;transition:width var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier),transform var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);list-style:none}.el-tabs__new-tab{display:flex;align-items:center;justify-content:center;float:right;border:1px solid var(--el-border-color);height:20px;width:20px;line-height:20px;margin:10px 0 10px 10px;border-radius:3px;text-align:center;font-size:12px;color:var(--el-text-color-primary);cursor:pointer;transition:all .15s}.el-tabs__new-tab .is-icon-plus{height:inherit;width:inherit;transform:scale(.8)}.el-tabs__new-tab .is-icon-plus svg{vertical-align:middle}.el-tabs__new-tab:hover{color:var(--el-color-primary)}.el-tabs__nav-wrap{overflow:hidden;margin-bottom:-1px;position:relative}.el-tabs__nav-wrap:after{content:"";position:absolute;left:0;bottom:0;width:100%;height:2px;background-color:var(--el-border-color-light);z-index:var(--el-index-normal)}.el-tabs__nav-wrap.is-scrollable{padding:0 20px;box-sizing:border-box}.el-tabs__nav-scroll{overflow:hidden}.el-tabs__nav-next,.el-tabs__nav-prev{position:absolute;cursor:pointer;line-height:44px;font-size:12px;color:var(--el-text-color-secondary);width:20px;text-align:center}.el-tabs__nav-next{right:0}.el-tabs__nav-prev{left:0}.el-tabs__nav{display:flex;white-space:nowrap;position:relative;transition:transform var(--el-transition-duration);float:left;z-index:calc(var(--el-index-normal) + 1)}.el-tabs__nav.is-stretch{min-width:100%;display:flex}.el-tabs__nav.is-stretch>*{flex:1;text-align:center}.el-tabs__item{padding:0 20px;height:var(--el-tabs-header-height);box-sizing:border-box;display:flex;align-items:center;justify-content:center;list-style:none;font-size:var(--el-font-size-base);font-weight:500;color:var(--el-text-color-primary);position:relative}.el-tabs__item:focus,.el-tabs__item:focus:active{outline:0}.el-tabs__item:focus-visible{box-shadow:0 0 2px 2px var(--el-color-primary) inset;border-radius:3px}.el-tabs__item .is-icon-close{border-radius:50%;text-align:center;transition:all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);margin-left:5px}.el-tabs__item .is-icon-close:before{transform:scale(.9);display:inline-block}.el-tabs__item .is-icon-close:hover{background-color:var(--el-text-color-placeholder);color:#fff}.el-tabs__item.is-active{color:var(--el-color-primary)}.el-tabs__item:hover{color:var(--el-color-primary);cursor:pointer}.el-tabs__item.is-disabled{color:var(--el-disabled-text-color);cursor:not-allowed}.el-tabs__content{overflow:hidden;position:relative}.el-tabs--card>.el-tabs__header{border-bottom:1px solid var(--el-border-color-light);height:var(--el-tabs-header-height)}.el-tabs--card>.el-tabs__header .el-tabs__nav-wrap:after{content:none}.el-tabs--card>.el-tabs__header .el-tabs__nav{border:1px solid var(--el-border-color-light);border-bottom:none;border-radius:4px 4px 0 0;box-sizing:border-box}.el-tabs--card>.el-tabs__header .el-tabs__active-bar{display:none}.el-tabs--card>.el-tabs__header .el-tabs__item .is-icon-close{position:relative;font-size:12px;width:0;height:14px;overflow:hidden;right:-2px;transform-origin:100% 50%}.el-tabs--card>.el-tabs__header .el-tabs__item{border-bottom:1px solid transparent;border-left:1px solid var(--el-border-color-light);transition:color var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier),padding var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier)}.el-tabs--card>.el-tabs__header .el-tabs__item:first-child{border-left:none}.el-tabs--card>.el-tabs__header .el-tabs__item.is-closable:hover{padding-left:13px;padding-right:13px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-closable:hover .is-icon-close{width:14px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active{border-bottom-color:var(--el-bg-color)}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active.is-closable{padding-left:20px;padding-right:20px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active.is-closable .is-icon-close{width:14px}.el-tabs--border-card{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color)}.el-tabs--border-card>.el-tabs__content{padding:15px}.el-tabs--border-card>.el-tabs__header{background-color:var(--el-fill-color-light);border-bottom:1px solid var(--el-border-color-light);margin:0}.el-tabs--border-card>.el-tabs__header .el-tabs__nav-wrap:after{content:none}.el-tabs--border-card>.el-tabs__header .el-tabs__item{transition:all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);border:1px solid transparent;margin-top:-1px;color:var(--el-text-color-secondary)}.el-tabs--border-card>.el-tabs__header .el-tabs__item:first-child{margin-left:-1px}.el-tabs--border-card>.el-tabs__header .el-tabs__item+.el-tabs__item{margin-left:-1px}.el-tabs--border-card>.el-tabs__header .el-tabs__item.is-active{color:var(--el-color-primary);background-color:var(--el-bg-color-overlay);border-right-color:var(--el-border-color);border-left-color:var(--el-border-color)}.el-tabs--border-card>.el-tabs__header .el-tabs__item:not(.is-disabled):hover{color:var(--el-color-primary)}.el-tabs--border-card>.el-tabs__header .el-tabs__item.is-disabled{color:var(--el-disabled-text-color)}.el-tabs--border-card>.el-tabs__header .is-scrollable .el-tabs__item:first-child{margin-left:0}.el-tabs--bottom .el-tabs__item.is-bottom:nth-child(2),.el-tabs--bottom .el-tabs__item.is-top:nth-child(2),.el-tabs--top .el-tabs__item.is-bottom:nth-child(2),.el-tabs--top .el-tabs__item.is-top:nth-child(2){padding-left:0}.el-tabs--bottom .el-tabs__item.is-bottom:last-child,.el-tabs--bottom .el-tabs__item.is-top:last-child,.el-tabs--top .el-tabs__item.is-bottom:last-child,.el-tabs--top .el-tabs__item.is-top:last-child{padding-right:0}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2){padding-left:20px}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover{padding-left:13px}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:last-child{padding-right:20px}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover{padding-right:13px}.el-tabs--bottom .el-tabs__header.is-bottom{margin-bottom:0;margin-top:10px}.el-tabs--bottom.el-tabs--border-card .el-tabs__header.is-bottom{border-bottom:0;border-top:1px solid var(--el-border-color)}.el-tabs--bottom.el-tabs--border-card .el-tabs__nav-wrap.is-bottom{margin-top:-1px;margin-bottom:0}.el-tabs--bottom.el-tabs--border-card .el-tabs__item.is-bottom:not(.is-active){border:1px solid transparent}.el-tabs--bottom.el-tabs--border-card .el-tabs__item.is-bottom{margin:0 -1px -1px}.el-tabs--left,.el-tabs--right{overflow:hidden}.el-tabs--left .el-tabs__header.is-left,.el-tabs--left .el-tabs__header.is-right,.el-tabs--left .el-tabs__nav-scroll,.el-tabs--left .el-tabs__nav-wrap.is-left,.el-tabs--left .el-tabs__nav-wrap.is-right,.el-tabs--right .el-tabs__header.is-left,.el-tabs--right .el-tabs__header.is-right,.el-tabs--right .el-tabs__nav-scroll,.el-tabs--right .el-tabs__nav-wrap.is-left,.el-tabs--right .el-tabs__nav-wrap.is-right{height:100%}.el-tabs--left .el-tabs__active-bar.is-left,.el-tabs--left .el-tabs__active-bar.is-right,.el-tabs--right .el-tabs__active-bar.is-left,.el-tabs--right .el-tabs__active-bar.is-right{top:0;bottom:auto;width:2px;height:auto}.el-tabs--left .el-tabs__nav-wrap.is-left,.el-tabs--left .el-tabs__nav-wrap.is-right,.el-tabs--right .el-tabs__nav-wrap.is-left,.el-tabs--right .el-tabs__nav-wrap.is-right{margin-bottom:0}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev{height:30px;line-height:30px;width:100%;text-align:center;cursor:pointer}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next i,.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev i,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next i,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev i,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next i,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev i,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next i,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev i{transform:rotate(90deg)}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev{left:auto;top:0}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next{right:auto;bottom:0}.el-tabs--left .el-tabs__nav-wrap.is-left.is-scrollable,.el-tabs--left .el-tabs__nav-wrap.is-right.is-scrollable,.el-tabs--right .el-tabs__nav-wrap.is-left.is-scrollable,.el-tabs--right .el-tabs__nav-wrap.is-right.is-scrollable{padding:30px 0}.el-tabs--left .el-tabs__nav-wrap.is-left:after,.el-tabs--left .el-tabs__nav-wrap.is-right:after,.el-tabs--right .el-tabs__nav-wrap.is-left:after,.el-tabs--right .el-tabs__nav-wrap.is-right:after{height:100%;width:2px;bottom:auto;top:0}.el-tabs--left .el-tabs__nav.is-left,.el-tabs--left .el-tabs__nav.is-right,.el-tabs--right .el-tabs__nav.is-left,.el-tabs--right .el-tabs__nav.is-right{flex-direction:column}.el-tabs--left .el-tabs__item.is-left,.el-tabs--right .el-tabs__item.is-left{justify-content:flex-end}.el-tabs--left .el-tabs__item.is-right,.el-tabs--right .el-tabs__item.is-right{justify-content:flex-start}.el-tabs--left .el-tabs__header.is-left{float:left;margin-bottom:0;margin-right:10px}.el-tabs--left .el-tabs__nav-wrap.is-left{margin-right:-1px}.el-tabs--left .el-tabs__nav-wrap.is-left:after{left:auto;right:0}.el-tabs--left .el-tabs__active-bar.is-left{right:0;left:auto}.el-tabs--left .el-tabs__item.is-left{text-align:right}.el-tabs--left.el-tabs--card .el-tabs__active-bar.is-left{display:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left{border-left:none;border-right:1px solid var(--el-border-color-light);border-bottom:none;border-top:1px solid var(--el-border-color-light);text-align:left}.el-tabs--left.el-tabs--card .el-tabs__item.is-left:first-child{border-right:1px solid var(--el-border-color-light);border-top:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active{border:1px solid var(--el-border-color-light);border-right-color:#fff;border-left:none;border-bottom:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active:first-child{border-top:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active:last-child{border-bottom:none}.el-tabs--left.el-tabs--card .el-tabs__nav{border-radius:4px 0 0 4px;border-bottom:1px solid var(--el-border-color-light);border-right:none}.el-tabs--left.el-tabs--card .el-tabs__new-tab{float:none}.el-tabs--left.el-tabs--border-card .el-tabs__header.is-left{border-right:1px solid var(--el-border-color)}.el-tabs--left.el-tabs--border-card .el-tabs__item.is-left{border:1px solid transparent;margin:-1px 0 -1px -1px}.el-tabs--left.el-tabs--border-card .el-tabs__item.is-left.is-active{border-color:transparent;border-top-color:#d1dbe5;border-bottom-color:#d1dbe5}.el-tabs--right .el-tabs__header.is-right{float:right;margin-bottom:0;margin-left:10px}.el-tabs--right .el-tabs__nav-wrap.is-right{margin-left:-1px}.el-tabs--right .el-tabs__nav-wrap.is-right:after{left:0;right:auto}.el-tabs--right .el-tabs__active-bar.is-right{left:0}.el-tabs--right.el-tabs--card .el-tabs__active-bar.is-right{display:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right{border-bottom:none;border-top:1px solid var(--el-border-color-light)}.el-tabs--right.el-tabs--card .el-tabs__item.is-right:first-child{border-left:1px solid var(--el-border-color-light);border-top:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active{border:1px solid var(--el-border-color-light);border-left-color:#fff;border-right:none;border-bottom:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active:first-child{border-top:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active:last-child{border-bottom:none}.el-tabs--right.el-tabs--card .el-tabs__nav{border-radius:0 4px 4px 0;border-bottom:1px solid var(--el-border-color-light);border-left:none}.el-tabs--right.el-tabs--border-card .el-tabs__header.is-right{border-left:1px solid var(--el-border-color)}.el-tabs--right.el-tabs--border-card .el-tabs__item.is-right{border:1px solid transparent;margin:-1px -1px -1px 0}.el-tabs--right.el-tabs--border-card .el-tabs__item.is-right.is-active{border-color:transparent;border-top-color:#d1dbe5;border-bottom-color:#d1dbe5}.slideInLeft-transition,.slideInRight-transition{display:inline-block}.slideInRight-enter{-webkit-animation:slideInRight-enter var(--el-transition-duration);animation:slideInRight-enter var(--el-transition-duration)}.slideInRight-leave{position:absolute;left:0;right:0;-webkit-animation:slideInRight-leave var(--el-transition-duration);animation:slideInRight-leave var(--el-transition-duration)}.slideInLeft-enter{-webkit-animation:slideInLeft-enter var(--el-transition-duration);animation:slideInLeft-enter var(--el-transition-duration)}.slideInLeft-leave{position:absolute;left:0;right:0;-webkit-animation:slideInLeft-leave var(--el-transition-duration);animation:slideInLeft-leave var(--el-transition-duration)}@-webkit-keyframes slideInRight-enter{0%{opacity:0;transform-origin:0 0;transform:translate(100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@keyframes slideInRight-enter{0%{opacity:0;transform-origin:0 0;transform:translate(100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@-webkit-keyframes slideInRight-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(100%);opacity:0}}@keyframes slideInRight-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(100%);opacity:0}}@-webkit-keyframes slideInLeft-enter{0%{opacity:0;transform-origin:0 0;transform:translate(-100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@keyframes slideInLeft-enter{0%{opacity:0;transform-origin:0 0;transform:translate(-100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@-webkit-keyframes slideInLeft-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(-100%);opacity:0}}@keyframes slideInLeft-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(-100%);opacity:0}}.el-tag{--el-tag-font-size:12px;--el-tag-border-radius:4px;--el-tag-border-radius-rounded:9999px}.el-tag{--el-tag-bg-color:var(--el-color-primary-light-9);--el-tag-border-color:var(--el-color-primary-light-8);--el-tag-hover-color:var(--el-color-primary);--el-tag-text-color:var(--el-color-primary);background-color:var(--el-tag-bg-color);border-color:var(--el-tag-border-color);color:var(--el-tag-text-color);display:inline-flex;justify-content:center;align-items:center;height:24px;padding:0 9px;font-size:var(--el-tag-font-size);line-height:1;border-width:1px;border-style:solid;border-radius:var(--el-tag-border-radius);box-sizing:border-box;white-space:nowrap;--el-icon-size:14px}.el-tag.el-tag--primary{--el-tag-bg-color:var(--el-color-primary-light-9);--el-tag-border-color:var(--el-color-primary-light-8);--el-tag-hover-color:var(--el-color-primary)}.el-tag.el-tag--success{--el-tag-bg-color:var(--el-color-success-light-9);--el-tag-border-color:var(--el-color-success-light-8);--el-tag-hover-color:var(--el-color-success)}.el-tag.el-tag--warning{--el-tag-bg-color:var(--el-color-warning-light-9);--el-tag-border-color:var(--el-color-warning-light-8);--el-tag-hover-color:var(--el-color-warning)}.el-tag.el-tag--danger{--el-tag-bg-color:var(--el-color-danger-light-9);--el-tag-border-color:var(--el-color-danger-light-8);--el-tag-hover-color:var(--el-color-danger)}.el-tag.el-tag--error{--el-tag-bg-color:var(--el-color-error-light-9);--el-tag-border-color:var(--el-color-error-light-8);--el-tag-hover-color:var(--el-color-error)}.el-tag.el-tag--info{--el-tag-bg-color:var(--el-color-info-light-9);--el-tag-border-color:var(--el-color-info-light-8);--el-tag-hover-color:var(--el-color-info)}.el-tag.el-tag--primary{--el-tag-text-color:var(--el-color-primary)}.el-tag.el-tag--success{--el-tag-text-color:var(--el-color-success)}.el-tag.el-tag--warning{--el-tag-text-color:var(--el-color-warning)}.el-tag.el-tag--danger{--el-tag-text-color:var(--el-color-danger)}.el-tag.el-tag--error{--el-tag-text-color:var(--el-color-error)}.el-tag.el-tag--info{--el-tag-text-color:var(--el-color-info)}.el-tag.is-hit{border-color:var(--el-color-primary)}.el-tag.is-round{border-radius:var(--el-tag-border-radius-rounded)}.el-tag .el-tag__close{color:var(--el-tag-text-color)}.el-tag .el-tag__close:hover{color:var(--el-color-white);background-color:var(--el-tag-hover-color)}.el-tag .el-icon{border-radius:50%;cursor:pointer;font-size:calc(var(--el-icon-size) - 2px);height:var(--el-icon-size);width:var(--el-icon-size)}.el-tag .el-tag__close{margin-left:6px}.el-tag--dark{--el-tag-bg-color:var(--el-color-primary);--el-tag-border-color:var(--el-color-primary);--el-tag-hover-color:var(--el-color-primary-light-3);--el-tag-text-color:var(--el-color-white)}.el-tag--dark.el-tag--primary{--el-tag-bg-color:var(--el-color-primary);--el-tag-border-color:var(--el-color-primary);--el-tag-hover-color:var(--el-color-primary-light-3)}.el-tag--dark.el-tag--success{--el-tag-bg-color:var(--el-color-success);--el-tag-border-color:var(--el-color-success);--el-tag-hover-color:var(--el-color-success-light-3)}.el-tag--dark.el-tag--warning{--el-tag-bg-color:var(--el-color-warning);--el-tag-border-color:var(--el-color-warning);--el-tag-hover-color:var(--el-color-warning-light-3)}.el-tag--dark.el-tag--danger{--el-tag-bg-color:var(--el-color-danger);--el-tag-border-color:var(--el-color-danger);--el-tag-hover-color:var(--el-color-danger-light-3)}.el-tag--dark.el-tag--error{--el-tag-bg-color:var(--el-color-error);--el-tag-border-color:var(--el-color-error);--el-tag-hover-color:var(--el-color-error-light-3)}.el-tag--dark.el-tag--info{--el-tag-bg-color:var(--el-color-info);--el-tag-border-color:var(--el-color-info);--el-tag-hover-color:var(--el-color-info-light-3)}.el-tag--dark.el-tag--primary,.el-tag--dark.el-tag--success,.el-tag--dark.el-tag--warning,.el-tag--dark.el-tag--danger,.el-tag--dark.el-tag--error,.el-tag--dark.el-tag--info{--el-tag-text-color:var(--el-color-white)}.el-tag--plain{--el-tag-border-color:var(--el-color-primary-light-5);--el-tag-hover-color:var(--el-color-primary);--el-tag-bg-color:var(--el-fill-color-blank)}.el-tag--plain.el-tag--primary{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-primary-light-5);--el-tag-hover-color:var(--el-color-primary)}.el-tag--plain.el-tag--success{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-success-light-5);--el-tag-hover-color:var(--el-color-success)}.el-tag--plain.el-tag--warning{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-warning-light-5);--el-tag-hover-color:var(--el-color-warning)}.el-tag--plain.el-tag--danger{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-danger-light-5);--el-tag-hover-color:var(--el-color-danger)}.el-tag--plain.el-tag--error{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-error-light-5);--el-tag-hover-color:var(--el-color-error)}.el-tag--plain.el-tag--info{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-info-light-5);--el-tag-hover-color:var(--el-color-info)}.el-tag.is-closable{padding-right:5px}.el-tag--large{padding:0 11px;height:32px;--el-icon-size:16px}.el-tag--large .el-tag__close{margin-left:8px}.el-tag--large.is-closable{padding-right:7px}.el-tag--small{padding:0 7px;height:20px;--el-icon-size:12px}.el-tag--small .el-tag__close{margin-left:4px}.el-tag--small.is-closable{padding-right:3px}.el-tag--small .el-icon-close{transform:scale(.8)}.el-tag.el-tag--primary.is-hit{border-color:var(--el-color-primary)}.el-tag.el-tag--success.is-hit{border-color:var(--el-color-success)}.el-tag.el-tag--warning.is-hit{border-color:var(--el-color-warning)}.el-tag.el-tag--danger.is-hit{border-color:var(--el-color-danger)}.el-tag.el-tag--error.is-hit{border-color:var(--el-color-error)}.el-tag.el-tag--info.is-hit{border-color:var(--el-color-info)}.el-text{--el-text-font-size:var(--el-font-size-base);--el-text-color:var(--el-text-color-regular)}.el-text{align-self:center;margin:0;padding:0;font-size:var(--el-text-font-size);color:var(--el-text-color);word-break:break-all}.el-text.is-truncated{display:inline-block;max-width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.el-text--large{--el-text-font-size:var(--el-font-size-medium)}.el-text--default{--el-text-font-size:var(--el-font-size-base)}.el-text--small{--el-text-font-size:var(--el-font-size-extra-small)}.el-text.el-text--primary{--el-text-color:var(--el-color-primary)}.el-text.el-text--success{--el-text-color:var(--el-color-success)}.el-text.el-text--warning{--el-text-color:var(--el-color-warning)}.el-text.el-text--danger{--el-text-color:var(--el-color-danger)}.el-text.el-text--error{--el-text-color:var(--el-color-error)}.el-text.el-text--info{--el-text-color:var(--el-color-info)}.el-text>.el-icon{vertical-align:-2px}.time-select{margin:5px 0;min-width:0}.time-select .el-picker-panel__content{max-height:200px;margin:0}.time-select-item{padding:8px 10px;font-size:14px;line-height:20px}.time-select-item.disabled{color:var(--el-datepicker-border-color);cursor:not-allowed}.time-select-item:hover{background-color:var(--el-fill-color-light);font-weight:700;cursor:pointer}.time-select .time-select-item.selected:not(.disabled){color:var(--el-color-primary);font-weight:700}.el-timeline-item{position:relative;padding-bottom:20px}.el-timeline-item__wrapper{position:relative;padding-left:28px;top:-3px}.el-timeline-item__tail{position:absolute;left:4px;height:100%;border-left:2px solid var(--el-timeline-node-color)}.el-timeline-item .el-timeline-item__icon{color:var(--el-color-white);font-size:var(--el-font-size-small)}.el-timeline-item__node{position:absolute;background-color:var(--el-timeline-node-color);border-color:var(--el-timeline-node-color);border-radius:50%;box-sizing:border-box;display:flex;justify-content:center;align-items:center}.el-timeline-item__node--normal{left:-1px;width:var(--el-timeline-node-size-normal);height:var(--el-timeline-node-size-normal)}.el-timeline-item__node--large{left:-2px;width:var(--el-timeline-node-size-large);height:var(--el-timeline-node-size-large)}.el-timeline-item__node.is-hollow{background:var(--el-color-white);border-style:solid;border-width:2px}.el-timeline-item__node--primary{background-color:var(--el-color-primary);border-color:var(--el-color-primary)}.el-timeline-item__node--success{background-color:var(--el-color-success);border-color:var(--el-color-success)}.el-timeline-item__node--warning{background-color:var(--el-color-warning);border-color:var(--el-color-warning)}.el-timeline-item__node--danger{background-color:var(--el-color-danger);border-color:var(--el-color-danger)}.el-timeline-item__node--info{background-color:var(--el-color-info);border-color:var(--el-color-info)}.el-timeline-item__dot{position:absolute;display:flex;justify-content:center;align-items:center}.el-timeline-item__content{color:var(--el-text-color-primary)}.el-timeline-item__timestamp{color:var(--el-text-color-secondary);line-height:1;font-size:var(--el-font-size-small)}.el-timeline-item__timestamp.is-top{margin-bottom:8px;padding-top:4px}.el-timeline-item__timestamp.is-bottom{margin-top:8px}.el-timeline{--el-timeline-node-size-normal:12px;--el-timeline-node-size-large:14px;--el-timeline-node-color:var(--el-border-color-light)}.el-timeline{margin:0;font-size:var(--el-font-size-base);list-style:none}.el-timeline .el-timeline-item:last-child .el-timeline-item__tail{display:none}.el-timeline .el-timeline-item__center{display:flex;align-items:center}.el-timeline .el-timeline-item__center .el-timeline-item__wrapper{width:100%}.el-timeline .el-timeline-item__center .el-timeline-item__tail{top:0}.el-timeline .el-timeline-item__center:first-child .el-timeline-item__tail{height:calc(50% + 10px);top:calc(50% - 10px)}.el-timeline .el-timeline-item__center:last-child .el-timeline-item__tail{display:block;height:calc(50% - 10px)}.el-tooltip-v2__content{--el-tooltip-v2-padding:5px 10px;--el-tooltip-v2-border-radius:4px;--el-tooltip-v2-border-color:var(--el-border-color);border-radius:var(--el-tooltip-v2-border-radius);color:var(--el-color-black);background-color:var(--el-color-white);padding:var(--el-tooltip-v2-padding);border:1px solid var(--el-border-color)}.el-tooltip-v2__arrow{position:absolute;color:var(--el-color-white);width:var(--el-tooltip-v2-arrow-width);height:var(--el-tooltip-v2-arrow-height);pointer-events:none;left:var(--el-tooltip-v2-arrow-x);top:var(--el-tooltip-v2-arrow-y)}.el-tooltip-v2__arrow:before{content:"";width:0;height:0;border:var(--el-tooltip-v2-arrow-border-width) solid transparent;position:absolute}.el-tooltip-v2__arrow:after{content:"";width:0;height:0;border:var(--el-tooltip-v2-arrow-border-width) solid transparent;position:absolute}.el-tooltip-v2__content[data-side^=top] .el-tooltip-v2__arrow{bottom:0}.el-tooltip-v2__content[data-side^=top] .el-tooltip-v2__arrow:before{border-top-color:var(--el-color-white);border-top-width:var(--el-tooltip-v2-arrow-border-width);border-bottom:0;top:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=top] .el-tooltip-v2__arrow:after{border-top-color:var(--el-border-color);border-top-width:var(--el-tooltip-v2-arrow-border-width);border-bottom:0;top:100%;z-index:-1}.el-tooltip-v2__content[data-side^=bottom] .el-tooltip-v2__arrow{top:0}.el-tooltip-v2__content[data-side^=bottom] .el-tooltip-v2__arrow:before{border-bottom-color:var(--el-color-white);border-bottom-width:var(--el-tooltip-v2-arrow-border-width);border-top:0;bottom:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=bottom] .el-tooltip-v2__arrow:after{border-bottom-color:var(--el-border-color);border-bottom-width:var(--el-tooltip-v2-arrow-border-width);border-top:0;bottom:100%;z-index:-1}.el-tooltip-v2__content[data-side^=left] .el-tooltip-v2__arrow{right:0}.el-tooltip-v2__content[data-side^=left] .el-tooltip-v2__arrow:before{border-left-color:var(--el-color-white);border-left-width:var(--el-tooltip-v2-arrow-border-width);border-right:0;left:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=left] .el-tooltip-v2__arrow:after{border-left-color:var(--el-border-color);border-left-width:var(--el-tooltip-v2-arrow-border-width);border-right:0;left:100%;z-index:-1}.el-tooltip-v2__content[data-side^=right] .el-tooltip-v2__arrow{left:0}.el-tooltip-v2__content[data-side^=right] .el-tooltip-v2__arrow:before{border-right-color:var(--el-color-white);border-right-width:var(--el-tooltip-v2-arrow-border-width);border-left:0;right:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=right] .el-tooltip-v2__arrow:after{border-right-color:var(--el-border-color);border-right-width:var(--el-tooltip-v2-arrow-border-width);border-left:0;right:100%;z-index:-1}.el-tooltip-v2__content.is-dark{--el-tooltip-v2-border-color:transparent;background-color:var(--el-color-black);color:var(--el-color-white);border-color:transparent}.el-tooltip-v2__content.is-dark .el-tooltip-v2__arrow{background-color:var(--el-color-black);border-color:transparent}.el-transfer{--el-transfer-border-color:var(--el-border-color-lighter);--el-transfer-border-radius:var(--el-border-radius-base);--el-transfer-panel-width:200px;--el-transfer-panel-header-height:40px;--el-transfer-panel-header-bg-color:var(--el-fill-color-light);--el-transfer-panel-footer-height:40px;--el-transfer-panel-body-height:278px;--el-transfer-item-height:30px;--el-transfer-filter-height:32px}.el-transfer{font-size:var(--el-font-size-base)}.el-transfer__buttons{display:inline-block;vertical-align:middle;padding:0 30px}.el-transfer__button{vertical-align:top}.el-transfer__button:nth-child(2){margin:0 0 0 10px}.el-transfer__button i,.el-transfer__button span{font-size:14px}.el-transfer__button .el-icon+span{margin-left:0}.el-transfer-panel{overflow:hidden;background:var(--el-bg-color-overlay);display:inline-block;text-align:left;vertical-align:middle;width:var(--el-transfer-panel-width);max-height:100%;box-sizing:border-box;position:relative}.el-transfer-panel__body{height:var(--el-transfer-panel-body-height);border-left:1px solid var(--el-transfer-border-color);border-right:1px solid var(--el-transfer-border-color);border-bottom:1px solid var(--el-transfer-border-color);border-bottom-left-radius:var(--el-transfer-border-radius);border-bottom-right-radius:var(--el-transfer-border-radius);overflow:hidden}.el-transfer-panel__body.is-with-footer{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.el-transfer-panel__list{margin:0;padding:6px 0;list-style:none;height:var(--el-transfer-panel-body-height);overflow:auto;box-sizing:border-box}.el-transfer-panel__list.is-filterable{height:calc(100% - var(--el-transfer-filter-height) - 30px);padding-top:0}.el-transfer-panel__item{height:var(--el-transfer-item-height);line-height:var(--el-transfer-item-height);padding-left:15px;display:block!important}.el-transfer-panel__item+.el-transfer-panel__item{margin-left:0}.el-transfer-panel__item.el-checkbox{color:var(--el-text-color-regular)}.el-transfer-panel__item:hover{color:var(--el-color-primary)}.el-transfer-panel__item.el-checkbox .el-checkbox__label{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;box-sizing:border-box;padding-left:22px;line-height:var(--el-transfer-item-height)}.el-transfer-panel__item .el-checkbox__input{position:absolute;top:8px}.el-transfer-panel__filter{text-align:center;padding:15px;box-sizing:border-box}.el-transfer-panel__filter .el-input__inner{height:var(--el-transfer-filter-height);width:100%;font-size:12px;display:inline-block;box-sizing:border-box;border-radius:calc(var(--el-transfer-filter-height)/ 2)}.el-transfer-panel__filter .el-icon-circle-close{cursor:pointer}.el-transfer-panel .el-transfer-panel__header{display:flex;align-items:center;height:var(--el-transfer-panel-header-height);background:var(--el-transfer-panel-header-bg-color);margin:0;padding-left:15px;border:1px solid var(--el-transfer-border-color);border-top-left-radius:var(--el-transfer-border-radius);border-top-right-radius:var(--el-transfer-border-radius);box-sizing:border-box;color:var(--el-color-black)}.el-transfer-panel .el-transfer-panel__header .el-checkbox{position:relative;display:flex;width:100%;align-items:center}.el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label{font-size:16px;color:var(--el-text-color-primary);font-weight:400}.el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label span{position:absolute;right:15px;top:50%;transform:translate3d(0,-50%,0);color:var(--el-text-color-secondary);font-size:12px;font-weight:400}.el-transfer-panel .el-transfer-panel__footer{height:var(--el-transfer-panel-footer-height);background:var(--el-bg-color-overlay);margin:0;padding:0;border:1px solid var(--el-transfer-border-color);border-bottom-left-radius:var(--el-transfer-border-radius);border-bottom-right-radius:var(--el-transfer-border-radius)}.el-transfer-panel .el-transfer-panel__footer:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-transfer-panel .el-transfer-panel__footer .el-checkbox{padding-left:20px;color:var(--el-text-color-regular)}.el-transfer-panel .el-transfer-panel__empty{margin:0;height:var(--el-transfer-item-height);line-height:var(--el-transfer-item-height);padding:6px 15px 0;color:var(--el-text-color-secondary);text-align:center}.el-transfer-panel .el-checkbox__label{padding-left:8px}.el-transfer-panel .el-checkbox__inner{height:14px;width:14px;border-radius:3px}.el-transfer-panel .el-checkbox__inner:after{height:6px;width:3px;left:4px}.el-tree{--el-tree-node-hover-bg-color:var(--el-fill-color-light);--el-tree-text-color:var(--el-text-color-regular);--el-tree-expand-icon-color:var(--el-text-color-placeholder)}.el-tree{position:relative;cursor:default;background:var(--el-fill-color-blank);color:var(--el-tree-text-color);font-size:var(--el-font-size-base)}.el-tree__empty-block{position:relative;min-height:60px;text-align:center;width:100%;height:100%}.el-tree__empty-text{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);color:var(--el-text-color-secondary);font-size:var(--el-font-size-base)}.el-tree__drop-indicator{position:absolute;left:0;right:0;height:1px;background-color:var(--el-color-primary)}.el-tree-node{white-space:nowrap;outline:0}.el-tree-node:focus>.el-tree-node__content{background-color:var(--el-tree-node-hover-bg-color)}.el-tree-node.is-drop-inner>.el-tree-node__content .el-tree-node__label{background-color:var(--el-color-primary);color:#fff}.el-tree-node__content{display:flex;align-items:center;height:26px;cursor:pointer}.el-tree-node__content>.el-tree-node__expand-icon{padding:6px;box-sizing:content-box}.el-tree-node__content>label.el-checkbox{margin-right:8px}.el-tree-node__content:hover{background-color:var(--el-tree-node-hover-bg-color)}.el-tree.is-dragging .el-tree-node__content{cursor:move}.el-tree.is-dragging .el-tree-node__content *{pointer-events:none}.el-tree.is-dragging.is-drop-not-allow .el-tree-node__content{cursor:not-allowed}.el-tree-node__expand-icon{cursor:pointer;color:var(--el-tree-expand-icon-color);font-size:12px;transform:rotate(0);transition:transform var(--el-transition-duration) ease-in-out}.el-tree-node__expand-icon.expanded{transform:rotate(90deg)}.el-tree-node__expand-icon.is-leaf{color:transparent;cursor:default}.el-tree-node__expand-icon.is-hidden{visibility:hidden}.el-tree-node__loading-icon{margin-right:8px;font-size:var(--el-font-size-base);color:var(--el-tree-expand-icon-color)}.el-tree-node>.el-tree-node__children{overflow:hidden;background-color:transparent}.el-tree-node.is-expanded>.el-tree-node__children{display:block}.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content{background-color:var(--el-color-primary-light-9)}.el-tree-select{--el-tree-node-hover-bg-color:var(--el-fill-color-light);--el-tree-text-color:var(--el-text-color-regular);--el-tree-expand-icon-color:var(--el-text-color-placeholder)}.el-tree-select__popper .el-tree-node__expand-icon{margin-left:8px}.el-tree-select__popper .el-tree-node.is-checked>.el-tree-node__content .el-select-dropdown__item.selected:after{content:none}.el-tree-select__popper .el-select-dropdown__item{flex:1;background:0 0!important;padding-left:0;height:20px;line-height:20px}.el-upload{--el-upload-dragger-padding-horizontal:40px;--el-upload-dragger-padding-vertical:10px}.el-upload{display:inline-flex;justify-content:center;align-items:center;cursor:pointer;outline:0}.el-upload__input{display:none}.el-upload__tip{font-size:12px;color:var(--el-text-color-regular);margin-top:7px}.el-upload iframe{position:absolute;z-index:-1;top:0;left:0;opacity:0}.el-upload--picture-card{--el-upload-picture-card-size:148px;background-color:var(--el-fill-color-lighter);border:1px dashed var(--el-border-color-darker);border-radius:6px;box-sizing:border-box;width:var(--el-upload-picture-card-size);height:var(--el-upload-picture-card-size);cursor:pointer;vertical-align:top;display:inline-flex;justify-content:center;align-items:center}.el-upload--picture-card i{font-size:28px;color:var(--el-text-color-secondary)}.el-upload--picture-card:hover{border-color:var(--el-color-primary);color:var(--el-color-primary)}.el-upload.is-drag{display:block}.el-upload:focus{border-color:var(--el-color-primary);color:var(--el-color-primary)}.el-upload:focus .el-upload-dragger{border-color:var(--el-color-primary)}.el-upload-dragger{padding:var(--el-upload-dragger-padding-horizontal) var(--el-upload-dragger-padding-vertical);background-color:var(--el-fill-color-blank);border:1px dashed var(--el-border-color);border-radius:6px;box-sizing:border-box;text-align:center;cursor:pointer;position:relative;overflow:hidden}.el-upload-dragger .el-icon--upload{font-size:67px;color:var(--el-text-color-placeholder);margin-bottom:16px;line-height:50px}.el-upload-dragger+.el-upload__tip{text-align:center}.el-upload-dragger~.el-upload__files{border-top:var(--el-border);margin-top:7px;padding-top:5px}.el-upload-dragger .el-upload__text{color:var(--el-text-color-regular);font-size:14px;text-align:center}.el-upload-dragger .el-upload__text em{color:var(--el-color-primary);font-style:normal}.el-upload-dragger:hover{border-color:var(--el-color-primary)}.el-upload-dragger.is-dragover{padding:calc(var(--el-upload-dragger-padding-horizontal) - 1px) calc(var(--el-upload-dragger-padding-vertical) - 1px);background-color:var(--el-color-primary-light-9);border:2px dashed var(--el-color-primary)}.el-upload-list{margin:10px 0 0;padding:0;list-style:none;position:relative}.el-upload-list__item{transition:all .5s cubic-bezier(.55,0,.1,1);font-size:14px;color:var(--el-text-color-regular);margin-bottom:5px;position:relative;box-sizing:border-box;border-radius:4px;width:100%}.el-upload-list__item .el-progress{position:absolute;top:20px;width:100%}.el-upload-list__item .el-progress__text{position:absolute;right:0;top:-13px}.el-upload-list__item .el-progress-bar{margin-right:0;padding-right:0}.el-upload-list__item .el-icon--upload-success{color:var(--el-color-success)}.el-upload-list__item .el-icon--close{display:none;position:absolute;right:5px;top:50%;cursor:pointer;opacity:.75;color:var(--el-text-color-regular);transition:opacity var(--el-transition-duration);transform:translateY(-50%)}.el-upload-list__item .el-icon--close:hover{opacity:1;color:var(--el-color-primary)}.el-upload-list__item .el-icon--close-tip{display:none;position:absolute;top:1px;right:5px;font-size:12px;cursor:pointer;opacity:1;color:var(--el-color-primary);font-style:normal}.el-upload-list__item:hover{background-color:var(--el-fill-color-light)}.el-upload-list__item:hover .el-icon--close{display:inline-flex}.el-upload-list__item:hover .el-progress__text{display:none}.el-upload-list__item .el-upload-list__item-info{display:inline-flex;justify-content:center;flex-direction:column;width:calc(100% - 30px);margin-left:4px}.el-upload-list__item.is-success .el-upload-list__item-status-label{display:inline-flex}.el-upload-list__item.is-success .el-upload-list__item-name:focus,.el-upload-list__item.is-success .el-upload-list__item-name:hover{color:var(--el-color-primary);cursor:pointer}.el-upload-list__item.is-success:focus:not(:hover) .el-icon--close-tip{display:inline-block}.el-upload-list__item.is-success:active,.el-upload-list__item.is-success:not(.focusing):focus{outline-width:0}.el-upload-list__item.is-success:active .el-icon--close-tip,.el-upload-list__item.is-success:not(.focusing):focus .el-icon--close-tip{display:none}.el-upload-list__item.is-success:focus .el-upload-list__item-status-label,.el-upload-list__item.is-success:hover .el-upload-list__item-status-label{display:none;opacity:0}.el-upload-list__item-name{color:var(--el-text-color-regular);display:inline-flex;text-align:center;align-items:center;padding:0 4px;transition:color var(--el-transition-duration);font-size:var(--el-font-size-base)}.el-upload-list__item-name .el-icon{margin-right:6px;color:var(--el-text-color-secondary)}.el-upload-list__item-file-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-upload-list__item-status-label{position:absolute;right:5px;top:0;line-height:inherit;display:none;height:100%;justify-content:center;align-items:center;transition:opacity var(--el-transition-duration)}.el-upload-list__item-delete{position:absolute;right:10px;top:0;font-size:12px;color:var(--el-text-color-regular);display:none}.el-upload-list__item-delete:hover{color:var(--el-color-primary)}.el-upload-list--picture-card{--el-upload-list-picture-card-size:148px;display:inline-flex;flex-wrap:wrap;margin:0}.el-upload-list--picture-card .el-upload-list__item{overflow:hidden;background-color:var(--el-fill-color-blank);border:1px solid var(--el-border-color);border-radius:6px;box-sizing:border-box;width:var(--el-upload-list-picture-card-size);height:var(--el-upload-list-picture-card-size);margin:0 8px 8px 0;padding:0;display:inline-flex}.el-upload-list--picture-card .el-upload-list__item .el-icon--check,.el-upload-list--picture-card .el-upload-list__item .el-icon--circle-check{color:#fff}.el-upload-list--picture-card .el-upload-list__item .el-icon--close{display:none}.el-upload-list--picture-card .el-upload-list__item:hover .el-upload-list__item-status-label{opacity:0;display:block}.el-upload-list--picture-card .el-upload-list__item:hover .el-progress__text{display:block}.el-upload-list--picture-card .el-upload-list__item .el-upload-list__item-name{display:none}.el-upload-list--picture-card .el-upload-list__item-thumbnail{width:100%;height:100%;-o-object-fit:contain;object-fit:contain}.el-upload-list--picture-card .el-upload-list__item-status-label{right:-15px;top:-6px;width:40px;height:24px;background:var(--el-color-success);text-align:center;transform:rotate(45deg)}.el-upload-list--picture-card .el-upload-list__item-status-label i{font-size:12px;margin-top:11px;transform:rotate(-45deg)}.el-upload-list--picture-card .el-upload-list__item-actions{position:absolute;width:100%;height:100%;left:0;top:0;cursor:default;display:inline-flex;justify-content:center;align-items:center;color:#fff;opacity:0;font-size:20px;background-color:var(--el-overlay-color-lighter);transition:opacity var(--el-transition-duration)}.el-upload-list--picture-card .el-upload-list__item-actions span{display:none;cursor:pointer}.el-upload-list--picture-card .el-upload-list__item-actions span+span{margin-left:1rem}.el-upload-list--picture-card .el-upload-list__item-actions .el-upload-list__item-delete{position:static;font-size:inherit;color:inherit}.el-upload-list--picture-card .el-upload-list__item-actions:hover{opacity:1}.el-upload-list--picture-card .el-upload-list__item-actions:hover span{display:inline-flex}.el-upload-list--picture-card .el-progress{top:50%;left:50%;transform:translate(-50%,-50%);bottom:auto;width:126px}.el-upload-list--picture-card .el-progress .el-progress__text{top:50%}.el-upload-list--picture .el-upload-list__item{overflow:hidden;z-index:0;background-color:var(--el-fill-color-blank);border:1px solid var(--el-border-color);border-radius:6px;box-sizing:border-box;margin-top:10px;padding:10px;display:flex;align-items:center}.el-upload-list--picture .el-upload-list__item .el-icon--check,.el-upload-list--picture .el-upload-list__item .el-icon--circle-check{color:#fff}.el-upload-list--picture .el-upload-list__item:hover .el-upload-list__item-status-label{opacity:0;display:inline-flex}.el-upload-list--picture .el-upload-list__item:hover .el-progress__text{display:block}.el-upload-list--picture .el-upload-list__item.is-success .el-upload-list__item-name i{display:none}.el-upload-list--picture .el-upload-list__item .el-icon--close{top:5px;transform:translateY(0)}.el-upload-list--picture .el-upload-list__item-thumbnail{display:inline-flex;justify-content:center;align-items:center;width:70px;height:70px;-o-object-fit:contain;object-fit:contain;position:relative;z-index:1;background-color:var(--el-color-white)}.el-upload-list--picture .el-upload-list__item-status-label{position:absolute;right:-17px;top:-7px;width:46px;height:26px;background:var(--el-color-success);text-align:center;transform:rotate(45deg)}.el-upload-list--picture .el-upload-list__item-status-label i{font-size:12px;margin-top:12px;transform:rotate(-45deg)}.el-upload-list--picture .el-progress{position:relative;top:-7px}.el-upload-cover{position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden;z-index:10;cursor:default}.el-upload-cover:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-upload-cover img{display:block;width:100%;height:100%}.el-upload-cover__label{right:-15px;top:-6px;width:40px;height:24px;background:var(--el-color-success);text-align:center;transform:rotate(45deg)}.el-upload-cover__label i{font-size:12px;margin-top:11px;transform:rotate(-45deg);color:#fff}.el-upload-cover__progress{display:inline-block;vertical-align:middle;position:static;width:243px}.el-upload-cover__progress+.el-upload__inner{opacity:0}.el-upload-cover__content{position:absolute;top:0;left:0;width:100%;height:100%}.el-upload-cover__interact{position:absolute;bottom:0;left:0;width:100%;height:100%;background-color:var(--el-overlay-color-light);text-align:center}.el-upload-cover__interact .btn{display:inline-block;color:#fff;font-size:14px;cursor:pointer;vertical-align:middle;transition:var(--el-transition-md-fade);margin-top:60px}.el-upload-cover__interact .btn i{margin-top:0}.el-upload-cover__interact .btn span{opacity:0;transition:opacity .15s linear}.el-upload-cover__interact .btn:not(:first-child){margin-left:35px}.el-upload-cover__interact .btn:hover{transform:translateY(-13px)}.el-upload-cover__interact .btn:hover span{opacity:1}.el-upload-cover__interact .btn i{color:#fff;display:block;font-size:24px;line-height:inherit;margin:0 auto 5px}.el-upload-cover__title{position:absolute;bottom:0;left:0;background-color:#fff;height:36px;width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:400;text-align:left;padding:0 10px;margin:0;line-height:36px;font-size:14px;color:var(--el-text-color-primary)}.el-upload-cover+.el-upload__inner{opacity:0;position:relative;z-index:1}.el-vl__wrapper{position:relative}.el-vl__wrapper:hover .el-virtual-scrollbar,.el-vl__wrapper.always-on .el-virtual-scrollbar{opacity:1}.el-vl__window{scrollbar-width:none}.el-vl__window::-webkit-scrollbar{display:none}.el-virtual-scrollbar{opacity:0;transition:opacity .34s ease-out}.el-virtual-scrollbar.always-on{opacity:1}.el-vg__wrapper{position:relative}.el-popper{--el-popper-border-radius:var(--el-popover-border-radius, 4px)}.el-popper{position:absolute;border-radius:var(--el-popper-border-radius);padding:5px 11px;z-index:2000;font-size:12px;line-height:20px;min-width:10px;word-wrap:break-word;visibility:visible}.el-popper.is-dark{color:var(--el-bg-color);background:var(--el-text-color-primary);border:1px solid var(--el-text-color-primary)}.el-popper.is-dark .el-popper__arrow:before{border:1px solid var(--el-text-color-primary);background:var(--el-text-color-primary);right:0}.el-popper.is-light{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light)}.el-popper.is-light .el-popper__arrow:before{border:1px solid var(--el-border-color-light);background:var(--el-bg-color-overlay);right:0}.el-popper.is-pure{padding:0}.el-popper__arrow{position:absolute;width:10px;height:10px;z-index:-1}.el-popper__arrow:before{position:absolute;width:10px;height:10px;z-index:-1;content:" ";transform:rotate(45deg);background:var(--el-text-color-primary);box-sizing:border-box}.el-popper[data-popper-placement^=top]>.el-popper__arrow{bottom:-5px}.el-popper[data-popper-placement^=top]>.el-popper__arrow:before{border-bottom-right-radius:2px}.el-popper[data-popper-placement^=bottom]>.el-popper__arrow{top:-5px}.el-popper[data-popper-placement^=bottom]>.el-popper__arrow:before{border-top-left-radius:2px}.el-popper[data-popper-placement^=left]>.el-popper__arrow{right:-5px}.el-popper[data-popper-placement^=left]>.el-popper__arrow:before{border-top-right-radius:2px}.el-popper[data-popper-placement^=right]>.el-popper__arrow{left:-5px}.el-popper[data-popper-placement^=right]>.el-popper__arrow:before{border-bottom-left-radius:2px}.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent!important;border-left-color:transparent!important}.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent!important;border-right-color:transparent!important}.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent!important;border-bottom-color:transparent!important}.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent!important;border-top-color:transparent!important}.el-select-dropdown__item{font-size:var(--el-font-size-base);padding:0 32px 0 20px;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--el-text-color-regular);height:34px;line-height:34px;box-sizing:border-box;cursor:pointer}.el-select-dropdown__item.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-select-dropdown__item.hover,.el-select-dropdown__item:hover{background-color:var(--el-fill-color-light)}.el-select-dropdown__item.selected{color:var(--el-color-primary);font-weight:700}.el-statistic{--el-statistic-title-font-weight:400;--el-statistic-title-font-size:var(--el-font-size-extra-small);--el-statistic-title-color:var(--el-text-color-regular);--el-statistic-content-font-weight:400;--el-statistic-content-font-size:var(--el-font-size-extra-large);--el-statistic-content-color:var(--el-text-color-primary)}.el-statistic__head{font-weight:var(--el-statistic-title-font-weight);font-size:var(--el-statistic-title-font-size);color:var(--el-statistic-title-color);line-height:20px;margin-bottom:4px}.el-statistic__content{font-weight:var(--el-statistic-content-font-weight);font-size:var(--el-statistic-content-font-size);color:var(--el-statistic-content-color)}.el-statistic__value{display:inline-block}.el-statistic__prefix{margin-right:4px;display:inline-block}.el-statistic__suffix{margin-left:4px;display:inline-block}.el-button{height:32rem!important;padding:8rem 15rem!important;font-size:14rem!important}.el-input__wrapper{padding:1rem 11rem!important}.el-input{height:32rem!important;font-size:14rem!important}.el-input-number{line-height:30rem!important;width:150rem}.el-input-number__decrease,.el-input-number__increase{top:1rem!important;bottom:1rem!important;width:32rem!important;font-size:13rem!important;background-color:#409eff}.jt-drawing-row .col-left{font-size:14rem!important}.el-color-picker__trigger{height:32rem!important;padding:4rem!important}.el-radio-button__inner{padding:8rem 15rem!important;font-size:14rem}.el-textarea__inner{padding:5rem 11rem!important;font-size:14rem}.el-input__inner{height:32rem!important;font-size:14rem!important}.el-scrollbar{color:#fff!important;background-color:#052d73!important;overflow:visible!important}.jt-drawing-row{display:flex;flex-direction:row;height:40rem;align-items:center}.jt-drawing-row .col-left{display:flex;align-items:center;justify-content:right;width:60rem;font-family:Alimama_ShuHeiTi_Bold;font-weight:700;margin-right:8rem}.jt-drawing-row .col-main{flex:1;display:flex;flex-direction:row}.jt-drawing-row .col-main .el-input--suffix{background-color:#fff0}.jt-drawing-row .col-main .el-input--suffix *{background-color:#fff0;color:#fff}.jt-drawing-row .col-main .el-input-number__decrease,.jt-drawing-row .col-main .el-input-number__increase{background-color:#409eff;color:#fff}.jt-drawing-dialog{pointer-events:none}.jt-drawing-dialog .el-dialog{pointer-events:auto;position:absolute!important;background:rgba(5,45,155,.7);min-width:280rem;overflow:hidden;left:10rem;background:rgba(0,44,126,.68);height:calc(100% - 175rem);width:180rem;top:125rem;margin-top:0rem}.jt-drawing-dialog .el-dialog .el-dialog__header{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyCAIAAAD9fhrKAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo4NTc1YTY2Yi1hY2U5LTUyNDctODM5MS01MGJjMjM4MDkxMDkiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RDY4MTUxMzk2RDM1MTFFRDkzM0JDNEQ5N0IwQTIxRjYiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RDY4MTUxMzg2RDM1MTFFRDkzM0JDNEQ5N0IwQTIxRjYiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6YjZlNTUzODYtMzRjZC02NDQyLWI4OTktODY4YTdiYTNkMzgyIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjg1NzVhNjZiLWFjZTktNTI0Ny04MzkxLTUwYmMyMzgwOTEwOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Po+VQtwAACdUSURBVHja7H1bluM4kiUMfEjuHpFZtY4+/TGLmQ3MmTMbnf1MdUX6QyIJ2MAAAjC8+JB7ZHZXh7LKQ6IoECSBy2sXFwb4/X/+X2FfEqDv5dh35mXeC+k2CzD/+XfxL72BeVbv04KI7uP6ByD7pZTy6ToMnUTwv3f7rgWG/cNXrhz7AcVtUfOiwP/kOg6mLGRVoq1JUewjsAoLWJQ2RdlTg7CD+y+eJW3MziVU1dfK/wV2LIhXJpQJ/nQhOUFWWxDJRYjnwnfItkB2Z8w/yC7sr9fnXpj8Y/9d27hw/2D4zm/0/4V92EcRtq+bMP9J+AX98UdadxN8oy/D/tXdBeWAvsBQM7/FvwklxzemJ0xyfrflu6JG1T+Hc1mrhKEA/wfTQ9BfAD119x9Ca2R1ZjuEqwdq/Kb7C9vO3oQzZJ9AKdAzqDuoGVC5r3r3j8Gp62XoJaT9g3WBDK3crwwIdfB+mxUmyJP0HXNGAj/uM1zNQWTs8MChMOvJEQYMuDxdepBAQGM7810t2MHIioItnEqwbOx66GBadMSXHHQiCgBHFmDV8h+rJcQPEUaLk+WIFi5YDnyQXPoUs0R+oyTfEWvdkKFaskPYju0t1RLCDrxM/luoHejIm+0qbZ9g6+P2/snOBWDRQVPAggLOgMEBFRh7PoY+DPaJvUIYIvjeb3eG9b39tH6zFoL0Q9eHzVt6A1qOKMdYE7cD+lsBDCtdya7B2QINBEj1YZqMxSAwIKL7J3DVdI0WHbWgY4HdyIp2Z7d+lvreTa+hfHep/M/ZhZS9Gr7pbthqXsmtsdXpepS9MHXTi5xf5XIzX3XXf/tfBkmer2MHkPKdGr0SOckyXGzoO60IYIGBUcEdYFZKSuikFMBLT7pxQprYwXrifAZwtfto3pi9bVEcXVKSVcKtPYT5lSnMlOAaQMKKUobEv2UXF9a7kx4vbkRWnGsxAKxnAIRnrPAtg9FFYM8l93Pg/YA9A31zZCeJfOOBv3znykOv2KG6W/YVpu+xtlHUjlvWXGzu3Dqd6rflx/ZRkH+0vEFofssYCXAbtSNB7O6gxylGfNhRGFFJOdT6jbbFR4jEcHa4EqKrlkOsD2LKs2J9AlGKdVtucv4I9TdQpftrrH88BUSO3QVHI7RaboRWiJW7zy+zoW/jd4Ie0b472y+Q2F+AwHXuXv79f39/GiHr3pCgXQpSxaMeYOx7cxYGBHIKkHIKQhxJ6MOimxQI25jVdWBCy0Up941DSE4JAfKQtUURDcqawrT21YUUnVHkUVoJfByheE0DCGLysIiwkiEX6zwZctkHb3JHofU0ivee7aJx/QoxOTT6b2OVMCmE/0RU0SctOfsqnOz6rS9KszI5Umh2dJHWNjsFXSsw+7nIcCEtKuys2VfILxcWwIf8TdGrI3wxQpQHU/zi5JEjD8HWclhMxX4ecMHgi4ZesOgyBGsZWokCrWD5kPM9otXwbOLK9OphesYiOWvWFA3qddNbivHFc81iq7r8ZrrvJ2Jz/zjuRqnuvQm46rtmsFO0Yaql4w7U4fH5YuJD+JiWsB3Dj9HRYdp0J81LGE7nySMmPZfxflbAemw6wGW42RLMj+bZHEtcL1145NmiPEMWGKmNAwOMkYchZyaenRYiWmgpLx0xcGfXrjwXdMw5xSG/3ZJ/5LKXa0D++I4+R9gKVwwtuVrpNzj6HS7syt/Fuj+E5ghJAAblHeFxG2rhzyWNfgRrZ2HPNDDCVjQm2P4ltPk9kZUfRRmssXRMgzGIhftL7zdCpBuClYxYi02LC7KWwK+JSH4Yj5tEhZiyjLwfBaiq4lSKGonKgzUBK5xdQr5C9wfT/5HCfx5vJhcRkQtYKVrN77BMnjtJPT5pGHK4LCCKHSBidDe/rzQt2S+7CEINL4bBsX7XiNURcTdot5/18NIPXVfiFK8GNB/tGZYhiWBSvt/n8gnN7+9kEccCJSSH4Ai4fsG+stU3BzDI+OEPMS/K7GXgz0foAf6wgVkiYIkJMk2F7/NimBayADDClrZIJDCHLUQBGTdCcKAsPXcKWqODsqABuJPFJApGpx+sskHE20jmINK6KFuAbxvgmR2cCoTE3le5KAoeODNymG7ZKP/IcbdjNrEZTmzVfzMaySEojcE3QeokTnEoYVCFCSxGAT4e3uCU7i/oxMokDCzQKq8MFeTRyv1OquEZoU/pURFgisp1oFhnfiWaxgYCkkEGH8SZMJDi1kBadlvEEcol+x6q4tQ2TwMGw8ClHzF2snu6vN0nFx4mwOUAyILQNNPY4tN1WKUeKDAr/Cj/Cg3QPBnMmhxm4bKoD1PUSML8SmcCZmCmC+dUCwizumlWobYFbEWUs3o8psoXijTeElqsCBeCVE+4wFcEIQsVg9IZNC3hyZhgI7AY1LUVv9KWFJhM/SZioY23iHN1O6bsJGd2lS1VZra/AzY0/HatTsQXG6Vl75MOhoySNjhIHlCzvq6xxMEmVCXH4sSms9wKMmLFeA0bHMxEK9Nl5jehZrEerTM8BUHmaIU5WvHzCvWW06u0NC2pJSZohXJQw3eUXfOZggX1wYMwhn1xU2EfqjZfHYhv1/F9MhGbZjw9xIkrAM0GJG6zoUs5ZhUHRR+PhWCKMGscDDlaNPUUgzcf9+V6IUVLJFSLUSp+ahC3m/9f+v6+UHDoQ9EYCAewWu81rILXyrY4cYMkdHfEyjNNYONMPOLDVd3L1MqVeWGmSqVgiyJ1j2AYptSYtACA2Haz94jN1gOprhSLFbEThhIAErkEIO7TIkOhwPA3+6EQ9cNhUUnEdAvW+0A4SnYdmCiZGhdwHfZCkTMpjlDZD9t8KtlFp+4ATNSuyJjcc1T2KC/rOGQmtIs04uc7uC+0MtxK6GVFFei14VY0QFiEfZipdpiVCajl/RXU1Azi7DaS2HoCRNzlVOmFzTt949XvwlMlKqzoWYnqZIDjZRxvcrkZJiWYkuUwa90NDUi836fn67h2X4dZWHKi+JMANJIMWf1tMphlbj4obTFr7GjokGNSEo95LMIUtgAvfTct2haFERQgYAF6FuMxCDzaoR+rDvQOfIQc+6Af0XaCFPjWYDvV+pEPVmCizfvxv3DqfqgA07sb9sRjARdgfVS/UoLHR31svBBwn/aHa8WPlf8Q07rh1pM6KZBHytXSMB1cx1z+YnQoFYOygQjMhB6RGaZ4ed6jkIRgmuNUihYrWg0erdoxYM7+AlotFAnqZQUxOej+2QNfDa0QK5aOiFZ/gKVp6eGTM9Xjt5UJihpdrYfsFbjKHxWHAAtqStYeyUKv0Zj+dB36DoCcpVHAQd+DV2xaFnz7mEyIZ5AmpeWV2DCQHS8rCcOzDGaZkI7uDmEW6Vl2FBIjI8mU+IxFetgiRZ94n2LUA1Cu5peAm8IjUgA17nnx7qqIXLGXeG0fU9sHYm5eozMNJg9kmldiOsn516qC4TGjS/JgwEQWxYY0iqWqDbVYK2tnpddKJPeCl4O1nbG0TImKmSyOdWJxUuXZ8aFMVp9Ej6/7G3MWUIv4ivFELH7H+UsyIBf0b3qZzt8NmPC1TaiKLlZBZkuDVqjWAcFuxP4pRSseyWJlWNAfjmxQ0ysQTcvFdX6t1OW3fMyxQZ8OhO/YstLtM6xtLEuCAshgEkcDWXbo0KBJMnDDBHIb0M3Xceh7mQwacg0+CEAx1lsDNYN1Xn2nb2/3ZRz70WEWRHaUR4jZaVgY6SU5/KdZRRjSvDH7wUR/wyCQJe/bWI9WQ66oka8RIUMAiD67YDFksV6ira3UD6E+BhLHBDBvIomCE4Ij1vigaFbY3hh/y0+zRLBsH5Ect8nUjo0MZKcTY3NMj4gN8QsTXplrzFgPUhKvQC42p0JVWVobpxjbWiFNWrOVzmkIYhEAZo4EZw1dPhC1R6sLmv8hVAc9c90qPTUTA8r5DbQSVZP/GjF1epXYGSVtaZen4WsHsA4oVbgl0kc6Zv8MUkrrRZiUghSzwqGUJiv8FXuac4NxxKuCWVl4aPe72LlE93mxCIP3aca+uww976xHYMsAUkeeMhMeLkyLYtw1nUyUMAQdmVGIFpPBO0g4R2YchsTXtQ5HYsmngY0JZJxLeDK4WiYgC+fdxvVvwTggMW/7UNmF6aLYjuxYfh+Moj/E5p55rzBy8Ky1MLkwfw85ugh+UrGqaRzBL0V5IhBHNzBUOF6ZFmxhJU5JFHRRM3ChyKV0kUlOLFa0rZogBvpV6joCVWzqDCw3WO4GrcRqtnrScvScvDaMkGIU307AZ2mawIo1awW6/qJ6O+aYjH4WV6+lTNQC9w0w6wvqdHjcBWqerHwECq0MDzS9ZobJYgp3ZoEnSuZBcrPB42iBJlItZM5xfmUhkhZYA7r+Ns3OFzUtNPPIY9YGbHE6sApMvZ1UeafpRrhq2SH049okePiARMLw4lIAL2+CwGAYxSihQxwKTQbbgJ011EZTEmoAcVQxzo7wY4eiFo1gHtIhYh7YAVblTxRYcehAnYwgYJPwM+kzfx/tEsmbvLbpr4oZfuifDeysoer+wvwnDfE3g5u8f2Y6OvPclsyljPKCkkWRoOhyt0DFXZXSGdcXlg+DVqFwsi/IIYw9J7/dGBB0bUfdOppvqEVuTGWiVfesB6ptKwKsq1e1GL3p0jrAsKLWzW9wLmPhASeE35nG9WiqItzmmd/LBLNMQDfRCRPQ+EaZ+rASfYYNLNJbwiwraaEdXnHOCRNpMmBKzYIJT0oIlzWoyvuiHacOdxWCuB4mzMTJW4nOFWLGCF7pYBRzKXD+hWGnAsICPEM6oue9W7w34THCvTHf5SxZx5PbDz5Rsb3bkXrioYd2qz6lnbIYjShoVKmgi9b0acyIp30nSbSGrjL8V8BNIue75mDYkJoCoBDxkSNW5nLvo5UkT/yHcEpO6hwL2K/6b6K/rA6JClDhgYaHVVfABnj1BzlU3XNQkqzcDRBVGYrdCFTgY55pvJYZHSJh0po8oQ5ooPSOlkJLgAp6axDxeumtFZ5uyETWCXwaRyjHgJyzPM4ByglXJ+DSy7stAeIMU4xhIvg5oOEmQp6IghEBhBBCCREjx/wWOgTiJ4pMiq8RaEgTNZz1JW37m6pTnOEMhMGmEWx746PGmkdk2WzAZ2e0HUuUryBUVfAqQS3wF9nbSLDjc4MqlIr7DxjsyOkN1OIIEUppw7Qh82okgSd/yKVfyflNqpufv5Wq7KsPVSJNZh7Z3Kl8TAL3BpMfe/WfuvEbnsAc19ZJ3yOZ4ccPa9bkGBSAyZIjUtBX/3qCSpXRw2yH3lK526Jc+cus3jWNQoJzfmKpH6/IVRAuh1n95CxagkndGI0O6wgiJBHOqnuDV6OK0EzkdlAGupzeBh7lpHRZPLggxqxRAn+AFlV9KgcF8W0sOGhiP96yP9no8djVEJsUoKQPmDHcAqRSllZKQuQ5IPtCJ1JOk5ujcs+XC9A0KU1q9o/VTnWJqFSyqhaxstbQN7ncc6s741ZU1eEbTWbG2nAg7t2kDXp1GrCSYReoh4TbjyYW9jByxNUW4kHP43BfFhqP416H4KhEpOk7Gp+crbROtZpsy7C4a9/d7Pij2dcAzjtSUVIyACiTiTCsCFFXZxX9SSwmvgRgNIrxRwZegXn5CxbAy2teXCjn/IsBNwsMRRxQDUOWaazPGJmom+MqTKe1s6i5FHaHXDAxdjSfZAefbdtjO9sqRHV/qPgudmgjxqmKUNGxMm6CdUcRZrQMc5BiGKENBHQOrbASVWFuSk06vFYWrRYvufc2Euwy2wH3WGEWikZzAxVl0UpkM28i3HVXbcvPoRMrcWc9Kj/+9Dnnwzry5IQ2Zomq+LXyF8KUwZAheZ/mKOMB8PDQORWeiJJBMhWw9D2kwz8UgUthMOtu0MoG4d450TtbaUKpMoWLcS53LHPwsTO332b+g6hkIRTBMpefgcdqq8GCtTsoc/ghcNMApn6FypjgCvIC6mmudjnLKennBCU5ecQjT1k8+ZOW4HWcNmI+Oo9lbFUFstT/WTHxYq4cYTcSt0KZKWIlXytN8zZRFFlDPfe5rBK4LghdVgBmDIuK6pwEJnJraMA7pMnMV+2n9TTQCnG/gT3Ok0+EhFsToUVNzCoHiZidU4LBLJK0bjQrMEkesMIWwEqOKAuqDIbPQoxnT1X2OLVW+O4+WS+ozWxDVvih7zvws5UxyWNTm0kQQjea9oNioudYbpVKfVJ8XF9wR3Uy5TKQMiZrMU9DRClg4335nYYGSgFUmkU546r8Nkxtyaa5ZGUC7Nz96v6t7aIyKbV+lPIn6cDpVgnVw7X2wdzqpetDXylyYdkVOWyl7CiOsl3IyM5mHdVxKnMMrKN4s1wMWik/zc9wn6sFvtKBgQW3S6bjmKI6MlstCUtMJHZJLvZ+jLkLt9Fq+/nBc5N8FrCwkavveGBYbC80+FWutvP4ZCfHt/uEGvPgyB5LUeIr7CqD+QXbKgY3zR+DiQagboasadPs1IfWhmcNfZdoWJlchKkRwu9mqJ6JESfL+9bWHow/btoKBPk+72+BOsYLBd51EHP9CZ6lETMuloBYDIErwyDVprDdPrI5vVgkOWq9P/IIPVjO9semovRogYjtjRW2VSFVWCN+WAwL5mN03BNwNWhFG3RuW03izAwf3SieJoeUWHO6CdU/CWlzOeRDmY0AUGS2We2Cyhx2HHEzR7v8roNoVUrseKxl7KpX+ABgcR4koFQNEsxqznfnuVFCT8x+yNKzZVZk5hd9smb5vDLMLs/dAbnt3v4ldjarkAQFsOEVcbmrWrTL/mS0ye7vk4rPniwNRGqPggihMXrlwI18HDAHKEhd2lAMswtRptvHhgiFNcnpSBIF3EztUOYthk0hbEM/2tCnWukcoK277Ra7e5VEKyVKYbMSMQNaBZ5SM0FoDXp4sjmOM3cw1jTskrqhz4bqDi0RHPepCVVZYIiVM6P8CuPzmuU9y7EVjG8t/MdCad/RCo6hFZ4OCc8PIO8NG5eYdZvUnXIuhPAoWpjJDHXpx76LFwViGJVJrPlIov/e8CE7P9qlVKYg0TCudlDJ8CZNehXwC8Is1liLkGwP02uHmIOsiIlmipCk9HGJIidpYV/AChAkOUiTjIgs711mCYN0lLNIQ1oLlwW3rSTWxNp2URwUoTEqB7VsL1D0lXTkBCE95W37FbsgmOUmbJAsgaK0QebyFFZOByu2hyhKlOGeaKf6ZMRHw4D9C9lEcTE8S06vujcIOKSzeEoZqyqHU0NE+YSDpDmD2WIZ1K5VN/3Q3RNl46tEvXhC2dyXT/FhDasJPznuiE2exakWwywT6H3cab5OktvXN8K+k7Q6Tj4jmvdkyJNGBsnMZz2YFj3Ns7K4YOK5y2BFdxS5vsZM862Hc8gX6JKUQvZcTrCWJXthaQCAz5CJxApZsIciW0YIc7isdKZKVFjLebCT/a6aL6GWGXd3GgXUdJzyPWw0zloNoWa5Fzmgi329t9WxzgUplVwCmOdbqIANf5Dod+gvdtLMBkhhbXzAcy8YoAfKdaUXsUw03a9/CtOPMZsSVD/v5DsNF4NZ3fSHsGJWUn2tpDIHUoRZ0InD8nqJ4J/0pRxjWHjU0d4IHDDDLEN8XJaFJE+m7+WDW8JnYzA7S7fHx/j80/U2zwawHFEywHexqSO22l8ZWjKVyZRzV2omHwYKkSZ9BagkFUe+gg3E7HcpdeISdAWReQIErmQlEnLE3Gya3iMv/MS3x/cR5+1U+BPK3H7I46Z81p6+k/OxQujxd3ghkVsqaxaVB0Eqe2Bo0RHPwndKqqdMgW+yWwwVQoBK1dpQxeynvRq/Ww/qvWCUKOcPA4uqt8FsKwzcGhHG/cv+IGDt+WgSHf3Qz6O6ZEiKiQSVc/1DYByr/D0OPVkZoKmF1YplUAVonjS3ZVkIXOzSXkN3GX1i1Wpa8SQzShYJWkVT4X1Wi8s8k156nhVUlOv1IE+7VxqF0gm5KVEFwGRr1jSgblKqDMtycnTKCYXHrOdiM4dnS9jaaGDbrvcjVqwjRxENh1ruvMIkC01xZXErCMIKVPGWa5q+fpdEW+J0nJyLYK3HJ8I5YRaSt/2D0vVpO25oMCtbpWYTp/hhNPQ4fpMTgLpVfrvcpV7IimXqvE2jTyVmOOxceSQkPB0bhmtheMq83OcF+SoyEH95HbqrAxcshr22YCsSk2XBm4nc1LryoCnQzabO5ihB3gqbwa8piuA1DCqloniZHymP5yCBLpHYqlBUkoqKQn7HjTpCNjdxe07fWSfU2TmJu213e4mn4673I/U5mPm9PtbHODSyYBObqCU2+EbT1uCm/N0Is9zKXfVflzJ/VhqgzczXLR/W9X4HpZUT9RvCXAlVKcBKZTBr7uJiq5we6MWEjdrAljkEdIemamJtXtmW2vDJkPAx3T0Fl0Vpw1MmZ78sVFiyTQ09raZTldghs97Uqzk5CV+vdIfQqu8SjZytiZPKQ9kzdd3bxICGrPFlXIJ7NZtIA4xUlY2YLQ+RZrKCjWud5bfL3sY1Lb4+KPr1arCPkvI0o5qG36IeFS0zmIDOhFrdRbQTrOLm0hhIijjYbDAa1NQh6U0GB7cEsupEGj+mQY55w9+Wd9TlUdFimbKu92FniAPxAUf7YwyrETqJzdiwHCo2UKJMGOgn5XGvlX3XSfl06Ya+q1A2n4evrulCSMsviLstyolWPZBoZTX7QqHHVB1PleCgYZmazospcEGsqeDFslIY85pm05DrRIyFnGno1zDBQf4M2EjP8cCz5fO9G35m+X8BWNXPBkUtrKqB3J7PO0cKraV+050yoda6jncp7Vdni7LPWl7FADC909ChWqR+FR3BFgpZ54QNW1l4q4dn4hKL85TmR5XLjXyS4zMdt41Wpy82PgBYZ6bLb9vfHZTcbLKXPGSyb/uOsmX1UlbCTN4OIGUUTJNSdIh5nZloE4f6RMkF2c2MEal2HhoIha6TmgMZLBJyYmEyh4L05USswqegGjnklzcTs1p3B44/sHiEA5sL11eZelWmqu5/ZK345orxj76gfeiNyYQHw0aWB34/LK3pXFk3jhEomKck6HehFeUyZpLWIe+431XDKAbZza+gZ1vgm9XI7OzCwzjFi9X9BcDZHWZRRA9mY3f/Q/SuzrIJzQcHOg60gv44MLW+qpMsu4lWxpkWytvX8JTaAUGPVjG/diW3ZKbVBPVn1vo+LbNPwWxiwKdxoOmH22pXJtUzVFpIYrcqmEi9YZgDZco+sSRighsgdtOmQyaOQ1yTFFpaSQZtojqvqJiXgmxjdVXBZHSKz9sJBB8gtka2Q2Uwvz2T50S2qnLWULtwTGtbXTMxmdBbu0QHKMF2KpVKYFjrnLEeIafVTSpF4Vg3tPVEbFaHWkuvhu9SvIKdxgzzh8EsNbxg1MiwyYGwgriUV/7yrfNDh8U56lXS6l+i0i+OORjw6ODgkZDwXARQMqN50WsamYokj26yyxNN0gOBVb26mNaTA6JBFn2b5yBaDUP/vGr2KAAqFxfaiqmFuHnSVgXLGBmnL1AfWhJ1CzqKRk2iEgk5LysXXqjhWnEfYGM2S2aPxWxNp222EYxumoVFNYnmgUlBTQ5X3DinJCazTnGr8Gq1N/bE0hNbUiRo3sdC1cYd6G3zOJrZp/6gUIskLWhL+yV8+V1BquGbFNKuz2xiECdpvawZrNp8qv7coL49WLuDlMtH9daa7WCo3PBijWAHiBUbADuFWUcWoajj04aehda78GHgJNONg2nIoNXQPV+GZtNOO3nJuQykGGL1MS1hcayL9UM0L3uJGmn9tc3DdbNJnKHiVQ2F5E0tXdXmKJAxRoQbD+forirjTcECT8RzefV2Ap9jfOin6UWHdI1Thi98qFolHOoDkCRaeYLZt43RRr4GDS2r1S+pAlU3SDTwizALSYanoUOhlFR/iOHJurTkgcGFgsFBZzCLlkxf3vMUo+tk7KnTCw7fRHfRZXh4JBh8XMP6xEtR1lCS2JM6MBphut86ILg1fQxbQGPAS9tI826Xt6GpmTZpHy2fkyQ2SDt5uawmbx2UnXmenQoGdcjn+dmrpyYKrYy5w6pcCXfVQww+1a2ui4fUzUPyT4KPWJH095+HrX2SpSK+6JWtT5EVDnztyXz1sc9VBvER2N0FiLRYks8NBHQ81MJ2eZVy7EKE0i57o0mUn96sDP9sC9yoRusj0JLOVOA7CFXjerq7/9DDM5Dj4euxZQ+wiuG8xrfxtVjX0ryoFiOTkhZtNvRquxwhapqXAxdafpXSgLrfdlIaptb3sBHrVfwB7GLPBH8+dG3oDlUU8ws0ayhWOcuJD1ak5nwAYaOVAx7puzvi44EYP1mlAo49Dzf2Sd2bmKX4hXOaQ6N1NNa/SD+2ltIol7eoD0VUq3cojT3iQcirajqmdvNdmqZpuJKVtHD7oVWNU8nZAHJ6FZp6JSzW9jW+RNvXSdg1oSUtezC/0lhkRfgSNkWXUiNTzeoaIB5F+UcZViM29AIQpa8yYaBuNva+k08XP0Nwo6OCaA032MWi55CfyBT4fLVzbtLHbHuIh0MYwYC13S+6EbXBtk4BqbyYS0pBs2jEKNC8SblJO2eLmyu+PUZfHo65Ho7IPj8N6EvqeTz7YO74PXB8bPbJ0k5fy6jlJS39TxPf6f4iBGzDU7XZazni+BuN9Nn8fLTU4E0Jg1mmQISj15P7J8iaL+X0B+i53oDVvbstNoXWRZTDcY+ilXl1f/8f/+fQo7uJJS60x2kitEJs7mxw6sUm/dwOglrfart41/stHsKU9Xwdu2q0DBUqlNeZbPcktCFurrN4dBvDISzoVmNqFWD726zc/6KWpn/JF+7lLMd16cA85MS2nrWj5KAd8gM78bg+utLy2fuZ0pI4GhkdLM8y4aG6U5sysSHA+cCWfPVCjiZidQXW+og5xI26nuxESFL6uQcPoDobZ1biN7cManQtFVWg8bu+f74OsL1OQftbskcEp5WdczN23ZMpsFS7anythHMT0X9MNDs616NKqo9Qj4ZbQNZSlPJhr4biDq1blYW3B7D+1+vLEOpAXFwfIdWPcMSGhEQ5ZPSC/bOQ/S5C1YLNTo2/CfFKsw4tdJKkZYf2cr3piOuV3O4dXn43PIsvWpH92ESOAhfdf3My3Ofly/7Q5awjEdgw0MRok9bYCusMulyG7skPCDYDt3ZU6MJA5Z1WNk9p/3Tpd5577eeGKertvkTRih0RK1DUQKeaAoV7UAK7T+m6hgWNFAK/wOunw9ODPOtIqZtTqutaLrm0KNQK8hCeOwtSzUnSIncCtX/rVl/U5TdaE0wcwqm0E0h1+V3AD1OOKNF5lbToEHr8rkiGg58PWO1TuM+LgZKNLiMNWo1+hmBDmm3mXLZ/5sVFmhgKvI6DHRDc66hY84zbRXTephmx6kwvbnViJoQWfxQbcJaVcyYchlN949c8wv9UyIbtBz9ugtg2sKGVtG7/VG15aLcyZHcgBeqN1qAn3jH3t3+o4beiQDzYuAxxQ+i6+U20GKVe5O0fOH5HK379fMAqerehVB/TdPcpXCrhonMbXNIBwRZXrSEXUk6r5WOKgNjR+mDjMMidltFAAeu0IutWGcU14WKbaycCaGvZLAH7I0rH0O0Xk/oLkQmOjR5ud/At/wmeePCg6u7/BPWih+fcVAWHRjN090wJv0k1t92B7Aj/Afgtc2kdfwiauJLmBJsCUbVmi6+G+PEFoXv4Qds/cO9MMPV2CzFarmqtKUMNuDiJ/fgQNUMujWiIVZgeKOyA4MuVkqrvx0Glux1dgtPZ5oqAY0/JDZ0bjksHtWRKsF3j3Zw+p3EL/nT+Be2nAB77yfbHLyz50PXBnbykR4ZNTtPhHdGAco3ioofvO/2/UQwlDrx0BviEXjkBTK/QKcwA5ThmUYYs2U0/nN2hqunZZX4mikDlg+HhOcBy67+/TxPiltA1kNvAgstDUsuiVHRa2V/0fWfQSsIBbKrdYFLBDMLyyR01negw48cDJwJnpIttgBON9RK+WpT5E4Kl40s6f2YtQnGyKPyiM8SvukxHi5LLfVWgilTLW304TAQ1+HT5m7z/sHYHl4Dhw3Audflet1Dt1Ra7UV3/1q0FNhq4XvqPf5hDGDb3AGYdsDUEBEVhSArFaLglKhta9e3pIuWBqtQggjSmSN/sgODQPz8NUC5ceuxKzrZAvfEQ3C0Pzj8K4Iv3+/X6VxK4HgG4RgMGJIOCgRo7DAe7vy3GwIHyMZh/9ZIUCJ1N8ACn6k9eDvJPXIJ/onWSZKqgSSrDqc51wtagNL7ZjFZ5XdOEwmPfv1yHo1ZlzMWg+7x8cBUf8DoOmWZfzrHYuMW3UOCGnWo/1sDTcIYPNesvgK9treVsOAQNEotbttctblhmkoF2lpvqQbEotrry9cEz/dLkNp9nsrsOr/p2bSM7ZdNXPZDREdZJgiG/KGlk/yHwe1lgC6dSEHRDh3/YqddNKmoN8bMaf09yPHw+JAwkBbGd2Mx2WwMuT2N/JlqL+66L6Ni5x2FlwKeLHRA8pnyVtz5RwfCEHHTunuNJV+fGI+ULYjc8GZKd9ZufNdTjsXL2AkKopk/HM+e1a4v8OZHzTxjhrfq27OQb63h4SIFyQ4edKcRXuLOSfCwQT/Q+KnAFwbfqLBGPlHN/+39qLAYoHwYscwjDULKZzOVOkiT2YV1DsFlSs0KLxne7LkVS4MXEgg+OgCbzDc83lyPmg0+kJv6ijgH/ncLJv9C0keXi+vk1x0eLIlOVVqcVqKD59M800nf/4ewOlgRZSWv8LSvwoP/TgmDfTT/EhoHWDVDqFzV+O4JZWxqWpjAwGaqrXyYJ3wy56rozcU3cycSZbx+TinmjaT7zt6dLZRJPK85IX4YPvt5mrfVfoBnBA/X9RB8+wjAOrb/0ic6En/7JLh3ELzovPEDpML28eIC2HrsAcNa39VgDjApU/0AtDb5gdwE1gYeYtUDZafkIcbMFDrBMsIn1JjaUlJdiFJsuLVrStQVY86JfOetpMbSuDS4HOqjhbm+3iZ/KYDX7TsJDV4eSZL3f5p+COn8F0ok9XefX68+hd3AcVfBPq1TzK5rEBwI3nOXtBTpJNe+vJJmjih1ruQk3G/GBChr07A0IzrA5UcmAEc2XlP0G1DZF948pEb9bL0OrXi4jwIFLCnWN6e5EK7/rZbBTDh+6gYaivVNSK/VpFMIvw5gvPSb+Jf3i1+vPu9rngHEn7pleBU2I+W3XWV7JvQNyuf7eTa8kw4e4Z/pheJAev+8UiHWepa5/l5OdwbNNoG7/EON3sqG2GFK5JI9hKNOidq8IgctlAHjksUPB5n3KNKansb9eBmhGyFsAobNBzPI3B1dmgD+hDVeHun69/lWZGZ4Zf8RzrW+zYC9p/a7lA1owOFGJZi/HAp1L63e3pMU5LyBITVOvIUmyXFWpbNYaC7WVAcr/L8AA+dSd3OMf2BsAAAAASUVORK5CYII=) no-repeat;background-size:100%;margin-right:0rem;padding:6rem;text-align:center}.jt-drawing-dialog .el-dialog .el-dialog__headerbtn{height:34rem}.jt-drawing-dialog .el-dialog .content{height:calc(100% - 120rem);width:92%;overflow-y:auto;padding:5rem 0 0;position:absolute}.jt-drawing-dialog .el-dialog .el-collapse{--el-collapse-border-color: rgb(0 44 126 / 0%);--el-collapse-header-text-color: #ffffff;--el-collapse-header-font-size: 13rem;--el-collapse-content-bg-color: rgb(0 44 126 / 0%);--el-collapse-content-font-size: 13rem;--el-collapse-content-text-color: rgb(216 240 255);--el-collapse-header-height: 40rem;--el-collapse-header-bg-color: rgb(30 130 255)}.jt-drawing-dialog .el-dialog .el-collapse .el-collapse-item__header{background-color:#409eff;border-bottom:2px solid rgb(22,90,190)}.jt-drawing-dialog .el-dialog .el-collapse .el-collapse-item__content{padding:10rem}.jt-drawing-dialog .el-dialog .el-dialog__body{padding:10rem;color:#fff}.jt-drawing-dialog .el-dialog .el-color-picker__trigger{width:120rem}.jt-drawing-dialog .el-dialog .el-body-foot{position:absolute;bottom:8rem;right:8rem;width:calc(100% - 16rem)}.jt-drawing-dialog .el-dialog .el-body-foot .el-button-group{display:flex}.jt-drawing-dialog .el-dialog .el-body-foot .el-button-group .el-button{border:solid 0rem rgb(255,0,0);flex:1}
  44161. `;
  44162. const _hoisted_1 = { class: "jt-drawing-dialog" };
  44163. const _hoisted_2 = {
  44164. slot: "title",
  44165. class: "header-title"
  44166. };
  44167. const _hoisted_3 = { style: { "line-height": "24rem", "font-size": "16rem", "color": "#fff", "font-family": "'Alimama_ShuHeiTi_Bold'" } };
  44168. const _hoisted_4 = { class: "content" };
  44169. const _hoisted_5 = {
  44170. class: "jt-drawing-row",
  44171. style: { "height": "60rem" }
  44172. };
  44173. const _hoisted_6 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u5185\u5BB9", -1);
  44174. const _hoisted_7 = { class: "col-main" };
  44175. const _hoisted_8 = { class: "jt-drawing-row" };
  44176. const _hoisted_9 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u5B57\u4F53", -1);
  44177. const _hoisted_10 = { class: "col-main" };
  44178. const _hoisted_11 = { class: "jt-drawing-row" };
  44179. const _hoisted_12 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u5B57\u4F53\u5927\u5C0F", -1);
  44180. const _hoisted_13 = { class: "col-main" };
  44181. const _hoisted_14 = { class: "jt-drawing-row" };
  44182. const _hoisted_15 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u662F\u5426\u52A0\u7C97", -1);
  44183. const _hoisted_16 = { class: "col-main" };
  44184. const _hoisted_17 = { class: "jt-drawing-row" };
  44185. const _hoisted_18 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u662F\u5426\u659C\u4F53", -1);
  44186. const _hoisted_19 = { class: "col-main" };
  44187. const _hoisted_20 = { class: "jt-drawing-row" };
  44188. const _hoisted_21 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u989C\u8272", -1);
  44189. const _hoisted_22 = { class: "col-main" };
  44190. const _hoisted_23 = { class: "jt-drawing-row" };
  44191. const _hoisted_24 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u662F\u5426\u8FB9\u6846", -1);
  44192. const _hoisted_25 = { class: "col-main" };
  44193. const _hoisted_26 = { class: "jt-drawing-row" };
  44194. const _hoisted_27 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u8FB9\u6846\u989C\u8272", -1);
  44195. const _hoisted_28 = { class: "col-main" };
  44196. const _hoisted_29 = { class: "jt-drawing-row" };
  44197. const _hoisted_30 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u8FB9\u6846\u5BBD\u5EA6", -1);
  44198. const _hoisted_31 = { class: "col-main" };
  44199. const _hoisted_32 = { class: "jt-drawing-row" };
  44200. const _hoisted_33 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u662F\u5426\u80CC\u666F", -1);
  44201. const _hoisted_34 = { class: "col-main" };
  44202. const _hoisted_35 = { class: "jt-drawing-row" };
  44203. const _hoisted_36 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u80CC\u666F\u989C\u8272", -1);
  44204. const _hoisted_37 = { class: "col-main" };
  44205. const _hoisted_38 = { class: "jt-drawing-row" };
  44206. const _hoisted_39 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u80CC\u666F\u5185\u8FB9\u8DDD", -1);
  44207. const _hoisted_40 = { class: "col-main" };
  44208. const _hoisted_41 = { class: "jt-drawing-row" };
  44209. const _hoisted_42 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6A2A\u5411\u504F\u79FB\u50CF\u7D20", -1);
  44210. const _hoisted_43 = { class: "col-main" };
  44211. const _hoisted_44 = { class: "jt-drawing-row" };
  44212. const _hoisted_45 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u7EB5\u5411\u504F\u79FB\u50CF\u7D20", -1);
  44213. const _hoisted_46 = { class: "col-main" };
  44214. const _hoisted_47 = { class: "jt-drawing-row" };
  44215. const _hoisted_48 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u50CF\u7D20\u5927\u5C0F", -1);
  44216. const _hoisted_49 = { class: "col-main" };
  44217. const _hoisted_50 = { class: "jt-drawing-row" };
  44218. const _hoisted_51 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u989C\u8272", -1);
  44219. const _hoisted_52 = { class: "col-main" };
  44220. const _hoisted_53 = { class: "jt-drawing-row" };
  44221. const _hoisted_54 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u662F\u5426\u8FB9\u6846", -1);
  44222. const _hoisted_55 = { class: "col-main" };
  44223. const _hoisted_56 = { class: "jt-drawing-row" };
  44224. const _hoisted_57 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u8FB9\u6846\u989C\u8272", -1);
  44225. const _hoisted_58 = { class: "col-main" };
  44226. const _hoisted_59 = { class: "jt-drawing-row" };
  44227. const _hoisted_60 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u8FB9\u6846\u5BBD\u5EA6", -1);
  44228. const _hoisted_61 = { class: "col-main" };
  44229. const _hoisted_62 = {
  44230. class: "jt-drawing-row",
  44231. style: { "height": "60rem" }
  44232. };
  44233. const _hoisted_63 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u56FE\u6807", -1);
  44234. const _hoisted_64 = { class: "col-main" };
  44235. const _hoisted_65 = { class: "jt-drawing-row" };
  44236. const _hoisted_66 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u5927\u5C0F\u6BD4\u4F8B", -1);
  44237. const _hoisted_67 = { class: "col-main" };
  44238. const _hoisted_68 = {
  44239. class: "jt-drawing-row",
  44240. style: { "height": "60rem" }
  44241. };
  44242. const _hoisted_69 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6A21\u578B\u8DEF\u5F84", -1);
  44243. const _hoisted_70 = { class: "col-main" };
  44244. const _hoisted_71 = { class: "jt-drawing-row" };
  44245. const _hoisted_72 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u900F\u660E\u5EA6", -1);
  44246. const _hoisted_73 = { class: "col-main" };
  44247. const _hoisted_74 = { class: "jt-drawing-row" };
  44248. const _hoisted_75 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6700\u5C0F\u50CF\u7D20\u5927\u5C0F", -1);
  44249. const _hoisted_76 = { class: "col-main" };
  44250. const _hoisted_77 = { class: "jt-drawing-row" };
  44251. const _hoisted_78 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u662F\u5426\u8FB9\u6846", -1);
  44252. const _hoisted_79 = { class: "col-main" };
  44253. const _hoisted_80 = { class: "jt-drawing-row" };
  44254. const _hoisted_81 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u8FB9\u6846\u989C\u8272", -1);
  44255. const _hoisted_82 = { class: "col-main" };
  44256. const _hoisted_83 = { class: "jt-drawing-row" };
  44257. const _hoisted_84 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u8FB9\u6846\u5BBD\u5EA6", -1);
  44258. const _hoisted_85 = { class: "col-main" };
  44259. const _hoisted_86 = { class: "el-body-foot" };
  44260. const _sfc_main = {
  44261. __name: "CrEditProperty_Point.ce",
  44262. props: {
  44263. params: {
  44264. id: {
  44265. type: String,
  44266. default: () => void 0
  44267. },
  44268. text: {
  44269. type: String,
  44270. default: () => ""
  44271. },
  44272. font: {
  44273. type: String,
  44274. default: () => ""
  44275. },
  44276. fontSize: {
  44277. type: Number,
  44278. default: () => 24
  44279. },
  44280. color: {
  44281. type: String,
  44282. default: () => "255,255,0,0.9"
  44283. }
  44284. },
  44285. showDialog: {
  44286. type: Boolean,
  44287. default: () => false
  44288. }
  44289. },
  44290. emits: ["submit", "update:showDialog", "update:params", "remove"],
  44291. setup(__props, { emit }) {
  44292. const props = __props;
  44293. const language = ref("zh-cn");
  44294. const locale = computed$1(() => language.value === "zh-cn" ? zhCn : en);
  44295. const {
  44296. proxy
  44297. } = getCurrentInstance();
  44298. const predefineColors = ref([
  44299. "#ff4500",
  44300. "#ff8c00",
  44301. "#ffd700",
  44302. "#90ee90",
  44303. "#00ced1",
  44304. "#1e90ff",
  44305. "#c71585",
  44306. "rgba(255, 69, 0, 0.68)",
  44307. "rgb(255, 120, 0)",
  44308. "hsv(51, 100, 98)",
  44309. "hsva(120, 40, 94, 0.5)",
  44310. "hsl(181, 100%, 37%)",
  44311. "hsla(209, 100%, 56%, 0.73)",
  44312. "#c7158577"
  44313. ]);
  44314. const selectOptionsFont = [
  44315. {
  44316. value: "Helvetica",
  44317. label: "\u9ED8\u8BA4\u5B57\u4F53"
  44318. },
  44319. {
  44320. value: "Microsoft YaHei",
  44321. label: "\u5FAE\u8F6F\u96C5\u9ED1"
  44322. },
  44323. {
  44324. value: "\u5B8B\u4F53",
  44325. label: "\u5B8B\u4F53"
  44326. },
  44327. {
  44328. value: "\u6977\u4F53",
  44329. label: "\u6977\u4F53"
  44330. },
  44331. {
  44332. value: "\u96B6\u4E66",
  44333. label: "\u96B6\u4E66"
  44334. },
  44335. {
  44336. value: "\u9ED1\u4F53",
  44337. label: "\u9ED1\u4F53"
  44338. }
  44339. ];
  44340. const activeNames = ref(["1"]);
  44341. const title = ref("\u5C5E\u6027\u7F16\u8F91");
  44342. const dialogVisible = ref(props.showDialog);
  44343. const isShowLabelStyle = ref(false);
  44344. const isShowPointStyle = ref(false);
  44345. const isShowBillboardStyle = ref(false);
  44346. const isShowModelStyle = ref(false);
  44347. const label2 = ref({
  44348. content: "",
  44349. font: "",
  44350. fontSize: 0,
  44351. bolder: false,
  44352. italic: false,
  44353. fillColor: "",
  44354. showOutline: false,
  44355. outlineColor: "",
  44356. outlineWidth: 0,
  44357. showBackground: false,
  44358. backgroundColor: "",
  44359. backgroundPadding: 0,
  44360. pixelOffsetX: 0,
  44361. pixelOffsetY: 0
  44362. });
  44363. const point2 = ref({
  44364. color: "",
  44365. pixelSize: 10,
  44366. showOutline: false,
  44367. outlineColor: "",
  44368. outlineWidth: 0
  44369. });
  44370. const billboard = ref({
  44371. imgUrl: "",
  44372. alpha: 1,
  44373. scale: 1
  44374. });
  44375. const model = ref({
  44376. url: "",
  44377. alpha: 1,
  44378. showSilhouette: false,
  44379. silhouetteSize: 0,
  44380. silhouetteColor: "rgba(255,255,255,1)",
  44381. minimumPixelSize: 1,
  44382. maximumScale: 1,
  44383. heading: 0,
  44384. pitch: 0,
  44385. roll: 0
  44386. });
  44387. updateParams(props.params);
  44388. function updateParams(params) {
  44389. proxy._params = params;
  44390. _setShowControls(false);
  44391. if (params.id === DrawPoint.DrawType.Label) {
  44392. title.value = "\u6587\u5B57\u7F16\u8F91";
  44393. activeNames.value = ["\u6807\u6CE8\u6837\u5F0F"];
  44394. isShowLabelStyle.value = true;
  44395. label2.value.content = params.label.text;
  44396. label2.value.font = params.label.font;
  44397. label2.value.fontSize = params.label.fontSize;
  44398. label2.value.fillColor = params.label.fillColor;
  44399. label2.value.showOutline = params.label.showOutline;
  44400. label2.value.outlineColor = params.label.outlineColor;
  44401. label2.value.outlineWidth = params.label.outlineWidth;
  44402. label2.value.showBackground = params.label.showBackground;
  44403. label2.value.backgroundColor = params.label.backgroundColor;
  44404. label2.value.backgroundPadding = params.label.backgroundPadding;
  44405. label2.value.pixelOffsetX = params.label.pixelOffsetX;
  44406. label2.value.pixelOffsetY = params.label.pixelOffsetY;
  44407. } else if (params.id === DrawPoint.DrawType.Point) {
  44408. title.value = "\u70B9\u7F16\u8F91";
  44409. activeNames.value = ["\u70B9\u6837\u5F0F"];
  44410. isShowPointStyle.value = true;
  44411. point2.value.color = params.point.color;
  44412. point2.value.pixelSize = params.point.pixelSize;
  44413. point2.value.showOutline = params.point.showOutline;
  44414. point2.value.outlineColor = params.point.outlineColor;
  44415. point2.value.outlineWidth = params.point.outlineWidth;
  44416. } else if (params.id === DrawPoint.DrawType.Point2Label) {
  44417. title.value = "\u70B9\u53CA\u6587\u5B57\u7F16\u8F91";
  44418. activeNames.value = ["\u70B9\u6837\u5F0F", "\u6807\u6CE8\u6837\u5F0F"];
  44419. isShowPointStyle.value = true;
  44420. isShowLabelStyle.value = true;
  44421. point2.value.color = params.point.color;
  44422. point2.value.pixelSize = params.point.pixelSize;
  44423. point2.value.showOutline = params.point.showOutline;
  44424. point2.value.outlineColor = params.point.outlineColor;
  44425. point2.value.outlineWidth = params.point.outlineWidth;
  44426. label2.value.content = params.label.text;
  44427. label2.value.font = params.label.font;
  44428. label2.value.fontSize = params.label.fontSize;
  44429. label2.value.fillColor = params.label.fillColor;
  44430. label2.value.showOutline = params.label.showOutline;
  44431. label2.value.outlineColor = params.label.outlineColor;
  44432. label2.value.outlineWidth = params.label.outlineWidth;
  44433. label2.value.showBackground = params.label.showBackground;
  44434. label2.value.backgroundColor = params.label.backgroundColor;
  44435. label2.value.backgroundPadding = params.label.backgroundPadding;
  44436. label2.value.pixelOffsetX = params.label.pixelOffsetX;
  44437. label2.value.pixelOffsetY = params.label.pixelOffsetY;
  44438. } else if (params.id === DrawPoint.DrawType.Billboard) {
  44439. title.value = "\u5E7F\u544A\u724C\u7F16\u8F91";
  44440. activeNames.value = ["\u56FE\u7247\u6837\u5F0F"];
  44441. isShowBillboardStyle.value = true;
  44442. billboard.value.imgUrl = params.billboard.imgUrl;
  44443. billboard.value.alpha = params.billboard.alpha;
  44444. billboard.value.scale = params.billboard.scale;
  44445. } else if (params.id === DrawPoint.DrawType.Billboard2Label) {
  44446. title.value = "\u5E7F\u544A\u724C\u53CA\u6587\u5B57\u5706\u7F16\u8F91";
  44447. activeNames.value = ["\u56FE\u7247\u6837\u5F0F", "\u6807\u6CE8\u6837\u5F0F"];
  44448. isShowBillboardStyle.value = true;
  44449. isShowLabelStyle.value = true;
  44450. billboard.value.imgUrl = params.billboard.imgUrl;
  44451. billboard.value.alpha = params.billboard.alpha;
  44452. billboard.value.scale = params.billboard.scale;
  44453. label2.value.content = params.label.text;
  44454. label2.value.font = params.label.font;
  44455. label2.value.fontSize = params.label.fontSize;
  44456. label2.value.fillColor = params.label.fillColor;
  44457. label2.value.showOutline = params.label.showOutline;
  44458. label2.value.outlineColor = params.label.outlineColor;
  44459. label2.value.outlineWidth = params.label.outlineWidth;
  44460. label2.value.showBackground = params.label.showBackground;
  44461. label2.value.backgroundColor = params.label.backgroundColor;
  44462. label2.value.backgroundPadding = params.label.backgroundPadding;
  44463. label2.value.pixelOffsetX = params.label.pixelOffsetX;
  44464. label2.value.pixelOffsetY = params.label.pixelOffsetY;
  44465. } else if (params.id === DrawPoint.DrawType.Model) {
  44466. title.value = "\u5C0F\u6A21\u578B\u7F16\u8F91";
  44467. activeNames.value = ["\u5C0F\u6A21\u578B\u6837\u5F0F"];
  44468. isShowModelStyle.value = true;
  44469. model.value.url = params.model.url;
  44470. model.value.alpha = params.model.alpha;
  44471. model.value.showSilhouette = params.model.showSilhouette;
  44472. model.value.silhouetteColor = params.model.silhouetteColor;
  44473. model.value.silhouetteSize = params.model.silhouetteSize;
  44474. model.value.minimumPixelSize = params.model.minimumPixelSize;
  44475. model.value.maximumScale = params.model.maximumScale;
  44476. model.value.heading = params.model.heading;
  44477. model.value.pitch = params.model.pitch;
  44478. model.value.roll = params.model.roll;
  44479. }
  44480. }
  44481. function _setShowControls(isShow) {
  44482. isShowLabelStyle.value = isShow;
  44483. isShowPointStyle.value = isShow;
  44484. isShowBillboardStyle.value = isShow;
  44485. isShowModelStyle.value = isShow;
  44486. }
  44487. function submit() {
  44488. let outParam = proxy._params;
  44489. outParam = {
  44490. id: outParam.id,
  44491. label: {
  44492. text: label2.value.content,
  44493. font: label2.value.font,
  44494. fontSize: label2.value.fontSize,
  44495. bolder: label2.value.bolder,
  44496. italic: label2.value.italic,
  44497. fillColor: label2.value.fillColor,
  44498. showOutline: label2.value.showOutline,
  44499. outlineWidth: label2.value.outlineWidth,
  44500. outlineColor: label2.value.outlineColor,
  44501. showBackground: label2.value.showBackground,
  44502. backgroundColor: label2.value.backgroundColor,
  44503. backgroundPadding: label2.value.backgroundPadding,
  44504. pixelOffsetX: label2.value.pixelOffsetX,
  44505. pixelOffsetY: label2.value.pixelOffsetY
  44506. },
  44507. point: {
  44508. color: point2.value.color,
  44509. pixelSize: point2.value.pixelSize,
  44510. showOutline: point2.value.showOutline,
  44511. outlineWidth: point2.value.outlineWidth,
  44512. outlineColor: point2.value.outlineColor
  44513. },
  44514. billboard: {
  44515. imgUrl: billboard.value.imgUrl,
  44516. alpha: billboard.value.alpha,
  44517. scale: billboard.value.scale
  44518. },
  44519. model: {
  44520. url: model.value.url,
  44521. alpha: model.value.alpha,
  44522. showSilhouette: model.value.showSilhouette,
  44523. silhouetteColor: model.value.silhouetteColor,
  44524. silhouetteSize: model.value.silhouetteSize,
  44525. minimumPixelSize: model.value.minimumPixelSize,
  44526. maximumScale: model.value.maximumScale,
  44527. heading: model.value.heading,
  44528. pitch: model.value.pitch,
  44529. roll: model.value.roll
  44530. }
  44531. };
  44532. emit("submit", outParam);
  44533. }
  44534. function close() {
  44535. dialogVisible.value = false;
  44536. }
  44537. function remove2() {
  44538. emit("remove", {});
  44539. dialogVisible.value = false;
  44540. }
  44541. function closeDialog() {
  44542. emit("update:showDialog", false);
  44543. }
  44544. function openDialog() {
  44545. updateParams(props.params);
  44546. }
  44547. return (_ctx, _cache) => {
  44548. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  44549. return openBlock(), createElementBlock("div", _hoisted_1, [
  44550. createVNode(unref(ElDialog), {
  44551. modal: false,
  44552. "destroy-on-close": false,
  44553. modelValue: dialogVisible.value,
  44554. "onUpdate:modelValue": _cache[31] || (_cache[31] = ($event) => dialogVisible.value = $event),
  44555. title: title.value,
  44556. onClose: closeDialog,
  44557. onOpen: openDialog,
  44558. "show-close": false
  44559. }, {
  44560. header: withCtx(() => [
  44561. createElementVNode("div", _hoisted_2, [
  44562. createElementVNode("span", _hoisted_3, toDisplayString(title.value), 1)
  44563. ])
  44564. ]),
  44565. default: withCtx(() => [
  44566. createVNode(_component_el_scrollbar, null, {
  44567. default: withCtx(() => [
  44568. createElementVNode("div", _hoisted_4, [
  44569. createVNode(unref(ElCollapse), {
  44570. modelValue: activeNames.value,
  44571. "onUpdate:modelValue": _cache[27] || (_cache[27] = ($event) => activeNames.value = $event)
  44572. }, {
  44573. default: withCtx(() => [
  44574. withDirectives(createVNode(unref(ElCollapseItem), { name: "\u6807\u6CE8\u6837\u5F0F" }, {
  44575. title: withCtx(() => [
  44576. createVNode(unref(ElIcon), { style: { "padding": "10rem" } }, {
  44577. default: withCtx(() => [
  44578. createVNode(unref(setting_default))
  44579. ]),
  44580. _: 1
  44581. }),
  44582. createTextVNode("\u6807\u6CE8\u6837\u5F0F ")
  44583. ]),
  44584. default: withCtx(() => [
  44585. createElementVNode("div", _hoisted_5, [
  44586. _hoisted_6,
  44587. createElementVNode("div", _hoisted_7, [
  44588. createVNode(unref(ElInput), {
  44589. modelValue: label2.value.content,
  44590. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => label2.value.content = $event),
  44591. placeholder: "\u8F93\u5165\u663E\u793A\u7684\u6587\u5B57\u5185\u5BB9",
  44592. clearable: "",
  44593. type: "textarea",
  44594. rows: 2
  44595. }, null, 8, ["modelValue"])
  44596. ])
  44597. ]),
  44598. createElementVNode("div", _hoisted_8, [
  44599. _hoisted_9,
  44600. createElementVNode("div", _hoisted_10, [
  44601. createVNode(unref(ElSelect), {
  44602. modelValue: label2.value.font,
  44603. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => label2.value.font = $event),
  44604. placeholder: "\u8BF7\u9009\u62E9"
  44605. }, {
  44606. default: withCtx(() => [
  44607. (openBlock(), createElementBlock(Fragment, null, renderList(selectOptionsFont, (item) => {
  44608. return createVNode(unref(ElOption), {
  44609. key: item.value,
  44610. label: item.label,
  44611. value: item.value
  44612. }, null, 8, ["label", "value"]);
  44613. }), 64))
  44614. ]),
  44615. _: 1
  44616. }, 8, ["modelValue"])
  44617. ])
  44618. ]),
  44619. createElementVNode("div", _hoisted_11, [
  44620. _hoisted_12,
  44621. createElementVNode("div", _hoisted_13, [
  44622. createVNode(unref(ElInputNumber), {
  44623. modelValue: label2.value.fontSize,
  44624. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => label2.value.fontSize = $event),
  44625. min: 0,
  44626. max: 100
  44627. }, null, 8, ["modelValue"])
  44628. ])
  44629. ]),
  44630. createElementVNode("div", _hoisted_14, [
  44631. _hoisted_15,
  44632. createElementVNode("div", _hoisted_16, [
  44633. createVNode(unref(ElSwitch), {
  44634. modelValue: label2.value.bolder,
  44635. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => label2.value.bolder = $event)
  44636. }, null, 8, ["modelValue"])
  44637. ])
  44638. ]),
  44639. createElementVNode("div", _hoisted_17, [
  44640. _hoisted_18,
  44641. createElementVNode("div", _hoisted_19, [
  44642. createVNode(unref(ElSwitch), {
  44643. modelValue: label2.value.italic,
  44644. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => label2.value.italic = $event)
  44645. }, null, 8, ["modelValue"])
  44646. ])
  44647. ]),
  44648. createElementVNode("div", _hoisted_20, [
  44649. _hoisted_21,
  44650. createElementVNode("div", _hoisted_22, [
  44651. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  44652. default: withCtx(() => [
  44653. createVNode(unref(ElColorPicker), {
  44654. modelValue: label2.value.fillColor,
  44655. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => label2.value.fillColor = $event),
  44656. "show-alpha": "",
  44657. predefine: predefineColors.value,
  44658. label: "12"
  44659. }, null, 8, ["modelValue", "predefine"])
  44660. ]),
  44661. _: 1
  44662. }, 8, ["locale"])
  44663. ])
  44664. ]),
  44665. createElementVNode("div", _hoisted_23, [
  44666. _hoisted_24,
  44667. createElementVNode("div", _hoisted_25, [
  44668. createVNode(unref(ElSwitch), {
  44669. modelValue: label2.value.showOutline,
  44670. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => label2.value.showOutline = $event)
  44671. }, null, 8, ["modelValue"])
  44672. ])
  44673. ]),
  44674. withDirectives(createElementVNode("div", _hoisted_26, [
  44675. _hoisted_27,
  44676. createElementVNode("div", _hoisted_28, [
  44677. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  44678. default: withCtx(() => [
  44679. createVNode(unref(ElColorPicker), {
  44680. modelValue: label2.value.outlineColor,
  44681. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => label2.value.outlineColor = $event),
  44682. "show-alpha": "",
  44683. predefine: predefineColors.value,
  44684. label: "12"
  44685. }, null, 8, ["modelValue", "predefine"])
  44686. ]),
  44687. _: 1
  44688. }, 8, ["locale"])
  44689. ])
  44690. ], 512), [
  44691. [vShow, label2.value.showOutline]
  44692. ]),
  44693. withDirectives(createElementVNode("div", _hoisted_29, [
  44694. _hoisted_30,
  44695. createElementVNode("div", _hoisted_31, [
  44696. createVNode(unref(ElInputNumber), {
  44697. modelValue: label2.value.outlineWidth,
  44698. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => label2.value.outlineWidth = $event),
  44699. min: 0,
  44700. max: 100
  44701. }, null, 8, ["modelValue"])
  44702. ])
  44703. ], 512), [
  44704. [vShow, label2.value.showOutline]
  44705. ]),
  44706. createElementVNode("div", _hoisted_32, [
  44707. _hoisted_33,
  44708. createElementVNode("div", _hoisted_34, [
  44709. createVNode(unref(ElSwitch), {
  44710. modelValue: label2.value.showBackground,
  44711. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => label2.value.showBackground = $event)
  44712. }, null, 8, ["modelValue"])
  44713. ])
  44714. ]),
  44715. withDirectives(createElementVNode("div", _hoisted_35, [
  44716. _hoisted_36,
  44717. createElementVNode("div", _hoisted_37, [
  44718. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  44719. default: withCtx(() => [
  44720. createVNode(unref(ElColorPicker), {
  44721. modelValue: label2.value.backgroundColor,
  44722. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => label2.value.backgroundColor = $event),
  44723. "show-alpha": "",
  44724. predefine: predefineColors.value,
  44725. label: "12"
  44726. }, null, 8, ["modelValue", "predefine"])
  44727. ]),
  44728. _: 1
  44729. }, 8, ["locale"])
  44730. ])
  44731. ], 512), [
  44732. [vShow, label2.value.showBackground]
  44733. ]),
  44734. withDirectives(createElementVNode("div", _hoisted_38, [
  44735. _hoisted_39,
  44736. createElementVNode("div", _hoisted_40, [
  44737. createVNode(unref(ElInputNumber), {
  44738. modelValue: label2.value.backgroundPadding,
  44739. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => label2.value.backgroundPadding = $event),
  44740. min: -100,
  44741. max: 100
  44742. }, null, 8, ["modelValue"])
  44743. ])
  44744. ], 512), [
  44745. [vShow, label2.value.showBackground]
  44746. ]),
  44747. createElementVNode("div", _hoisted_41, [
  44748. _hoisted_42,
  44749. createElementVNode("div", _hoisted_43, [
  44750. createVNode(unref(ElInputNumber), {
  44751. modelValue: label2.value.pixelOffsetX,
  44752. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => label2.value.pixelOffsetX = $event),
  44753. min: -100,
  44754. max: 100
  44755. }, null, 8, ["modelValue"])
  44756. ])
  44757. ]),
  44758. createElementVNode("div", _hoisted_44, [
  44759. _hoisted_45,
  44760. createElementVNode("div", _hoisted_46, [
  44761. createVNode(unref(ElInputNumber), {
  44762. modelValue: label2.value.pixelOffsetY,
  44763. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => label2.value.pixelOffsetY = $event),
  44764. min: -100,
  44765. max: 100
  44766. }, null, 8, ["modelValue"])
  44767. ])
  44768. ])
  44769. ]),
  44770. _: 1
  44771. }, 512), [
  44772. [vShow, isShowLabelStyle.value]
  44773. ]),
  44774. withDirectives(createVNode(unref(ElCollapseItem), { name: "\u70B9\u6837\u5F0F" }, {
  44775. title: withCtx(() => [
  44776. createVNode(unref(ElIcon), { style: { "padding": "10rem" } }, {
  44777. default: withCtx(() => [
  44778. createVNode(unref(setting_default))
  44779. ]),
  44780. _: 1
  44781. }),
  44782. createTextVNode("\u70B9\u6837\u5F0F ")
  44783. ]),
  44784. default: withCtx(() => [
  44785. createElementVNode("div", _hoisted_47, [
  44786. _hoisted_48,
  44787. createElementVNode("div", _hoisted_49, [
  44788. createVNode(unref(ElInputNumber), {
  44789. modelValue: point2.value.pixelSize,
  44790. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => point2.value.pixelSize = $event),
  44791. min: 0,
  44792. max: 100
  44793. }, null, 8, ["modelValue"])
  44794. ])
  44795. ]),
  44796. createElementVNode("div", _hoisted_50, [
  44797. _hoisted_51,
  44798. createElementVNode("div", _hoisted_52, [
  44799. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  44800. default: withCtx(() => [
  44801. createVNode(unref(ElColorPicker), {
  44802. modelValue: point2.value.color,
  44803. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => point2.value.color = $event),
  44804. "show-alpha": "",
  44805. predefine: predefineColors.value,
  44806. label: "12"
  44807. }, null, 8, ["modelValue", "predefine"])
  44808. ]),
  44809. _: 1
  44810. }, 8, ["locale"])
  44811. ])
  44812. ]),
  44813. createElementVNode("div", _hoisted_53, [
  44814. _hoisted_54,
  44815. createElementVNode("div", _hoisted_55, [
  44816. createVNode(unref(ElSwitch), {
  44817. modelValue: point2.value.showOutline,
  44818. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => point2.value.showOutline = $event)
  44819. }, null, 8, ["modelValue"])
  44820. ])
  44821. ]),
  44822. withDirectives(createElementVNode("div", _hoisted_56, [
  44823. _hoisted_57,
  44824. createElementVNode("div", _hoisted_58, [
  44825. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  44826. default: withCtx(() => [
  44827. createVNode(unref(ElColorPicker), {
  44828. modelValue: point2.value.outlineColor,
  44829. "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => point2.value.outlineColor = $event),
  44830. "show-alpha": "",
  44831. predefine: predefineColors.value,
  44832. label: "12"
  44833. }, null, 8, ["modelValue", "predefine"])
  44834. ]),
  44835. _: 1
  44836. }, 8, ["locale"])
  44837. ])
  44838. ], 512), [
  44839. [vShow, point2.value.showOutline]
  44840. ]),
  44841. withDirectives(createElementVNode("div", _hoisted_59, [
  44842. _hoisted_60,
  44843. createElementVNode("div", _hoisted_61, [
  44844. createVNode(unref(ElInputNumber), {
  44845. modelValue: point2.value.outlineWidth,
  44846. "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => point2.value.outlineWidth = $event),
  44847. min: 0,
  44848. max: 100
  44849. }, null, 8, ["modelValue"])
  44850. ])
  44851. ], 512), [
  44852. [vShow, point2.value.showOutline]
  44853. ])
  44854. ]),
  44855. _: 1
  44856. }, 512), [
  44857. [vShow, isShowPointStyle.value]
  44858. ]),
  44859. withDirectives(createVNode(unref(ElCollapseItem), { name: "\u56FE\u7247\u6837\u5F0F" }, {
  44860. title: withCtx(() => [
  44861. createVNode(unref(ElIcon), { style: { "padding": "10rem" } }, {
  44862. default: withCtx(() => [
  44863. createVNode(unref(setting_default))
  44864. ]),
  44865. _: 1
  44866. }),
  44867. createTextVNode("\u56FE\u7247\u6837\u5F0F ")
  44868. ]),
  44869. default: withCtx(() => [
  44870. createElementVNode("div", _hoisted_62, [
  44871. _hoisted_63,
  44872. createElementVNode("div", _hoisted_64, [
  44873. createVNode(unref(ElInput), {
  44874. modelValue: billboard.value.imgUrl,
  44875. "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => billboard.value.imgUrl = $event),
  44876. placeholder: "\u8F93\u5165\u56FE\u6807\u8DEF\u5F84",
  44877. clearable: "",
  44878. type: "textarea",
  44879. rows: 2
  44880. }, null, 8, ["modelValue"])
  44881. ])
  44882. ]),
  44883. createElementVNode("div", _hoisted_65, [
  44884. _hoisted_66,
  44885. createElementVNode("div", _hoisted_67, [
  44886. createVNode(unref(ElInputNumber), {
  44887. modelValue: billboard.value.scale,
  44888. "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => billboard.value.scale = $event),
  44889. min: 1,
  44890. max: 100
  44891. }, null, 8, ["modelValue"])
  44892. ])
  44893. ])
  44894. ]),
  44895. _: 1
  44896. }, 512), [
  44897. [vShow, isShowBillboardStyle.value]
  44898. ]),
  44899. withDirectives(createVNode(unref(ElCollapseItem), { name: "\u5C0F\u6A21\u578B\u6837\u5F0F" }, {
  44900. title: withCtx(() => [
  44901. createVNode(unref(ElIcon), { style: { "padding": "10rem" } }, {
  44902. default: withCtx(() => [
  44903. createVNode(unref(setting_default))
  44904. ]),
  44905. _: 1
  44906. }),
  44907. createTextVNode("\u5C0F\u6A21\u578B\u6837\u5F0F ")
  44908. ]),
  44909. default: withCtx(() => [
  44910. createElementVNode("div", _hoisted_68, [
  44911. _hoisted_69,
  44912. createElementVNode("div", _hoisted_70, [
  44913. createVNode(unref(ElInput), {
  44914. modelValue: model.value.url,
  44915. "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => model.value.url = $event),
  44916. placeholder: "\u8F93\u5165\u6A21\u578B\u8DEF\u5F84",
  44917. clearable: "",
  44918. type: "textarea",
  44919. rows: 2
  44920. }, null, 8, ["modelValue"])
  44921. ])
  44922. ]),
  44923. createElementVNode("div", _hoisted_71, [
  44924. _hoisted_72,
  44925. createElementVNode("div", _hoisted_73, [
  44926. createVNode(unref(ElInputNumber), {
  44927. modelValue: model.value.alpha,
  44928. "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => model.value.alpha = $event),
  44929. step: 0.1,
  44930. min: 0,
  44931. max: 1
  44932. }, null, 8, ["modelValue"])
  44933. ])
  44934. ]),
  44935. createElementVNode("div", _hoisted_74, [
  44936. _hoisted_75,
  44937. createElementVNode("div", _hoisted_76, [
  44938. createVNode(unref(ElInputNumber), {
  44939. modelValue: model.value.minimumPixelSize,
  44940. "onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => model.value.minimumPixelSize = $event),
  44941. step: 1,
  44942. min: 0,
  44943. max: 2e4
  44944. }, null, 8, ["modelValue"])
  44945. ])
  44946. ]),
  44947. createElementVNode("div", _hoisted_77, [
  44948. _hoisted_78,
  44949. createElementVNode("div", _hoisted_79, [
  44950. createVNode(unref(ElSwitch), {
  44951. modelValue: model.value.showSilhouette,
  44952. "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => model.value.showSilhouette = $event)
  44953. }, null, 8, ["modelValue"])
  44954. ])
  44955. ]),
  44956. withDirectives(createElementVNode("div", _hoisted_80, [
  44957. _hoisted_81,
  44958. createElementVNode("div", _hoisted_82, [
  44959. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  44960. default: withCtx(() => [
  44961. createVNode(unref(ElColorPicker), {
  44962. modelValue: model.value.silhouetteColor,
  44963. "onUpdate:modelValue": _cache[25] || (_cache[25] = ($event) => model.value.silhouetteColor = $event),
  44964. "show-alpha": "",
  44965. predefine: predefineColors.value,
  44966. label: "12"
  44967. }, null, 8, ["modelValue", "predefine"])
  44968. ]),
  44969. _: 1
  44970. }, 8, ["locale"])
  44971. ])
  44972. ], 512), [
  44973. [vShow, model.value.showSilhouette]
  44974. ]),
  44975. withDirectives(createElementVNode("div", _hoisted_83, [
  44976. _hoisted_84,
  44977. createElementVNode("div", _hoisted_85, [
  44978. createVNode(unref(ElInputNumber), {
  44979. modelValue: model.value.silhouetteSize,
  44980. "onUpdate:modelValue": _cache[26] || (_cache[26] = ($event) => model.value.silhouetteSize = $event),
  44981. step: 1,
  44982. min: 0,
  44983. max: 100
  44984. }, null, 8, ["modelValue"])
  44985. ])
  44986. ], 512), [
  44987. [vShow, model.value.showSilhouette]
  44988. ])
  44989. ]),
  44990. _: 1
  44991. }, 512), [
  44992. [vShow, isShowModelStyle.value]
  44993. ])
  44994. ]),
  44995. _: 1
  44996. }, 8, ["modelValue"])
  44997. ]),
  44998. createElementVNode("div", _hoisted_86, [
  44999. createVNode(unref(ElButtonGroup), null, {
  45000. default: withCtx(() => [
  45001. createVNode(unref(ElButton), {
  45002. type: "primary",
  45003. icon: unref(edit_default),
  45004. onClick: _cache[28] || (_cache[28] = ($event) => submit())
  45005. }, {
  45006. default: withCtx(() => [
  45007. createTextVNode("\u4FEE\u6539")
  45008. ]),
  45009. _: 1
  45010. }, 8, ["icon"]),
  45011. createVNode(unref(ElButton), {
  45012. type: "primary",
  45013. style: { "background-color": "rgb(222, 146, 47)" },
  45014. icon: unref(delete_default),
  45015. onClick: _cache[29] || (_cache[29] = ($event) => remove2())
  45016. }, {
  45017. default: withCtx(() => [
  45018. createTextVNode("\u5220\u9664")
  45019. ]),
  45020. _: 1
  45021. }, 8, ["icon"]),
  45022. createVNode(unref(ElButton), {
  45023. type: "primary",
  45024. style: { "background-color": "rgb(126, 128, 135)" },
  45025. icon: unref(close_default),
  45026. onClick: _cache[30] || (_cache[30] = ($event) => close())
  45027. }, {
  45028. default: withCtx(() => [
  45029. createTextVNode("\u5173\u95ED")
  45030. ]),
  45031. _: 1
  45032. }, 8, ["icon"])
  45033. ]),
  45034. _: 1
  45035. })
  45036. ])
  45037. ]),
  45038. _: 1
  45039. })
  45040. ]),
  45041. _: 1
  45042. }, 8, ["modelValue", "title"])
  45043. ]);
  45044. };
  45045. }
  45046. };
  45047. var DialogEditProperty = /* @__PURE__ */ _export_sfc(_sfc_main, [["styles", [_style_0]]]);
  45048. Cesium.Entity.prototype.setParams = function(params) {
  45049. this._params = params;
  45050. };
  45051. Cesium.Entity.prototype.getParams = function() {
  45052. return this._params;
  45053. };
  45054. Cesium.Entity.prototype.setEntityType = function(entityType) {
  45055. this._entityType = entityType;
  45056. };
  45057. Cesium.Entity.prototype.getEntityType = function(entityType) {
  45058. return this._entityType;
  45059. };
  45060. Cesium.Entity.prototype.setIsEdit = function(isEdit) {
  45061. this._isEdit = isEdit;
  45062. };
  45063. Cesium.Entity.prototype.getIsEdit = function() {
  45064. return this._isEdit;
  45065. };
  45066. class DrawPoint {
  45067. constructor(viewer2) {
  45068. if (!viewer2)
  45069. throw new Cesium.DeveloperError("no viewer object!");
  45070. this._viewer = viewer2;
  45071. this._viewer.scene.globe.depthTestAgainstTerrain = true;
  45072. this._viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  45073. this._entities = [];
  45074. this._pointObject = new PointObject(viewer2);
  45075. }
  45076. static initEditPropertyParams() {
  45077. return {
  45078. id: void 0,
  45079. label: {
  45080. text: "\u91D1\u7530CIM\u4E09\u7EF4\u57FA\u7840\u5E73\u53F0",
  45081. font: "Helvetica",
  45082. fontSize: 24,
  45083. bolder: false,
  45084. italic: false,
  45085. fillColor: "rgba(0,255,0,0.75)",
  45086. showOutline: false,
  45087. outlineWidth: 0,
  45088. outlineColor: "rgba(255,255,255,1)",
  45089. showBackground: false,
  45090. backgroundPadding: 0,
  45091. backgroundColor: "rgba(255,255,255,1)",
  45092. pixelOffsetX: 0,
  45093. pixelOffsetY: 0
  45094. },
  45095. point: {
  45096. color: "rgba(0,255,0,0.75)",
  45097. pixelSize: 10,
  45098. showOutline: false,
  45099. outlineWidth: 0,
  45100. outlineColor: "rgba(255,255,255,1)"
  45101. },
  45102. billboard: {
  45103. imgUrl: "jt3dSDK/imgs/point/point3.png",
  45104. alpha: 1,
  45105. scale: 1
  45106. },
  45107. model: {
  45108. url: "jt3dSDK/gltf/pyramid.glb",
  45109. alpha: 1,
  45110. showSilhouette: false,
  45111. silhouetteColor: "rgba(255,255,255,1)",
  45112. silhouetteSize: 0,
  45113. minimumPixelSize: 128,
  45114. maximumScale: 2e4,
  45115. heading: 0,
  45116. pitch: 0,
  45117. roll: 0
  45118. }
  45119. };
  45120. }
  45121. _cartesian3ToGeo(position2) {
  45122. let g = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  45123. return {
  45124. longitude: Cesium.Math.toDegrees(g.longitude),
  45125. latitude: Cesium.Math.toDegrees(g.latitude),
  45126. height: g.height
  45127. };
  45128. }
  45129. _arcToDegree(arc) {
  45130. return arc / Math.PI * 180;
  45131. }
  45132. _getScreenClickPositionAndHeight(screenPoint) {
  45133. var lng = void 0, lat = void 0, height2 = void 0;
  45134. var ray = this._viewer.scene.camera.getPickRay(screenPoint);
  45135. var position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
  45136. var cartographic = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  45137. var feature2 = this._viewer.scene.pick(screenPoint);
  45138. if (feature2 == void 0) {
  45139. lng = this._arcToDegree(cartographic.longitude);
  45140. lat = this._arcToDegree(cartographic.latitude);
  45141. height2 = cartographic.height;
  45142. } else {
  45143. var cartesian = this._viewer.scene.pickPosition(screenPoint);
  45144. if (Cesium.defined(cartesian)) {
  45145. var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  45146. lng = this._arcToDegree(cartographic.longitude);
  45147. lat = this._arcToDegree(cartographic.latitude);
  45148. height2 = cartographic.height;
  45149. }
  45150. }
  45151. return {
  45152. lng,
  45153. lat,
  45154. height: height2
  45155. };
  45156. }
  45157. _transfromFromScreenPoint(screenPosition) {
  45158. let location = this._getScreenClickPositionAndHeight(screenPosition);
  45159. var cartesian = Cesium.Cartesian3.fromDegrees(location.lng, location.lat, location.height);
  45160. return {
  45161. gLocation: location,
  45162. sLocation: cartesian
  45163. };
  45164. }
  45165. }
  45166. Object.assign(DrawPoint.prototype, {
  45167. _setMousePointerStyle() {
  45168. document.querySelector("body").style.cursor = "crosshair";
  45169. },
  45170. _setMouseDefaultStyle() {
  45171. document.querySelector("body").style.cursor = "default";
  45172. },
  45173. _registerLeftClickEvent(handler, callChange) {
  45174. let _self = this;
  45175. if (!handler)
  45176. return;
  45177. handler.setInputAction(function(event2) {
  45178. _self._lock = true;
  45179. clearTimeout(_self._timer);
  45180. _self._timer = setTimeout(function() {
  45181. if (callChange)
  45182. callChange(event2);
  45183. _self._lock = false;
  45184. }, 200);
  45185. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  45186. },
  45187. _registerMouseMoveEvent(handler, callChange) {
  45188. let _self = this;
  45189. if (!handler)
  45190. return;
  45191. handler.setInputAction(function(event2) {
  45192. if (_self._lock === void 0 || _self._lock === false) {
  45193. if (callChange)
  45194. callChange(event2);
  45195. }
  45196. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  45197. },
  45198. _registerLeftDownEvent(handler, callChange) {
  45199. if (!handler)
  45200. return;
  45201. handler.setInputAction(function(event2) {
  45202. if (callChange)
  45203. callChange(event2);
  45204. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  45205. },
  45206. _registerLeftUpEvent(handler, callChange) {
  45207. if (!handler)
  45208. return;
  45209. handler.setInputAction(function(event2) {
  45210. if (callChange)
  45211. callChange(event2);
  45212. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  45213. },
  45214. _clearEvent(handler) {
  45215. if (!handler)
  45216. return;
  45217. handler.destroy();
  45218. handler = null;
  45219. }
  45220. });
  45221. Object.assign(DrawPoint.prototype, {
  45222. draw: function(type2, options2) {
  45223. let _self = this;
  45224. _self._unActivateEdit();
  45225. this._drawEventHandler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  45226. this._drawType = type2;
  45227. switch (type2) {
  45228. case DrawPoint.DrawType.Model:
  45229. _self._sketchDrawModel(_self._drawEventHandler, options2);
  45230. break;
  45231. case DrawPoint.DrawType.Label:
  45232. _self._sketchDrawLabel(_self._drawEventHandler, options2);
  45233. break;
  45234. case DrawPoint.DrawType.Point:
  45235. _self._sketchDrawPoint(_self._drawEventHandler, options2);
  45236. break;
  45237. case DrawPoint.DrawType.Point2Label:
  45238. _self._sketchDrawPoint2Label(_self._drawEventHandler, options2);
  45239. break;
  45240. case DrawPoint.DrawType.Billboard:
  45241. _self._sketchDrawBillboard(_self._drawEventHandler, options2);
  45242. break;
  45243. case DrawPoint.DrawType.Billboard2Label:
  45244. _self._sketchDrawBillboard2Label(_self._drawEventHandler, options2);
  45245. break;
  45246. }
  45247. },
  45248. clearAll() {
  45249. for (var i2 = 0; i2 < this._entities.length; i2++) {
  45250. var getById = viewer.entities.getById(this._entities[i2]);
  45251. if (getById) {
  45252. this._viewer.entities.remove(getById);
  45253. }
  45254. }
  45255. this._closePropertyEditDialog();
  45256. },
  45257. _sketchDrawLabel(handler, options2) {
  45258. let _self = this;
  45259. this._registerLeftClickEvent(handler, function(event2) {
  45260. let loc2 = _self._transfromFromScreenPoint(event2.position);
  45261. if (!Cesium.defined(loc2.sLocation))
  45262. return;
  45263. let entityParam = DrawPoint.initEditPropertyParams();
  45264. entityParam.label.font = entityParam.label.fontSize + "px " + entityParam.label.font;
  45265. entityParam.label.pixelOffset = {
  45266. x: entityParam.label.pixelOffsetX,
  45267. y: entityParam.label.pixelOffsetY
  45268. };
  45269. _self._pointObject.addLabel(loc2.sLocation, {
  45270. label: entityParam.label
  45271. }).then((entity) => {
  45272. _self._viewer.entities.add(entity);
  45273. _self._entities.push(entity.id);
  45274. entityParam = DrawPoint.initEditPropertyParams();
  45275. _self._drawEntity = entity;
  45276. _self._drawEntity.setParams(entityParam);
  45277. _self._drawEntity.setEntityType(DrawPoint.DrawType.Label);
  45278. _self._setEntityIsEdit(_self._drawEntity);
  45279. _self._clearEvent(handler);
  45280. if (options2.onComplete)
  45281. options2.onComplete(loc2.sLocation, loc2.gLocation);
  45282. });
  45283. });
  45284. },
  45285. _sketchDrawPoint(handler, options2) {
  45286. let _self = this;
  45287. this._registerLeftClickEvent(handler, function(event2) {
  45288. let loc2 = _self._transfromFromScreenPoint(event2.position);
  45289. if (!Cesium.defined(loc2.sLocation))
  45290. return;
  45291. let entityParam = DrawPoint.initEditPropertyParams();
  45292. _self._pointObject.addPoint(loc2.sLocation, {
  45293. point: entityParam.point
  45294. }).then((entity) => {
  45295. _self._viewer.entities.add(entity);
  45296. _self._entities.push(entity.id);
  45297. entityParam = DrawPoint.initEditPropertyParams();
  45298. _self._drawEntity = entity;
  45299. _self._drawEntity.setParams(entityParam);
  45300. _self._drawEntity.setEntityType(DrawPoint.DrawType.Point);
  45301. _self._setEntityIsEdit(_self._drawEntity);
  45302. _self._clearEvent(handler);
  45303. if (options2.onComplete)
  45304. options2.onComplete(loc2.sLocation, loc2.gLocation);
  45305. });
  45306. });
  45307. },
  45308. _sketchDrawPoint2Label(handler, options2) {
  45309. let _self = this;
  45310. this._registerLeftClickEvent(handler, function(event2) {
  45311. let loc2 = _self._transfromFromScreenPoint(event2.position);
  45312. if (!Cesium.defined(loc2.sLocation))
  45313. return;
  45314. let entityParam = DrawPoint.initEditPropertyParams();
  45315. entityParam.label.font = entityParam.label.fontSize + "px " + entityParam.label.font;
  45316. entityParam.label.pixelOffset = {
  45317. x: entityParam.label.pixelOffsetX,
  45318. y: entityParam.label.pixelOffsetY - 10
  45319. };
  45320. _self._pointObject.addPoint(loc2.sLocation, {
  45321. point: entityParam.point,
  45322. label: entityParam.label
  45323. }).then((entity) => {
  45324. _self._viewer.entities.add(entity);
  45325. _self._entities.push(entity.id);
  45326. entityParam = DrawPoint.initEditPropertyParams();
  45327. entityParam.label.pixelOffsetY = -10;
  45328. _self._drawEntity = entity;
  45329. _self._drawEntity.setParams(entityParam);
  45330. _self._drawEntity.setEntityType(DrawPoint.DrawType.Point2Label);
  45331. _self._setEntityIsEdit(_self._drawEntity);
  45332. _self._clearEvent(handler);
  45333. if (options2.onComplete)
  45334. options2.onComplete(loc2.sLocation, loc2.gLocation);
  45335. });
  45336. });
  45337. },
  45338. _sketchDrawBillboard(handler, options2) {
  45339. let _self = this;
  45340. this._registerLeftClickEvent(handler, function(event2) {
  45341. let loc2 = _self._transfromFromScreenPoint(event2.position);
  45342. if (!Cesium.defined(loc2.sLocation))
  45343. return;
  45344. let entityParam = DrawPoint.initEditPropertyParams();
  45345. _self._pointObject.addBillboard(loc2.sLocation, {
  45346. billboard: entityParam.billboard
  45347. }).then((entity) => {
  45348. _self._viewer.entities.add(entity);
  45349. _self._entities.push(entity.id);
  45350. entityParam = DrawPoint.initEditPropertyParams();
  45351. entityParam.label.pixelOffsetY = -50;
  45352. _self._drawEntity = entity;
  45353. _self._drawEntity.setParams(entityParam);
  45354. _self._drawEntity.setEntityType(DrawPoint.DrawType.Billboard);
  45355. _self._setEntityIsEdit(_self._drawEntity);
  45356. _self._clearEvent(handler);
  45357. if (options2.onComplete)
  45358. options2.onComplete(loc2.sLocation, loc2.gLocation);
  45359. });
  45360. });
  45361. },
  45362. _sketchDrawBillboard2Label(handler, options2) {
  45363. let _self = this;
  45364. this._registerLeftClickEvent(handler, function(event2) {
  45365. let loc2 = _self._transfromFromScreenPoint(event2.position);
  45366. if (!Cesium.defined(loc2.sLocation))
  45367. return;
  45368. let entityParam = DrawPoint.initEditPropertyParams();
  45369. entityParam.label.font = entityParam.label.fontSize + "px " + entityParam.label.font;
  45370. entityParam.label.pixelOffset = {
  45371. x: entityParam.label.pixelOffsetX,
  45372. y: entityParam.label.pixelOffsetY - 50
  45373. };
  45374. _self._pointObject.addBillboard(loc2.sLocation, {
  45375. billboard: entityParam.billboard,
  45376. label: entityParam.label
  45377. }).then((entity) => {
  45378. _self._viewer.entities.add(entity);
  45379. _self._entities.push(entity.id);
  45380. entityParam = DrawPoint.initEditPropertyParams();
  45381. _self._drawEntity = entity;
  45382. _self._drawEntity.setParams(entityParam);
  45383. _self._drawEntity.setEntityType(DrawPoint.DrawType.Billboard2Label);
  45384. _self._setEntityIsEdit(_self._drawEntity);
  45385. _self._clearEvent(handler);
  45386. if (options2.onComplete)
  45387. options2.onComplete(loc2.sLocation, loc2.gLocation);
  45388. });
  45389. });
  45390. },
  45391. _sketchDrawModel(handler, options2) {
  45392. let _self = this;
  45393. this._registerLeftClickEvent(handler, function(event2) {
  45394. let loc2 = _self._transfromFromScreenPoint(event2.position);
  45395. if (!Cesium.defined(loc2.sLocation))
  45396. return;
  45397. let entityParam = DrawPoint.initEditPropertyParams();
  45398. _self._pointObject.addModel(loc2.sLocation, {
  45399. model: entityParam.model
  45400. }).then((entity) => {
  45401. _self._viewer.entities.add(entity);
  45402. _self._entities.push(entity.id);
  45403. entityParam = DrawPoint.initEditPropertyParams();
  45404. _self._drawEntity = entity;
  45405. _self._drawEntity.setParams(entityParam);
  45406. _self._drawEntity.setEntityType(DrawPoint.DrawType.Model);
  45407. _self._setEntityIsEdit(_self._drawEntity);
  45408. _self._clearEvent(handler);
  45409. if (options2.onComplete)
  45410. options2.onComplete(loc2.sLocation, loc2.gLocation);
  45411. });
  45412. });
  45413. },
  45414. updateEditEntityProperty: function(params) {
  45415. if (this._editEntity === void 0)
  45416. return;
  45417. if (this._editEntity.getIsEdit() === void 0 || this._editEntity.getIsEdit() === false)
  45418. return;
  45419. let editEntityType = this._editEntity.getEntityType();
  45420. if (editEntityType === void 0)
  45421. return;
  45422. if (editEntityType === DrawPoint.DrawType.Label) {
  45423. this._updateLabelProperty(params);
  45424. } else if (editEntityType === DrawPoint.DrawType.Point) {
  45425. this._updatePointProperty(params);
  45426. } else if (editEntityType === DrawPoint.DrawType.Point2Label) {
  45427. this._updatePoint2LabelProperty(params);
  45428. } else if (editEntityType === DrawPoint.DrawType.Billboard) {
  45429. this._updateBillboardProperty(params);
  45430. } else if (editEntityType === DrawPoint.DrawType.Billboard2Label) {
  45431. this._updateBillboard2LabelProperty(params);
  45432. } else if (editEntityType === DrawPoint.DrawType.Model) {
  45433. this._updateModelProperty(params);
  45434. }
  45435. },
  45436. _updateLabelProperty(params) {
  45437. let label2 = params.label;
  45438. this._editEntity.label.text = label2.text;
  45439. let font = "";
  45440. if (label2.italic) {
  45441. font += "italic ";
  45442. }
  45443. if (label2.bolder) {
  45444. font += " bolder ";
  45445. }
  45446. font += label2.fontSize + "px " + label2.font;
  45447. this._editEntity.label.font = font;
  45448. this._editEntity.label.fillColor = Cesium.Color.fromCssColorString(label2.fillColor);
  45449. this._editEntity.label.outlineColor = Cesium.Color.fromCssColorString(label2.outlineColor);
  45450. this._editEntity.label.outlineWidth = parseFloat(label2.outlineWidth);
  45451. this._editEntity.label.showBackground = label2.showBackground;
  45452. this._editEntity.label.backgroundColor = Cesium.Color.fromCssColorString(label2.backgroundColor);
  45453. this._editEntity.label.backgroundPadding = new Cesium.Cartesian2(parseFloat(label2.backgroundPadding), parseFloat(label2.backgroundPadding));
  45454. this._editEntity.label.pixelOffset = new Cesium.Cartesian2(parseFloat(label2.pixelOffsetX), parseFloat(label2.pixelOffsetY));
  45455. this._editEntity.setParams(params);
  45456. },
  45457. _updatePointProperty(params) {
  45458. let point2 = params.point;
  45459. this._editEntity.point.color = Cesium.Color.fromCssColorString(point2.color);
  45460. this._editEntity.point.pixelSize = parseFloat(point2.pixelSize);
  45461. this._editEntity.point.outlineColor = Cesium.Color.fromCssColorString(point2.outlineColor);
  45462. this._editEntity.point.outlineWidth = parseFloat(point2.outlineWidth);
  45463. this._editEntity.setParams(params);
  45464. },
  45465. _updatePoint2LabelProperty(params) {
  45466. let label2 = params.label;
  45467. this._editEntity.label.text = label2.text;
  45468. let font = "";
  45469. if (label2.italic) {
  45470. font += "italic ";
  45471. }
  45472. if (label2.bolder) {
  45473. font += " bolder ";
  45474. }
  45475. font += label2.fontSize + "px " + label2.font;
  45476. this._editEntity.label.font = font;
  45477. this._editEntity.label.fillColor = Cesium.Color.fromCssColorString(label2.fillColor);
  45478. this._editEntity.label.outlineColor = Cesium.Color.fromCssColorString(label2.outlineColor);
  45479. this._editEntity.label.outlineWidth = parseFloat(label2.outlineWidth);
  45480. this._editEntity.label.showBackground = label2.showBackground;
  45481. this._editEntity.label.backgroundColor = Cesium.Color.fromCssColorString(label2.backgroundColor);
  45482. this._editEntity.label.backgroundPadding = new Cesium.Cartesian2(parseFloat(label2.backgroundPadding), parseFloat(label2.backgroundPadding));
  45483. let point2 = params.point;
  45484. this._editEntity.point.color = Cesium.Color.fromCssColorString(point2.color);
  45485. this._editEntity.point.pixelSize = parseFloat(point2.pixelSize);
  45486. this._editEntity.point.outlineColor = Cesium.Color.fromCssColorString(point2.outlineColor);
  45487. this._editEntity.point.outlineWidth = parseFloat(point2.outlineWidth);
  45488. this._editEntity.setParams(params);
  45489. },
  45490. _updateBillboardProperty(params) {
  45491. let billboard = params.billboard;
  45492. this._editEntity.billboard.image = billboard.imgUrl;
  45493. this._editEntity.billboard.scale = billboard.scale;
  45494. this._editEntity.setParams(params);
  45495. },
  45496. _updateBillboard2LabelProperty(params) {
  45497. let label2 = params.label;
  45498. this._editEntity.label.text = label2.text;
  45499. let font = "";
  45500. if (label2.italic) {
  45501. font += "italic ";
  45502. }
  45503. if (label2.bolder) {
  45504. font += " bolder ";
  45505. }
  45506. font += label2.fontSize + "px " + label2.font;
  45507. this._editEntity.label.font = font;
  45508. this._editEntity.label.fillColor = Cesium.Color.fromCssColorString(label2.fillColor);
  45509. this._editEntity.label.outlineColor = Cesium.Color.fromCssColorString(label2.outlineColor);
  45510. this._editEntity.label.outlineWidth = parseFloat(label2.outlineWidth);
  45511. this._editEntity.label.showBackground = label2.showBackground;
  45512. this._editEntity.label.backgroundColor = Cesium.Color.fromCssColorString(label2.backgroundColor);
  45513. this._editEntity.label.backgroundPadding = new Cesium.Cartesian2(parseFloat(label2.backgroundPadding), parseFloat(label2.backgroundPadding));
  45514. this._editEntity.label.pixelOffset = new Cesium.Cartesian2(parseFloat(label2.pixelOffsetX), parseFloat(label2.pixelOffsetY));
  45515. let billboard = params.billboard;
  45516. this._editEntity.billboard.image = billboard.imgUrl;
  45517. this._editEntity.billboard.scale = billboard.scale;
  45518. this._editEntity.setParams(params);
  45519. }
  45520. });
  45521. Object.assign(DrawPoint.prototype, {
  45522. _setEntityIsEdit(entity) {
  45523. let _self = this;
  45524. this._unActivateEdit();
  45525. entity.setIsEdit(true);
  45526. this._sendShowPropertyDialog(entity);
  45527. let handler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  45528. this._registerLeftClickEvent(handler, function(event2) {
  45529. _self._unActivateEdit();
  45530. let feature2 = _self._viewer.scene.pick(event2.position);
  45531. if (feature2 !== void 0 && feature2.id instanceof Cesium.Entity) {
  45532. let editEntityType = feature2.id.getEntityType();
  45533. if (editEntityType === DrawPoint.DrawType.Label || editEntityType === DrawPoint.DrawType.Point || editEntityType === DrawPoint.DrawType.Point2Label || editEntityType === DrawPoint.DrawType.Billboard || editEntityType === DrawPoint.DrawType.Billboard2Label || editEntityType === DrawPoint.DrawType.Model) {
  45534. feature2.id.setIsEdit(true);
  45535. _self._sendShowPropertyDialog(feature2.id);
  45536. }
  45537. }
  45538. });
  45539. this._registerMouseMoveEvent(handler, function(event2) {
  45540. let toolTip = "\u5355\u51FB\u4FEE\u6539\u5C5E\u6027\uFF0C\u5355\u51FB\u62D6\u52A8\u4FEE\u6539\u4F4D\u7F6E";
  45541. let feature2 = _self._viewer.scene.pick(event2.endPosition);
  45542. if (feature2 !== void 0 && feature2.id instanceof Cesium.Entity) {
  45543. let editEntityType = feature2.id.getEntityType();
  45544. if (editEntityType === DrawPoint.DrawType.Label || editEntityType === DrawPoint.DrawType.Point || editEntityType === DrawPoint.DrawType.Point2Label || editEntityType === DrawPoint.DrawType.Billboard || editEntityType === DrawPoint.DrawType.Billboard2Label || editEntityType === DrawPoint.DrawType.Model) {
  45545. if (feature2.id.getIsEdit()) {
  45546. toolTip = "\u5355\u51FB\u4FEE\u6539\u5C5E\u6027\uFF0C\u5355\u51FB\u62D6\u52A8\u4FEE\u6539\u4F4D\u7F6E";
  45547. CreateRemindertip(toolTip, event2.endPosition, true);
  45548. } else {
  45549. toolTip = "\u5355\u51FB\u4FEE\u6539\u5C5E\u6027";
  45550. CreateRemindertip(toolTip, event2.endPosition, true);
  45551. }
  45552. }
  45553. } else {
  45554. CreateRemindertip(toolTip, event2.endPosition, false);
  45555. }
  45556. });
  45557. },
  45558. _unActivateEdit: function() {
  45559. if (this._sketchEditHandler != void 0) {
  45560. this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOWN);
  45561. this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_UP);
  45562. this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  45563. }
  45564. this._editEntity = void 0;
  45565. for (var i2 = 0; i2 < this._entities.length; i2++) {
  45566. var getById = this._viewer.entities.getById(this._entities[i2]);
  45567. if (getById) {
  45568. getById.setIsEdit(false);
  45569. }
  45570. }
  45571. this._closePropertyEditDialog();
  45572. },
  45573. _sendShowPropertyDialog(entity) {
  45574. let _self = this;
  45575. let editEntityType = entity.getEntityType();
  45576. if (entity.getIsEdit() === void 0 || entity.getIsEdit() === false || editEntityType === void 0) {
  45577. this._unActivateEdit();
  45578. return;
  45579. }
  45580. let editProperty = entity.getParams();
  45581. if (editProperty !== void 0 && this.onEditProperty !== void 0) {
  45582. editProperty.id = editEntityType;
  45583. _self._openPropertyEditDialog(
  45584. editProperty,
  45585. function(params) {
  45586. _self.updateEditEntityProperty(params);
  45587. },
  45588. function() {
  45589. _self._viewer.entities.remove(entity);
  45590. _self._editEntity = void 0;
  45591. }
  45592. );
  45593. }
  45594. this._activeteNormalEdit(entity);
  45595. },
  45596. _activeteNormalEdit: function(editEntity) {
  45597. let _self = this;
  45598. editEntity.getEntityType();
  45599. this._editEntity = editEntity;
  45600. if (this._sketchEditHandler === void 0) {
  45601. this._sketchEditHandler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  45602. }
  45603. this._registerLeftDownEvent(this._sketchEditHandler, function(event2) {
  45604. const pickInfo = _self._viewer.scene.pick(event2.position);
  45605. console.log(pickInfo);
  45606. if (!pickInfo) {
  45607. return;
  45608. }
  45609. console.log("\u6309\u4E0B");
  45610. _self._viewer.scene.screenSpaceCameraController.enableRotate = false;
  45611. _self._registerMouseMoveEvent(_self._sketchEditHandler, function(event3) {
  45612. console.log("\u79FB\u52A8");
  45613. const position2 = event3.endPosition;
  45614. const cartesian = _self._viewer.scene.globe.pick(_self._viewer.camera.getPickRay(position2), _self._viewer.scene);
  45615. const selectedEntity = _self._editEntity;
  45616. if (!selectedEntity) {
  45617. return false;
  45618. }
  45619. selectedEntity.position = cartesian;
  45620. });
  45621. _self._registerLeftUpEvent(_self._sketchEditHandler, function(event3) {
  45622. _self._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  45623. _self._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_UP);
  45624. _self._viewer.scene.screenSpaceCameraController.enableRotate = true;
  45625. console.log("\u62AC\u8D77");
  45626. });
  45627. });
  45628. },
  45629. _updateModelProperty(params) {
  45630. let model = params.model;
  45631. this._editEntity.model.uri = model.url;
  45632. this._editEntity.model.color = Cesium.Color.WHITE.withAlpha(model.alpha);
  45633. this._editEntity.model.minimumPixelSize = model.minimumPixelSize;
  45634. this._editEntity.model.maximumScale = model.maximumScale;
  45635. this._editEntity.model.silhouetteSize = model.silhouetteSize;
  45636. this._editEntity.model.silhouetteColor = new Cesium.Color.fromCssColorString(model.silhouetteColor);
  45637. var heading = Cesium.Math.toRadians(model.heading);
  45638. var pitch = model.pitch;
  45639. var roll = model.roll;
  45640. new Cesium.HeadingPitchRoll(heading, pitch, roll);
  45641. this._editEntity.setParams(params);
  45642. }
  45643. });
  45644. Object.assign(DrawPoint.prototype, {
  45645. _openPropertyEditDialog: function(params, callEdit, callRemove) {
  45646. this._editPropertyDialogDomId = "dialog-property-dom-point";
  45647. this._registerDOMPropertyEdit = "dialog-edit-property-point";
  45648. let PropertyEditComponent = customElements.get(this._registerDOMPropertyEdit);
  45649. if (PropertyEditComponent === void 0) {
  45650. PropertyEditComponent = defineCustomElement(DialogEditProperty);
  45651. customElements.define(this._registerDOMPropertyEdit, PropertyEditComponent);
  45652. }
  45653. this._closePropertyEditDialog();
  45654. let dialogPropertyElement = new PropertyEditComponent({
  45655. params
  45656. });
  45657. dialogPropertyElement.id = this._editPropertyDialogDomId;
  45658. dialogPropertyElement.showDialog = true;
  45659. document.body.appendChild(dialogPropertyElement);
  45660. dialogPropertyElement.addEventListener(
  45661. "submit",
  45662. (e) => {
  45663. if (callEdit)
  45664. callEdit(e.detail[0]);
  45665. },
  45666. false
  45667. );
  45668. dialogPropertyElement.addEventListener(
  45669. "remove",
  45670. (e) => {
  45671. if (callRemove)
  45672. callRemove();
  45673. },
  45674. false
  45675. );
  45676. },
  45677. _closePropertyEditDialog() {
  45678. let dom2 = document.getElementById(this._editPropertyDialogDomId);
  45679. if (dom2 !== null && dom2 !== void 0) {
  45680. document.body.removeChild(dom2);
  45681. }
  45682. }
  45683. });
  45684. DrawPoint.DrawType = Object.freeze({
  45685. Model: "model",
  45686. Label: "label",
  45687. Point: "point",
  45688. Point2Label: "point2Label",
  45689. Billboard: "billboard",
  45690. Billboard2Label: "billboard2Label"
  45691. });
  45692. var MultiFieldAdaptWindow$1 = "";
  45693. class MultiFieldAdaptWindow {
  45694. constructor(viewer2, position2, title, properties, offsetHeight) {
  45695. if (!viewer2)
  45696. throw new Cesium.DeveloperError("no viewer object!");
  45697. if (!position2)
  45698. throw new Cesium.DeveloperError("no position object!");
  45699. this.viewer = viewer2;
  45700. this.position = position2;
  45701. this.offsetHeight = offsetHeight;
  45702. if (position2 instanceof Cesium.Cartesian3) {
  45703. this.position = position2;
  45704. } else {
  45705. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  45706. }
  45707. if (document.getElementsByClassName("MultiField-popup").length > 0) {
  45708. document.getElementsByClassName("MultiField-popup")[0].remove();
  45709. viewer2.entities.remove(viewer2.entities.getById("MultiFieldPopupPoint"));
  45710. }
  45711. this.id = "popup_" + getGuid();
  45712. this.popupDiv = document.createElement("div");
  45713. this.popupDiv.classList.add("MultiField-popup");
  45714. this.popupDiv.id = this.id;
  45715. this.viewer.container.append(this.popupDiv);
  45716. this.popupDiv.innerHTML = this._createHtml(title, properties);
  45717. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  45718. this.initPoint();
  45719. document.getElementsByClassName("leaflet-popup-close-button")[0].onclick = () => {
  45720. this.close();
  45721. };
  45722. }
  45723. postRender() {
  45724. this.viewer.scene.canvas.height;
  45725. const windowPosition = new Cesium.Cartesian2();
  45726. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  45727. this.viewer.scene,
  45728. this.position,
  45729. windowPosition
  45730. );
  45731. let elWidth = this.popupDiv.offsetWidth;
  45732. let elHeight = this.popupDiv.offsetHeight;
  45733. if (!!this.offsetHeight) {
  45734. elHeight += this.offsetHeight;
  45735. }
  45736. this.popupDiv.style.left = windowPosition.x - elWidth / 2 + "px";
  45737. this.popupDiv.style.top = windowPosition.y - elHeight + "px";
  45738. const camerPosition = this.viewer.camera.position;
  45739. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  45740. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  45741. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  45742. this.popupDiv.style.display = "block";
  45743. } else {
  45744. this.popupDiv.style.display = "none";
  45745. }
  45746. }
  45747. _createHtml(header, content) {
  45748. let html = `
  45749. <div class="MultiField-popup-header">
  45750. ` + header + `
  45751. <span class="leaflet-popup-close-button">\xD7</span>
  45752. </div>
  45753. <div class="MultiField-popup-content">
  45754. ` + this._createTable(content) + `
  45755. </div>
  45756. <div class="MultiField-popup-tip">
  45757. </div>
  45758. `;
  45759. return html;
  45760. }
  45761. _createTable(content) {
  45762. let html = '<table class="table-popup">';
  45763. for (let key in content) {
  45764. html += `<tr><td class="title-popup">${key}</td>
  45765. <td class="value-popup">${content[key]}</td></tr>`;
  45766. }
  45767. html += "</table>";
  45768. return html;
  45769. }
  45770. initPoint() {
  45771. this.billboard = new Cesium.Entity({
  45772. id: "MultiFieldPopupPoint",
  45773. name: "popupPoint",
  45774. position: this.position,
  45775. billboard: {
  45776. image: "jt3dSDK/imgs/point/point.png",
  45777. horizontalOrigin: Cesium.HorizontalOrigin.center,
  45778. verticalOrigin: Cesium.VerticalOrigin.bottom,
  45779. scale: 1,
  45780. pixelOffset: new Cesium.Cartesian2(0, 0),
  45781. disableDepthTestDistance: Number.POSITIVE_INFINITY
  45782. }
  45783. });
  45784. this.viewer.entities.add(this.billboard);
  45785. }
  45786. }
  45787. Object.assign(MultiFieldAdaptWindow.prototype, {
  45788. close() {
  45789. this.popupDiv.remove();
  45790. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  45791. this.viewer.entities.remove(this.billboard);
  45792. }
  45793. });
  45794. var win;
  45795. if (typeof window !== "undefined") {
  45796. win = window;
  45797. } else if (typeof commonjsGlobal !== "undefined") {
  45798. win = commonjsGlobal;
  45799. } else if (typeof self !== "undefined") {
  45800. win = self;
  45801. } else {
  45802. win = {};
  45803. }
  45804. var window_1 = win;
  45805. var __viteBrowserExternal = {};
  45806. var __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  45807. __proto__: null,
  45808. "default": __viteBrowserExternal
  45809. }, Symbol.toStringTag, { value: "Module" }));
  45810. var require$$0 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
  45811. var topLevel = typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof window !== "undefined" ? window : {};
  45812. var minDoc = require$$0;
  45813. var doccy;
  45814. if (typeof document !== "undefined") {
  45815. doccy = document;
  45816. } else {
  45817. doccy = topLevel["__GLOBAL_DOCUMENT_CACHE@4"];
  45818. if (!doccy) {
  45819. doccy = topLevel["__GLOBAL_DOCUMENT_CACHE@4"] = minDoc;
  45820. }
  45821. }
  45822. var document_1 = doccy;
  45823. var keycode$1 = { exports: {} };
  45824. (function(module2, exports2) {
  45825. function keyCode(searchInput) {
  45826. if (searchInput && "object" === typeof searchInput) {
  45827. var hasKeyCode = searchInput.which || searchInput.keyCode || searchInput.charCode;
  45828. if (hasKeyCode)
  45829. searchInput = hasKeyCode;
  45830. }
  45831. if ("number" === typeof searchInput)
  45832. return names2[searchInput];
  45833. var search = String(searchInput);
  45834. var foundNamedKey = codes[search.toLowerCase()];
  45835. if (foundNamedKey)
  45836. return foundNamedKey;
  45837. var foundNamedKey = aliases[search.toLowerCase()];
  45838. if (foundNamedKey)
  45839. return foundNamedKey;
  45840. if (search.length === 1)
  45841. return search.charCodeAt(0);
  45842. return void 0;
  45843. }
  45844. keyCode.isEventKey = function isEventKey(event2, nameOrCode) {
  45845. if (event2 && "object" === typeof event2) {
  45846. var keyCode2 = event2.which || event2.keyCode || event2.charCode;
  45847. if (keyCode2 === null || keyCode2 === void 0) {
  45848. return false;
  45849. }
  45850. if (typeof nameOrCode === "string") {
  45851. var foundNamedKey = codes[nameOrCode.toLowerCase()];
  45852. if (foundNamedKey) {
  45853. return foundNamedKey === keyCode2;
  45854. }
  45855. var foundNamedKey = aliases[nameOrCode.toLowerCase()];
  45856. if (foundNamedKey) {
  45857. return foundNamedKey === keyCode2;
  45858. }
  45859. } else if (typeof nameOrCode === "number") {
  45860. return nameOrCode === keyCode2;
  45861. }
  45862. return false;
  45863. }
  45864. };
  45865. exports2 = module2.exports = keyCode;
  45866. var codes = exports2.code = exports2.codes = {
  45867. "backspace": 8,
  45868. "tab": 9,
  45869. "enter": 13,
  45870. "shift": 16,
  45871. "ctrl": 17,
  45872. "alt": 18,
  45873. "pause/break": 19,
  45874. "caps lock": 20,
  45875. "esc": 27,
  45876. "space": 32,
  45877. "page up": 33,
  45878. "page down": 34,
  45879. "end": 35,
  45880. "home": 36,
  45881. "left": 37,
  45882. "up": 38,
  45883. "right": 39,
  45884. "down": 40,
  45885. "insert": 45,
  45886. "delete": 46,
  45887. "command": 91,
  45888. "left command": 91,
  45889. "right command": 93,
  45890. "numpad *": 106,
  45891. "numpad +": 107,
  45892. "numpad -": 109,
  45893. "numpad .": 110,
  45894. "numpad /": 111,
  45895. "num lock": 144,
  45896. "scroll lock": 145,
  45897. "my computer": 182,
  45898. "my calculator": 183,
  45899. ";": 186,
  45900. "=": 187,
  45901. ",": 188,
  45902. "-": 189,
  45903. ".": 190,
  45904. "/": 191,
  45905. "`": 192,
  45906. "[": 219,
  45907. "\\": 220,
  45908. "]": 221,
  45909. "'": 222
  45910. };
  45911. var aliases = exports2.aliases = {
  45912. "windows": 91,
  45913. "\u21E7": 16,
  45914. "\u2325": 18,
  45915. "\u2303": 17,
  45916. "\u2318": 91,
  45917. "ctl": 17,
  45918. "control": 17,
  45919. "option": 18,
  45920. "pause": 19,
  45921. "break": 19,
  45922. "caps": 20,
  45923. "return": 13,
  45924. "escape": 27,
  45925. "spc": 32,
  45926. "spacebar": 32,
  45927. "pgup": 33,
  45928. "pgdn": 34,
  45929. "ins": 45,
  45930. "del": 46,
  45931. "cmd": 91
  45932. };
  45933. /*!
  45934. * Programatically add the following
  45935. */
  45936. for (i2 = 97; i2 < 123; i2++)
  45937. codes[String.fromCharCode(i2)] = i2 - 32;
  45938. for (var i2 = 48; i2 < 58; i2++)
  45939. codes[i2 - 48] = i2;
  45940. for (i2 = 1; i2 < 13; i2++)
  45941. codes["f" + i2] = i2 + 111;
  45942. for (i2 = 0; i2 < 10; i2++)
  45943. codes["numpad " + i2] = i2 + 96;
  45944. var names2 = exports2.names = exports2.title = {};
  45945. for (i2 in codes)
  45946. names2[codes[i2]] = i2;
  45947. for (var alias in aliases) {
  45948. codes[alias] = aliases[alias];
  45949. }
  45950. })(keycode$1, keycode$1.exports);
  45951. var keycode = keycode$1.exports;
  45952. var tuple = SafeParseTuple;
  45953. function SafeParseTuple(obj, reviver) {
  45954. var json;
  45955. var error = null;
  45956. try {
  45957. json = JSON.parse(obj, reviver);
  45958. } catch (err) {
  45959. error = err;
  45960. }
  45961. return [error, json];
  45962. }
  45963. var lib = { exports: {} };
  45964. function _extends$2() {
  45965. _extends$2 = Object.assign ? Object.assign.bind() : function(target) {
  45966. for (var i2 = 1; i2 < arguments.length; i2++) {
  45967. var source = arguments[i2];
  45968. for (var key in source) {
  45969. if (Object.prototype.hasOwnProperty.call(source, key)) {
  45970. target[key] = source[key];
  45971. }
  45972. }
  45973. }
  45974. return target;
  45975. };
  45976. return _extends$2.apply(this, arguments);
  45977. }
  45978. var _extends$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  45979. __proto__: null,
  45980. "default": _extends$2
  45981. }, Symbol.toStringTag, { value: "Module" }));
  45982. var require$$1 = /* @__PURE__ */ getAugmentedNamespace(_extends$3);
  45983. var isFunction_1 = isFunction$1;
  45984. var toString$2 = Object.prototype.toString;
  45985. function isFunction$1(fn2) {
  45986. if (!fn2) {
  45987. return false;
  45988. }
  45989. var string = toString$2.call(fn2);
  45990. return string === "[object Function]" || typeof fn2 === "function" && string !== "[object RegExp]" || typeof window !== "undefined" && (fn2 === window.setTimeout || fn2 === window.alert || fn2 === window.confirm || fn2 === window.prompt);
  45991. }
  45992. var window$3 = window_1;
  45993. var httpResponseHandler = function httpResponseHandler2(callback2, decodeResponseBody) {
  45994. if (decodeResponseBody === void 0) {
  45995. decodeResponseBody = false;
  45996. }
  45997. return function(err, response, responseBody) {
  45998. if (err) {
  45999. callback2(err);
  46000. return;
  46001. }
  46002. if (response.statusCode >= 400 && response.statusCode <= 599) {
  46003. var cause = responseBody;
  46004. if (decodeResponseBody) {
  46005. if (window$3.TextDecoder) {
  46006. var charset = getCharset(response.headers && response.headers["content-type"]);
  46007. try {
  46008. cause = new TextDecoder(charset).decode(responseBody);
  46009. } catch (e) {
  46010. }
  46011. } else {
  46012. cause = String.fromCharCode.apply(null, new Uint8Array(responseBody));
  46013. }
  46014. }
  46015. callback2({
  46016. cause
  46017. });
  46018. return;
  46019. }
  46020. callback2(null, responseBody);
  46021. };
  46022. };
  46023. function getCharset(contentTypeHeader) {
  46024. if (contentTypeHeader === void 0) {
  46025. contentTypeHeader = "";
  46026. }
  46027. return contentTypeHeader.toLowerCase().split(";").reduce(function(charset, contentType) {
  46028. var _contentType$split = contentType.split("="), type2 = _contentType$split[0], value = _contentType$split[1];
  46029. if (type2.trim() === "charset") {
  46030. return value.trim();
  46031. }
  46032. return charset;
  46033. }, "utf-8");
  46034. }
  46035. var httpHandler = httpResponseHandler;
  46036. var window$2 = window_1;
  46037. var _extends$1 = require$$1;
  46038. var isFunction = isFunction_1;
  46039. createXHR.httpHandler = httpHandler;
  46040. /**
  46041. * @license
  46042. * slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
  46043. * Copyright (c) 2014 David Björklund
  46044. * Available under the MIT license
  46045. * <https://github.com/kesla/parse-headers/blob/master/LICENCE>
  46046. */
  46047. var parseHeaders = function parseHeaders2(headers) {
  46048. var result = {};
  46049. if (!headers) {
  46050. return result;
  46051. }
  46052. headers.trim().split("\n").forEach(function(row) {
  46053. var index2 = row.indexOf(":");
  46054. var key = row.slice(0, index2).trim().toLowerCase();
  46055. var value = row.slice(index2 + 1).trim();
  46056. if (typeof result[key] === "undefined") {
  46057. result[key] = value;
  46058. } else if (Array.isArray(result[key])) {
  46059. result[key].push(value);
  46060. } else {
  46061. result[key] = [result[key], value];
  46062. }
  46063. });
  46064. return result;
  46065. };
  46066. lib.exports = createXHR;
  46067. lib.exports.default = createXHR;
  46068. createXHR.XMLHttpRequest = window$2.XMLHttpRequest || noop$2;
  46069. createXHR.XDomainRequest = "withCredentials" in new createXHR.XMLHttpRequest() ? createXHR.XMLHttpRequest : window$2.XDomainRequest;
  46070. forEachArray(["get", "put", "post", "patch", "head", "delete"], function(method) {
  46071. createXHR[method === "delete" ? "del" : method] = function(uri, options2, callback2) {
  46072. options2 = initParams(uri, options2, callback2);
  46073. options2.method = method.toUpperCase();
  46074. return _createXHR(options2);
  46075. };
  46076. });
  46077. function forEachArray(array, iterator) {
  46078. for (var i2 = 0; i2 < array.length; i2++) {
  46079. iterator(array[i2]);
  46080. }
  46081. }
  46082. function isEmpty(obj) {
  46083. for (var i2 in obj) {
  46084. if (obj.hasOwnProperty(i2))
  46085. return false;
  46086. }
  46087. return true;
  46088. }
  46089. function initParams(uri, options2, callback2) {
  46090. var params = uri;
  46091. if (isFunction(options2)) {
  46092. callback2 = options2;
  46093. if (typeof uri === "string") {
  46094. params = {
  46095. uri
  46096. };
  46097. }
  46098. } else {
  46099. params = _extends$1({}, options2, {
  46100. uri
  46101. });
  46102. }
  46103. params.callback = callback2;
  46104. return params;
  46105. }
  46106. function createXHR(uri, options2, callback2) {
  46107. options2 = initParams(uri, options2, callback2);
  46108. return _createXHR(options2);
  46109. }
  46110. function _createXHR(options2) {
  46111. if (typeof options2.callback === "undefined") {
  46112. throw new Error("callback argument missing");
  46113. }
  46114. var called = false;
  46115. var callback2 = function cbOnce(err, response, body2) {
  46116. if (!called) {
  46117. called = true;
  46118. options2.callback(err, response, body2);
  46119. }
  46120. };
  46121. function readystatechange() {
  46122. if (xhr.readyState === 4) {
  46123. setTimeout(loadFunc, 0);
  46124. }
  46125. }
  46126. function getBody() {
  46127. var body2 = void 0;
  46128. if (xhr.response) {
  46129. body2 = xhr.response;
  46130. } else {
  46131. body2 = xhr.responseText || getXml(xhr);
  46132. }
  46133. if (isJson) {
  46134. try {
  46135. body2 = JSON.parse(body2);
  46136. } catch (e) {
  46137. }
  46138. }
  46139. return body2;
  46140. }
  46141. function errorFunc(evt) {
  46142. clearTimeout(timeoutTimer);
  46143. if (!(evt instanceof Error)) {
  46144. evt = new Error("" + (evt || "Unknown XMLHttpRequest Error"));
  46145. }
  46146. evt.statusCode = 0;
  46147. return callback2(evt, failureResponse);
  46148. }
  46149. function loadFunc() {
  46150. if (aborted)
  46151. return;
  46152. var status;
  46153. clearTimeout(timeoutTimer);
  46154. if (options2.useXDR && xhr.status === void 0) {
  46155. status = 200;
  46156. } else {
  46157. status = xhr.status === 1223 ? 204 : xhr.status;
  46158. }
  46159. var response = failureResponse;
  46160. var err = null;
  46161. if (status !== 0) {
  46162. response = {
  46163. body: getBody(),
  46164. statusCode: status,
  46165. method,
  46166. headers: {},
  46167. url: uri,
  46168. rawRequest: xhr
  46169. };
  46170. if (xhr.getAllResponseHeaders) {
  46171. response.headers = parseHeaders(xhr.getAllResponseHeaders());
  46172. }
  46173. } else {
  46174. err = new Error("Internal XMLHttpRequest Error");
  46175. }
  46176. return callback2(err, response, response.body);
  46177. }
  46178. var xhr = options2.xhr || null;
  46179. if (!xhr) {
  46180. if (options2.cors || options2.useXDR) {
  46181. xhr = new createXHR.XDomainRequest();
  46182. } else {
  46183. xhr = new createXHR.XMLHttpRequest();
  46184. }
  46185. }
  46186. var key;
  46187. var aborted;
  46188. var uri = xhr.url = options2.uri || options2.url;
  46189. var method = xhr.method = options2.method || "GET";
  46190. var body = options2.body || options2.data;
  46191. var headers = xhr.headers = options2.headers || {};
  46192. var sync = !!options2.sync;
  46193. var isJson = false;
  46194. var timeoutTimer;
  46195. var failureResponse = {
  46196. body: void 0,
  46197. headers: {},
  46198. statusCode: 0,
  46199. method,
  46200. url: uri,
  46201. rawRequest: xhr
  46202. };
  46203. if ("json" in options2 && options2.json !== false) {
  46204. isJson = true;
  46205. headers["accept"] || headers["Accept"] || (headers["Accept"] = "application/json");
  46206. if (method !== "GET" && method !== "HEAD") {
  46207. headers["content-type"] || headers["Content-Type"] || (headers["Content-Type"] = "application/json");
  46208. body = JSON.stringify(options2.json === true ? body : options2.json);
  46209. }
  46210. }
  46211. xhr.onreadystatechange = readystatechange;
  46212. xhr.onload = loadFunc;
  46213. xhr.onerror = errorFunc;
  46214. xhr.onprogress = function() {
  46215. };
  46216. xhr.onabort = function() {
  46217. aborted = true;
  46218. };
  46219. xhr.ontimeout = errorFunc;
  46220. xhr.open(method, uri, !sync, options2.username, options2.password);
  46221. if (!sync) {
  46222. xhr.withCredentials = !!options2.withCredentials;
  46223. }
  46224. if (!sync && options2.timeout > 0) {
  46225. timeoutTimer = setTimeout(function() {
  46226. if (aborted)
  46227. return;
  46228. aborted = true;
  46229. xhr.abort("timeout");
  46230. var e = new Error("XMLHttpRequest timeout");
  46231. e.code = "ETIMEDOUT";
  46232. errorFunc(e);
  46233. }, options2.timeout);
  46234. }
  46235. if (xhr.setRequestHeader) {
  46236. for (key in headers) {
  46237. if (headers.hasOwnProperty(key)) {
  46238. xhr.setRequestHeader(key, headers[key]);
  46239. }
  46240. }
  46241. } else if (options2.headers && !isEmpty(options2.headers)) {
  46242. throw new Error("Headers cannot be set on an XDomainRequest object");
  46243. }
  46244. if ("responseType" in options2) {
  46245. xhr.responseType = options2.responseType;
  46246. }
  46247. if ("beforeSend" in options2 && typeof options2.beforeSend === "function") {
  46248. options2.beforeSend(xhr);
  46249. }
  46250. xhr.send(body || null);
  46251. return xhr;
  46252. }
  46253. function getXml(xhr) {
  46254. try {
  46255. if (xhr.responseType === "document") {
  46256. return xhr.responseXML;
  46257. }
  46258. var firefoxBugTakenEffect = xhr.responseXML && xhr.responseXML.documentElement.nodeName === "parsererror";
  46259. if (xhr.responseType === "" && !firefoxBugTakenEffect) {
  46260. return xhr.responseXML;
  46261. }
  46262. } catch (e) {
  46263. }
  46264. return null;
  46265. }
  46266. function noop$2() {
  46267. }
  46268. var XHR = lib.exports;
  46269. var browserIndex = { exports: {} };
  46270. var document$1 = document_1;
  46271. var _objCreate = Object.create || function() {
  46272. function F() {
  46273. }
  46274. return function(o) {
  46275. if (arguments.length !== 1) {
  46276. throw new Error("Object.create shim only accepts one parameter.");
  46277. }
  46278. F.prototype = o;
  46279. return new F();
  46280. };
  46281. }();
  46282. function ParsingError(errorData, message) {
  46283. this.name = "ParsingError";
  46284. this.code = errorData.code;
  46285. this.message = message || errorData.message;
  46286. }
  46287. ParsingError.prototype = _objCreate(Error.prototype);
  46288. ParsingError.prototype.constructor = ParsingError;
  46289. ParsingError.Errors = {
  46290. BadSignature: {
  46291. code: 0,
  46292. message: "Malformed WebVTT signature."
  46293. },
  46294. BadTimeStamp: {
  46295. code: 1,
  46296. message: "Malformed time stamp."
  46297. }
  46298. };
  46299. function parseTimeStamp(input) {
  46300. function computeSeconds(h2, m2, s, f) {
  46301. return (h2 | 0) * 3600 + (m2 | 0) * 60 + (s | 0) + (f | 0) / 1e3;
  46302. }
  46303. var m = input.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);
  46304. if (!m) {
  46305. return null;
  46306. }
  46307. if (m[3]) {
  46308. return computeSeconds(m[1], m[2], m[3].replace(":", ""), m[4]);
  46309. } else if (m[1] > 59) {
  46310. return computeSeconds(m[1], m[2], 0, m[4]);
  46311. } else {
  46312. return computeSeconds(0, m[1], m[2], m[4]);
  46313. }
  46314. }
  46315. function Settings() {
  46316. this.values = _objCreate(null);
  46317. }
  46318. Settings.prototype = {
  46319. set: function(k, v) {
  46320. if (!this.get(k) && v !== "") {
  46321. this.values[k] = v;
  46322. }
  46323. },
  46324. get: function(k, dflt, defaultKey) {
  46325. if (defaultKey) {
  46326. return this.has(k) ? this.values[k] : dflt[defaultKey];
  46327. }
  46328. return this.has(k) ? this.values[k] : dflt;
  46329. },
  46330. has: function(k) {
  46331. return k in this.values;
  46332. },
  46333. alt: function(k, v, a) {
  46334. for (var n = 0; n < a.length; ++n) {
  46335. if (v === a[n]) {
  46336. this.set(k, v);
  46337. break;
  46338. }
  46339. }
  46340. },
  46341. integer: function(k, v) {
  46342. if (/^-?\d+$/.test(v)) {
  46343. this.set(k, parseInt(v, 10));
  46344. }
  46345. },
  46346. percent: function(k, v) {
  46347. if (v.match(/^([\d]{1,3})(\.[\d]*)?%$/)) {
  46348. v = parseFloat(v);
  46349. if (v >= 0 && v <= 100) {
  46350. this.set(k, v);
  46351. return true;
  46352. }
  46353. }
  46354. return false;
  46355. }
  46356. };
  46357. function parseOptions(input, callback2, keyValueDelim, groupDelim) {
  46358. var groups = groupDelim ? input.split(groupDelim) : [input];
  46359. for (var i2 in groups) {
  46360. if (typeof groups[i2] !== "string") {
  46361. continue;
  46362. }
  46363. var kv = groups[i2].split(keyValueDelim);
  46364. if (kv.length !== 2) {
  46365. continue;
  46366. }
  46367. var k = kv[0].trim();
  46368. var v = kv[1].trim();
  46369. callback2(k, v);
  46370. }
  46371. }
  46372. function parseCue(input, cue, regionList) {
  46373. var oInput = input;
  46374. function consumeTimeStamp() {
  46375. var ts3 = parseTimeStamp(input);
  46376. if (ts3 === null) {
  46377. throw new ParsingError(
  46378. ParsingError.Errors.BadTimeStamp,
  46379. "Malformed timestamp: " + oInput
  46380. );
  46381. }
  46382. input = input.replace(/^[^\sa-zA-Z-]+/, "");
  46383. return ts3;
  46384. }
  46385. function consumeCueSettings(input2, cue2) {
  46386. var settings = new Settings();
  46387. parseOptions(input2, function(k, v) {
  46388. switch (k) {
  46389. case "region":
  46390. for (var i2 = regionList.length - 1; i2 >= 0; i2--) {
  46391. if (regionList[i2].id === v) {
  46392. settings.set(k, regionList[i2].region);
  46393. break;
  46394. }
  46395. }
  46396. break;
  46397. case "vertical":
  46398. settings.alt(k, v, ["rl", "lr"]);
  46399. break;
  46400. case "line":
  46401. var vals = v.split(","), vals0 = vals[0];
  46402. settings.integer(k, vals0);
  46403. settings.percent(k, vals0) ? settings.set("snapToLines", false) : null;
  46404. settings.alt(k, vals0, ["auto"]);
  46405. if (vals.length === 2) {
  46406. settings.alt("lineAlign", vals[1], ["start", "center", "end"]);
  46407. }
  46408. break;
  46409. case "position":
  46410. vals = v.split(",");
  46411. settings.percent(k, vals[0]);
  46412. if (vals.length === 2) {
  46413. settings.alt("positionAlign", vals[1], ["start", "center", "end"]);
  46414. }
  46415. break;
  46416. case "size":
  46417. settings.percent(k, v);
  46418. break;
  46419. case "align":
  46420. settings.alt(k, v, ["start", "center", "end", "left", "right"]);
  46421. break;
  46422. }
  46423. }, /:/, /\s/);
  46424. cue2.region = settings.get("region", null);
  46425. cue2.vertical = settings.get("vertical", "");
  46426. try {
  46427. cue2.line = settings.get("line", "auto");
  46428. } catch (e) {
  46429. }
  46430. cue2.lineAlign = settings.get("lineAlign", "start");
  46431. cue2.snapToLines = settings.get("snapToLines", true);
  46432. cue2.size = settings.get("size", 100);
  46433. try {
  46434. cue2.align = settings.get("align", "center");
  46435. } catch (e) {
  46436. cue2.align = settings.get("align", "middle");
  46437. }
  46438. try {
  46439. cue2.position = settings.get("position", "auto");
  46440. } catch (e) {
  46441. cue2.position = settings.get("position", {
  46442. start: 0,
  46443. left: 0,
  46444. center: 50,
  46445. middle: 50,
  46446. end: 100,
  46447. right: 100
  46448. }, cue2.align);
  46449. }
  46450. cue2.positionAlign = settings.get("positionAlign", {
  46451. start: "start",
  46452. left: "start",
  46453. center: "center",
  46454. middle: "center",
  46455. end: "end",
  46456. right: "end"
  46457. }, cue2.align);
  46458. }
  46459. function skipWhitespace() {
  46460. input = input.replace(/^\s+/, "");
  46461. }
  46462. skipWhitespace();
  46463. cue.startTime = consumeTimeStamp();
  46464. skipWhitespace();
  46465. if (input.substr(0, 3) !== "-->") {
  46466. throw new ParsingError(
  46467. ParsingError.Errors.BadTimeStamp,
  46468. "Malformed time stamp (time stamps must be separated by '-->'): " + oInput
  46469. );
  46470. }
  46471. input = input.substr(3);
  46472. skipWhitespace();
  46473. cue.endTime = consumeTimeStamp();
  46474. skipWhitespace();
  46475. consumeCueSettings(input, cue);
  46476. }
  46477. var TEXTAREA_ELEMENT = document$1.createElement && document$1.createElement("textarea");
  46478. var TAG_NAME = {
  46479. c: "span",
  46480. i: "i",
  46481. b: "b",
  46482. u: "u",
  46483. ruby: "ruby",
  46484. rt: "rt",
  46485. v: "span",
  46486. lang: "span"
  46487. };
  46488. var DEFAULT_COLOR_CLASS = {
  46489. white: "rgba(255,255,255,1)",
  46490. lime: "rgba(0,255,0,1)",
  46491. cyan: "rgba(0,255,255,1)",
  46492. red: "rgba(255,0,0,1)",
  46493. yellow: "rgba(255,255,0,1)",
  46494. magenta: "rgba(255,0,255,1)",
  46495. blue: "rgba(0,0,255,1)",
  46496. black: "rgba(0,0,0,1)"
  46497. };
  46498. var TAG_ANNOTATION = {
  46499. v: "title",
  46500. lang: "lang"
  46501. };
  46502. var NEEDS_PARENT = {
  46503. rt: "ruby"
  46504. };
  46505. function parseContent(window2, input) {
  46506. function nextToken() {
  46507. if (!input) {
  46508. return null;
  46509. }
  46510. function consume(result) {
  46511. input = input.substr(result.length);
  46512. return result;
  46513. }
  46514. var m2 = input.match(/^([^<]*)(<[^>]*>?)?/);
  46515. return consume(m2[1] ? m2[1] : m2[2]);
  46516. }
  46517. function unescape2(s) {
  46518. TEXTAREA_ELEMENT.innerHTML = s;
  46519. s = TEXTAREA_ELEMENT.textContent;
  46520. TEXTAREA_ELEMENT.textContent = "";
  46521. return s;
  46522. }
  46523. function shouldAdd(current2, element) {
  46524. return !NEEDS_PARENT[element.localName] || NEEDS_PARENT[element.localName] === current2.localName;
  46525. }
  46526. function createElement(type2, annotation) {
  46527. var tagName = TAG_NAME[type2];
  46528. if (!tagName) {
  46529. return null;
  46530. }
  46531. var element = window2.document.createElement(tagName);
  46532. var name = TAG_ANNOTATION[type2];
  46533. if (name && annotation) {
  46534. element[name] = annotation.trim();
  46535. }
  46536. return element;
  46537. }
  46538. var rootDiv = window2.document.createElement("div"), current = rootDiv, t2, tagStack = [];
  46539. while ((t2 = nextToken()) !== null) {
  46540. if (t2[0] === "<") {
  46541. if (t2[1] === "/") {
  46542. if (tagStack.length && tagStack[tagStack.length - 1] === t2.substr(2).replace(">", "")) {
  46543. tagStack.pop();
  46544. current = current.parentNode;
  46545. }
  46546. continue;
  46547. }
  46548. var ts3 = parseTimeStamp(t2.substr(1, t2.length - 2));
  46549. var node;
  46550. if (ts3) {
  46551. node = window2.document.createProcessingInstruction("timestamp", ts3);
  46552. current.appendChild(node);
  46553. continue;
  46554. }
  46555. var m = t2.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);
  46556. if (!m) {
  46557. continue;
  46558. }
  46559. node = createElement(m[1], m[3]);
  46560. if (!node) {
  46561. continue;
  46562. }
  46563. if (!shouldAdd(current, node)) {
  46564. continue;
  46565. }
  46566. if (m[2]) {
  46567. var classes = m[2].split(".");
  46568. classes.forEach(function(cl) {
  46569. var bgColor = /^bg_/.test(cl);
  46570. var colorName = bgColor ? cl.slice(3) : cl;
  46571. if (DEFAULT_COLOR_CLASS.hasOwnProperty(colorName)) {
  46572. var propName = bgColor ? "background-color" : "color";
  46573. var propValue = DEFAULT_COLOR_CLASS[colorName];
  46574. node.style[propName] = propValue;
  46575. }
  46576. });
  46577. node.className = classes.join(" ");
  46578. }
  46579. tagStack.push(m[1]);
  46580. current.appendChild(node);
  46581. current = node;
  46582. continue;
  46583. }
  46584. current.appendChild(window2.document.createTextNode(unescape2(t2)));
  46585. }
  46586. return rootDiv;
  46587. }
  46588. var strongRTLRanges = [
  46589. [1470, 1470],
  46590. [1472, 1472],
  46591. [1475, 1475],
  46592. [1478, 1478],
  46593. [1488, 1514],
  46594. [1520, 1524],
  46595. [1544, 1544],
  46596. [1547, 1547],
  46597. [1549, 1549],
  46598. [1563, 1563],
  46599. [1566, 1610],
  46600. [1645, 1647],
  46601. [1649, 1749],
  46602. [1765, 1766],
  46603. [1774, 1775],
  46604. [1786, 1805],
  46605. [1807, 1808],
  46606. [1810, 1839],
  46607. [1869, 1957],
  46608. [1969, 1969],
  46609. [1984, 2026],
  46610. [2036, 2037],
  46611. [2042, 2042],
  46612. [2048, 2069],
  46613. [2074, 2074],
  46614. [2084, 2084],
  46615. [2088, 2088],
  46616. [2096, 2110],
  46617. [2112, 2136],
  46618. [2142, 2142],
  46619. [2208, 2208],
  46620. [2210, 2220],
  46621. [8207, 8207],
  46622. [64285, 64285],
  46623. [64287, 64296],
  46624. [64298, 64310],
  46625. [64312, 64316],
  46626. [64318, 64318],
  46627. [64320, 64321],
  46628. [64323, 64324],
  46629. [64326, 64449],
  46630. [64467, 64829],
  46631. [64848, 64911],
  46632. [64914, 64967],
  46633. [65008, 65020],
  46634. [65136, 65140],
  46635. [65142, 65276],
  46636. [67584, 67589],
  46637. [67592, 67592],
  46638. [67594, 67637],
  46639. [67639, 67640],
  46640. [67644, 67644],
  46641. [67647, 67669],
  46642. [67671, 67679],
  46643. [67840, 67867],
  46644. [67872, 67897],
  46645. [67903, 67903],
  46646. [67968, 68023],
  46647. [68030, 68031],
  46648. [68096, 68096],
  46649. [68112, 68115],
  46650. [68117, 68119],
  46651. [68121, 68147],
  46652. [68160, 68167],
  46653. [68176, 68184],
  46654. [68192, 68223],
  46655. [68352, 68405],
  46656. [68416, 68437],
  46657. [68440, 68466],
  46658. [68472, 68479],
  46659. [68608, 68680],
  46660. [126464, 126467],
  46661. [126469, 126495],
  46662. [126497, 126498],
  46663. [126500, 126500],
  46664. [126503, 126503],
  46665. [126505, 126514],
  46666. [126516, 126519],
  46667. [126521, 126521],
  46668. [126523, 126523],
  46669. [126530, 126530],
  46670. [126535, 126535],
  46671. [126537, 126537],
  46672. [126539, 126539],
  46673. [126541, 126543],
  46674. [126545, 126546],
  46675. [126548, 126548],
  46676. [126551, 126551],
  46677. [126553, 126553],
  46678. [126555, 126555],
  46679. [126557, 126557],
  46680. [126559, 126559],
  46681. [126561, 126562],
  46682. [126564, 126564],
  46683. [126567, 126570],
  46684. [126572, 126578],
  46685. [126580, 126583],
  46686. [126585, 126588],
  46687. [126590, 126590],
  46688. [126592, 126601],
  46689. [126603, 126619],
  46690. [126625, 126627],
  46691. [126629, 126633],
  46692. [126635, 126651],
  46693. [1114109, 1114109]
  46694. ];
  46695. function isStrongRTLChar(charCode) {
  46696. for (var i2 = 0; i2 < strongRTLRanges.length; i2++) {
  46697. var currentRange = strongRTLRanges[i2];
  46698. if (charCode >= currentRange[0] && charCode <= currentRange[1]) {
  46699. return true;
  46700. }
  46701. }
  46702. return false;
  46703. }
  46704. function determineBidi(cueDiv) {
  46705. var nodeStack = [], text = "", charCode;
  46706. if (!cueDiv || !cueDiv.childNodes) {
  46707. return "ltr";
  46708. }
  46709. function pushNodes(nodeStack2, node) {
  46710. for (var i3 = node.childNodes.length - 1; i3 >= 0; i3--) {
  46711. nodeStack2.push(node.childNodes[i3]);
  46712. }
  46713. }
  46714. function nextTextNode(nodeStack2) {
  46715. if (!nodeStack2 || !nodeStack2.length) {
  46716. return null;
  46717. }
  46718. var node = nodeStack2.pop(), text2 = node.textContent || node.innerText;
  46719. if (text2) {
  46720. var m = text2.match(/^.*(\n|\r)/);
  46721. if (m) {
  46722. nodeStack2.length = 0;
  46723. return m[0];
  46724. }
  46725. return text2;
  46726. }
  46727. if (node.tagName === "ruby") {
  46728. return nextTextNode(nodeStack2);
  46729. }
  46730. if (node.childNodes) {
  46731. pushNodes(nodeStack2, node);
  46732. return nextTextNode(nodeStack2);
  46733. }
  46734. }
  46735. pushNodes(nodeStack, cueDiv);
  46736. while (text = nextTextNode(nodeStack)) {
  46737. for (var i2 = 0; i2 < text.length; i2++) {
  46738. charCode = text.charCodeAt(i2);
  46739. if (isStrongRTLChar(charCode)) {
  46740. return "rtl";
  46741. }
  46742. }
  46743. }
  46744. return "ltr";
  46745. }
  46746. function computeLinePos(cue) {
  46747. if (typeof cue.line === "number" && (cue.snapToLines || cue.line >= 0 && cue.line <= 100)) {
  46748. return cue.line;
  46749. }
  46750. if (!cue.track || !cue.track.textTrackList || !cue.track.textTrackList.mediaElement) {
  46751. return -1;
  46752. }
  46753. var track = cue.track, trackList = track.textTrackList, count = 0;
  46754. for (var i2 = 0; i2 < trackList.length && trackList[i2] !== track; i2++) {
  46755. if (trackList[i2].mode === "showing") {
  46756. count++;
  46757. }
  46758. }
  46759. return ++count * -1;
  46760. }
  46761. function StyleBox() {
  46762. }
  46763. StyleBox.prototype.applyStyles = function(styles, div) {
  46764. div = div || this.div;
  46765. for (var prop in styles) {
  46766. if (styles.hasOwnProperty(prop)) {
  46767. div.style[prop] = styles[prop];
  46768. }
  46769. }
  46770. };
  46771. StyleBox.prototype.formatStyle = function(val, unit) {
  46772. return val === 0 ? 0 : val + unit;
  46773. };
  46774. function CueStyleBox(window2, cue, styleOptions) {
  46775. StyleBox.call(this);
  46776. this.cue = cue;
  46777. this.cueDiv = parseContent(window2, cue.text);
  46778. var styles = {
  46779. color: "rgba(255, 255, 255, 1)",
  46780. backgroundColor: "rgba(0, 0, 0, 0.8)",
  46781. position: "relative",
  46782. left: 0,
  46783. right: 0,
  46784. top: 0,
  46785. bottom: 0,
  46786. display: "inline",
  46787. writingMode: cue.vertical === "" ? "horizontal-tb" : cue.vertical === "lr" ? "vertical-lr" : "vertical-rl",
  46788. unicodeBidi: "plaintext"
  46789. };
  46790. this.applyStyles(styles, this.cueDiv);
  46791. this.div = window2.document.createElement("div");
  46792. styles = {
  46793. direction: determineBidi(this.cueDiv),
  46794. writingMode: cue.vertical === "" ? "horizontal-tb" : cue.vertical === "lr" ? "vertical-lr" : "vertical-rl",
  46795. unicodeBidi: "plaintext",
  46796. textAlign: cue.align === "middle" ? "center" : cue.align,
  46797. font: styleOptions.font,
  46798. whiteSpace: "pre-line",
  46799. position: "absolute"
  46800. };
  46801. this.applyStyles(styles);
  46802. this.div.appendChild(this.cueDiv);
  46803. var textPos = 0;
  46804. switch (cue.positionAlign) {
  46805. case "start":
  46806. textPos = cue.position;
  46807. break;
  46808. case "center":
  46809. textPos = cue.position - cue.size / 2;
  46810. break;
  46811. case "end":
  46812. textPos = cue.position - cue.size;
  46813. break;
  46814. }
  46815. if (cue.vertical === "") {
  46816. this.applyStyles({
  46817. left: this.formatStyle(textPos, "%"),
  46818. width: this.formatStyle(cue.size, "%")
  46819. });
  46820. } else {
  46821. this.applyStyles({
  46822. top: this.formatStyle(textPos, "%"),
  46823. height: this.formatStyle(cue.size, "%")
  46824. });
  46825. }
  46826. this.move = function(box) {
  46827. this.applyStyles({
  46828. top: this.formatStyle(box.top, "px"),
  46829. bottom: this.formatStyle(box.bottom, "px"),
  46830. left: this.formatStyle(box.left, "px"),
  46831. right: this.formatStyle(box.right, "px"),
  46832. height: this.formatStyle(box.height, "px"),
  46833. width: this.formatStyle(box.width, "px")
  46834. });
  46835. };
  46836. }
  46837. CueStyleBox.prototype = _objCreate(StyleBox.prototype);
  46838. CueStyleBox.prototype.constructor = CueStyleBox;
  46839. function BoxPosition(obj) {
  46840. var lh, height2, width2, top;
  46841. if (obj.div) {
  46842. height2 = obj.div.offsetHeight;
  46843. width2 = obj.div.offsetWidth;
  46844. top = obj.div.offsetTop;
  46845. var rects = (rects = obj.div.childNodes) && (rects = rects[0]) && rects.getClientRects && rects.getClientRects();
  46846. obj = obj.div.getBoundingClientRect();
  46847. lh = rects ? Math.max(rects[0] && rects[0].height || 0, obj.height / rects.length) : 0;
  46848. }
  46849. this.left = obj.left;
  46850. this.right = obj.right;
  46851. this.top = obj.top || top;
  46852. this.height = obj.height || height2;
  46853. this.bottom = obj.bottom || top + (obj.height || height2);
  46854. this.width = obj.width || width2;
  46855. this.lineHeight = lh !== void 0 ? lh : obj.lineHeight;
  46856. }
  46857. BoxPosition.prototype.move = function(axis, toMove) {
  46858. toMove = toMove !== void 0 ? toMove : this.lineHeight;
  46859. switch (axis) {
  46860. case "+x":
  46861. this.left += toMove;
  46862. this.right += toMove;
  46863. break;
  46864. case "-x":
  46865. this.left -= toMove;
  46866. this.right -= toMove;
  46867. break;
  46868. case "+y":
  46869. this.top += toMove;
  46870. this.bottom += toMove;
  46871. break;
  46872. case "-y":
  46873. this.top -= toMove;
  46874. this.bottom -= toMove;
  46875. break;
  46876. }
  46877. };
  46878. BoxPosition.prototype.overlaps = function(b2) {
  46879. return this.left < b2.right && this.right > b2.left && this.top < b2.bottom && this.bottom > b2.top;
  46880. };
  46881. BoxPosition.prototype.overlapsAny = function(boxes) {
  46882. for (var i2 = 0; i2 < boxes.length; i2++) {
  46883. if (this.overlaps(boxes[i2])) {
  46884. return true;
  46885. }
  46886. }
  46887. return false;
  46888. };
  46889. BoxPosition.prototype.within = function(container) {
  46890. return this.top >= container.top && this.bottom <= container.bottom && this.left >= container.left && this.right <= container.right;
  46891. };
  46892. BoxPosition.prototype.overlapsOppositeAxis = function(container, axis) {
  46893. switch (axis) {
  46894. case "+x":
  46895. return this.left < container.left;
  46896. case "-x":
  46897. return this.right > container.right;
  46898. case "+y":
  46899. return this.top < container.top;
  46900. case "-y":
  46901. return this.bottom > container.bottom;
  46902. }
  46903. };
  46904. BoxPosition.prototype.intersectPercentage = function(b2) {
  46905. var x = Math.max(0, Math.min(this.right, b2.right) - Math.max(this.left, b2.left)), y = Math.max(0, Math.min(this.bottom, b2.bottom) - Math.max(this.top, b2.top)), intersectArea = x * y;
  46906. return intersectArea / (this.height * this.width);
  46907. };
  46908. BoxPosition.prototype.toCSSCompatValues = function(reference) {
  46909. return {
  46910. top: this.top - reference.top,
  46911. bottom: reference.bottom - this.bottom,
  46912. left: this.left - reference.left,
  46913. right: reference.right - this.right,
  46914. height: this.height,
  46915. width: this.width
  46916. };
  46917. };
  46918. BoxPosition.getSimpleBoxPosition = function(obj) {
  46919. var height2 = obj.div ? obj.div.offsetHeight : obj.tagName ? obj.offsetHeight : 0;
  46920. var width2 = obj.div ? obj.div.offsetWidth : obj.tagName ? obj.offsetWidth : 0;
  46921. var top = obj.div ? obj.div.offsetTop : obj.tagName ? obj.offsetTop : 0;
  46922. obj = obj.div ? obj.div.getBoundingClientRect() : obj.tagName ? obj.getBoundingClientRect() : obj;
  46923. var ret = {
  46924. left: obj.left,
  46925. right: obj.right,
  46926. top: obj.top || top,
  46927. height: obj.height || height2,
  46928. bottom: obj.bottom || top + (obj.height || height2),
  46929. width: obj.width || width2
  46930. };
  46931. return ret;
  46932. };
  46933. function moveBoxToLinePosition(window2, styleBox, containerBox, boxPositions) {
  46934. function findBestPosition(b, axis2) {
  46935. var bestPosition2, specifiedPosition = new BoxPosition(b), percentage = 1;
  46936. for (var i2 = 0; i2 < axis2.length; i2++) {
  46937. while (b.overlapsOppositeAxis(containerBox, axis2[i2]) || b.within(containerBox) && b.overlapsAny(boxPositions)) {
  46938. b.move(axis2[i2]);
  46939. }
  46940. if (b.within(containerBox)) {
  46941. return b;
  46942. }
  46943. var p = b.intersectPercentage(containerBox);
  46944. if (percentage > p) {
  46945. bestPosition2 = new BoxPosition(b);
  46946. percentage = p;
  46947. }
  46948. b = new BoxPosition(specifiedPosition);
  46949. }
  46950. return bestPosition2 || specifiedPosition;
  46951. }
  46952. var boxPosition = new BoxPosition(styleBox), cue = styleBox.cue, linePos = computeLinePos(cue), axis = [];
  46953. if (cue.snapToLines) {
  46954. var size;
  46955. switch (cue.vertical) {
  46956. case "":
  46957. axis = ["+y", "-y"];
  46958. size = "height";
  46959. break;
  46960. case "rl":
  46961. axis = ["+x", "-x"];
  46962. size = "width";
  46963. break;
  46964. case "lr":
  46965. axis = ["-x", "+x"];
  46966. size = "width";
  46967. break;
  46968. }
  46969. var step = boxPosition.lineHeight, position2 = step * Math.round(linePos), maxPosition = containerBox[size] + step, initialAxis = axis[0];
  46970. if (Math.abs(position2) > maxPosition) {
  46971. position2 = position2 < 0 ? -1 : 1;
  46972. position2 *= Math.ceil(maxPosition / step) * step;
  46973. }
  46974. if (linePos < 0) {
  46975. position2 += cue.vertical === "" ? containerBox.height : containerBox.width;
  46976. axis = axis.reverse();
  46977. }
  46978. boxPosition.move(initialAxis, position2);
  46979. } else {
  46980. var calculatedPercentage = boxPosition.lineHeight / containerBox.height * 100;
  46981. switch (cue.lineAlign) {
  46982. case "center":
  46983. linePos -= calculatedPercentage / 2;
  46984. break;
  46985. case "end":
  46986. linePos -= calculatedPercentage;
  46987. break;
  46988. }
  46989. switch (cue.vertical) {
  46990. case "":
  46991. styleBox.applyStyles({
  46992. top: styleBox.formatStyle(linePos, "%")
  46993. });
  46994. break;
  46995. case "rl":
  46996. styleBox.applyStyles({
  46997. left: styleBox.formatStyle(linePos, "%")
  46998. });
  46999. break;
  47000. case "lr":
  47001. styleBox.applyStyles({
  47002. right: styleBox.formatStyle(linePos, "%")
  47003. });
  47004. break;
  47005. }
  47006. axis = ["+y", "-x", "+x", "-y"];
  47007. boxPosition = new BoxPosition(styleBox);
  47008. }
  47009. var bestPosition = findBestPosition(boxPosition, axis);
  47010. styleBox.move(bestPosition.toCSSCompatValues(containerBox));
  47011. }
  47012. function WebVTT$1() {
  47013. }
  47014. WebVTT$1.StringDecoder = function() {
  47015. return {
  47016. decode: function(data) {
  47017. if (!data) {
  47018. return "";
  47019. }
  47020. if (typeof data !== "string") {
  47021. throw new Error("Error - expected string data.");
  47022. }
  47023. return decodeURIComponent(encodeURIComponent(data));
  47024. }
  47025. };
  47026. };
  47027. WebVTT$1.convertCueToDOMTree = function(window2, cuetext) {
  47028. if (!window2 || !cuetext) {
  47029. return null;
  47030. }
  47031. return parseContent(window2, cuetext);
  47032. };
  47033. var FONT_SIZE_PERCENT = 0.05;
  47034. var FONT_STYLE = "sans-serif";
  47035. var CUE_BACKGROUND_PADDING = "1.5%";
  47036. WebVTT$1.processCues = function(window2, cues, overlay) {
  47037. if (!window2 || !cues || !overlay) {
  47038. return null;
  47039. }
  47040. while (overlay.firstChild) {
  47041. overlay.removeChild(overlay.firstChild);
  47042. }
  47043. var paddedOverlay = window2.document.createElement("div");
  47044. paddedOverlay.style.position = "absolute";
  47045. paddedOverlay.style.left = "0";
  47046. paddedOverlay.style.right = "0";
  47047. paddedOverlay.style.top = "0";
  47048. paddedOverlay.style.bottom = "0";
  47049. paddedOverlay.style.margin = CUE_BACKGROUND_PADDING;
  47050. overlay.appendChild(paddedOverlay);
  47051. function shouldCompute(cues2) {
  47052. for (var i3 = 0; i3 < cues2.length; i3++) {
  47053. if (cues2[i3].hasBeenReset || !cues2[i3].displayState) {
  47054. return true;
  47055. }
  47056. }
  47057. return false;
  47058. }
  47059. if (!shouldCompute(cues)) {
  47060. for (var i2 = 0; i2 < cues.length; i2++) {
  47061. paddedOverlay.appendChild(cues[i2].displayState);
  47062. }
  47063. return;
  47064. }
  47065. var boxPositions = [], containerBox = BoxPosition.getSimpleBoxPosition(paddedOverlay), fontSize = Math.round(containerBox.height * FONT_SIZE_PERCENT * 100) / 100;
  47066. var styleOptions = {
  47067. font: fontSize + "px " + FONT_STYLE
  47068. };
  47069. (function() {
  47070. var styleBox, cue;
  47071. for (var i3 = 0; i3 < cues.length; i3++) {
  47072. cue = cues[i3];
  47073. styleBox = new CueStyleBox(window2, cue, styleOptions);
  47074. paddedOverlay.appendChild(styleBox.div);
  47075. moveBoxToLinePosition(window2, styleBox, containerBox, boxPositions);
  47076. cue.displayState = styleBox.div;
  47077. boxPositions.push(BoxPosition.getSimpleBoxPosition(styleBox));
  47078. }
  47079. })();
  47080. };
  47081. WebVTT$1.Parser = function(window2, vttjs2, decoder) {
  47082. if (!decoder) {
  47083. decoder = vttjs2;
  47084. vttjs2 = {};
  47085. }
  47086. if (!vttjs2) {
  47087. vttjs2 = {};
  47088. }
  47089. this.window = window2;
  47090. this.vttjs = vttjs2;
  47091. this.state = "INITIAL";
  47092. this.buffer = "";
  47093. this.decoder = decoder || new TextDecoder("utf8");
  47094. this.regionList = [];
  47095. };
  47096. WebVTT$1.Parser.prototype = {
  47097. reportOrThrowError: function(e) {
  47098. if (e instanceof ParsingError) {
  47099. this.onparsingerror && this.onparsingerror(e);
  47100. } else {
  47101. throw e;
  47102. }
  47103. },
  47104. parse: function(data) {
  47105. var self2 = this;
  47106. if (data) {
  47107. self2.buffer += self2.decoder.decode(data, { stream: true });
  47108. }
  47109. function collectNextLine() {
  47110. var buffer = self2.buffer;
  47111. var pos = 0;
  47112. while (pos < buffer.length && buffer[pos] !== "\r" && buffer[pos] !== "\n") {
  47113. ++pos;
  47114. }
  47115. var line2 = buffer.substr(0, pos);
  47116. if (buffer[pos] === "\r") {
  47117. ++pos;
  47118. }
  47119. if (buffer[pos] === "\n") {
  47120. ++pos;
  47121. }
  47122. self2.buffer = buffer.substr(pos);
  47123. return line2;
  47124. }
  47125. function parseRegion(input) {
  47126. var settings = new Settings();
  47127. parseOptions(input, function(k, v) {
  47128. switch (k) {
  47129. case "id":
  47130. settings.set(k, v);
  47131. break;
  47132. case "width":
  47133. settings.percent(k, v);
  47134. break;
  47135. case "lines":
  47136. settings.integer(k, v);
  47137. break;
  47138. case "regionanchor":
  47139. case "viewportanchor":
  47140. var xy = v.split(",");
  47141. if (xy.length !== 2) {
  47142. break;
  47143. }
  47144. var anchor = new Settings();
  47145. anchor.percent("x", xy[0]);
  47146. anchor.percent("y", xy[1]);
  47147. if (!anchor.has("x") || !anchor.has("y")) {
  47148. break;
  47149. }
  47150. settings.set(k + "X", anchor.get("x"));
  47151. settings.set(k + "Y", anchor.get("y"));
  47152. break;
  47153. case "scroll":
  47154. settings.alt(k, v, ["up"]);
  47155. break;
  47156. }
  47157. }, /=/, /\s/);
  47158. if (settings.has("id")) {
  47159. var region = new (self2.vttjs.VTTRegion || self2.window.VTTRegion)();
  47160. region.width = settings.get("width", 100);
  47161. region.lines = settings.get("lines", 3);
  47162. region.regionAnchorX = settings.get("regionanchorX", 0);
  47163. region.regionAnchorY = settings.get("regionanchorY", 100);
  47164. region.viewportAnchorX = settings.get("viewportanchorX", 0);
  47165. region.viewportAnchorY = settings.get("viewportanchorY", 100);
  47166. region.scroll = settings.get("scroll", "");
  47167. self2.onregion && self2.onregion(region);
  47168. self2.regionList.push({
  47169. id: settings.get("id"),
  47170. region
  47171. });
  47172. }
  47173. }
  47174. function parseTimestampMap(input) {
  47175. var settings = new Settings();
  47176. parseOptions(input, function(k, v) {
  47177. switch (k) {
  47178. case "MPEGT":
  47179. settings.integer(k + "S", v);
  47180. break;
  47181. case "LOCA":
  47182. settings.set(k + "L", parseTimeStamp(v));
  47183. break;
  47184. }
  47185. }, /[^\d]:/, /,/);
  47186. self2.ontimestampmap && self2.ontimestampmap({
  47187. "MPEGTS": settings.get("MPEGTS"),
  47188. "LOCAL": settings.get("LOCAL")
  47189. });
  47190. }
  47191. function parseHeader(input) {
  47192. if (input.match(/X-TIMESTAMP-MAP/)) {
  47193. parseOptions(input, function(k, v) {
  47194. switch (k) {
  47195. case "X-TIMESTAMP-MAP":
  47196. parseTimestampMap(v);
  47197. break;
  47198. }
  47199. }, /=/);
  47200. } else {
  47201. parseOptions(input, function(k, v) {
  47202. switch (k) {
  47203. case "Region":
  47204. parseRegion(v);
  47205. break;
  47206. }
  47207. }, /:/);
  47208. }
  47209. }
  47210. try {
  47211. var line;
  47212. if (self2.state === "INITIAL") {
  47213. if (!/\r\n|\n/.test(self2.buffer)) {
  47214. return this;
  47215. }
  47216. line = collectNextLine();
  47217. var m = line.match(/^WEBVTT([ \t].*)?$/);
  47218. if (!m || !m[0]) {
  47219. throw new ParsingError(ParsingError.Errors.BadSignature);
  47220. }
  47221. self2.state = "HEADER";
  47222. }
  47223. var alreadyCollectedLine = false;
  47224. while (self2.buffer) {
  47225. if (!/\r\n|\n/.test(self2.buffer)) {
  47226. return this;
  47227. }
  47228. if (!alreadyCollectedLine) {
  47229. line = collectNextLine();
  47230. } else {
  47231. alreadyCollectedLine = false;
  47232. }
  47233. switch (self2.state) {
  47234. case "HEADER":
  47235. if (/:/.test(line)) {
  47236. parseHeader(line);
  47237. } else if (!line) {
  47238. self2.state = "ID";
  47239. }
  47240. continue;
  47241. case "NOTE":
  47242. if (!line) {
  47243. self2.state = "ID";
  47244. }
  47245. continue;
  47246. case "ID":
  47247. if (/^NOTE($|[ \t])/.test(line)) {
  47248. self2.state = "NOTE";
  47249. break;
  47250. }
  47251. if (!line) {
  47252. continue;
  47253. }
  47254. self2.cue = new (self2.vttjs.VTTCue || self2.window.VTTCue)(0, 0, "");
  47255. try {
  47256. self2.cue.align = "center";
  47257. } catch (e) {
  47258. self2.cue.align = "middle";
  47259. }
  47260. self2.state = "CUE";
  47261. if (line.indexOf("-->") === -1) {
  47262. self2.cue.id = line;
  47263. continue;
  47264. }
  47265. case "CUE":
  47266. try {
  47267. parseCue(line, self2.cue, self2.regionList);
  47268. } catch (e) {
  47269. self2.reportOrThrowError(e);
  47270. self2.cue = null;
  47271. self2.state = "BADCUE";
  47272. continue;
  47273. }
  47274. self2.state = "CUETEXT";
  47275. continue;
  47276. case "CUETEXT":
  47277. var hasSubstring = line.indexOf("-->") !== -1;
  47278. if (!line || hasSubstring && (alreadyCollectedLine = true)) {
  47279. self2.oncue && self2.oncue(self2.cue);
  47280. self2.cue = null;
  47281. self2.state = "ID";
  47282. continue;
  47283. }
  47284. if (self2.cue.text) {
  47285. self2.cue.text += "\n";
  47286. }
  47287. self2.cue.text += line.replace(/\u2028/g, "\n").replace(/u2029/g, "\n");
  47288. continue;
  47289. case "BADCUE":
  47290. if (!line) {
  47291. self2.state = "ID";
  47292. }
  47293. continue;
  47294. }
  47295. }
  47296. } catch (e) {
  47297. self2.reportOrThrowError(e);
  47298. if (self2.state === "CUETEXT" && self2.cue && self2.oncue) {
  47299. self2.oncue(self2.cue);
  47300. }
  47301. self2.cue = null;
  47302. self2.state = self2.state === "INITIAL" ? "BADWEBVTT" : "BADCUE";
  47303. }
  47304. return this;
  47305. },
  47306. flush: function() {
  47307. var self2 = this;
  47308. try {
  47309. self2.buffer += self2.decoder.decode();
  47310. if (self2.cue || self2.state === "HEADER") {
  47311. self2.buffer += "\n\n";
  47312. self2.parse();
  47313. }
  47314. if (self2.state === "INITIAL") {
  47315. throw new ParsingError(ParsingError.Errors.BadSignature);
  47316. }
  47317. } catch (e) {
  47318. self2.reportOrThrowError(e);
  47319. }
  47320. self2.onflush && self2.onflush();
  47321. return this;
  47322. }
  47323. };
  47324. var vtt$1 = WebVTT$1;
  47325. var autoKeyword = "auto";
  47326. var directionSetting = {
  47327. "": 1,
  47328. "lr": 1,
  47329. "rl": 1
  47330. };
  47331. var alignSetting = {
  47332. "start": 1,
  47333. "center": 1,
  47334. "end": 1,
  47335. "left": 1,
  47336. "right": 1,
  47337. "auto": 1,
  47338. "line-left": 1,
  47339. "line-right": 1
  47340. };
  47341. function findDirectionSetting(value) {
  47342. if (typeof value !== "string") {
  47343. return false;
  47344. }
  47345. var dir = directionSetting[value.toLowerCase()];
  47346. return dir ? value.toLowerCase() : false;
  47347. }
  47348. function findAlignSetting(value) {
  47349. if (typeof value !== "string") {
  47350. return false;
  47351. }
  47352. var align = alignSetting[value.toLowerCase()];
  47353. return align ? value.toLowerCase() : false;
  47354. }
  47355. function VTTCue(startTime, endTime, text) {
  47356. this.hasBeenReset = false;
  47357. var _id = "";
  47358. var _pauseOnExit = false;
  47359. var _startTime = startTime;
  47360. var _endTime = endTime;
  47361. var _text = text;
  47362. var _region = null;
  47363. var _vertical = "";
  47364. var _snapToLines = true;
  47365. var _line = "auto";
  47366. var _lineAlign = "start";
  47367. var _position = "auto";
  47368. var _positionAlign = "auto";
  47369. var _size = 100;
  47370. var _align = "center";
  47371. Object.defineProperties(this, {
  47372. "id": {
  47373. enumerable: true,
  47374. get: function() {
  47375. return _id;
  47376. },
  47377. set: function(value) {
  47378. _id = "" + value;
  47379. }
  47380. },
  47381. "pauseOnExit": {
  47382. enumerable: true,
  47383. get: function() {
  47384. return _pauseOnExit;
  47385. },
  47386. set: function(value) {
  47387. _pauseOnExit = !!value;
  47388. }
  47389. },
  47390. "startTime": {
  47391. enumerable: true,
  47392. get: function() {
  47393. return _startTime;
  47394. },
  47395. set: function(value) {
  47396. if (typeof value !== "number") {
  47397. throw new TypeError("Start time must be set to a number.");
  47398. }
  47399. _startTime = value;
  47400. this.hasBeenReset = true;
  47401. }
  47402. },
  47403. "endTime": {
  47404. enumerable: true,
  47405. get: function() {
  47406. return _endTime;
  47407. },
  47408. set: function(value) {
  47409. if (typeof value !== "number") {
  47410. throw new TypeError("End time must be set to a number.");
  47411. }
  47412. _endTime = value;
  47413. this.hasBeenReset = true;
  47414. }
  47415. },
  47416. "text": {
  47417. enumerable: true,
  47418. get: function() {
  47419. return _text;
  47420. },
  47421. set: function(value) {
  47422. _text = "" + value;
  47423. this.hasBeenReset = true;
  47424. }
  47425. },
  47426. "region": {
  47427. enumerable: true,
  47428. get: function() {
  47429. return _region;
  47430. },
  47431. set: function(value) {
  47432. _region = value;
  47433. this.hasBeenReset = true;
  47434. }
  47435. },
  47436. "vertical": {
  47437. enumerable: true,
  47438. get: function() {
  47439. return _vertical;
  47440. },
  47441. set: function(value) {
  47442. var setting = findDirectionSetting(value);
  47443. if (setting === false) {
  47444. throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");
  47445. }
  47446. _vertical = setting;
  47447. this.hasBeenReset = true;
  47448. }
  47449. },
  47450. "snapToLines": {
  47451. enumerable: true,
  47452. get: function() {
  47453. return _snapToLines;
  47454. },
  47455. set: function(value) {
  47456. _snapToLines = !!value;
  47457. this.hasBeenReset = true;
  47458. }
  47459. },
  47460. "line": {
  47461. enumerable: true,
  47462. get: function() {
  47463. return _line;
  47464. },
  47465. set: function(value) {
  47466. if (typeof value !== "number" && value !== autoKeyword) {
  47467. throw new SyntaxError("Line: an invalid number or illegal string was specified.");
  47468. }
  47469. _line = value;
  47470. this.hasBeenReset = true;
  47471. }
  47472. },
  47473. "lineAlign": {
  47474. enumerable: true,
  47475. get: function() {
  47476. return _lineAlign;
  47477. },
  47478. set: function(value) {
  47479. var setting = findAlignSetting(value);
  47480. if (!setting) {
  47481. console.warn("lineAlign: an invalid or illegal string was specified.");
  47482. } else {
  47483. _lineAlign = setting;
  47484. this.hasBeenReset = true;
  47485. }
  47486. }
  47487. },
  47488. "position": {
  47489. enumerable: true,
  47490. get: function() {
  47491. return _position;
  47492. },
  47493. set: function(value) {
  47494. if (value < 0 || value > 100) {
  47495. throw new Error("Position must be between 0 and 100.");
  47496. }
  47497. _position = value;
  47498. this.hasBeenReset = true;
  47499. }
  47500. },
  47501. "positionAlign": {
  47502. enumerable: true,
  47503. get: function() {
  47504. return _positionAlign;
  47505. },
  47506. set: function(value) {
  47507. var setting = findAlignSetting(value);
  47508. if (!setting) {
  47509. console.warn("positionAlign: an invalid or illegal string was specified.");
  47510. } else {
  47511. _positionAlign = setting;
  47512. this.hasBeenReset = true;
  47513. }
  47514. }
  47515. },
  47516. "size": {
  47517. enumerable: true,
  47518. get: function() {
  47519. return _size;
  47520. },
  47521. set: function(value) {
  47522. if (value < 0 || value > 100) {
  47523. throw new Error("Size must be between 0 and 100.");
  47524. }
  47525. _size = value;
  47526. this.hasBeenReset = true;
  47527. }
  47528. },
  47529. "align": {
  47530. enumerable: true,
  47531. get: function() {
  47532. return _align;
  47533. },
  47534. set: function(value) {
  47535. var setting = findAlignSetting(value);
  47536. if (!setting) {
  47537. throw new SyntaxError("align: an invalid or illegal alignment string was specified.");
  47538. }
  47539. _align = setting;
  47540. this.hasBeenReset = true;
  47541. }
  47542. }
  47543. });
  47544. this.displayState = void 0;
  47545. }
  47546. VTTCue.prototype.getCueAsHTML = function() {
  47547. return WebVTT.convertCueToDOMTree(window, this.text);
  47548. };
  47549. var vttcue = VTTCue;
  47550. var scrollSetting = {
  47551. "": true,
  47552. "up": true
  47553. };
  47554. function findScrollSetting(value) {
  47555. if (typeof value !== "string") {
  47556. return false;
  47557. }
  47558. var scroll = scrollSetting[value.toLowerCase()];
  47559. return scroll ? value.toLowerCase() : false;
  47560. }
  47561. function isValidPercentValue(value) {
  47562. return typeof value === "number" && (value >= 0 && value <= 100);
  47563. }
  47564. function VTTRegion() {
  47565. var _width = 100;
  47566. var _lines = 3;
  47567. var _regionAnchorX = 0;
  47568. var _regionAnchorY = 100;
  47569. var _viewportAnchorX = 0;
  47570. var _viewportAnchorY = 100;
  47571. var _scroll = "";
  47572. Object.defineProperties(this, {
  47573. "width": {
  47574. enumerable: true,
  47575. get: function() {
  47576. return _width;
  47577. },
  47578. set: function(value) {
  47579. if (!isValidPercentValue(value)) {
  47580. throw new Error("Width must be between 0 and 100.");
  47581. }
  47582. _width = value;
  47583. }
  47584. },
  47585. "lines": {
  47586. enumerable: true,
  47587. get: function() {
  47588. return _lines;
  47589. },
  47590. set: function(value) {
  47591. if (typeof value !== "number") {
  47592. throw new TypeError("Lines must be set to a number.");
  47593. }
  47594. _lines = value;
  47595. }
  47596. },
  47597. "regionAnchorY": {
  47598. enumerable: true,
  47599. get: function() {
  47600. return _regionAnchorY;
  47601. },
  47602. set: function(value) {
  47603. if (!isValidPercentValue(value)) {
  47604. throw new Error("RegionAnchorX must be between 0 and 100.");
  47605. }
  47606. _regionAnchorY = value;
  47607. }
  47608. },
  47609. "regionAnchorX": {
  47610. enumerable: true,
  47611. get: function() {
  47612. return _regionAnchorX;
  47613. },
  47614. set: function(value) {
  47615. if (!isValidPercentValue(value)) {
  47616. throw new Error("RegionAnchorY must be between 0 and 100.");
  47617. }
  47618. _regionAnchorX = value;
  47619. }
  47620. },
  47621. "viewportAnchorY": {
  47622. enumerable: true,
  47623. get: function() {
  47624. return _viewportAnchorY;
  47625. },
  47626. set: function(value) {
  47627. if (!isValidPercentValue(value)) {
  47628. throw new Error("ViewportAnchorY must be between 0 and 100.");
  47629. }
  47630. _viewportAnchorY = value;
  47631. }
  47632. },
  47633. "viewportAnchorX": {
  47634. enumerable: true,
  47635. get: function() {
  47636. return _viewportAnchorX;
  47637. },
  47638. set: function(value) {
  47639. if (!isValidPercentValue(value)) {
  47640. throw new Error("ViewportAnchorX must be between 0 and 100.");
  47641. }
  47642. _viewportAnchorX = value;
  47643. }
  47644. },
  47645. "scroll": {
  47646. enumerable: true,
  47647. get: function() {
  47648. return _scroll;
  47649. },
  47650. set: function(value) {
  47651. var setting = findScrollSetting(value);
  47652. if (setting === false) {
  47653. console.warn("Scroll: an invalid or illegal string was specified.");
  47654. } else {
  47655. _scroll = setting;
  47656. }
  47657. }
  47658. }
  47659. });
  47660. }
  47661. var vttregion = VTTRegion;
  47662. var window$1 = window_1;
  47663. var vttjs = browserIndex.exports = {
  47664. WebVTT: vtt$1,
  47665. VTTCue: vttcue,
  47666. VTTRegion: vttregion
  47667. };
  47668. window$1.vttjs = vttjs;
  47669. window$1.WebVTT = vttjs.WebVTT;
  47670. var cueShim = vttjs.VTTCue;
  47671. var regionShim = vttjs.VTTRegion;
  47672. var nativeVTTCue = window$1.VTTCue;
  47673. var nativeVTTRegion = window$1.VTTRegion;
  47674. vttjs.shim = function() {
  47675. window$1.VTTCue = cueShim;
  47676. window$1.VTTRegion = regionShim;
  47677. };
  47678. vttjs.restore = function() {
  47679. window$1.VTTCue = nativeVTTCue;
  47680. window$1.VTTRegion = nativeVTTRegion;
  47681. };
  47682. if (!window$1.VTTCue) {
  47683. vttjs.shim();
  47684. }
  47685. var vtt = browserIndex.exports;
  47686. var urlToolkit = { exports: {} };
  47687. (function(module2, exports2) {
  47688. (function(root2) {
  47689. var URL_REGEX = /^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/;
  47690. var FIRST_SEGMENT_REGEX = /^(?=([^\/?#]*))\1([^]*)$/;
  47691. var SLASH_DOT_REGEX = /(?:\/|^)\.(?=\/)/g;
  47692. var SLASH_DOT_DOT_REGEX = /(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g;
  47693. var URLToolkit2 = {
  47694. buildAbsoluteURL: function(baseURL, relativeURL, opts) {
  47695. opts = opts || {};
  47696. baseURL = baseURL.trim();
  47697. relativeURL = relativeURL.trim();
  47698. if (!relativeURL) {
  47699. if (!opts.alwaysNormalize) {
  47700. return baseURL;
  47701. }
  47702. var basePartsForNormalise = URLToolkit2.parseURL(baseURL);
  47703. if (!basePartsForNormalise) {
  47704. throw new Error("Error trying to parse base URL.");
  47705. }
  47706. basePartsForNormalise.path = URLToolkit2.normalizePath(
  47707. basePartsForNormalise.path
  47708. );
  47709. return URLToolkit2.buildURLFromParts(basePartsForNormalise);
  47710. }
  47711. var relativeParts = URLToolkit2.parseURL(relativeURL);
  47712. if (!relativeParts) {
  47713. throw new Error("Error trying to parse relative URL.");
  47714. }
  47715. if (relativeParts.scheme) {
  47716. if (!opts.alwaysNormalize) {
  47717. return relativeURL;
  47718. }
  47719. relativeParts.path = URLToolkit2.normalizePath(relativeParts.path);
  47720. return URLToolkit2.buildURLFromParts(relativeParts);
  47721. }
  47722. var baseParts = URLToolkit2.parseURL(baseURL);
  47723. if (!baseParts) {
  47724. throw new Error("Error trying to parse base URL.");
  47725. }
  47726. if (!baseParts.netLoc && baseParts.path && baseParts.path[0] !== "/") {
  47727. var pathParts = FIRST_SEGMENT_REGEX.exec(baseParts.path);
  47728. baseParts.netLoc = pathParts[1];
  47729. baseParts.path = pathParts[2];
  47730. }
  47731. if (baseParts.netLoc && !baseParts.path) {
  47732. baseParts.path = "/";
  47733. }
  47734. var builtParts = {
  47735. scheme: baseParts.scheme,
  47736. netLoc: relativeParts.netLoc,
  47737. path: null,
  47738. params: relativeParts.params,
  47739. query: relativeParts.query,
  47740. fragment: relativeParts.fragment
  47741. };
  47742. if (!relativeParts.netLoc) {
  47743. builtParts.netLoc = baseParts.netLoc;
  47744. if (relativeParts.path[0] !== "/") {
  47745. if (!relativeParts.path) {
  47746. builtParts.path = baseParts.path;
  47747. if (!relativeParts.params) {
  47748. builtParts.params = baseParts.params;
  47749. if (!relativeParts.query) {
  47750. builtParts.query = baseParts.query;
  47751. }
  47752. }
  47753. } else {
  47754. var baseURLPath = baseParts.path;
  47755. var newPath = baseURLPath.substring(0, baseURLPath.lastIndexOf("/") + 1) + relativeParts.path;
  47756. builtParts.path = URLToolkit2.normalizePath(newPath);
  47757. }
  47758. }
  47759. }
  47760. if (builtParts.path === null) {
  47761. builtParts.path = opts.alwaysNormalize ? URLToolkit2.normalizePath(relativeParts.path) : relativeParts.path;
  47762. }
  47763. return URLToolkit2.buildURLFromParts(builtParts);
  47764. },
  47765. parseURL: function(url) {
  47766. var parts = URL_REGEX.exec(url);
  47767. if (!parts) {
  47768. return null;
  47769. }
  47770. return {
  47771. scheme: parts[1] || "",
  47772. netLoc: parts[2] || "",
  47773. path: parts[3] || "",
  47774. params: parts[4] || "",
  47775. query: parts[5] || "",
  47776. fragment: parts[6] || ""
  47777. };
  47778. },
  47779. normalizePath: function(path) {
  47780. path = path.split("").reverse().join("").replace(SLASH_DOT_REGEX, "");
  47781. while (path.length !== (path = path.replace(SLASH_DOT_DOT_REGEX, "")).length) {
  47782. }
  47783. return path.split("").reverse().join("");
  47784. },
  47785. buildURLFromParts: function(parts) {
  47786. return parts.scheme + parts.netLoc + parts.path + parts.params + parts.query + parts.fragment;
  47787. }
  47788. };
  47789. module2.exports = URLToolkit2;
  47790. })();
  47791. })(urlToolkit);
  47792. var URLToolkit = urlToolkit.exports;
  47793. var DEFAULT_LOCATION$2 = "http://example.com";
  47794. var resolveUrl$4 = function resolveUrl(baseUrl, relativeUrl) {
  47795. if (/^[a-z]+:/i.test(relativeUrl)) {
  47796. return relativeUrl;
  47797. }
  47798. if (/^data:/.test(baseUrl)) {
  47799. baseUrl = window_1.location && window_1.location.href || "";
  47800. }
  47801. var nativeURL = typeof window_1.URL === "function";
  47802. var protocolLess = /^\/\//.test(baseUrl);
  47803. var removeLocation = !window_1.location && !/\/\//i.test(baseUrl);
  47804. if (nativeURL) {
  47805. baseUrl = new window_1.URL(baseUrl, window_1.location || DEFAULT_LOCATION$2);
  47806. } else if (!/\/\//i.test(baseUrl)) {
  47807. baseUrl = URLToolkit.buildAbsoluteURL(window_1.location && window_1.location.href || "", baseUrl);
  47808. }
  47809. if (nativeURL) {
  47810. var newUrl = new URL(relativeUrl, baseUrl);
  47811. if (removeLocation) {
  47812. return newUrl.href.slice(DEFAULT_LOCATION$2.length);
  47813. } else if (protocolLess) {
  47814. return newUrl.href.slice(newUrl.protocol.length);
  47815. }
  47816. return newUrl.href;
  47817. }
  47818. return URLToolkit.buildAbsoluteURL(baseUrl, relativeUrl);
  47819. };
  47820. var Stream$1 = /* @__PURE__ */ function() {
  47821. function Stream2() {
  47822. this.listeners = {};
  47823. }
  47824. var _proto = Stream2.prototype;
  47825. _proto.on = function on3(type2, listener) {
  47826. if (!this.listeners[type2]) {
  47827. this.listeners[type2] = [];
  47828. }
  47829. this.listeners[type2].push(listener);
  47830. };
  47831. _proto.off = function off2(type2, listener) {
  47832. if (!this.listeners[type2]) {
  47833. return false;
  47834. }
  47835. var index2 = this.listeners[type2].indexOf(listener);
  47836. this.listeners[type2] = this.listeners[type2].slice(0);
  47837. this.listeners[type2].splice(index2, 1);
  47838. return index2 > -1;
  47839. };
  47840. _proto.trigger = function trigger2(type2) {
  47841. var callbacks = this.listeners[type2];
  47842. if (!callbacks) {
  47843. return;
  47844. }
  47845. if (arguments.length === 2) {
  47846. var length = callbacks.length;
  47847. for (var i2 = 0; i2 < length; ++i2) {
  47848. callbacks[i2].call(this, arguments[1]);
  47849. }
  47850. } else {
  47851. var args = Array.prototype.slice.call(arguments, 1);
  47852. var _length = callbacks.length;
  47853. for (var _i = 0; _i < _length; ++_i) {
  47854. callbacks[_i].apply(this, args);
  47855. }
  47856. }
  47857. };
  47858. _proto.dispose = function dispose() {
  47859. this.listeners = {};
  47860. };
  47861. _proto.pipe = function pipe(destination2) {
  47862. this.on("data", function(data) {
  47863. destination2.push(data);
  47864. });
  47865. };
  47866. return Stream2;
  47867. }();
  47868. var atob$2 = function atob(s) {
  47869. return window_1.atob ? window_1.atob(s) : Buffer.from(s, "base64").toString("binary");
  47870. };
  47871. function decodeB64ToUint8Array$2(b64Text) {
  47872. var decodedString = atob$2(b64Text);
  47873. var array = new Uint8Array(decodedString.length);
  47874. for (var i2 = 0; i2 < decodedString.length; i2++) {
  47875. array[i2] = decodedString.charCodeAt(i2);
  47876. }
  47877. return array;
  47878. }
  47879. /*! @name m3u8-parser @version 6.1.0 @license Apache-2.0 */
  47880. class LineStream$1 extends Stream$1 {
  47881. constructor() {
  47882. super();
  47883. this.buffer = "";
  47884. }
  47885. push(data) {
  47886. let nextNewline;
  47887. this.buffer += data;
  47888. nextNewline = this.buffer.indexOf("\n");
  47889. for (; nextNewline > -1; nextNewline = this.buffer.indexOf("\n")) {
  47890. this.trigger("data", this.buffer.substring(0, nextNewline));
  47891. this.buffer = this.buffer.substring(nextNewline + 1);
  47892. }
  47893. }
  47894. }
  47895. const TAB$1 = String.fromCharCode(9);
  47896. const parseByterange$1 = function(byterangeString) {
  47897. const match = /([0-9.]*)?@?([0-9.]*)?/.exec(byterangeString || "");
  47898. const result = {};
  47899. if (match[1]) {
  47900. result.length = parseInt(match[1], 10);
  47901. }
  47902. if (match[2]) {
  47903. result.offset = parseInt(match[2], 10);
  47904. }
  47905. return result;
  47906. };
  47907. const attributeSeparator$1 = function() {
  47908. const key = "[^=]*";
  47909. const value = '"[^"]*"|[^,]*';
  47910. const keyvalue = "(?:" + key + ")=(?:" + value + ")";
  47911. return new RegExp("(?:^|,)(" + keyvalue + ")");
  47912. };
  47913. const parseAttributes$3 = function(attributes) {
  47914. const result = {};
  47915. if (!attributes) {
  47916. return result;
  47917. }
  47918. const attrs = attributes.split(attributeSeparator$1());
  47919. let i2 = attrs.length;
  47920. let attr;
  47921. while (i2--) {
  47922. if (attrs[i2] === "") {
  47923. continue;
  47924. }
  47925. attr = /([^=]*)=(.*)/.exec(attrs[i2]).slice(1);
  47926. attr[0] = attr[0].replace(/^\s+|\s+$/g, "");
  47927. attr[1] = attr[1].replace(/^\s+|\s+$/g, "");
  47928. attr[1] = attr[1].replace(/^['"](.*)['"]$/g, "$1");
  47929. result[attr[0]] = attr[1];
  47930. }
  47931. return result;
  47932. };
  47933. class ParseStream$1 extends Stream$1 {
  47934. constructor() {
  47935. super();
  47936. this.customParsers = [];
  47937. this.tagMappers = [];
  47938. }
  47939. push(line) {
  47940. let match;
  47941. let event2;
  47942. line = line.trim();
  47943. if (line.length === 0) {
  47944. return;
  47945. }
  47946. if (line[0] !== "#") {
  47947. this.trigger("data", {
  47948. type: "uri",
  47949. uri: line
  47950. });
  47951. return;
  47952. }
  47953. const newLines = this.tagMappers.reduce((acc, mapper) => {
  47954. const mappedLine = mapper(line);
  47955. if (mappedLine === line) {
  47956. return acc;
  47957. }
  47958. return acc.concat([mappedLine]);
  47959. }, [line]);
  47960. newLines.forEach((newLine) => {
  47961. for (let i2 = 0; i2 < this.customParsers.length; i2++) {
  47962. if (this.customParsers[i2].call(this, newLine)) {
  47963. return;
  47964. }
  47965. }
  47966. if (newLine.indexOf("#EXT") !== 0) {
  47967. this.trigger("data", {
  47968. type: "comment",
  47969. text: newLine.slice(1)
  47970. });
  47971. return;
  47972. }
  47973. newLine = newLine.replace("\r", "");
  47974. match = /^#EXTM3U/.exec(newLine);
  47975. if (match) {
  47976. this.trigger("data", {
  47977. type: "tag",
  47978. tagType: "m3u"
  47979. });
  47980. return;
  47981. }
  47982. match = /^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(newLine);
  47983. if (match) {
  47984. event2 = {
  47985. type: "tag",
  47986. tagType: "inf"
  47987. };
  47988. if (match[1]) {
  47989. event2.duration = parseFloat(match[1]);
  47990. }
  47991. if (match[2]) {
  47992. event2.title = match[2];
  47993. }
  47994. this.trigger("data", event2);
  47995. return;
  47996. }
  47997. match = /^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(newLine);
  47998. if (match) {
  47999. event2 = {
  48000. type: "tag",
  48001. tagType: "targetduration"
  48002. };
  48003. if (match[1]) {
  48004. event2.duration = parseInt(match[1], 10);
  48005. }
  48006. this.trigger("data", event2);
  48007. return;
  48008. }
  48009. match = /^#EXT-X-VERSION:([0-9.]*)?/.exec(newLine);
  48010. if (match) {
  48011. event2 = {
  48012. type: "tag",
  48013. tagType: "version"
  48014. };
  48015. if (match[1]) {
  48016. event2.version = parseInt(match[1], 10);
  48017. }
  48018. this.trigger("data", event2);
  48019. return;
  48020. }
  48021. match = /^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(newLine);
  48022. if (match) {
  48023. event2 = {
  48024. type: "tag",
  48025. tagType: "media-sequence"
  48026. };
  48027. if (match[1]) {
  48028. event2.number = parseInt(match[1], 10);
  48029. }
  48030. this.trigger("data", event2);
  48031. return;
  48032. }
  48033. match = /^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(newLine);
  48034. if (match) {
  48035. event2 = {
  48036. type: "tag",
  48037. tagType: "discontinuity-sequence"
  48038. };
  48039. if (match[1]) {
  48040. event2.number = parseInt(match[1], 10);
  48041. }
  48042. this.trigger("data", event2);
  48043. return;
  48044. }
  48045. match = /^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(newLine);
  48046. if (match) {
  48047. event2 = {
  48048. type: "tag",
  48049. tagType: "playlist-type"
  48050. };
  48051. if (match[1]) {
  48052. event2.playlistType = match[1];
  48053. }
  48054. this.trigger("data", event2);
  48055. return;
  48056. }
  48057. match = /^#EXT-X-BYTERANGE:(.*)?$/.exec(newLine);
  48058. if (match) {
  48059. event2 = _extends$2(parseByterange$1(match[1]), {
  48060. type: "tag",
  48061. tagType: "byterange"
  48062. });
  48063. this.trigger("data", event2);
  48064. return;
  48065. }
  48066. match = /^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(newLine);
  48067. if (match) {
  48068. event2 = {
  48069. type: "tag",
  48070. tagType: "allow-cache"
  48071. };
  48072. if (match[1]) {
  48073. event2.allowed = !/NO/.test(match[1]);
  48074. }
  48075. this.trigger("data", event2);
  48076. return;
  48077. }
  48078. match = /^#EXT-X-MAP:(.*)$/.exec(newLine);
  48079. if (match) {
  48080. event2 = {
  48081. type: "tag",
  48082. tagType: "map"
  48083. };
  48084. if (match[1]) {
  48085. const attributes = parseAttributes$3(match[1]);
  48086. if (attributes.URI) {
  48087. event2.uri = attributes.URI;
  48088. }
  48089. if (attributes.BYTERANGE) {
  48090. event2.byterange = parseByterange$1(attributes.BYTERANGE);
  48091. }
  48092. }
  48093. this.trigger("data", event2);
  48094. return;
  48095. }
  48096. match = /^#EXT-X-STREAM-INF:(.*)$/.exec(newLine);
  48097. if (match) {
  48098. event2 = {
  48099. type: "tag",
  48100. tagType: "stream-inf"
  48101. };
  48102. if (match[1]) {
  48103. event2.attributes = parseAttributes$3(match[1]);
  48104. if (event2.attributes.RESOLUTION) {
  48105. const split2 = event2.attributes.RESOLUTION.split("x");
  48106. const resolution = {};
  48107. if (split2[0]) {
  48108. resolution.width = parseInt(split2[0], 10);
  48109. }
  48110. if (split2[1]) {
  48111. resolution.height = parseInt(split2[1], 10);
  48112. }
  48113. event2.attributes.RESOLUTION = resolution;
  48114. }
  48115. if (event2.attributes.BANDWIDTH) {
  48116. event2.attributes.BANDWIDTH = parseInt(event2.attributes.BANDWIDTH, 10);
  48117. }
  48118. if (event2.attributes["FRAME-RATE"]) {
  48119. event2.attributes["FRAME-RATE"] = parseFloat(event2.attributes["FRAME-RATE"]);
  48120. }
  48121. if (event2.attributes["PROGRAM-ID"]) {
  48122. event2.attributes["PROGRAM-ID"] = parseInt(event2.attributes["PROGRAM-ID"], 10);
  48123. }
  48124. }
  48125. this.trigger("data", event2);
  48126. return;
  48127. }
  48128. match = /^#EXT-X-MEDIA:(.*)$/.exec(newLine);
  48129. if (match) {
  48130. event2 = {
  48131. type: "tag",
  48132. tagType: "media"
  48133. };
  48134. if (match[1]) {
  48135. event2.attributes = parseAttributes$3(match[1]);
  48136. }
  48137. this.trigger("data", event2);
  48138. return;
  48139. }
  48140. match = /^#EXT-X-ENDLIST/.exec(newLine);
  48141. if (match) {
  48142. this.trigger("data", {
  48143. type: "tag",
  48144. tagType: "endlist"
  48145. });
  48146. return;
  48147. }
  48148. match = /^#EXT-X-DISCONTINUITY/.exec(newLine);
  48149. if (match) {
  48150. this.trigger("data", {
  48151. type: "tag",
  48152. tagType: "discontinuity"
  48153. });
  48154. return;
  48155. }
  48156. match = /^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(newLine);
  48157. if (match) {
  48158. event2 = {
  48159. type: "tag",
  48160. tagType: "program-date-time"
  48161. };
  48162. if (match[1]) {
  48163. event2.dateTimeString = match[1];
  48164. event2.dateTimeObject = new Date(match[1]);
  48165. }
  48166. this.trigger("data", event2);
  48167. return;
  48168. }
  48169. match = /^#EXT-X-KEY:(.*)$/.exec(newLine);
  48170. if (match) {
  48171. event2 = {
  48172. type: "tag",
  48173. tagType: "key"
  48174. };
  48175. if (match[1]) {
  48176. event2.attributes = parseAttributes$3(match[1]);
  48177. if (event2.attributes.IV) {
  48178. if (event2.attributes.IV.substring(0, 2).toLowerCase() === "0x") {
  48179. event2.attributes.IV = event2.attributes.IV.substring(2);
  48180. }
  48181. event2.attributes.IV = event2.attributes.IV.match(/.{8}/g);
  48182. event2.attributes.IV[0] = parseInt(event2.attributes.IV[0], 16);
  48183. event2.attributes.IV[1] = parseInt(event2.attributes.IV[1], 16);
  48184. event2.attributes.IV[2] = parseInt(event2.attributes.IV[2], 16);
  48185. event2.attributes.IV[3] = parseInt(event2.attributes.IV[3], 16);
  48186. event2.attributes.IV = new Uint32Array(event2.attributes.IV);
  48187. }
  48188. }
  48189. this.trigger("data", event2);
  48190. return;
  48191. }
  48192. match = /^#EXT-X-START:(.*)$/.exec(newLine);
  48193. if (match) {
  48194. event2 = {
  48195. type: "tag",
  48196. tagType: "start"
  48197. };
  48198. if (match[1]) {
  48199. event2.attributes = parseAttributes$3(match[1]);
  48200. event2.attributes["TIME-OFFSET"] = parseFloat(event2.attributes["TIME-OFFSET"]);
  48201. event2.attributes.PRECISE = /YES/.test(event2.attributes.PRECISE);
  48202. }
  48203. this.trigger("data", event2);
  48204. return;
  48205. }
  48206. match = /^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(newLine);
  48207. if (match) {
  48208. event2 = {
  48209. type: "tag",
  48210. tagType: "cue-out-cont"
  48211. };
  48212. if (match[1]) {
  48213. event2.data = match[1];
  48214. } else {
  48215. event2.data = "";
  48216. }
  48217. this.trigger("data", event2);
  48218. return;
  48219. }
  48220. match = /^#EXT-X-CUE-OUT:(.*)?$/.exec(newLine);
  48221. if (match) {
  48222. event2 = {
  48223. type: "tag",
  48224. tagType: "cue-out"
  48225. };
  48226. if (match[1]) {
  48227. event2.data = match[1];
  48228. } else {
  48229. event2.data = "";
  48230. }
  48231. this.trigger("data", event2);
  48232. return;
  48233. }
  48234. match = /^#EXT-X-CUE-IN:(.*)?$/.exec(newLine);
  48235. if (match) {
  48236. event2 = {
  48237. type: "tag",
  48238. tagType: "cue-in"
  48239. };
  48240. if (match[1]) {
  48241. event2.data = match[1];
  48242. } else {
  48243. event2.data = "";
  48244. }
  48245. this.trigger("data", event2);
  48246. return;
  48247. }
  48248. match = /^#EXT-X-SKIP:(.*)$/.exec(newLine);
  48249. if (match && match[1]) {
  48250. event2 = {
  48251. type: "tag",
  48252. tagType: "skip"
  48253. };
  48254. event2.attributes = parseAttributes$3(match[1]);
  48255. if (event2.attributes.hasOwnProperty("SKIPPED-SEGMENTS")) {
  48256. event2.attributes["SKIPPED-SEGMENTS"] = parseInt(event2.attributes["SKIPPED-SEGMENTS"], 10);
  48257. }
  48258. if (event2.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")) {
  48259. event2.attributes["RECENTLY-REMOVED-DATERANGES"] = event2.attributes["RECENTLY-REMOVED-DATERANGES"].split(TAB$1);
  48260. }
  48261. this.trigger("data", event2);
  48262. return;
  48263. }
  48264. match = /^#EXT-X-PART:(.*)$/.exec(newLine);
  48265. if (match && match[1]) {
  48266. event2 = {
  48267. type: "tag",
  48268. tagType: "part"
  48269. };
  48270. event2.attributes = parseAttributes$3(match[1]);
  48271. ["DURATION"].forEach(function(key) {
  48272. if (event2.attributes.hasOwnProperty(key)) {
  48273. event2.attributes[key] = parseFloat(event2.attributes[key]);
  48274. }
  48275. });
  48276. ["INDEPENDENT", "GAP"].forEach(function(key) {
  48277. if (event2.attributes.hasOwnProperty(key)) {
  48278. event2.attributes[key] = /YES/.test(event2.attributes[key]);
  48279. }
  48280. });
  48281. if (event2.attributes.hasOwnProperty("BYTERANGE")) {
  48282. event2.attributes.byterange = parseByterange$1(event2.attributes.BYTERANGE);
  48283. }
  48284. this.trigger("data", event2);
  48285. return;
  48286. }
  48287. match = /^#EXT-X-SERVER-CONTROL:(.*)$/.exec(newLine);
  48288. if (match && match[1]) {
  48289. event2 = {
  48290. type: "tag",
  48291. tagType: "server-control"
  48292. };
  48293. event2.attributes = parseAttributes$3(match[1]);
  48294. ["CAN-SKIP-UNTIL", "PART-HOLD-BACK", "HOLD-BACK"].forEach(function(key) {
  48295. if (event2.attributes.hasOwnProperty(key)) {
  48296. event2.attributes[key] = parseFloat(event2.attributes[key]);
  48297. }
  48298. });
  48299. ["CAN-SKIP-DATERANGES", "CAN-BLOCK-RELOAD"].forEach(function(key) {
  48300. if (event2.attributes.hasOwnProperty(key)) {
  48301. event2.attributes[key] = /YES/.test(event2.attributes[key]);
  48302. }
  48303. });
  48304. this.trigger("data", event2);
  48305. return;
  48306. }
  48307. match = /^#EXT-X-PART-INF:(.*)$/.exec(newLine);
  48308. if (match && match[1]) {
  48309. event2 = {
  48310. type: "tag",
  48311. tagType: "part-inf"
  48312. };
  48313. event2.attributes = parseAttributes$3(match[1]);
  48314. ["PART-TARGET"].forEach(function(key) {
  48315. if (event2.attributes.hasOwnProperty(key)) {
  48316. event2.attributes[key] = parseFloat(event2.attributes[key]);
  48317. }
  48318. });
  48319. this.trigger("data", event2);
  48320. return;
  48321. }
  48322. match = /^#EXT-X-PRELOAD-HINT:(.*)$/.exec(newLine);
  48323. if (match && match[1]) {
  48324. event2 = {
  48325. type: "tag",
  48326. tagType: "preload-hint"
  48327. };
  48328. event2.attributes = parseAttributes$3(match[1]);
  48329. ["BYTERANGE-START", "BYTERANGE-LENGTH"].forEach(function(key) {
  48330. if (event2.attributes.hasOwnProperty(key)) {
  48331. event2.attributes[key] = parseInt(event2.attributes[key], 10);
  48332. const subkey = key === "BYTERANGE-LENGTH" ? "length" : "offset";
  48333. event2.attributes.byterange = event2.attributes.byterange || {};
  48334. event2.attributes.byterange[subkey] = event2.attributes[key];
  48335. delete event2.attributes[key];
  48336. }
  48337. });
  48338. this.trigger("data", event2);
  48339. return;
  48340. }
  48341. match = /^#EXT-X-RENDITION-REPORT:(.*)$/.exec(newLine);
  48342. if (match && match[1]) {
  48343. event2 = {
  48344. type: "tag",
  48345. tagType: "rendition-report"
  48346. };
  48347. event2.attributes = parseAttributes$3(match[1]);
  48348. ["LAST-MSN", "LAST-PART"].forEach(function(key) {
  48349. if (event2.attributes.hasOwnProperty(key)) {
  48350. event2.attributes[key] = parseInt(event2.attributes[key], 10);
  48351. }
  48352. });
  48353. this.trigger("data", event2);
  48354. return;
  48355. }
  48356. match = /^#EXT-X-DATERANGE:(.*)$/.exec(newLine);
  48357. if (match && match[1]) {
  48358. event2 = {
  48359. type: "tag",
  48360. tagType: "daterange"
  48361. };
  48362. event2.attributes = parseAttributes$3(match[1]);
  48363. ["ID", "CLASS"].forEach(function(key) {
  48364. if (event2.attributes.hasOwnProperty(key)) {
  48365. event2.attributes[key] = String(event2.attributes[key]);
  48366. }
  48367. });
  48368. ["START-DATE", "END-DATE"].forEach(function(key) {
  48369. if (event2.attributes.hasOwnProperty(key)) {
  48370. event2.attributes[key] = new Date(event2.attributes[key]);
  48371. }
  48372. });
  48373. ["DURATION", "PLANNED-DURATION"].forEach(function(key) {
  48374. if (event2.attributes.hasOwnProperty(key)) {
  48375. event2.attributes[key] = parseFloat(event2.attributes[key]);
  48376. }
  48377. });
  48378. ["END-ON-NEXT"].forEach(function(key) {
  48379. if (event2.attributes.hasOwnProperty(key)) {
  48380. event2.attributes[key] = /YES/i.test(event2.attributes[key]);
  48381. }
  48382. });
  48383. ["SCTE35-CMD", " SCTE35-OUT", "SCTE35-IN"].forEach(function(key) {
  48384. if (event2.attributes.hasOwnProperty(key)) {
  48385. event2.attributes[key] = event2.attributes[key].toString(16);
  48386. }
  48387. });
  48388. const clientAttributePattern = /^X-([A-Z]+-)+[A-Z]+$/;
  48389. for (const key in event2.attributes) {
  48390. if (!clientAttributePattern.test(key)) {
  48391. continue;
  48392. }
  48393. const isHexaDecimal = /[0-9A-Fa-f]{6}/g.test(event2.attributes[key]);
  48394. const isDecimalFloating = /^\d+(\.\d+)?$/.test(event2.attributes[key]);
  48395. event2.attributes[key] = isHexaDecimal ? event2.attributes[key].toString(16) : isDecimalFloating ? parseFloat(event2.attributes[key]) : String(event2.attributes[key]);
  48396. }
  48397. this.trigger("data", event2);
  48398. return;
  48399. }
  48400. this.trigger("data", {
  48401. type: "tag",
  48402. data: newLine.slice(4)
  48403. });
  48404. });
  48405. }
  48406. addParser({
  48407. expression,
  48408. customType,
  48409. dataParser,
  48410. segment
  48411. }) {
  48412. if (typeof dataParser !== "function") {
  48413. dataParser = (line) => line;
  48414. }
  48415. this.customParsers.push((line) => {
  48416. const match = expression.exec(line);
  48417. if (match) {
  48418. this.trigger("data", {
  48419. type: "custom",
  48420. data: dataParser(line),
  48421. customType,
  48422. segment
  48423. });
  48424. return true;
  48425. }
  48426. });
  48427. }
  48428. addTagMapper({
  48429. expression,
  48430. map
  48431. }) {
  48432. const mapFn = (line) => {
  48433. if (expression.test(line)) {
  48434. return map(line);
  48435. }
  48436. return line;
  48437. };
  48438. this.tagMappers.push(mapFn);
  48439. }
  48440. }
  48441. const camelCase$1 = (str) => str.toLowerCase().replace(/-(\w)/g, (a) => a[1].toUpperCase());
  48442. const camelCaseKeys$1 = function(attributes) {
  48443. const result = {};
  48444. Object.keys(attributes).forEach(function(key) {
  48445. result[camelCase$1(key)] = attributes[key];
  48446. });
  48447. return result;
  48448. };
  48449. const setHoldBack$1 = function(manifest) {
  48450. const {
  48451. serverControl,
  48452. targetDuration,
  48453. partTargetDuration
  48454. } = manifest;
  48455. if (!serverControl) {
  48456. return;
  48457. }
  48458. const tag = "#EXT-X-SERVER-CONTROL";
  48459. const hb = "holdBack";
  48460. const phb = "partHoldBack";
  48461. const minTargetDuration = targetDuration && targetDuration * 3;
  48462. const minPartDuration = partTargetDuration && partTargetDuration * 2;
  48463. if (targetDuration && !serverControl.hasOwnProperty(hb)) {
  48464. serverControl[hb] = minTargetDuration;
  48465. this.trigger("info", {
  48466. message: `${tag} defaulting HOLD-BACK to targetDuration * 3 (${minTargetDuration}).`
  48467. });
  48468. }
  48469. if (minTargetDuration && serverControl[hb] < minTargetDuration) {
  48470. this.trigger("warn", {
  48471. message: `${tag} clamping HOLD-BACK (${serverControl[hb]}) to targetDuration * 3 (${minTargetDuration})`
  48472. });
  48473. serverControl[hb] = minTargetDuration;
  48474. }
  48475. if (partTargetDuration && !serverControl.hasOwnProperty(phb)) {
  48476. serverControl[phb] = partTargetDuration * 3;
  48477. this.trigger("info", {
  48478. message: `${tag} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${serverControl[phb]}).`
  48479. });
  48480. }
  48481. if (partTargetDuration && serverControl[phb] < minPartDuration) {
  48482. this.trigger("warn", {
  48483. message: `${tag} clamping PART-HOLD-BACK (${serverControl[phb]}) to partTargetDuration * 2 (${minPartDuration}).`
  48484. });
  48485. serverControl[phb] = minPartDuration;
  48486. }
  48487. };
  48488. class Parser$1 extends Stream$1 {
  48489. constructor() {
  48490. super();
  48491. this.lineStream = new LineStream$1();
  48492. this.parseStream = new ParseStream$1();
  48493. this.lineStream.pipe(this.parseStream);
  48494. const self2 = this;
  48495. const uris = [];
  48496. let currentUri = {};
  48497. let currentMap;
  48498. let key;
  48499. let hasParts = false;
  48500. const noop2 = function() {
  48501. };
  48502. const defaultMediaGroups = {
  48503. "AUDIO": {},
  48504. "VIDEO": {},
  48505. "CLOSED-CAPTIONS": {},
  48506. "SUBTITLES": {}
  48507. };
  48508. const widevineUuid = "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";
  48509. let currentTimeline = 0;
  48510. this.manifest = {
  48511. allowCache: true,
  48512. discontinuityStarts: [],
  48513. segments: []
  48514. };
  48515. let lastByterangeEnd = 0;
  48516. let lastPartByterangeEnd = 0;
  48517. const daterangeTags = {};
  48518. this.on("end", () => {
  48519. if (currentUri.uri || !currentUri.parts && !currentUri.preloadHints) {
  48520. return;
  48521. }
  48522. if (!currentUri.map && currentMap) {
  48523. currentUri.map = currentMap;
  48524. }
  48525. if (!currentUri.key && key) {
  48526. currentUri.key = key;
  48527. }
  48528. if (!currentUri.timeline && typeof currentTimeline === "number") {
  48529. currentUri.timeline = currentTimeline;
  48530. }
  48531. this.manifest.preloadSegment = currentUri;
  48532. });
  48533. this.parseStream.on("data", function(entry) {
  48534. let mediaGroup;
  48535. let rendition;
  48536. ({
  48537. tag() {
  48538. ({
  48539. version() {
  48540. if (entry.version) {
  48541. this.manifest.version = entry.version;
  48542. }
  48543. },
  48544. "allow-cache"() {
  48545. this.manifest.allowCache = entry.allowed;
  48546. if (!("allowed" in entry)) {
  48547. this.trigger("info", {
  48548. message: "defaulting allowCache to YES"
  48549. });
  48550. this.manifest.allowCache = true;
  48551. }
  48552. },
  48553. byterange() {
  48554. const byterange = {};
  48555. if ("length" in entry) {
  48556. currentUri.byterange = byterange;
  48557. byterange.length = entry.length;
  48558. if (!("offset" in entry)) {
  48559. entry.offset = lastByterangeEnd;
  48560. }
  48561. }
  48562. if ("offset" in entry) {
  48563. currentUri.byterange = byterange;
  48564. byterange.offset = entry.offset;
  48565. }
  48566. lastByterangeEnd = byterange.offset + byterange.length;
  48567. },
  48568. endlist() {
  48569. this.manifest.endList = true;
  48570. },
  48571. inf() {
  48572. if (!("mediaSequence" in this.manifest)) {
  48573. this.manifest.mediaSequence = 0;
  48574. this.trigger("info", {
  48575. message: "defaulting media sequence to zero"
  48576. });
  48577. }
  48578. if (!("discontinuitySequence" in this.manifest)) {
  48579. this.manifest.discontinuitySequence = 0;
  48580. this.trigger("info", {
  48581. message: "defaulting discontinuity sequence to zero"
  48582. });
  48583. }
  48584. if (entry.duration > 0) {
  48585. currentUri.duration = entry.duration;
  48586. }
  48587. if (entry.duration === 0) {
  48588. currentUri.duration = 0.01;
  48589. this.trigger("info", {
  48590. message: "updating zero segment duration to a small value"
  48591. });
  48592. }
  48593. this.manifest.segments = uris;
  48594. },
  48595. key() {
  48596. if (!entry.attributes) {
  48597. this.trigger("warn", {
  48598. message: "ignoring key declaration without attribute list"
  48599. });
  48600. return;
  48601. }
  48602. if (entry.attributes.METHOD === "NONE") {
  48603. key = null;
  48604. return;
  48605. }
  48606. if (!entry.attributes.URI) {
  48607. this.trigger("warn", {
  48608. message: "ignoring key declaration without URI"
  48609. });
  48610. return;
  48611. }
  48612. if (entry.attributes.KEYFORMAT === "com.apple.streamingkeydelivery") {
  48613. this.manifest.contentProtection = this.manifest.contentProtection || {};
  48614. this.manifest.contentProtection["com.apple.fps.1_0"] = {
  48615. attributes: entry.attributes
  48616. };
  48617. return;
  48618. }
  48619. if (entry.attributes.KEYFORMAT === "com.microsoft.playready") {
  48620. this.manifest.contentProtection = this.manifest.contentProtection || {};
  48621. this.manifest.contentProtection["com.microsoft.playready"] = {
  48622. uri: entry.attributes.URI
  48623. };
  48624. return;
  48625. }
  48626. if (entry.attributes.KEYFORMAT === widevineUuid) {
  48627. const VALID_METHODS = ["SAMPLE-AES", "SAMPLE-AES-CTR", "SAMPLE-AES-CENC"];
  48628. if (VALID_METHODS.indexOf(entry.attributes.METHOD) === -1) {
  48629. this.trigger("warn", {
  48630. message: "invalid key method provided for Widevine"
  48631. });
  48632. return;
  48633. }
  48634. if (entry.attributes.METHOD === "SAMPLE-AES-CENC") {
  48635. this.trigger("warn", {
  48636. message: "SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"
  48637. });
  48638. }
  48639. if (entry.attributes.URI.substring(0, 23) !== "data:text/plain;base64,") {
  48640. this.trigger("warn", {
  48641. message: "invalid key URI provided for Widevine"
  48642. });
  48643. return;
  48644. }
  48645. if (!(entry.attributes.KEYID && entry.attributes.KEYID.substring(0, 2) === "0x")) {
  48646. this.trigger("warn", {
  48647. message: "invalid key ID provided for Widevine"
  48648. });
  48649. return;
  48650. }
  48651. this.manifest.contentProtection = this.manifest.contentProtection || {};
  48652. this.manifest.contentProtection["com.widevine.alpha"] = {
  48653. attributes: {
  48654. schemeIdUri: entry.attributes.KEYFORMAT,
  48655. keyId: entry.attributes.KEYID.substring(2)
  48656. },
  48657. pssh: decodeB64ToUint8Array$2(entry.attributes.URI.split(",")[1])
  48658. };
  48659. return;
  48660. }
  48661. if (!entry.attributes.METHOD) {
  48662. this.trigger("warn", {
  48663. message: "defaulting key method to AES-128"
  48664. });
  48665. }
  48666. key = {
  48667. method: entry.attributes.METHOD || "AES-128",
  48668. uri: entry.attributes.URI
  48669. };
  48670. if (typeof entry.attributes.IV !== "undefined") {
  48671. key.iv = entry.attributes.IV;
  48672. }
  48673. },
  48674. "media-sequence"() {
  48675. if (!isFinite(entry.number)) {
  48676. this.trigger("warn", {
  48677. message: "ignoring invalid media sequence: " + entry.number
  48678. });
  48679. return;
  48680. }
  48681. this.manifest.mediaSequence = entry.number;
  48682. },
  48683. "discontinuity-sequence"() {
  48684. if (!isFinite(entry.number)) {
  48685. this.trigger("warn", {
  48686. message: "ignoring invalid discontinuity sequence: " + entry.number
  48687. });
  48688. return;
  48689. }
  48690. this.manifest.discontinuitySequence = entry.number;
  48691. currentTimeline = entry.number;
  48692. },
  48693. "playlist-type"() {
  48694. if (!/VOD|EVENT/.test(entry.playlistType)) {
  48695. this.trigger("warn", {
  48696. message: "ignoring unknown playlist type: " + entry.playlist
  48697. });
  48698. return;
  48699. }
  48700. this.manifest.playlistType = entry.playlistType;
  48701. },
  48702. map() {
  48703. currentMap = {};
  48704. if (entry.uri) {
  48705. currentMap.uri = entry.uri;
  48706. }
  48707. if (entry.byterange) {
  48708. currentMap.byterange = entry.byterange;
  48709. }
  48710. if (key) {
  48711. currentMap.key = key;
  48712. }
  48713. },
  48714. "stream-inf"() {
  48715. this.manifest.playlists = uris;
  48716. this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups;
  48717. if (!entry.attributes) {
  48718. this.trigger("warn", {
  48719. message: "ignoring empty stream-inf attributes"
  48720. });
  48721. return;
  48722. }
  48723. if (!currentUri.attributes) {
  48724. currentUri.attributes = {};
  48725. }
  48726. _extends$2(currentUri.attributes, entry.attributes);
  48727. },
  48728. media() {
  48729. this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups;
  48730. if (!(entry.attributes && entry.attributes.TYPE && entry.attributes["GROUP-ID"] && entry.attributes.NAME)) {
  48731. this.trigger("warn", {
  48732. message: "ignoring incomplete or missing media group"
  48733. });
  48734. return;
  48735. }
  48736. const mediaGroupType = this.manifest.mediaGroups[entry.attributes.TYPE];
  48737. mediaGroupType[entry.attributes["GROUP-ID"]] = mediaGroupType[entry.attributes["GROUP-ID"]] || {};
  48738. mediaGroup = mediaGroupType[entry.attributes["GROUP-ID"]];
  48739. rendition = {
  48740. default: /yes/i.test(entry.attributes.DEFAULT)
  48741. };
  48742. if (rendition.default) {
  48743. rendition.autoselect = true;
  48744. } else {
  48745. rendition.autoselect = /yes/i.test(entry.attributes.AUTOSELECT);
  48746. }
  48747. if (entry.attributes.LANGUAGE) {
  48748. rendition.language = entry.attributes.LANGUAGE;
  48749. }
  48750. if (entry.attributes.URI) {
  48751. rendition.uri = entry.attributes.URI;
  48752. }
  48753. if (entry.attributes["INSTREAM-ID"]) {
  48754. rendition.instreamId = entry.attributes["INSTREAM-ID"];
  48755. }
  48756. if (entry.attributes.CHARACTERISTICS) {
  48757. rendition.characteristics = entry.attributes.CHARACTERISTICS;
  48758. }
  48759. if (entry.attributes.FORCED) {
  48760. rendition.forced = /yes/i.test(entry.attributes.FORCED);
  48761. }
  48762. mediaGroup[entry.attributes.NAME] = rendition;
  48763. },
  48764. discontinuity() {
  48765. currentTimeline += 1;
  48766. currentUri.discontinuity = true;
  48767. this.manifest.discontinuityStarts.push(uris.length);
  48768. },
  48769. "program-date-time"() {
  48770. if (typeof this.manifest.dateTimeString === "undefined") {
  48771. this.manifest.dateTimeString = entry.dateTimeString;
  48772. this.manifest.dateTimeObject = entry.dateTimeObject;
  48773. }
  48774. currentUri.dateTimeString = entry.dateTimeString;
  48775. currentUri.dateTimeObject = entry.dateTimeObject;
  48776. },
  48777. targetduration() {
  48778. if (!isFinite(entry.duration) || entry.duration < 0) {
  48779. this.trigger("warn", {
  48780. message: "ignoring invalid target duration: " + entry.duration
  48781. });
  48782. return;
  48783. }
  48784. this.manifest.targetDuration = entry.duration;
  48785. setHoldBack$1.call(this, this.manifest);
  48786. },
  48787. start() {
  48788. if (!entry.attributes || isNaN(entry.attributes["TIME-OFFSET"])) {
  48789. this.trigger("warn", {
  48790. message: "ignoring start declaration without appropriate attribute list"
  48791. });
  48792. return;
  48793. }
  48794. this.manifest.start = {
  48795. timeOffset: entry.attributes["TIME-OFFSET"],
  48796. precise: entry.attributes.PRECISE
  48797. };
  48798. },
  48799. "cue-out"() {
  48800. currentUri.cueOut = entry.data;
  48801. },
  48802. "cue-out-cont"() {
  48803. currentUri.cueOutCont = entry.data;
  48804. },
  48805. "cue-in"() {
  48806. currentUri.cueIn = entry.data;
  48807. },
  48808. "skip"() {
  48809. this.manifest.skip = camelCaseKeys$1(entry.attributes);
  48810. this.warnOnMissingAttributes_("#EXT-X-SKIP", entry.attributes, ["SKIPPED-SEGMENTS"]);
  48811. },
  48812. "part"() {
  48813. hasParts = true;
  48814. const segmentIndex = this.manifest.segments.length;
  48815. const part = camelCaseKeys$1(entry.attributes);
  48816. currentUri.parts = currentUri.parts || [];
  48817. currentUri.parts.push(part);
  48818. if (part.byterange) {
  48819. if (!part.byterange.hasOwnProperty("offset")) {
  48820. part.byterange.offset = lastPartByterangeEnd;
  48821. }
  48822. lastPartByterangeEnd = part.byterange.offset + part.byterange.length;
  48823. }
  48824. const partIndex = currentUri.parts.length - 1;
  48825. this.warnOnMissingAttributes_(`#EXT-X-PART #${partIndex} for segment #${segmentIndex}`, entry.attributes, ["URI", "DURATION"]);
  48826. if (this.manifest.renditionReports) {
  48827. this.manifest.renditionReports.forEach((r2, i2) => {
  48828. if (!r2.hasOwnProperty("lastPart")) {
  48829. this.trigger("warn", {
  48830. message: `#EXT-X-RENDITION-REPORT #${i2} lacks required attribute(s): LAST-PART`
  48831. });
  48832. }
  48833. });
  48834. }
  48835. },
  48836. "server-control"() {
  48837. const attrs = this.manifest.serverControl = camelCaseKeys$1(entry.attributes);
  48838. if (!attrs.hasOwnProperty("canBlockReload")) {
  48839. attrs.canBlockReload = false;
  48840. this.trigger("info", {
  48841. message: "#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"
  48842. });
  48843. }
  48844. setHoldBack$1.call(this, this.manifest);
  48845. if (attrs.canSkipDateranges && !attrs.hasOwnProperty("canSkipUntil")) {
  48846. this.trigger("warn", {
  48847. message: "#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"
  48848. });
  48849. }
  48850. },
  48851. "preload-hint"() {
  48852. const segmentIndex = this.manifest.segments.length;
  48853. const hint = camelCaseKeys$1(entry.attributes);
  48854. const isPart = hint.type && hint.type === "PART";
  48855. currentUri.preloadHints = currentUri.preloadHints || [];
  48856. currentUri.preloadHints.push(hint);
  48857. if (hint.byterange) {
  48858. if (!hint.byterange.hasOwnProperty("offset")) {
  48859. hint.byterange.offset = isPart ? lastPartByterangeEnd : 0;
  48860. if (isPart) {
  48861. lastPartByterangeEnd = hint.byterange.offset + hint.byterange.length;
  48862. }
  48863. }
  48864. }
  48865. const index2 = currentUri.preloadHints.length - 1;
  48866. this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${index2} for segment #${segmentIndex}`, entry.attributes, ["TYPE", "URI"]);
  48867. if (!hint.type) {
  48868. return;
  48869. }
  48870. for (let i2 = 0; i2 < currentUri.preloadHints.length - 1; i2++) {
  48871. const otherHint = currentUri.preloadHints[i2];
  48872. if (!otherHint.type) {
  48873. continue;
  48874. }
  48875. if (otherHint.type === hint.type) {
  48876. this.trigger("warn", {
  48877. message: `#EXT-X-PRELOAD-HINT #${index2} for segment #${segmentIndex} has the same TYPE ${hint.type} as preload hint #${i2}`
  48878. });
  48879. }
  48880. }
  48881. },
  48882. "rendition-report"() {
  48883. const report = camelCaseKeys$1(entry.attributes);
  48884. this.manifest.renditionReports = this.manifest.renditionReports || [];
  48885. this.manifest.renditionReports.push(report);
  48886. const index2 = this.manifest.renditionReports.length - 1;
  48887. const required = ["LAST-MSN", "URI"];
  48888. if (hasParts) {
  48889. required.push("LAST-PART");
  48890. }
  48891. this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${index2}`, entry.attributes, required);
  48892. },
  48893. "part-inf"() {
  48894. this.manifest.partInf = camelCaseKeys$1(entry.attributes);
  48895. this.warnOnMissingAttributes_("#EXT-X-PART-INF", entry.attributes, ["PART-TARGET"]);
  48896. if (this.manifest.partInf.partTarget) {
  48897. this.manifest.partTargetDuration = this.manifest.partInf.partTarget;
  48898. }
  48899. setHoldBack$1.call(this, this.manifest);
  48900. },
  48901. "daterange"() {
  48902. this.manifest.daterange = this.manifest.daterange || [];
  48903. this.manifest.daterange.push(camelCaseKeys$1(entry.attributes));
  48904. const index2 = this.manifest.daterange.length - 1;
  48905. this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${index2}`, entry.attributes, ["ID", "START-DATE"]);
  48906. const daterange = this.manifest.daterange[index2];
  48907. if (daterange.endDate && daterange.startDate && new Date(daterange.endDate) < new Date(daterange.startDate)) {
  48908. this.trigger("warn", {
  48909. message: "EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"
  48910. });
  48911. }
  48912. if (daterange.duration && daterange.duration < 0) {
  48913. this.trigger("warn", {
  48914. message: "EXT-X-DATERANGE DURATION must not be negative"
  48915. });
  48916. }
  48917. if (daterange.plannedDuration && daterange.plannedDuration < 0) {
  48918. this.trigger("warn", {
  48919. message: "EXT-X-DATERANGE PLANNED-DURATION must not be negative"
  48920. });
  48921. }
  48922. const endOnNextYes = !!daterange.endOnNext;
  48923. if (endOnNextYes && !daterange.class) {
  48924. this.trigger("warn", {
  48925. message: "EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"
  48926. });
  48927. }
  48928. if (endOnNextYes && (daterange.duration || daterange.endDate)) {
  48929. this.trigger("warn", {
  48930. message: "EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"
  48931. });
  48932. }
  48933. if (daterange.duration && daterange.endDate) {
  48934. const startDate = daterange.startDate;
  48935. const newDateInSeconds = startDate.setSeconds(startDate.getSeconds() + daterange.duration);
  48936. this.manifest.daterange[index2].endDate = new Date(newDateInSeconds);
  48937. }
  48938. if (daterange && !this.manifest.dateTimeString) {
  48939. this.trigger("warn", {
  48940. message: "A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"
  48941. });
  48942. }
  48943. if (!daterangeTags[daterange.id]) {
  48944. daterangeTags[daterange.id] = daterange;
  48945. } else {
  48946. for (const attribute in daterangeTags[daterange.id]) {
  48947. if (daterangeTags[daterange.id][attribute] !== daterange[attribute]) {
  48948. this.trigger("warn", {
  48949. message: "EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes and same attribute values"
  48950. });
  48951. break;
  48952. }
  48953. }
  48954. }
  48955. }
  48956. }[entry.tagType] || noop2).call(self2);
  48957. },
  48958. uri() {
  48959. currentUri.uri = entry.uri;
  48960. uris.push(currentUri);
  48961. if (this.manifest.targetDuration && !("duration" in currentUri)) {
  48962. this.trigger("warn", {
  48963. message: "defaulting segment duration to the target duration"
  48964. });
  48965. currentUri.duration = this.manifest.targetDuration;
  48966. }
  48967. if (key) {
  48968. currentUri.key = key;
  48969. }
  48970. currentUri.timeline = currentTimeline;
  48971. if (currentMap) {
  48972. currentUri.map = currentMap;
  48973. }
  48974. lastPartByterangeEnd = 0;
  48975. currentUri = {};
  48976. },
  48977. comment() {
  48978. },
  48979. custom() {
  48980. if (entry.segment) {
  48981. currentUri.custom = currentUri.custom || {};
  48982. currentUri.custom[entry.customType] = entry.data;
  48983. } else {
  48984. this.manifest.custom = this.manifest.custom || {};
  48985. this.manifest.custom[entry.customType] = entry.data;
  48986. }
  48987. }
  48988. })[entry.type].call(self2);
  48989. });
  48990. }
  48991. warnOnMissingAttributes_(identifier, attributes, required) {
  48992. const missing = [];
  48993. required.forEach(function(key) {
  48994. if (!attributes.hasOwnProperty(key)) {
  48995. missing.push(key);
  48996. }
  48997. });
  48998. if (missing.length) {
  48999. this.trigger("warn", {
  49000. message: `${identifier} lacks required attribute(s): ${missing.join(", ")}`
  49001. });
  49002. }
  49003. }
  49004. push(chunk) {
  49005. this.lineStream.push(chunk);
  49006. }
  49007. end() {
  49008. this.lineStream.push("\n");
  49009. this.trigger("end");
  49010. }
  49011. addParser(options2) {
  49012. this.parseStream.addParser(options2);
  49013. }
  49014. addTagMapper(options2) {
  49015. this.parseStream.addTagMapper(options2);
  49016. }
  49017. }
  49018. var regexs$1 = {
  49019. mp4: /^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,
  49020. webm: /^(vp0?[89]|av0?1|opus|vorbis)/,
  49021. ogg: /^(vp0?[89]|theora|flac|opus|vorbis)/,
  49022. video: /^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,
  49023. audio: /^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,
  49024. text: /^(stpp.ttml.im1t)/,
  49025. muxerVideo: /^(avc0?1)/,
  49026. muxerAudio: /^(mp4a)/,
  49027. muxerText: /a^/
  49028. };
  49029. var mediaTypes$1 = ["video", "audio", "text"];
  49030. var upperMediaTypes$1 = ["Video", "Audio", "Text"];
  49031. var translateLegacyCodec$1 = function translateLegacyCodec(codec) {
  49032. if (!codec) {
  49033. return codec;
  49034. }
  49035. return codec.replace(/avc1\.(\d+)\.(\d+)/i, function(orig, profile, avcLevel) {
  49036. var profileHex = ("00" + Number(profile).toString(16)).slice(-2);
  49037. var avcLevelHex = ("00" + Number(avcLevel).toString(16)).slice(-2);
  49038. return "avc1." + profileHex + "00" + avcLevelHex;
  49039. });
  49040. };
  49041. var parseCodecs$1 = function parseCodecs(codecString) {
  49042. if (codecString === void 0) {
  49043. codecString = "";
  49044. }
  49045. var codecs = codecString.split(",");
  49046. var result = [];
  49047. codecs.forEach(function(codec) {
  49048. codec = codec.trim();
  49049. var codecType;
  49050. mediaTypes$1.forEach(function(name) {
  49051. var match = regexs$1[name].exec(codec.toLowerCase());
  49052. if (!match || match.length <= 1) {
  49053. return;
  49054. }
  49055. codecType = name;
  49056. var type2 = codec.substring(0, match[1].length);
  49057. var details = codec.replace(type2, "");
  49058. result.push({
  49059. type: type2,
  49060. details,
  49061. mediaType: name
  49062. });
  49063. });
  49064. if (!codecType) {
  49065. result.push({
  49066. type: codec,
  49067. details: "",
  49068. mediaType: "unknown"
  49069. });
  49070. }
  49071. });
  49072. return result;
  49073. };
  49074. var codecsFromDefault$1 = function codecsFromDefault(master, audioGroupId) {
  49075. if (!master.mediaGroups.AUDIO || !audioGroupId) {
  49076. return null;
  49077. }
  49078. var audioGroup = master.mediaGroups.AUDIO[audioGroupId];
  49079. if (!audioGroup) {
  49080. return null;
  49081. }
  49082. for (var name in audioGroup) {
  49083. var audioType = audioGroup[name];
  49084. if (audioType.default && audioType.playlists) {
  49085. return parseCodecs$1(audioType.playlists[0].attributes.CODECS);
  49086. }
  49087. }
  49088. return null;
  49089. };
  49090. var isAudioCodec$1 = function isAudioCodec(codec) {
  49091. if (codec === void 0) {
  49092. codec = "";
  49093. }
  49094. return regexs$1.audio.test(codec.trim().toLowerCase());
  49095. };
  49096. var isTextCodec$1 = function isTextCodec(codec) {
  49097. if (codec === void 0) {
  49098. codec = "";
  49099. }
  49100. return regexs$1.text.test(codec.trim().toLowerCase());
  49101. };
  49102. var getMimeForCodec$1 = function getMimeForCodec(codecString) {
  49103. if (!codecString || typeof codecString !== "string") {
  49104. return;
  49105. }
  49106. var codecs = codecString.toLowerCase().split(",").map(function(c) {
  49107. return translateLegacyCodec$1(c.trim());
  49108. });
  49109. var type2 = "video";
  49110. if (codecs.length === 1 && isAudioCodec$1(codecs[0])) {
  49111. type2 = "audio";
  49112. } else if (codecs.length === 1 && isTextCodec$1(codecs[0])) {
  49113. type2 = "application";
  49114. }
  49115. var container = "mp4";
  49116. if (codecs.every(function(c) {
  49117. return regexs$1.mp4.test(c);
  49118. })) {
  49119. container = "mp4";
  49120. } else if (codecs.every(function(c) {
  49121. return regexs$1.webm.test(c);
  49122. })) {
  49123. container = "webm";
  49124. } else if (codecs.every(function(c) {
  49125. return regexs$1.ogg.test(c);
  49126. })) {
  49127. container = "ogg";
  49128. }
  49129. return type2 + "/" + container + ';codecs="' + codecString + '"';
  49130. };
  49131. var browserSupportsCodec$1 = function browserSupportsCodec(codecString) {
  49132. if (codecString === void 0) {
  49133. codecString = "";
  49134. }
  49135. return window_1.MediaSource && window_1.MediaSource.isTypeSupported && window_1.MediaSource.isTypeSupported(getMimeForCodec$1(codecString)) || false;
  49136. };
  49137. var muxerSupportsCodec$1 = function muxerSupportsCodec(codecString) {
  49138. if (codecString === void 0) {
  49139. codecString = "";
  49140. }
  49141. return codecString.toLowerCase().split(",").every(function(codec) {
  49142. codec = codec.trim();
  49143. for (var i2 = 0; i2 < upperMediaTypes$1.length; i2++) {
  49144. var type2 = upperMediaTypes$1[i2];
  49145. if (regexs$1["muxer" + type2].test(codec)) {
  49146. return true;
  49147. }
  49148. }
  49149. return false;
  49150. });
  49151. };
  49152. var DEFAULT_AUDIO_CODEC$1 = "mp4a.40.2";
  49153. var DEFAULT_VIDEO_CODEC$1 = "avc1.4d400d";
  49154. var MPEGURL_REGEX$1 = /^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i;
  49155. var DASH_REGEX$1 = /^application\/dash\+xml/i;
  49156. var simpleTypeFromSourceType$1 = function simpleTypeFromSourceType(type2) {
  49157. if (MPEGURL_REGEX$1.test(type2)) {
  49158. return "hls";
  49159. }
  49160. if (DASH_REGEX$1.test(type2)) {
  49161. return "dash";
  49162. }
  49163. if (type2 === "application/vnd.videojs.vhs+json") {
  49164. return "vhs-json";
  49165. }
  49166. return null;
  49167. };
  49168. var countBits$1 = function countBits(x) {
  49169. return x.toString(2).length;
  49170. };
  49171. var countBytes$1 = function countBytes(x) {
  49172. return Math.ceil(countBits$1(x) / 8);
  49173. };
  49174. var isArrayBufferView$1 = function isArrayBufferView(obj) {
  49175. if (ArrayBuffer.isView === "function") {
  49176. return ArrayBuffer.isView(obj);
  49177. }
  49178. return obj && obj.buffer instanceof ArrayBuffer;
  49179. };
  49180. var isTypedArray$1 = function isTypedArray(obj) {
  49181. return isArrayBufferView$1(obj);
  49182. };
  49183. var toUint8$1 = function toUint8(bytes) {
  49184. if (bytes instanceof Uint8Array) {
  49185. return bytes;
  49186. }
  49187. if (!Array.isArray(bytes) && !isTypedArray$1(bytes) && !(bytes instanceof ArrayBuffer)) {
  49188. if (typeof bytes !== "number" || typeof bytes === "number" && bytes !== bytes) {
  49189. bytes = 0;
  49190. } else {
  49191. bytes = [bytes];
  49192. }
  49193. }
  49194. return new Uint8Array(bytes && bytes.buffer || bytes, bytes && bytes.byteOffset || 0, bytes && bytes.byteLength || 0);
  49195. };
  49196. var BigInt$1 = window_1.BigInt || Number;
  49197. var BYTE_TABLE$1 = [BigInt$1("0x1"), BigInt$1("0x100"), BigInt$1("0x10000"), BigInt$1("0x1000000"), BigInt$1("0x100000000"), BigInt$1("0x10000000000"), BigInt$1("0x1000000000000"), BigInt$1("0x100000000000000"), BigInt$1("0x10000000000000000")];
  49198. (function() {
  49199. var a = new Uint16Array([65484]);
  49200. var b = new Uint8Array(a.buffer, a.byteOffset, a.byteLength);
  49201. if (b[0] === 255) {
  49202. return "big";
  49203. }
  49204. if (b[0] === 204) {
  49205. return "little";
  49206. }
  49207. return "unknown";
  49208. })();
  49209. var bytesToNumber$1 = function bytesToNumber(bytes, _temp) {
  49210. var _ref = _temp === void 0 ? {} : _temp, _ref$signed = _ref.signed, signed = _ref$signed === void 0 ? false : _ref$signed, _ref$le = _ref.le, le = _ref$le === void 0 ? false : _ref$le;
  49211. bytes = toUint8$1(bytes);
  49212. var fn2 = le ? "reduce" : "reduceRight";
  49213. var obj = bytes[fn2] ? bytes[fn2] : Array.prototype[fn2];
  49214. var number = obj.call(bytes, function(total, byte, i2) {
  49215. var exponent = le ? i2 : Math.abs(i2 + 1 - bytes.length);
  49216. return total + BigInt$1(byte) * BYTE_TABLE$1[exponent];
  49217. }, BigInt$1(0));
  49218. if (signed) {
  49219. var max2 = BYTE_TABLE$1[bytes.length] / BigInt$1(2) - BigInt$1(1);
  49220. number = BigInt$1(number);
  49221. if (number > max2) {
  49222. number -= max2;
  49223. number -= max2;
  49224. number -= BigInt$1(2);
  49225. }
  49226. }
  49227. return Number(number);
  49228. };
  49229. var numberToBytes$1 = function numberToBytes(number, _temp2) {
  49230. var _ref2 = _temp2 === void 0 ? {} : _temp2, _ref2$le = _ref2.le, le = _ref2$le === void 0 ? false : _ref2$le;
  49231. if (typeof number !== "bigint" && typeof number !== "number" || typeof number === "number" && number !== number) {
  49232. number = 0;
  49233. }
  49234. number = BigInt$1(number);
  49235. var byteCount = countBytes$1(number);
  49236. var bytes = new Uint8Array(new ArrayBuffer(byteCount));
  49237. for (var i2 = 0; i2 < byteCount; i2++) {
  49238. var byteIndex = le ? i2 : Math.abs(i2 + 1 - bytes.length);
  49239. bytes[byteIndex] = Number(number / BYTE_TABLE$1[i2] & BigInt$1(255));
  49240. if (number < 0) {
  49241. bytes[byteIndex] = Math.abs(~bytes[byteIndex]);
  49242. bytes[byteIndex] -= i2 === 0 ? 1 : 2;
  49243. }
  49244. }
  49245. return bytes;
  49246. };
  49247. var stringToBytes$1 = function stringToBytes(string, stringIsBytes) {
  49248. if (typeof string !== "string" && string && typeof string.toString === "function") {
  49249. string = string.toString();
  49250. }
  49251. if (typeof string !== "string") {
  49252. return new Uint8Array();
  49253. }
  49254. if (!stringIsBytes) {
  49255. string = unescape(encodeURIComponent(string));
  49256. }
  49257. var view = new Uint8Array(string.length);
  49258. for (var i2 = 0; i2 < string.length; i2++) {
  49259. view[i2] = string.charCodeAt(i2);
  49260. }
  49261. return view;
  49262. };
  49263. var concatTypedArrays$1 = function concatTypedArrays() {
  49264. for (var _len = arguments.length, buffers = new Array(_len), _key = 0; _key < _len; _key++) {
  49265. buffers[_key] = arguments[_key];
  49266. }
  49267. buffers = buffers.filter(function(b) {
  49268. return b && (b.byteLength || b.length) && typeof b !== "string";
  49269. });
  49270. if (buffers.length <= 1) {
  49271. return toUint8$1(buffers[0]);
  49272. }
  49273. var totalLen = buffers.reduce(function(total, buf, i2) {
  49274. return total + (buf.byteLength || buf.length);
  49275. }, 0);
  49276. var tempBuffer = new Uint8Array(totalLen);
  49277. var offset = 0;
  49278. buffers.forEach(function(buf) {
  49279. buf = toUint8$1(buf);
  49280. tempBuffer.set(buf, offset);
  49281. offset += buf.byteLength;
  49282. });
  49283. return tempBuffer;
  49284. };
  49285. var bytesMatch$1 = function bytesMatch(a, b, _temp3) {
  49286. var _ref3 = _temp3 === void 0 ? {} : _temp3, _ref3$offset = _ref3.offset, offset = _ref3$offset === void 0 ? 0 : _ref3$offset, _ref3$mask = _ref3.mask, mask = _ref3$mask === void 0 ? [] : _ref3$mask;
  49287. a = toUint8$1(a);
  49288. b = toUint8$1(b);
  49289. var fn2 = b.every ? b.every : Array.prototype.every;
  49290. return b.length && a.length - offset >= b.length && fn2.call(b, function(bByte, i2) {
  49291. var aByte = mask[i2] ? mask[i2] & a[offset + i2] : a[offset + i2];
  49292. return bByte === aByte;
  49293. });
  49294. };
  49295. var DEFAULT_LOCATION$1 = "http://example.com";
  49296. var resolveUrl$3 = function resolveUrl2(baseUrl, relativeUrl) {
  49297. if (/^[a-z]+:/i.test(relativeUrl)) {
  49298. return relativeUrl;
  49299. }
  49300. if (/^data:/.test(baseUrl)) {
  49301. baseUrl = window_1.location && window_1.location.href || "";
  49302. }
  49303. var nativeURL = typeof window_1.URL === "function";
  49304. var protocolLess = /^\/\//.test(baseUrl);
  49305. var removeLocation = !window_1.location && !/\/\//i.test(baseUrl);
  49306. if (nativeURL) {
  49307. baseUrl = new window_1.URL(baseUrl, window_1.location || DEFAULT_LOCATION$1);
  49308. } else if (!/\/\//i.test(baseUrl)) {
  49309. baseUrl = URLToolkit.buildAbsoluteURL(window_1.location && window_1.location.href || "", baseUrl);
  49310. }
  49311. if (nativeURL) {
  49312. var newUrl = new URL(relativeUrl, baseUrl);
  49313. if (removeLocation) {
  49314. return newUrl.href.slice(DEFAULT_LOCATION$1.length);
  49315. } else if (protocolLess) {
  49316. return newUrl.href.slice(newUrl.protocol.length);
  49317. }
  49318. return newUrl.href;
  49319. }
  49320. return URLToolkit.buildAbsoluteURL(baseUrl, relativeUrl);
  49321. };
  49322. var forEachMediaGroup$3 = function forEachMediaGroup(master, groups, callback2) {
  49323. groups.forEach(function(mediaType) {
  49324. for (var groupKey in master.mediaGroups[mediaType]) {
  49325. for (var labelKey in master.mediaGroups[mediaType][groupKey]) {
  49326. var mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey];
  49327. callback2(mediaProperties, mediaType, groupKey, labelKey);
  49328. }
  49329. }
  49330. });
  49331. };
  49332. var atob$1 = function atob2(s) {
  49333. return window_1.atob ? window_1.atob(s) : Buffer.from(s, "base64").toString("binary");
  49334. };
  49335. function decodeB64ToUint8Array$1(b64Text) {
  49336. var decodedString = atob$1(b64Text);
  49337. var array = new Uint8Array(decodedString.length);
  49338. for (var i2 = 0; i2 < decodedString.length; i2++) {
  49339. array[i2] = decodedString.charCodeAt(i2);
  49340. }
  49341. return array;
  49342. }
  49343. var dom$1 = {};
  49344. var conventions$2 = {};
  49345. function find$1(list, predicate, ac) {
  49346. if (ac === void 0) {
  49347. ac = Array.prototype;
  49348. }
  49349. if (list && typeof ac.find === "function") {
  49350. return ac.find.call(list, predicate);
  49351. }
  49352. for (var i2 = 0; i2 < list.length; i2++) {
  49353. if (Object.prototype.hasOwnProperty.call(list, i2)) {
  49354. var item = list[i2];
  49355. if (predicate.call(void 0, item, i2, list)) {
  49356. return item;
  49357. }
  49358. }
  49359. }
  49360. }
  49361. function freeze(object, oc) {
  49362. if (oc === void 0) {
  49363. oc = Object;
  49364. }
  49365. return oc && typeof oc.freeze === "function" ? oc.freeze(object) : object;
  49366. }
  49367. function assign$1(target, source) {
  49368. if (target === null || typeof target !== "object") {
  49369. throw new TypeError("target is not an object");
  49370. }
  49371. for (var key in source) {
  49372. if (Object.prototype.hasOwnProperty.call(source, key)) {
  49373. target[key] = source[key];
  49374. }
  49375. }
  49376. return target;
  49377. }
  49378. var MIME_TYPE = freeze({
  49379. HTML: "text/html",
  49380. isHTML: function(value) {
  49381. return value === MIME_TYPE.HTML;
  49382. },
  49383. XML_APPLICATION: "application/xml",
  49384. XML_TEXT: "text/xml",
  49385. XML_XHTML_APPLICATION: "application/xhtml+xml",
  49386. XML_SVG_IMAGE: "image/svg+xml"
  49387. });
  49388. var NAMESPACE$3 = freeze({
  49389. HTML: "http://www.w3.org/1999/xhtml",
  49390. isHTML: function(uri) {
  49391. return uri === NAMESPACE$3.HTML;
  49392. },
  49393. SVG: "http://www.w3.org/2000/svg",
  49394. XML: "http://www.w3.org/XML/1998/namespace",
  49395. XMLNS: "http://www.w3.org/2000/xmlns/"
  49396. });
  49397. conventions$2.assign = assign$1;
  49398. conventions$2.find = find$1;
  49399. conventions$2.freeze = freeze;
  49400. conventions$2.MIME_TYPE = MIME_TYPE;
  49401. conventions$2.NAMESPACE = NAMESPACE$3;
  49402. var conventions$1 = conventions$2;
  49403. var find = conventions$1.find;
  49404. var NAMESPACE$2 = conventions$1.NAMESPACE;
  49405. function notEmptyString(input) {
  49406. return input !== "";
  49407. }
  49408. function splitOnASCIIWhitespace(input) {
  49409. return input ? input.split(/[\t\n\f\r ]+/).filter(notEmptyString) : [];
  49410. }
  49411. function orderedSetReducer(current, element) {
  49412. if (!current.hasOwnProperty(element)) {
  49413. current[element] = true;
  49414. }
  49415. return current;
  49416. }
  49417. function toOrderedSet(input) {
  49418. if (!input)
  49419. return [];
  49420. var list = splitOnASCIIWhitespace(input);
  49421. return Object.keys(list.reduce(orderedSetReducer, {}));
  49422. }
  49423. function arrayIncludes(list) {
  49424. return function(element) {
  49425. return list && list.indexOf(element) !== -1;
  49426. };
  49427. }
  49428. function copy(src, dest) {
  49429. for (var p in src) {
  49430. if (Object.prototype.hasOwnProperty.call(src, p)) {
  49431. dest[p] = src[p];
  49432. }
  49433. }
  49434. }
  49435. function _extends(Class, Super) {
  49436. var pt2 = Class.prototype;
  49437. if (!(pt2 instanceof Super)) {
  49438. let t2 = function() {
  49439. };
  49440. t2.prototype = Super.prototype;
  49441. t2 = new t2();
  49442. copy(pt2, t2);
  49443. Class.prototype = pt2 = t2;
  49444. }
  49445. if (pt2.constructor != Class) {
  49446. if (typeof Class != "function") {
  49447. console.error("unknown Class:" + Class);
  49448. }
  49449. pt2.constructor = Class;
  49450. }
  49451. }
  49452. var NodeType = {};
  49453. var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1;
  49454. var ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2;
  49455. var TEXT_NODE = NodeType.TEXT_NODE = 3;
  49456. var CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4;
  49457. var ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5;
  49458. var ENTITY_NODE = NodeType.ENTITY_NODE = 6;
  49459. var PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7;
  49460. var COMMENT_NODE = NodeType.COMMENT_NODE = 8;
  49461. var DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9;
  49462. var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10;
  49463. var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11;
  49464. var NOTATION_NODE = NodeType.NOTATION_NODE = 12;
  49465. var ExceptionCode = {};
  49466. var ExceptionMessage = {};
  49467. ExceptionCode.INDEX_SIZE_ERR = (ExceptionMessage[1] = "Index size error", 1);
  49468. ExceptionCode.DOMSTRING_SIZE_ERR = (ExceptionMessage[2] = "DOMString size error", 2);
  49469. var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = (ExceptionMessage[3] = "Hierarchy request error", 3);
  49470. ExceptionCode.WRONG_DOCUMENT_ERR = (ExceptionMessage[4] = "Wrong document", 4);
  49471. ExceptionCode.INVALID_CHARACTER_ERR = (ExceptionMessage[5] = "Invalid character", 5);
  49472. ExceptionCode.NO_DATA_ALLOWED_ERR = (ExceptionMessage[6] = "No data allowed", 6);
  49473. ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = (ExceptionMessage[7] = "No modification allowed", 7);
  49474. var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = (ExceptionMessage[8] = "Not found", 8);
  49475. ExceptionCode.NOT_SUPPORTED_ERR = (ExceptionMessage[9] = "Not supported", 9);
  49476. var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = (ExceptionMessage[10] = "Attribute in use", 10);
  49477. ExceptionCode.INVALID_STATE_ERR = (ExceptionMessage[11] = "Invalid state", 11);
  49478. ExceptionCode.SYNTAX_ERR = (ExceptionMessage[12] = "Syntax error", 12);
  49479. ExceptionCode.INVALID_MODIFICATION_ERR = (ExceptionMessage[13] = "Invalid modification", 13);
  49480. ExceptionCode.NAMESPACE_ERR = (ExceptionMessage[14] = "Invalid namespace", 14);
  49481. ExceptionCode.INVALID_ACCESS_ERR = (ExceptionMessage[15] = "Invalid access", 15);
  49482. function DOMException(code, message) {
  49483. if (message instanceof Error) {
  49484. var error = message;
  49485. } else {
  49486. error = this;
  49487. Error.call(this, ExceptionMessage[code]);
  49488. this.message = ExceptionMessage[code];
  49489. if (Error.captureStackTrace)
  49490. Error.captureStackTrace(this, DOMException);
  49491. }
  49492. error.code = code;
  49493. if (message)
  49494. this.message = this.message + ": " + message;
  49495. return error;
  49496. }
  49497. DOMException.prototype = Error.prototype;
  49498. copy(ExceptionCode, DOMException);
  49499. function NodeList() {
  49500. }
  49501. NodeList.prototype = {
  49502. length: 0,
  49503. item: function(index2) {
  49504. return this[index2] || null;
  49505. },
  49506. toString: function(isHTML, nodeFilter) {
  49507. for (var buf = [], i2 = 0; i2 < this.length; i2++) {
  49508. serializeToString(this[i2], buf, isHTML, nodeFilter);
  49509. }
  49510. return buf.join("");
  49511. },
  49512. filter: function(predicate) {
  49513. return Array.prototype.filter.call(this, predicate);
  49514. },
  49515. indexOf: function(item) {
  49516. return Array.prototype.indexOf.call(this, item);
  49517. }
  49518. };
  49519. function LiveNodeList(node, refresh) {
  49520. this._node = node;
  49521. this._refresh = refresh;
  49522. _updateLiveList(this);
  49523. }
  49524. function _updateLiveList(list) {
  49525. var inc = list._node._inc || list._node.ownerDocument._inc;
  49526. if (list._inc != inc) {
  49527. var ls = list._refresh(list._node);
  49528. __set__(list, "length", ls.length);
  49529. copy(ls, list);
  49530. list._inc = inc;
  49531. }
  49532. }
  49533. LiveNodeList.prototype.item = function(i2) {
  49534. _updateLiveList(this);
  49535. return this[i2];
  49536. };
  49537. _extends(LiveNodeList, NodeList);
  49538. function NamedNodeMap() {
  49539. }
  49540. function _findNodeIndex(list, node) {
  49541. var i2 = list.length;
  49542. while (i2--) {
  49543. if (list[i2] === node) {
  49544. return i2;
  49545. }
  49546. }
  49547. }
  49548. function _addNamedNode(el, list, newAttr, oldAttr) {
  49549. if (oldAttr) {
  49550. list[_findNodeIndex(list, oldAttr)] = newAttr;
  49551. } else {
  49552. list[list.length++] = newAttr;
  49553. }
  49554. if (el) {
  49555. newAttr.ownerElement = el;
  49556. var doc = el.ownerDocument;
  49557. if (doc) {
  49558. oldAttr && _onRemoveAttribute(doc, el, oldAttr);
  49559. _onAddAttribute(doc, el, newAttr);
  49560. }
  49561. }
  49562. }
  49563. function _removeNamedNode(el, list, attr) {
  49564. var i2 = _findNodeIndex(list, attr);
  49565. if (i2 >= 0) {
  49566. var lastIndex = list.length - 1;
  49567. while (i2 < lastIndex) {
  49568. list[i2] = list[++i2];
  49569. }
  49570. list.length = lastIndex;
  49571. if (el) {
  49572. var doc = el.ownerDocument;
  49573. if (doc) {
  49574. _onRemoveAttribute(doc, el, attr);
  49575. attr.ownerElement = null;
  49576. }
  49577. }
  49578. } else {
  49579. throw new DOMException(NOT_FOUND_ERR, new Error(el.tagName + "@" + attr));
  49580. }
  49581. }
  49582. NamedNodeMap.prototype = {
  49583. length: 0,
  49584. item: NodeList.prototype.item,
  49585. getNamedItem: function(key) {
  49586. var i2 = this.length;
  49587. while (i2--) {
  49588. var attr = this[i2];
  49589. if (attr.nodeName == key) {
  49590. return attr;
  49591. }
  49592. }
  49593. },
  49594. setNamedItem: function(attr) {
  49595. var el = attr.ownerElement;
  49596. if (el && el != this._ownerElement) {
  49597. throw new DOMException(INUSE_ATTRIBUTE_ERR);
  49598. }
  49599. var oldAttr = this.getNamedItem(attr.nodeName);
  49600. _addNamedNode(this._ownerElement, this, attr, oldAttr);
  49601. return oldAttr;
  49602. },
  49603. setNamedItemNS: function(attr) {
  49604. var el = attr.ownerElement, oldAttr;
  49605. if (el && el != this._ownerElement) {
  49606. throw new DOMException(INUSE_ATTRIBUTE_ERR);
  49607. }
  49608. oldAttr = this.getNamedItemNS(attr.namespaceURI, attr.localName);
  49609. _addNamedNode(this._ownerElement, this, attr, oldAttr);
  49610. return oldAttr;
  49611. },
  49612. removeNamedItem: function(key) {
  49613. var attr = this.getNamedItem(key);
  49614. _removeNamedNode(this._ownerElement, this, attr);
  49615. return attr;
  49616. },
  49617. removeNamedItemNS: function(namespaceURI, localName) {
  49618. var attr = this.getNamedItemNS(namespaceURI, localName);
  49619. _removeNamedNode(this._ownerElement, this, attr);
  49620. return attr;
  49621. },
  49622. getNamedItemNS: function(namespaceURI, localName) {
  49623. var i2 = this.length;
  49624. while (i2--) {
  49625. var node = this[i2];
  49626. if (node.localName == localName && node.namespaceURI == namespaceURI) {
  49627. return node;
  49628. }
  49629. }
  49630. return null;
  49631. }
  49632. };
  49633. function DOMImplementation$1() {
  49634. }
  49635. DOMImplementation$1.prototype = {
  49636. hasFeature: function(feature2, version2) {
  49637. return true;
  49638. },
  49639. createDocument: function(namespaceURI, qualifiedName, doctype) {
  49640. var doc = new Document();
  49641. doc.implementation = this;
  49642. doc.childNodes = new NodeList();
  49643. doc.doctype = doctype || null;
  49644. if (doctype) {
  49645. doc.appendChild(doctype);
  49646. }
  49647. if (qualifiedName) {
  49648. var root2 = doc.createElementNS(namespaceURI, qualifiedName);
  49649. doc.appendChild(root2);
  49650. }
  49651. return doc;
  49652. },
  49653. createDocumentType: function(qualifiedName, publicId, systemId) {
  49654. var node = new DocumentType();
  49655. node.name = qualifiedName;
  49656. node.nodeName = qualifiedName;
  49657. node.publicId = publicId || "";
  49658. node.systemId = systemId || "";
  49659. return node;
  49660. }
  49661. };
  49662. function Node() {
  49663. }
  49664. Node.prototype = {
  49665. firstChild: null,
  49666. lastChild: null,
  49667. previousSibling: null,
  49668. nextSibling: null,
  49669. attributes: null,
  49670. parentNode: null,
  49671. childNodes: null,
  49672. ownerDocument: null,
  49673. nodeValue: null,
  49674. namespaceURI: null,
  49675. prefix: null,
  49676. localName: null,
  49677. insertBefore: function(newChild, refChild) {
  49678. return _insertBefore(this, newChild, refChild);
  49679. },
  49680. replaceChild: function(newChild, oldChild) {
  49681. _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
  49682. if (oldChild) {
  49683. this.removeChild(oldChild);
  49684. }
  49685. },
  49686. removeChild: function(oldChild) {
  49687. return _removeChild(this, oldChild);
  49688. },
  49689. appendChild: function(newChild) {
  49690. return this.insertBefore(newChild, null);
  49691. },
  49692. hasChildNodes: function() {
  49693. return this.firstChild != null;
  49694. },
  49695. cloneNode: function(deep) {
  49696. return cloneNode(this.ownerDocument || this, this, deep);
  49697. },
  49698. normalize: function() {
  49699. var child = this.firstChild;
  49700. while (child) {
  49701. var next = child.nextSibling;
  49702. if (next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE) {
  49703. this.removeChild(next);
  49704. child.appendData(next.data);
  49705. } else {
  49706. child.normalize();
  49707. child = next;
  49708. }
  49709. }
  49710. },
  49711. isSupported: function(feature2, version2) {
  49712. return this.ownerDocument.implementation.hasFeature(feature2, version2);
  49713. },
  49714. hasAttributes: function() {
  49715. return this.attributes.length > 0;
  49716. },
  49717. lookupPrefix: function(namespaceURI) {
  49718. var el = this;
  49719. while (el) {
  49720. var map = el._nsMap;
  49721. if (map) {
  49722. for (var n in map) {
  49723. if (Object.prototype.hasOwnProperty.call(map, n) && map[n] === namespaceURI) {
  49724. return n;
  49725. }
  49726. }
  49727. }
  49728. el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;
  49729. }
  49730. return null;
  49731. },
  49732. lookupNamespaceURI: function(prefix) {
  49733. var el = this;
  49734. while (el) {
  49735. var map = el._nsMap;
  49736. if (map) {
  49737. if (Object.prototype.hasOwnProperty.call(map, prefix)) {
  49738. return map[prefix];
  49739. }
  49740. }
  49741. el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;
  49742. }
  49743. return null;
  49744. },
  49745. isDefaultNamespace: function(namespaceURI) {
  49746. var prefix = this.lookupPrefix(namespaceURI);
  49747. return prefix == null;
  49748. }
  49749. };
  49750. function _xmlEncoder(c) {
  49751. return c == "<" && "&lt;" || c == ">" && "&gt;" || c == "&" && "&amp;" || c == '"' && "&quot;" || "&#" + c.charCodeAt() + ";";
  49752. }
  49753. copy(NodeType, Node);
  49754. copy(NodeType, Node.prototype);
  49755. function _visitNode(node, callback2) {
  49756. if (callback2(node)) {
  49757. return true;
  49758. }
  49759. if (node = node.firstChild) {
  49760. do {
  49761. if (_visitNode(node, callback2)) {
  49762. return true;
  49763. }
  49764. } while (node = node.nextSibling);
  49765. }
  49766. }
  49767. function Document() {
  49768. this.ownerDocument = this;
  49769. }
  49770. function _onAddAttribute(doc, el, newAttr) {
  49771. doc && doc._inc++;
  49772. var ns = newAttr.namespaceURI;
  49773. if (ns === NAMESPACE$2.XMLNS) {
  49774. el._nsMap[newAttr.prefix ? newAttr.localName : ""] = newAttr.value;
  49775. }
  49776. }
  49777. function _onRemoveAttribute(doc, el, newAttr, remove2) {
  49778. doc && doc._inc++;
  49779. var ns = newAttr.namespaceURI;
  49780. if (ns === NAMESPACE$2.XMLNS) {
  49781. delete el._nsMap[newAttr.prefix ? newAttr.localName : ""];
  49782. }
  49783. }
  49784. function _onUpdateChild(doc, el, newChild) {
  49785. if (doc && doc._inc) {
  49786. doc._inc++;
  49787. var cs = el.childNodes;
  49788. if (newChild) {
  49789. cs[cs.length++] = newChild;
  49790. } else {
  49791. var child = el.firstChild;
  49792. var i2 = 0;
  49793. while (child) {
  49794. cs[i2++] = child;
  49795. child = child.nextSibling;
  49796. }
  49797. cs.length = i2;
  49798. delete cs[cs.length];
  49799. }
  49800. }
  49801. }
  49802. function _removeChild(parentNode, child) {
  49803. var previous = child.previousSibling;
  49804. var next = child.nextSibling;
  49805. if (previous) {
  49806. previous.nextSibling = next;
  49807. } else {
  49808. parentNode.firstChild = next;
  49809. }
  49810. if (next) {
  49811. next.previousSibling = previous;
  49812. } else {
  49813. parentNode.lastChild = previous;
  49814. }
  49815. child.parentNode = null;
  49816. child.previousSibling = null;
  49817. child.nextSibling = null;
  49818. _onUpdateChild(parentNode.ownerDocument, parentNode);
  49819. return child;
  49820. }
  49821. function hasValidParentNodeType(node) {
  49822. return node && (node.nodeType === Node.DOCUMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.ELEMENT_NODE);
  49823. }
  49824. function hasInsertableNodeType(node) {
  49825. return node && (isElementNode(node) || isTextNode$2(node) || isDocTypeNode(node) || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.COMMENT_NODE || node.nodeType === Node.PROCESSING_INSTRUCTION_NODE);
  49826. }
  49827. function isDocTypeNode(node) {
  49828. return node && node.nodeType === Node.DOCUMENT_TYPE_NODE;
  49829. }
  49830. function isElementNode(node) {
  49831. return node && node.nodeType === Node.ELEMENT_NODE;
  49832. }
  49833. function isTextNode$2(node) {
  49834. return node && node.nodeType === Node.TEXT_NODE;
  49835. }
  49836. function isElementInsertionPossible(doc, child) {
  49837. var parentChildNodes = doc.childNodes || [];
  49838. if (find(parentChildNodes, isElementNode) || isDocTypeNode(child)) {
  49839. return false;
  49840. }
  49841. var docTypeNode = find(parentChildNodes, isDocTypeNode);
  49842. return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));
  49843. }
  49844. function isElementReplacementPossible(doc, child) {
  49845. var parentChildNodes = doc.childNodes || [];
  49846. function hasElementChildThatIsNotChild(node) {
  49847. return isElementNode(node) && node !== child;
  49848. }
  49849. if (find(parentChildNodes, hasElementChildThatIsNotChild)) {
  49850. return false;
  49851. }
  49852. var docTypeNode = find(parentChildNodes, isDocTypeNode);
  49853. return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));
  49854. }
  49855. function assertPreInsertionValidity1to5(parent, node, child) {
  49856. if (!hasValidParentNodeType(parent)) {
  49857. throw new DOMException(HIERARCHY_REQUEST_ERR, "Unexpected parent node type " + parent.nodeType);
  49858. }
  49859. if (child && child.parentNode !== parent) {
  49860. throw new DOMException(NOT_FOUND_ERR, "child not in parent");
  49861. }
  49862. if (!hasInsertableNodeType(node) || isDocTypeNode(node) && parent.nodeType !== Node.DOCUMENT_NODE) {
  49863. throw new DOMException(
  49864. HIERARCHY_REQUEST_ERR,
  49865. "Unexpected node type " + node.nodeType + " for parent node type " + parent.nodeType
  49866. );
  49867. }
  49868. }
  49869. function assertPreInsertionValidityInDocument(parent, node, child) {
  49870. var parentChildNodes = parent.childNodes || [];
  49871. var nodeChildNodes = node.childNodes || [];
  49872. if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
  49873. var nodeChildElements = nodeChildNodes.filter(isElementNode);
  49874. if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode$2)) {
  49875. throw new DOMException(HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
  49876. }
  49877. if (nodeChildElements.length === 1 && !isElementInsertionPossible(parent, child)) {
  49878. throw new DOMException(HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
  49879. }
  49880. }
  49881. if (isElementNode(node)) {
  49882. if (!isElementInsertionPossible(parent, child)) {
  49883. throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
  49884. }
  49885. }
  49886. if (isDocTypeNode(node)) {
  49887. if (find(parentChildNodes, isDocTypeNode)) {
  49888. throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
  49889. }
  49890. var parentElementChild = find(parentChildNodes, isElementNode);
  49891. if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {
  49892. throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
  49893. }
  49894. if (!child && parentElementChild) {
  49895. throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can not be appended since element is present");
  49896. }
  49897. }
  49898. }
  49899. function assertPreReplacementValidityInDocument(parent, node, child) {
  49900. var parentChildNodes = parent.childNodes || [];
  49901. var nodeChildNodes = node.childNodes || [];
  49902. if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
  49903. var nodeChildElements = nodeChildNodes.filter(isElementNode);
  49904. if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode$2)) {
  49905. throw new DOMException(HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
  49906. }
  49907. if (nodeChildElements.length === 1 && !isElementReplacementPossible(parent, child)) {
  49908. throw new DOMException(HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
  49909. }
  49910. }
  49911. if (isElementNode(node)) {
  49912. if (!isElementReplacementPossible(parent, child)) {
  49913. throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
  49914. }
  49915. }
  49916. if (isDocTypeNode(node)) {
  49917. let hasDoctypeChildThatIsNotChild = function(node2) {
  49918. return isDocTypeNode(node2) && node2 !== child;
  49919. };
  49920. if (find(parentChildNodes, hasDoctypeChildThatIsNotChild)) {
  49921. throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
  49922. }
  49923. var parentElementChild = find(parentChildNodes, isElementNode);
  49924. if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {
  49925. throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
  49926. }
  49927. }
  49928. }
  49929. function _insertBefore(parent, node, child, _inDocumentAssertion) {
  49930. assertPreInsertionValidity1to5(parent, node, child);
  49931. if (parent.nodeType === Node.DOCUMENT_NODE) {
  49932. (_inDocumentAssertion || assertPreInsertionValidityInDocument)(parent, node, child);
  49933. }
  49934. var cp = node.parentNode;
  49935. if (cp) {
  49936. cp.removeChild(node);
  49937. }
  49938. if (node.nodeType === DOCUMENT_FRAGMENT_NODE) {
  49939. var newFirst = node.firstChild;
  49940. if (newFirst == null) {
  49941. return node;
  49942. }
  49943. var newLast = node.lastChild;
  49944. } else {
  49945. newFirst = newLast = node;
  49946. }
  49947. var pre = child ? child.previousSibling : parent.lastChild;
  49948. newFirst.previousSibling = pre;
  49949. newLast.nextSibling = child;
  49950. if (pre) {
  49951. pre.nextSibling = newFirst;
  49952. } else {
  49953. parent.firstChild = newFirst;
  49954. }
  49955. if (child == null) {
  49956. parent.lastChild = newLast;
  49957. } else {
  49958. child.previousSibling = newLast;
  49959. }
  49960. do {
  49961. newFirst.parentNode = parent;
  49962. } while (newFirst !== newLast && (newFirst = newFirst.nextSibling));
  49963. _onUpdateChild(parent.ownerDocument || parent, parent);
  49964. if (node.nodeType == DOCUMENT_FRAGMENT_NODE) {
  49965. node.firstChild = node.lastChild = null;
  49966. }
  49967. return node;
  49968. }
  49969. function _appendSingleChild(parentNode, newChild) {
  49970. if (newChild.parentNode) {
  49971. newChild.parentNode.removeChild(newChild);
  49972. }
  49973. newChild.parentNode = parentNode;
  49974. newChild.previousSibling = parentNode.lastChild;
  49975. newChild.nextSibling = null;
  49976. if (newChild.previousSibling) {
  49977. newChild.previousSibling.nextSibling = newChild;
  49978. } else {
  49979. parentNode.firstChild = newChild;
  49980. }
  49981. parentNode.lastChild = newChild;
  49982. _onUpdateChild(parentNode.ownerDocument, parentNode, newChild);
  49983. return newChild;
  49984. }
  49985. Document.prototype = {
  49986. nodeName: "#document",
  49987. nodeType: DOCUMENT_NODE,
  49988. doctype: null,
  49989. documentElement: null,
  49990. _inc: 1,
  49991. insertBefore: function(newChild, refChild) {
  49992. if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) {
  49993. var child = newChild.firstChild;
  49994. while (child) {
  49995. var next = child.nextSibling;
  49996. this.insertBefore(child, refChild);
  49997. child = next;
  49998. }
  49999. return newChild;
  50000. }
  50001. _insertBefore(this, newChild, refChild);
  50002. newChild.ownerDocument = this;
  50003. if (this.documentElement === null && newChild.nodeType === ELEMENT_NODE) {
  50004. this.documentElement = newChild;
  50005. }
  50006. return newChild;
  50007. },
  50008. removeChild: function(oldChild) {
  50009. if (this.documentElement == oldChild) {
  50010. this.documentElement = null;
  50011. }
  50012. return _removeChild(this, oldChild);
  50013. },
  50014. replaceChild: function(newChild, oldChild) {
  50015. _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
  50016. newChild.ownerDocument = this;
  50017. if (oldChild) {
  50018. this.removeChild(oldChild);
  50019. }
  50020. if (isElementNode(newChild)) {
  50021. this.documentElement = newChild;
  50022. }
  50023. },
  50024. importNode: function(importedNode, deep) {
  50025. return importNode(this, importedNode, deep);
  50026. },
  50027. getElementById: function(id) {
  50028. var rtv = null;
  50029. _visitNode(this.documentElement, function(node) {
  50030. if (node.nodeType == ELEMENT_NODE) {
  50031. if (node.getAttribute("id") == id) {
  50032. rtv = node;
  50033. return true;
  50034. }
  50035. }
  50036. });
  50037. return rtv;
  50038. },
  50039. getElementsByClassName: function(classNames) {
  50040. var classNamesSet = toOrderedSet(classNames);
  50041. return new LiveNodeList(this, function(base2) {
  50042. var ls = [];
  50043. if (classNamesSet.length > 0) {
  50044. _visitNode(base2.documentElement, function(node) {
  50045. if (node !== base2 && node.nodeType === ELEMENT_NODE) {
  50046. var nodeClassNames = node.getAttribute("class");
  50047. if (nodeClassNames) {
  50048. var matches = classNames === nodeClassNames;
  50049. if (!matches) {
  50050. var nodeClassNamesSet = toOrderedSet(nodeClassNames);
  50051. matches = classNamesSet.every(arrayIncludes(nodeClassNamesSet));
  50052. }
  50053. if (matches) {
  50054. ls.push(node);
  50055. }
  50056. }
  50057. }
  50058. });
  50059. }
  50060. return ls;
  50061. });
  50062. },
  50063. createElement: function(tagName) {
  50064. var node = new Element$1();
  50065. node.ownerDocument = this;
  50066. node.nodeName = tagName;
  50067. node.tagName = tagName;
  50068. node.localName = tagName;
  50069. node.childNodes = new NodeList();
  50070. var attrs = node.attributes = new NamedNodeMap();
  50071. attrs._ownerElement = node;
  50072. return node;
  50073. },
  50074. createDocumentFragment: function() {
  50075. var node = new DocumentFragment();
  50076. node.ownerDocument = this;
  50077. node.childNodes = new NodeList();
  50078. return node;
  50079. },
  50080. createTextNode: function(data) {
  50081. var node = new Text();
  50082. node.ownerDocument = this;
  50083. node.appendData(data);
  50084. return node;
  50085. },
  50086. createComment: function(data) {
  50087. var node = new Comment();
  50088. node.ownerDocument = this;
  50089. node.appendData(data);
  50090. return node;
  50091. },
  50092. createCDATASection: function(data) {
  50093. var node = new CDATASection();
  50094. node.ownerDocument = this;
  50095. node.appendData(data);
  50096. return node;
  50097. },
  50098. createProcessingInstruction: function(target, data) {
  50099. var node = new ProcessingInstruction();
  50100. node.ownerDocument = this;
  50101. node.tagName = node.target = target;
  50102. node.nodeValue = node.data = data;
  50103. return node;
  50104. },
  50105. createAttribute: function(name) {
  50106. var node = new Attr();
  50107. node.ownerDocument = this;
  50108. node.name = name;
  50109. node.nodeName = name;
  50110. node.localName = name;
  50111. node.specified = true;
  50112. return node;
  50113. },
  50114. createEntityReference: function(name) {
  50115. var node = new EntityReference();
  50116. node.ownerDocument = this;
  50117. node.nodeName = name;
  50118. return node;
  50119. },
  50120. createElementNS: function(namespaceURI, qualifiedName) {
  50121. var node = new Element$1();
  50122. var pl = qualifiedName.split(":");
  50123. var attrs = node.attributes = new NamedNodeMap();
  50124. node.childNodes = new NodeList();
  50125. node.ownerDocument = this;
  50126. node.nodeName = qualifiedName;
  50127. node.tagName = qualifiedName;
  50128. node.namespaceURI = namespaceURI;
  50129. if (pl.length == 2) {
  50130. node.prefix = pl[0];
  50131. node.localName = pl[1];
  50132. } else {
  50133. node.localName = qualifiedName;
  50134. }
  50135. attrs._ownerElement = node;
  50136. return node;
  50137. },
  50138. createAttributeNS: function(namespaceURI, qualifiedName) {
  50139. var node = new Attr();
  50140. var pl = qualifiedName.split(":");
  50141. node.ownerDocument = this;
  50142. node.nodeName = qualifiedName;
  50143. node.name = qualifiedName;
  50144. node.namespaceURI = namespaceURI;
  50145. node.specified = true;
  50146. if (pl.length == 2) {
  50147. node.prefix = pl[0];
  50148. node.localName = pl[1];
  50149. } else {
  50150. node.localName = qualifiedName;
  50151. }
  50152. return node;
  50153. }
  50154. };
  50155. _extends(Document, Node);
  50156. function Element$1() {
  50157. this._nsMap = {};
  50158. }
  50159. Element$1.prototype = {
  50160. nodeType: ELEMENT_NODE,
  50161. hasAttribute: function(name) {
  50162. return this.getAttributeNode(name) != null;
  50163. },
  50164. getAttribute: function(name) {
  50165. var attr = this.getAttributeNode(name);
  50166. return attr && attr.value || "";
  50167. },
  50168. getAttributeNode: function(name) {
  50169. return this.attributes.getNamedItem(name);
  50170. },
  50171. setAttribute: function(name, value) {
  50172. var attr = this.ownerDocument.createAttribute(name);
  50173. attr.value = attr.nodeValue = "" + value;
  50174. this.setAttributeNode(attr);
  50175. },
  50176. removeAttribute: function(name) {
  50177. var attr = this.getAttributeNode(name);
  50178. attr && this.removeAttributeNode(attr);
  50179. },
  50180. appendChild: function(newChild) {
  50181. if (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) {
  50182. return this.insertBefore(newChild, null);
  50183. } else {
  50184. return _appendSingleChild(this, newChild);
  50185. }
  50186. },
  50187. setAttributeNode: function(newAttr) {
  50188. return this.attributes.setNamedItem(newAttr);
  50189. },
  50190. setAttributeNodeNS: function(newAttr) {
  50191. return this.attributes.setNamedItemNS(newAttr);
  50192. },
  50193. removeAttributeNode: function(oldAttr) {
  50194. return this.attributes.removeNamedItem(oldAttr.nodeName);
  50195. },
  50196. removeAttributeNS: function(namespaceURI, localName) {
  50197. var old = this.getAttributeNodeNS(namespaceURI, localName);
  50198. old && this.removeAttributeNode(old);
  50199. },
  50200. hasAttributeNS: function(namespaceURI, localName) {
  50201. return this.getAttributeNodeNS(namespaceURI, localName) != null;
  50202. },
  50203. getAttributeNS: function(namespaceURI, localName) {
  50204. var attr = this.getAttributeNodeNS(namespaceURI, localName);
  50205. return attr && attr.value || "";
  50206. },
  50207. setAttributeNS: function(namespaceURI, qualifiedName, value) {
  50208. var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);
  50209. attr.value = attr.nodeValue = "" + value;
  50210. this.setAttributeNode(attr);
  50211. },
  50212. getAttributeNodeNS: function(namespaceURI, localName) {
  50213. return this.attributes.getNamedItemNS(namespaceURI, localName);
  50214. },
  50215. getElementsByTagName: function(tagName) {
  50216. return new LiveNodeList(this, function(base2) {
  50217. var ls = [];
  50218. _visitNode(base2, function(node) {
  50219. if (node !== base2 && node.nodeType == ELEMENT_NODE && (tagName === "*" || node.tagName == tagName)) {
  50220. ls.push(node);
  50221. }
  50222. });
  50223. return ls;
  50224. });
  50225. },
  50226. getElementsByTagNameNS: function(namespaceURI, localName) {
  50227. return new LiveNodeList(this, function(base2) {
  50228. var ls = [];
  50229. _visitNode(base2, function(node) {
  50230. if (node !== base2 && node.nodeType === ELEMENT_NODE && (namespaceURI === "*" || node.namespaceURI === namespaceURI) && (localName === "*" || node.localName == localName)) {
  50231. ls.push(node);
  50232. }
  50233. });
  50234. return ls;
  50235. });
  50236. }
  50237. };
  50238. Document.prototype.getElementsByTagName = Element$1.prototype.getElementsByTagName;
  50239. Document.prototype.getElementsByTagNameNS = Element$1.prototype.getElementsByTagNameNS;
  50240. _extends(Element$1, Node);
  50241. function Attr() {
  50242. }
  50243. Attr.prototype.nodeType = ATTRIBUTE_NODE;
  50244. _extends(Attr, Node);
  50245. function CharacterData() {
  50246. }
  50247. CharacterData.prototype = {
  50248. data: "",
  50249. substringData: function(offset, count) {
  50250. return this.data.substring(offset, offset + count);
  50251. },
  50252. appendData: function(text) {
  50253. text = this.data + text;
  50254. this.nodeValue = this.data = text;
  50255. this.length = text.length;
  50256. },
  50257. insertData: function(offset, text) {
  50258. this.replaceData(offset, 0, text);
  50259. },
  50260. appendChild: function(newChild) {
  50261. throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]);
  50262. },
  50263. deleteData: function(offset, count) {
  50264. this.replaceData(offset, count, "");
  50265. },
  50266. replaceData: function(offset, count, text) {
  50267. var start2 = this.data.substring(0, offset);
  50268. var end = this.data.substring(offset + count);
  50269. text = start2 + text + end;
  50270. this.nodeValue = this.data = text;
  50271. this.length = text.length;
  50272. }
  50273. };
  50274. _extends(CharacterData, Node);
  50275. function Text() {
  50276. }
  50277. Text.prototype = {
  50278. nodeName: "#text",
  50279. nodeType: TEXT_NODE,
  50280. splitText: function(offset) {
  50281. var text = this.data;
  50282. var newText = text.substring(offset);
  50283. text = text.substring(0, offset);
  50284. this.data = this.nodeValue = text;
  50285. this.length = text.length;
  50286. var newNode = this.ownerDocument.createTextNode(newText);
  50287. if (this.parentNode) {
  50288. this.parentNode.insertBefore(newNode, this.nextSibling);
  50289. }
  50290. return newNode;
  50291. }
  50292. };
  50293. _extends(Text, CharacterData);
  50294. function Comment() {
  50295. }
  50296. Comment.prototype = {
  50297. nodeName: "#comment",
  50298. nodeType: COMMENT_NODE
  50299. };
  50300. _extends(Comment, CharacterData);
  50301. function CDATASection() {
  50302. }
  50303. CDATASection.prototype = {
  50304. nodeName: "#cdata-section",
  50305. nodeType: CDATA_SECTION_NODE
  50306. };
  50307. _extends(CDATASection, CharacterData);
  50308. function DocumentType() {
  50309. }
  50310. DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
  50311. _extends(DocumentType, Node);
  50312. function Notation() {
  50313. }
  50314. Notation.prototype.nodeType = NOTATION_NODE;
  50315. _extends(Notation, Node);
  50316. function Entity() {
  50317. }
  50318. Entity.prototype.nodeType = ENTITY_NODE;
  50319. _extends(Entity, Node);
  50320. function EntityReference() {
  50321. }
  50322. EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;
  50323. _extends(EntityReference, Node);
  50324. function DocumentFragment() {
  50325. }
  50326. DocumentFragment.prototype.nodeName = "#document-fragment";
  50327. DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE;
  50328. _extends(DocumentFragment, Node);
  50329. function ProcessingInstruction() {
  50330. }
  50331. ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;
  50332. _extends(ProcessingInstruction, Node);
  50333. function XMLSerializer() {
  50334. }
  50335. XMLSerializer.prototype.serializeToString = function(node, isHtml, nodeFilter) {
  50336. return nodeSerializeToString.call(node, isHtml, nodeFilter);
  50337. };
  50338. Node.prototype.toString = nodeSerializeToString;
  50339. function nodeSerializeToString(isHtml, nodeFilter) {
  50340. var buf = [];
  50341. var refNode = this.nodeType == 9 && this.documentElement || this;
  50342. var prefix = refNode.prefix;
  50343. var uri = refNode.namespaceURI;
  50344. if (uri && prefix == null) {
  50345. var prefix = refNode.lookupPrefix(uri);
  50346. if (prefix == null) {
  50347. var visibleNamespaces = [
  50348. { namespace: uri, prefix: null }
  50349. ];
  50350. }
  50351. }
  50352. serializeToString(this, buf, isHtml, nodeFilter, visibleNamespaces);
  50353. return buf.join("");
  50354. }
  50355. function needNamespaceDefine(node, isHTML, visibleNamespaces) {
  50356. var prefix = node.prefix || "";
  50357. var uri = node.namespaceURI;
  50358. if (!uri) {
  50359. return false;
  50360. }
  50361. if (prefix === "xml" && uri === NAMESPACE$2.XML || uri === NAMESPACE$2.XMLNS) {
  50362. return false;
  50363. }
  50364. var i2 = visibleNamespaces.length;
  50365. while (i2--) {
  50366. var ns = visibleNamespaces[i2];
  50367. if (ns.prefix === prefix) {
  50368. return ns.namespace !== uri;
  50369. }
  50370. }
  50371. return true;
  50372. }
  50373. function addSerializedAttribute(buf, qualifiedName, value) {
  50374. buf.push(" ", qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"');
  50375. }
  50376. function serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces) {
  50377. if (!visibleNamespaces) {
  50378. visibleNamespaces = [];
  50379. }
  50380. if (nodeFilter) {
  50381. node = nodeFilter(node);
  50382. if (node) {
  50383. if (typeof node == "string") {
  50384. buf.push(node);
  50385. return;
  50386. }
  50387. } else {
  50388. return;
  50389. }
  50390. }
  50391. switch (node.nodeType) {
  50392. case ELEMENT_NODE:
  50393. var attrs = node.attributes;
  50394. var len = attrs.length;
  50395. var child = node.firstChild;
  50396. var nodeName = node.tagName;
  50397. isHTML = NAMESPACE$2.isHTML(node.namespaceURI) || isHTML;
  50398. var prefixedNodeName = nodeName;
  50399. if (!isHTML && !node.prefix && node.namespaceURI) {
  50400. var defaultNS;
  50401. for (var ai = 0; ai < attrs.length; ai++) {
  50402. if (attrs.item(ai).name === "xmlns") {
  50403. defaultNS = attrs.item(ai).value;
  50404. break;
  50405. }
  50406. }
  50407. if (!defaultNS) {
  50408. for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
  50409. var namespace = visibleNamespaces[nsi];
  50410. if (namespace.prefix === "" && namespace.namespace === node.namespaceURI) {
  50411. defaultNS = namespace.namespace;
  50412. break;
  50413. }
  50414. }
  50415. }
  50416. if (defaultNS !== node.namespaceURI) {
  50417. for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
  50418. var namespace = visibleNamespaces[nsi];
  50419. if (namespace.namespace === node.namespaceURI) {
  50420. if (namespace.prefix) {
  50421. prefixedNodeName = namespace.prefix + ":" + nodeName;
  50422. }
  50423. break;
  50424. }
  50425. }
  50426. }
  50427. }
  50428. buf.push("<", prefixedNodeName);
  50429. for (var i2 = 0; i2 < len; i2++) {
  50430. var attr = attrs.item(i2);
  50431. if (attr.prefix == "xmlns") {
  50432. visibleNamespaces.push({ prefix: attr.localName, namespace: attr.value });
  50433. } else if (attr.nodeName == "xmlns") {
  50434. visibleNamespaces.push({ prefix: "", namespace: attr.value });
  50435. }
  50436. }
  50437. for (var i2 = 0; i2 < len; i2++) {
  50438. var attr = attrs.item(i2);
  50439. if (needNamespaceDefine(attr, isHTML, visibleNamespaces)) {
  50440. var prefix = attr.prefix || "";
  50441. var uri = attr.namespaceURI;
  50442. addSerializedAttribute(buf, prefix ? "xmlns:" + prefix : "xmlns", uri);
  50443. visibleNamespaces.push({ prefix, namespace: uri });
  50444. }
  50445. serializeToString(attr, buf, isHTML, nodeFilter, visibleNamespaces);
  50446. }
  50447. if (nodeName === prefixedNodeName && needNamespaceDefine(node, isHTML, visibleNamespaces)) {
  50448. var prefix = node.prefix || "";
  50449. var uri = node.namespaceURI;
  50450. addSerializedAttribute(buf, prefix ? "xmlns:" + prefix : "xmlns", uri);
  50451. visibleNamespaces.push({ prefix, namespace: uri });
  50452. }
  50453. if (child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) {
  50454. buf.push(">");
  50455. if (isHTML && /^script$/i.test(nodeName)) {
  50456. while (child) {
  50457. if (child.data) {
  50458. buf.push(child.data);
  50459. } else {
  50460. serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
  50461. }
  50462. child = child.nextSibling;
  50463. }
  50464. } else {
  50465. while (child) {
  50466. serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
  50467. child = child.nextSibling;
  50468. }
  50469. }
  50470. buf.push("</", prefixedNodeName, ">");
  50471. } else {
  50472. buf.push("/>");
  50473. }
  50474. return;
  50475. case DOCUMENT_NODE:
  50476. case DOCUMENT_FRAGMENT_NODE:
  50477. var child = node.firstChild;
  50478. while (child) {
  50479. serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
  50480. child = child.nextSibling;
  50481. }
  50482. return;
  50483. case ATTRIBUTE_NODE:
  50484. return addSerializedAttribute(buf, node.name, node.value);
  50485. case TEXT_NODE:
  50486. return buf.push(
  50487. node.data.replace(/[<&>]/g, _xmlEncoder)
  50488. );
  50489. case CDATA_SECTION_NODE:
  50490. return buf.push("<![CDATA[", node.data, "]]>");
  50491. case COMMENT_NODE:
  50492. return buf.push("<!--", node.data, "-->");
  50493. case DOCUMENT_TYPE_NODE:
  50494. var pubid = node.publicId;
  50495. var sysid = node.systemId;
  50496. buf.push("<!DOCTYPE ", node.name);
  50497. if (pubid) {
  50498. buf.push(" PUBLIC ", pubid);
  50499. if (sysid && sysid != ".") {
  50500. buf.push(" ", sysid);
  50501. }
  50502. buf.push(">");
  50503. } else if (sysid && sysid != ".") {
  50504. buf.push(" SYSTEM ", sysid, ">");
  50505. } else {
  50506. var sub = node.internalSubset;
  50507. if (sub) {
  50508. buf.push(" [", sub, "]");
  50509. }
  50510. buf.push(">");
  50511. }
  50512. return;
  50513. case PROCESSING_INSTRUCTION_NODE:
  50514. return buf.push("<?", node.target, " ", node.data, "?>");
  50515. case ENTITY_REFERENCE_NODE:
  50516. return buf.push("&", node.nodeName, ";");
  50517. default:
  50518. buf.push("??", node.nodeName);
  50519. }
  50520. }
  50521. function importNode(doc, node, deep) {
  50522. var node2;
  50523. switch (node.nodeType) {
  50524. case ELEMENT_NODE:
  50525. node2 = node.cloneNode(false);
  50526. node2.ownerDocument = doc;
  50527. case DOCUMENT_FRAGMENT_NODE:
  50528. break;
  50529. case ATTRIBUTE_NODE:
  50530. deep = true;
  50531. break;
  50532. }
  50533. if (!node2) {
  50534. node2 = node.cloneNode(false);
  50535. }
  50536. node2.ownerDocument = doc;
  50537. node2.parentNode = null;
  50538. if (deep) {
  50539. var child = node.firstChild;
  50540. while (child) {
  50541. node2.appendChild(importNode(doc, child, deep));
  50542. child = child.nextSibling;
  50543. }
  50544. }
  50545. return node2;
  50546. }
  50547. function cloneNode(doc, node, deep) {
  50548. var node2 = new node.constructor();
  50549. for (var n in node) {
  50550. if (Object.prototype.hasOwnProperty.call(node, n)) {
  50551. var v = node[n];
  50552. if (typeof v != "object") {
  50553. if (v != node2[n]) {
  50554. node2[n] = v;
  50555. }
  50556. }
  50557. }
  50558. }
  50559. if (node.childNodes) {
  50560. node2.childNodes = new NodeList();
  50561. }
  50562. node2.ownerDocument = doc;
  50563. switch (node2.nodeType) {
  50564. case ELEMENT_NODE:
  50565. var attrs = node.attributes;
  50566. var attrs2 = node2.attributes = new NamedNodeMap();
  50567. var len = attrs.length;
  50568. attrs2._ownerElement = node2;
  50569. for (var i2 = 0; i2 < len; i2++) {
  50570. node2.setAttributeNode(cloneNode(doc, attrs.item(i2), true));
  50571. }
  50572. break;
  50573. case ATTRIBUTE_NODE:
  50574. deep = true;
  50575. }
  50576. if (deep) {
  50577. var child = node.firstChild;
  50578. while (child) {
  50579. node2.appendChild(cloneNode(doc, child, deep));
  50580. child = child.nextSibling;
  50581. }
  50582. }
  50583. return node2;
  50584. }
  50585. function __set__(object, key, value) {
  50586. object[key] = value;
  50587. }
  50588. try {
  50589. if (Object.defineProperty) {
  50590. let getTextContent = function(node) {
  50591. switch (node.nodeType) {
  50592. case ELEMENT_NODE:
  50593. case DOCUMENT_FRAGMENT_NODE:
  50594. var buf = [];
  50595. node = node.firstChild;
  50596. while (node) {
  50597. if (node.nodeType !== 7 && node.nodeType !== 8) {
  50598. buf.push(getTextContent(node));
  50599. }
  50600. node = node.nextSibling;
  50601. }
  50602. return buf.join("");
  50603. default:
  50604. return node.nodeValue;
  50605. }
  50606. };
  50607. Object.defineProperty(LiveNodeList.prototype, "length", {
  50608. get: function() {
  50609. _updateLiveList(this);
  50610. return this.$$length;
  50611. }
  50612. });
  50613. Object.defineProperty(Node.prototype, "textContent", {
  50614. get: function() {
  50615. return getTextContent(this);
  50616. },
  50617. set: function(data) {
  50618. switch (this.nodeType) {
  50619. case ELEMENT_NODE:
  50620. case DOCUMENT_FRAGMENT_NODE:
  50621. while (this.firstChild) {
  50622. this.removeChild(this.firstChild);
  50623. }
  50624. if (data || String(data)) {
  50625. this.appendChild(this.ownerDocument.createTextNode(data));
  50626. }
  50627. break;
  50628. default:
  50629. this.data = data;
  50630. this.value = data;
  50631. this.nodeValue = data;
  50632. }
  50633. }
  50634. });
  50635. __set__ = function(object, key, value) {
  50636. object["$$" + key] = value;
  50637. };
  50638. }
  50639. } catch (e) {
  50640. }
  50641. dom$1.DocumentType = DocumentType;
  50642. dom$1.DOMException = DOMException;
  50643. dom$1.DOMImplementation = DOMImplementation$1;
  50644. dom$1.Element = Element$1;
  50645. dom$1.Node = Node;
  50646. dom$1.NodeList = NodeList;
  50647. dom$1.XMLSerializer = XMLSerializer;
  50648. var domParser = {};
  50649. var entities$1 = {};
  50650. (function(exports2) {
  50651. var freeze2 = conventions$2.freeze;
  50652. exports2.XML_ENTITIES = freeze2({ amp: "&", apos: "'", gt: ">", lt: "<", quot: '"' });
  50653. exports2.HTML_ENTITIES = freeze2({
  50654. lt: "<",
  50655. gt: ">",
  50656. amp: "&",
  50657. quot: '"',
  50658. apos: "'",
  50659. Agrave: "\xC0",
  50660. Aacute: "\xC1",
  50661. Acirc: "\xC2",
  50662. Atilde: "\xC3",
  50663. Auml: "\xC4",
  50664. Aring: "\xC5",
  50665. AElig: "\xC6",
  50666. Ccedil: "\xC7",
  50667. Egrave: "\xC8",
  50668. Eacute: "\xC9",
  50669. Ecirc: "\xCA",
  50670. Euml: "\xCB",
  50671. Igrave: "\xCC",
  50672. Iacute: "\xCD",
  50673. Icirc: "\xCE",
  50674. Iuml: "\xCF",
  50675. ETH: "\xD0",
  50676. Ntilde: "\xD1",
  50677. Ograve: "\xD2",
  50678. Oacute: "\xD3",
  50679. Ocirc: "\xD4",
  50680. Otilde: "\xD5",
  50681. Ouml: "\xD6",
  50682. Oslash: "\xD8",
  50683. Ugrave: "\xD9",
  50684. Uacute: "\xDA",
  50685. Ucirc: "\xDB",
  50686. Uuml: "\xDC",
  50687. Yacute: "\xDD",
  50688. THORN: "\xDE",
  50689. szlig: "\xDF",
  50690. agrave: "\xE0",
  50691. aacute: "\xE1",
  50692. acirc: "\xE2",
  50693. atilde: "\xE3",
  50694. auml: "\xE4",
  50695. aring: "\xE5",
  50696. aelig: "\xE6",
  50697. ccedil: "\xE7",
  50698. egrave: "\xE8",
  50699. eacute: "\xE9",
  50700. ecirc: "\xEA",
  50701. euml: "\xEB",
  50702. igrave: "\xEC",
  50703. iacute: "\xED",
  50704. icirc: "\xEE",
  50705. iuml: "\xEF",
  50706. eth: "\xF0",
  50707. ntilde: "\xF1",
  50708. ograve: "\xF2",
  50709. oacute: "\xF3",
  50710. ocirc: "\xF4",
  50711. otilde: "\xF5",
  50712. ouml: "\xF6",
  50713. oslash: "\xF8",
  50714. ugrave: "\xF9",
  50715. uacute: "\xFA",
  50716. ucirc: "\xFB",
  50717. uuml: "\xFC",
  50718. yacute: "\xFD",
  50719. thorn: "\xFE",
  50720. yuml: "\xFF",
  50721. nbsp: "\xA0",
  50722. iexcl: "\xA1",
  50723. cent: "\xA2",
  50724. pound: "\xA3",
  50725. curren: "\xA4",
  50726. yen: "\xA5",
  50727. brvbar: "\xA6",
  50728. sect: "\xA7",
  50729. uml: "\xA8",
  50730. copy: "\xA9",
  50731. ordf: "\xAA",
  50732. laquo: "\xAB",
  50733. not: "\xAC",
  50734. shy: "\xAD\xAD",
  50735. reg: "\xAE",
  50736. macr: "\xAF",
  50737. deg: "\xB0",
  50738. plusmn: "\xB1",
  50739. sup2: "\xB2",
  50740. sup3: "\xB3",
  50741. acute: "\xB4",
  50742. micro: "\xB5",
  50743. para: "\xB6",
  50744. middot: "\xB7",
  50745. cedil: "\xB8",
  50746. sup1: "\xB9",
  50747. ordm: "\xBA",
  50748. raquo: "\xBB",
  50749. frac14: "\xBC",
  50750. frac12: "\xBD",
  50751. frac34: "\xBE",
  50752. iquest: "\xBF",
  50753. times: "\xD7",
  50754. divide: "\xF7",
  50755. forall: "\u2200",
  50756. part: "\u2202",
  50757. exist: "\u2203",
  50758. empty: "\u2205",
  50759. nabla: "\u2207",
  50760. isin: "\u2208",
  50761. notin: "\u2209",
  50762. ni: "\u220B",
  50763. prod: "\u220F",
  50764. sum: "\u2211",
  50765. minus: "\u2212",
  50766. lowast: "\u2217",
  50767. radic: "\u221A",
  50768. prop: "\u221D",
  50769. infin: "\u221E",
  50770. ang: "\u2220",
  50771. and: "\u2227",
  50772. or: "\u2228",
  50773. cap: "\u2229",
  50774. cup: "\u222A",
  50775. "int": "\u222B",
  50776. there4: "\u2234",
  50777. sim: "\u223C",
  50778. cong: "\u2245",
  50779. asymp: "\u2248",
  50780. ne: "\u2260",
  50781. equiv: "\u2261",
  50782. le: "\u2264",
  50783. ge: "\u2265",
  50784. sub: "\u2282",
  50785. sup: "\u2283",
  50786. nsub: "\u2284",
  50787. sube: "\u2286",
  50788. supe: "\u2287",
  50789. oplus: "\u2295",
  50790. otimes: "\u2297",
  50791. perp: "\u22A5",
  50792. sdot: "\u22C5",
  50793. Alpha: "\u0391",
  50794. Beta: "\u0392",
  50795. Gamma: "\u0393",
  50796. Delta: "\u0394",
  50797. Epsilon: "\u0395",
  50798. Zeta: "\u0396",
  50799. Eta: "\u0397",
  50800. Theta: "\u0398",
  50801. Iota: "\u0399",
  50802. Kappa: "\u039A",
  50803. Lambda: "\u039B",
  50804. Mu: "\u039C",
  50805. Nu: "\u039D",
  50806. Xi: "\u039E",
  50807. Omicron: "\u039F",
  50808. Pi: "\u03A0",
  50809. Rho: "\u03A1",
  50810. Sigma: "\u03A3",
  50811. Tau: "\u03A4",
  50812. Upsilon: "\u03A5",
  50813. Phi: "\u03A6",
  50814. Chi: "\u03A7",
  50815. Psi: "\u03A8",
  50816. Omega: "\u03A9",
  50817. alpha: "\u03B1",
  50818. beta: "\u03B2",
  50819. gamma: "\u03B3",
  50820. delta: "\u03B4",
  50821. epsilon: "\u03B5",
  50822. zeta: "\u03B6",
  50823. eta: "\u03B7",
  50824. theta: "\u03B8",
  50825. iota: "\u03B9",
  50826. kappa: "\u03BA",
  50827. lambda: "\u03BB",
  50828. mu: "\u03BC",
  50829. nu: "\u03BD",
  50830. xi: "\u03BE",
  50831. omicron: "\u03BF",
  50832. pi: "\u03C0",
  50833. rho: "\u03C1",
  50834. sigmaf: "\u03C2",
  50835. sigma: "\u03C3",
  50836. tau: "\u03C4",
  50837. upsilon: "\u03C5",
  50838. phi: "\u03C6",
  50839. chi: "\u03C7",
  50840. psi: "\u03C8",
  50841. omega: "\u03C9",
  50842. thetasym: "\u03D1",
  50843. upsih: "\u03D2",
  50844. piv: "\u03D6",
  50845. OElig: "\u0152",
  50846. oelig: "\u0153",
  50847. Scaron: "\u0160",
  50848. scaron: "\u0161",
  50849. Yuml: "\u0178",
  50850. fnof: "\u0192",
  50851. circ: "\u02C6",
  50852. tilde: "\u02DC",
  50853. ensp: "\u2002",
  50854. emsp: "\u2003",
  50855. thinsp: "\u2009",
  50856. zwnj: "\u200C",
  50857. zwj: "\u200D",
  50858. lrm: "\u200E",
  50859. rlm: "\u200F",
  50860. ndash: "\u2013",
  50861. mdash: "\u2014",
  50862. lsquo: "\u2018",
  50863. rsquo: "\u2019",
  50864. sbquo: "\u201A",
  50865. ldquo: "\u201C",
  50866. rdquo: "\u201D",
  50867. bdquo: "\u201E",
  50868. dagger: "\u2020",
  50869. Dagger: "\u2021",
  50870. bull: "\u2022",
  50871. hellip: "\u2026",
  50872. permil: "\u2030",
  50873. prime: "\u2032",
  50874. Prime: "\u2033",
  50875. lsaquo: "\u2039",
  50876. rsaquo: "\u203A",
  50877. oline: "\u203E",
  50878. euro: "\u20AC",
  50879. trade: "\u2122",
  50880. larr: "\u2190",
  50881. uarr: "\u2191",
  50882. rarr: "\u2192",
  50883. darr: "\u2193",
  50884. harr: "\u2194",
  50885. crarr: "\u21B5",
  50886. lceil: "\u2308",
  50887. rceil: "\u2309",
  50888. lfloor: "\u230A",
  50889. rfloor: "\u230B",
  50890. loz: "\u25CA",
  50891. spades: "\u2660",
  50892. clubs: "\u2663",
  50893. hearts: "\u2665",
  50894. diams: "\u2666"
  50895. });
  50896. exports2.entityMap = exports2.HTML_ENTITIES;
  50897. })(entities$1);
  50898. var sax$1 = {};
  50899. var NAMESPACE$1 = conventions$2.NAMESPACE;
  50900. var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
  50901. var nameChar = new RegExp("[\\-\\.0-9" + nameStartChar.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
  50902. var tagNamePattern = new RegExp("^" + nameStartChar.source + nameChar.source + "*(?::" + nameStartChar.source + nameChar.source + "*)?$");
  50903. var S_TAG = 0;
  50904. var S_ATTR = 1;
  50905. var S_ATTR_SPACE = 2;
  50906. var S_EQ = 3;
  50907. var S_ATTR_NOQUOT_VALUE = 4;
  50908. var S_ATTR_END = 5;
  50909. var S_TAG_SPACE = 6;
  50910. var S_TAG_CLOSE = 7;
  50911. function ParseError$1(message, locator) {
  50912. this.message = message;
  50913. this.locator = locator;
  50914. if (Error.captureStackTrace)
  50915. Error.captureStackTrace(this, ParseError$1);
  50916. }
  50917. ParseError$1.prototype = new Error();
  50918. ParseError$1.prototype.name = ParseError$1.name;
  50919. function XMLReader$1() {
  50920. }
  50921. XMLReader$1.prototype = {
  50922. parse: function(source, defaultNSMap, entityMap) {
  50923. var domBuilder = this.domBuilder;
  50924. domBuilder.startDocument();
  50925. _copy(defaultNSMap, defaultNSMap = {});
  50926. parse$2(
  50927. source,
  50928. defaultNSMap,
  50929. entityMap,
  50930. domBuilder,
  50931. this.errorHandler
  50932. );
  50933. domBuilder.endDocument();
  50934. }
  50935. };
  50936. function parse$2(source, defaultNSMapCopy, entityMap, domBuilder, errorHandler) {
  50937. function fixedFromCharCode(code) {
  50938. if (code > 65535) {
  50939. code -= 65536;
  50940. var surrogate1 = 55296 + (code >> 10), surrogate2 = 56320 + (code & 1023);
  50941. return String.fromCharCode(surrogate1, surrogate2);
  50942. } else {
  50943. return String.fromCharCode(code);
  50944. }
  50945. }
  50946. function entityReplacer(a2) {
  50947. var k = a2.slice(1, -1);
  50948. if (Object.hasOwnProperty.call(entityMap, k)) {
  50949. return entityMap[k];
  50950. } else if (k.charAt(0) === "#") {
  50951. return fixedFromCharCode(parseInt(k.substr(1).replace("x", "0x")));
  50952. } else {
  50953. errorHandler.error("entity not found:" + a2);
  50954. return a2;
  50955. }
  50956. }
  50957. function appendText(end2) {
  50958. if (end2 > start2) {
  50959. var xt2 = source.substring(start2, end2).replace(/&#?\w+;/g, entityReplacer);
  50960. locator && position2(start2);
  50961. domBuilder.characters(xt2, 0, end2 - start2);
  50962. start2 = end2;
  50963. }
  50964. }
  50965. function position2(p, m) {
  50966. while (p >= lineEnd && (m = linePattern.exec(source))) {
  50967. lineStart = m.index;
  50968. lineEnd = lineStart + m[0].length;
  50969. locator.lineNumber++;
  50970. }
  50971. locator.columnNumber = p - lineStart + 1;
  50972. }
  50973. var lineStart = 0;
  50974. var lineEnd = 0;
  50975. var linePattern = /.*(?:\r\n?|\n)|.*$/g;
  50976. var locator = domBuilder.locator;
  50977. var parseStack = [{ currentNSMap: defaultNSMapCopy }];
  50978. var closeMap = {};
  50979. var start2 = 0;
  50980. while (true) {
  50981. try {
  50982. var tagStart = source.indexOf("<", start2);
  50983. if (tagStart < 0) {
  50984. if (!source.substr(start2).match(/^\s*$/)) {
  50985. var doc = domBuilder.doc;
  50986. var text = doc.createTextNode(source.substr(start2));
  50987. doc.appendChild(text);
  50988. domBuilder.currentElement = text;
  50989. }
  50990. return;
  50991. }
  50992. if (tagStart > start2) {
  50993. appendText(tagStart);
  50994. }
  50995. switch (source.charAt(tagStart + 1)) {
  50996. case "/":
  50997. var end = source.indexOf(">", tagStart + 3);
  50998. var tagName = source.substring(tagStart + 2, end).replace(/[ \t\n\r]+$/g, "");
  50999. var config = parseStack.pop();
  51000. if (end < 0) {
  51001. tagName = source.substring(tagStart + 2).replace(/[\s<].*/, "");
  51002. errorHandler.error("end tag name: " + tagName + " is not complete:" + config.tagName);
  51003. end = tagStart + 1 + tagName.length;
  51004. } else if (tagName.match(/\s</)) {
  51005. tagName = tagName.replace(/[\s<].*/, "");
  51006. errorHandler.error("end tag name: " + tagName + " maybe not complete");
  51007. end = tagStart + 1 + tagName.length;
  51008. }
  51009. var localNSMap = config.localNSMap;
  51010. var endMatch = config.tagName == tagName;
  51011. var endIgnoreCaseMach = endMatch || config.tagName && config.tagName.toLowerCase() == tagName.toLowerCase();
  51012. if (endIgnoreCaseMach) {
  51013. domBuilder.endElement(config.uri, config.localName, tagName);
  51014. if (localNSMap) {
  51015. for (var prefix in localNSMap) {
  51016. if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
  51017. domBuilder.endPrefixMapping(prefix);
  51018. }
  51019. }
  51020. }
  51021. if (!endMatch) {
  51022. errorHandler.fatalError("end tag name: " + tagName + " is not match the current start tagName:" + config.tagName);
  51023. }
  51024. } else {
  51025. parseStack.push(config);
  51026. }
  51027. end++;
  51028. break;
  51029. case "?":
  51030. locator && position2(tagStart);
  51031. end = parseInstruction(source, tagStart, domBuilder);
  51032. break;
  51033. case "!":
  51034. locator && position2(tagStart);
  51035. end = parseDCC(source, tagStart, domBuilder, errorHandler);
  51036. break;
  51037. default:
  51038. locator && position2(tagStart);
  51039. var el = new ElementAttributes();
  51040. var currentNSMap = parseStack[parseStack.length - 1].currentNSMap;
  51041. var end = parseElementStartPart(source, tagStart, el, currentNSMap, entityReplacer, errorHandler);
  51042. var len = el.length;
  51043. if (!el.closed && fixSelfClosed(source, end, el.tagName, closeMap)) {
  51044. el.closed = true;
  51045. if (!entityMap.nbsp) {
  51046. errorHandler.warning("unclosed xml attribute");
  51047. }
  51048. }
  51049. if (locator && len) {
  51050. var locator2 = copyLocator(locator, {});
  51051. for (var i2 = 0; i2 < len; i2++) {
  51052. var a = el[i2];
  51053. position2(a.offset);
  51054. a.locator = copyLocator(locator, {});
  51055. }
  51056. domBuilder.locator = locator2;
  51057. if (appendElement$1(el, domBuilder, currentNSMap)) {
  51058. parseStack.push(el);
  51059. }
  51060. domBuilder.locator = locator;
  51061. } else {
  51062. if (appendElement$1(el, domBuilder, currentNSMap)) {
  51063. parseStack.push(el);
  51064. }
  51065. }
  51066. if (NAMESPACE$1.isHTML(el.uri) && !el.closed) {
  51067. end = parseHtmlSpecialContent(source, end, el.tagName, entityReplacer, domBuilder);
  51068. } else {
  51069. end++;
  51070. }
  51071. }
  51072. } catch (e) {
  51073. if (e instanceof ParseError$1) {
  51074. throw e;
  51075. }
  51076. errorHandler.error("element parse error: " + e);
  51077. end = -1;
  51078. }
  51079. if (end > start2) {
  51080. start2 = end;
  51081. } else {
  51082. appendText(Math.max(tagStart, start2) + 1);
  51083. }
  51084. }
  51085. }
  51086. function copyLocator(f, t2) {
  51087. t2.lineNumber = f.lineNumber;
  51088. t2.columnNumber = f.columnNumber;
  51089. return t2;
  51090. }
  51091. function parseElementStartPart(source, start2, el, currentNSMap, entityReplacer, errorHandler) {
  51092. function addAttribute(qname, value2, startIndex) {
  51093. if (el.attributeNames.hasOwnProperty(qname)) {
  51094. errorHandler.fatalError("Attribute " + qname + " redefined");
  51095. }
  51096. el.addValue(
  51097. qname,
  51098. value2.replace(/[\t\n\r]/g, " ").replace(/&#?\w+;/g, entityReplacer),
  51099. startIndex
  51100. );
  51101. }
  51102. var attrName;
  51103. var value;
  51104. var p = ++start2;
  51105. var s = S_TAG;
  51106. while (true) {
  51107. var c = source.charAt(p);
  51108. switch (c) {
  51109. case "=":
  51110. if (s === S_ATTR) {
  51111. attrName = source.slice(start2, p);
  51112. s = S_EQ;
  51113. } else if (s === S_ATTR_SPACE) {
  51114. s = S_EQ;
  51115. } else {
  51116. throw new Error("attribute equal must after attrName");
  51117. }
  51118. break;
  51119. case "'":
  51120. case '"':
  51121. if (s === S_EQ || s === S_ATTR) {
  51122. if (s === S_ATTR) {
  51123. errorHandler.warning('attribute value must after "="');
  51124. attrName = source.slice(start2, p);
  51125. }
  51126. start2 = p + 1;
  51127. p = source.indexOf(c, start2);
  51128. if (p > 0) {
  51129. value = source.slice(start2, p);
  51130. addAttribute(attrName, value, start2 - 1);
  51131. s = S_ATTR_END;
  51132. } else {
  51133. throw new Error("attribute value no end '" + c + "' match");
  51134. }
  51135. } else if (s == S_ATTR_NOQUOT_VALUE) {
  51136. value = source.slice(start2, p);
  51137. addAttribute(attrName, value, start2);
  51138. errorHandler.warning('attribute "' + attrName + '" missed start quot(' + c + ")!!");
  51139. start2 = p + 1;
  51140. s = S_ATTR_END;
  51141. } else {
  51142. throw new Error('attribute value must after "="');
  51143. }
  51144. break;
  51145. case "/":
  51146. switch (s) {
  51147. case S_TAG:
  51148. el.setTagName(source.slice(start2, p));
  51149. case S_ATTR_END:
  51150. case S_TAG_SPACE:
  51151. case S_TAG_CLOSE:
  51152. s = S_TAG_CLOSE;
  51153. el.closed = true;
  51154. case S_ATTR_NOQUOT_VALUE:
  51155. case S_ATTR:
  51156. break;
  51157. case S_ATTR_SPACE:
  51158. el.closed = true;
  51159. break;
  51160. default:
  51161. throw new Error("attribute invalid close char('/')");
  51162. }
  51163. break;
  51164. case "":
  51165. errorHandler.error("unexpected end of input");
  51166. if (s == S_TAG) {
  51167. el.setTagName(source.slice(start2, p));
  51168. }
  51169. return p;
  51170. case ">":
  51171. switch (s) {
  51172. case S_TAG:
  51173. el.setTagName(source.slice(start2, p));
  51174. case S_ATTR_END:
  51175. case S_TAG_SPACE:
  51176. case S_TAG_CLOSE:
  51177. break;
  51178. case S_ATTR_NOQUOT_VALUE:
  51179. case S_ATTR:
  51180. value = source.slice(start2, p);
  51181. if (value.slice(-1) === "/") {
  51182. el.closed = true;
  51183. value = value.slice(0, -1);
  51184. }
  51185. case S_ATTR_SPACE:
  51186. if (s === S_ATTR_SPACE) {
  51187. value = attrName;
  51188. }
  51189. if (s == S_ATTR_NOQUOT_VALUE) {
  51190. errorHandler.warning('attribute "' + value + '" missed quot(")!');
  51191. addAttribute(attrName, value, start2);
  51192. } else {
  51193. if (!NAMESPACE$1.isHTML(currentNSMap[""]) || !value.match(/^(?:disabled|checked|selected)$/i)) {
  51194. errorHandler.warning('attribute "' + value + '" missed value!! "' + value + '" instead!!');
  51195. }
  51196. addAttribute(value, value, start2);
  51197. }
  51198. break;
  51199. case S_EQ:
  51200. throw new Error("attribute value missed!!");
  51201. }
  51202. return p;
  51203. case "\x80":
  51204. c = " ";
  51205. default:
  51206. if (c <= " ") {
  51207. switch (s) {
  51208. case S_TAG:
  51209. el.setTagName(source.slice(start2, p));
  51210. s = S_TAG_SPACE;
  51211. break;
  51212. case S_ATTR:
  51213. attrName = source.slice(start2, p);
  51214. s = S_ATTR_SPACE;
  51215. break;
  51216. case S_ATTR_NOQUOT_VALUE:
  51217. var value = source.slice(start2, p);
  51218. errorHandler.warning('attribute "' + value + '" missed quot(")!!');
  51219. addAttribute(attrName, value, start2);
  51220. case S_ATTR_END:
  51221. s = S_TAG_SPACE;
  51222. break;
  51223. }
  51224. } else {
  51225. switch (s) {
  51226. case S_ATTR_SPACE:
  51227. el.tagName;
  51228. if (!NAMESPACE$1.isHTML(currentNSMap[""]) || !attrName.match(/^(?:disabled|checked|selected)$/i)) {
  51229. errorHandler.warning('attribute "' + attrName + '" missed value!! "' + attrName + '" instead2!!');
  51230. }
  51231. addAttribute(attrName, attrName, start2);
  51232. start2 = p;
  51233. s = S_ATTR;
  51234. break;
  51235. case S_ATTR_END:
  51236. errorHandler.warning('attribute space is required"' + attrName + '"!!');
  51237. case S_TAG_SPACE:
  51238. s = S_ATTR;
  51239. start2 = p;
  51240. break;
  51241. case S_EQ:
  51242. s = S_ATTR_NOQUOT_VALUE;
  51243. start2 = p;
  51244. break;
  51245. case S_TAG_CLOSE:
  51246. throw new Error("elements closed character '/' and '>' must be connected to");
  51247. }
  51248. }
  51249. }
  51250. p++;
  51251. }
  51252. }
  51253. function appendElement$1(el, domBuilder, currentNSMap) {
  51254. var tagName = el.tagName;
  51255. var localNSMap = null;
  51256. var i2 = el.length;
  51257. while (i2--) {
  51258. var a = el[i2];
  51259. var qName = a.qName;
  51260. var value = a.value;
  51261. var nsp = qName.indexOf(":");
  51262. if (nsp > 0) {
  51263. var prefix = a.prefix = qName.slice(0, nsp);
  51264. var localName = qName.slice(nsp + 1);
  51265. var nsPrefix = prefix === "xmlns" && localName;
  51266. } else {
  51267. localName = qName;
  51268. prefix = null;
  51269. nsPrefix = qName === "xmlns" && "";
  51270. }
  51271. a.localName = localName;
  51272. if (nsPrefix !== false) {
  51273. if (localNSMap == null) {
  51274. localNSMap = {};
  51275. _copy(currentNSMap, currentNSMap = {});
  51276. }
  51277. currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
  51278. a.uri = NAMESPACE$1.XMLNS;
  51279. domBuilder.startPrefixMapping(nsPrefix, value);
  51280. }
  51281. }
  51282. var i2 = el.length;
  51283. while (i2--) {
  51284. a = el[i2];
  51285. var prefix = a.prefix;
  51286. if (prefix) {
  51287. if (prefix === "xml") {
  51288. a.uri = NAMESPACE$1.XML;
  51289. }
  51290. if (prefix !== "xmlns") {
  51291. a.uri = currentNSMap[prefix || ""];
  51292. }
  51293. }
  51294. }
  51295. var nsp = tagName.indexOf(":");
  51296. if (nsp > 0) {
  51297. prefix = el.prefix = tagName.slice(0, nsp);
  51298. localName = el.localName = tagName.slice(nsp + 1);
  51299. } else {
  51300. prefix = null;
  51301. localName = el.localName = tagName;
  51302. }
  51303. var ns = el.uri = currentNSMap[prefix || ""];
  51304. domBuilder.startElement(ns, localName, tagName, el);
  51305. if (el.closed) {
  51306. domBuilder.endElement(ns, localName, tagName);
  51307. if (localNSMap) {
  51308. for (prefix in localNSMap) {
  51309. if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
  51310. domBuilder.endPrefixMapping(prefix);
  51311. }
  51312. }
  51313. }
  51314. } else {
  51315. el.currentNSMap = currentNSMap;
  51316. el.localNSMap = localNSMap;
  51317. return true;
  51318. }
  51319. }
  51320. function parseHtmlSpecialContent(source, elStartEnd, tagName, entityReplacer, domBuilder) {
  51321. if (/^(?:script|textarea)$/i.test(tagName)) {
  51322. var elEndStart = source.indexOf("</" + tagName + ">", elStartEnd);
  51323. var text = source.substring(elStartEnd + 1, elEndStart);
  51324. if (/[&<]/.test(text)) {
  51325. if (/^script$/i.test(tagName)) {
  51326. domBuilder.characters(text, 0, text.length);
  51327. return elEndStart;
  51328. }
  51329. text = text.replace(/&#?\w+;/g, entityReplacer);
  51330. domBuilder.characters(text, 0, text.length);
  51331. return elEndStart;
  51332. }
  51333. }
  51334. return elStartEnd + 1;
  51335. }
  51336. function fixSelfClosed(source, elStartEnd, tagName, closeMap) {
  51337. var pos = closeMap[tagName];
  51338. if (pos == null) {
  51339. pos = source.lastIndexOf("</" + tagName + ">");
  51340. if (pos < elStartEnd) {
  51341. pos = source.lastIndexOf("</" + tagName);
  51342. }
  51343. closeMap[tagName] = pos;
  51344. }
  51345. return pos < elStartEnd;
  51346. }
  51347. function _copy(source, target) {
  51348. for (var n in source) {
  51349. if (Object.prototype.hasOwnProperty.call(source, n)) {
  51350. target[n] = source[n];
  51351. }
  51352. }
  51353. }
  51354. function parseDCC(source, start2, domBuilder, errorHandler) {
  51355. var next = source.charAt(start2 + 2);
  51356. switch (next) {
  51357. case "-":
  51358. if (source.charAt(start2 + 3) === "-") {
  51359. var end = source.indexOf("-->", start2 + 4);
  51360. if (end > start2) {
  51361. domBuilder.comment(source, start2 + 4, end - start2 - 4);
  51362. return end + 3;
  51363. } else {
  51364. errorHandler.error("Unclosed comment");
  51365. return -1;
  51366. }
  51367. } else {
  51368. return -1;
  51369. }
  51370. default:
  51371. if (source.substr(start2 + 3, 6) == "CDATA[") {
  51372. var end = source.indexOf("]]>", start2 + 9);
  51373. domBuilder.startCDATA();
  51374. domBuilder.characters(source, start2 + 9, end - start2 - 9);
  51375. domBuilder.endCDATA();
  51376. return end + 3;
  51377. }
  51378. var matchs = split(source, start2);
  51379. var len = matchs.length;
  51380. if (len > 1 && /!doctype/i.test(matchs[0][0])) {
  51381. var name = matchs[1][0];
  51382. var pubid = false;
  51383. var sysid = false;
  51384. if (len > 3) {
  51385. if (/^public$/i.test(matchs[2][0])) {
  51386. pubid = matchs[3][0];
  51387. sysid = len > 4 && matchs[4][0];
  51388. } else if (/^system$/i.test(matchs[2][0])) {
  51389. sysid = matchs[3][0];
  51390. }
  51391. }
  51392. var lastMatch = matchs[len - 1];
  51393. domBuilder.startDTD(name, pubid, sysid);
  51394. domBuilder.endDTD();
  51395. return lastMatch.index + lastMatch[0].length;
  51396. }
  51397. }
  51398. return -1;
  51399. }
  51400. function parseInstruction(source, start2, domBuilder) {
  51401. var end = source.indexOf("?>", start2);
  51402. if (end) {
  51403. var match = source.substring(start2, end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);
  51404. if (match) {
  51405. match[0].length;
  51406. domBuilder.processingInstruction(match[1], match[2]);
  51407. return end + 2;
  51408. } else {
  51409. return -1;
  51410. }
  51411. }
  51412. return -1;
  51413. }
  51414. function ElementAttributes() {
  51415. this.attributeNames = {};
  51416. }
  51417. ElementAttributes.prototype = {
  51418. setTagName: function(tagName) {
  51419. if (!tagNamePattern.test(tagName)) {
  51420. throw new Error("invalid tagName:" + tagName);
  51421. }
  51422. this.tagName = tagName;
  51423. },
  51424. addValue: function(qName, value, offset) {
  51425. if (!tagNamePattern.test(qName)) {
  51426. throw new Error("invalid attribute:" + qName);
  51427. }
  51428. this.attributeNames[qName] = this.length;
  51429. this[this.length++] = { qName, value, offset };
  51430. },
  51431. length: 0,
  51432. getLocalName: function(i2) {
  51433. return this[i2].localName;
  51434. },
  51435. getLocator: function(i2) {
  51436. return this[i2].locator;
  51437. },
  51438. getQName: function(i2) {
  51439. return this[i2].qName;
  51440. },
  51441. getURI: function(i2) {
  51442. return this[i2].uri;
  51443. },
  51444. getValue: function(i2) {
  51445. return this[i2].value;
  51446. }
  51447. };
  51448. function split(source, start2) {
  51449. var match;
  51450. var buf = [];
  51451. var reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;
  51452. reg.lastIndex = start2;
  51453. reg.exec(source);
  51454. while (match = reg.exec(source)) {
  51455. buf.push(match);
  51456. if (match[1])
  51457. return buf;
  51458. }
  51459. }
  51460. sax$1.XMLReader = XMLReader$1;
  51461. sax$1.ParseError = ParseError$1;
  51462. var conventions = conventions$2;
  51463. var dom = dom$1;
  51464. var entities = entities$1;
  51465. var sax = sax$1;
  51466. var DOMImplementation = dom.DOMImplementation;
  51467. var NAMESPACE = conventions.NAMESPACE;
  51468. var ParseError = sax.ParseError;
  51469. var XMLReader = sax.XMLReader;
  51470. function normalizeLineEndings(input) {
  51471. return input.replace(/\r[\n\u0085]/g, "\n").replace(/[\r\u0085\u2028]/g, "\n");
  51472. }
  51473. function DOMParser$1(options2) {
  51474. this.options = options2 || { locator: {} };
  51475. }
  51476. DOMParser$1.prototype.parseFromString = function(source, mimeType) {
  51477. var options2 = this.options;
  51478. var sax2 = new XMLReader();
  51479. var domBuilder = options2.domBuilder || new DOMHandler();
  51480. var errorHandler = options2.errorHandler;
  51481. var locator = options2.locator;
  51482. var defaultNSMap = options2.xmlns || {};
  51483. var isHTML = /\/x?html?$/.test(mimeType);
  51484. var entityMap = isHTML ? entities.HTML_ENTITIES : entities.XML_ENTITIES;
  51485. if (locator) {
  51486. domBuilder.setDocumentLocator(locator);
  51487. }
  51488. sax2.errorHandler = buildErrorHandler(errorHandler, domBuilder, locator);
  51489. sax2.domBuilder = options2.domBuilder || domBuilder;
  51490. if (isHTML) {
  51491. defaultNSMap[""] = NAMESPACE.HTML;
  51492. }
  51493. defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;
  51494. var normalize = options2.normalizeLineEndings || normalizeLineEndings;
  51495. if (source && typeof source === "string") {
  51496. sax2.parse(
  51497. normalize(source),
  51498. defaultNSMap,
  51499. entityMap
  51500. );
  51501. } else {
  51502. sax2.errorHandler.error("invalid doc source");
  51503. }
  51504. return domBuilder.doc;
  51505. };
  51506. function buildErrorHandler(errorImpl, domBuilder, locator) {
  51507. if (!errorImpl) {
  51508. if (domBuilder instanceof DOMHandler) {
  51509. return domBuilder;
  51510. }
  51511. errorImpl = domBuilder;
  51512. }
  51513. var errorHandler = {};
  51514. var isCallback = errorImpl instanceof Function;
  51515. locator = locator || {};
  51516. function build(key) {
  51517. var fn2 = errorImpl[key];
  51518. if (!fn2 && isCallback) {
  51519. fn2 = errorImpl.length == 2 ? function(msg) {
  51520. errorImpl(key, msg);
  51521. } : errorImpl;
  51522. }
  51523. errorHandler[key] = fn2 && function(msg) {
  51524. fn2("[xmldom " + key + "] " + msg + _locator(locator));
  51525. } || function() {
  51526. };
  51527. }
  51528. build("warning");
  51529. build("error");
  51530. build("fatalError");
  51531. return errorHandler;
  51532. }
  51533. function DOMHandler() {
  51534. this.cdata = false;
  51535. }
  51536. function position(locator, node) {
  51537. node.lineNumber = locator.lineNumber;
  51538. node.columnNumber = locator.columnNumber;
  51539. }
  51540. DOMHandler.prototype = {
  51541. startDocument: function() {
  51542. this.doc = new DOMImplementation().createDocument(null, null, null);
  51543. if (this.locator) {
  51544. this.doc.documentURI = this.locator.systemId;
  51545. }
  51546. },
  51547. startElement: function(namespaceURI, localName, qName, attrs) {
  51548. var doc = this.doc;
  51549. var el = doc.createElementNS(namespaceURI, qName || localName);
  51550. var len = attrs.length;
  51551. appendElement(this, el);
  51552. this.currentElement = el;
  51553. this.locator && position(this.locator, el);
  51554. for (var i2 = 0; i2 < len; i2++) {
  51555. var namespaceURI = attrs.getURI(i2);
  51556. var value = attrs.getValue(i2);
  51557. var qName = attrs.getQName(i2);
  51558. var attr = doc.createAttributeNS(namespaceURI, qName);
  51559. this.locator && position(attrs.getLocator(i2), attr);
  51560. attr.value = attr.nodeValue = value;
  51561. el.setAttributeNode(attr);
  51562. }
  51563. },
  51564. endElement: function(namespaceURI, localName, qName) {
  51565. var current = this.currentElement;
  51566. current.tagName;
  51567. this.currentElement = current.parentNode;
  51568. },
  51569. startPrefixMapping: function(prefix, uri) {
  51570. },
  51571. endPrefixMapping: function(prefix) {
  51572. },
  51573. processingInstruction: function(target, data) {
  51574. var ins = this.doc.createProcessingInstruction(target, data);
  51575. this.locator && position(this.locator, ins);
  51576. appendElement(this, ins);
  51577. },
  51578. ignorableWhitespace: function(ch, start2, length) {
  51579. },
  51580. characters: function(chars, start2, length) {
  51581. chars = _toString.apply(this, arguments);
  51582. if (chars) {
  51583. if (this.cdata) {
  51584. var charNode = this.doc.createCDATASection(chars);
  51585. } else {
  51586. var charNode = this.doc.createTextNode(chars);
  51587. }
  51588. if (this.currentElement) {
  51589. this.currentElement.appendChild(charNode);
  51590. } else if (/^\s*$/.test(chars)) {
  51591. this.doc.appendChild(charNode);
  51592. }
  51593. this.locator && position(this.locator, charNode);
  51594. }
  51595. },
  51596. skippedEntity: function(name) {
  51597. },
  51598. endDocument: function() {
  51599. this.doc.normalize();
  51600. },
  51601. setDocumentLocator: function(locator) {
  51602. if (this.locator = locator) {
  51603. locator.lineNumber = 0;
  51604. }
  51605. },
  51606. comment: function(chars, start2, length) {
  51607. chars = _toString.apply(this, arguments);
  51608. var comm = this.doc.createComment(chars);
  51609. this.locator && position(this.locator, comm);
  51610. appendElement(this, comm);
  51611. },
  51612. startCDATA: function() {
  51613. this.cdata = true;
  51614. },
  51615. endCDATA: function() {
  51616. this.cdata = false;
  51617. },
  51618. startDTD: function(name, publicId, systemId) {
  51619. var impl = this.doc.implementation;
  51620. if (impl && impl.createDocumentType) {
  51621. var dt2 = impl.createDocumentType(name, publicId, systemId);
  51622. this.locator && position(this.locator, dt2);
  51623. appendElement(this, dt2);
  51624. this.doc.doctype = dt2;
  51625. }
  51626. },
  51627. warning: function(error) {
  51628. console.warn("[xmldom warning] " + error, _locator(this.locator));
  51629. },
  51630. error: function(error) {
  51631. console.error("[xmldom error] " + error, _locator(this.locator));
  51632. },
  51633. fatalError: function(error) {
  51634. throw new ParseError(error, this.locator);
  51635. }
  51636. };
  51637. function _locator(l) {
  51638. if (l) {
  51639. return "\n@" + (l.systemId || "") + "#[line:" + l.lineNumber + ",col:" + l.columnNumber + "]";
  51640. }
  51641. }
  51642. function _toString(chars, start2, length) {
  51643. if (typeof chars == "string") {
  51644. return chars.substr(start2, length);
  51645. } else {
  51646. if (chars.length >= start2 + length || start2) {
  51647. return new java.lang.String(chars, start2, length) + "";
  51648. }
  51649. return chars;
  51650. }
  51651. }
  51652. "endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g, function(key) {
  51653. DOMHandler.prototype[key] = function() {
  51654. return null;
  51655. };
  51656. });
  51657. function appendElement(hander, node) {
  51658. if (!hander.currentElement) {
  51659. hander.doc.appendChild(node);
  51660. } else {
  51661. hander.currentElement.appendChild(node);
  51662. }
  51663. }
  51664. domParser.__DOMHandler = DOMHandler;
  51665. domParser.normalizeLineEndings = normalizeLineEndings;
  51666. domParser.DOMParser = DOMParser$1;
  51667. var DOMParser = domParser.DOMParser;
  51668. /*! @name mpd-parser @version 1.1.1 @license Apache-2.0 */
  51669. const isObject$3 = (obj) => {
  51670. return !!obj && typeof obj === "object";
  51671. };
  51672. const merge$3 = (...objects) => {
  51673. return objects.reduce((result, source) => {
  51674. if (typeof source !== "object") {
  51675. return result;
  51676. }
  51677. Object.keys(source).forEach((key) => {
  51678. if (Array.isArray(result[key]) && Array.isArray(source[key])) {
  51679. result[key] = result[key].concat(source[key]);
  51680. } else if (isObject$3(result[key]) && isObject$3(source[key])) {
  51681. result[key] = merge$3(result[key], source[key]);
  51682. } else {
  51683. result[key] = source[key];
  51684. }
  51685. });
  51686. return result;
  51687. }, {});
  51688. };
  51689. const values$1 = (o) => Object.keys(o).map((k) => o[k]);
  51690. const range$1 = (start2, end) => {
  51691. const result = [];
  51692. for (let i2 = start2; i2 < end; i2++) {
  51693. result.push(i2);
  51694. }
  51695. return result;
  51696. };
  51697. const flatten$1 = (lists) => lists.reduce((x, y) => x.concat(y), []);
  51698. const from$1 = (list) => {
  51699. if (!list.length) {
  51700. return [];
  51701. }
  51702. const result = [];
  51703. for (let i2 = 0; i2 < list.length; i2++) {
  51704. result.push(list[i2]);
  51705. }
  51706. return result;
  51707. };
  51708. const findIndexes$1 = (l, key) => l.reduce((a, e, i2) => {
  51709. if (e[key]) {
  51710. a.push(i2);
  51711. }
  51712. return a;
  51713. }, []);
  51714. const union$1 = (lists, keyFunction) => {
  51715. return values$1(lists.reduce((acc, list) => {
  51716. list.forEach((el) => {
  51717. acc[keyFunction(el)] = el;
  51718. });
  51719. return acc;
  51720. }, {}));
  51721. };
  51722. var errors$1 = {
  51723. INVALID_NUMBER_OF_PERIOD: "INVALID_NUMBER_OF_PERIOD",
  51724. DASH_EMPTY_MANIFEST: "DASH_EMPTY_MANIFEST",
  51725. DASH_INVALID_XML: "DASH_INVALID_XML",
  51726. NO_BASE_URL: "NO_BASE_URL",
  51727. MISSING_SEGMENT_INFORMATION: "MISSING_SEGMENT_INFORMATION",
  51728. SEGMENT_TIME_UNSPECIFIED: "SEGMENT_TIME_UNSPECIFIED",
  51729. UNSUPPORTED_UTC_TIMING_SCHEME: "UNSUPPORTED_UTC_TIMING_SCHEME"
  51730. };
  51731. const urlTypeToSegment$1 = ({
  51732. baseUrl = "",
  51733. source = "",
  51734. range: range3 = "",
  51735. indexRange = ""
  51736. }) => {
  51737. const segment = {
  51738. uri: source,
  51739. resolvedUri: resolveUrl$3(baseUrl || "", source)
  51740. };
  51741. if (range3 || indexRange) {
  51742. const rangeStr = range3 ? range3 : indexRange;
  51743. const ranges = rangeStr.split("-");
  51744. let startRange = window_1.BigInt ? window_1.BigInt(ranges[0]) : parseInt(ranges[0], 10);
  51745. let endRange = window_1.BigInt ? window_1.BigInt(ranges[1]) : parseInt(ranges[1], 10);
  51746. if (startRange < Number.MAX_SAFE_INTEGER && typeof startRange === "bigint") {
  51747. startRange = Number(startRange);
  51748. }
  51749. if (endRange < Number.MAX_SAFE_INTEGER && typeof endRange === "bigint") {
  51750. endRange = Number(endRange);
  51751. }
  51752. let length;
  51753. if (typeof endRange === "bigint" || typeof startRange === "bigint") {
  51754. length = window_1.BigInt(endRange) - window_1.BigInt(startRange) + window_1.BigInt(1);
  51755. } else {
  51756. length = endRange - startRange + 1;
  51757. }
  51758. if (typeof length === "bigint" && length < Number.MAX_SAFE_INTEGER) {
  51759. length = Number(length);
  51760. }
  51761. segment.byterange = {
  51762. length,
  51763. offset: startRange
  51764. };
  51765. }
  51766. return segment;
  51767. };
  51768. const byteRangeToString$1 = (byterange) => {
  51769. let endRange;
  51770. if (typeof byterange.offset === "bigint" || typeof byterange.length === "bigint") {
  51771. endRange = window_1.BigInt(byterange.offset) + window_1.BigInt(byterange.length) - window_1.BigInt(1);
  51772. } else {
  51773. endRange = byterange.offset + byterange.length - 1;
  51774. }
  51775. return `${byterange.offset}-${endRange}`;
  51776. };
  51777. const parseEndNumber$1 = (endNumber) => {
  51778. if (endNumber && typeof endNumber !== "number") {
  51779. endNumber = parseInt(endNumber, 10);
  51780. }
  51781. if (isNaN(endNumber)) {
  51782. return null;
  51783. }
  51784. return endNumber;
  51785. };
  51786. const segmentRange$1 = {
  51787. static(attributes) {
  51788. const {
  51789. duration: duration5,
  51790. timescale: timescale2 = 1,
  51791. sourceDuration,
  51792. periodDuration
  51793. } = attributes;
  51794. const endNumber = parseEndNumber$1(attributes.endNumber);
  51795. const segmentDuration = duration5 / timescale2;
  51796. if (typeof endNumber === "number") {
  51797. return {
  51798. start: 0,
  51799. end: endNumber
  51800. };
  51801. }
  51802. if (typeof periodDuration === "number") {
  51803. return {
  51804. start: 0,
  51805. end: periodDuration / segmentDuration
  51806. };
  51807. }
  51808. return {
  51809. start: 0,
  51810. end: sourceDuration / segmentDuration
  51811. };
  51812. },
  51813. dynamic(attributes) {
  51814. const {
  51815. NOW,
  51816. clientOffset,
  51817. availabilityStartTime: availabilityStartTime2,
  51818. timescale: timescale2 = 1,
  51819. duration: duration5,
  51820. periodStart = 0,
  51821. minimumUpdatePeriod: minimumUpdatePeriod2 = 0,
  51822. timeShiftBufferDepth: timeShiftBufferDepth2 = Infinity
  51823. } = attributes;
  51824. const endNumber = parseEndNumber$1(attributes.endNumber);
  51825. const now2 = (NOW + clientOffset) / 1e3;
  51826. const periodStartWC = availabilityStartTime2 + periodStart;
  51827. const periodEndWC = now2 + minimumUpdatePeriod2;
  51828. const periodDuration = periodEndWC - periodStartWC;
  51829. const segmentCount = Math.ceil(periodDuration * timescale2 / duration5);
  51830. const availableStart = Math.floor((now2 - periodStartWC - timeShiftBufferDepth2) * timescale2 / duration5);
  51831. const availableEnd = Math.floor((now2 - periodStartWC) * timescale2 / duration5);
  51832. return {
  51833. start: Math.max(0, availableStart),
  51834. end: typeof endNumber === "number" ? endNumber : Math.min(segmentCount, availableEnd)
  51835. };
  51836. }
  51837. };
  51838. const toSegments$1 = (attributes) => (number) => {
  51839. const {
  51840. duration: duration5,
  51841. timescale: timescale2 = 1,
  51842. periodStart,
  51843. startNumber: startNumber2 = 1
  51844. } = attributes;
  51845. return {
  51846. number: startNumber2 + number,
  51847. duration: duration5 / timescale2,
  51848. timeline: periodStart,
  51849. time: number * duration5
  51850. };
  51851. };
  51852. const parseByDuration$1 = (attributes) => {
  51853. const {
  51854. type: type2,
  51855. duration: duration5,
  51856. timescale: timescale2 = 1,
  51857. periodDuration,
  51858. sourceDuration
  51859. } = attributes;
  51860. const {
  51861. start: start2,
  51862. end
  51863. } = segmentRange$1[type2](attributes);
  51864. const segments = range$1(start2, end).map(toSegments$1(attributes));
  51865. if (type2 === "static") {
  51866. const index2 = segments.length - 1;
  51867. const sectionDuration = typeof periodDuration === "number" ? periodDuration : sourceDuration;
  51868. segments[index2].duration = sectionDuration - duration5 / timescale2 * index2;
  51869. }
  51870. return segments;
  51871. };
  51872. const segmentsFromBase$1 = (attributes) => {
  51873. const {
  51874. baseUrl,
  51875. initialization = {},
  51876. sourceDuration,
  51877. indexRange = "",
  51878. periodStart,
  51879. presentationTime,
  51880. number = 0,
  51881. duration: duration5
  51882. } = attributes;
  51883. if (!baseUrl) {
  51884. throw new Error(errors$1.NO_BASE_URL);
  51885. }
  51886. const initSegment = urlTypeToSegment$1({
  51887. baseUrl,
  51888. source: initialization.sourceURL,
  51889. range: initialization.range
  51890. });
  51891. const segment = urlTypeToSegment$1({
  51892. baseUrl,
  51893. source: baseUrl,
  51894. indexRange
  51895. });
  51896. segment.map = initSegment;
  51897. if (duration5) {
  51898. const segmentTimeInfo = parseByDuration$1(attributes);
  51899. if (segmentTimeInfo.length) {
  51900. segment.duration = segmentTimeInfo[0].duration;
  51901. segment.timeline = segmentTimeInfo[0].timeline;
  51902. }
  51903. } else if (sourceDuration) {
  51904. segment.duration = sourceDuration;
  51905. segment.timeline = periodStart;
  51906. }
  51907. segment.presentationTime = presentationTime || periodStart;
  51908. segment.number = number;
  51909. return [segment];
  51910. };
  51911. const addSidxSegmentsToPlaylist$1$1 = (playlist, sidx, baseUrl) => {
  51912. const initSegment = playlist.sidx.map ? playlist.sidx.map : null;
  51913. const sourceDuration = playlist.sidx.duration;
  51914. const timeline = playlist.timeline || 0;
  51915. const sidxByteRange = playlist.sidx.byterange;
  51916. const sidxEnd = sidxByteRange.offset + sidxByteRange.length;
  51917. const timescale2 = sidx.timescale;
  51918. const mediaReferences = sidx.references.filter((r2) => r2.referenceType !== 1);
  51919. const segments = [];
  51920. const type2 = playlist.endList ? "static" : "dynamic";
  51921. const periodStart = playlist.sidx.timeline;
  51922. let presentationTime = periodStart;
  51923. let number = playlist.mediaSequence || 0;
  51924. let startIndex;
  51925. if (typeof sidx.firstOffset === "bigint") {
  51926. startIndex = window_1.BigInt(sidxEnd) + sidx.firstOffset;
  51927. } else {
  51928. startIndex = sidxEnd + sidx.firstOffset;
  51929. }
  51930. for (let i2 = 0; i2 < mediaReferences.length; i2++) {
  51931. const reference = sidx.references[i2];
  51932. const size = reference.referencedSize;
  51933. const duration5 = reference.subsegmentDuration;
  51934. let endIndex;
  51935. if (typeof startIndex === "bigint") {
  51936. endIndex = startIndex + window_1.BigInt(size) - window_1.BigInt(1);
  51937. } else {
  51938. endIndex = startIndex + size - 1;
  51939. }
  51940. const indexRange = `${startIndex}-${endIndex}`;
  51941. const attributes = {
  51942. baseUrl,
  51943. timescale: timescale2,
  51944. timeline,
  51945. periodStart,
  51946. presentationTime,
  51947. number,
  51948. duration: duration5,
  51949. sourceDuration,
  51950. indexRange,
  51951. type: type2
  51952. };
  51953. const segment = segmentsFromBase$1(attributes)[0];
  51954. if (initSegment) {
  51955. segment.map = initSegment;
  51956. }
  51957. segments.push(segment);
  51958. if (typeof startIndex === "bigint") {
  51959. startIndex += window_1.BigInt(size);
  51960. } else {
  51961. startIndex += size;
  51962. }
  51963. presentationTime += duration5 / timescale2;
  51964. number++;
  51965. }
  51966. playlist.segments = segments;
  51967. return playlist;
  51968. };
  51969. const SUPPORTED_MEDIA_TYPES$1 = ["AUDIO", "SUBTITLES"];
  51970. const TIME_FUDGE$1 = 1 / 60;
  51971. const getUniqueTimelineStarts$1 = (timelineStarts) => {
  51972. return union$1(timelineStarts, ({
  51973. timeline
  51974. }) => timeline).sort((a, b) => a.timeline > b.timeline ? 1 : -1);
  51975. };
  51976. const findPlaylistWithName$1 = (playlists, name) => {
  51977. for (let i2 = 0; i2 < playlists.length; i2++) {
  51978. if (playlists[i2].attributes.NAME === name) {
  51979. return playlists[i2];
  51980. }
  51981. }
  51982. return null;
  51983. };
  51984. const getMediaGroupPlaylists$1 = (manifest) => {
  51985. let mediaGroupPlaylists = [];
  51986. forEachMediaGroup$3(manifest, SUPPORTED_MEDIA_TYPES$1, (properties, type2, group, label2) => {
  51987. mediaGroupPlaylists = mediaGroupPlaylists.concat(properties.playlists || []);
  51988. });
  51989. return mediaGroupPlaylists;
  51990. };
  51991. const updateMediaSequenceForPlaylist$1 = ({
  51992. playlist,
  51993. mediaSequence
  51994. }) => {
  51995. playlist.mediaSequence = mediaSequence;
  51996. playlist.segments.forEach((segment, index2) => {
  51997. segment.number = playlist.mediaSequence + index2;
  51998. });
  51999. };
  52000. const updateSequenceNumbers$1 = ({
  52001. oldPlaylists,
  52002. newPlaylists,
  52003. timelineStarts
  52004. }) => {
  52005. newPlaylists.forEach((playlist) => {
  52006. playlist.discontinuitySequence = timelineStarts.findIndex(function({
  52007. timeline
  52008. }) {
  52009. return timeline === playlist.timeline;
  52010. });
  52011. const oldPlaylist = findPlaylistWithName$1(oldPlaylists, playlist.attributes.NAME);
  52012. if (!oldPlaylist) {
  52013. return;
  52014. }
  52015. if (playlist.sidx) {
  52016. return;
  52017. }
  52018. const firstNewSegment = playlist.segments[0];
  52019. const oldMatchingSegmentIndex = oldPlaylist.segments.findIndex(function(oldSegment) {
  52020. return Math.abs(oldSegment.presentationTime - firstNewSegment.presentationTime) < TIME_FUDGE$1;
  52021. });
  52022. if (oldMatchingSegmentIndex === -1) {
  52023. updateMediaSequenceForPlaylist$1({
  52024. playlist,
  52025. mediaSequence: oldPlaylist.mediaSequence + oldPlaylist.segments.length
  52026. });
  52027. playlist.segments[0].discontinuity = true;
  52028. playlist.discontinuityStarts.unshift(0);
  52029. if (!oldPlaylist.segments.length && playlist.timeline > oldPlaylist.timeline || oldPlaylist.segments.length && playlist.timeline > oldPlaylist.segments[oldPlaylist.segments.length - 1].timeline) {
  52030. playlist.discontinuitySequence--;
  52031. }
  52032. return;
  52033. }
  52034. const oldMatchingSegment = oldPlaylist.segments[oldMatchingSegmentIndex];
  52035. if (oldMatchingSegment.discontinuity && !firstNewSegment.discontinuity) {
  52036. firstNewSegment.discontinuity = true;
  52037. playlist.discontinuityStarts.unshift(0);
  52038. playlist.discontinuitySequence--;
  52039. }
  52040. updateMediaSequenceForPlaylist$1({
  52041. playlist,
  52042. mediaSequence: oldPlaylist.segments[oldMatchingSegmentIndex].number
  52043. });
  52044. });
  52045. };
  52046. const positionManifestOnTimeline$1 = ({
  52047. oldManifest,
  52048. newManifest
  52049. }) => {
  52050. const oldPlaylists = oldManifest.playlists.concat(getMediaGroupPlaylists$1(oldManifest));
  52051. const newPlaylists = newManifest.playlists.concat(getMediaGroupPlaylists$1(newManifest));
  52052. newManifest.timelineStarts = getUniqueTimelineStarts$1([oldManifest.timelineStarts, newManifest.timelineStarts]);
  52053. updateSequenceNumbers$1({
  52054. oldPlaylists,
  52055. newPlaylists,
  52056. timelineStarts: newManifest.timelineStarts
  52057. });
  52058. return newManifest;
  52059. };
  52060. const generateSidxKey$1 = (sidx) => sidx && sidx.uri + "-" + byteRangeToString$1(sidx.byterange);
  52061. const mergeDiscontiguousPlaylists$1 = (playlists) => {
  52062. const mergedPlaylists = values$1(playlists.reduce((acc, playlist) => {
  52063. const name = playlist.attributes.id + (playlist.attributes.lang || "");
  52064. if (!acc[name]) {
  52065. acc[name] = playlist;
  52066. acc[name].attributes.timelineStarts = [];
  52067. } else {
  52068. if (playlist.segments) {
  52069. if (playlist.segments[0]) {
  52070. playlist.segments[0].discontinuity = true;
  52071. }
  52072. acc[name].segments.push(...playlist.segments);
  52073. }
  52074. if (playlist.attributes.contentProtection) {
  52075. acc[name].attributes.contentProtection = playlist.attributes.contentProtection;
  52076. }
  52077. }
  52078. acc[name].attributes.timelineStarts.push({
  52079. start: playlist.attributes.periodStart,
  52080. timeline: playlist.attributes.periodStart
  52081. });
  52082. return acc;
  52083. }, {}));
  52084. return mergedPlaylists.map((playlist) => {
  52085. playlist.discontinuityStarts = findIndexes$1(playlist.segments || [], "discontinuity");
  52086. return playlist;
  52087. });
  52088. };
  52089. const addSidxSegmentsToPlaylist$2 = (playlist, sidxMapping) => {
  52090. const sidxKey = generateSidxKey$1(playlist.sidx);
  52091. const sidxMatch = sidxKey && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx;
  52092. if (sidxMatch) {
  52093. addSidxSegmentsToPlaylist$1$1(playlist, sidxMatch, playlist.sidx.resolvedUri);
  52094. }
  52095. return playlist;
  52096. };
  52097. const addSidxSegmentsToPlaylists$1 = (playlists, sidxMapping = {}) => {
  52098. if (!Object.keys(sidxMapping).length) {
  52099. return playlists;
  52100. }
  52101. for (const i2 in playlists) {
  52102. playlists[i2] = addSidxSegmentsToPlaylist$2(playlists[i2], sidxMapping);
  52103. }
  52104. return playlists;
  52105. };
  52106. const formatAudioPlaylist$1 = ({
  52107. attributes,
  52108. segments,
  52109. sidx,
  52110. mediaSequence,
  52111. discontinuitySequence,
  52112. discontinuityStarts
  52113. }, isAudioOnly3) => {
  52114. const playlist = {
  52115. attributes: {
  52116. NAME: attributes.id,
  52117. BANDWIDTH: attributes.bandwidth,
  52118. CODECS: attributes.codecs,
  52119. ["PROGRAM-ID"]: 1
  52120. },
  52121. uri: "",
  52122. endList: attributes.type === "static",
  52123. timeline: attributes.periodStart,
  52124. resolvedUri: "",
  52125. targetDuration: attributes.duration,
  52126. discontinuitySequence,
  52127. discontinuityStarts,
  52128. timelineStarts: attributes.timelineStarts,
  52129. mediaSequence,
  52130. segments
  52131. };
  52132. if (attributes.contentProtection) {
  52133. playlist.contentProtection = attributes.contentProtection;
  52134. }
  52135. if (sidx) {
  52136. playlist.sidx = sidx;
  52137. }
  52138. if (isAudioOnly3) {
  52139. playlist.attributes.AUDIO = "audio";
  52140. playlist.attributes.SUBTITLES = "subs";
  52141. }
  52142. return playlist;
  52143. };
  52144. const formatVttPlaylist$1 = ({
  52145. attributes,
  52146. segments,
  52147. mediaSequence,
  52148. discontinuityStarts,
  52149. discontinuitySequence
  52150. }) => {
  52151. if (typeof segments === "undefined") {
  52152. segments = [{
  52153. uri: attributes.baseUrl,
  52154. timeline: attributes.periodStart,
  52155. resolvedUri: attributes.baseUrl || "",
  52156. duration: attributes.sourceDuration,
  52157. number: 0
  52158. }];
  52159. attributes.duration = attributes.sourceDuration;
  52160. }
  52161. const m3u8Attributes = {
  52162. NAME: attributes.id,
  52163. BANDWIDTH: attributes.bandwidth,
  52164. ["PROGRAM-ID"]: 1
  52165. };
  52166. if (attributes.codecs) {
  52167. m3u8Attributes.CODECS = attributes.codecs;
  52168. }
  52169. return {
  52170. attributes: m3u8Attributes,
  52171. uri: "",
  52172. endList: attributes.type === "static",
  52173. timeline: attributes.periodStart,
  52174. resolvedUri: attributes.baseUrl || "",
  52175. targetDuration: attributes.duration,
  52176. timelineStarts: attributes.timelineStarts,
  52177. discontinuityStarts,
  52178. discontinuitySequence,
  52179. mediaSequence,
  52180. segments
  52181. };
  52182. };
  52183. const organizeAudioPlaylists$1 = (playlists, sidxMapping = {}, isAudioOnly3 = false) => {
  52184. let mainPlaylist;
  52185. const formattedPlaylists = playlists.reduce((a, playlist) => {
  52186. const role = playlist.attributes.role && playlist.attributes.role.value || "";
  52187. const language = playlist.attributes.lang || "";
  52188. let label2 = playlist.attributes.label || "main";
  52189. if (language && !playlist.attributes.label) {
  52190. const roleLabel = role ? ` (${role})` : "";
  52191. label2 = `${playlist.attributes.lang}${roleLabel}`;
  52192. }
  52193. if (!a[label2]) {
  52194. a[label2] = {
  52195. language,
  52196. autoselect: true,
  52197. default: role === "main",
  52198. playlists: [],
  52199. uri: ""
  52200. };
  52201. }
  52202. const formatted = addSidxSegmentsToPlaylist$2(formatAudioPlaylist$1(playlist, isAudioOnly3), sidxMapping);
  52203. a[label2].playlists.push(formatted);
  52204. if (typeof mainPlaylist === "undefined" && role === "main") {
  52205. mainPlaylist = playlist;
  52206. mainPlaylist.default = true;
  52207. }
  52208. return a;
  52209. }, {});
  52210. if (!mainPlaylist) {
  52211. const firstLabel = Object.keys(formattedPlaylists)[0];
  52212. formattedPlaylists[firstLabel].default = true;
  52213. }
  52214. return formattedPlaylists;
  52215. };
  52216. const organizeVttPlaylists$1 = (playlists, sidxMapping = {}) => {
  52217. return playlists.reduce((a, playlist) => {
  52218. const label2 = playlist.attributes.label || playlist.attributes.lang || "text";
  52219. if (!a[label2]) {
  52220. a[label2] = {
  52221. language: label2,
  52222. default: false,
  52223. autoselect: false,
  52224. playlists: [],
  52225. uri: ""
  52226. };
  52227. }
  52228. a[label2].playlists.push(addSidxSegmentsToPlaylist$2(formatVttPlaylist$1(playlist), sidxMapping));
  52229. return a;
  52230. }, {});
  52231. };
  52232. const organizeCaptionServices$1 = (captionServices) => captionServices.reduce((svcObj, svc) => {
  52233. if (!svc) {
  52234. return svcObj;
  52235. }
  52236. svc.forEach((service) => {
  52237. const {
  52238. channel,
  52239. language
  52240. } = service;
  52241. svcObj[language] = {
  52242. autoselect: false,
  52243. default: false,
  52244. instreamId: channel,
  52245. language
  52246. };
  52247. if (service.hasOwnProperty("aspectRatio")) {
  52248. svcObj[language].aspectRatio = service.aspectRatio;
  52249. }
  52250. if (service.hasOwnProperty("easyReader")) {
  52251. svcObj[language].easyReader = service.easyReader;
  52252. }
  52253. if (service.hasOwnProperty("3D")) {
  52254. svcObj[language]["3D"] = service["3D"];
  52255. }
  52256. });
  52257. return svcObj;
  52258. }, {});
  52259. const formatVideoPlaylist$1 = ({
  52260. attributes,
  52261. segments,
  52262. sidx,
  52263. discontinuityStarts
  52264. }) => {
  52265. const playlist = {
  52266. attributes: {
  52267. NAME: attributes.id,
  52268. AUDIO: "audio",
  52269. SUBTITLES: "subs",
  52270. RESOLUTION: {
  52271. width: attributes.width,
  52272. height: attributes.height
  52273. },
  52274. CODECS: attributes.codecs,
  52275. BANDWIDTH: attributes.bandwidth,
  52276. ["PROGRAM-ID"]: 1
  52277. },
  52278. uri: "",
  52279. endList: attributes.type === "static",
  52280. timeline: attributes.periodStart,
  52281. resolvedUri: "",
  52282. targetDuration: attributes.duration,
  52283. discontinuityStarts,
  52284. timelineStarts: attributes.timelineStarts,
  52285. segments
  52286. };
  52287. if (attributes.frameRate) {
  52288. playlist.attributes["FRAME-RATE"] = attributes.frameRate;
  52289. }
  52290. if (attributes.contentProtection) {
  52291. playlist.contentProtection = attributes.contentProtection;
  52292. }
  52293. if (sidx) {
  52294. playlist.sidx = sidx;
  52295. }
  52296. return playlist;
  52297. };
  52298. const videoOnly$1 = ({
  52299. attributes
  52300. }) => attributes.mimeType === "video/mp4" || attributes.mimeType === "video/webm" || attributes.contentType === "video";
  52301. const audioOnly$1 = ({
  52302. attributes
  52303. }) => attributes.mimeType === "audio/mp4" || attributes.mimeType === "audio/webm" || attributes.contentType === "audio";
  52304. const vttOnly$1 = ({
  52305. attributes
  52306. }) => attributes.mimeType === "text/vtt" || attributes.contentType === "text";
  52307. const addMediaSequenceValues$1 = (playlists, timelineStarts) => {
  52308. playlists.forEach((playlist) => {
  52309. playlist.mediaSequence = 0;
  52310. playlist.discontinuitySequence = timelineStarts.findIndex(function({
  52311. timeline
  52312. }) {
  52313. return timeline === playlist.timeline;
  52314. });
  52315. if (!playlist.segments) {
  52316. return;
  52317. }
  52318. playlist.segments.forEach((segment, index2) => {
  52319. segment.number = index2;
  52320. });
  52321. });
  52322. };
  52323. const flattenMediaGroupPlaylists$1 = (mediaGroupObject) => {
  52324. if (!mediaGroupObject) {
  52325. return [];
  52326. }
  52327. return Object.keys(mediaGroupObject).reduce((acc, label2) => {
  52328. const labelContents = mediaGroupObject[label2];
  52329. return acc.concat(labelContents.playlists);
  52330. }, []);
  52331. };
  52332. const toM3u8$1 = ({
  52333. dashPlaylists,
  52334. locations,
  52335. sidxMapping = {},
  52336. previousManifest,
  52337. eventStream
  52338. }) => {
  52339. if (!dashPlaylists.length) {
  52340. return {};
  52341. }
  52342. const {
  52343. sourceDuration: duration5,
  52344. type: type2,
  52345. suggestedPresentationDelay: suggestedPresentationDelay2,
  52346. minimumUpdatePeriod: minimumUpdatePeriod2
  52347. } = dashPlaylists[0].attributes;
  52348. const videoPlaylists = mergeDiscontiguousPlaylists$1(dashPlaylists.filter(videoOnly$1)).map(formatVideoPlaylist$1);
  52349. const audioPlaylists = mergeDiscontiguousPlaylists$1(dashPlaylists.filter(audioOnly$1));
  52350. const vttPlaylists = mergeDiscontiguousPlaylists$1(dashPlaylists.filter(vttOnly$1));
  52351. const captions = dashPlaylists.map((playlist) => playlist.attributes.captionServices).filter(Boolean);
  52352. const manifest = {
  52353. allowCache: true,
  52354. discontinuityStarts: [],
  52355. segments: [],
  52356. endList: true,
  52357. mediaGroups: {
  52358. AUDIO: {},
  52359. VIDEO: {},
  52360. ["CLOSED-CAPTIONS"]: {},
  52361. SUBTITLES: {}
  52362. },
  52363. uri: "",
  52364. duration: duration5,
  52365. playlists: addSidxSegmentsToPlaylists$1(videoPlaylists, sidxMapping)
  52366. };
  52367. if (minimumUpdatePeriod2 >= 0) {
  52368. manifest.minimumUpdatePeriod = minimumUpdatePeriod2 * 1e3;
  52369. }
  52370. if (locations) {
  52371. manifest.locations = locations;
  52372. }
  52373. if (type2 === "dynamic") {
  52374. manifest.suggestedPresentationDelay = suggestedPresentationDelay2;
  52375. }
  52376. if (eventStream && eventStream.length > 0) {
  52377. manifest.eventStream = eventStream;
  52378. }
  52379. const isAudioOnly3 = manifest.playlists.length === 0;
  52380. const organizedAudioGroup = audioPlaylists.length ? organizeAudioPlaylists$1(audioPlaylists, sidxMapping, isAudioOnly3) : null;
  52381. const organizedVttGroup = vttPlaylists.length ? organizeVttPlaylists$1(vttPlaylists, sidxMapping) : null;
  52382. const formattedPlaylists = videoPlaylists.concat(flattenMediaGroupPlaylists$1(organizedAudioGroup), flattenMediaGroupPlaylists$1(organizedVttGroup));
  52383. const playlistTimelineStarts = formattedPlaylists.map(({
  52384. timelineStarts
  52385. }) => timelineStarts);
  52386. manifest.timelineStarts = getUniqueTimelineStarts$1(playlistTimelineStarts);
  52387. addMediaSequenceValues$1(formattedPlaylists, manifest.timelineStarts);
  52388. if (organizedAudioGroup) {
  52389. manifest.mediaGroups.AUDIO.audio = organizedAudioGroup;
  52390. }
  52391. if (organizedVttGroup) {
  52392. manifest.mediaGroups.SUBTITLES.subs = organizedVttGroup;
  52393. }
  52394. if (captions.length) {
  52395. manifest.mediaGroups["CLOSED-CAPTIONS"].cc = organizeCaptionServices$1(captions);
  52396. }
  52397. if (previousManifest) {
  52398. return positionManifestOnTimeline$1({
  52399. oldManifest: previousManifest,
  52400. newManifest: manifest
  52401. });
  52402. }
  52403. return manifest;
  52404. };
  52405. const getLiveRValue$1 = (attributes, time, duration5) => {
  52406. const {
  52407. NOW,
  52408. clientOffset,
  52409. availabilityStartTime: availabilityStartTime2,
  52410. timescale: timescale2 = 1,
  52411. periodStart = 0,
  52412. minimumUpdatePeriod: minimumUpdatePeriod2 = 0
  52413. } = attributes;
  52414. const now2 = (NOW + clientOffset) / 1e3;
  52415. const periodStartWC = availabilityStartTime2 + periodStart;
  52416. const periodEndWC = now2 + minimumUpdatePeriod2;
  52417. const periodDuration = periodEndWC - periodStartWC;
  52418. return Math.ceil((periodDuration * timescale2 - time) / duration5);
  52419. };
  52420. const parseByTimeline$1 = (attributes, segmentTimeline) => {
  52421. const {
  52422. type: type2,
  52423. minimumUpdatePeriod: minimumUpdatePeriod2 = 0,
  52424. media = "",
  52425. sourceDuration,
  52426. timescale: timescale2 = 1,
  52427. startNumber: startNumber2 = 1,
  52428. periodStart: timeline
  52429. } = attributes;
  52430. const segments = [];
  52431. let time = -1;
  52432. for (let sIndex = 0; sIndex < segmentTimeline.length; sIndex++) {
  52433. const S = segmentTimeline[sIndex];
  52434. const duration5 = S.d;
  52435. const repeat = S.r || 0;
  52436. const segmentTime = S.t || 0;
  52437. if (time < 0) {
  52438. time = segmentTime;
  52439. }
  52440. if (segmentTime && segmentTime > time) {
  52441. time = segmentTime;
  52442. }
  52443. let count;
  52444. if (repeat < 0) {
  52445. const nextS = sIndex + 1;
  52446. if (nextS === segmentTimeline.length) {
  52447. if (type2 === "dynamic" && minimumUpdatePeriod2 > 0 && media.indexOf("$Number$") > 0) {
  52448. count = getLiveRValue$1(attributes, time, duration5);
  52449. } else {
  52450. count = (sourceDuration * timescale2 - time) / duration5;
  52451. }
  52452. } else {
  52453. count = (segmentTimeline[nextS].t - time) / duration5;
  52454. }
  52455. } else {
  52456. count = repeat + 1;
  52457. }
  52458. const end = startNumber2 + segments.length + count;
  52459. let number = startNumber2 + segments.length;
  52460. while (number < end) {
  52461. segments.push({
  52462. number,
  52463. duration: duration5 / timescale2,
  52464. time,
  52465. timeline
  52466. });
  52467. time += duration5;
  52468. number++;
  52469. }
  52470. }
  52471. return segments;
  52472. };
  52473. const identifierPattern$1 = /\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g;
  52474. const identifierReplacement$1 = (values3) => (match, identifier, format, width2) => {
  52475. if (match === "$$") {
  52476. return "$";
  52477. }
  52478. if (typeof values3[identifier] === "undefined") {
  52479. return match;
  52480. }
  52481. const value = "" + values3[identifier];
  52482. if (identifier === "RepresentationID") {
  52483. return value;
  52484. }
  52485. if (!format) {
  52486. width2 = 1;
  52487. } else {
  52488. width2 = parseInt(width2, 10);
  52489. }
  52490. if (value.length >= width2) {
  52491. return value;
  52492. }
  52493. return `${new Array(width2 - value.length + 1).join("0")}${value}`;
  52494. };
  52495. const constructTemplateUrl$1 = (url, values3) => url.replace(identifierPattern$1, identifierReplacement$1(values3));
  52496. const parseTemplateInfo$1 = (attributes, segmentTimeline) => {
  52497. if (!attributes.duration && !segmentTimeline) {
  52498. return [{
  52499. number: attributes.startNumber || 1,
  52500. duration: attributes.sourceDuration,
  52501. time: 0,
  52502. timeline: attributes.periodStart
  52503. }];
  52504. }
  52505. if (attributes.duration) {
  52506. return parseByDuration$1(attributes);
  52507. }
  52508. return parseByTimeline$1(attributes, segmentTimeline);
  52509. };
  52510. const segmentsFromTemplate$1 = (attributes, segmentTimeline) => {
  52511. const templateValues = {
  52512. RepresentationID: attributes.id,
  52513. Bandwidth: attributes.bandwidth || 0
  52514. };
  52515. const {
  52516. initialization = {
  52517. sourceURL: "",
  52518. range: ""
  52519. }
  52520. } = attributes;
  52521. const mapSegment = urlTypeToSegment$1({
  52522. baseUrl: attributes.baseUrl,
  52523. source: constructTemplateUrl$1(initialization.sourceURL, templateValues),
  52524. range: initialization.range
  52525. });
  52526. const segments = parseTemplateInfo$1(attributes, segmentTimeline);
  52527. return segments.map((segment) => {
  52528. templateValues.Number = segment.number;
  52529. templateValues.Time = segment.time;
  52530. const uri = constructTemplateUrl$1(attributes.media || "", templateValues);
  52531. const timescale2 = attributes.timescale || 1;
  52532. const presentationTimeOffset2 = attributes.presentationTimeOffset || 0;
  52533. const presentationTime = attributes.periodStart + (segment.time - presentationTimeOffset2) / timescale2;
  52534. const map = {
  52535. uri,
  52536. timeline: segment.timeline,
  52537. duration: segment.duration,
  52538. resolvedUri: resolveUrl$3(attributes.baseUrl || "", uri),
  52539. map: mapSegment,
  52540. number: segment.number,
  52541. presentationTime
  52542. };
  52543. return map;
  52544. });
  52545. };
  52546. const SegmentURLToSegmentObject$1 = (attributes, segmentUrl) => {
  52547. const {
  52548. baseUrl,
  52549. initialization = {}
  52550. } = attributes;
  52551. const initSegment = urlTypeToSegment$1({
  52552. baseUrl,
  52553. source: initialization.sourceURL,
  52554. range: initialization.range
  52555. });
  52556. const segment = urlTypeToSegment$1({
  52557. baseUrl,
  52558. source: segmentUrl.media,
  52559. range: segmentUrl.mediaRange
  52560. });
  52561. segment.map = initSegment;
  52562. return segment;
  52563. };
  52564. const segmentsFromList$1 = (attributes, segmentTimeline) => {
  52565. const {
  52566. duration: duration5,
  52567. segmentUrls = [],
  52568. periodStart
  52569. } = attributes;
  52570. if (!duration5 && !segmentTimeline || duration5 && segmentTimeline) {
  52571. throw new Error(errors$1.SEGMENT_TIME_UNSPECIFIED);
  52572. }
  52573. const segmentUrlMap = segmentUrls.map((segmentUrlObject) => SegmentURLToSegmentObject$1(attributes, segmentUrlObject));
  52574. let segmentTimeInfo;
  52575. if (duration5) {
  52576. segmentTimeInfo = parseByDuration$1(attributes);
  52577. }
  52578. if (segmentTimeline) {
  52579. segmentTimeInfo = parseByTimeline$1(attributes, segmentTimeline);
  52580. }
  52581. const segments = segmentTimeInfo.map((segmentTime, index2) => {
  52582. if (segmentUrlMap[index2]) {
  52583. const segment = segmentUrlMap[index2];
  52584. const timescale2 = attributes.timescale || 1;
  52585. const presentationTimeOffset2 = attributes.presentationTimeOffset || 0;
  52586. segment.timeline = segmentTime.timeline;
  52587. segment.duration = segmentTime.duration;
  52588. segment.number = segmentTime.number;
  52589. segment.presentationTime = periodStart + (segmentTime.time - presentationTimeOffset2) / timescale2;
  52590. return segment;
  52591. }
  52592. }).filter((segment) => segment);
  52593. return segments;
  52594. };
  52595. const generateSegments$1 = ({
  52596. attributes,
  52597. segmentInfo
  52598. }) => {
  52599. let segmentAttributes;
  52600. let segmentsFn;
  52601. if (segmentInfo.template) {
  52602. segmentsFn = segmentsFromTemplate$1;
  52603. segmentAttributes = merge$3(attributes, segmentInfo.template);
  52604. } else if (segmentInfo.base) {
  52605. segmentsFn = segmentsFromBase$1;
  52606. segmentAttributes = merge$3(attributes, segmentInfo.base);
  52607. } else if (segmentInfo.list) {
  52608. segmentsFn = segmentsFromList$1;
  52609. segmentAttributes = merge$3(attributes, segmentInfo.list);
  52610. }
  52611. const segmentsInfo = {
  52612. attributes
  52613. };
  52614. if (!segmentsFn) {
  52615. return segmentsInfo;
  52616. }
  52617. const segments = segmentsFn(segmentAttributes, segmentInfo.segmentTimeline);
  52618. if (segmentAttributes.duration) {
  52619. const {
  52620. duration: duration5,
  52621. timescale: timescale2 = 1
  52622. } = segmentAttributes;
  52623. segmentAttributes.duration = duration5 / timescale2;
  52624. } else if (segments.length) {
  52625. segmentAttributes.duration = segments.reduce((max2, segment) => {
  52626. return Math.max(max2, Math.ceil(segment.duration));
  52627. }, 0);
  52628. } else {
  52629. segmentAttributes.duration = 0;
  52630. }
  52631. segmentsInfo.attributes = segmentAttributes;
  52632. segmentsInfo.segments = segments;
  52633. if (segmentInfo.base && segmentAttributes.indexRange) {
  52634. segmentsInfo.sidx = segments[0];
  52635. segmentsInfo.segments = [];
  52636. }
  52637. return segmentsInfo;
  52638. };
  52639. const toPlaylists$1 = (representations) => representations.map(generateSegments$1);
  52640. const findChildren$1 = (element, name) => from$1(element.childNodes).filter(({
  52641. tagName
  52642. }) => tagName === name);
  52643. const getContent$1 = (element) => element.textContent.trim();
  52644. const parseDivisionValue$1 = (value) => {
  52645. return parseFloat(value.split("/").reduce((prev, current) => prev / current));
  52646. };
  52647. const parseDuration$1 = (str) => {
  52648. const SECONDS_IN_YEAR = 365 * 24 * 60 * 60;
  52649. const SECONDS_IN_MONTH = 30 * 24 * 60 * 60;
  52650. const SECONDS_IN_DAY = 24 * 60 * 60;
  52651. const SECONDS_IN_HOUR = 60 * 60;
  52652. const SECONDS_IN_MIN = 60;
  52653. const durationRegex = /P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/;
  52654. const match = durationRegex.exec(str);
  52655. if (!match) {
  52656. return 0;
  52657. }
  52658. const [year, month, day, hour, minute, second] = match.slice(1);
  52659. return parseFloat(year || 0) * SECONDS_IN_YEAR + parseFloat(month || 0) * SECONDS_IN_MONTH + parseFloat(day || 0) * SECONDS_IN_DAY + parseFloat(hour || 0) * SECONDS_IN_HOUR + parseFloat(minute || 0) * SECONDS_IN_MIN + parseFloat(second || 0);
  52660. };
  52661. const parseDate$1 = (str) => {
  52662. const dateRegex = /^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/;
  52663. if (dateRegex.test(str)) {
  52664. str += "Z";
  52665. }
  52666. return Date.parse(str);
  52667. };
  52668. const parsers$1 = {
  52669. mediaPresentationDuration(value) {
  52670. return parseDuration$1(value);
  52671. },
  52672. availabilityStartTime(value) {
  52673. return parseDate$1(value) / 1e3;
  52674. },
  52675. minimumUpdatePeriod(value) {
  52676. return parseDuration$1(value);
  52677. },
  52678. suggestedPresentationDelay(value) {
  52679. return parseDuration$1(value);
  52680. },
  52681. type(value) {
  52682. return value;
  52683. },
  52684. timeShiftBufferDepth(value) {
  52685. return parseDuration$1(value);
  52686. },
  52687. start(value) {
  52688. return parseDuration$1(value);
  52689. },
  52690. width(value) {
  52691. return parseInt(value, 10);
  52692. },
  52693. height(value) {
  52694. return parseInt(value, 10);
  52695. },
  52696. bandwidth(value) {
  52697. return parseInt(value, 10);
  52698. },
  52699. frameRate(value) {
  52700. return parseDivisionValue$1(value);
  52701. },
  52702. startNumber(value) {
  52703. return parseInt(value, 10);
  52704. },
  52705. timescale(value) {
  52706. return parseInt(value, 10);
  52707. },
  52708. presentationTimeOffset(value) {
  52709. return parseInt(value, 10);
  52710. },
  52711. duration(value) {
  52712. const parsedValue = parseInt(value, 10);
  52713. if (isNaN(parsedValue)) {
  52714. return parseDuration$1(value);
  52715. }
  52716. return parsedValue;
  52717. },
  52718. d(value) {
  52719. return parseInt(value, 10);
  52720. },
  52721. t(value) {
  52722. return parseInt(value, 10);
  52723. },
  52724. r(value) {
  52725. return parseInt(value, 10);
  52726. },
  52727. presentationTime(value) {
  52728. return parseInt(value, 10);
  52729. },
  52730. DEFAULT(value) {
  52731. return value;
  52732. }
  52733. };
  52734. const parseAttributes$2 = (el) => {
  52735. if (!(el && el.attributes)) {
  52736. return {};
  52737. }
  52738. return from$1(el.attributes).reduce((a, e) => {
  52739. const parseFn = parsers$1[e.name] || parsers$1.DEFAULT;
  52740. a[e.name] = parseFn(e.value);
  52741. return a;
  52742. }, {});
  52743. };
  52744. const keySystemsMap$1 = {
  52745. "urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b": "org.w3.clearkey",
  52746. "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed": "com.widevine.alpha",
  52747. "urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95": "com.microsoft.playready",
  52748. "urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb": "com.adobe.primetime"
  52749. };
  52750. const buildBaseUrls$1 = (referenceUrls, baseUrlElements) => {
  52751. if (!baseUrlElements.length) {
  52752. return referenceUrls;
  52753. }
  52754. return flatten$1(referenceUrls.map(function(reference) {
  52755. return baseUrlElements.map(function(baseUrlElement) {
  52756. return resolveUrl$3(reference, getContent$1(baseUrlElement));
  52757. });
  52758. }));
  52759. };
  52760. const getSegmentInformation$1 = (adaptationSet) => {
  52761. const segmentTemplate = findChildren$1(adaptationSet, "SegmentTemplate")[0];
  52762. const segmentList = findChildren$1(adaptationSet, "SegmentList")[0];
  52763. const segmentUrls = segmentList && findChildren$1(segmentList, "SegmentURL").map((s) => merge$3({
  52764. tag: "SegmentURL"
  52765. }, parseAttributes$2(s)));
  52766. const segmentBase = findChildren$1(adaptationSet, "SegmentBase")[0];
  52767. const segmentTimelineParentNode = segmentList || segmentTemplate;
  52768. const segmentTimeline = segmentTimelineParentNode && findChildren$1(segmentTimelineParentNode, "SegmentTimeline")[0];
  52769. const segmentInitializationParentNode = segmentList || segmentBase || segmentTemplate;
  52770. const segmentInitialization = segmentInitializationParentNode && findChildren$1(segmentInitializationParentNode, "Initialization")[0];
  52771. const template = segmentTemplate && parseAttributes$2(segmentTemplate);
  52772. if (template && segmentInitialization) {
  52773. template.initialization = segmentInitialization && parseAttributes$2(segmentInitialization);
  52774. } else if (template && template.initialization) {
  52775. template.initialization = {
  52776. sourceURL: template.initialization
  52777. };
  52778. }
  52779. const segmentInfo = {
  52780. template,
  52781. segmentTimeline: segmentTimeline && findChildren$1(segmentTimeline, "S").map((s) => parseAttributes$2(s)),
  52782. list: segmentList && merge$3(parseAttributes$2(segmentList), {
  52783. segmentUrls,
  52784. initialization: parseAttributes$2(segmentInitialization)
  52785. }),
  52786. base: segmentBase && merge$3(parseAttributes$2(segmentBase), {
  52787. initialization: parseAttributes$2(segmentInitialization)
  52788. })
  52789. };
  52790. Object.keys(segmentInfo).forEach((key) => {
  52791. if (!segmentInfo[key]) {
  52792. delete segmentInfo[key];
  52793. }
  52794. });
  52795. return segmentInfo;
  52796. };
  52797. const inheritBaseUrls$1 = (adaptationSetAttributes, adaptationSetBaseUrls, adaptationSetSegmentInfo) => (representation) => {
  52798. const repBaseUrlElements = findChildren$1(representation, "BaseURL");
  52799. const repBaseUrls = buildBaseUrls$1(adaptationSetBaseUrls, repBaseUrlElements);
  52800. const attributes = merge$3(adaptationSetAttributes, parseAttributes$2(representation));
  52801. const representationSegmentInfo = getSegmentInformation$1(representation);
  52802. return repBaseUrls.map((baseUrl) => {
  52803. return {
  52804. segmentInfo: merge$3(adaptationSetSegmentInfo, representationSegmentInfo),
  52805. attributes: merge$3(attributes, {
  52806. baseUrl
  52807. })
  52808. };
  52809. });
  52810. };
  52811. const generateKeySystemInformation$1 = (contentProtectionNodes) => {
  52812. return contentProtectionNodes.reduce((acc, node) => {
  52813. const attributes = parseAttributes$2(node);
  52814. if (attributes.schemeIdUri) {
  52815. attributes.schemeIdUri = attributes.schemeIdUri.toLowerCase();
  52816. }
  52817. const keySystem = keySystemsMap$1[attributes.schemeIdUri];
  52818. if (keySystem) {
  52819. acc[keySystem] = {
  52820. attributes
  52821. };
  52822. const psshNode = findChildren$1(node, "cenc:pssh")[0];
  52823. if (psshNode) {
  52824. const pssh = getContent$1(psshNode);
  52825. acc[keySystem].pssh = pssh && decodeB64ToUint8Array$1(pssh);
  52826. }
  52827. }
  52828. return acc;
  52829. }, {});
  52830. };
  52831. const parseCaptionServiceMetadata$1 = (service) => {
  52832. if (service.schemeIdUri === "urn:scte:dash:cc:cea-608:2015") {
  52833. const values3 = typeof service.value !== "string" ? [] : service.value.split(";");
  52834. return values3.map((value) => {
  52835. let channel;
  52836. let language;
  52837. language = value;
  52838. if (/^CC\d=/.test(value)) {
  52839. [channel, language] = value.split("=");
  52840. } else if (/^CC\d$/.test(value)) {
  52841. channel = value;
  52842. }
  52843. return {
  52844. channel,
  52845. language
  52846. };
  52847. });
  52848. } else if (service.schemeIdUri === "urn:scte:dash:cc:cea-708:2015") {
  52849. const values3 = typeof service.value !== "string" ? [] : service.value.split(";");
  52850. return values3.map((value) => {
  52851. const flags = {
  52852. "channel": void 0,
  52853. "language": void 0,
  52854. "aspectRatio": 1,
  52855. "easyReader": 0,
  52856. "3D": 0
  52857. };
  52858. if (/=/.test(value)) {
  52859. const [channel, opts = ""] = value.split("=");
  52860. flags.channel = channel;
  52861. flags.language = value;
  52862. opts.split(",").forEach((opt) => {
  52863. const [name, val] = opt.split(":");
  52864. if (name === "lang") {
  52865. flags.language = val;
  52866. } else if (name === "er") {
  52867. flags.easyReader = Number(val);
  52868. } else if (name === "war") {
  52869. flags.aspectRatio = Number(val);
  52870. } else if (name === "3D") {
  52871. flags["3D"] = Number(val);
  52872. }
  52873. });
  52874. } else {
  52875. flags.language = value;
  52876. }
  52877. if (flags.channel) {
  52878. flags.channel = "SERVICE" + flags.channel;
  52879. }
  52880. return flags;
  52881. });
  52882. }
  52883. };
  52884. const toEventStream = (period) => {
  52885. return flatten$1(findChildren$1(period.node, "EventStream").map((eventStream) => {
  52886. const eventStreamAttributes = parseAttributes$2(eventStream);
  52887. const schemeIdUri = eventStreamAttributes.schemeIdUri;
  52888. return findChildren$1(eventStream, "Event").map((event2) => {
  52889. const eventAttributes = parseAttributes$2(event2);
  52890. const presentationTime = eventAttributes.presentationTime || 0;
  52891. const timescale2 = eventStreamAttributes.timescale || 1;
  52892. const duration5 = eventAttributes.duration || 0;
  52893. const start2 = presentationTime / timescale2 + period.attributes.start;
  52894. return {
  52895. schemeIdUri,
  52896. value: eventStreamAttributes.value,
  52897. id: eventAttributes.id,
  52898. start: start2,
  52899. end: start2 + duration5 / timescale2,
  52900. messageData: getContent$1(event2) || eventAttributes.messageData,
  52901. contentEncoding: eventStreamAttributes.contentEncoding,
  52902. presentationTimeOffset: eventStreamAttributes.presentationTimeOffset || 0
  52903. };
  52904. });
  52905. }));
  52906. };
  52907. const toRepresentations$1 = (periodAttributes, periodBaseUrls, periodSegmentInfo) => (adaptationSet) => {
  52908. const adaptationSetAttributes = parseAttributes$2(adaptationSet);
  52909. const adaptationSetBaseUrls = buildBaseUrls$1(periodBaseUrls, findChildren$1(adaptationSet, "BaseURL"));
  52910. const role = findChildren$1(adaptationSet, "Role")[0];
  52911. const roleAttributes = {
  52912. role: parseAttributes$2(role)
  52913. };
  52914. let attrs = merge$3(periodAttributes, adaptationSetAttributes, roleAttributes);
  52915. const accessibility = findChildren$1(adaptationSet, "Accessibility")[0];
  52916. const captionServices = parseCaptionServiceMetadata$1(parseAttributes$2(accessibility));
  52917. if (captionServices) {
  52918. attrs = merge$3(attrs, {
  52919. captionServices
  52920. });
  52921. }
  52922. const label2 = findChildren$1(adaptationSet, "Label")[0];
  52923. if (label2 && label2.childNodes.length) {
  52924. const labelVal = label2.childNodes[0].nodeValue.trim();
  52925. attrs = merge$3(attrs, {
  52926. label: labelVal
  52927. });
  52928. }
  52929. const contentProtection = generateKeySystemInformation$1(findChildren$1(adaptationSet, "ContentProtection"));
  52930. if (Object.keys(contentProtection).length) {
  52931. attrs = merge$3(attrs, {
  52932. contentProtection
  52933. });
  52934. }
  52935. const segmentInfo = getSegmentInformation$1(adaptationSet);
  52936. const representations = findChildren$1(adaptationSet, "Representation");
  52937. const adaptationSetSegmentInfo = merge$3(periodSegmentInfo, segmentInfo);
  52938. return flatten$1(representations.map(inheritBaseUrls$1(attrs, adaptationSetBaseUrls, adaptationSetSegmentInfo)));
  52939. };
  52940. const toAdaptationSets$1 = (mpdAttributes, mpdBaseUrls) => (period, index2) => {
  52941. const periodBaseUrls = buildBaseUrls$1(mpdBaseUrls, findChildren$1(period.node, "BaseURL"));
  52942. const periodAttributes = merge$3(mpdAttributes, {
  52943. periodStart: period.attributes.start
  52944. });
  52945. if (typeof period.attributes.duration === "number") {
  52946. periodAttributes.periodDuration = period.attributes.duration;
  52947. }
  52948. const adaptationSets = findChildren$1(period.node, "AdaptationSet");
  52949. const periodSegmentInfo = getSegmentInformation$1(period.node);
  52950. return flatten$1(adaptationSets.map(toRepresentations$1(periodAttributes, periodBaseUrls, periodSegmentInfo)));
  52951. };
  52952. const getPeriodStart$1 = ({
  52953. attributes,
  52954. priorPeriodAttributes,
  52955. mpdType
  52956. }) => {
  52957. if (typeof attributes.start === "number") {
  52958. return attributes.start;
  52959. }
  52960. if (priorPeriodAttributes && typeof priorPeriodAttributes.start === "number" && typeof priorPeriodAttributes.duration === "number") {
  52961. return priorPeriodAttributes.start + priorPeriodAttributes.duration;
  52962. }
  52963. if (!priorPeriodAttributes && mpdType === "static") {
  52964. return 0;
  52965. }
  52966. return null;
  52967. };
  52968. const inheritAttributes$1 = (mpd, options2 = {}) => {
  52969. const {
  52970. manifestUri = "",
  52971. NOW = Date.now(),
  52972. clientOffset = 0
  52973. } = options2;
  52974. const periodNodes = findChildren$1(mpd, "Period");
  52975. if (!periodNodes.length) {
  52976. throw new Error(errors$1.INVALID_NUMBER_OF_PERIOD);
  52977. }
  52978. const locations = findChildren$1(mpd, "Location");
  52979. const mpdAttributes = parseAttributes$2(mpd);
  52980. const mpdBaseUrls = buildBaseUrls$1([manifestUri], findChildren$1(mpd, "BaseURL"));
  52981. mpdAttributes.type = mpdAttributes.type || "static";
  52982. mpdAttributes.sourceDuration = mpdAttributes.mediaPresentationDuration || 0;
  52983. mpdAttributes.NOW = NOW;
  52984. mpdAttributes.clientOffset = clientOffset;
  52985. if (locations.length) {
  52986. mpdAttributes.locations = locations.map(getContent$1);
  52987. }
  52988. const periods = [];
  52989. periodNodes.forEach((node, index2) => {
  52990. const attributes = parseAttributes$2(node);
  52991. const priorPeriod = periods[index2 - 1];
  52992. attributes.start = getPeriodStart$1({
  52993. attributes,
  52994. priorPeriodAttributes: priorPeriod ? priorPeriod.attributes : null,
  52995. mpdType: mpdAttributes.type
  52996. });
  52997. periods.push({
  52998. node,
  52999. attributes
  53000. });
  53001. });
  53002. return {
  53003. locations: mpdAttributes.locations,
  53004. representationInfo: flatten$1(periods.map(toAdaptationSets$1(mpdAttributes, mpdBaseUrls))),
  53005. eventStream: flatten$1(periods.map(toEventStream))
  53006. };
  53007. };
  53008. const stringToMpdXml$1 = (manifestString) => {
  53009. if (manifestString === "") {
  53010. throw new Error(errors$1.DASH_EMPTY_MANIFEST);
  53011. }
  53012. const parser2 = new DOMParser();
  53013. let xml;
  53014. let mpd;
  53015. try {
  53016. xml = parser2.parseFromString(manifestString, "application/xml");
  53017. mpd = xml && xml.documentElement.tagName === "MPD" ? xml.documentElement : null;
  53018. } catch (e) {
  53019. }
  53020. if (!mpd || mpd && mpd.getElementsByTagName("parsererror").length > 0) {
  53021. throw new Error(errors$1.DASH_INVALID_XML);
  53022. }
  53023. return mpd;
  53024. };
  53025. const parseUTCTimingScheme$1 = (mpd) => {
  53026. const UTCTimingNode = findChildren$1(mpd, "UTCTiming")[0];
  53027. if (!UTCTimingNode) {
  53028. return null;
  53029. }
  53030. const attributes = parseAttributes$2(UTCTimingNode);
  53031. switch (attributes.schemeIdUri) {
  53032. case "urn:mpeg:dash:utc:http-head:2014":
  53033. case "urn:mpeg:dash:utc:http-head:2012":
  53034. attributes.method = "HEAD";
  53035. break;
  53036. case "urn:mpeg:dash:utc:http-xsdate:2014":
  53037. case "urn:mpeg:dash:utc:http-iso:2014":
  53038. case "urn:mpeg:dash:utc:http-xsdate:2012":
  53039. case "urn:mpeg:dash:utc:http-iso:2012":
  53040. attributes.method = "GET";
  53041. break;
  53042. case "urn:mpeg:dash:utc:direct:2014":
  53043. case "urn:mpeg:dash:utc:direct:2012":
  53044. attributes.method = "DIRECT";
  53045. attributes.value = Date.parse(attributes.value);
  53046. break;
  53047. case "urn:mpeg:dash:utc:http-ntp:2014":
  53048. case "urn:mpeg:dash:utc:ntp:2014":
  53049. case "urn:mpeg:dash:utc:sntp:2014":
  53050. default:
  53051. throw new Error(errors$1.UNSUPPORTED_UTC_TIMING_SCHEME);
  53052. }
  53053. return attributes;
  53054. };
  53055. const parse$1 = (manifestString, options2 = {}) => {
  53056. const parsedManifestInfo = inheritAttributes$1(stringToMpdXml$1(manifestString), options2);
  53057. const playlists = toPlaylists$1(parsedManifestInfo.representationInfo);
  53058. return toM3u8$1({
  53059. dashPlaylists: playlists,
  53060. locations: parsedManifestInfo.locations,
  53061. sidxMapping: options2.sidxMapping,
  53062. previousManifest: options2.previousManifest,
  53063. eventStream: parsedManifestInfo.eventStream
  53064. });
  53065. };
  53066. const parseUTCTiming$1 = (manifestString) => parseUTCTimingScheme$1(stringToMpdXml$1(manifestString));
  53067. var MAX_UINT32$1 = Math.pow(2, 32);
  53068. var getUint64$3 = function(uint8) {
  53069. var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength);
  53070. var value;
  53071. if (dv.getBigUint64) {
  53072. value = dv.getBigUint64(0);
  53073. if (value < Number.MAX_SAFE_INTEGER) {
  53074. return Number(value);
  53075. }
  53076. return value;
  53077. }
  53078. return dv.getUint32(0) * MAX_UINT32$1 + dv.getUint32(4);
  53079. };
  53080. var numbers$1 = {
  53081. getUint64: getUint64$3,
  53082. MAX_UINT32: MAX_UINT32$1
  53083. };
  53084. var getUint64$2 = numbers$1.getUint64;
  53085. var parseSidx$1 = function(data) {
  53086. var view = new DataView(data.buffer, data.byteOffset, data.byteLength), result = {
  53087. version: data[0],
  53088. flags: new Uint8Array(data.subarray(1, 4)),
  53089. references: [],
  53090. referenceId: view.getUint32(4),
  53091. timescale: view.getUint32(8)
  53092. }, i2 = 12;
  53093. if (result.version === 0) {
  53094. result.earliestPresentationTime = view.getUint32(i2);
  53095. result.firstOffset = view.getUint32(i2 + 4);
  53096. i2 += 8;
  53097. } else {
  53098. result.earliestPresentationTime = getUint64$2(data.subarray(i2));
  53099. result.firstOffset = getUint64$2(data.subarray(i2 + 8));
  53100. i2 += 16;
  53101. }
  53102. i2 += 2;
  53103. var referenceCount = view.getUint16(i2);
  53104. i2 += 2;
  53105. for (; referenceCount > 0; i2 += 12, referenceCount--) {
  53106. result.references.push({
  53107. referenceType: (data[i2] & 128) >>> 7,
  53108. referencedSize: view.getUint32(i2) & 2147483647,
  53109. subsegmentDuration: view.getUint32(i2 + 4),
  53110. startsWithSap: !!(data[i2 + 8] & 128),
  53111. sapType: (data[i2 + 8] & 112) >>> 4,
  53112. sapDeltaTime: view.getUint32(i2 + 8) & 268435455
  53113. });
  53114. }
  53115. return result;
  53116. };
  53117. var parseSidx_1$1 = parseSidx$1;
  53118. var ID3$1 = toUint8$1([73, 68, 51]);
  53119. var getId3Size$1 = function getId3Size(bytes, offset) {
  53120. if (offset === void 0) {
  53121. offset = 0;
  53122. }
  53123. bytes = toUint8$1(bytes);
  53124. var flags = bytes[offset + 5];
  53125. var returnSize = bytes[offset + 6] << 21 | bytes[offset + 7] << 14 | bytes[offset + 8] << 7 | bytes[offset + 9];
  53126. var footerPresent = (flags & 16) >> 4;
  53127. if (footerPresent) {
  53128. return returnSize + 20;
  53129. }
  53130. return returnSize + 10;
  53131. };
  53132. var getId3Offset$1 = function getId3Offset(bytes, offset) {
  53133. if (offset === void 0) {
  53134. offset = 0;
  53135. }
  53136. bytes = toUint8$1(bytes);
  53137. if (bytes.length - offset < 10 || !bytesMatch$1(bytes, ID3$1, {
  53138. offset
  53139. })) {
  53140. return offset;
  53141. }
  53142. offset += getId3Size$1(bytes, offset);
  53143. return getId3Offset(bytes, offset);
  53144. };
  53145. var normalizePath$3 = function normalizePath(path) {
  53146. if (typeof path === "string") {
  53147. return stringToBytes$1(path);
  53148. }
  53149. if (typeof path === "number") {
  53150. return path;
  53151. }
  53152. return path;
  53153. };
  53154. var normalizePaths$3 = function normalizePaths(paths) {
  53155. if (!Array.isArray(paths)) {
  53156. return [normalizePath$3(paths)];
  53157. }
  53158. return paths.map(function(p) {
  53159. return normalizePath$3(p);
  53160. });
  53161. };
  53162. var findBox$1 = function findBox(bytes, paths, complete) {
  53163. if (complete === void 0) {
  53164. complete = false;
  53165. }
  53166. paths = normalizePaths$3(paths);
  53167. bytes = toUint8$1(bytes);
  53168. var results = [];
  53169. if (!paths.length) {
  53170. return results;
  53171. }
  53172. var i2 = 0;
  53173. while (i2 < bytes.length) {
  53174. var size = (bytes[i2] << 24 | bytes[i2 + 1] << 16 | bytes[i2 + 2] << 8 | bytes[i2 + 3]) >>> 0;
  53175. var type2 = bytes.subarray(i2 + 4, i2 + 8);
  53176. if (size === 0) {
  53177. break;
  53178. }
  53179. var end = i2 + size;
  53180. if (end > bytes.length) {
  53181. if (complete) {
  53182. break;
  53183. }
  53184. end = bytes.length;
  53185. }
  53186. var data = bytes.subarray(i2 + 8, end);
  53187. if (bytesMatch$1(type2, paths[0])) {
  53188. if (paths.length === 1) {
  53189. results.push(data);
  53190. } else {
  53191. results.push.apply(results, findBox(data, paths.slice(1), complete));
  53192. }
  53193. }
  53194. i2 = end;
  53195. }
  53196. return results;
  53197. };
  53198. var EBML_TAGS$1 = {
  53199. EBML: toUint8$1([26, 69, 223, 163]),
  53200. DocType: toUint8$1([66, 130]),
  53201. Segment: toUint8$1([24, 83, 128, 103]),
  53202. SegmentInfo: toUint8$1([21, 73, 169, 102]),
  53203. Tracks: toUint8$1([22, 84, 174, 107]),
  53204. Track: toUint8$1([174]),
  53205. TrackNumber: toUint8$1([215]),
  53206. DefaultDuration: toUint8$1([35, 227, 131]),
  53207. TrackEntry: toUint8$1([174]),
  53208. TrackType: toUint8$1([131]),
  53209. FlagDefault: toUint8$1([136]),
  53210. CodecID: toUint8$1([134]),
  53211. CodecPrivate: toUint8$1([99, 162]),
  53212. VideoTrack: toUint8$1([224]),
  53213. AudioTrack: toUint8$1([225]),
  53214. Cluster: toUint8$1([31, 67, 182, 117]),
  53215. Timestamp: toUint8$1([231]),
  53216. TimestampScale: toUint8$1([42, 215, 177]),
  53217. BlockGroup: toUint8$1([160]),
  53218. BlockDuration: toUint8$1([155]),
  53219. Block: toUint8$1([161]),
  53220. SimpleBlock: toUint8$1([163])
  53221. };
  53222. var LENGTH_TABLE$1 = [128, 64, 32, 16, 8, 4, 2, 1];
  53223. var getLength$1 = function getLength(byte) {
  53224. var len = 1;
  53225. for (var i2 = 0; i2 < LENGTH_TABLE$1.length; i2++) {
  53226. if (byte & LENGTH_TABLE$1[i2]) {
  53227. break;
  53228. }
  53229. len++;
  53230. }
  53231. return len;
  53232. };
  53233. var getvint$1 = function getvint(bytes, offset, removeLength, signed) {
  53234. if (removeLength === void 0) {
  53235. removeLength = true;
  53236. }
  53237. if (signed === void 0) {
  53238. signed = false;
  53239. }
  53240. var length = getLength$1(bytes[offset]);
  53241. var valueBytes = bytes.subarray(offset, offset + length);
  53242. if (removeLength) {
  53243. valueBytes = Array.prototype.slice.call(bytes, offset, offset + length);
  53244. valueBytes[0] ^= LENGTH_TABLE$1[length - 1];
  53245. }
  53246. return {
  53247. length,
  53248. value: bytesToNumber$1(valueBytes, {
  53249. signed
  53250. }),
  53251. bytes: valueBytes
  53252. };
  53253. };
  53254. var normalizePath$2 = function normalizePath2(path) {
  53255. if (typeof path === "string") {
  53256. return path.match(/.{1,2}/g).map(function(p) {
  53257. return normalizePath2(p);
  53258. });
  53259. }
  53260. if (typeof path === "number") {
  53261. return numberToBytes$1(path);
  53262. }
  53263. return path;
  53264. };
  53265. var normalizePaths$2 = function normalizePaths2(paths) {
  53266. if (!Array.isArray(paths)) {
  53267. return [normalizePath$2(paths)];
  53268. }
  53269. return paths.map(function(p) {
  53270. return normalizePath$2(p);
  53271. });
  53272. };
  53273. var getInfinityDataSize$1 = function getInfinityDataSize(id, bytes, offset) {
  53274. if (offset >= bytes.length) {
  53275. return bytes.length;
  53276. }
  53277. var innerid = getvint$1(bytes, offset, false);
  53278. if (bytesMatch$1(id.bytes, innerid.bytes)) {
  53279. return offset;
  53280. }
  53281. var dataHeader = getvint$1(bytes, offset + innerid.length);
  53282. return getInfinityDataSize(id, bytes, offset + dataHeader.length + dataHeader.value + innerid.length);
  53283. };
  53284. var findEbml$1 = function findEbml(bytes, paths) {
  53285. paths = normalizePaths$2(paths);
  53286. bytes = toUint8$1(bytes);
  53287. var results = [];
  53288. if (!paths.length) {
  53289. return results;
  53290. }
  53291. var i2 = 0;
  53292. while (i2 < bytes.length) {
  53293. var id = getvint$1(bytes, i2, false);
  53294. var dataHeader = getvint$1(bytes, i2 + id.length);
  53295. var dataStart = i2 + id.length + dataHeader.length;
  53296. if (dataHeader.value === 127) {
  53297. dataHeader.value = getInfinityDataSize$1(id, bytes, dataStart);
  53298. if (dataHeader.value !== bytes.length) {
  53299. dataHeader.value -= dataStart;
  53300. }
  53301. }
  53302. var dataEnd = dataStart + dataHeader.value > bytes.length ? bytes.length : dataStart + dataHeader.value;
  53303. var data = bytes.subarray(dataStart, dataEnd);
  53304. if (bytesMatch$1(paths[0], id.bytes)) {
  53305. if (paths.length === 1) {
  53306. results.push(data);
  53307. } else {
  53308. results = results.concat(findEbml(data, paths.slice(1)));
  53309. }
  53310. }
  53311. var totalLength = id.length + dataHeader.length + data.length;
  53312. i2 += totalLength;
  53313. }
  53314. return results;
  53315. };
  53316. var NAL_TYPE_ONE$1 = toUint8$1([0, 0, 0, 1]);
  53317. var NAL_TYPE_TWO$1 = toUint8$1([0, 0, 1]);
  53318. var EMULATION_PREVENTION$1 = toUint8$1([0, 0, 3]);
  53319. var discardEmulationPreventionBytes$1 = function discardEmulationPreventionBytes(bytes) {
  53320. var positions = [];
  53321. var i2 = 1;
  53322. while (i2 < bytes.length - 2) {
  53323. if (bytesMatch$1(bytes.subarray(i2, i2 + 3), EMULATION_PREVENTION$1)) {
  53324. positions.push(i2 + 2);
  53325. i2++;
  53326. }
  53327. i2++;
  53328. }
  53329. if (positions.length === 0) {
  53330. return bytes;
  53331. }
  53332. var newLength = bytes.length - positions.length;
  53333. var newData = new Uint8Array(newLength);
  53334. var sourceIndex = 0;
  53335. for (i2 = 0; i2 < newLength; sourceIndex++, i2++) {
  53336. if (sourceIndex === positions[0]) {
  53337. sourceIndex++;
  53338. positions.shift();
  53339. }
  53340. newData[i2] = bytes[sourceIndex];
  53341. }
  53342. return newData;
  53343. };
  53344. var findNal$1 = function findNal(bytes, dataType, types, nalLimit) {
  53345. if (nalLimit === void 0) {
  53346. nalLimit = Infinity;
  53347. }
  53348. bytes = toUint8$1(bytes);
  53349. types = [].concat(types);
  53350. var i2 = 0;
  53351. var nalStart;
  53352. var nalsFound = 0;
  53353. while (i2 < bytes.length && (nalsFound < nalLimit || nalStart)) {
  53354. var nalOffset = void 0;
  53355. if (bytesMatch$1(bytes.subarray(i2), NAL_TYPE_ONE$1)) {
  53356. nalOffset = 4;
  53357. } else if (bytesMatch$1(bytes.subarray(i2), NAL_TYPE_TWO$1)) {
  53358. nalOffset = 3;
  53359. }
  53360. if (!nalOffset) {
  53361. i2++;
  53362. continue;
  53363. }
  53364. nalsFound++;
  53365. if (nalStart) {
  53366. return discardEmulationPreventionBytes$1(bytes.subarray(nalStart, i2));
  53367. }
  53368. var nalType = void 0;
  53369. if (dataType === "h264") {
  53370. nalType = bytes[i2 + nalOffset] & 31;
  53371. } else if (dataType === "h265") {
  53372. nalType = bytes[i2 + nalOffset] >> 1 & 63;
  53373. }
  53374. if (types.indexOf(nalType) !== -1) {
  53375. nalStart = i2 + nalOffset;
  53376. }
  53377. i2 += nalOffset + (dataType === "h264" ? 1 : 2);
  53378. }
  53379. return bytes.subarray(0, 0);
  53380. };
  53381. var findH264Nal$1 = function findH264Nal(bytes, type2, nalLimit) {
  53382. return findNal$1(bytes, "h264", type2, nalLimit);
  53383. };
  53384. var findH265Nal$1 = function findH265Nal(bytes, type2, nalLimit) {
  53385. return findNal$1(bytes, "h265", type2, nalLimit);
  53386. };
  53387. var CONSTANTS$1 = {
  53388. "webm": toUint8$1([119, 101, 98, 109]),
  53389. "matroska": toUint8$1([109, 97, 116, 114, 111, 115, 107, 97]),
  53390. "flac": toUint8$1([102, 76, 97, 67]),
  53391. "ogg": toUint8$1([79, 103, 103, 83]),
  53392. "ac3": toUint8$1([11, 119]),
  53393. "riff": toUint8$1([82, 73, 70, 70]),
  53394. "avi": toUint8$1([65, 86, 73]),
  53395. "wav": toUint8$1([87, 65, 86, 69]),
  53396. "3gp": toUint8$1([102, 116, 121, 112, 51, 103]),
  53397. "mp4": toUint8$1([102, 116, 121, 112]),
  53398. "fmp4": toUint8$1([115, 116, 121, 112]),
  53399. "mov": toUint8$1([102, 116, 121, 112, 113, 116]),
  53400. "moov": toUint8$1([109, 111, 111, 118]),
  53401. "moof": toUint8$1([109, 111, 111, 102])
  53402. };
  53403. var _isLikely$1 = {
  53404. aac: function aac(bytes) {
  53405. var offset = getId3Offset$1(bytes);
  53406. return bytesMatch$1(bytes, [255, 16], {
  53407. offset,
  53408. mask: [255, 22]
  53409. });
  53410. },
  53411. mp3: function mp3(bytes) {
  53412. var offset = getId3Offset$1(bytes);
  53413. return bytesMatch$1(bytes, [255, 2], {
  53414. offset,
  53415. mask: [255, 6]
  53416. });
  53417. },
  53418. webm: function webm(bytes) {
  53419. var docType = findEbml$1(bytes, [EBML_TAGS$1.EBML, EBML_TAGS$1.DocType])[0];
  53420. return bytesMatch$1(docType, CONSTANTS$1.webm);
  53421. },
  53422. mkv: function mkv(bytes) {
  53423. var docType = findEbml$1(bytes, [EBML_TAGS$1.EBML, EBML_TAGS$1.DocType])[0];
  53424. return bytesMatch$1(docType, CONSTANTS$1.matroska);
  53425. },
  53426. mp4: function mp4(bytes) {
  53427. if (_isLikely$1["3gp"](bytes) || _isLikely$1.mov(bytes)) {
  53428. return false;
  53429. }
  53430. if (bytesMatch$1(bytes, CONSTANTS$1.mp4, {
  53431. offset: 4
  53432. }) || bytesMatch$1(bytes, CONSTANTS$1.fmp4, {
  53433. offset: 4
  53434. })) {
  53435. return true;
  53436. }
  53437. if (bytesMatch$1(bytes, CONSTANTS$1.moof, {
  53438. offset: 4
  53439. }) || bytesMatch$1(bytes, CONSTANTS$1.moov, {
  53440. offset: 4
  53441. })) {
  53442. return true;
  53443. }
  53444. },
  53445. mov: function mov(bytes) {
  53446. return bytesMatch$1(bytes, CONSTANTS$1.mov, {
  53447. offset: 4
  53448. });
  53449. },
  53450. "3gp": function gp(bytes) {
  53451. return bytesMatch$1(bytes, CONSTANTS$1["3gp"], {
  53452. offset: 4
  53453. });
  53454. },
  53455. ac3: function ac3(bytes) {
  53456. var offset = getId3Offset$1(bytes);
  53457. return bytesMatch$1(bytes, CONSTANTS$1.ac3, {
  53458. offset
  53459. });
  53460. },
  53461. ts: function ts(bytes) {
  53462. if (bytes.length < 189 && bytes.length >= 1) {
  53463. return bytes[0] === 71;
  53464. }
  53465. var i2 = 0;
  53466. while (i2 + 188 < bytes.length && i2 < 188) {
  53467. if (bytes[i2] === 71 && bytes[i2 + 188] === 71) {
  53468. return true;
  53469. }
  53470. i2 += 1;
  53471. }
  53472. return false;
  53473. },
  53474. flac: function flac(bytes) {
  53475. var offset = getId3Offset$1(bytes);
  53476. return bytesMatch$1(bytes, CONSTANTS$1.flac, {
  53477. offset
  53478. });
  53479. },
  53480. ogg: function ogg(bytes) {
  53481. return bytesMatch$1(bytes, CONSTANTS$1.ogg);
  53482. },
  53483. avi: function avi(bytes) {
  53484. return bytesMatch$1(bytes, CONSTANTS$1.riff) && bytesMatch$1(bytes, CONSTANTS$1.avi, {
  53485. offset: 8
  53486. });
  53487. },
  53488. wav: function wav(bytes) {
  53489. return bytesMatch$1(bytes, CONSTANTS$1.riff) && bytesMatch$1(bytes, CONSTANTS$1.wav, {
  53490. offset: 8
  53491. });
  53492. },
  53493. "h264": function h264(bytes) {
  53494. return findH264Nal$1(bytes, 7, 3).length;
  53495. },
  53496. "h265": function h265(bytes) {
  53497. return findH265Nal$1(bytes, [32, 33], 3).length;
  53498. }
  53499. };
  53500. var isLikelyTypes$1 = Object.keys(_isLikely$1).filter(function(t2) {
  53501. return t2 !== "ts" && t2 !== "h264" && t2 !== "h265";
  53502. }).concat(["ts", "h264", "h265"]);
  53503. isLikelyTypes$1.forEach(function(type2) {
  53504. var isLikelyFn = _isLikely$1[type2];
  53505. _isLikely$1[type2] = function(bytes) {
  53506. return isLikelyFn(toUint8$1(bytes));
  53507. };
  53508. });
  53509. var isLikely$1 = _isLikely$1;
  53510. var detectContainerForBytes$1 = function detectContainerForBytes(bytes) {
  53511. bytes = toUint8$1(bytes);
  53512. for (var i2 = 0; i2 < isLikelyTypes$1.length; i2++) {
  53513. var type2 = isLikelyTypes$1[i2];
  53514. if (isLikely$1[type2](bytes)) {
  53515. return type2;
  53516. }
  53517. }
  53518. return "";
  53519. };
  53520. var isLikelyFmp4MediaSegment$1 = function isLikelyFmp4MediaSegment(bytes) {
  53521. return findBox$1(bytes, ["moof"]).length > 0;
  53522. };
  53523. var ONE_SECOND_IN_TS$1 = 9e4, secondsToVideoTs$1, secondsToAudioTs$1, videoTsToSeconds$1, audioTsToSeconds$1, audioTsToVideoTs$1, videoTsToAudioTs$1, metadataTsToSeconds$1;
  53524. secondsToVideoTs$1 = function(seconds) {
  53525. return seconds * ONE_SECOND_IN_TS$1;
  53526. };
  53527. secondsToAudioTs$1 = function(seconds, sampleRate) {
  53528. return seconds * sampleRate;
  53529. };
  53530. videoTsToSeconds$1 = function(timestamp) {
  53531. return timestamp / ONE_SECOND_IN_TS$1;
  53532. };
  53533. audioTsToSeconds$1 = function(timestamp, sampleRate) {
  53534. return timestamp / sampleRate;
  53535. };
  53536. audioTsToVideoTs$1 = function(timestamp, sampleRate) {
  53537. return secondsToVideoTs$1(audioTsToSeconds$1(timestamp, sampleRate));
  53538. };
  53539. videoTsToAudioTs$1 = function(timestamp, sampleRate) {
  53540. return secondsToAudioTs$1(videoTsToSeconds$1(timestamp), sampleRate);
  53541. };
  53542. metadataTsToSeconds$1 = function(timestamp, timelineStartPts, keepOriginalTimestamps) {
  53543. return videoTsToSeconds$1(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts);
  53544. };
  53545. var clock$1 = {
  53546. ONE_SECOND_IN_TS: ONE_SECOND_IN_TS$1,
  53547. secondsToVideoTs: secondsToVideoTs$1,
  53548. secondsToAudioTs: secondsToAudioTs$1,
  53549. videoTsToSeconds: videoTsToSeconds$1,
  53550. audioTsToSeconds: audioTsToSeconds$1,
  53551. audioTsToVideoTs: audioTsToVideoTs$1,
  53552. videoTsToAudioTs: videoTsToAudioTs$1,
  53553. metadataTsToSeconds: metadataTsToSeconds$1
  53554. };
  53555. /**
  53556. * @license
  53557. * Video.js 8.3.0 <http://videojs.com/>
  53558. * Copyright Brightcove, Inc. <https://www.brightcove.com/>
  53559. * Available under Apache License Version 2.0
  53560. * <https://github.com/videojs/video.js/blob/main/LICENSE>
  53561. *
  53562. * Includes vtt.js <https://github.com/mozilla/vtt.js>
  53563. * Available under Apache License Version 2.0
  53564. * <https://github.com/mozilla/vtt.js/blob/main/LICENSE>
  53565. */
  53566. var version$6$1 = "8.3.0";
  53567. const hooks_$1 = {};
  53568. const hooks$1 = function(type2, fn2) {
  53569. hooks_$1[type2] = hooks_$1[type2] || [];
  53570. if (fn2) {
  53571. hooks_$1[type2] = hooks_$1[type2].concat(fn2);
  53572. }
  53573. return hooks_$1[type2];
  53574. };
  53575. const hook$1 = function(type2, fn2) {
  53576. hooks$1(type2, fn2);
  53577. };
  53578. const removeHook$1 = function(type2, fn2) {
  53579. const index2 = hooks$1(type2).indexOf(fn2);
  53580. if (index2 <= -1) {
  53581. return false;
  53582. }
  53583. hooks_$1[type2] = hooks_$1[type2].slice();
  53584. hooks_$1[type2].splice(index2, 1);
  53585. return true;
  53586. };
  53587. const hookOnce$1 = function(type2, fn2) {
  53588. hooks$1(type2, [].concat(fn2).map((original) => {
  53589. const wrapper = (...args) => {
  53590. removeHook$1(type2, wrapper);
  53591. return original(...args);
  53592. };
  53593. return wrapper;
  53594. }));
  53595. };
  53596. const FullscreenApi$1 = {
  53597. prefixed: true
  53598. };
  53599. const apiMap$1 = [
  53600. ["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror", "fullscreen"],
  53601. ["webkitRequestFullscreen", "webkitExitFullscreen", "webkitFullscreenElement", "webkitFullscreenEnabled", "webkitfullscreenchange", "webkitfullscreenerror", "-webkit-full-screen"],
  53602. ["mozRequestFullScreen", "mozCancelFullScreen", "mozFullScreenElement", "mozFullScreenEnabled", "mozfullscreenchange", "mozfullscreenerror", "-moz-full-screen"],
  53603. ["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError", "-ms-fullscreen"]
  53604. ];
  53605. const specApi$1 = apiMap$1[0];
  53606. let browserApi$1;
  53607. for (let i2 = 0; i2 < apiMap$1.length; i2++) {
  53608. if (apiMap$1[i2][1] in document_1) {
  53609. browserApi$1 = apiMap$1[i2];
  53610. break;
  53611. }
  53612. }
  53613. if (browserApi$1) {
  53614. for (let i2 = 0; i2 < browserApi$1.length; i2++) {
  53615. FullscreenApi$1[specApi$1[i2]] = browserApi$1[i2];
  53616. }
  53617. FullscreenApi$1.prefixed = browserApi$1[0] !== specApi$1[0];
  53618. }
  53619. let history$1 = [];
  53620. const LogByTypeFactory$1 = (name, log2) => (type2, level, args) => {
  53621. const lvl = log2.levels[level];
  53622. const lvlRegExp = new RegExp(`^(${lvl})$`);
  53623. if (type2 !== "log") {
  53624. args.unshift(type2.toUpperCase() + ":");
  53625. }
  53626. args.unshift(name + ":");
  53627. if (history$1) {
  53628. history$1.push([].concat(args));
  53629. const splice2 = history$1.length - 1e3;
  53630. history$1.splice(0, splice2 > 0 ? splice2 : 0);
  53631. }
  53632. if (!window_1.console) {
  53633. return;
  53634. }
  53635. let fn2 = window_1.console[type2];
  53636. if (!fn2 && type2 === "debug") {
  53637. fn2 = window_1.console.info || window_1.console.log;
  53638. }
  53639. if (!fn2 || !lvl || !lvlRegExp.test(type2)) {
  53640. return;
  53641. }
  53642. fn2[Array.isArray(args) ? "apply" : "call"](window_1.console, args);
  53643. };
  53644. function createLogger$1$1(name) {
  53645. let level = "info";
  53646. let logByType;
  53647. const log2 = function(...args) {
  53648. logByType("log", level, args);
  53649. };
  53650. logByType = LogByTypeFactory$1(name, log2);
  53651. log2.createLogger = (subname) => createLogger$1$1(name + ": " + subname);
  53652. log2.levels = {
  53653. all: "debug|log|warn|error",
  53654. off: "",
  53655. debug: "debug|log|warn|error",
  53656. info: "log|warn|error",
  53657. warn: "warn|error",
  53658. error: "error",
  53659. DEFAULT: level
  53660. };
  53661. log2.level = (lvl) => {
  53662. if (typeof lvl === "string") {
  53663. if (!log2.levels.hasOwnProperty(lvl)) {
  53664. throw new Error(`"${lvl}" in not a valid log level`);
  53665. }
  53666. level = lvl;
  53667. }
  53668. return level;
  53669. };
  53670. log2.history = () => history$1 ? [].concat(history$1) : [];
  53671. log2.history.filter = (fname) => {
  53672. return (history$1 || []).filter((historyItem) => {
  53673. return new RegExp(`.*${fname}.*`).test(historyItem[0]);
  53674. });
  53675. };
  53676. log2.history.clear = () => {
  53677. if (history$1) {
  53678. history$1.length = 0;
  53679. }
  53680. };
  53681. log2.history.disable = () => {
  53682. if (history$1 !== null) {
  53683. history$1.length = 0;
  53684. history$1 = null;
  53685. }
  53686. };
  53687. log2.history.enable = () => {
  53688. if (history$1 === null) {
  53689. history$1 = [];
  53690. }
  53691. };
  53692. log2.error = (...args) => logByType("error", level, args);
  53693. log2.warn = (...args) => logByType("warn", level, args);
  53694. log2.debug = (...args) => logByType("debug", level, args);
  53695. return log2;
  53696. }
  53697. const log$1$1 = createLogger$1$1("VIDEOJS");
  53698. const createLogger$2 = log$1$1.createLogger;
  53699. const toString$1 = Object.prototype.toString;
  53700. const keys$1 = function(object) {
  53701. return isObject$2(object) ? Object.keys(object) : [];
  53702. };
  53703. function each$1(object, fn2) {
  53704. keys$1(object).forEach((key) => fn2(object[key], key));
  53705. }
  53706. function reduce$1(object, fn2, initial = 0) {
  53707. return keys$1(object).reduce((accum, key) => fn2(accum, object[key], key), initial);
  53708. }
  53709. function isObject$2(value) {
  53710. return !!value && typeof value === "object";
  53711. }
  53712. function isPlain$1(value) {
  53713. return isObject$2(value) && toString$1.call(value) === "[object Object]" && value.constructor === Object;
  53714. }
  53715. function merge$1(...sources) {
  53716. const result = {};
  53717. sources.forEach((source) => {
  53718. if (!source) {
  53719. return;
  53720. }
  53721. each$1(source, (value, key) => {
  53722. if (!isPlain$1(value)) {
  53723. result[key] = value;
  53724. return;
  53725. }
  53726. if (!isPlain$1(result[key])) {
  53727. result[key] = {};
  53728. }
  53729. result[key] = merge$1(result[key], value);
  53730. });
  53731. });
  53732. return result;
  53733. }
  53734. function defineLazyProperty$1(obj, key, getValue2, setter = true) {
  53735. const set4 = (value) => Object.defineProperty(obj, key, {
  53736. value,
  53737. enumerable: true,
  53738. writable: true
  53739. });
  53740. const options2 = {
  53741. configurable: true,
  53742. enumerable: true,
  53743. get() {
  53744. const value = getValue2();
  53745. set4(value);
  53746. return value;
  53747. }
  53748. };
  53749. if (setter) {
  53750. options2.set = set4;
  53751. }
  53752. return Object.defineProperty(obj, key, options2);
  53753. }
  53754. var Obj = /* @__PURE__ */ Object.freeze({
  53755. __proto__: null,
  53756. each: each$1,
  53757. reduce: reduce$1,
  53758. isObject: isObject$2,
  53759. isPlain: isPlain$1,
  53760. merge: merge$1,
  53761. defineLazyProperty: defineLazyProperty$1
  53762. });
  53763. let IS_IPOD$1 = false;
  53764. let IOS_VERSION$1 = null;
  53765. let IS_ANDROID$1 = false;
  53766. let ANDROID_VERSION$1;
  53767. let IS_FIREFOX$1 = false;
  53768. let IS_EDGE$1 = false;
  53769. let IS_CHROMIUM = false;
  53770. let IS_CHROME$1 = false;
  53771. let CHROMIUM_VERSION = null;
  53772. let CHROME_VERSION$1 = null;
  53773. let IE_VERSION$1 = null;
  53774. let IS_SAFARI$1 = false;
  53775. let IS_WINDOWS$1 = false;
  53776. let IS_IPAD$1 = false;
  53777. let IS_IPHONE$1 = false;
  53778. const TOUCH_ENABLED$1 = Boolean(isReal$1() && ("ontouchstart" in window_1 || window_1.navigator.maxTouchPoints || window_1.DocumentTouch && window_1.document instanceof window_1.DocumentTouch));
  53779. const UAD = window_1.navigator && window_1.navigator.userAgentData;
  53780. if (UAD) {
  53781. IS_ANDROID$1 = UAD.platform === "Android";
  53782. IS_EDGE$1 = Boolean(UAD.brands.find((b) => b.brand === "Microsoft Edge"));
  53783. IS_CHROMIUM = Boolean(UAD.brands.find((b) => b.brand === "Chromium"));
  53784. IS_CHROME$1 = !IS_EDGE$1 && IS_CHROMIUM;
  53785. CHROMIUM_VERSION = CHROME_VERSION$1 = (UAD.brands.find((b) => b.brand === "Chromium") || {}).version || null;
  53786. IS_WINDOWS$1 = UAD.platform === "Windows";
  53787. }
  53788. if (!IS_CHROMIUM) {
  53789. const USER_AGENT2 = window_1.navigator && window_1.navigator.userAgent || "";
  53790. IS_IPOD$1 = /iPod/i.test(USER_AGENT2);
  53791. IOS_VERSION$1 = function() {
  53792. const match = USER_AGENT2.match(/OS (\d+)_/i);
  53793. if (match && match[1]) {
  53794. return match[1];
  53795. }
  53796. return null;
  53797. }();
  53798. IS_ANDROID$1 = /Android/i.test(USER_AGENT2);
  53799. ANDROID_VERSION$1 = function() {
  53800. const match = USER_AGENT2.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);
  53801. if (!match) {
  53802. return null;
  53803. }
  53804. const major = match[1] && parseFloat(match[1]);
  53805. const minor = match[2] && parseFloat(match[2]);
  53806. if (major && minor) {
  53807. return parseFloat(match[1] + "." + match[2]);
  53808. } else if (major) {
  53809. return major;
  53810. }
  53811. return null;
  53812. }();
  53813. IS_FIREFOX$1 = /Firefox/i.test(USER_AGENT2);
  53814. IS_EDGE$1 = /Edg/i.test(USER_AGENT2);
  53815. IS_CHROMIUM = /Chrome/i.test(USER_AGENT2) || /CriOS/i.test(USER_AGENT2);
  53816. IS_CHROME$1 = !IS_EDGE$1 && IS_CHROMIUM;
  53817. CHROMIUM_VERSION = CHROME_VERSION$1 = function() {
  53818. const match = USER_AGENT2.match(/(Chrome|CriOS)\/(\d+)/);
  53819. if (match && match[2]) {
  53820. return parseFloat(match[2]);
  53821. }
  53822. return null;
  53823. }();
  53824. IE_VERSION$1 = function() {
  53825. const result = /MSIE\s(\d+)\.\d/.exec(USER_AGENT2);
  53826. let version2 = result && parseFloat(result[1]);
  53827. if (!version2 && /Trident\/7.0/i.test(USER_AGENT2) && /rv:11.0/.test(USER_AGENT2)) {
  53828. version2 = 11;
  53829. }
  53830. return version2;
  53831. }();
  53832. IS_SAFARI$1 = /Safari/i.test(USER_AGENT2) && !IS_CHROME$1 && !IS_ANDROID$1 && !IS_EDGE$1;
  53833. IS_WINDOWS$1 = /Windows/i.test(USER_AGENT2);
  53834. IS_IPAD$1 = /iPad/i.test(USER_AGENT2) || IS_SAFARI$1 && TOUCH_ENABLED$1 && !/iPhone/i.test(USER_AGENT2);
  53835. IS_IPHONE$1 = /iPhone/i.test(USER_AGENT2) && !IS_IPAD$1;
  53836. }
  53837. const IS_IOS$1 = IS_IPHONE$1 || IS_IPAD$1 || IS_IPOD$1;
  53838. const IS_ANY_SAFARI$1 = (IS_SAFARI$1 || IS_IOS$1) && !IS_CHROME$1;
  53839. var browser$1 = /* @__PURE__ */ Object.freeze({
  53840. __proto__: null,
  53841. get IS_IPOD() {
  53842. return IS_IPOD$1;
  53843. },
  53844. get IOS_VERSION() {
  53845. return IOS_VERSION$1;
  53846. },
  53847. get IS_ANDROID() {
  53848. return IS_ANDROID$1;
  53849. },
  53850. get ANDROID_VERSION() {
  53851. return ANDROID_VERSION$1;
  53852. },
  53853. get IS_FIREFOX() {
  53854. return IS_FIREFOX$1;
  53855. },
  53856. get IS_EDGE() {
  53857. return IS_EDGE$1;
  53858. },
  53859. get IS_CHROMIUM() {
  53860. return IS_CHROMIUM;
  53861. },
  53862. get IS_CHROME() {
  53863. return IS_CHROME$1;
  53864. },
  53865. get CHROMIUM_VERSION() {
  53866. return CHROMIUM_VERSION;
  53867. },
  53868. get CHROME_VERSION() {
  53869. return CHROME_VERSION$1;
  53870. },
  53871. get IE_VERSION() {
  53872. return IE_VERSION$1;
  53873. },
  53874. get IS_SAFARI() {
  53875. return IS_SAFARI$1;
  53876. },
  53877. get IS_WINDOWS() {
  53878. return IS_WINDOWS$1;
  53879. },
  53880. get IS_IPAD() {
  53881. return IS_IPAD$1;
  53882. },
  53883. get IS_IPHONE() {
  53884. return IS_IPHONE$1;
  53885. },
  53886. TOUCH_ENABLED: TOUCH_ENABLED$1,
  53887. IS_IOS: IS_IOS$1,
  53888. IS_ANY_SAFARI: IS_ANY_SAFARI$1
  53889. });
  53890. function isNonBlankString$1(str) {
  53891. return typeof str === "string" && Boolean(str.trim());
  53892. }
  53893. function throwIfWhitespace$1(str) {
  53894. if (str.indexOf(" ") >= 0) {
  53895. throw new Error("class has illegal whitespace characters");
  53896. }
  53897. }
  53898. function isReal$1() {
  53899. return document_1 === window_1.document;
  53900. }
  53901. function isEl$1(value) {
  53902. return isObject$2(value) && value.nodeType === 1;
  53903. }
  53904. function isInFrame$1() {
  53905. try {
  53906. return window_1.parent !== window_1.self;
  53907. } catch (x) {
  53908. return true;
  53909. }
  53910. }
  53911. function createQuerier$1(method) {
  53912. return function(selector, context) {
  53913. if (!isNonBlankString$1(selector)) {
  53914. return document_1[method](null);
  53915. }
  53916. if (isNonBlankString$1(context)) {
  53917. context = document_1.querySelector(context);
  53918. }
  53919. const ctx = isEl$1(context) ? context : document_1;
  53920. return ctx[method] && ctx[method](selector);
  53921. };
  53922. }
  53923. function createEl$1(tagName = "div", properties = {}, attributes = {}, content) {
  53924. const el = document_1.createElement(tagName);
  53925. Object.getOwnPropertyNames(properties).forEach(function(propName) {
  53926. const val = properties[propName];
  53927. if (propName === "textContent") {
  53928. textContent$1(el, val);
  53929. } else if (el[propName] !== val || propName === "tabIndex") {
  53930. el[propName] = val;
  53931. }
  53932. });
  53933. Object.getOwnPropertyNames(attributes).forEach(function(attrName) {
  53934. el.setAttribute(attrName, attributes[attrName]);
  53935. });
  53936. if (content) {
  53937. appendContent$1(el, content);
  53938. }
  53939. return el;
  53940. }
  53941. function textContent$1(el, text) {
  53942. if (typeof el.textContent === "undefined") {
  53943. el.innerText = text;
  53944. } else {
  53945. el.textContent = text;
  53946. }
  53947. return el;
  53948. }
  53949. function prependTo$1(child, parent) {
  53950. if (parent.firstChild) {
  53951. parent.insertBefore(child, parent.firstChild);
  53952. } else {
  53953. parent.appendChild(child);
  53954. }
  53955. }
  53956. function hasClass$1(element, classToCheck) {
  53957. throwIfWhitespace$1(classToCheck);
  53958. return element.classList.contains(classToCheck);
  53959. }
  53960. function addClass$1(element, ...classesToAdd) {
  53961. element.classList.add(...classesToAdd.reduce((prev, current) => prev.concat(current.split(/\s+/)), []));
  53962. return element;
  53963. }
  53964. function removeClass$1(element, ...classesToRemove) {
  53965. if (!element) {
  53966. log$1$1.warn("removeClass was called with an element that doesn't exist");
  53967. return null;
  53968. }
  53969. element.classList.remove(...classesToRemove.reduce((prev, current) => prev.concat(current.split(/\s+/)), []));
  53970. return element;
  53971. }
  53972. function toggleClass$1(element, classToToggle, predicate) {
  53973. if (typeof predicate === "function") {
  53974. predicate = predicate(element, classToToggle);
  53975. }
  53976. if (typeof predicate !== "boolean") {
  53977. predicate = void 0;
  53978. }
  53979. classToToggle.split(/\s+/).forEach((className) => element.classList.toggle(className, predicate));
  53980. return element;
  53981. }
  53982. function setAttributes$1(el, attributes) {
  53983. Object.getOwnPropertyNames(attributes).forEach(function(attrName) {
  53984. const attrValue = attributes[attrName];
  53985. if (attrValue === null || typeof attrValue === "undefined" || attrValue === false) {
  53986. el.removeAttribute(attrName);
  53987. } else {
  53988. el.setAttribute(attrName, attrValue === true ? "" : attrValue);
  53989. }
  53990. });
  53991. }
  53992. function getAttributes$1(tag) {
  53993. const obj = {};
  53994. const knownBooleans = ",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";
  53995. if (tag && tag.attributes && tag.attributes.length > 0) {
  53996. const attrs = tag.attributes;
  53997. for (let i2 = attrs.length - 1; i2 >= 0; i2--) {
  53998. const attrName = attrs[i2].name;
  53999. let attrVal = attrs[i2].value;
  54000. if (typeof tag[attrName] === "boolean" || knownBooleans.indexOf("," + attrName + ",") !== -1) {
  54001. attrVal = attrVal !== null ? true : false;
  54002. }
  54003. obj[attrName] = attrVal;
  54004. }
  54005. }
  54006. return obj;
  54007. }
  54008. function getAttribute$1(el, attribute) {
  54009. return el.getAttribute(attribute);
  54010. }
  54011. function setAttribute$1(el, attribute, value) {
  54012. el.setAttribute(attribute, value);
  54013. }
  54014. function removeAttribute$1(el, attribute) {
  54015. el.removeAttribute(attribute);
  54016. }
  54017. function blockTextSelection$1() {
  54018. document_1.body.focus();
  54019. document_1.onselectstart = function() {
  54020. return false;
  54021. };
  54022. }
  54023. function unblockTextSelection$1() {
  54024. document_1.onselectstart = function() {
  54025. return true;
  54026. };
  54027. }
  54028. function getBoundingClientRect$1(el) {
  54029. if (el && el.getBoundingClientRect && el.parentNode) {
  54030. const rect = el.getBoundingClientRect();
  54031. const result = {};
  54032. ["bottom", "height", "left", "right", "top", "width"].forEach((k) => {
  54033. if (rect[k] !== void 0) {
  54034. result[k] = rect[k];
  54035. }
  54036. });
  54037. if (!result.height) {
  54038. result.height = parseFloat(computedStyle$1(el, "height"));
  54039. }
  54040. if (!result.width) {
  54041. result.width = parseFloat(computedStyle$1(el, "width"));
  54042. }
  54043. return result;
  54044. }
  54045. }
  54046. function findPosition$1(el) {
  54047. if (!el || el && !el.offsetParent) {
  54048. return {
  54049. left: 0,
  54050. top: 0,
  54051. width: 0,
  54052. height: 0
  54053. };
  54054. }
  54055. const width2 = el.offsetWidth;
  54056. const height2 = el.offsetHeight;
  54057. let left = 0;
  54058. let top = 0;
  54059. while (el.offsetParent && el !== document_1[FullscreenApi$1.fullscreenElement]) {
  54060. left += el.offsetLeft;
  54061. top += el.offsetTop;
  54062. el = el.offsetParent;
  54063. }
  54064. return {
  54065. left,
  54066. top,
  54067. width: width2,
  54068. height: height2
  54069. };
  54070. }
  54071. function getPointerPosition$1(el, event2) {
  54072. const translated = {
  54073. x: 0,
  54074. y: 0
  54075. };
  54076. if (IS_IOS$1) {
  54077. let item = el;
  54078. while (item && item.nodeName.toLowerCase() !== "html") {
  54079. const transform3 = computedStyle$1(item, "transform");
  54080. if (/^matrix/.test(transform3)) {
  54081. const values3 = transform3.slice(7, -1).split(/,\s/).map(Number);
  54082. translated.x += values3[4];
  54083. translated.y += values3[5];
  54084. } else if (/^matrix3d/.test(transform3)) {
  54085. const values3 = transform3.slice(9, -1).split(/,\s/).map(Number);
  54086. translated.x += values3[12];
  54087. translated.y += values3[13];
  54088. }
  54089. item = item.parentNode;
  54090. }
  54091. }
  54092. const position2 = {};
  54093. const boxTarget = findPosition$1(event2.target);
  54094. const box = findPosition$1(el);
  54095. const boxW = box.width;
  54096. const boxH = box.height;
  54097. let offsetY = event2.offsetY - (box.top - boxTarget.top);
  54098. let offsetX = event2.offsetX - (box.left - boxTarget.left);
  54099. if (event2.changedTouches) {
  54100. offsetX = event2.changedTouches[0].pageX - box.left;
  54101. offsetY = event2.changedTouches[0].pageY + box.top;
  54102. if (IS_IOS$1) {
  54103. offsetX -= translated.x;
  54104. offsetY -= translated.y;
  54105. }
  54106. }
  54107. position2.y = 1 - Math.max(0, Math.min(1, offsetY / boxH));
  54108. position2.x = Math.max(0, Math.min(1, offsetX / boxW));
  54109. return position2;
  54110. }
  54111. function isTextNode$1(value) {
  54112. return isObject$2(value) && value.nodeType === 3;
  54113. }
  54114. function emptyEl$1(el) {
  54115. while (el.firstChild) {
  54116. el.removeChild(el.firstChild);
  54117. }
  54118. return el;
  54119. }
  54120. function normalizeContent$1(content) {
  54121. if (typeof content === "function") {
  54122. content = content();
  54123. }
  54124. return (Array.isArray(content) ? content : [content]).map((value) => {
  54125. if (typeof value === "function") {
  54126. value = value();
  54127. }
  54128. if (isEl$1(value) || isTextNode$1(value)) {
  54129. return value;
  54130. }
  54131. if (typeof value === "string" && /\S/.test(value)) {
  54132. return document_1.createTextNode(value);
  54133. }
  54134. }).filter((value) => value);
  54135. }
  54136. function appendContent$1(el, content) {
  54137. normalizeContent$1(content).forEach((node) => el.appendChild(node));
  54138. return el;
  54139. }
  54140. function insertContent$1(el, content) {
  54141. return appendContent$1(emptyEl$1(el), content);
  54142. }
  54143. function isSingleLeftClick$1(event2) {
  54144. if (event2.button === void 0 && event2.buttons === void 0) {
  54145. return true;
  54146. }
  54147. if (event2.button === 0 && event2.buttons === void 0) {
  54148. return true;
  54149. }
  54150. if (event2.type === "mouseup" && event2.button === 0 && event2.buttons === 0) {
  54151. return true;
  54152. }
  54153. if (event2.button !== 0 || event2.buttons !== 1) {
  54154. return false;
  54155. }
  54156. return true;
  54157. }
  54158. const $$1 = createQuerier$1("querySelector");
  54159. const $$$1 = createQuerier$1("querySelectorAll");
  54160. function computedStyle$1(el, prop) {
  54161. if (!el || !prop) {
  54162. return "";
  54163. }
  54164. if (typeof window_1.getComputedStyle === "function") {
  54165. let computedStyleValue;
  54166. try {
  54167. computedStyleValue = window_1.getComputedStyle(el);
  54168. } catch (e) {
  54169. return "";
  54170. }
  54171. return computedStyleValue ? computedStyleValue.getPropertyValue(prop) || computedStyleValue[prop] : "";
  54172. }
  54173. return "";
  54174. }
  54175. var Dom$2 = /* @__PURE__ */ Object.freeze({
  54176. __proto__: null,
  54177. isReal: isReal$1,
  54178. isEl: isEl$1,
  54179. isInFrame: isInFrame$1,
  54180. createEl: createEl$1,
  54181. textContent: textContent$1,
  54182. prependTo: prependTo$1,
  54183. hasClass: hasClass$1,
  54184. addClass: addClass$1,
  54185. removeClass: removeClass$1,
  54186. toggleClass: toggleClass$1,
  54187. setAttributes: setAttributes$1,
  54188. getAttributes: getAttributes$1,
  54189. getAttribute: getAttribute$1,
  54190. setAttribute: setAttribute$1,
  54191. removeAttribute: removeAttribute$1,
  54192. blockTextSelection: blockTextSelection$1,
  54193. unblockTextSelection: unblockTextSelection$1,
  54194. getBoundingClientRect: getBoundingClientRect$1,
  54195. findPosition: findPosition$1,
  54196. getPointerPosition: getPointerPosition$1,
  54197. isTextNode: isTextNode$1,
  54198. emptyEl: emptyEl$1,
  54199. normalizeContent: normalizeContent$1,
  54200. appendContent: appendContent$1,
  54201. insertContent: insertContent$1,
  54202. isSingleLeftClick: isSingleLeftClick$1,
  54203. $: $$1,
  54204. $$: $$$1,
  54205. computedStyle: computedStyle$1
  54206. });
  54207. let _windowLoaded$1 = false;
  54208. let videojs$1$1;
  54209. const autoSetup$1 = function() {
  54210. if (videojs$1$1.options.autoSetup === false) {
  54211. return;
  54212. }
  54213. const vids = Array.prototype.slice.call(document_1.getElementsByTagName("video"));
  54214. const audios = Array.prototype.slice.call(document_1.getElementsByTagName("audio"));
  54215. const divs = Array.prototype.slice.call(document_1.getElementsByTagName("video-js"));
  54216. const mediaEls = vids.concat(audios, divs);
  54217. if (mediaEls && mediaEls.length > 0) {
  54218. for (let i2 = 0, e = mediaEls.length; i2 < e; i2++) {
  54219. const mediaEl = mediaEls[i2];
  54220. if (mediaEl && mediaEl.getAttribute) {
  54221. if (mediaEl.player === void 0) {
  54222. const options2 = mediaEl.getAttribute("data-setup");
  54223. if (options2 !== null) {
  54224. videojs$1$1(mediaEl);
  54225. }
  54226. }
  54227. } else {
  54228. autoSetupTimeout$1(1);
  54229. break;
  54230. }
  54231. }
  54232. } else if (!_windowLoaded$1) {
  54233. autoSetupTimeout$1(1);
  54234. }
  54235. };
  54236. function autoSetupTimeout$1(wait, vjs) {
  54237. if (!isReal$1()) {
  54238. return;
  54239. }
  54240. if (vjs) {
  54241. videojs$1$1 = vjs;
  54242. }
  54243. window_1.setTimeout(autoSetup$1, wait);
  54244. }
  54245. function setWindowLoaded$1() {
  54246. _windowLoaded$1 = true;
  54247. window_1.removeEventListener("load", setWindowLoaded$1);
  54248. }
  54249. if (isReal$1()) {
  54250. if (document_1.readyState === "complete") {
  54251. setWindowLoaded$1();
  54252. } else {
  54253. window_1.addEventListener("load", setWindowLoaded$1);
  54254. }
  54255. }
  54256. const createStyleElement$1 = function(className) {
  54257. const style = document_1.createElement("style");
  54258. style.className = className;
  54259. return style;
  54260. };
  54261. const setTextContent$1 = function(el, content) {
  54262. if (el.styleSheet) {
  54263. el.styleSheet.cssText = content;
  54264. } else {
  54265. el.textContent = content;
  54266. }
  54267. };
  54268. var DomData$1 = /* @__PURE__ */ new WeakMap();
  54269. const _initialGuid$1 = 3;
  54270. let _guid$1 = _initialGuid$1;
  54271. function newGUID$1() {
  54272. return _guid$1++;
  54273. }
  54274. function _cleanUpEvents$1(elem, type2) {
  54275. if (!DomData$1.has(elem)) {
  54276. return;
  54277. }
  54278. const data = DomData$1.get(elem);
  54279. if (data.handlers[type2].length === 0) {
  54280. delete data.handlers[type2];
  54281. if (elem.removeEventListener) {
  54282. elem.removeEventListener(type2, data.dispatcher, false);
  54283. } else if (elem.detachEvent) {
  54284. elem.detachEvent("on" + type2, data.dispatcher);
  54285. }
  54286. }
  54287. if (Object.getOwnPropertyNames(data.handlers).length <= 0) {
  54288. delete data.handlers;
  54289. delete data.dispatcher;
  54290. delete data.disabled;
  54291. }
  54292. if (Object.getOwnPropertyNames(data).length === 0) {
  54293. DomData$1.delete(elem);
  54294. }
  54295. }
  54296. function _handleMultipleEvents$1(fn2, elem, types, callback2) {
  54297. types.forEach(function(type2) {
  54298. fn2(elem, type2, callback2);
  54299. });
  54300. }
  54301. function fixEvent$1(event2) {
  54302. if (event2.fixed_) {
  54303. return event2;
  54304. }
  54305. function returnTrue() {
  54306. return true;
  54307. }
  54308. function returnFalse() {
  54309. return false;
  54310. }
  54311. if (!event2 || !event2.isPropagationStopped || !event2.isImmediatePropagationStopped) {
  54312. const old = event2 || window_1.event;
  54313. event2 = {};
  54314. for (const key in old) {
  54315. if (key !== "layerX" && key !== "layerY" && key !== "keyLocation" && key !== "webkitMovementX" && key !== "webkitMovementY" && key !== "path") {
  54316. if (!(key === "returnValue" && old.preventDefault)) {
  54317. event2[key] = old[key];
  54318. }
  54319. }
  54320. }
  54321. if (!event2.target) {
  54322. event2.target = event2.srcElement || document_1;
  54323. }
  54324. if (!event2.relatedTarget) {
  54325. event2.relatedTarget = event2.fromElement === event2.target ? event2.toElement : event2.fromElement;
  54326. }
  54327. event2.preventDefault = function() {
  54328. if (old.preventDefault) {
  54329. old.preventDefault();
  54330. }
  54331. event2.returnValue = false;
  54332. old.returnValue = false;
  54333. event2.defaultPrevented = true;
  54334. };
  54335. event2.defaultPrevented = false;
  54336. event2.stopPropagation = function() {
  54337. if (old.stopPropagation) {
  54338. old.stopPropagation();
  54339. }
  54340. event2.cancelBubble = true;
  54341. old.cancelBubble = true;
  54342. event2.isPropagationStopped = returnTrue;
  54343. };
  54344. event2.isPropagationStopped = returnFalse;
  54345. event2.stopImmediatePropagation = function() {
  54346. if (old.stopImmediatePropagation) {
  54347. old.stopImmediatePropagation();
  54348. }
  54349. event2.isImmediatePropagationStopped = returnTrue;
  54350. event2.stopPropagation();
  54351. };
  54352. event2.isImmediatePropagationStopped = returnFalse;
  54353. if (event2.clientX !== null && event2.clientX !== void 0) {
  54354. const doc = document_1.documentElement;
  54355. const body = document_1.body;
  54356. event2.pageX = event2.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
  54357. event2.pageY = event2.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
  54358. }
  54359. event2.which = event2.charCode || event2.keyCode;
  54360. if (event2.button !== null && event2.button !== void 0) {
  54361. event2.button = event2.button & 1 ? 0 : event2.button & 4 ? 1 : event2.button & 2 ? 2 : 0;
  54362. }
  54363. }
  54364. event2.fixed_ = true;
  54365. return event2;
  54366. }
  54367. let _supportsPassive$1;
  54368. const supportsPassive$1 = function() {
  54369. if (typeof _supportsPassive$1 !== "boolean") {
  54370. _supportsPassive$1 = false;
  54371. try {
  54372. const opts = Object.defineProperty({}, "passive", {
  54373. get() {
  54374. _supportsPassive$1 = true;
  54375. }
  54376. });
  54377. window_1.addEventListener("test", null, opts);
  54378. window_1.removeEventListener("test", null, opts);
  54379. } catch (e) {
  54380. }
  54381. }
  54382. return _supportsPassive$1;
  54383. };
  54384. const passiveEvents$1 = ["touchstart", "touchmove"];
  54385. function on$1(elem, type2, fn2) {
  54386. if (Array.isArray(type2)) {
  54387. return _handleMultipleEvents$1(on$1, elem, type2, fn2);
  54388. }
  54389. if (!DomData$1.has(elem)) {
  54390. DomData$1.set(elem, {});
  54391. }
  54392. const data = DomData$1.get(elem);
  54393. if (!data.handlers) {
  54394. data.handlers = {};
  54395. }
  54396. if (!data.handlers[type2]) {
  54397. data.handlers[type2] = [];
  54398. }
  54399. if (!fn2.guid) {
  54400. fn2.guid = newGUID$1();
  54401. }
  54402. data.handlers[type2].push(fn2);
  54403. if (!data.dispatcher) {
  54404. data.disabled = false;
  54405. data.dispatcher = function(event2, hash) {
  54406. if (data.disabled) {
  54407. return;
  54408. }
  54409. event2 = fixEvent$1(event2);
  54410. const handlers = data.handlers[event2.type];
  54411. if (handlers) {
  54412. const handlersCopy = handlers.slice(0);
  54413. for (let m = 0, n = handlersCopy.length; m < n; m++) {
  54414. if (event2.isImmediatePropagationStopped()) {
  54415. break;
  54416. } else {
  54417. try {
  54418. handlersCopy[m].call(elem, event2, hash);
  54419. } catch (e) {
  54420. log$1$1.error(e);
  54421. }
  54422. }
  54423. }
  54424. }
  54425. };
  54426. }
  54427. if (data.handlers[type2].length === 1) {
  54428. if (elem.addEventListener) {
  54429. let options2 = false;
  54430. if (supportsPassive$1() && passiveEvents$1.indexOf(type2) > -1) {
  54431. options2 = {
  54432. passive: true
  54433. };
  54434. }
  54435. elem.addEventListener(type2, data.dispatcher, options2);
  54436. } else if (elem.attachEvent) {
  54437. elem.attachEvent("on" + type2, data.dispatcher);
  54438. }
  54439. }
  54440. }
  54441. function off$1(elem, type2, fn2) {
  54442. if (!DomData$1.has(elem)) {
  54443. return;
  54444. }
  54445. const data = DomData$1.get(elem);
  54446. if (!data.handlers) {
  54447. return;
  54448. }
  54449. if (Array.isArray(type2)) {
  54450. return _handleMultipleEvents$1(off$1, elem, type2, fn2);
  54451. }
  54452. const removeType = function(el, t2) {
  54453. data.handlers[t2] = [];
  54454. _cleanUpEvents$1(el, t2);
  54455. };
  54456. if (type2 === void 0) {
  54457. for (const t2 in data.handlers) {
  54458. if (Object.prototype.hasOwnProperty.call(data.handlers || {}, t2)) {
  54459. removeType(elem, t2);
  54460. }
  54461. }
  54462. return;
  54463. }
  54464. const handlers = data.handlers[type2];
  54465. if (!handlers) {
  54466. return;
  54467. }
  54468. if (!fn2) {
  54469. removeType(elem, type2);
  54470. return;
  54471. }
  54472. if (fn2.guid) {
  54473. for (let n = 0; n < handlers.length; n++) {
  54474. if (handlers[n].guid === fn2.guid) {
  54475. handlers.splice(n--, 1);
  54476. }
  54477. }
  54478. }
  54479. _cleanUpEvents$1(elem, type2);
  54480. }
  54481. function trigger$1(elem, event2, hash) {
  54482. const elemData = DomData$1.has(elem) ? DomData$1.get(elem) : {};
  54483. const parent = elem.parentNode || elem.ownerDocument;
  54484. if (typeof event2 === "string") {
  54485. event2 = {
  54486. type: event2,
  54487. target: elem
  54488. };
  54489. } else if (!event2.target) {
  54490. event2.target = elem;
  54491. }
  54492. event2 = fixEvent$1(event2);
  54493. if (elemData.dispatcher) {
  54494. elemData.dispatcher.call(elem, event2, hash);
  54495. }
  54496. if (parent && !event2.isPropagationStopped() && event2.bubbles === true) {
  54497. trigger$1.call(null, parent, event2, hash);
  54498. } else if (!parent && !event2.defaultPrevented && event2.target && event2.target[event2.type]) {
  54499. if (!DomData$1.has(event2.target)) {
  54500. DomData$1.set(event2.target, {});
  54501. }
  54502. const targetData = DomData$1.get(event2.target);
  54503. if (event2.target[event2.type]) {
  54504. targetData.disabled = true;
  54505. if (typeof event2.target[event2.type] === "function") {
  54506. event2.target[event2.type]();
  54507. }
  54508. targetData.disabled = false;
  54509. }
  54510. }
  54511. return !event2.defaultPrevented;
  54512. }
  54513. function one$1(elem, type2, fn2) {
  54514. if (Array.isArray(type2)) {
  54515. return _handleMultipleEvents$1(one$1, elem, type2, fn2);
  54516. }
  54517. const func = function() {
  54518. off$1(elem, type2, func);
  54519. fn2.apply(this, arguments);
  54520. };
  54521. func.guid = fn2.guid = fn2.guid || newGUID$1();
  54522. on$1(elem, type2, func);
  54523. }
  54524. function any$1(elem, type2, fn2) {
  54525. const func = function() {
  54526. off$1(elem, type2, func);
  54527. fn2.apply(this, arguments);
  54528. };
  54529. func.guid = fn2.guid = fn2.guid || newGUID$1();
  54530. on$1(elem, type2, func);
  54531. }
  54532. var Events$1 = /* @__PURE__ */ Object.freeze({
  54533. __proto__: null,
  54534. fixEvent: fixEvent$1,
  54535. on: on$1,
  54536. off: off$1,
  54537. trigger: trigger$1,
  54538. one: one$1,
  54539. any: any$1
  54540. });
  54541. const UPDATE_REFRESH_INTERVAL$1 = 30;
  54542. const bind_ = function(context, fn2, uid) {
  54543. if (!fn2.guid) {
  54544. fn2.guid = newGUID$1();
  54545. }
  54546. const bound = fn2.bind(context);
  54547. bound.guid = uid ? uid + "_" + fn2.guid : fn2.guid;
  54548. return bound;
  54549. };
  54550. const throttle$1 = function(fn2, wait) {
  54551. let last = window_1.performance.now();
  54552. const throttled = function(...args) {
  54553. const now2 = window_1.performance.now();
  54554. if (now2 - last >= wait) {
  54555. fn2(...args);
  54556. last = now2;
  54557. }
  54558. };
  54559. return throttled;
  54560. };
  54561. const debounce$1 = function(func, wait, immediate, context = window_1) {
  54562. let timeout;
  54563. const cancel = () => {
  54564. context.clearTimeout(timeout);
  54565. timeout = null;
  54566. };
  54567. const debounced = function() {
  54568. const self2 = this;
  54569. const args = arguments;
  54570. let later = function() {
  54571. timeout = null;
  54572. later = null;
  54573. if (!immediate) {
  54574. func.apply(self2, args);
  54575. }
  54576. };
  54577. if (!timeout && immediate) {
  54578. func.apply(self2, args);
  54579. }
  54580. context.clearTimeout(timeout);
  54581. timeout = context.setTimeout(later, wait);
  54582. };
  54583. debounced.cancel = cancel;
  54584. return debounced;
  54585. };
  54586. var Fn = /* @__PURE__ */ Object.freeze({
  54587. __proto__: null,
  54588. UPDATE_REFRESH_INTERVAL: UPDATE_REFRESH_INTERVAL$1,
  54589. bind_,
  54590. throttle: throttle$1,
  54591. debounce: debounce$1
  54592. });
  54593. let EVENT_MAP$1;
  54594. class EventTarget$2$1 {
  54595. on(type2, fn2) {
  54596. const ael = this.addEventListener;
  54597. this.addEventListener = () => {
  54598. };
  54599. on$1(this, type2, fn2);
  54600. this.addEventListener = ael;
  54601. }
  54602. off(type2, fn2) {
  54603. off$1(this, type2, fn2);
  54604. }
  54605. one(type2, fn2) {
  54606. const ael = this.addEventListener;
  54607. this.addEventListener = () => {
  54608. };
  54609. one$1(this, type2, fn2);
  54610. this.addEventListener = ael;
  54611. }
  54612. any(type2, fn2) {
  54613. const ael = this.addEventListener;
  54614. this.addEventListener = () => {
  54615. };
  54616. any$1(this, type2, fn2);
  54617. this.addEventListener = ael;
  54618. }
  54619. trigger(event2) {
  54620. const type2 = event2.type || event2;
  54621. if (typeof event2 === "string") {
  54622. event2 = {
  54623. type: type2
  54624. };
  54625. }
  54626. event2 = fixEvent$1(event2);
  54627. if (this.allowedEvents_[type2] && this["on" + type2]) {
  54628. this["on" + type2](event2);
  54629. }
  54630. trigger$1(this, event2);
  54631. }
  54632. queueTrigger(event2) {
  54633. if (!EVENT_MAP$1) {
  54634. EVENT_MAP$1 = /* @__PURE__ */ new Map();
  54635. }
  54636. const type2 = event2.type || event2;
  54637. let map = EVENT_MAP$1.get(this);
  54638. if (!map) {
  54639. map = /* @__PURE__ */ new Map();
  54640. EVENT_MAP$1.set(this, map);
  54641. }
  54642. const oldTimeout = map.get(type2);
  54643. map.delete(type2);
  54644. window_1.clearTimeout(oldTimeout);
  54645. const timeout = window_1.setTimeout(() => {
  54646. map.delete(type2);
  54647. if (map.size === 0) {
  54648. map = null;
  54649. EVENT_MAP$1.delete(this);
  54650. }
  54651. this.trigger(event2);
  54652. }, 0);
  54653. map.set(type2, timeout);
  54654. }
  54655. }
  54656. EventTarget$2$1.prototype.allowedEvents_ = {};
  54657. EventTarget$2$1.prototype.addEventListener = EventTarget$2$1.prototype.on;
  54658. EventTarget$2$1.prototype.removeEventListener = EventTarget$2$1.prototype.off;
  54659. EventTarget$2$1.prototype.dispatchEvent = EventTarget$2$1.prototype.trigger;
  54660. const objName$1 = (obj) => {
  54661. if (typeof obj.name === "function") {
  54662. return obj.name();
  54663. }
  54664. if (typeof obj.name === "string") {
  54665. return obj.name;
  54666. }
  54667. if (obj.name_) {
  54668. return obj.name_;
  54669. }
  54670. if (obj.constructor && obj.constructor.name) {
  54671. return obj.constructor.name;
  54672. }
  54673. return typeof obj;
  54674. };
  54675. const isEvented$1 = (object) => object instanceof EventTarget$2$1 || !!object.eventBusEl_ && ["on", "one", "off", "trigger"].every((k) => typeof object[k] === "function");
  54676. const addEventedCallback$1 = (target, callback2) => {
  54677. if (isEvented$1(target)) {
  54678. callback2();
  54679. } else {
  54680. if (!target.eventedCallbacks) {
  54681. target.eventedCallbacks = [];
  54682. }
  54683. target.eventedCallbacks.push(callback2);
  54684. }
  54685. };
  54686. const isValidEventType$1 = (type2) => typeof type2 === "string" && /\S/.test(type2) || Array.isArray(type2) && !!type2.length;
  54687. const validateTarget$1 = (target, obj, fnName) => {
  54688. if (!target || !target.nodeName && !isEvented$1(target)) {
  54689. throw new Error(`Invalid target for ${objName$1(obj)}#${fnName}; must be a DOM node or evented object.`);
  54690. }
  54691. };
  54692. const validateEventType$1 = (type2, obj, fnName) => {
  54693. if (!isValidEventType$1(type2)) {
  54694. throw new Error(`Invalid event type for ${objName$1(obj)}#${fnName}; must be a non-empty string or array.`);
  54695. }
  54696. };
  54697. const validateListener$1 = (listener, obj, fnName) => {
  54698. if (typeof listener !== "function") {
  54699. throw new Error(`Invalid listener for ${objName$1(obj)}#${fnName}; must be a function.`);
  54700. }
  54701. };
  54702. const normalizeListenArgs$1 = (self2, args, fnName) => {
  54703. const isTargetingSelf = args.length < 3 || args[0] === self2 || args[0] === self2.eventBusEl_;
  54704. let target;
  54705. let type2;
  54706. let listener;
  54707. if (isTargetingSelf) {
  54708. target = self2.eventBusEl_;
  54709. if (args.length >= 3) {
  54710. args.shift();
  54711. }
  54712. [type2, listener] = args;
  54713. } else {
  54714. [target, type2, listener] = args;
  54715. }
  54716. validateTarget$1(target, self2, fnName);
  54717. validateEventType$1(type2, self2, fnName);
  54718. validateListener$1(listener, self2, fnName);
  54719. listener = bind_(self2, listener);
  54720. return {
  54721. isTargetingSelf,
  54722. target,
  54723. type: type2,
  54724. listener
  54725. };
  54726. };
  54727. const listen$1 = (target, method, type2, listener) => {
  54728. validateTarget$1(target, target, method);
  54729. if (target.nodeName) {
  54730. Events$1[method](target, type2, listener);
  54731. } else {
  54732. target[method](type2, listener);
  54733. }
  54734. };
  54735. const EventedMixin$1 = {
  54736. on(...args) {
  54737. const {
  54738. isTargetingSelf,
  54739. target,
  54740. type: type2,
  54741. listener
  54742. } = normalizeListenArgs$1(this, args, "on");
  54743. listen$1(target, "on", type2, listener);
  54744. if (!isTargetingSelf) {
  54745. const removeListenerOnDispose = () => this.off(target, type2, listener);
  54746. removeListenerOnDispose.guid = listener.guid;
  54747. const removeRemoverOnTargetDispose = () => this.off("dispose", removeListenerOnDispose);
  54748. removeRemoverOnTargetDispose.guid = listener.guid;
  54749. listen$1(this, "on", "dispose", removeListenerOnDispose);
  54750. listen$1(target, "on", "dispose", removeRemoverOnTargetDispose);
  54751. }
  54752. },
  54753. one(...args) {
  54754. const {
  54755. isTargetingSelf,
  54756. target,
  54757. type: type2,
  54758. listener
  54759. } = normalizeListenArgs$1(this, args, "one");
  54760. if (isTargetingSelf) {
  54761. listen$1(target, "one", type2, listener);
  54762. } else {
  54763. const wrapper = (...largs) => {
  54764. this.off(target, type2, wrapper);
  54765. listener.apply(null, largs);
  54766. };
  54767. wrapper.guid = listener.guid;
  54768. listen$1(target, "one", type2, wrapper);
  54769. }
  54770. },
  54771. any(...args) {
  54772. const {
  54773. isTargetingSelf,
  54774. target,
  54775. type: type2,
  54776. listener
  54777. } = normalizeListenArgs$1(this, args, "any");
  54778. if (isTargetingSelf) {
  54779. listen$1(target, "any", type2, listener);
  54780. } else {
  54781. const wrapper = (...largs) => {
  54782. this.off(target, type2, wrapper);
  54783. listener.apply(null, largs);
  54784. };
  54785. wrapper.guid = listener.guid;
  54786. listen$1(target, "any", type2, wrapper);
  54787. }
  54788. },
  54789. off(targetOrType, typeOrListener, listener) {
  54790. if (!targetOrType || isValidEventType$1(targetOrType)) {
  54791. off$1(this.eventBusEl_, targetOrType, typeOrListener);
  54792. } else {
  54793. const target = targetOrType;
  54794. const type2 = typeOrListener;
  54795. validateTarget$1(target, this, "off");
  54796. validateEventType$1(type2, this, "off");
  54797. validateListener$1(listener, this, "off");
  54798. listener = bind_(this, listener);
  54799. this.off("dispose", listener);
  54800. if (target.nodeName) {
  54801. off$1(target, type2, listener);
  54802. off$1(target, "dispose", listener);
  54803. } else if (isEvented$1(target)) {
  54804. target.off(type2, listener);
  54805. target.off("dispose", listener);
  54806. }
  54807. }
  54808. },
  54809. trigger(event2, hash) {
  54810. validateTarget$1(this.eventBusEl_, this, "trigger");
  54811. const type2 = event2 && typeof event2 !== "string" ? event2.type : event2;
  54812. if (!isValidEventType$1(type2)) {
  54813. throw new Error(`Invalid event type for ${objName$1(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);
  54814. }
  54815. return trigger$1(this.eventBusEl_, event2, hash);
  54816. }
  54817. };
  54818. function evented$1(target, options2 = {}) {
  54819. const {
  54820. eventBusKey
  54821. } = options2;
  54822. if (eventBusKey) {
  54823. if (!target[eventBusKey].nodeName) {
  54824. throw new Error(`The eventBusKey "${eventBusKey}" does not refer to an element.`);
  54825. }
  54826. target.eventBusEl_ = target[eventBusKey];
  54827. } else {
  54828. target.eventBusEl_ = createEl$1("span", {
  54829. className: "vjs-event-bus"
  54830. });
  54831. }
  54832. Object.assign(target, EventedMixin$1);
  54833. if (target.eventedCallbacks) {
  54834. target.eventedCallbacks.forEach((callback2) => {
  54835. callback2();
  54836. });
  54837. }
  54838. target.on("dispose", () => {
  54839. target.off();
  54840. [target, target.el_, target.eventBusEl_].forEach(function(val) {
  54841. if (val && DomData$1.has(val)) {
  54842. DomData$1.delete(val);
  54843. }
  54844. });
  54845. window_1.setTimeout(() => {
  54846. target.eventBusEl_ = null;
  54847. }, 0);
  54848. });
  54849. return target;
  54850. }
  54851. const StatefulMixin$1 = {
  54852. state: {},
  54853. setState(stateUpdates) {
  54854. if (typeof stateUpdates === "function") {
  54855. stateUpdates = stateUpdates();
  54856. }
  54857. let changes;
  54858. each$1(stateUpdates, (value, key) => {
  54859. if (this.state[key] !== value) {
  54860. changes = changes || {};
  54861. changes[key] = {
  54862. from: this.state[key],
  54863. to: value
  54864. };
  54865. }
  54866. this.state[key] = value;
  54867. });
  54868. if (changes && isEvented$1(this)) {
  54869. this.trigger({
  54870. changes,
  54871. type: "statechanged"
  54872. });
  54873. }
  54874. return changes;
  54875. }
  54876. };
  54877. function stateful$1(target, defaultState) {
  54878. Object.assign(target, StatefulMixin$1);
  54879. target.state = Object.assign({}, target.state, defaultState);
  54880. if (typeof target.handleStateChanged === "function" && isEvented$1(target)) {
  54881. target.on("statechanged", target.handleStateChanged);
  54882. }
  54883. return target;
  54884. }
  54885. const toLowerCase$1 = function(string) {
  54886. if (typeof string !== "string") {
  54887. return string;
  54888. }
  54889. return string.replace(/./, (w) => w.toLowerCase());
  54890. };
  54891. const toTitleCase$1$1 = function(string) {
  54892. if (typeof string !== "string") {
  54893. return string;
  54894. }
  54895. return string.replace(/./, (w) => w.toUpperCase());
  54896. };
  54897. const titleCaseEquals$1 = function(str1, str2) {
  54898. return toTitleCase$1$1(str1) === toTitleCase$1$1(str2);
  54899. };
  54900. var Str = /* @__PURE__ */ Object.freeze({
  54901. __proto__: null,
  54902. toLowerCase: toLowerCase$1,
  54903. toTitleCase: toTitleCase$1$1,
  54904. titleCaseEquals: titleCaseEquals$1
  54905. });
  54906. class Component$1$1 {
  54907. constructor(player, options2, ready) {
  54908. if (!player && this.play) {
  54909. this.player_ = player = this;
  54910. } else {
  54911. this.player_ = player;
  54912. }
  54913. this.isDisposed_ = false;
  54914. this.parentComponent_ = null;
  54915. this.options_ = merge$1({}, this.options_);
  54916. options2 = this.options_ = merge$1(this.options_, options2);
  54917. this.id_ = options2.id || options2.el && options2.el.id;
  54918. if (!this.id_) {
  54919. const id = player && player.id && player.id() || "no_player";
  54920. this.id_ = `${id}_component_${newGUID$1()}`;
  54921. }
  54922. this.name_ = options2.name || null;
  54923. if (options2.el) {
  54924. this.el_ = options2.el;
  54925. } else if (options2.createEl !== false) {
  54926. this.el_ = this.createEl();
  54927. }
  54928. if (options2.className && this.el_) {
  54929. options2.className.split(" ").forEach((c) => this.addClass(c));
  54930. }
  54931. ["on", "off", "one", "any", "trigger"].forEach((fn2) => {
  54932. this[fn2] = void 0;
  54933. });
  54934. if (options2.evented !== false) {
  54935. evented$1(this, {
  54936. eventBusKey: this.el_ ? "el_" : null
  54937. });
  54938. this.handleLanguagechange = this.handleLanguagechange.bind(this);
  54939. this.on(this.player_, "languagechange", this.handleLanguagechange);
  54940. }
  54941. stateful$1(this, this.constructor.defaultState);
  54942. this.children_ = [];
  54943. this.childIndex_ = {};
  54944. this.childNameIndex_ = {};
  54945. this.setTimeoutIds_ = /* @__PURE__ */ new Set();
  54946. this.setIntervalIds_ = /* @__PURE__ */ new Set();
  54947. this.rafIds_ = /* @__PURE__ */ new Set();
  54948. this.namedRafs_ = /* @__PURE__ */ new Map();
  54949. this.clearingTimersOnDispose_ = false;
  54950. if (options2.initChildren !== false) {
  54951. this.initChildren();
  54952. }
  54953. this.ready(ready);
  54954. if (options2.reportTouchActivity !== false) {
  54955. this.enableTouchActivity();
  54956. }
  54957. }
  54958. on(type2, fn2) {
  54959. }
  54960. off(type2, fn2) {
  54961. }
  54962. one(type2, fn2) {
  54963. }
  54964. any(type2, fn2) {
  54965. }
  54966. trigger(event2) {
  54967. }
  54968. dispose(options2 = {}) {
  54969. if (this.isDisposed_) {
  54970. return;
  54971. }
  54972. if (this.readyQueue_) {
  54973. this.readyQueue_.length = 0;
  54974. }
  54975. this.trigger({
  54976. type: "dispose",
  54977. bubbles: false
  54978. });
  54979. this.isDisposed_ = true;
  54980. if (this.children_) {
  54981. for (let i2 = this.children_.length - 1; i2 >= 0; i2--) {
  54982. if (this.children_[i2].dispose) {
  54983. this.children_[i2].dispose();
  54984. }
  54985. }
  54986. }
  54987. this.children_ = null;
  54988. this.childIndex_ = null;
  54989. this.childNameIndex_ = null;
  54990. this.parentComponent_ = null;
  54991. if (this.el_) {
  54992. if (this.el_.parentNode) {
  54993. if (options2.restoreEl) {
  54994. this.el_.parentNode.replaceChild(options2.restoreEl, this.el_);
  54995. } else {
  54996. this.el_.parentNode.removeChild(this.el_);
  54997. }
  54998. }
  54999. this.el_ = null;
  55000. }
  55001. this.player_ = null;
  55002. }
  55003. isDisposed() {
  55004. return Boolean(this.isDisposed_);
  55005. }
  55006. player() {
  55007. return this.player_;
  55008. }
  55009. options(obj) {
  55010. if (!obj) {
  55011. return this.options_;
  55012. }
  55013. this.options_ = merge$1(this.options_, obj);
  55014. return this.options_;
  55015. }
  55016. el() {
  55017. return this.el_;
  55018. }
  55019. createEl(tagName, properties, attributes) {
  55020. return createEl$1(tagName, properties, attributes);
  55021. }
  55022. localize(string, tokens, defaultValue2 = string) {
  55023. const code = this.player_.language && this.player_.language();
  55024. const languages = this.player_.languages && this.player_.languages();
  55025. const language = languages && languages[code];
  55026. const primaryCode = code && code.split("-")[0];
  55027. const primaryLang = languages && languages[primaryCode];
  55028. let localizedString = defaultValue2;
  55029. if (language && language[string]) {
  55030. localizedString = language[string];
  55031. } else if (primaryLang && primaryLang[string]) {
  55032. localizedString = primaryLang[string];
  55033. }
  55034. if (tokens) {
  55035. localizedString = localizedString.replace(/\{(\d+)\}/g, function(match, index2) {
  55036. const value = tokens[index2 - 1];
  55037. let ret = value;
  55038. if (typeof value === "undefined") {
  55039. ret = match;
  55040. }
  55041. return ret;
  55042. });
  55043. }
  55044. return localizedString;
  55045. }
  55046. handleLanguagechange() {
  55047. }
  55048. contentEl() {
  55049. return this.contentEl_ || this.el_;
  55050. }
  55051. id() {
  55052. return this.id_;
  55053. }
  55054. name() {
  55055. return this.name_;
  55056. }
  55057. children() {
  55058. return this.children_;
  55059. }
  55060. getChildById(id) {
  55061. return this.childIndex_[id];
  55062. }
  55063. getChild(name) {
  55064. if (!name) {
  55065. return;
  55066. }
  55067. return this.childNameIndex_[name];
  55068. }
  55069. getDescendant(...names2) {
  55070. names2 = names2.reduce((acc, n) => acc.concat(n), []);
  55071. let currentChild = this;
  55072. for (let i2 = 0; i2 < names2.length; i2++) {
  55073. currentChild = currentChild.getChild(names2[i2]);
  55074. if (!currentChild || !currentChild.getChild) {
  55075. return;
  55076. }
  55077. }
  55078. return currentChild;
  55079. }
  55080. addChild(child, options2 = {}, index2 = this.children_.length) {
  55081. let component;
  55082. let componentName;
  55083. if (typeof child === "string") {
  55084. componentName = toTitleCase$1$1(child);
  55085. const componentClassName = options2.componentClass || componentName;
  55086. options2.name = componentName;
  55087. const ComponentClass = Component$1$1.getComponent(componentClassName);
  55088. if (!ComponentClass) {
  55089. throw new Error(`Component ${componentClassName} does not exist`);
  55090. }
  55091. if (typeof ComponentClass !== "function") {
  55092. return null;
  55093. }
  55094. component = new ComponentClass(this.player_ || this, options2);
  55095. } else {
  55096. component = child;
  55097. }
  55098. if (component.parentComponent_) {
  55099. component.parentComponent_.removeChild(component);
  55100. }
  55101. this.children_.splice(index2, 0, component);
  55102. component.parentComponent_ = this;
  55103. if (typeof component.id === "function") {
  55104. this.childIndex_[component.id()] = component;
  55105. }
  55106. componentName = componentName || component.name && toTitleCase$1$1(component.name());
  55107. if (componentName) {
  55108. this.childNameIndex_[componentName] = component;
  55109. this.childNameIndex_[toLowerCase$1(componentName)] = component;
  55110. }
  55111. if (typeof component.el === "function" && component.el()) {
  55112. let refNode = null;
  55113. if (this.children_[index2 + 1]) {
  55114. if (this.children_[index2 + 1].el_) {
  55115. refNode = this.children_[index2 + 1].el_;
  55116. } else if (isEl$1(this.children_[index2 + 1])) {
  55117. refNode = this.children_[index2 + 1];
  55118. }
  55119. }
  55120. this.contentEl().insertBefore(component.el(), refNode);
  55121. }
  55122. return component;
  55123. }
  55124. removeChild(component) {
  55125. if (typeof component === "string") {
  55126. component = this.getChild(component);
  55127. }
  55128. if (!component || !this.children_) {
  55129. return;
  55130. }
  55131. let childFound = false;
  55132. for (let i2 = this.children_.length - 1; i2 >= 0; i2--) {
  55133. if (this.children_[i2] === component) {
  55134. childFound = true;
  55135. this.children_.splice(i2, 1);
  55136. break;
  55137. }
  55138. }
  55139. if (!childFound) {
  55140. return;
  55141. }
  55142. component.parentComponent_ = null;
  55143. this.childIndex_[component.id()] = null;
  55144. this.childNameIndex_[toTitleCase$1$1(component.name())] = null;
  55145. this.childNameIndex_[toLowerCase$1(component.name())] = null;
  55146. const compEl = component.el();
  55147. if (compEl && compEl.parentNode === this.contentEl()) {
  55148. this.contentEl().removeChild(component.el());
  55149. }
  55150. }
  55151. initChildren() {
  55152. const children = this.options_.children;
  55153. if (children) {
  55154. const parentOptions = this.options_;
  55155. const handleAdd = (child) => {
  55156. const name = child.name;
  55157. let opts = child.opts;
  55158. if (parentOptions[name] !== void 0) {
  55159. opts = parentOptions[name];
  55160. }
  55161. if (opts === false) {
  55162. return;
  55163. }
  55164. if (opts === true) {
  55165. opts = {};
  55166. }
  55167. opts.playerOptions = this.options_.playerOptions;
  55168. const newChild = this.addChild(name, opts);
  55169. if (newChild) {
  55170. this[name] = newChild;
  55171. }
  55172. };
  55173. let workingChildren;
  55174. const Tech2 = Component$1$1.getComponent("Tech");
  55175. if (Array.isArray(children)) {
  55176. workingChildren = children;
  55177. } else {
  55178. workingChildren = Object.keys(children);
  55179. }
  55180. workingChildren.concat(Object.keys(this.options_).filter(function(child) {
  55181. return !workingChildren.some(function(wchild) {
  55182. if (typeof wchild === "string") {
  55183. return child === wchild;
  55184. }
  55185. return child === wchild.name;
  55186. });
  55187. })).map((child) => {
  55188. let name;
  55189. let opts;
  55190. if (typeof child === "string") {
  55191. name = child;
  55192. opts = children[name] || this.options_[name] || {};
  55193. } else {
  55194. name = child.name;
  55195. opts = child;
  55196. }
  55197. return {
  55198. name,
  55199. opts
  55200. };
  55201. }).filter((child) => {
  55202. const c = Component$1$1.getComponent(child.opts.componentClass || toTitleCase$1$1(child.name));
  55203. return c && !Tech2.isTech(c);
  55204. }).forEach(handleAdd);
  55205. }
  55206. }
  55207. buildCSSClass() {
  55208. return "";
  55209. }
  55210. ready(fn2, sync = false) {
  55211. if (!fn2) {
  55212. return;
  55213. }
  55214. if (!this.isReady_) {
  55215. this.readyQueue_ = this.readyQueue_ || [];
  55216. this.readyQueue_.push(fn2);
  55217. return;
  55218. }
  55219. if (sync) {
  55220. fn2.call(this);
  55221. } else {
  55222. this.setTimeout(fn2, 1);
  55223. }
  55224. }
  55225. triggerReady() {
  55226. this.isReady_ = true;
  55227. this.setTimeout(function() {
  55228. const readyQueue = this.readyQueue_;
  55229. this.readyQueue_ = [];
  55230. if (readyQueue && readyQueue.length > 0) {
  55231. readyQueue.forEach(function(fn2) {
  55232. fn2.call(this);
  55233. }, this);
  55234. }
  55235. this.trigger("ready");
  55236. }, 1);
  55237. }
  55238. $(selector, context) {
  55239. return $$1(selector, context || this.contentEl());
  55240. }
  55241. $$(selector, context) {
  55242. return $$$1(selector, context || this.contentEl());
  55243. }
  55244. hasClass(classToCheck) {
  55245. return hasClass$1(this.el_, classToCheck);
  55246. }
  55247. addClass(...classesToAdd) {
  55248. addClass$1(this.el_, ...classesToAdd);
  55249. }
  55250. removeClass(...classesToRemove) {
  55251. removeClass$1(this.el_, ...classesToRemove);
  55252. }
  55253. toggleClass(classToToggle, predicate) {
  55254. toggleClass$1(this.el_, classToToggle, predicate);
  55255. }
  55256. show() {
  55257. this.removeClass("vjs-hidden");
  55258. }
  55259. hide() {
  55260. this.addClass("vjs-hidden");
  55261. }
  55262. lockShowing() {
  55263. this.addClass("vjs-lock-showing");
  55264. }
  55265. unlockShowing() {
  55266. this.removeClass("vjs-lock-showing");
  55267. }
  55268. getAttribute(attribute) {
  55269. return getAttribute$1(this.el_, attribute);
  55270. }
  55271. setAttribute(attribute, value) {
  55272. setAttribute$1(this.el_, attribute, value);
  55273. }
  55274. removeAttribute(attribute) {
  55275. removeAttribute$1(this.el_, attribute);
  55276. }
  55277. width(num, skipListeners) {
  55278. return this.dimension("width", num, skipListeners);
  55279. }
  55280. height(num, skipListeners) {
  55281. return this.dimension("height", num, skipListeners);
  55282. }
  55283. dimensions(width2, height2) {
  55284. this.width(width2, true);
  55285. this.height(height2);
  55286. }
  55287. dimension(widthOrHeight, num, skipListeners) {
  55288. if (num !== void 0) {
  55289. if (num === null || num !== num) {
  55290. num = 0;
  55291. }
  55292. if (("" + num).indexOf("%") !== -1 || ("" + num).indexOf("px") !== -1) {
  55293. this.el_.style[widthOrHeight] = num;
  55294. } else if (num === "auto") {
  55295. this.el_.style[widthOrHeight] = "";
  55296. } else {
  55297. this.el_.style[widthOrHeight] = num + "px";
  55298. }
  55299. if (!skipListeners) {
  55300. this.trigger("componentresize");
  55301. }
  55302. return;
  55303. }
  55304. if (!this.el_) {
  55305. return 0;
  55306. }
  55307. const val = this.el_.style[widthOrHeight];
  55308. const pxIndex = val.indexOf("px");
  55309. if (pxIndex !== -1) {
  55310. return parseInt(val.slice(0, pxIndex), 10);
  55311. }
  55312. return parseInt(this.el_["offset" + toTitleCase$1$1(widthOrHeight)], 10);
  55313. }
  55314. currentDimension(widthOrHeight) {
  55315. let computedWidthOrHeight = 0;
  55316. if (widthOrHeight !== "width" && widthOrHeight !== "height") {
  55317. throw new Error("currentDimension only accepts width or height value");
  55318. }
  55319. computedWidthOrHeight = computedStyle$1(this.el_, widthOrHeight);
  55320. computedWidthOrHeight = parseFloat(computedWidthOrHeight);
  55321. if (computedWidthOrHeight === 0 || isNaN(computedWidthOrHeight)) {
  55322. const rule = `offset${toTitleCase$1$1(widthOrHeight)}`;
  55323. computedWidthOrHeight = this.el_[rule];
  55324. }
  55325. return computedWidthOrHeight;
  55326. }
  55327. currentDimensions() {
  55328. return {
  55329. width: this.currentDimension("width"),
  55330. height: this.currentDimension("height")
  55331. };
  55332. }
  55333. currentWidth() {
  55334. return this.currentDimension("width");
  55335. }
  55336. currentHeight() {
  55337. return this.currentDimension("height");
  55338. }
  55339. focus() {
  55340. this.el_.focus();
  55341. }
  55342. blur() {
  55343. this.el_.blur();
  55344. }
  55345. handleKeyDown(event2) {
  55346. if (this.player_) {
  55347. if (!keycode.isEventKey(event2, "Tab")) {
  55348. event2.stopPropagation();
  55349. }
  55350. this.player_.handleKeyDown(event2);
  55351. }
  55352. }
  55353. handleKeyPress(event2) {
  55354. this.handleKeyDown(event2);
  55355. }
  55356. emitTapEvents() {
  55357. let touchStart = 0;
  55358. let firstTouch = null;
  55359. const tapMovementThreshold = 10;
  55360. const touchTimeThreshold = 200;
  55361. let couldBeTap;
  55362. this.on("touchstart", function(event2) {
  55363. if (event2.touches.length === 1) {
  55364. firstTouch = {
  55365. pageX: event2.touches[0].pageX,
  55366. pageY: event2.touches[0].pageY
  55367. };
  55368. touchStart = window_1.performance.now();
  55369. couldBeTap = true;
  55370. }
  55371. });
  55372. this.on("touchmove", function(event2) {
  55373. if (event2.touches.length > 1) {
  55374. couldBeTap = false;
  55375. } else if (firstTouch) {
  55376. const xdiff = event2.touches[0].pageX - firstTouch.pageX;
  55377. const ydiff = event2.touches[0].pageY - firstTouch.pageY;
  55378. const touchDistance = Math.sqrt(xdiff * xdiff + ydiff * ydiff);
  55379. if (touchDistance > tapMovementThreshold) {
  55380. couldBeTap = false;
  55381. }
  55382. }
  55383. });
  55384. const noTap = function() {
  55385. couldBeTap = false;
  55386. };
  55387. this.on("touchleave", noTap);
  55388. this.on("touchcancel", noTap);
  55389. this.on("touchend", function(event2) {
  55390. firstTouch = null;
  55391. if (couldBeTap === true) {
  55392. const touchTime = window_1.performance.now() - touchStart;
  55393. if (touchTime < touchTimeThreshold) {
  55394. event2.preventDefault();
  55395. this.trigger("tap");
  55396. }
  55397. }
  55398. });
  55399. }
  55400. enableTouchActivity() {
  55401. if (!this.player() || !this.player().reportUserActivity) {
  55402. return;
  55403. }
  55404. const report = bind_(this.player(), this.player().reportUserActivity);
  55405. let touchHolding;
  55406. this.on("touchstart", function() {
  55407. report();
  55408. this.clearInterval(touchHolding);
  55409. touchHolding = this.setInterval(report, 250);
  55410. });
  55411. const touchEnd = function(event2) {
  55412. report();
  55413. this.clearInterval(touchHolding);
  55414. };
  55415. this.on("touchmove", report);
  55416. this.on("touchend", touchEnd);
  55417. this.on("touchcancel", touchEnd);
  55418. }
  55419. setTimeout(fn2, timeout) {
  55420. var timeoutId;
  55421. fn2 = bind_(this, fn2);
  55422. this.clearTimersOnDispose_();
  55423. timeoutId = window_1.setTimeout(() => {
  55424. if (this.setTimeoutIds_.has(timeoutId)) {
  55425. this.setTimeoutIds_.delete(timeoutId);
  55426. }
  55427. fn2();
  55428. }, timeout);
  55429. this.setTimeoutIds_.add(timeoutId);
  55430. return timeoutId;
  55431. }
  55432. clearTimeout(timeoutId) {
  55433. if (this.setTimeoutIds_.has(timeoutId)) {
  55434. this.setTimeoutIds_.delete(timeoutId);
  55435. window_1.clearTimeout(timeoutId);
  55436. }
  55437. return timeoutId;
  55438. }
  55439. setInterval(fn2, interval) {
  55440. fn2 = bind_(this, fn2);
  55441. this.clearTimersOnDispose_();
  55442. const intervalId = window_1.setInterval(fn2, interval);
  55443. this.setIntervalIds_.add(intervalId);
  55444. return intervalId;
  55445. }
  55446. clearInterval(intervalId) {
  55447. if (this.setIntervalIds_.has(intervalId)) {
  55448. this.setIntervalIds_.delete(intervalId);
  55449. window_1.clearInterval(intervalId);
  55450. }
  55451. return intervalId;
  55452. }
  55453. requestAnimationFrame(fn2) {
  55454. this.clearTimersOnDispose_();
  55455. var id;
  55456. fn2 = bind_(this, fn2);
  55457. id = window_1.requestAnimationFrame(() => {
  55458. if (this.rafIds_.has(id)) {
  55459. this.rafIds_.delete(id);
  55460. }
  55461. fn2();
  55462. });
  55463. this.rafIds_.add(id);
  55464. return id;
  55465. }
  55466. requestNamedAnimationFrame(name, fn2) {
  55467. if (this.namedRafs_.has(name)) {
  55468. return;
  55469. }
  55470. this.clearTimersOnDispose_();
  55471. fn2 = bind_(this, fn2);
  55472. const id = this.requestAnimationFrame(() => {
  55473. fn2();
  55474. if (this.namedRafs_.has(name)) {
  55475. this.namedRafs_.delete(name);
  55476. }
  55477. });
  55478. this.namedRafs_.set(name, id);
  55479. return name;
  55480. }
  55481. cancelNamedAnimationFrame(name) {
  55482. if (!this.namedRafs_.has(name)) {
  55483. return;
  55484. }
  55485. this.cancelAnimationFrame(this.namedRafs_.get(name));
  55486. this.namedRafs_.delete(name);
  55487. }
  55488. cancelAnimationFrame(id) {
  55489. if (this.rafIds_.has(id)) {
  55490. this.rafIds_.delete(id);
  55491. window_1.cancelAnimationFrame(id);
  55492. }
  55493. return id;
  55494. }
  55495. clearTimersOnDispose_() {
  55496. if (this.clearingTimersOnDispose_) {
  55497. return;
  55498. }
  55499. this.clearingTimersOnDispose_ = true;
  55500. this.one("dispose", () => {
  55501. [["namedRafs_", "cancelNamedAnimationFrame"], ["rafIds_", "cancelAnimationFrame"], ["setTimeoutIds_", "clearTimeout"], ["setIntervalIds_", "clearInterval"]].forEach(([idName, cancelName]) => {
  55502. this[idName].forEach((val, key) => this[cancelName](key));
  55503. });
  55504. this.clearingTimersOnDispose_ = false;
  55505. });
  55506. }
  55507. static registerComponent(name, ComponentToRegister) {
  55508. if (typeof name !== "string" || !name) {
  55509. throw new Error(`Illegal component name, "${name}"; must be a non-empty string.`);
  55510. }
  55511. const Tech2 = Component$1$1.getComponent("Tech");
  55512. const isTech = Tech2 && Tech2.isTech(ComponentToRegister);
  55513. const isComp = Component$1$1 === ComponentToRegister || Component$1$1.prototype.isPrototypeOf(ComponentToRegister.prototype);
  55514. if (isTech || !isComp) {
  55515. let reason;
  55516. if (isTech) {
  55517. reason = "techs must be registered using Tech.registerTech()";
  55518. } else {
  55519. reason = "must be a Component subclass";
  55520. }
  55521. throw new Error(`Illegal component, "${name}"; ${reason}.`);
  55522. }
  55523. name = toTitleCase$1$1(name);
  55524. if (!Component$1$1.components_) {
  55525. Component$1$1.components_ = {};
  55526. }
  55527. const Player2 = Component$1$1.getComponent("Player");
  55528. if (name === "Player" && Player2 && Player2.players) {
  55529. const players = Player2.players;
  55530. const playerNames = Object.keys(players);
  55531. if (players && playerNames.length > 0 && playerNames.map((pname) => players[pname]).every(Boolean)) {
  55532. throw new Error("Can not register Player component after player has been created.");
  55533. }
  55534. }
  55535. Component$1$1.components_[name] = ComponentToRegister;
  55536. Component$1$1.components_[toLowerCase$1(name)] = ComponentToRegister;
  55537. return ComponentToRegister;
  55538. }
  55539. static getComponent(name) {
  55540. if (!name || !Component$1$1.components_) {
  55541. return;
  55542. }
  55543. return Component$1$1.components_[name];
  55544. }
  55545. }
  55546. Component$1$1.registerComponent("Component", Component$1$1);
  55547. function rangeCheck$1(fnName, index2, maxIndex) {
  55548. if (typeof index2 !== "number" || index2 < 0 || index2 > maxIndex) {
  55549. throw new Error(`Failed to execute '${fnName}' on 'TimeRanges': The index provided (${index2}) is non-numeric or out of bounds (0-${maxIndex}).`);
  55550. }
  55551. }
  55552. function getRange$1(fnName, valueIndex, ranges, rangeIndex) {
  55553. rangeCheck$1(fnName, rangeIndex, ranges.length - 1);
  55554. return ranges[rangeIndex][valueIndex];
  55555. }
  55556. function createTimeRangesObj$1(ranges) {
  55557. let timeRangesObj;
  55558. if (ranges === void 0 || ranges.length === 0) {
  55559. timeRangesObj = {
  55560. length: 0,
  55561. start() {
  55562. throw new Error("This TimeRanges object is empty");
  55563. },
  55564. end() {
  55565. throw new Error("This TimeRanges object is empty");
  55566. }
  55567. };
  55568. } else {
  55569. timeRangesObj = {
  55570. length: ranges.length,
  55571. start: getRange$1.bind(null, "start", 0, ranges),
  55572. end: getRange$1.bind(null, "end", 1, ranges)
  55573. };
  55574. }
  55575. if (window_1.Symbol && window_1.Symbol.iterator) {
  55576. timeRangesObj[window_1.Symbol.iterator] = () => (ranges || []).values();
  55577. }
  55578. return timeRangesObj;
  55579. }
  55580. function createTimeRanges$1(start2, end) {
  55581. if (Array.isArray(start2)) {
  55582. return createTimeRangesObj$1(start2);
  55583. } else if (start2 === void 0 || end === void 0) {
  55584. return createTimeRangesObj$1();
  55585. }
  55586. return createTimeRangesObj$1([[start2, end]]);
  55587. }
  55588. const defaultImplementation$1 = function(seconds, guide) {
  55589. seconds = seconds < 0 ? 0 : seconds;
  55590. let s = Math.floor(seconds % 60);
  55591. let m = Math.floor(seconds / 60 % 60);
  55592. let h2 = Math.floor(seconds / 3600);
  55593. const gm = Math.floor(guide / 60 % 60);
  55594. const gh = Math.floor(guide / 3600);
  55595. if (isNaN(seconds) || seconds === Infinity) {
  55596. h2 = m = s = "-";
  55597. }
  55598. h2 = h2 > 0 || gh > 0 ? h2 + ":" : "";
  55599. m = ((h2 || gm >= 10) && m < 10 ? "0" + m : m) + ":";
  55600. s = s < 10 ? "0" + s : s;
  55601. return h2 + m + s;
  55602. };
  55603. let implementation$1 = defaultImplementation$1;
  55604. function setFormatTime$1(customImplementation) {
  55605. implementation$1 = customImplementation;
  55606. }
  55607. function resetFormatTime$1() {
  55608. implementation$1 = defaultImplementation$1;
  55609. }
  55610. function formatTime$1(seconds, guide = seconds) {
  55611. return implementation$1(seconds, guide);
  55612. }
  55613. var Time = /* @__PURE__ */ Object.freeze({
  55614. __proto__: null,
  55615. createTimeRanges: createTimeRanges$1,
  55616. createTimeRange: createTimeRanges$1,
  55617. setFormatTime: setFormatTime$1,
  55618. resetFormatTime: resetFormatTime$1,
  55619. formatTime: formatTime$1
  55620. });
  55621. function bufferedPercent$1(buffered, duration5) {
  55622. let bufferedDuration = 0;
  55623. let start2;
  55624. let end;
  55625. if (!duration5) {
  55626. return 0;
  55627. }
  55628. if (!buffered || !buffered.length) {
  55629. buffered = createTimeRanges$1(0, 0);
  55630. }
  55631. for (let i2 = 0; i2 < buffered.length; i2++) {
  55632. start2 = buffered.start(i2);
  55633. end = buffered.end(i2);
  55634. if (end > duration5) {
  55635. end = duration5;
  55636. }
  55637. bufferedDuration += end - start2;
  55638. }
  55639. return bufferedDuration / duration5;
  55640. }
  55641. function MediaError$1(value) {
  55642. if (value instanceof MediaError$1) {
  55643. return value;
  55644. }
  55645. if (typeof value === "number") {
  55646. this.code = value;
  55647. } else if (typeof value === "string") {
  55648. this.message = value;
  55649. } else if (isObject$2(value)) {
  55650. if (typeof value.code === "number") {
  55651. this.code = value.code;
  55652. }
  55653. Object.assign(this, value);
  55654. }
  55655. if (!this.message) {
  55656. this.message = MediaError$1.defaultMessages[this.code] || "";
  55657. }
  55658. }
  55659. MediaError$1.prototype.code = 0;
  55660. MediaError$1.prototype.message = "";
  55661. MediaError$1.prototype.status = null;
  55662. MediaError$1.errorTypes = ["MEDIA_ERR_CUSTOM", "MEDIA_ERR_ABORTED", "MEDIA_ERR_NETWORK", "MEDIA_ERR_DECODE", "MEDIA_ERR_SRC_NOT_SUPPORTED", "MEDIA_ERR_ENCRYPTED"];
  55663. MediaError$1.defaultMessages = {
  55664. 1: "You aborted the media playback",
  55665. 2: "A network error caused the media download to fail part-way.",
  55666. 3: "The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",
  55667. 4: "The media could not be loaded, either because the server or network failed or because the format is not supported.",
  55668. 5: "The media is encrypted and we do not have the keys to decrypt it."
  55669. };
  55670. for (let errNum = 0; errNum < MediaError$1.errorTypes.length; errNum++) {
  55671. MediaError$1[MediaError$1.errorTypes[errNum]] = errNum;
  55672. MediaError$1.prototype[MediaError$1.errorTypes[errNum]] = errNum;
  55673. }
  55674. function isPromise$1(value) {
  55675. return value !== void 0 && value !== null && typeof value.then === "function";
  55676. }
  55677. function silencePromise$1(value) {
  55678. if (isPromise$1(value)) {
  55679. value.then(null, (e) => {
  55680. });
  55681. }
  55682. }
  55683. const trackToJson_$1 = function(track) {
  55684. const ret = ["kind", "label", "language", "id", "inBandMetadataTrackDispatchType", "mode", "src"].reduce((acc, prop, i2) => {
  55685. if (track[prop]) {
  55686. acc[prop] = track[prop];
  55687. }
  55688. return acc;
  55689. }, {
  55690. cues: track.cues && Array.prototype.map.call(track.cues, function(cue) {
  55691. return {
  55692. startTime: cue.startTime,
  55693. endTime: cue.endTime,
  55694. text: cue.text,
  55695. id: cue.id
  55696. };
  55697. })
  55698. });
  55699. return ret;
  55700. };
  55701. const textTracksToJson$1 = function(tech) {
  55702. const trackEls = tech.$$("track");
  55703. const trackObjs = Array.prototype.map.call(trackEls, (t2) => t2.track);
  55704. const tracks = Array.prototype.map.call(trackEls, function(trackEl) {
  55705. const json = trackToJson_$1(trackEl.track);
  55706. if (trackEl.src) {
  55707. json.src = trackEl.src;
  55708. }
  55709. return json;
  55710. });
  55711. return tracks.concat(Array.prototype.filter.call(tech.textTracks(), function(track) {
  55712. return trackObjs.indexOf(track) === -1;
  55713. }).map(trackToJson_$1));
  55714. };
  55715. const jsonToTextTracks$1 = function(json, tech) {
  55716. json.forEach(function(track) {
  55717. const addedTrack = tech.addRemoteTextTrack(track).track;
  55718. if (!track.src && track.cues) {
  55719. track.cues.forEach((cue) => addedTrack.addCue(cue));
  55720. }
  55721. });
  55722. return tech.textTracks();
  55723. };
  55724. var textTrackConverter$1 = {
  55725. textTracksToJson: textTracksToJson$1,
  55726. jsonToTextTracks: jsonToTextTracks$1,
  55727. trackToJson_: trackToJson_$1
  55728. };
  55729. const MODAL_CLASS_NAME$1 = "vjs-modal-dialog";
  55730. class ModalDialog$1 extends Component$1$1 {
  55731. constructor(player, options2) {
  55732. super(player, options2);
  55733. this.handleKeyDown_ = (e) => this.handleKeyDown(e);
  55734. this.close_ = (e) => this.close(e);
  55735. this.opened_ = this.hasBeenOpened_ = this.hasBeenFilled_ = false;
  55736. this.closeable(!this.options_.uncloseable);
  55737. this.content(this.options_.content);
  55738. this.contentEl_ = createEl$1("div", {
  55739. className: `${MODAL_CLASS_NAME$1}-content`
  55740. }, {
  55741. role: "document"
  55742. });
  55743. this.descEl_ = createEl$1("p", {
  55744. className: `${MODAL_CLASS_NAME$1}-description vjs-control-text`,
  55745. id: this.el().getAttribute("aria-describedby")
  55746. });
  55747. textContent$1(this.descEl_, this.description());
  55748. this.el_.appendChild(this.descEl_);
  55749. this.el_.appendChild(this.contentEl_);
  55750. }
  55751. createEl() {
  55752. return super.createEl("div", {
  55753. className: this.buildCSSClass(),
  55754. tabIndex: -1
  55755. }, {
  55756. "aria-describedby": `${this.id()}_description`,
  55757. "aria-hidden": "true",
  55758. "aria-label": this.label(),
  55759. "role": "dialog"
  55760. });
  55761. }
  55762. dispose() {
  55763. this.contentEl_ = null;
  55764. this.descEl_ = null;
  55765. this.previouslyActiveEl_ = null;
  55766. super.dispose();
  55767. }
  55768. buildCSSClass() {
  55769. return `${MODAL_CLASS_NAME$1} vjs-hidden ${super.buildCSSClass()}`;
  55770. }
  55771. label() {
  55772. return this.localize(this.options_.label || "Modal Window");
  55773. }
  55774. description() {
  55775. let desc = this.options_.description || this.localize("This is a modal window.");
  55776. if (this.closeable()) {
  55777. desc += " " + this.localize("This modal can be closed by pressing the Escape key or activating the close button.");
  55778. }
  55779. return desc;
  55780. }
  55781. open() {
  55782. if (!this.opened_) {
  55783. const player = this.player();
  55784. this.trigger("beforemodalopen");
  55785. this.opened_ = true;
  55786. if (this.options_.fillAlways || !this.hasBeenOpened_ && !this.hasBeenFilled_) {
  55787. this.fill();
  55788. }
  55789. this.wasPlaying_ = !player.paused();
  55790. if (this.options_.pauseOnOpen && this.wasPlaying_) {
  55791. player.pause();
  55792. }
  55793. this.on("keydown", this.handleKeyDown_);
  55794. this.hadControls_ = player.controls();
  55795. player.controls(false);
  55796. this.show();
  55797. this.conditionalFocus_();
  55798. this.el().setAttribute("aria-hidden", "false");
  55799. this.trigger("modalopen");
  55800. this.hasBeenOpened_ = true;
  55801. }
  55802. }
  55803. opened(value) {
  55804. if (typeof value === "boolean") {
  55805. this[value ? "open" : "close"]();
  55806. }
  55807. return this.opened_;
  55808. }
  55809. close() {
  55810. if (!this.opened_) {
  55811. return;
  55812. }
  55813. const player = this.player();
  55814. this.trigger("beforemodalclose");
  55815. this.opened_ = false;
  55816. if (this.wasPlaying_ && this.options_.pauseOnOpen) {
  55817. player.play();
  55818. }
  55819. this.off("keydown", this.handleKeyDown_);
  55820. if (this.hadControls_) {
  55821. player.controls(true);
  55822. }
  55823. this.hide();
  55824. this.el().setAttribute("aria-hidden", "true");
  55825. this.trigger("modalclose");
  55826. this.conditionalBlur_();
  55827. if (this.options_.temporary) {
  55828. this.dispose();
  55829. }
  55830. }
  55831. closeable(value) {
  55832. if (typeof value === "boolean") {
  55833. const closeable = this.closeable_ = !!value;
  55834. let close = this.getChild("closeButton");
  55835. if (closeable && !close) {
  55836. const temp = this.contentEl_;
  55837. this.contentEl_ = this.el_;
  55838. close = this.addChild("closeButton", {
  55839. controlText: "Close Modal Dialog"
  55840. });
  55841. this.contentEl_ = temp;
  55842. this.on(close, "close", this.close_);
  55843. }
  55844. if (!closeable && close) {
  55845. this.off(close, "close", this.close_);
  55846. this.removeChild(close);
  55847. close.dispose();
  55848. }
  55849. }
  55850. return this.closeable_;
  55851. }
  55852. fill() {
  55853. this.fillWith(this.content());
  55854. }
  55855. fillWith(content) {
  55856. const contentEl = this.contentEl();
  55857. const parentEl = contentEl.parentNode;
  55858. const nextSiblingEl = contentEl.nextSibling;
  55859. this.trigger("beforemodalfill");
  55860. this.hasBeenFilled_ = true;
  55861. parentEl.removeChild(contentEl);
  55862. this.empty();
  55863. insertContent$1(contentEl, content);
  55864. this.trigger("modalfill");
  55865. if (nextSiblingEl) {
  55866. parentEl.insertBefore(contentEl, nextSiblingEl);
  55867. } else {
  55868. parentEl.appendChild(contentEl);
  55869. }
  55870. const closeButton = this.getChild("closeButton");
  55871. if (closeButton) {
  55872. parentEl.appendChild(closeButton.el_);
  55873. }
  55874. }
  55875. empty() {
  55876. this.trigger("beforemodalempty");
  55877. emptyEl$1(this.contentEl());
  55878. this.trigger("modalempty");
  55879. }
  55880. content(value) {
  55881. if (typeof value !== "undefined") {
  55882. this.content_ = value;
  55883. }
  55884. return this.content_;
  55885. }
  55886. conditionalFocus_() {
  55887. const activeEl = document_1.activeElement;
  55888. const playerEl = this.player_.el_;
  55889. this.previouslyActiveEl_ = null;
  55890. if (playerEl.contains(activeEl) || playerEl === activeEl) {
  55891. this.previouslyActiveEl_ = activeEl;
  55892. this.focus();
  55893. }
  55894. }
  55895. conditionalBlur_() {
  55896. if (this.previouslyActiveEl_) {
  55897. this.previouslyActiveEl_.focus();
  55898. this.previouslyActiveEl_ = null;
  55899. }
  55900. }
  55901. handleKeyDown(event2) {
  55902. event2.stopPropagation();
  55903. if (keycode.isEventKey(event2, "Escape") && this.closeable()) {
  55904. event2.preventDefault();
  55905. this.close();
  55906. return;
  55907. }
  55908. if (!keycode.isEventKey(event2, "Tab")) {
  55909. return;
  55910. }
  55911. const focusableEls = this.focusableEls_();
  55912. const activeEl = this.el_.querySelector(":focus");
  55913. let focusIndex;
  55914. for (let i2 = 0; i2 < focusableEls.length; i2++) {
  55915. if (activeEl === focusableEls[i2]) {
  55916. focusIndex = i2;
  55917. break;
  55918. }
  55919. }
  55920. if (document_1.activeElement === this.el_) {
  55921. focusIndex = 0;
  55922. }
  55923. if (event2.shiftKey && focusIndex === 0) {
  55924. focusableEls[focusableEls.length - 1].focus();
  55925. event2.preventDefault();
  55926. } else if (!event2.shiftKey && focusIndex === focusableEls.length - 1) {
  55927. focusableEls[0].focus();
  55928. event2.preventDefault();
  55929. }
  55930. }
  55931. focusableEls_() {
  55932. const allChildren = this.el_.querySelectorAll("*");
  55933. return Array.prototype.filter.call(allChildren, (child) => {
  55934. return (child instanceof window_1.HTMLAnchorElement || child instanceof window_1.HTMLAreaElement) && child.hasAttribute("href") || (child instanceof window_1.HTMLInputElement || child instanceof window_1.HTMLSelectElement || child instanceof window_1.HTMLTextAreaElement || child instanceof window_1.HTMLButtonElement) && !child.hasAttribute("disabled") || child instanceof window_1.HTMLIFrameElement || child instanceof window_1.HTMLObjectElement || child instanceof window_1.HTMLEmbedElement || child.hasAttribute("tabindex") && child.getAttribute("tabindex") !== -1 || child.hasAttribute("contenteditable");
  55935. });
  55936. }
  55937. }
  55938. ModalDialog$1.prototype.options_ = {
  55939. pauseOnOpen: true,
  55940. temporary: true
  55941. };
  55942. Component$1$1.registerComponent("ModalDialog", ModalDialog$1);
  55943. class TrackList$1 extends EventTarget$2$1 {
  55944. constructor(tracks = []) {
  55945. super();
  55946. this.tracks_ = [];
  55947. Object.defineProperty(this, "length", {
  55948. get() {
  55949. return this.tracks_.length;
  55950. }
  55951. });
  55952. for (let i2 = 0; i2 < tracks.length; i2++) {
  55953. this.addTrack(tracks[i2]);
  55954. }
  55955. }
  55956. addTrack(track) {
  55957. const index2 = this.tracks_.length;
  55958. if (!("" + index2 in this)) {
  55959. Object.defineProperty(this, index2, {
  55960. get() {
  55961. return this.tracks_[index2];
  55962. }
  55963. });
  55964. }
  55965. if (this.tracks_.indexOf(track) === -1) {
  55966. this.tracks_.push(track);
  55967. this.trigger({
  55968. track,
  55969. type: "addtrack",
  55970. target: this
  55971. });
  55972. }
  55973. track.labelchange_ = () => {
  55974. this.trigger({
  55975. track,
  55976. type: "labelchange",
  55977. target: this
  55978. });
  55979. };
  55980. if (isEvented$1(track)) {
  55981. track.addEventListener("labelchange", track.labelchange_);
  55982. }
  55983. }
  55984. removeTrack(rtrack) {
  55985. let track;
  55986. for (let i2 = 0, l = this.length; i2 < l; i2++) {
  55987. if (this[i2] === rtrack) {
  55988. track = this[i2];
  55989. if (track.off) {
  55990. track.off();
  55991. }
  55992. this.tracks_.splice(i2, 1);
  55993. break;
  55994. }
  55995. }
  55996. if (!track) {
  55997. return;
  55998. }
  55999. this.trigger({
  56000. track,
  56001. type: "removetrack",
  56002. target: this
  56003. });
  56004. }
  56005. getTrackById(id) {
  56006. let result = null;
  56007. for (let i2 = 0, l = this.length; i2 < l; i2++) {
  56008. const track = this[i2];
  56009. if (track.id === id) {
  56010. result = track;
  56011. break;
  56012. }
  56013. }
  56014. return result;
  56015. }
  56016. }
  56017. TrackList$1.prototype.allowedEvents_ = {
  56018. change: "change",
  56019. addtrack: "addtrack",
  56020. removetrack: "removetrack",
  56021. labelchange: "labelchange"
  56022. };
  56023. for (const event2 in TrackList$1.prototype.allowedEvents_) {
  56024. TrackList$1.prototype["on" + event2] = null;
  56025. }
  56026. const disableOthers$1$1 = function(list, track) {
  56027. for (let i2 = 0; i2 < list.length; i2++) {
  56028. if (!Object.keys(list[i2]).length || track.id === list[i2].id) {
  56029. continue;
  56030. }
  56031. list[i2].enabled = false;
  56032. }
  56033. };
  56034. class AudioTrackList$1 extends TrackList$1 {
  56035. constructor(tracks = []) {
  56036. for (let i2 = tracks.length - 1; i2 >= 0; i2--) {
  56037. if (tracks[i2].enabled) {
  56038. disableOthers$1$1(tracks, tracks[i2]);
  56039. break;
  56040. }
  56041. }
  56042. super(tracks);
  56043. this.changing_ = false;
  56044. }
  56045. addTrack(track) {
  56046. if (track.enabled) {
  56047. disableOthers$1$1(this, track);
  56048. }
  56049. super.addTrack(track);
  56050. if (!track.addEventListener) {
  56051. return;
  56052. }
  56053. track.enabledChange_ = () => {
  56054. if (this.changing_) {
  56055. return;
  56056. }
  56057. this.changing_ = true;
  56058. disableOthers$1$1(this, track);
  56059. this.changing_ = false;
  56060. this.trigger("change");
  56061. };
  56062. track.addEventListener("enabledchange", track.enabledChange_);
  56063. }
  56064. removeTrack(rtrack) {
  56065. super.removeTrack(rtrack);
  56066. if (rtrack.removeEventListener && rtrack.enabledChange_) {
  56067. rtrack.removeEventListener("enabledchange", rtrack.enabledChange_);
  56068. rtrack.enabledChange_ = null;
  56069. }
  56070. }
  56071. }
  56072. const disableOthers$2 = function(list, track) {
  56073. for (let i2 = 0; i2 < list.length; i2++) {
  56074. if (!Object.keys(list[i2]).length || track.id === list[i2].id) {
  56075. continue;
  56076. }
  56077. list[i2].selected = false;
  56078. }
  56079. };
  56080. class VideoTrackList$1 extends TrackList$1 {
  56081. constructor(tracks = []) {
  56082. for (let i2 = tracks.length - 1; i2 >= 0; i2--) {
  56083. if (tracks[i2].selected) {
  56084. disableOthers$2(tracks, tracks[i2]);
  56085. break;
  56086. }
  56087. }
  56088. super(tracks);
  56089. this.changing_ = false;
  56090. Object.defineProperty(this, "selectedIndex", {
  56091. get() {
  56092. for (let i2 = 0; i2 < this.length; i2++) {
  56093. if (this[i2].selected) {
  56094. return i2;
  56095. }
  56096. }
  56097. return -1;
  56098. },
  56099. set() {
  56100. }
  56101. });
  56102. }
  56103. addTrack(track) {
  56104. if (track.selected) {
  56105. disableOthers$2(this, track);
  56106. }
  56107. super.addTrack(track);
  56108. if (!track.addEventListener) {
  56109. return;
  56110. }
  56111. track.selectedChange_ = () => {
  56112. if (this.changing_) {
  56113. return;
  56114. }
  56115. this.changing_ = true;
  56116. disableOthers$2(this, track);
  56117. this.changing_ = false;
  56118. this.trigger("change");
  56119. };
  56120. track.addEventListener("selectedchange", track.selectedChange_);
  56121. }
  56122. removeTrack(rtrack) {
  56123. super.removeTrack(rtrack);
  56124. if (rtrack.removeEventListener && rtrack.selectedChange_) {
  56125. rtrack.removeEventListener("selectedchange", rtrack.selectedChange_);
  56126. rtrack.selectedChange_ = null;
  56127. }
  56128. }
  56129. }
  56130. class TextTrackList$1 extends TrackList$1 {
  56131. addTrack(track) {
  56132. super.addTrack(track);
  56133. if (!this.queueChange_) {
  56134. this.queueChange_ = () => this.queueTrigger("change");
  56135. }
  56136. if (!this.triggerSelectedlanguagechange) {
  56137. this.triggerSelectedlanguagechange_ = () => this.trigger("selectedlanguagechange");
  56138. }
  56139. track.addEventListener("modechange", this.queueChange_);
  56140. const nonLanguageTextTrackKind = ["metadata", "chapters"];
  56141. if (nonLanguageTextTrackKind.indexOf(track.kind) === -1) {
  56142. track.addEventListener("modechange", this.triggerSelectedlanguagechange_);
  56143. }
  56144. }
  56145. removeTrack(rtrack) {
  56146. super.removeTrack(rtrack);
  56147. if (rtrack.removeEventListener) {
  56148. if (this.queueChange_) {
  56149. rtrack.removeEventListener("modechange", this.queueChange_);
  56150. }
  56151. if (this.selectedlanguagechange_) {
  56152. rtrack.removeEventListener("modechange", this.triggerSelectedlanguagechange_);
  56153. }
  56154. }
  56155. }
  56156. }
  56157. class HtmlTrackElementList$1 {
  56158. constructor(trackElements = []) {
  56159. this.trackElements_ = [];
  56160. Object.defineProperty(this, "length", {
  56161. get() {
  56162. return this.trackElements_.length;
  56163. }
  56164. });
  56165. for (let i2 = 0, length = trackElements.length; i2 < length; i2++) {
  56166. this.addTrackElement_(trackElements[i2]);
  56167. }
  56168. }
  56169. addTrackElement_(trackElement) {
  56170. const index2 = this.trackElements_.length;
  56171. if (!("" + index2 in this)) {
  56172. Object.defineProperty(this, index2, {
  56173. get() {
  56174. return this.trackElements_[index2];
  56175. }
  56176. });
  56177. }
  56178. if (this.trackElements_.indexOf(trackElement) === -1) {
  56179. this.trackElements_.push(trackElement);
  56180. }
  56181. }
  56182. getTrackElementByTrack_(track) {
  56183. let trackElement_;
  56184. for (let i2 = 0, length = this.trackElements_.length; i2 < length; i2++) {
  56185. if (track === this.trackElements_[i2].track) {
  56186. trackElement_ = this.trackElements_[i2];
  56187. break;
  56188. }
  56189. }
  56190. return trackElement_;
  56191. }
  56192. removeTrackElement_(trackElement) {
  56193. for (let i2 = 0, length = this.trackElements_.length; i2 < length; i2++) {
  56194. if (trackElement === this.trackElements_[i2]) {
  56195. if (this.trackElements_[i2].track && typeof this.trackElements_[i2].track.off === "function") {
  56196. this.trackElements_[i2].track.off();
  56197. }
  56198. if (typeof this.trackElements_[i2].off === "function") {
  56199. this.trackElements_[i2].off();
  56200. }
  56201. this.trackElements_.splice(i2, 1);
  56202. break;
  56203. }
  56204. }
  56205. }
  56206. }
  56207. class TextTrackCueList$1 {
  56208. constructor(cues) {
  56209. TextTrackCueList$1.prototype.setCues_.call(this, cues);
  56210. Object.defineProperty(this, "length", {
  56211. get() {
  56212. return this.length_;
  56213. }
  56214. });
  56215. }
  56216. setCues_(cues) {
  56217. const oldLength = this.length || 0;
  56218. let i2 = 0;
  56219. const l = cues.length;
  56220. this.cues_ = cues;
  56221. this.length_ = cues.length;
  56222. const defineProp = function(index2) {
  56223. if (!("" + index2 in this)) {
  56224. Object.defineProperty(this, "" + index2, {
  56225. get() {
  56226. return this.cues_[index2];
  56227. }
  56228. });
  56229. }
  56230. };
  56231. if (oldLength < l) {
  56232. i2 = oldLength;
  56233. for (; i2 < l; i2++) {
  56234. defineProp.call(this, i2);
  56235. }
  56236. }
  56237. }
  56238. getCueById(id) {
  56239. let result = null;
  56240. for (let i2 = 0, l = this.length; i2 < l; i2++) {
  56241. const cue = this[i2];
  56242. if (cue.id === id) {
  56243. result = cue;
  56244. break;
  56245. }
  56246. }
  56247. return result;
  56248. }
  56249. }
  56250. const VideoTrackKind$1 = {
  56251. alternative: "alternative",
  56252. captions: "captions",
  56253. main: "main",
  56254. sign: "sign",
  56255. subtitles: "subtitles",
  56256. commentary: "commentary"
  56257. };
  56258. const AudioTrackKind$1 = {
  56259. "alternative": "alternative",
  56260. "descriptions": "descriptions",
  56261. "main": "main",
  56262. "main-desc": "main-desc",
  56263. "translation": "translation",
  56264. "commentary": "commentary"
  56265. };
  56266. const TextTrackKind$1 = {
  56267. subtitles: "subtitles",
  56268. captions: "captions",
  56269. descriptions: "descriptions",
  56270. chapters: "chapters",
  56271. metadata: "metadata"
  56272. };
  56273. const TextTrackMode$1 = {
  56274. disabled: "disabled",
  56275. hidden: "hidden",
  56276. showing: "showing"
  56277. };
  56278. class Track$1 extends EventTarget$2$1 {
  56279. constructor(options2 = {}) {
  56280. super();
  56281. const trackProps = {
  56282. id: options2.id || "vjs_track_" + newGUID$1(),
  56283. kind: options2.kind || "",
  56284. language: options2.language || ""
  56285. };
  56286. let label2 = options2.label || "";
  56287. for (const key in trackProps) {
  56288. Object.defineProperty(this, key, {
  56289. get() {
  56290. return trackProps[key];
  56291. },
  56292. set() {
  56293. }
  56294. });
  56295. }
  56296. Object.defineProperty(this, "label", {
  56297. get() {
  56298. return label2;
  56299. },
  56300. set(newLabel) {
  56301. if (newLabel !== label2) {
  56302. label2 = newLabel;
  56303. this.trigger("labelchange");
  56304. }
  56305. }
  56306. });
  56307. }
  56308. }
  56309. const parseUrl$1 = function(url) {
  56310. const props = ["protocol", "hostname", "port", "pathname", "search", "hash", "host"];
  56311. const a = document_1.createElement("a");
  56312. a.href = url;
  56313. const details = {};
  56314. for (let i2 = 0; i2 < props.length; i2++) {
  56315. details[props[i2]] = a[props[i2]];
  56316. }
  56317. if (details.protocol === "http:") {
  56318. details.host = details.host.replace(/:80$/, "");
  56319. }
  56320. if (details.protocol === "https:") {
  56321. details.host = details.host.replace(/:443$/, "");
  56322. }
  56323. if (!details.protocol) {
  56324. details.protocol = window_1.location.protocol;
  56325. }
  56326. if (!details.host) {
  56327. details.host = window_1.location.host;
  56328. }
  56329. return details;
  56330. };
  56331. const getAbsoluteURL$1 = function(url) {
  56332. if (!url.match(/^https?:\/\//)) {
  56333. const a = document_1.createElement("a");
  56334. a.href = url;
  56335. url = a.href;
  56336. }
  56337. return url;
  56338. };
  56339. const getFileExtension$1 = function(path) {
  56340. if (typeof path === "string") {
  56341. const splitPathRe = /^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/;
  56342. const pathParts = splitPathRe.exec(path);
  56343. if (pathParts) {
  56344. return pathParts.pop().toLowerCase();
  56345. }
  56346. }
  56347. return "";
  56348. };
  56349. const isCrossOrigin$1 = function(url, winLoc = window_1.location) {
  56350. const urlInfo = parseUrl$1(url);
  56351. const srcProtocol = urlInfo.protocol === ":" ? winLoc.protocol : urlInfo.protocol;
  56352. const crossOrigin = srcProtocol + urlInfo.host !== winLoc.protocol + winLoc.host;
  56353. return crossOrigin;
  56354. };
  56355. var Url$2 = /* @__PURE__ */ Object.freeze({
  56356. __proto__: null,
  56357. parseUrl: parseUrl$1,
  56358. getAbsoluteURL: getAbsoluteURL$1,
  56359. getFileExtension: getFileExtension$1,
  56360. isCrossOrigin: isCrossOrigin$1
  56361. });
  56362. const parseCues$1 = function(srcContent, track) {
  56363. const parser2 = new window_1.WebVTT.Parser(window_1, window_1.vttjs, window_1.WebVTT.StringDecoder());
  56364. const errors2 = [];
  56365. parser2.oncue = function(cue) {
  56366. track.addCue(cue);
  56367. };
  56368. parser2.onparsingerror = function(error) {
  56369. errors2.push(error);
  56370. };
  56371. parser2.onflush = function() {
  56372. track.trigger({
  56373. type: "loadeddata",
  56374. target: track
  56375. });
  56376. };
  56377. parser2.parse(srcContent);
  56378. if (errors2.length > 0) {
  56379. if (window_1.console && window_1.console.groupCollapsed) {
  56380. window_1.console.groupCollapsed(`Text Track parsing errors for ${track.src}`);
  56381. }
  56382. errors2.forEach((error) => log$1$1.error(error));
  56383. if (window_1.console && window_1.console.groupEnd) {
  56384. window_1.console.groupEnd();
  56385. }
  56386. }
  56387. parser2.flush();
  56388. };
  56389. const loadTrack$1 = function(src, track) {
  56390. const opts = {
  56391. uri: src
  56392. };
  56393. const crossOrigin = isCrossOrigin$1(src);
  56394. if (crossOrigin) {
  56395. opts.cors = crossOrigin;
  56396. }
  56397. const withCredentials = track.tech_.crossOrigin() === "use-credentials";
  56398. if (withCredentials) {
  56399. opts.withCredentials = withCredentials;
  56400. }
  56401. XHR(opts, bind_(this, function(err, response, responseBody) {
  56402. if (err) {
  56403. return log$1$1.error(err, response);
  56404. }
  56405. track.loaded_ = true;
  56406. if (typeof window_1.WebVTT !== "function") {
  56407. if (track.tech_) {
  56408. track.tech_.any(["vttjsloaded", "vttjserror"], (event2) => {
  56409. if (event2.type === "vttjserror") {
  56410. log$1$1.error(`vttjs failed to load, stopping trying to process ${track.src}`);
  56411. return;
  56412. }
  56413. return parseCues$1(responseBody, track);
  56414. });
  56415. }
  56416. } else {
  56417. parseCues$1(responseBody, track);
  56418. }
  56419. }));
  56420. };
  56421. class TextTrack$1 extends Track$1 {
  56422. constructor(options2 = {}) {
  56423. if (!options2.tech) {
  56424. throw new Error("A tech was not provided.");
  56425. }
  56426. const settings = merge$1(options2, {
  56427. kind: TextTrackKind$1[options2.kind] || "subtitles",
  56428. language: options2.language || options2.srclang || ""
  56429. });
  56430. let mode = TextTrackMode$1[settings.mode] || "disabled";
  56431. const default_ = settings.default;
  56432. if (settings.kind === "metadata" || settings.kind === "chapters") {
  56433. mode = "hidden";
  56434. }
  56435. super(settings);
  56436. this.tech_ = settings.tech;
  56437. this.cues_ = [];
  56438. this.activeCues_ = [];
  56439. this.preload_ = this.tech_.preloadTextTracks !== false;
  56440. const cues = new TextTrackCueList$1(this.cues_);
  56441. const activeCues = new TextTrackCueList$1(this.activeCues_);
  56442. let changed = false;
  56443. this.timeupdateHandler = bind_(this, function(event2 = {}) {
  56444. if (this.tech_.isDisposed()) {
  56445. return;
  56446. }
  56447. if (!this.tech_.isReady_) {
  56448. if (event2.type !== "timeupdate") {
  56449. this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);
  56450. }
  56451. return;
  56452. }
  56453. this.activeCues = this.activeCues;
  56454. if (changed) {
  56455. this.trigger("cuechange");
  56456. changed = false;
  56457. }
  56458. if (event2.type !== "timeupdate") {
  56459. this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);
  56460. }
  56461. });
  56462. const disposeHandler = () => {
  56463. this.stopTracking();
  56464. };
  56465. this.tech_.one("dispose", disposeHandler);
  56466. if (mode !== "disabled") {
  56467. this.startTracking();
  56468. }
  56469. Object.defineProperties(this, {
  56470. default: {
  56471. get() {
  56472. return default_;
  56473. },
  56474. set() {
  56475. }
  56476. },
  56477. mode: {
  56478. get() {
  56479. return mode;
  56480. },
  56481. set(newMode) {
  56482. if (!TextTrackMode$1[newMode]) {
  56483. return;
  56484. }
  56485. if (mode === newMode) {
  56486. return;
  56487. }
  56488. mode = newMode;
  56489. if (!this.preload_ && mode !== "disabled" && this.cues.length === 0) {
  56490. loadTrack$1(this.src, this);
  56491. }
  56492. this.stopTracking();
  56493. if (mode !== "disabled") {
  56494. this.startTracking();
  56495. }
  56496. this.trigger("modechange");
  56497. }
  56498. },
  56499. cues: {
  56500. get() {
  56501. if (!this.loaded_) {
  56502. return null;
  56503. }
  56504. return cues;
  56505. },
  56506. set() {
  56507. }
  56508. },
  56509. activeCues: {
  56510. get() {
  56511. if (!this.loaded_) {
  56512. return null;
  56513. }
  56514. if (this.cues.length === 0) {
  56515. return activeCues;
  56516. }
  56517. const ct2 = this.tech_.currentTime();
  56518. const active = [];
  56519. for (let i2 = 0, l = this.cues.length; i2 < l; i2++) {
  56520. const cue = this.cues[i2];
  56521. if (cue.startTime <= ct2 && cue.endTime >= ct2) {
  56522. active.push(cue);
  56523. }
  56524. }
  56525. changed = false;
  56526. if (active.length !== this.activeCues_.length) {
  56527. changed = true;
  56528. } else {
  56529. for (let i2 = 0; i2 < active.length; i2++) {
  56530. if (this.activeCues_.indexOf(active[i2]) === -1) {
  56531. changed = true;
  56532. }
  56533. }
  56534. }
  56535. this.activeCues_ = active;
  56536. activeCues.setCues_(this.activeCues_);
  56537. return activeCues;
  56538. },
  56539. set() {
  56540. }
  56541. }
  56542. });
  56543. if (settings.src) {
  56544. this.src = settings.src;
  56545. if (!this.preload_) {
  56546. this.loaded_ = true;
  56547. }
  56548. if (this.preload_ || settings.kind !== "subtitles" && settings.kind !== "captions") {
  56549. loadTrack$1(this.src, this);
  56550. }
  56551. } else {
  56552. this.loaded_ = true;
  56553. }
  56554. }
  56555. startTracking() {
  56556. this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);
  56557. this.tech_.on("timeupdate", this.timeupdateHandler);
  56558. }
  56559. stopTracking() {
  56560. if (this.rvf_) {
  56561. this.tech_.cancelVideoFrameCallback(this.rvf_);
  56562. this.rvf_ = void 0;
  56563. }
  56564. this.tech_.off("timeupdate", this.timeupdateHandler);
  56565. }
  56566. addCue(originalCue) {
  56567. let cue = originalCue;
  56568. if (window_1.vttjs && !(originalCue instanceof window_1.vttjs.VTTCue)) {
  56569. cue = new window_1.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text);
  56570. for (const prop in originalCue) {
  56571. if (!(prop in cue)) {
  56572. cue[prop] = originalCue[prop];
  56573. }
  56574. }
  56575. cue.id = originalCue.id;
  56576. cue.originalCue_ = originalCue;
  56577. }
  56578. const tracks = this.tech_.textTracks();
  56579. for (let i2 = 0; i2 < tracks.length; i2++) {
  56580. if (tracks[i2] !== this) {
  56581. tracks[i2].removeCue(cue);
  56582. }
  56583. }
  56584. this.cues_.push(cue);
  56585. this.cues.setCues_(this.cues_);
  56586. }
  56587. removeCue(removeCue) {
  56588. let i2 = this.cues_.length;
  56589. while (i2--) {
  56590. const cue = this.cues_[i2];
  56591. if (cue === removeCue || cue.originalCue_ && cue.originalCue_ === removeCue) {
  56592. this.cues_.splice(i2, 1);
  56593. this.cues.setCues_(this.cues_);
  56594. break;
  56595. }
  56596. }
  56597. }
  56598. }
  56599. TextTrack$1.prototype.allowedEvents_ = {
  56600. cuechange: "cuechange"
  56601. };
  56602. class AudioTrack$1 extends Track$1 {
  56603. constructor(options2 = {}) {
  56604. const settings = merge$1(options2, {
  56605. kind: AudioTrackKind$1[options2.kind] || ""
  56606. });
  56607. super(settings);
  56608. let enabled = false;
  56609. Object.defineProperty(this, "enabled", {
  56610. get() {
  56611. return enabled;
  56612. },
  56613. set(newEnabled) {
  56614. if (typeof newEnabled !== "boolean" || newEnabled === enabled) {
  56615. return;
  56616. }
  56617. enabled = newEnabled;
  56618. this.trigger("enabledchange");
  56619. }
  56620. });
  56621. if (settings.enabled) {
  56622. this.enabled = settings.enabled;
  56623. }
  56624. this.loaded_ = true;
  56625. }
  56626. }
  56627. class VideoTrack$1 extends Track$1 {
  56628. constructor(options2 = {}) {
  56629. const settings = merge$1(options2, {
  56630. kind: VideoTrackKind$1[options2.kind] || ""
  56631. });
  56632. super(settings);
  56633. let selected = false;
  56634. Object.defineProperty(this, "selected", {
  56635. get() {
  56636. return selected;
  56637. },
  56638. set(newSelected) {
  56639. if (typeof newSelected !== "boolean" || newSelected === selected) {
  56640. return;
  56641. }
  56642. selected = newSelected;
  56643. this.trigger("selectedchange");
  56644. }
  56645. });
  56646. if (settings.selected) {
  56647. this.selected = settings.selected;
  56648. }
  56649. }
  56650. }
  56651. class HTMLTrackElement$1 extends EventTarget$2$1 {
  56652. constructor(options2 = {}) {
  56653. super();
  56654. let readyState;
  56655. const track = new TextTrack$1(options2);
  56656. this.kind = track.kind;
  56657. this.src = track.src;
  56658. this.srclang = track.language;
  56659. this.label = track.label;
  56660. this.default = track.default;
  56661. Object.defineProperties(this, {
  56662. readyState: {
  56663. get() {
  56664. return readyState;
  56665. }
  56666. },
  56667. track: {
  56668. get() {
  56669. return track;
  56670. }
  56671. }
  56672. });
  56673. readyState = HTMLTrackElement$1.NONE;
  56674. track.addEventListener("loadeddata", () => {
  56675. readyState = HTMLTrackElement$1.LOADED;
  56676. this.trigger({
  56677. type: "load",
  56678. target: this
  56679. });
  56680. });
  56681. }
  56682. }
  56683. HTMLTrackElement$1.prototype.allowedEvents_ = {
  56684. load: "load"
  56685. };
  56686. HTMLTrackElement$1.NONE = 0;
  56687. HTMLTrackElement$1.LOADING = 1;
  56688. HTMLTrackElement$1.LOADED = 2;
  56689. HTMLTrackElement$1.ERROR = 3;
  56690. const NORMAL$1 = {
  56691. audio: {
  56692. ListClass: AudioTrackList$1,
  56693. TrackClass: AudioTrack$1,
  56694. capitalName: "Audio"
  56695. },
  56696. video: {
  56697. ListClass: VideoTrackList$1,
  56698. TrackClass: VideoTrack$1,
  56699. capitalName: "Video"
  56700. },
  56701. text: {
  56702. ListClass: TextTrackList$1,
  56703. TrackClass: TextTrack$1,
  56704. capitalName: "Text"
  56705. }
  56706. };
  56707. Object.keys(NORMAL$1).forEach(function(type2) {
  56708. NORMAL$1[type2].getterName = `${type2}Tracks`;
  56709. NORMAL$1[type2].privateName = `${type2}Tracks_`;
  56710. });
  56711. const REMOTE$1 = {
  56712. remoteText: {
  56713. ListClass: TextTrackList$1,
  56714. TrackClass: TextTrack$1,
  56715. capitalName: "RemoteText",
  56716. getterName: "remoteTextTracks",
  56717. privateName: "remoteTextTracks_"
  56718. },
  56719. remoteTextEl: {
  56720. ListClass: HtmlTrackElementList$1,
  56721. TrackClass: HTMLTrackElement$1,
  56722. capitalName: "RemoteTextTrackEls",
  56723. getterName: "remoteTextTrackEls",
  56724. privateName: "remoteTextTrackEls_"
  56725. }
  56726. };
  56727. const ALL$1 = Object.assign({}, NORMAL$1, REMOTE$1);
  56728. REMOTE$1.names = Object.keys(REMOTE$1);
  56729. NORMAL$1.names = Object.keys(NORMAL$1);
  56730. ALL$1.names = [].concat(REMOTE$1.names).concat(NORMAL$1.names);
  56731. function createTrackHelper$1(self2, kind, label2, language, options2 = {}) {
  56732. const tracks = self2.textTracks();
  56733. options2.kind = kind;
  56734. if (label2) {
  56735. options2.label = label2;
  56736. }
  56737. if (language) {
  56738. options2.language = language;
  56739. }
  56740. options2.tech = self2;
  56741. const track = new ALL$1.text.TrackClass(options2);
  56742. tracks.addTrack(track);
  56743. return track;
  56744. }
  56745. class Tech$2 extends Component$1$1 {
  56746. constructor(options2 = {}, ready = function() {
  56747. }) {
  56748. options2.reportTouchActivity = false;
  56749. super(null, options2, ready);
  56750. this.onDurationChange_ = (e) => this.onDurationChange(e);
  56751. this.trackProgress_ = (e) => this.trackProgress(e);
  56752. this.trackCurrentTime_ = (e) => this.trackCurrentTime(e);
  56753. this.stopTrackingCurrentTime_ = (e) => this.stopTrackingCurrentTime(e);
  56754. this.disposeSourceHandler_ = (e) => this.disposeSourceHandler(e);
  56755. this.queuedHanders_ = /* @__PURE__ */ new Set();
  56756. this.hasStarted_ = false;
  56757. this.on("playing", function() {
  56758. this.hasStarted_ = true;
  56759. });
  56760. this.on("loadstart", function() {
  56761. this.hasStarted_ = false;
  56762. });
  56763. ALL$1.names.forEach((name) => {
  56764. const props = ALL$1[name];
  56765. if (options2 && options2[props.getterName]) {
  56766. this[props.privateName] = options2[props.getterName];
  56767. }
  56768. });
  56769. if (!this.featuresProgressEvents) {
  56770. this.manualProgressOn();
  56771. }
  56772. if (!this.featuresTimeupdateEvents) {
  56773. this.manualTimeUpdatesOn();
  56774. }
  56775. ["Text", "Audio", "Video"].forEach((track) => {
  56776. if (options2[`native${track}Tracks`] === false) {
  56777. this[`featuresNative${track}Tracks`] = false;
  56778. }
  56779. });
  56780. if (options2.nativeCaptions === false || options2.nativeTextTracks === false) {
  56781. this.featuresNativeTextTracks = false;
  56782. } else if (options2.nativeCaptions === true || options2.nativeTextTracks === true) {
  56783. this.featuresNativeTextTracks = true;
  56784. }
  56785. if (!this.featuresNativeTextTracks) {
  56786. this.emulateTextTracks();
  56787. }
  56788. this.preloadTextTracks = options2.preloadTextTracks !== false;
  56789. this.autoRemoteTextTracks_ = new ALL$1.text.ListClass();
  56790. this.initTrackListeners();
  56791. if (!options2.nativeControlsForTouch) {
  56792. this.emitTapEvents();
  56793. }
  56794. if (this.constructor) {
  56795. this.name_ = this.constructor.name || "Unknown Tech";
  56796. }
  56797. }
  56798. triggerSourceset(src) {
  56799. if (!this.isReady_) {
  56800. this.one("ready", () => this.setTimeout(() => this.triggerSourceset(src), 1));
  56801. }
  56802. this.trigger({
  56803. src,
  56804. type: "sourceset"
  56805. });
  56806. }
  56807. manualProgressOn() {
  56808. this.on("durationchange", this.onDurationChange_);
  56809. this.manualProgress = true;
  56810. this.one("ready", this.trackProgress_);
  56811. }
  56812. manualProgressOff() {
  56813. this.manualProgress = false;
  56814. this.stopTrackingProgress();
  56815. this.off("durationchange", this.onDurationChange_);
  56816. }
  56817. trackProgress(event2) {
  56818. this.stopTrackingProgress();
  56819. this.progressInterval = this.setInterval(bind_(this, function() {
  56820. const numBufferedPercent = this.bufferedPercent();
  56821. if (this.bufferedPercent_ !== numBufferedPercent) {
  56822. this.trigger("progress");
  56823. }
  56824. this.bufferedPercent_ = numBufferedPercent;
  56825. if (numBufferedPercent === 1) {
  56826. this.stopTrackingProgress();
  56827. }
  56828. }), 500);
  56829. }
  56830. onDurationChange(event2) {
  56831. this.duration_ = this.duration();
  56832. }
  56833. buffered() {
  56834. return createTimeRanges$1(0, 0);
  56835. }
  56836. bufferedPercent() {
  56837. return bufferedPercent$1(this.buffered(), this.duration_);
  56838. }
  56839. stopTrackingProgress() {
  56840. this.clearInterval(this.progressInterval);
  56841. }
  56842. manualTimeUpdatesOn() {
  56843. this.manualTimeUpdates = true;
  56844. this.on("play", this.trackCurrentTime_);
  56845. this.on("pause", this.stopTrackingCurrentTime_);
  56846. }
  56847. manualTimeUpdatesOff() {
  56848. this.manualTimeUpdates = false;
  56849. this.stopTrackingCurrentTime();
  56850. this.off("play", this.trackCurrentTime_);
  56851. this.off("pause", this.stopTrackingCurrentTime_);
  56852. }
  56853. trackCurrentTime() {
  56854. if (this.currentTimeInterval) {
  56855. this.stopTrackingCurrentTime();
  56856. }
  56857. this.currentTimeInterval = this.setInterval(function() {
  56858. this.trigger({
  56859. type: "timeupdate",
  56860. target: this,
  56861. manuallyTriggered: true
  56862. });
  56863. }, 250);
  56864. }
  56865. stopTrackingCurrentTime() {
  56866. this.clearInterval(this.currentTimeInterval);
  56867. this.trigger({
  56868. type: "timeupdate",
  56869. target: this,
  56870. manuallyTriggered: true
  56871. });
  56872. }
  56873. dispose() {
  56874. this.clearTracks(NORMAL$1.names);
  56875. if (this.manualProgress) {
  56876. this.manualProgressOff();
  56877. }
  56878. if (this.manualTimeUpdates) {
  56879. this.manualTimeUpdatesOff();
  56880. }
  56881. super.dispose();
  56882. }
  56883. clearTracks(types) {
  56884. types = [].concat(types);
  56885. types.forEach((type2) => {
  56886. const list = this[`${type2}Tracks`]() || [];
  56887. let i2 = list.length;
  56888. while (i2--) {
  56889. const track = list[i2];
  56890. if (type2 === "text") {
  56891. this.removeRemoteTextTrack(track);
  56892. }
  56893. list.removeTrack(track);
  56894. }
  56895. });
  56896. }
  56897. cleanupAutoTextTracks() {
  56898. const list = this.autoRemoteTextTracks_ || [];
  56899. let i2 = list.length;
  56900. while (i2--) {
  56901. const track = list[i2];
  56902. this.removeRemoteTextTrack(track);
  56903. }
  56904. }
  56905. reset() {
  56906. }
  56907. crossOrigin() {
  56908. }
  56909. setCrossOrigin() {
  56910. }
  56911. error(err) {
  56912. if (err !== void 0) {
  56913. this.error_ = new MediaError$1(err);
  56914. this.trigger("error");
  56915. }
  56916. return this.error_;
  56917. }
  56918. played() {
  56919. if (this.hasStarted_) {
  56920. return createTimeRanges$1(0, 0);
  56921. }
  56922. return createTimeRanges$1();
  56923. }
  56924. play() {
  56925. }
  56926. setScrubbing(_isScrubbing) {
  56927. }
  56928. scrubbing() {
  56929. }
  56930. setCurrentTime(_seconds) {
  56931. if (this.manualTimeUpdates) {
  56932. this.trigger({
  56933. type: "timeupdate",
  56934. target: this,
  56935. manuallyTriggered: true
  56936. });
  56937. }
  56938. }
  56939. initTrackListeners() {
  56940. NORMAL$1.names.forEach((name) => {
  56941. const props = NORMAL$1[name];
  56942. const trackListChanges = () => {
  56943. this.trigger(`${name}trackchange`);
  56944. };
  56945. const tracks = this[props.getterName]();
  56946. tracks.addEventListener("removetrack", trackListChanges);
  56947. tracks.addEventListener("addtrack", trackListChanges);
  56948. this.on("dispose", () => {
  56949. tracks.removeEventListener("removetrack", trackListChanges);
  56950. tracks.removeEventListener("addtrack", trackListChanges);
  56951. });
  56952. });
  56953. }
  56954. addWebVttScript_() {
  56955. if (window_1.WebVTT) {
  56956. return;
  56957. }
  56958. if (document_1.body.contains(this.el())) {
  56959. if (!this.options_["vtt.js"] && isPlain$1(vtt) && Object.keys(vtt).length > 0) {
  56960. this.trigger("vttjsloaded");
  56961. return;
  56962. }
  56963. const script = document_1.createElement("script");
  56964. script.src = this.options_["vtt.js"] || "https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js";
  56965. script.onload = () => {
  56966. this.trigger("vttjsloaded");
  56967. };
  56968. script.onerror = () => {
  56969. this.trigger("vttjserror");
  56970. };
  56971. this.on("dispose", () => {
  56972. script.onload = null;
  56973. script.onerror = null;
  56974. });
  56975. window_1.WebVTT = true;
  56976. this.el().parentNode.appendChild(script);
  56977. } else {
  56978. this.ready(this.addWebVttScript_);
  56979. }
  56980. }
  56981. emulateTextTracks() {
  56982. const tracks = this.textTracks();
  56983. const remoteTracks = this.remoteTextTracks();
  56984. const handleAddTrack = (e) => tracks.addTrack(e.track);
  56985. const handleRemoveTrack = (e) => tracks.removeTrack(e.track);
  56986. remoteTracks.on("addtrack", handleAddTrack);
  56987. remoteTracks.on("removetrack", handleRemoveTrack);
  56988. this.addWebVttScript_();
  56989. const updateDisplay = () => this.trigger("texttrackchange");
  56990. const textTracksChanges = () => {
  56991. updateDisplay();
  56992. for (let i2 = 0; i2 < tracks.length; i2++) {
  56993. const track = tracks[i2];
  56994. track.removeEventListener("cuechange", updateDisplay);
  56995. if (track.mode === "showing") {
  56996. track.addEventListener("cuechange", updateDisplay);
  56997. }
  56998. }
  56999. };
  57000. textTracksChanges();
  57001. tracks.addEventListener("change", textTracksChanges);
  57002. tracks.addEventListener("addtrack", textTracksChanges);
  57003. tracks.addEventListener("removetrack", textTracksChanges);
  57004. this.on("dispose", function() {
  57005. remoteTracks.off("addtrack", handleAddTrack);
  57006. remoteTracks.off("removetrack", handleRemoveTrack);
  57007. tracks.removeEventListener("change", textTracksChanges);
  57008. tracks.removeEventListener("addtrack", textTracksChanges);
  57009. tracks.removeEventListener("removetrack", textTracksChanges);
  57010. for (let i2 = 0; i2 < tracks.length; i2++) {
  57011. const track = tracks[i2];
  57012. track.removeEventListener("cuechange", updateDisplay);
  57013. }
  57014. });
  57015. }
  57016. addTextTrack(kind, label2, language) {
  57017. if (!kind) {
  57018. throw new Error("TextTrack kind is required but was not provided");
  57019. }
  57020. return createTrackHelper$1(this, kind, label2, language);
  57021. }
  57022. createRemoteTextTrack(options2) {
  57023. const track = merge$1(options2, {
  57024. tech: this
  57025. });
  57026. return new REMOTE$1.remoteTextEl.TrackClass(track);
  57027. }
  57028. addRemoteTextTrack(options2 = {}, manualCleanup) {
  57029. const htmlTrackElement = this.createRemoteTextTrack(options2);
  57030. if (typeof manualCleanup !== "boolean") {
  57031. manualCleanup = false;
  57032. }
  57033. this.remoteTextTrackEls().addTrackElement_(htmlTrackElement);
  57034. this.remoteTextTracks().addTrack(htmlTrackElement.track);
  57035. if (manualCleanup === false) {
  57036. this.ready(() => this.autoRemoteTextTracks_.addTrack(htmlTrackElement.track));
  57037. }
  57038. return htmlTrackElement;
  57039. }
  57040. removeRemoteTextTrack(track) {
  57041. const trackElement = this.remoteTextTrackEls().getTrackElementByTrack_(track);
  57042. this.remoteTextTrackEls().removeTrackElement_(trackElement);
  57043. this.remoteTextTracks().removeTrack(track);
  57044. this.autoRemoteTextTracks_.removeTrack(track);
  57045. }
  57046. getVideoPlaybackQuality() {
  57047. return {};
  57048. }
  57049. requestPictureInPicture() {
  57050. return Promise.reject();
  57051. }
  57052. disablePictureInPicture() {
  57053. return true;
  57054. }
  57055. setDisablePictureInPicture() {
  57056. }
  57057. requestVideoFrameCallback(cb) {
  57058. const id = newGUID$1();
  57059. if (!this.isReady_ || this.paused()) {
  57060. this.queuedHanders_.add(id);
  57061. this.one("playing", () => {
  57062. if (this.queuedHanders_.has(id)) {
  57063. this.queuedHanders_.delete(id);
  57064. cb();
  57065. }
  57066. });
  57067. } else {
  57068. this.requestNamedAnimationFrame(id, cb);
  57069. }
  57070. return id;
  57071. }
  57072. cancelVideoFrameCallback(id) {
  57073. if (this.queuedHanders_.has(id)) {
  57074. this.queuedHanders_.delete(id);
  57075. } else {
  57076. this.cancelNamedAnimationFrame(id);
  57077. }
  57078. }
  57079. setPoster() {
  57080. }
  57081. playsinline() {
  57082. }
  57083. setPlaysinline() {
  57084. }
  57085. overrideNativeAudioTracks(override) {
  57086. }
  57087. overrideNativeVideoTracks(override) {
  57088. }
  57089. canPlayType(_type) {
  57090. return "";
  57091. }
  57092. static canPlayType(_type) {
  57093. return "";
  57094. }
  57095. static canPlaySource(srcObj, options2) {
  57096. return Tech$2.canPlayType(srcObj.type);
  57097. }
  57098. static isTech(component) {
  57099. return component.prototype instanceof Tech$2 || component instanceof Tech$2 || component === Tech$2;
  57100. }
  57101. static registerTech(name, tech) {
  57102. if (!Tech$2.techs_) {
  57103. Tech$2.techs_ = {};
  57104. }
  57105. if (!Tech$2.isTech(tech)) {
  57106. throw new Error(`Tech ${name} must be a Tech`);
  57107. }
  57108. if (!Tech$2.canPlayType) {
  57109. throw new Error("Techs must have a static canPlayType method on them");
  57110. }
  57111. if (!Tech$2.canPlaySource) {
  57112. throw new Error("Techs must have a static canPlaySource method on them");
  57113. }
  57114. name = toTitleCase$1$1(name);
  57115. Tech$2.techs_[name] = tech;
  57116. Tech$2.techs_[toLowerCase$1(name)] = tech;
  57117. if (name !== "Tech") {
  57118. Tech$2.defaultTechOrder_.push(name);
  57119. }
  57120. return tech;
  57121. }
  57122. static getTech(name) {
  57123. if (!name) {
  57124. return;
  57125. }
  57126. if (Tech$2.techs_ && Tech$2.techs_[name]) {
  57127. return Tech$2.techs_[name];
  57128. }
  57129. name = toTitleCase$1$1(name);
  57130. if (window_1 && window_1.videojs && window_1.videojs[name]) {
  57131. log$1$1.warn(`The ${name} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`);
  57132. return window_1.videojs[name];
  57133. }
  57134. }
  57135. }
  57136. ALL$1.names.forEach(function(name) {
  57137. const props = ALL$1[name];
  57138. Tech$2.prototype[props.getterName] = function() {
  57139. this[props.privateName] = this[props.privateName] || new props.ListClass();
  57140. return this[props.privateName];
  57141. };
  57142. });
  57143. Tech$2.prototype.featuresVolumeControl = true;
  57144. Tech$2.prototype.featuresMuteControl = true;
  57145. Tech$2.prototype.featuresFullscreenResize = false;
  57146. Tech$2.prototype.featuresPlaybackRate = false;
  57147. Tech$2.prototype.featuresProgressEvents = false;
  57148. Tech$2.prototype.featuresSourceset = false;
  57149. Tech$2.prototype.featuresTimeupdateEvents = false;
  57150. Tech$2.prototype.featuresNativeTextTracks = false;
  57151. Tech$2.prototype.featuresVideoFrameCallback = false;
  57152. Tech$2.withSourceHandlers = function(_Tech) {
  57153. _Tech.registerSourceHandler = function(handler, index2) {
  57154. let handlers = _Tech.sourceHandlers;
  57155. if (!handlers) {
  57156. handlers = _Tech.sourceHandlers = [];
  57157. }
  57158. if (index2 === void 0) {
  57159. index2 = handlers.length;
  57160. }
  57161. handlers.splice(index2, 0, handler);
  57162. };
  57163. _Tech.canPlayType = function(type2) {
  57164. const handlers = _Tech.sourceHandlers || [];
  57165. let can;
  57166. for (let i2 = 0; i2 < handlers.length; i2++) {
  57167. can = handlers[i2].canPlayType(type2);
  57168. if (can) {
  57169. return can;
  57170. }
  57171. }
  57172. return "";
  57173. };
  57174. _Tech.selectSourceHandler = function(source, options2) {
  57175. const handlers = _Tech.sourceHandlers || [];
  57176. let can;
  57177. for (let i2 = 0; i2 < handlers.length; i2++) {
  57178. can = handlers[i2].canHandleSource(source, options2);
  57179. if (can) {
  57180. return handlers[i2];
  57181. }
  57182. }
  57183. return null;
  57184. };
  57185. _Tech.canPlaySource = function(srcObj, options2) {
  57186. const sh = _Tech.selectSourceHandler(srcObj, options2);
  57187. if (sh) {
  57188. return sh.canHandleSource(srcObj, options2);
  57189. }
  57190. return "";
  57191. };
  57192. const deferrable = ["seekable", "seeking", "duration"];
  57193. deferrable.forEach(function(fnName) {
  57194. const originalFn = this[fnName];
  57195. if (typeof originalFn !== "function") {
  57196. return;
  57197. }
  57198. this[fnName] = function() {
  57199. if (this.sourceHandler_ && this.sourceHandler_[fnName]) {
  57200. return this.sourceHandler_[fnName].apply(this.sourceHandler_, arguments);
  57201. }
  57202. return originalFn.apply(this, arguments);
  57203. };
  57204. }, _Tech.prototype);
  57205. _Tech.prototype.setSource = function(source) {
  57206. let sh = _Tech.selectSourceHandler(source, this.options_);
  57207. if (!sh) {
  57208. if (_Tech.nativeSourceHandler) {
  57209. sh = _Tech.nativeSourceHandler;
  57210. } else {
  57211. log$1$1.error("No source handler found for the current source.");
  57212. }
  57213. }
  57214. this.disposeSourceHandler();
  57215. this.off("dispose", this.disposeSourceHandler_);
  57216. if (sh !== _Tech.nativeSourceHandler) {
  57217. this.currentSource_ = source;
  57218. }
  57219. this.sourceHandler_ = sh.handleSource(source, this, this.options_);
  57220. this.one("dispose", this.disposeSourceHandler_);
  57221. };
  57222. _Tech.prototype.disposeSourceHandler = function() {
  57223. if (this.currentSource_) {
  57224. this.clearTracks(["audio", "video"]);
  57225. this.currentSource_ = null;
  57226. }
  57227. this.cleanupAutoTextTracks();
  57228. if (this.sourceHandler_) {
  57229. if (this.sourceHandler_.dispose) {
  57230. this.sourceHandler_.dispose();
  57231. }
  57232. this.sourceHandler_ = null;
  57233. }
  57234. };
  57235. };
  57236. Component$1$1.registerComponent("Tech", Tech$2);
  57237. Tech$2.registerTech("Tech", Tech$2);
  57238. Tech$2.defaultTechOrder_ = [];
  57239. const middlewares$1 = {};
  57240. const middlewareInstances$1 = {};
  57241. const TERMINATOR$1 = {};
  57242. function use$1(type2, middleware) {
  57243. middlewares$1[type2] = middlewares$1[type2] || [];
  57244. middlewares$1[type2].push(middleware);
  57245. }
  57246. function setSource$1(player, src, next) {
  57247. player.setTimeout(() => setSourceHelper$1(src, middlewares$1[src.type], next, player), 1);
  57248. }
  57249. function setTech$1(middleware, tech) {
  57250. middleware.forEach((mw) => mw.setTech && mw.setTech(tech));
  57251. }
  57252. function get$1(middleware, tech, method) {
  57253. return middleware.reduceRight(middlewareIterator$1(method), tech[method]());
  57254. }
  57255. function set$1(middleware, tech, method, arg) {
  57256. return tech[method](middleware.reduce(middlewareIterator$1(method), arg));
  57257. }
  57258. function mediate$1(middleware, tech, method, arg = null) {
  57259. const callMethod = "call" + toTitleCase$1$1(method);
  57260. const middlewareValue = middleware.reduce(middlewareIterator$1(callMethod), arg);
  57261. const terminated = middlewareValue === TERMINATOR$1;
  57262. const returnValue = terminated ? null : tech[method](middlewareValue);
  57263. executeRight$1(middleware, method, returnValue, terminated);
  57264. return returnValue;
  57265. }
  57266. const allowedGetters$1 = {
  57267. buffered: 1,
  57268. currentTime: 1,
  57269. duration: 1,
  57270. muted: 1,
  57271. played: 1,
  57272. paused: 1,
  57273. seekable: 1,
  57274. volume: 1,
  57275. ended: 1
  57276. };
  57277. const allowedSetters$1 = {
  57278. setCurrentTime: 1,
  57279. setMuted: 1,
  57280. setVolume: 1
  57281. };
  57282. const allowedMediators$1 = {
  57283. play: 1,
  57284. pause: 1
  57285. };
  57286. function middlewareIterator$1(method) {
  57287. return (value, mw) => {
  57288. if (value === TERMINATOR$1) {
  57289. return TERMINATOR$1;
  57290. }
  57291. if (mw[method]) {
  57292. return mw[method](value);
  57293. }
  57294. return value;
  57295. };
  57296. }
  57297. function executeRight$1(mws, method, value, terminated) {
  57298. for (let i2 = mws.length - 1; i2 >= 0; i2--) {
  57299. const mw = mws[i2];
  57300. if (mw[method]) {
  57301. mw[method](terminated, value);
  57302. }
  57303. }
  57304. }
  57305. function clearCacheForPlayer$1(player) {
  57306. middlewareInstances$1[player.id()] = null;
  57307. }
  57308. function getOrCreateFactory$1(player, mwFactory) {
  57309. const mws = middlewareInstances$1[player.id()];
  57310. let mw = null;
  57311. if (mws === void 0 || mws === null) {
  57312. mw = mwFactory(player);
  57313. middlewareInstances$1[player.id()] = [[mwFactory, mw]];
  57314. return mw;
  57315. }
  57316. for (let i2 = 0; i2 < mws.length; i2++) {
  57317. const [mwf, mwi] = mws[i2];
  57318. if (mwf !== mwFactory) {
  57319. continue;
  57320. }
  57321. mw = mwi;
  57322. }
  57323. if (mw === null) {
  57324. mw = mwFactory(player);
  57325. mws.push([mwFactory, mw]);
  57326. }
  57327. return mw;
  57328. }
  57329. function setSourceHelper$1(src = {}, middleware = [], next, player, acc = [], lastRun = false) {
  57330. const [mwFactory, ...mwrest] = middleware;
  57331. if (typeof mwFactory === "string") {
  57332. setSourceHelper$1(src, middlewares$1[mwFactory], next, player, acc, lastRun);
  57333. } else if (mwFactory) {
  57334. const mw = getOrCreateFactory$1(player, mwFactory);
  57335. if (!mw.setSource) {
  57336. acc.push(mw);
  57337. return setSourceHelper$1(src, mwrest, next, player, acc, lastRun);
  57338. }
  57339. mw.setSource(Object.assign({}, src), function(err, _src) {
  57340. if (err) {
  57341. return setSourceHelper$1(src, mwrest, next, player, acc, lastRun);
  57342. }
  57343. acc.push(mw);
  57344. setSourceHelper$1(_src, src.type === _src.type ? mwrest : middlewares$1[_src.type], next, player, acc, lastRun);
  57345. });
  57346. } else if (mwrest.length) {
  57347. setSourceHelper$1(src, mwrest, next, player, acc, lastRun);
  57348. } else if (lastRun) {
  57349. next(src, acc);
  57350. } else {
  57351. setSourceHelper$1(src, middlewares$1["*"], next, player, acc, true);
  57352. }
  57353. }
  57354. const MimetypesKind$1 = {
  57355. opus: "video/ogg",
  57356. ogv: "video/ogg",
  57357. mp4: "video/mp4",
  57358. mov: "video/mp4",
  57359. m4v: "video/mp4",
  57360. mkv: "video/x-matroska",
  57361. m4a: "audio/mp4",
  57362. mp3: "audio/mpeg",
  57363. aac: "audio/aac",
  57364. caf: "audio/x-caf",
  57365. flac: "audio/flac",
  57366. oga: "audio/ogg",
  57367. wav: "audio/wav",
  57368. m3u8: "application/x-mpegURL",
  57369. mpd: "application/dash+xml",
  57370. jpg: "image/jpeg",
  57371. jpeg: "image/jpeg",
  57372. gif: "image/gif",
  57373. png: "image/png",
  57374. svg: "image/svg+xml",
  57375. webp: "image/webp"
  57376. };
  57377. const getMimetype$1 = function(src = "") {
  57378. const ext = getFileExtension$1(src);
  57379. const mimetype = MimetypesKind$1[ext.toLowerCase()];
  57380. return mimetype || "";
  57381. };
  57382. const findMimetype$1 = (player, src) => {
  57383. if (!src) {
  57384. return "";
  57385. }
  57386. if (player.cache_.source.src === src && player.cache_.source.type) {
  57387. return player.cache_.source.type;
  57388. }
  57389. const matchingSources = player.cache_.sources.filter((s) => s.src === src);
  57390. if (matchingSources.length) {
  57391. return matchingSources[0].type;
  57392. }
  57393. const sources = player.$$("source");
  57394. for (let i2 = 0; i2 < sources.length; i2++) {
  57395. const s = sources[i2];
  57396. if (s.type && s.src && s.src === src) {
  57397. return s.type;
  57398. }
  57399. }
  57400. return getMimetype$1(src);
  57401. };
  57402. const filterSource$1 = function(src) {
  57403. if (Array.isArray(src)) {
  57404. let newsrc = [];
  57405. src.forEach(function(srcobj) {
  57406. srcobj = filterSource$1(srcobj);
  57407. if (Array.isArray(srcobj)) {
  57408. newsrc = newsrc.concat(srcobj);
  57409. } else if (isObject$2(srcobj)) {
  57410. newsrc.push(srcobj);
  57411. }
  57412. });
  57413. src = newsrc;
  57414. } else if (typeof src === "string" && src.trim()) {
  57415. src = [fixSource$1({
  57416. src
  57417. })];
  57418. } else if (isObject$2(src) && typeof src.src === "string" && src.src && src.src.trim()) {
  57419. src = [fixSource$1(src)];
  57420. } else {
  57421. src = [];
  57422. }
  57423. return src;
  57424. };
  57425. function fixSource$1(src) {
  57426. if (!src.type) {
  57427. const mimetype = getMimetype$1(src.src);
  57428. if (mimetype) {
  57429. src.type = mimetype;
  57430. }
  57431. }
  57432. return src;
  57433. }
  57434. class MediaLoader$1 extends Component$1$1 {
  57435. constructor(player, options2, ready) {
  57436. const options_ = merge$1({
  57437. createEl: false
  57438. }, options2);
  57439. super(player, options_, ready);
  57440. if (!options2.playerOptions.sources || options2.playerOptions.sources.length === 0) {
  57441. for (let i2 = 0, j = options2.playerOptions.techOrder; i2 < j.length; i2++) {
  57442. const techName = toTitleCase$1$1(j[i2]);
  57443. let tech = Tech$2.getTech(techName);
  57444. if (!techName) {
  57445. tech = Component$1$1.getComponent(techName);
  57446. }
  57447. if (tech && tech.isSupported()) {
  57448. player.loadTech_(techName);
  57449. break;
  57450. }
  57451. }
  57452. } else {
  57453. player.src(options2.playerOptions.sources);
  57454. }
  57455. }
  57456. }
  57457. Component$1$1.registerComponent("MediaLoader", MediaLoader$1);
  57458. class ClickableComponent$1 extends Component$1$1 {
  57459. constructor(player, options2) {
  57460. super(player, options2);
  57461. if (this.options_.controlText) {
  57462. this.controlText(this.options_.controlText);
  57463. }
  57464. this.handleMouseOver_ = (e) => this.handleMouseOver(e);
  57465. this.handleMouseOut_ = (e) => this.handleMouseOut(e);
  57466. this.handleClick_ = (e) => this.handleClick(e);
  57467. this.handleKeyDown_ = (e) => this.handleKeyDown(e);
  57468. this.emitTapEvents();
  57469. this.enable();
  57470. }
  57471. createEl(tag = "div", props = {}, attributes = {}) {
  57472. props = Object.assign({
  57473. className: this.buildCSSClass(),
  57474. tabIndex: 0
  57475. }, props);
  57476. if (tag === "button") {
  57477. log$1$1.error(`Creating a ClickableComponent with an HTML element of ${tag} is not supported; use a Button instead.`);
  57478. }
  57479. attributes = Object.assign({
  57480. role: "button"
  57481. }, attributes);
  57482. this.tabIndex_ = props.tabIndex;
  57483. const el = createEl$1(tag, props, attributes);
  57484. el.appendChild(createEl$1("span", {
  57485. className: "vjs-icon-placeholder"
  57486. }, {
  57487. "aria-hidden": true
  57488. }));
  57489. this.createControlTextEl(el);
  57490. return el;
  57491. }
  57492. dispose() {
  57493. this.controlTextEl_ = null;
  57494. super.dispose();
  57495. }
  57496. createControlTextEl(el) {
  57497. this.controlTextEl_ = createEl$1("span", {
  57498. className: "vjs-control-text"
  57499. }, {
  57500. "aria-live": "polite"
  57501. });
  57502. if (el) {
  57503. el.appendChild(this.controlTextEl_);
  57504. }
  57505. this.controlText(this.controlText_, el);
  57506. return this.controlTextEl_;
  57507. }
  57508. controlText(text, el = this.el()) {
  57509. if (text === void 0) {
  57510. return this.controlText_ || "Need Text";
  57511. }
  57512. const localizedText = this.localize(text);
  57513. this.controlText_ = text;
  57514. textContent$1(this.controlTextEl_, localizedText);
  57515. if (!this.nonIconControl && !this.player_.options_.noUITitleAttributes) {
  57516. el.setAttribute("title", localizedText);
  57517. }
  57518. }
  57519. buildCSSClass() {
  57520. return `vjs-control vjs-button ${super.buildCSSClass()}`;
  57521. }
  57522. enable() {
  57523. if (!this.enabled_) {
  57524. this.enabled_ = true;
  57525. this.removeClass("vjs-disabled");
  57526. this.el_.setAttribute("aria-disabled", "false");
  57527. if (typeof this.tabIndex_ !== "undefined") {
  57528. this.el_.setAttribute("tabIndex", this.tabIndex_);
  57529. }
  57530. this.on(["tap", "click"], this.handleClick_);
  57531. this.on("keydown", this.handleKeyDown_);
  57532. }
  57533. }
  57534. disable() {
  57535. this.enabled_ = false;
  57536. this.addClass("vjs-disabled");
  57537. this.el_.setAttribute("aria-disabled", "true");
  57538. if (typeof this.tabIndex_ !== "undefined") {
  57539. this.el_.removeAttribute("tabIndex");
  57540. }
  57541. this.off("mouseover", this.handleMouseOver_);
  57542. this.off("mouseout", this.handleMouseOut_);
  57543. this.off(["tap", "click"], this.handleClick_);
  57544. this.off("keydown", this.handleKeyDown_);
  57545. }
  57546. handleLanguagechange() {
  57547. this.controlText(this.controlText_);
  57548. }
  57549. handleClick(event2) {
  57550. if (this.options_.clickHandler) {
  57551. this.options_.clickHandler.call(this, arguments);
  57552. }
  57553. }
  57554. handleKeyDown(event2) {
  57555. if (keycode.isEventKey(event2, "Space") || keycode.isEventKey(event2, "Enter")) {
  57556. event2.preventDefault();
  57557. event2.stopPropagation();
  57558. this.trigger("click");
  57559. } else {
  57560. super.handleKeyDown(event2);
  57561. }
  57562. }
  57563. }
  57564. Component$1$1.registerComponent("ClickableComponent", ClickableComponent$1);
  57565. class PosterImage$1 extends ClickableComponent$1 {
  57566. constructor(player, options2) {
  57567. super(player, options2);
  57568. this.update();
  57569. this.update_ = (e) => this.update(e);
  57570. player.on("posterchange", this.update_);
  57571. }
  57572. dispose() {
  57573. this.player().off("posterchange", this.update_);
  57574. super.dispose();
  57575. }
  57576. createEl() {
  57577. return createEl$1("div", {
  57578. className: "vjs-poster"
  57579. });
  57580. }
  57581. crossOrigin(value) {
  57582. if (typeof value === "undefined") {
  57583. if (this.$("img")) {
  57584. return this.$("img").crossOrigin;
  57585. } else if (this.player_.tech_ && this.player_.tech_.isReady_) {
  57586. return this.player_.crossOrigin();
  57587. }
  57588. return this.player_.options_.crossOrigin || this.player_.options_.crossorigin || null;
  57589. }
  57590. if (value !== null && value !== "anonymous" && value !== "use-credentials") {
  57591. this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${value}"`);
  57592. return;
  57593. }
  57594. if (this.$("img")) {
  57595. this.$("img").crossOrigin = value;
  57596. }
  57597. return;
  57598. }
  57599. update(event2) {
  57600. const url = this.player().poster();
  57601. this.setSrc(url);
  57602. if (url) {
  57603. this.show();
  57604. } else {
  57605. this.hide();
  57606. }
  57607. }
  57608. setSrc(url) {
  57609. if (!url) {
  57610. this.el_.textContent = "";
  57611. return;
  57612. }
  57613. if (!this.$("img")) {
  57614. this.el_.appendChild(createEl$1("picture", {
  57615. className: "vjs-poster",
  57616. tabIndex: -1
  57617. }, {}, createEl$1("img", {
  57618. loading: "lazy",
  57619. crossOrigin: this.crossOrigin()
  57620. }, {
  57621. alt: ""
  57622. })));
  57623. }
  57624. this.$("img").src = url;
  57625. }
  57626. handleClick(event2) {
  57627. if (!this.player_.controls()) {
  57628. return;
  57629. }
  57630. if (this.player_.tech(true)) {
  57631. this.player_.tech(true).focus();
  57632. }
  57633. if (this.player_.paused()) {
  57634. silencePromise$1(this.player_.play());
  57635. } else {
  57636. this.player_.pause();
  57637. }
  57638. }
  57639. }
  57640. PosterImage$1.prototype.crossorigin = PosterImage$1.prototype.crossOrigin;
  57641. Component$1$1.registerComponent("PosterImage", PosterImage$1);
  57642. const darkGray$1 = "#222";
  57643. const lightGray$1 = "#ccc";
  57644. const fontMap$1 = {
  57645. monospace: "monospace",
  57646. sansSerif: "sans-serif",
  57647. serif: "serif",
  57648. monospaceSansSerif: '"Andale Mono", "Lucida Console", monospace',
  57649. monospaceSerif: '"Courier New", monospace',
  57650. proportionalSansSerif: "sans-serif",
  57651. proportionalSerif: "serif",
  57652. casual: '"Comic Sans MS", Impact, fantasy',
  57653. script: '"Monotype Corsiva", cursive',
  57654. smallcaps: '"Andale Mono", "Lucida Console", monospace, sans-serif'
  57655. };
  57656. function constructColor$1(color2, opacity) {
  57657. let hex;
  57658. if (color2.length === 4) {
  57659. hex = color2[1] + color2[1] + color2[2] + color2[2] + color2[3] + color2[3];
  57660. } else if (color2.length === 7) {
  57661. hex = color2.slice(1);
  57662. } else {
  57663. throw new Error("Invalid color code provided, " + color2 + "; must be formatted as e.g. #f0e or #f604e2.");
  57664. }
  57665. return "rgba(" + parseInt(hex.slice(0, 2), 16) + "," + parseInt(hex.slice(2, 4), 16) + "," + parseInt(hex.slice(4, 6), 16) + "," + opacity + ")";
  57666. }
  57667. function tryUpdateStyle$1(el, style, rule) {
  57668. try {
  57669. el.style[style] = rule;
  57670. } catch (e) {
  57671. return;
  57672. }
  57673. }
  57674. class TextTrackDisplay$1 extends Component$1$1 {
  57675. constructor(player, options2, ready) {
  57676. super(player, options2, ready);
  57677. const updateDisplayHandler = (e) => this.updateDisplay(e);
  57678. player.on("loadstart", (e) => this.toggleDisplay(e));
  57679. player.on("texttrackchange", updateDisplayHandler);
  57680. player.on("loadedmetadata", (e) => this.preselectTrack(e));
  57681. player.ready(bind_(this, function() {
  57682. if (player.tech_ && player.tech_.featuresNativeTextTracks) {
  57683. this.hide();
  57684. return;
  57685. }
  57686. player.on("fullscreenchange", updateDisplayHandler);
  57687. player.on("playerresize", updateDisplayHandler);
  57688. const screenOrientation = window_1.screen.orientation || window_1;
  57689. const changeOrientationEvent = window_1.screen.orientation ? "change" : "orientationchange";
  57690. screenOrientation.addEventListener(changeOrientationEvent, updateDisplayHandler);
  57691. player.on("dispose", () => screenOrientation.removeEventListener(changeOrientationEvent, updateDisplayHandler));
  57692. const tracks = this.options_.playerOptions.tracks || [];
  57693. for (let i2 = 0; i2 < tracks.length; i2++) {
  57694. this.player_.addRemoteTextTrack(tracks[i2], true);
  57695. }
  57696. this.preselectTrack();
  57697. }));
  57698. }
  57699. preselectTrack() {
  57700. const modes = {
  57701. captions: 1,
  57702. subtitles: 1
  57703. };
  57704. const trackList = this.player_.textTracks();
  57705. const userPref = this.player_.cache_.selectedLanguage;
  57706. let firstDesc;
  57707. let firstCaptions;
  57708. let preferredTrack;
  57709. for (let i2 = 0; i2 < trackList.length; i2++) {
  57710. const track = trackList[i2];
  57711. if (userPref && userPref.enabled && userPref.language && userPref.language === track.language && track.kind in modes) {
  57712. if (track.kind === userPref.kind) {
  57713. preferredTrack = track;
  57714. } else if (!preferredTrack) {
  57715. preferredTrack = track;
  57716. }
  57717. } else if (userPref && !userPref.enabled) {
  57718. preferredTrack = null;
  57719. firstDesc = null;
  57720. firstCaptions = null;
  57721. } else if (track.default) {
  57722. if (track.kind === "descriptions" && !firstDesc) {
  57723. firstDesc = track;
  57724. } else if (track.kind in modes && !firstCaptions) {
  57725. firstCaptions = track;
  57726. }
  57727. }
  57728. }
  57729. if (preferredTrack) {
  57730. preferredTrack.mode = "showing";
  57731. } else if (firstCaptions) {
  57732. firstCaptions.mode = "showing";
  57733. } else if (firstDesc) {
  57734. firstDesc.mode = "showing";
  57735. }
  57736. }
  57737. toggleDisplay() {
  57738. if (this.player_.tech_ && this.player_.tech_.featuresNativeTextTracks) {
  57739. this.hide();
  57740. } else {
  57741. this.show();
  57742. }
  57743. }
  57744. createEl() {
  57745. return super.createEl("div", {
  57746. className: "vjs-text-track-display"
  57747. }, {
  57748. "translate": "yes",
  57749. "aria-live": "off",
  57750. "aria-atomic": "true"
  57751. });
  57752. }
  57753. clearDisplay() {
  57754. if (typeof window_1.WebVTT === "function") {
  57755. window_1.WebVTT.processCues(window_1, [], this.el_);
  57756. }
  57757. }
  57758. updateDisplay() {
  57759. const tracks = this.player_.textTracks();
  57760. const allowMultipleShowingTracks = this.options_.allowMultipleShowingTracks;
  57761. this.clearDisplay();
  57762. if (allowMultipleShowingTracks) {
  57763. const showingTracks = [];
  57764. for (let i3 = 0; i3 < tracks.length; ++i3) {
  57765. const track = tracks[i3];
  57766. if (track.mode !== "showing") {
  57767. continue;
  57768. }
  57769. showingTracks.push(track);
  57770. }
  57771. this.updateForTrack(showingTracks);
  57772. return;
  57773. }
  57774. let descriptionsTrack = null;
  57775. let captionsSubtitlesTrack = null;
  57776. let i2 = tracks.length;
  57777. while (i2--) {
  57778. const track = tracks[i2];
  57779. if (track.mode === "showing") {
  57780. if (track.kind === "descriptions") {
  57781. descriptionsTrack = track;
  57782. } else {
  57783. captionsSubtitlesTrack = track;
  57784. }
  57785. }
  57786. }
  57787. if (captionsSubtitlesTrack) {
  57788. if (this.getAttribute("aria-live") !== "off") {
  57789. this.setAttribute("aria-live", "off");
  57790. }
  57791. this.updateForTrack(captionsSubtitlesTrack);
  57792. } else if (descriptionsTrack) {
  57793. if (this.getAttribute("aria-live") !== "assertive") {
  57794. this.setAttribute("aria-live", "assertive");
  57795. }
  57796. this.updateForTrack(descriptionsTrack);
  57797. }
  57798. }
  57799. updateDisplayState(track) {
  57800. const overrides = this.player_.textTrackSettings.getValues();
  57801. const cues = track.activeCues;
  57802. let i2 = cues.length;
  57803. while (i2--) {
  57804. const cue = cues[i2];
  57805. if (!cue) {
  57806. continue;
  57807. }
  57808. const cueDiv = cue.displayState;
  57809. if (overrides.color) {
  57810. cueDiv.firstChild.style.color = overrides.color;
  57811. }
  57812. if (overrides.textOpacity) {
  57813. tryUpdateStyle$1(cueDiv.firstChild, "color", constructColor$1(overrides.color || "#fff", overrides.textOpacity));
  57814. }
  57815. if (overrides.backgroundColor) {
  57816. cueDiv.firstChild.style.backgroundColor = overrides.backgroundColor;
  57817. }
  57818. if (overrides.backgroundOpacity) {
  57819. tryUpdateStyle$1(cueDiv.firstChild, "backgroundColor", constructColor$1(overrides.backgroundColor || "#000", overrides.backgroundOpacity));
  57820. }
  57821. if (overrides.windowColor) {
  57822. if (overrides.windowOpacity) {
  57823. tryUpdateStyle$1(cueDiv, "backgroundColor", constructColor$1(overrides.windowColor, overrides.windowOpacity));
  57824. } else {
  57825. cueDiv.style.backgroundColor = overrides.windowColor;
  57826. }
  57827. }
  57828. if (overrides.edgeStyle) {
  57829. if (overrides.edgeStyle === "dropshadow") {
  57830. cueDiv.firstChild.style.textShadow = `2px 2px 3px ${darkGray$1}, 2px 2px 4px ${darkGray$1}, 2px 2px 5px ${darkGray$1}`;
  57831. } else if (overrides.edgeStyle === "raised") {
  57832. cueDiv.firstChild.style.textShadow = `1px 1px ${darkGray$1}, 2px 2px ${darkGray$1}, 3px 3px ${darkGray$1}`;
  57833. } else if (overrides.edgeStyle === "depressed") {
  57834. cueDiv.firstChild.style.textShadow = `1px 1px ${lightGray$1}, 0 1px ${lightGray$1}, -1px -1px ${darkGray$1}, 0 -1px ${darkGray$1}`;
  57835. } else if (overrides.edgeStyle === "uniform") {
  57836. cueDiv.firstChild.style.textShadow = `0 0 4px ${darkGray$1}, 0 0 4px ${darkGray$1}, 0 0 4px ${darkGray$1}, 0 0 4px ${darkGray$1}`;
  57837. }
  57838. }
  57839. if (overrides.fontPercent && overrides.fontPercent !== 1) {
  57840. const fontSize = window_1.parseFloat(cueDiv.style.fontSize);
  57841. cueDiv.style.fontSize = fontSize * overrides.fontPercent + "px";
  57842. cueDiv.style.height = "auto";
  57843. cueDiv.style.top = "auto";
  57844. }
  57845. if (overrides.fontFamily && overrides.fontFamily !== "default") {
  57846. if (overrides.fontFamily === "small-caps") {
  57847. cueDiv.firstChild.style.fontVariant = "small-caps";
  57848. } else {
  57849. cueDiv.firstChild.style.fontFamily = fontMap$1[overrides.fontFamily];
  57850. }
  57851. }
  57852. }
  57853. }
  57854. updateForTrack(tracks) {
  57855. if (!Array.isArray(tracks)) {
  57856. tracks = [tracks];
  57857. }
  57858. if (typeof window_1.WebVTT !== "function" || tracks.every((track) => {
  57859. return !track.activeCues;
  57860. })) {
  57861. return;
  57862. }
  57863. const cues = [];
  57864. for (let i2 = 0; i2 < tracks.length; ++i2) {
  57865. const track = tracks[i2];
  57866. for (let j = 0; j < track.activeCues.length; ++j) {
  57867. cues.push(track.activeCues[j]);
  57868. }
  57869. }
  57870. window_1.WebVTT.processCues(window_1, cues, this.el_);
  57871. for (let i2 = 0; i2 < tracks.length; ++i2) {
  57872. const track = tracks[i2];
  57873. for (let j = 0; j < track.activeCues.length; ++j) {
  57874. const cueEl = track.activeCues[j].displayState;
  57875. addClass$1(cueEl, "vjs-text-track-cue", "vjs-text-track-cue-" + (track.language ? track.language : i2));
  57876. if (track.language) {
  57877. setAttribute$1(cueEl, "lang", track.language);
  57878. }
  57879. }
  57880. if (this.player_.textTrackSettings) {
  57881. this.updateDisplayState(track);
  57882. }
  57883. }
  57884. }
  57885. }
  57886. Component$1$1.registerComponent("TextTrackDisplay", TextTrackDisplay$1);
  57887. class LoadingSpinner$1 extends Component$1$1 {
  57888. createEl() {
  57889. const isAudio = this.player_.isAudio();
  57890. const playerType = this.localize(isAudio ? "Audio Player" : "Video Player");
  57891. const controlText = createEl$1("span", {
  57892. className: "vjs-control-text",
  57893. textContent: this.localize("{1} is loading.", [playerType])
  57894. });
  57895. const el = super.createEl("div", {
  57896. className: "vjs-loading-spinner",
  57897. dir: "ltr"
  57898. });
  57899. el.appendChild(controlText);
  57900. return el;
  57901. }
  57902. handleLanguagechange() {
  57903. this.$(".vjs-control-text").textContent = this.localize("{1} is loading.", [this.player_.isAudio() ? "Audio Player" : "Video Player"]);
  57904. }
  57905. }
  57906. Component$1$1.registerComponent("LoadingSpinner", LoadingSpinner$1);
  57907. class Button$1 extends ClickableComponent$1 {
  57908. createEl(tag, props = {}, attributes = {}) {
  57909. tag = "button";
  57910. props = Object.assign({
  57911. className: this.buildCSSClass()
  57912. }, props);
  57913. attributes = Object.assign({
  57914. type: "button"
  57915. }, attributes);
  57916. const el = createEl$1(tag, props, attributes);
  57917. el.appendChild(createEl$1("span", {
  57918. className: "vjs-icon-placeholder"
  57919. }, {
  57920. "aria-hidden": true
  57921. }));
  57922. this.createControlTextEl(el);
  57923. return el;
  57924. }
  57925. addChild(child, options2 = {}) {
  57926. const className = this.constructor.name;
  57927. log$1$1.warn(`Adding an actionable (user controllable) child to a Button (${className}) is not supported; use a ClickableComponent instead.`);
  57928. return Component$1$1.prototype.addChild.call(this, child, options2);
  57929. }
  57930. enable() {
  57931. super.enable();
  57932. this.el_.removeAttribute("disabled");
  57933. }
  57934. disable() {
  57935. super.disable();
  57936. this.el_.setAttribute("disabled", "disabled");
  57937. }
  57938. handleKeyDown(event2) {
  57939. if (keycode.isEventKey(event2, "Space") || keycode.isEventKey(event2, "Enter")) {
  57940. event2.stopPropagation();
  57941. return;
  57942. }
  57943. super.handleKeyDown(event2);
  57944. }
  57945. }
  57946. Component$1$1.registerComponent("Button", Button$1);
  57947. class BigPlayButton$1 extends Button$1 {
  57948. constructor(player, options2) {
  57949. super(player, options2);
  57950. this.mouseused_ = false;
  57951. this.on("mousedown", (e) => this.handleMouseDown(e));
  57952. }
  57953. buildCSSClass() {
  57954. return "vjs-big-play-button";
  57955. }
  57956. handleClick(event2) {
  57957. const playPromise = this.player_.play();
  57958. if (this.mouseused_ && event2.clientX && event2.clientY) {
  57959. silencePromise$1(playPromise);
  57960. if (this.player_.tech(true)) {
  57961. this.player_.tech(true).focus();
  57962. }
  57963. return;
  57964. }
  57965. const cb = this.player_.getChild("controlBar");
  57966. const playToggle = cb && cb.getChild("playToggle");
  57967. if (!playToggle) {
  57968. this.player_.tech(true).focus();
  57969. return;
  57970. }
  57971. const playFocus = () => playToggle.focus();
  57972. if (isPromise$1(playPromise)) {
  57973. playPromise.then(playFocus, () => {
  57974. });
  57975. } else {
  57976. this.setTimeout(playFocus, 1);
  57977. }
  57978. }
  57979. handleKeyDown(event2) {
  57980. this.mouseused_ = false;
  57981. super.handleKeyDown(event2);
  57982. }
  57983. handleMouseDown(event2) {
  57984. this.mouseused_ = true;
  57985. }
  57986. }
  57987. BigPlayButton$1.prototype.controlText_ = "Play Video";
  57988. Component$1$1.registerComponent("BigPlayButton", BigPlayButton$1);
  57989. class CloseButton$1 extends Button$1 {
  57990. constructor(player, options2) {
  57991. super(player, options2);
  57992. this.controlText(options2 && options2.controlText || this.localize("Close"));
  57993. }
  57994. buildCSSClass() {
  57995. return `vjs-close-button ${super.buildCSSClass()}`;
  57996. }
  57997. handleClick(event2) {
  57998. this.trigger({
  57999. type: "close",
  58000. bubbles: false
  58001. });
  58002. }
  58003. handleKeyDown(event2) {
  58004. if (keycode.isEventKey(event2, "Esc")) {
  58005. event2.preventDefault();
  58006. event2.stopPropagation();
  58007. this.trigger("click");
  58008. } else {
  58009. super.handleKeyDown(event2);
  58010. }
  58011. }
  58012. }
  58013. Component$1$1.registerComponent("CloseButton", CloseButton$1);
  58014. class PlayToggle$1 extends Button$1 {
  58015. constructor(player, options2 = {}) {
  58016. super(player, options2);
  58017. options2.replay = options2.replay === void 0 || options2.replay;
  58018. this.on(player, "play", (e) => this.handlePlay(e));
  58019. this.on(player, "pause", (e) => this.handlePause(e));
  58020. if (options2.replay) {
  58021. this.on(player, "ended", (e) => this.handleEnded(e));
  58022. }
  58023. }
  58024. buildCSSClass() {
  58025. return `vjs-play-control ${super.buildCSSClass()}`;
  58026. }
  58027. handleClick(event2) {
  58028. if (this.player_.paused()) {
  58029. silencePromise$1(this.player_.play());
  58030. } else {
  58031. this.player_.pause();
  58032. }
  58033. }
  58034. handleSeeked(event2) {
  58035. this.removeClass("vjs-ended");
  58036. if (this.player_.paused()) {
  58037. this.handlePause(event2);
  58038. } else {
  58039. this.handlePlay(event2);
  58040. }
  58041. }
  58042. handlePlay(event2) {
  58043. this.removeClass("vjs-ended", "vjs-paused");
  58044. this.addClass("vjs-playing");
  58045. this.controlText("Pause");
  58046. }
  58047. handlePause(event2) {
  58048. this.removeClass("vjs-playing");
  58049. this.addClass("vjs-paused");
  58050. this.controlText("Play");
  58051. }
  58052. handleEnded(event2) {
  58053. this.removeClass("vjs-playing");
  58054. this.addClass("vjs-ended");
  58055. this.controlText("Replay");
  58056. this.one(this.player_, "seeked", (e) => this.handleSeeked(e));
  58057. }
  58058. }
  58059. PlayToggle$1.prototype.controlText_ = "Play";
  58060. Component$1$1.registerComponent("PlayToggle", PlayToggle$1);
  58061. class TimeDisplay$1 extends Component$1$1 {
  58062. constructor(player, options2) {
  58063. super(player, options2);
  58064. this.on(player, ["timeupdate", "ended"], (e) => this.updateContent(e));
  58065. this.updateTextNode_();
  58066. }
  58067. createEl() {
  58068. const className = this.buildCSSClass();
  58069. const el = super.createEl("div", {
  58070. className: `${className} vjs-time-control vjs-control`
  58071. });
  58072. const span = createEl$1("span", {
  58073. className: "vjs-control-text",
  58074. textContent: `${this.localize(this.labelText_)}\xA0`
  58075. }, {
  58076. role: "presentation"
  58077. });
  58078. el.appendChild(span);
  58079. this.contentEl_ = createEl$1("span", {
  58080. className: `${className}-display`
  58081. }, {
  58082. role: "presentation"
  58083. });
  58084. el.appendChild(this.contentEl_);
  58085. return el;
  58086. }
  58087. dispose() {
  58088. this.contentEl_ = null;
  58089. this.textNode_ = null;
  58090. super.dispose();
  58091. }
  58092. updateTextNode_(time = 0) {
  58093. time = formatTime$1(time);
  58094. if (this.formattedTime_ === time) {
  58095. return;
  58096. }
  58097. this.formattedTime_ = time;
  58098. this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_", () => {
  58099. if (!this.contentEl_) {
  58100. return;
  58101. }
  58102. let oldNode = this.textNode_;
  58103. if (oldNode && this.contentEl_.firstChild !== oldNode) {
  58104. oldNode = null;
  58105. log$1$1.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.");
  58106. }
  58107. this.textNode_ = document_1.createTextNode(this.formattedTime_);
  58108. if (!this.textNode_) {
  58109. return;
  58110. }
  58111. if (oldNode) {
  58112. this.contentEl_.replaceChild(this.textNode_, oldNode);
  58113. } else {
  58114. this.contentEl_.appendChild(this.textNode_);
  58115. }
  58116. });
  58117. }
  58118. updateContent(event2) {
  58119. }
  58120. }
  58121. TimeDisplay$1.prototype.labelText_ = "Time";
  58122. TimeDisplay$1.prototype.controlText_ = "Time";
  58123. Component$1$1.registerComponent("TimeDisplay", TimeDisplay$1);
  58124. class CurrentTimeDisplay$1 extends TimeDisplay$1 {
  58125. buildCSSClass() {
  58126. return "vjs-current-time";
  58127. }
  58128. updateContent(event2) {
  58129. let time;
  58130. if (this.player_.ended()) {
  58131. time = this.player_.duration();
  58132. } else {
  58133. time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
  58134. }
  58135. this.updateTextNode_(time);
  58136. }
  58137. }
  58138. CurrentTimeDisplay$1.prototype.labelText_ = "Current Time";
  58139. CurrentTimeDisplay$1.prototype.controlText_ = "Current Time";
  58140. Component$1$1.registerComponent("CurrentTimeDisplay", CurrentTimeDisplay$1);
  58141. class DurationDisplay$1 extends TimeDisplay$1 {
  58142. constructor(player, options2) {
  58143. super(player, options2);
  58144. const updateContent = (e) => this.updateContent(e);
  58145. this.on(player, "durationchange", updateContent);
  58146. this.on(player, "loadstart", updateContent);
  58147. this.on(player, "loadedmetadata", updateContent);
  58148. }
  58149. buildCSSClass() {
  58150. return "vjs-duration";
  58151. }
  58152. updateContent(event2) {
  58153. const duration5 = this.player_.duration();
  58154. this.updateTextNode_(duration5);
  58155. }
  58156. }
  58157. DurationDisplay$1.prototype.labelText_ = "Duration";
  58158. DurationDisplay$1.prototype.controlText_ = "Duration";
  58159. Component$1$1.registerComponent("DurationDisplay", DurationDisplay$1);
  58160. class TimeDivider$1 extends Component$1$1 {
  58161. createEl() {
  58162. const el = super.createEl("div", {
  58163. className: "vjs-time-control vjs-time-divider"
  58164. }, {
  58165. "aria-hidden": true
  58166. });
  58167. const div = super.createEl("div");
  58168. const span = super.createEl("span", {
  58169. textContent: "/"
  58170. });
  58171. div.appendChild(span);
  58172. el.appendChild(div);
  58173. return el;
  58174. }
  58175. }
  58176. Component$1$1.registerComponent("TimeDivider", TimeDivider$1);
  58177. class RemainingTimeDisplay$1 extends TimeDisplay$1 {
  58178. constructor(player, options2) {
  58179. super(player, options2);
  58180. this.on(player, "durationchange", (e) => this.updateContent(e));
  58181. }
  58182. buildCSSClass() {
  58183. return "vjs-remaining-time";
  58184. }
  58185. createEl() {
  58186. const el = super.createEl();
  58187. if (this.options_.displayNegative !== false) {
  58188. el.insertBefore(createEl$1("span", {}, {
  58189. "aria-hidden": true
  58190. }, "-"), this.contentEl_);
  58191. }
  58192. return el;
  58193. }
  58194. updateContent(event2) {
  58195. if (typeof this.player_.duration() !== "number") {
  58196. return;
  58197. }
  58198. let time;
  58199. if (this.player_.ended()) {
  58200. time = 0;
  58201. } else if (this.player_.remainingTimeDisplay) {
  58202. time = this.player_.remainingTimeDisplay();
  58203. } else {
  58204. time = this.player_.remainingTime();
  58205. }
  58206. this.updateTextNode_(time);
  58207. }
  58208. }
  58209. RemainingTimeDisplay$1.prototype.labelText_ = "Remaining Time";
  58210. RemainingTimeDisplay$1.prototype.controlText_ = "Remaining Time";
  58211. Component$1$1.registerComponent("RemainingTimeDisplay", RemainingTimeDisplay$1);
  58212. class LiveDisplay$1 extends Component$1$1 {
  58213. constructor(player, options2) {
  58214. super(player, options2);
  58215. this.updateShowing();
  58216. this.on(this.player(), "durationchange", (e) => this.updateShowing(e));
  58217. }
  58218. createEl() {
  58219. const el = super.createEl("div", {
  58220. className: "vjs-live-control vjs-control"
  58221. });
  58222. this.contentEl_ = createEl$1("div", {
  58223. className: "vjs-live-display"
  58224. }, {
  58225. "aria-live": "off"
  58226. });
  58227. this.contentEl_.appendChild(createEl$1("span", {
  58228. className: "vjs-control-text",
  58229. textContent: `${this.localize("Stream Type")}\xA0`
  58230. }));
  58231. this.contentEl_.appendChild(document_1.createTextNode(this.localize("LIVE")));
  58232. el.appendChild(this.contentEl_);
  58233. return el;
  58234. }
  58235. dispose() {
  58236. this.contentEl_ = null;
  58237. super.dispose();
  58238. }
  58239. updateShowing(event2) {
  58240. if (this.player().duration() === Infinity) {
  58241. this.show();
  58242. } else {
  58243. this.hide();
  58244. }
  58245. }
  58246. }
  58247. Component$1$1.registerComponent("LiveDisplay", LiveDisplay$1);
  58248. class SeekToLive$1 extends Button$1 {
  58249. constructor(player, options2) {
  58250. super(player, options2);
  58251. this.updateLiveEdgeStatus();
  58252. if (this.player_.liveTracker) {
  58253. this.updateLiveEdgeStatusHandler_ = (e) => this.updateLiveEdgeStatus(e);
  58254. this.on(this.player_.liveTracker, "liveedgechange", this.updateLiveEdgeStatusHandler_);
  58255. }
  58256. }
  58257. createEl() {
  58258. const el = super.createEl("button", {
  58259. className: "vjs-seek-to-live-control vjs-control"
  58260. });
  58261. this.textEl_ = createEl$1("span", {
  58262. className: "vjs-seek-to-live-text",
  58263. textContent: this.localize("LIVE")
  58264. }, {
  58265. "aria-hidden": "true"
  58266. });
  58267. el.appendChild(this.textEl_);
  58268. return el;
  58269. }
  58270. updateLiveEdgeStatus() {
  58271. if (!this.player_.liveTracker || this.player_.liveTracker.atLiveEdge()) {
  58272. this.setAttribute("aria-disabled", true);
  58273. this.addClass("vjs-at-live-edge");
  58274. this.controlText("Seek to live, currently playing live");
  58275. } else {
  58276. this.setAttribute("aria-disabled", false);
  58277. this.removeClass("vjs-at-live-edge");
  58278. this.controlText("Seek to live, currently behind live");
  58279. }
  58280. }
  58281. handleClick() {
  58282. this.player_.liveTracker.seekToLiveEdge();
  58283. }
  58284. dispose() {
  58285. if (this.player_.liveTracker) {
  58286. this.off(this.player_.liveTracker, "liveedgechange", this.updateLiveEdgeStatusHandler_);
  58287. }
  58288. this.textEl_ = null;
  58289. super.dispose();
  58290. }
  58291. }
  58292. SeekToLive$1.prototype.controlText_ = "Seek to live, currently playing live";
  58293. Component$1$1.registerComponent("SeekToLive", SeekToLive$1);
  58294. function clamp$1(number, min2, max2) {
  58295. number = Number(number);
  58296. return Math.min(max2, Math.max(min2, isNaN(number) ? min2 : number));
  58297. }
  58298. var Num = /* @__PURE__ */ Object.freeze({
  58299. __proto__: null,
  58300. clamp: clamp$1
  58301. });
  58302. class Slider$1 extends Component$1$1 {
  58303. constructor(player, options2) {
  58304. super(player, options2);
  58305. this.handleMouseDown_ = (e) => this.handleMouseDown(e);
  58306. this.handleMouseUp_ = (e) => this.handleMouseUp(e);
  58307. this.handleKeyDown_ = (e) => this.handleKeyDown(e);
  58308. this.handleClick_ = (e) => this.handleClick(e);
  58309. this.handleMouseMove_ = (e) => this.handleMouseMove(e);
  58310. this.update_ = (e) => this.update(e);
  58311. this.bar = this.getChild(this.options_.barName);
  58312. this.vertical(!!this.options_.vertical);
  58313. this.enable();
  58314. }
  58315. enabled() {
  58316. return this.enabled_;
  58317. }
  58318. enable() {
  58319. if (this.enabled()) {
  58320. return;
  58321. }
  58322. this.on("mousedown", this.handleMouseDown_);
  58323. this.on("touchstart", this.handleMouseDown_);
  58324. this.on("keydown", this.handleKeyDown_);
  58325. this.on("click", this.handleClick_);
  58326. this.on(this.player_, "controlsvisible", this.update);
  58327. if (this.playerEvent) {
  58328. this.on(this.player_, this.playerEvent, this.update);
  58329. }
  58330. this.removeClass("disabled");
  58331. this.setAttribute("tabindex", 0);
  58332. this.enabled_ = true;
  58333. }
  58334. disable() {
  58335. if (!this.enabled()) {
  58336. return;
  58337. }
  58338. const doc = this.bar.el_.ownerDocument;
  58339. this.off("mousedown", this.handleMouseDown_);
  58340. this.off("touchstart", this.handleMouseDown_);
  58341. this.off("keydown", this.handleKeyDown_);
  58342. this.off("click", this.handleClick_);
  58343. this.off(this.player_, "controlsvisible", this.update_);
  58344. this.off(doc, "mousemove", this.handleMouseMove_);
  58345. this.off(doc, "mouseup", this.handleMouseUp_);
  58346. this.off(doc, "touchmove", this.handleMouseMove_);
  58347. this.off(doc, "touchend", this.handleMouseUp_);
  58348. this.removeAttribute("tabindex");
  58349. this.addClass("disabled");
  58350. if (this.playerEvent) {
  58351. this.off(this.player_, this.playerEvent, this.update);
  58352. }
  58353. this.enabled_ = false;
  58354. }
  58355. createEl(type2, props = {}, attributes = {}) {
  58356. props.className = props.className + " vjs-slider";
  58357. props = Object.assign({
  58358. tabIndex: 0
  58359. }, props);
  58360. attributes = Object.assign({
  58361. "role": "slider",
  58362. "aria-valuenow": 0,
  58363. "aria-valuemin": 0,
  58364. "aria-valuemax": 100
  58365. }, attributes);
  58366. return super.createEl(type2, props, attributes);
  58367. }
  58368. handleMouseDown(event2) {
  58369. const doc = this.bar.el_.ownerDocument;
  58370. if (event2.type === "mousedown") {
  58371. event2.preventDefault();
  58372. }
  58373. if (event2.type === "touchstart" && !IS_CHROME$1) {
  58374. event2.preventDefault();
  58375. }
  58376. blockTextSelection$1();
  58377. this.addClass("vjs-sliding");
  58378. this.trigger("slideractive");
  58379. this.on(doc, "mousemove", this.handleMouseMove_);
  58380. this.on(doc, "mouseup", this.handleMouseUp_);
  58381. this.on(doc, "touchmove", this.handleMouseMove_);
  58382. this.on(doc, "touchend", this.handleMouseUp_);
  58383. this.handleMouseMove(event2, true);
  58384. }
  58385. handleMouseMove(event2) {
  58386. }
  58387. handleMouseUp(event2) {
  58388. const doc = this.bar.el_.ownerDocument;
  58389. unblockTextSelection$1();
  58390. this.removeClass("vjs-sliding");
  58391. this.trigger("sliderinactive");
  58392. this.off(doc, "mousemove", this.handleMouseMove_);
  58393. this.off(doc, "mouseup", this.handleMouseUp_);
  58394. this.off(doc, "touchmove", this.handleMouseMove_);
  58395. this.off(doc, "touchend", this.handleMouseUp_);
  58396. this.update();
  58397. }
  58398. update() {
  58399. if (!this.el_ || !this.bar) {
  58400. return;
  58401. }
  58402. const progress = this.getProgress();
  58403. if (progress === this.progress_) {
  58404. return progress;
  58405. }
  58406. this.progress_ = progress;
  58407. this.requestNamedAnimationFrame("Slider#update", () => {
  58408. const sizeKey = this.vertical() ? "height" : "width";
  58409. this.bar.el().style[sizeKey] = (progress * 100).toFixed(2) + "%";
  58410. });
  58411. return progress;
  58412. }
  58413. getProgress() {
  58414. return Number(clamp$1(this.getPercent(), 0, 1).toFixed(4));
  58415. }
  58416. calculateDistance(event2) {
  58417. const position2 = getPointerPosition$1(this.el_, event2);
  58418. if (this.vertical()) {
  58419. return position2.y;
  58420. }
  58421. return position2.x;
  58422. }
  58423. handleKeyDown(event2) {
  58424. if (keycode.isEventKey(event2, "Left") || keycode.isEventKey(event2, "Down")) {
  58425. event2.preventDefault();
  58426. event2.stopPropagation();
  58427. this.stepBack();
  58428. } else if (keycode.isEventKey(event2, "Right") || keycode.isEventKey(event2, "Up")) {
  58429. event2.preventDefault();
  58430. event2.stopPropagation();
  58431. this.stepForward();
  58432. } else {
  58433. super.handleKeyDown(event2);
  58434. }
  58435. }
  58436. handleClick(event2) {
  58437. event2.stopPropagation();
  58438. event2.preventDefault();
  58439. }
  58440. vertical(bool) {
  58441. if (bool === void 0) {
  58442. return this.vertical_ || false;
  58443. }
  58444. this.vertical_ = !!bool;
  58445. if (this.vertical_) {
  58446. this.addClass("vjs-slider-vertical");
  58447. } else {
  58448. this.addClass("vjs-slider-horizontal");
  58449. }
  58450. }
  58451. }
  58452. Component$1$1.registerComponent("Slider", Slider$1);
  58453. const percentify$1 = (time, end) => clamp$1(time / end * 100, 0, 100).toFixed(2) + "%";
  58454. class LoadProgressBar$1 extends Component$1$1 {
  58455. constructor(player, options2) {
  58456. super(player, options2);
  58457. this.partEls_ = [];
  58458. this.on(player, "progress", (e) => this.update(e));
  58459. }
  58460. createEl() {
  58461. const el = super.createEl("div", {
  58462. className: "vjs-load-progress"
  58463. });
  58464. const wrapper = createEl$1("span", {
  58465. className: "vjs-control-text"
  58466. });
  58467. const loadedText = createEl$1("span", {
  58468. textContent: this.localize("Loaded")
  58469. });
  58470. const separator = document_1.createTextNode(": ");
  58471. this.percentageEl_ = createEl$1("span", {
  58472. className: "vjs-control-text-loaded-percentage",
  58473. textContent: "0%"
  58474. });
  58475. el.appendChild(wrapper);
  58476. wrapper.appendChild(loadedText);
  58477. wrapper.appendChild(separator);
  58478. wrapper.appendChild(this.percentageEl_);
  58479. return el;
  58480. }
  58481. dispose() {
  58482. this.partEls_ = null;
  58483. this.percentageEl_ = null;
  58484. super.dispose();
  58485. }
  58486. update(event2) {
  58487. this.requestNamedAnimationFrame("LoadProgressBar#update", () => {
  58488. const liveTracker = this.player_.liveTracker;
  58489. const buffered = this.player_.buffered();
  58490. const duration5 = liveTracker && liveTracker.isLive() ? liveTracker.seekableEnd() : this.player_.duration();
  58491. const bufferedEnd = this.player_.bufferedEnd();
  58492. const children = this.partEls_;
  58493. const percent = percentify$1(bufferedEnd, duration5);
  58494. if (this.percent_ !== percent) {
  58495. this.el_.style.width = percent;
  58496. textContent$1(this.percentageEl_, percent);
  58497. this.percent_ = percent;
  58498. }
  58499. for (let i2 = 0; i2 < buffered.length; i2++) {
  58500. const start2 = buffered.start(i2);
  58501. const end = buffered.end(i2);
  58502. let part = children[i2];
  58503. if (!part) {
  58504. part = this.el_.appendChild(createEl$1());
  58505. children[i2] = part;
  58506. }
  58507. if (part.dataset.start === start2 && part.dataset.end === end) {
  58508. continue;
  58509. }
  58510. part.dataset.start = start2;
  58511. part.dataset.end = end;
  58512. part.style.left = percentify$1(start2, bufferedEnd);
  58513. part.style.width = percentify$1(end - start2, bufferedEnd);
  58514. }
  58515. for (let i2 = children.length; i2 > buffered.length; i2--) {
  58516. this.el_.removeChild(children[i2 - 1]);
  58517. }
  58518. children.length = buffered.length;
  58519. });
  58520. }
  58521. }
  58522. Component$1$1.registerComponent("LoadProgressBar", LoadProgressBar$1);
  58523. class TimeTooltip$1 extends Component$1$1 {
  58524. constructor(player, options2) {
  58525. super(player, options2);
  58526. this.update = throttle$1(bind_(this, this.update), UPDATE_REFRESH_INTERVAL$1);
  58527. }
  58528. createEl() {
  58529. return super.createEl("div", {
  58530. className: "vjs-time-tooltip"
  58531. }, {
  58532. "aria-hidden": "true"
  58533. });
  58534. }
  58535. update(seekBarRect, seekBarPoint, content) {
  58536. const tooltipRect = findPosition$1(this.el_);
  58537. const playerRect = getBoundingClientRect$1(this.player_.el());
  58538. const seekBarPointPx = seekBarRect.width * seekBarPoint;
  58539. if (!playerRect || !tooltipRect) {
  58540. return;
  58541. }
  58542. const spaceLeftOfPoint = seekBarRect.left - playerRect.left + seekBarPointPx;
  58543. const spaceRightOfPoint = seekBarRect.width - seekBarPointPx + (playerRect.right - seekBarRect.right);
  58544. let pullTooltipBy = tooltipRect.width / 2;
  58545. if (spaceLeftOfPoint < pullTooltipBy) {
  58546. pullTooltipBy += pullTooltipBy - spaceLeftOfPoint;
  58547. } else if (spaceRightOfPoint < pullTooltipBy) {
  58548. pullTooltipBy = spaceRightOfPoint;
  58549. }
  58550. if (pullTooltipBy < 0) {
  58551. pullTooltipBy = 0;
  58552. } else if (pullTooltipBy > tooltipRect.width) {
  58553. pullTooltipBy = tooltipRect.width;
  58554. }
  58555. pullTooltipBy = Math.round(pullTooltipBy);
  58556. this.el_.style.right = `-${pullTooltipBy}px`;
  58557. this.write(content);
  58558. }
  58559. write(content) {
  58560. textContent$1(this.el_, content);
  58561. }
  58562. updateTime(seekBarRect, seekBarPoint, time, cb) {
  58563. this.requestNamedAnimationFrame("TimeTooltip#updateTime", () => {
  58564. let content;
  58565. const duration5 = this.player_.duration();
  58566. if (this.player_.liveTracker && this.player_.liveTracker.isLive()) {
  58567. const liveWindow = this.player_.liveTracker.liveWindow();
  58568. const secondsBehind = liveWindow - seekBarPoint * liveWindow;
  58569. content = (secondsBehind < 1 ? "" : "-") + formatTime$1(secondsBehind, liveWindow);
  58570. } else {
  58571. content = formatTime$1(time, duration5);
  58572. }
  58573. this.update(seekBarRect, seekBarPoint, content);
  58574. if (cb) {
  58575. cb();
  58576. }
  58577. });
  58578. }
  58579. }
  58580. Component$1$1.registerComponent("TimeTooltip", TimeTooltip$1);
  58581. class PlayProgressBar$1 extends Component$1$1 {
  58582. constructor(player, options2) {
  58583. super(player, options2);
  58584. this.update = throttle$1(bind_(this, this.update), UPDATE_REFRESH_INTERVAL$1);
  58585. }
  58586. createEl() {
  58587. return super.createEl("div", {
  58588. className: "vjs-play-progress vjs-slider-bar"
  58589. }, {
  58590. "aria-hidden": "true"
  58591. });
  58592. }
  58593. update(seekBarRect, seekBarPoint) {
  58594. const timeTooltip = this.getChild("timeTooltip");
  58595. if (!timeTooltip) {
  58596. return;
  58597. }
  58598. const time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
  58599. timeTooltip.updateTime(seekBarRect, seekBarPoint, time);
  58600. }
  58601. }
  58602. PlayProgressBar$1.prototype.options_ = {
  58603. children: []
  58604. };
  58605. if (!IS_IOS$1 && !IS_ANDROID$1) {
  58606. PlayProgressBar$1.prototype.options_.children.push("timeTooltip");
  58607. }
  58608. Component$1$1.registerComponent("PlayProgressBar", PlayProgressBar$1);
  58609. class MouseTimeDisplay$1 extends Component$1$1 {
  58610. constructor(player, options2) {
  58611. super(player, options2);
  58612. this.update = throttle$1(bind_(this, this.update), UPDATE_REFRESH_INTERVAL$1);
  58613. }
  58614. createEl() {
  58615. return super.createEl("div", {
  58616. className: "vjs-mouse-display"
  58617. });
  58618. }
  58619. update(seekBarRect, seekBarPoint) {
  58620. const time = seekBarPoint * this.player_.duration();
  58621. this.getChild("timeTooltip").updateTime(seekBarRect, seekBarPoint, time, () => {
  58622. this.el_.style.left = `${seekBarRect.width * seekBarPoint}px`;
  58623. });
  58624. }
  58625. }
  58626. MouseTimeDisplay$1.prototype.options_ = {
  58627. children: ["timeTooltip"]
  58628. };
  58629. Component$1$1.registerComponent("MouseTimeDisplay", MouseTimeDisplay$1);
  58630. const STEP_SECONDS$1 = 5;
  58631. const PAGE_KEY_MULTIPLIER$1 = 12;
  58632. class SeekBar$1 extends Slider$1 {
  58633. constructor(player, options2) {
  58634. super(player, options2);
  58635. this.setEventHandlers_();
  58636. }
  58637. setEventHandlers_() {
  58638. this.update_ = bind_(this, this.update);
  58639. this.update = throttle$1(this.update_, UPDATE_REFRESH_INTERVAL$1);
  58640. this.on(this.player_, ["ended", "durationchange", "timeupdate"], this.update);
  58641. if (this.player_.liveTracker) {
  58642. this.on(this.player_.liveTracker, "liveedgechange", this.update);
  58643. }
  58644. this.updateInterval = null;
  58645. this.enableIntervalHandler_ = (e) => this.enableInterval_(e);
  58646. this.disableIntervalHandler_ = (e) => this.disableInterval_(e);
  58647. this.on(this.player_, ["playing"], this.enableIntervalHandler_);
  58648. this.on(this.player_, ["ended", "pause", "waiting"], this.disableIntervalHandler_);
  58649. if ("hidden" in document_1 && "visibilityState" in document_1) {
  58650. this.on(document_1, "visibilitychange", this.toggleVisibility_);
  58651. }
  58652. }
  58653. toggleVisibility_(e) {
  58654. if (document_1.visibilityState === "hidden") {
  58655. this.cancelNamedAnimationFrame("SeekBar#update");
  58656. this.cancelNamedAnimationFrame("Slider#update");
  58657. this.disableInterval_(e);
  58658. } else {
  58659. if (!this.player_.ended() && !this.player_.paused()) {
  58660. this.enableInterval_();
  58661. }
  58662. this.update();
  58663. }
  58664. }
  58665. enableInterval_() {
  58666. if (this.updateInterval) {
  58667. return;
  58668. }
  58669. this.updateInterval = this.setInterval(this.update, UPDATE_REFRESH_INTERVAL$1);
  58670. }
  58671. disableInterval_(e) {
  58672. if (this.player_.liveTracker && this.player_.liveTracker.isLive() && e && e.type !== "ended") {
  58673. return;
  58674. }
  58675. if (!this.updateInterval) {
  58676. return;
  58677. }
  58678. this.clearInterval(this.updateInterval);
  58679. this.updateInterval = null;
  58680. }
  58681. createEl() {
  58682. return super.createEl("div", {
  58683. className: "vjs-progress-holder"
  58684. }, {
  58685. "aria-label": this.localize("Progress Bar")
  58686. });
  58687. }
  58688. update(event2) {
  58689. if (document_1.visibilityState === "hidden") {
  58690. return;
  58691. }
  58692. const percent = super.update();
  58693. this.requestNamedAnimationFrame("SeekBar#update", () => {
  58694. const currentTime = this.player_.ended() ? this.player_.duration() : this.getCurrentTime_();
  58695. const liveTracker = this.player_.liveTracker;
  58696. let duration5 = this.player_.duration();
  58697. if (liveTracker && liveTracker.isLive()) {
  58698. duration5 = this.player_.liveTracker.liveCurrentTime();
  58699. }
  58700. if (this.percent_ !== percent) {
  58701. this.el_.setAttribute("aria-valuenow", (percent * 100).toFixed(2));
  58702. this.percent_ = percent;
  58703. }
  58704. if (this.currentTime_ !== currentTime || this.duration_ !== duration5) {
  58705. this.el_.setAttribute("aria-valuetext", this.localize("progress bar timing: currentTime={1} duration={2}", [formatTime$1(currentTime, duration5), formatTime$1(duration5, duration5)], "{1} of {2}"));
  58706. this.currentTime_ = currentTime;
  58707. this.duration_ = duration5;
  58708. }
  58709. if (this.bar) {
  58710. this.bar.update(getBoundingClientRect$1(this.el()), this.getProgress());
  58711. }
  58712. });
  58713. return percent;
  58714. }
  58715. userSeek_(ct2) {
  58716. if (this.player_.liveTracker && this.player_.liveTracker.isLive()) {
  58717. this.player_.liveTracker.nextSeekedFromUser();
  58718. }
  58719. this.player_.currentTime(ct2);
  58720. }
  58721. getCurrentTime_() {
  58722. return this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
  58723. }
  58724. getPercent() {
  58725. const currentTime = this.getCurrentTime_();
  58726. let percent;
  58727. const liveTracker = this.player_.liveTracker;
  58728. if (liveTracker && liveTracker.isLive()) {
  58729. percent = (currentTime - liveTracker.seekableStart()) / liveTracker.liveWindow();
  58730. if (liveTracker.atLiveEdge()) {
  58731. percent = 1;
  58732. }
  58733. } else {
  58734. percent = currentTime / this.player_.duration();
  58735. }
  58736. return percent;
  58737. }
  58738. handleMouseDown(event2) {
  58739. if (!isSingleLeftClick$1(event2)) {
  58740. return;
  58741. }
  58742. event2.stopPropagation();
  58743. this.videoWasPlaying = !this.player_.paused();
  58744. this.player_.pause();
  58745. super.handleMouseDown(event2);
  58746. }
  58747. handleMouseMove(event2, mouseDown = false) {
  58748. if (!isSingleLeftClick$1(event2)) {
  58749. return;
  58750. }
  58751. if (!mouseDown && !this.player_.scrubbing()) {
  58752. this.player_.scrubbing(true);
  58753. }
  58754. let newTime;
  58755. const distance2 = this.calculateDistance(event2);
  58756. const liveTracker = this.player_.liveTracker;
  58757. if (!liveTracker || !liveTracker.isLive()) {
  58758. newTime = distance2 * this.player_.duration();
  58759. if (newTime === this.player_.duration()) {
  58760. newTime = newTime - 0.1;
  58761. }
  58762. } else {
  58763. if (distance2 >= 0.99) {
  58764. liveTracker.seekToLiveEdge();
  58765. return;
  58766. }
  58767. const seekableStart = liveTracker.seekableStart();
  58768. const seekableEnd = liveTracker.liveCurrentTime();
  58769. newTime = seekableStart + distance2 * liveTracker.liveWindow();
  58770. if (newTime >= seekableEnd) {
  58771. newTime = seekableEnd;
  58772. }
  58773. if (newTime <= seekableStart) {
  58774. newTime = seekableStart + 0.1;
  58775. }
  58776. if (newTime === Infinity) {
  58777. return;
  58778. }
  58779. }
  58780. this.userSeek_(newTime);
  58781. }
  58782. enable() {
  58783. super.enable();
  58784. const mouseTimeDisplay = this.getChild("mouseTimeDisplay");
  58785. if (!mouseTimeDisplay) {
  58786. return;
  58787. }
  58788. mouseTimeDisplay.show();
  58789. }
  58790. disable() {
  58791. super.disable();
  58792. const mouseTimeDisplay = this.getChild("mouseTimeDisplay");
  58793. if (!mouseTimeDisplay) {
  58794. return;
  58795. }
  58796. mouseTimeDisplay.hide();
  58797. }
  58798. handleMouseUp(event2) {
  58799. super.handleMouseUp(event2);
  58800. if (event2) {
  58801. event2.stopPropagation();
  58802. }
  58803. this.player_.scrubbing(false);
  58804. this.player_.trigger({
  58805. type: "timeupdate",
  58806. target: this,
  58807. manuallyTriggered: true
  58808. });
  58809. if (this.videoWasPlaying) {
  58810. silencePromise$1(this.player_.play());
  58811. } else {
  58812. this.update_();
  58813. }
  58814. }
  58815. stepForward() {
  58816. this.userSeek_(this.player_.currentTime() + STEP_SECONDS$1);
  58817. }
  58818. stepBack() {
  58819. this.userSeek_(this.player_.currentTime() - STEP_SECONDS$1);
  58820. }
  58821. handleAction(event2) {
  58822. if (this.player_.paused()) {
  58823. this.player_.play();
  58824. } else {
  58825. this.player_.pause();
  58826. }
  58827. }
  58828. handleKeyDown(event2) {
  58829. const liveTracker = this.player_.liveTracker;
  58830. if (keycode.isEventKey(event2, "Space") || keycode.isEventKey(event2, "Enter")) {
  58831. event2.preventDefault();
  58832. event2.stopPropagation();
  58833. this.handleAction(event2);
  58834. } else if (keycode.isEventKey(event2, "Home")) {
  58835. event2.preventDefault();
  58836. event2.stopPropagation();
  58837. this.userSeek_(0);
  58838. } else if (keycode.isEventKey(event2, "End")) {
  58839. event2.preventDefault();
  58840. event2.stopPropagation();
  58841. if (liveTracker && liveTracker.isLive()) {
  58842. this.userSeek_(liveTracker.liveCurrentTime());
  58843. } else {
  58844. this.userSeek_(this.player_.duration());
  58845. }
  58846. } else if (/^[0-9]$/.test(keycode(event2))) {
  58847. event2.preventDefault();
  58848. event2.stopPropagation();
  58849. const gotoFraction = (keycode.codes[keycode(event2)] - keycode.codes["0"]) * 10 / 100;
  58850. if (liveTracker && liveTracker.isLive()) {
  58851. this.userSeek_(liveTracker.seekableStart() + liveTracker.liveWindow() * gotoFraction);
  58852. } else {
  58853. this.userSeek_(this.player_.duration() * gotoFraction);
  58854. }
  58855. } else if (keycode.isEventKey(event2, "PgDn")) {
  58856. event2.preventDefault();
  58857. event2.stopPropagation();
  58858. this.userSeek_(this.player_.currentTime() - STEP_SECONDS$1 * PAGE_KEY_MULTIPLIER$1);
  58859. } else if (keycode.isEventKey(event2, "PgUp")) {
  58860. event2.preventDefault();
  58861. event2.stopPropagation();
  58862. this.userSeek_(this.player_.currentTime() + STEP_SECONDS$1 * PAGE_KEY_MULTIPLIER$1);
  58863. } else {
  58864. super.handleKeyDown(event2);
  58865. }
  58866. }
  58867. dispose() {
  58868. this.disableInterval_();
  58869. this.off(this.player_, ["ended", "durationchange", "timeupdate"], this.update);
  58870. if (this.player_.liveTracker) {
  58871. this.off(this.player_.liveTracker, "liveedgechange", this.update);
  58872. }
  58873. this.off(this.player_, ["playing"], this.enableIntervalHandler_);
  58874. this.off(this.player_, ["ended", "pause", "waiting"], this.disableIntervalHandler_);
  58875. if ("hidden" in document_1 && "visibilityState" in document_1) {
  58876. this.off(document_1, "visibilitychange", this.toggleVisibility_);
  58877. }
  58878. super.dispose();
  58879. }
  58880. }
  58881. SeekBar$1.prototype.options_ = {
  58882. children: ["loadProgressBar", "playProgressBar"],
  58883. barName: "playProgressBar"
  58884. };
  58885. if (!IS_IOS$1 && !IS_ANDROID$1) {
  58886. SeekBar$1.prototype.options_.children.splice(1, 0, "mouseTimeDisplay");
  58887. }
  58888. Component$1$1.registerComponent("SeekBar", SeekBar$1);
  58889. class ProgressControl$1 extends Component$1$1 {
  58890. constructor(player, options2) {
  58891. super(player, options2);
  58892. this.handleMouseMove = throttle$1(bind_(this, this.handleMouseMove), UPDATE_REFRESH_INTERVAL$1);
  58893. this.throttledHandleMouseSeek = throttle$1(bind_(this, this.handleMouseSeek), UPDATE_REFRESH_INTERVAL$1);
  58894. this.handleMouseUpHandler_ = (e) => this.handleMouseUp(e);
  58895. this.handleMouseDownHandler_ = (e) => this.handleMouseDown(e);
  58896. this.enable();
  58897. }
  58898. createEl() {
  58899. return super.createEl("div", {
  58900. className: "vjs-progress-control vjs-control"
  58901. });
  58902. }
  58903. handleMouseMove(event2) {
  58904. const seekBar = this.getChild("seekBar");
  58905. if (!seekBar) {
  58906. return;
  58907. }
  58908. const playProgressBar = seekBar.getChild("playProgressBar");
  58909. const mouseTimeDisplay = seekBar.getChild("mouseTimeDisplay");
  58910. if (!playProgressBar && !mouseTimeDisplay) {
  58911. return;
  58912. }
  58913. const seekBarEl = seekBar.el();
  58914. const seekBarRect = findPosition$1(seekBarEl);
  58915. let seekBarPoint = getPointerPosition$1(seekBarEl, event2).x;
  58916. seekBarPoint = clamp$1(seekBarPoint, 0, 1);
  58917. if (mouseTimeDisplay) {
  58918. mouseTimeDisplay.update(seekBarRect, seekBarPoint);
  58919. }
  58920. if (playProgressBar) {
  58921. playProgressBar.update(seekBarRect, seekBar.getProgress());
  58922. }
  58923. }
  58924. handleMouseSeek(event2) {
  58925. const seekBar = this.getChild("seekBar");
  58926. if (seekBar) {
  58927. seekBar.handleMouseMove(event2);
  58928. }
  58929. }
  58930. enabled() {
  58931. return this.enabled_;
  58932. }
  58933. disable() {
  58934. this.children().forEach((child) => child.disable && child.disable());
  58935. if (!this.enabled()) {
  58936. return;
  58937. }
  58938. this.off(["mousedown", "touchstart"], this.handleMouseDownHandler_);
  58939. this.off(this.el_, "mousemove", this.handleMouseMove);
  58940. this.removeListenersAddedOnMousedownAndTouchstart();
  58941. this.addClass("disabled");
  58942. this.enabled_ = false;
  58943. if (this.player_.scrubbing()) {
  58944. const seekBar = this.getChild("seekBar");
  58945. this.player_.scrubbing(false);
  58946. if (seekBar.videoWasPlaying) {
  58947. silencePromise$1(this.player_.play());
  58948. }
  58949. }
  58950. }
  58951. enable() {
  58952. this.children().forEach((child) => child.enable && child.enable());
  58953. if (this.enabled()) {
  58954. return;
  58955. }
  58956. this.on(["mousedown", "touchstart"], this.handleMouseDownHandler_);
  58957. this.on(this.el_, "mousemove", this.handleMouseMove);
  58958. this.removeClass("disabled");
  58959. this.enabled_ = true;
  58960. }
  58961. removeListenersAddedOnMousedownAndTouchstart() {
  58962. const doc = this.el_.ownerDocument;
  58963. this.off(doc, "mousemove", this.throttledHandleMouseSeek);
  58964. this.off(doc, "touchmove", this.throttledHandleMouseSeek);
  58965. this.off(doc, "mouseup", this.handleMouseUpHandler_);
  58966. this.off(doc, "touchend", this.handleMouseUpHandler_);
  58967. }
  58968. handleMouseDown(event2) {
  58969. const doc = this.el_.ownerDocument;
  58970. const seekBar = this.getChild("seekBar");
  58971. if (seekBar) {
  58972. seekBar.handleMouseDown(event2);
  58973. }
  58974. this.on(doc, "mousemove", this.throttledHandleMouseSeek);
  58975. this.on(doc, "touchmove", this.throttledHandleMouseSeek);
  58976. this.on(doc, "mouseup", this.handleMouseUpHandler_);
  58977. this.on(doc, "touchend", this.handleMouseUpHandler_);
  58978. }
  58979. handleMouseUp(event2) {
  58980. const seekBar = this.getChild("seekBar");
  58981. if (seekBar) {
  58982. seekBar.handleMouseUp(event2);
  58983. }
  58984. this.removeListenersAddedOnMousedownAndTouchstart();
  58985. }
  58986. }
  58987. ProgressControl$1.prototype.options_ = {
  58988. children: ["seekBar"]
  58989. };
  58990. Component$1$1.registerComponent("ProgressControl", ProgressControl$1);
  58991. class PictureInPictureToggle$1 extends Button$1 {
  58992. constructor(player, options2) {
  58993. super(player, options2);
  58994. this.on(player, ["enterpictureinpicture", "leavepictureinpicture"], (e) => this.handlePictureInPictureChange(e));
  58995. this.on(player, ["disablepictureinpicturechanged", "loadedmetadata"], (e) => this.handlePictureInPictureEnabledChange(e));
  58996. this.on(player, ["loadedmetadata", "audioonlymodechange", "audiopostermodechange"], () => {
  58997. const isSourceAudio = player.currentType().substring(0, 5) === "audio";
  58998. if (isSourceAudio || player.audioPosterMode() || player.audioOnlyMode()) {
  58999. if (player.isInPictureInPicture()) {
  59000. player.exitPictureInPicture();
  59001. }
  59002. this.hide();
  59003. } else {
  59004. this.show();
  59005. }
  59006. });
  59007. this.disable();
  59008. }
  59009. buildCSSClass() {
  59010. return `vjs-picture-in-picture-control ${super.buildCSSClass()}`;
  59011. }
  59012. handlePictureInPictureEnabledChange() {
  59013. if (document_1.pictureInPictureEnabled && this.player_.disablePictureInPicture() === false || this.player_.options_.enableDocumentPictureInPicture && "documentPictureInPicture" in window_1) {
  59014. this.enable();
  59015. } else {
  59016. this.disable();
  59017. }
  59018. }
  59019. handlePictureInPictureChange(event2) {
  59020. if (this.player_.isInPictureInPicture()) {
  59021. this.controlText("Exit Picture-in-Picture");
  59022. } else {
  59023. this.controlText("Picture-in-Picture");
  59024. }
  59025. this.handlePictureInPictureEnabledChange();
  59026. }
  59027. handleClick(event2) {
  59028. if (!this.player_.isInPictureInPicture()) {
  59029. this.player_.requestPictureInPicture();
  59030. } else {
  59031. this.player_.exitPictureInPicture();
  59032. }
  59033. }
  59034. }
  59035. PictureInPictureToggle$1.prototype.controlText_ = "Picture-in-Picture";
  59036. Component$1$1.registerComponent("PictureInPictureToggle", PictureInPictureToggle$1);
  59037. class FullscreenToggle$1 extends Button$1 {
  59038. constructor(player, options2) {
  59039. super(player, options2);
  59040. this.on(player, "fullscreenchange", (e) => this.handleFullscreenChange(e));
  59041. if (document_1[player.fsApi_.fullscreenEnabled] === false) {
  59042. this.disable();
  59043. }
  59044. }
  59045. buildCSSClass() {
  59046. return `vjs-fullscreen-control ${super.buildCSSClass()}`;
  59047. }
  59048. handleFullscreenChange(event2) {
  59049. if (this.player_.isFullscreen()) {
  59050. this.controlText("Exit Fullscreen");
  59051. } else {
  59052. this.controlText("Fullscreen");
  59053. }
  59054. }
  59055. handleClick(event2) {
  59056. if (!this.player_.isFullscreen()) {
  59057. this.player_.requestFullscreen();
  59058. } else {
  59059. this.player_.exitFullscreen();
  59060. }
  59061. }
  59062. }
  59063. FullscreenToggle$1.prototype.controlText_ = "Fullscreen";
  59064. Component$1$1.registerComponent("FullscreenToggle", FullscreenToggle$1);
  59065. const checkVolumeSupport$1 = function(self2, player) {
  59066. if (player.tech_ && !player.tech_.featuresVolumeControl) {
  59067. self2.addClass("vjs-hidden");
  59068. }
  59069. self2.on(player, "loadstart", function() {
  59070. if (!player.tech_.featuresVolumeControl) {
  59071. self2.addClass("vjs-hidden");
  59072. } else {
  59073. self2.removeClass("vjs-hidden");
  59074. }
  59075. });
  59076. };
  59077. class VolumeLevel$1 extends Component$1$1 {
  59078. createEl() {
  59079. const el = super.createEl("div", {
  59080. className: "vjs-volume-level"
  59081. });
  59082. el.appendChild(super.createEl("span", {
  59083. className: "vjs-control-text"
  59084. }));
  59085. return el;
  59086. }
  59087. }
  59088. Component$1$1.registerComponent("VolumeLevel", VolumeLevel$1);
  59089. class VolumeLevelTooltip$1 extends Component$1$1 {
  59090. constructor(player, options2) {
  59091. super(player, options2);
  59092. this.update = throttle$1(bind_(this, this.update), UPDATE_REFRESH_INTERVAL$1);
  59093. }
  59094. createEl() {
  59095. return super.createEl("div", {
  59096. className: "vjs-volume-tooltip"
  59097. }, {
  59098. "aria-hidden": "true"
  59099. });
  59100. }
  59101. update(rangeBarRect, rangeBarPoint, vertical, content) {
  59102. if (!vertical) {
  59103. const tooltipRect = getBoundingClientRect$1(this.el_);
  59104. const playerRect = getBoundingClientRect$1(this.player_.el());
  59105. const volumeBarPointPx = rangeBarRect.width * rangeBarPoint;
  59106. if (!playerRect || !tooltipRect) {
  59107. return;
  59108. }
  59109. const spaceLeftOfPoint = rangeBarRect.left - playerRect.left + volumeBarPointPx;
  59110. const spaceRightOfPoint = rangeBarRect.width - volumeBarPointPx + (playerRect.right - rangeBarRect.right);
  59111. let pullTooltipBy = tooltipRect.width / 2;
  59112. if (spaceLeftOfPoint < pullTooltipBy) {
  59113. pullTooltipBy += pullTooltipBy - spaceLeftOfPoint;
  59114. } else if (spaceRightOfPoint < pullTooltipBy) {
  59115. pullTooltipBy = spaceRightOfPoint;
  59116. }
  59117. if (pullTooltipBy < 0) {
  59118. pullTooltipBy = 0;
  59119. } else if (pullTooltipBy > tooltipRect.width) {
  59120. pullTooltipBy = tooltipRect.width;
  59121. }
  59122. this.el_.style.right = `-${pullTooltipBy}px`;
  59123. }
  59124. this.write(`${content}%`);
  59125. }
  59126. write(content) {
  59127. textContent$1(this.el_, content);
  59128. }
  59129. updateVolume(rangeBarRect, rangeBarPoint, vertical, volume, cb) {
  59130. this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume", () => {
  59131. this.update(rangeBarRect, rangeBarPoint, vertical, volume.toFixed(0));
  59132. if (cb) {
  59133. cb();
  59134. }
  59135. });
  59136. }
  59137. }
  59138. Component$1$1.registerComponent("VolumeLevelTooltip", VolumeLevelTooltip$1);
  59139. class MouseVolumeLevelDisplay$1 extends Component$1$1 {
  59140. constructor(player, options2) {
  59141. super(player, options2);
  59142. this.update = throttle$1(bind_(this, this.update), UPDATE_REFRESH_INTERVAL$1);
  59143. }
  59144. createEl() {
  59145. return super.createEl("div", {
  59146. className: "vjs-mouse-display"
  59147. });
  59148. }
  59149. update(rangeBarRect, rangeBarPoint, vertical) {
  59150. const volume = 100 * rangeBarPoint;
  59151. this.getChild("volumeLevelTooltip").updateVolume(rangeBarRect, rangeBarPoint, vertical, volume, () => {
  59152. if (vertical) {
  59153. this.el_.style.bottom = `${rangeBarRect.height * rangeBarPoint}px`;
  59154. } else {
  59155. this.el_.style.left = `${rangeBarRect.width * rangeBarPoint}px`;
  59156. }
  59157. });
  59158. }
  59159. }
  59160. MouseVolumeLevelDisplay$1.prototype.options_ = {
  59161. children: ["volumeLevelTooltip"]
  59162. };
  59163. Component$1$1.registerComponent("MouseVolumeLevelDisplay", MouseVolumeLevelDisplay$1);
  59164. class VolumeBar$1 extends Slider$1 {
  59165. constructor(player, options2) {
  59166. super(player, options2);
  59167. this.on("slideractive", (e) => this.updateLastVolume_(e));
  59168. this.on(player, "volumechange", (e) => this.updateARIAAttributes(e));
  59169. player.ready(() => this.updateARIAAttributes());
  59170. }
  59171. createEl() {
  59172. return super.createEl("div", {
  59173. className: "vjs-volume-bar vjs-slider-bar"
  59174. }, {
  59175. "aria-label": this.localize("Volume Level"),
  59176. "aria-live": "polite"
  59177. });
  59178. }
  59179. handleMouseDown(event2) {
  59180. if (!isSingleLeftClick$1(event2)) {
  59181. return;
  59182. }
  59183. super.handleMouseDown(event2);
  59184. }
  59185. handleMouseMove(event2) {
  59186. const mouseVolumeLevelDisplay = this.getChild("mouseVolumeLevelDisplay");
  59187. if (mouseVolumeLevelDisplay) {
  59188. const volumeBarEl = this.el();
  59189. const volumeBarRect = getBoundingClientRect$1(volumeBarEl);
  59190. const vertical = this.vertical();
  59191. let volumeBarPoint = getPointerPosition$1(volumeBarEl, event2);
  59192. volumeBarPoint = vertical ? volumeBarPoint.y : volumeBarPoint.x;
  59193. volumeBarPoint = clamp$1(volumeBarPoint, 0, 1);
  59194. mouseVolumeLevelDisplay.update(volumeBarRect, volumeBarPoint, vertical);
  59195. }
  59196. if (!isSingleLeftClick$1(event2)) {
  59197. return;
  59198. }
  59199. this.checkMuted();
  59200. this.player_.volume(this.calculateDistance(event2));
  59201. }
  59202. checkMuted() {
  59203. if (this.player_.muted()) {
  59204. this.player_.muted(false);
  59205. }
  59206. }
  59207. getPercent() {
  59208. if (this.player_.muted()) {
  59209. return 0;
  59210. }
  59211. return this.player_.volume();
  59212. }
  59213. stepForward() {
  59214. this.checkMuted();
  59215. this.player_.volume(this.player_.volume() + 0.1);
  59216. }
  59217. stepBack() {
  59218. this.checkMuted();
  59219. this.player_.volume(this.player_.volume() - 0.1);
  59220. }
  59221. updateARIAAttributes(event2) {
  59222. const ariaValue = this.player_.muted() ? 0 : this.volumeAsPercentage_();
  59223. this.el_.setAttribute("aria-valuenow", ariaValue);
  59224. this.el_.setAttribute("aria-valuetext", ariaValue + "%");
  59225. }
  59226. volumeAsPercentage_() {
  59227. return Math.round(this.player_.volume() * 100);
  59228. }
  59229. updateLastVolume_() {
  59230. const volumeBeforeDrag = this.player_.volume();
  59231. this.one("sliderinactive", () => {
  59232. if (this.player_.volume() === 0) {
  59233. this.player_.lastVolume_(volumeBeforeDrag);
  59234. }
  59235. });
  59236. }
  59237. }
  59238. VolumeBar$1.prototype.options_ = {
  59239. children: ["volumeLevel"],
  59240. barName: "volumeLevel"
  59241. };
  59242. if (!IS_IOS$1 && !IS_ANDROID$1) {
  59243. VolumeBar$1.prototype.options_.children.splice(0, 0, "mouseVolumeLevelDisplay");
  59244. }
  59245. VolumeBar$1.prototype.playerEvent = "volumechange";
  59246. Component$1$1.registerComponent("VolumeBar", VolumeBar$1);
  59247. class VolumeControl$1 extends Component$1$1 {
  59248. constructor(player, options2 = {}) {
  59249. options2.vertical = options2.vertical || false;
  59250. if (typeof options2.volumeBar === "undefined" || isPlain$1(options2.volumeBar)) {
  59251. options2.volumeBar = options2.volumeBar || {};
  59252. options2.volumeBar.vertical = options2.vertical;
  59253. }
  59254. super(player, options2);
  59255. checkVolumeSupport$1(this, player);
  59256. this.throttledHandleMouseMove = throttle$1(bind_(this, this.handleMouseMove), UPDATE_REFRESH_INTERVAL$1);
  59257. this.handleMouseUpHandler_ = (e) => this.handleMouseUp(e);
  59258. this.on("mousedown", (e) => this.handleMouseDown(e));
  59259. this.on("touchstart", (e) => this.handleMouseDown(e));
  59260. this.on("mousemove", (e) => this.handleMouseMove(e));
  59261. this.on(this.volumeBar, ["focus", "slideractive"], () => {
  59262. this.volumeBar.addClass("vjs-slider-active");
  59263. this.addClass("vjs-slider-active");
  59264. this.trigger("slideractive");
  59265. });
  59266. this.on(this.volumeBar, ["blur", "sliderinactive"], () => {
  59267. this.volumeBar.removeClass("vjs-slider-active");
  59268. this.removeClass("vjs-slider-active");
  59269. this.trigger("sliderinactive");
  59270. });
  59271. }
  59272. createEl() {
  59273. let orientationClass = "vjs-volume-horizontal";
  59274. if (this.options_.vertical) {
  59275. orientationClass = "vjs-volume-vertical";
  59276. }
  59277. return super.createEl("div", {
  59278. className: `vjs-volume-control vjs-control ${orientationClass}`
  59279. });
  59280. }
  59281. handleMouseDown(event2) {
  59282. const doc = this.el_.ownerDocument;
  59283. this.on(doc, "mousemove", this.throttledHandleMouseMove);
  59284. this.on(doc, "touchmove", this.throttledHandleMouseMove);
  59285. this.on(doc, "mouseup", this.handleMouseUpHandler_);
  59286. this.on(doc, "touchend", this.handleMouseUpHandler_);
  59287. }
  59288. handleMouseUp(event2) {
  59289. const doc = this.el_.ownerDocument;
  59290. this.off(doc, "mousemove", this.throttledHandleMouseMove);
  59291. this.off(doc, "touchmove", this.throttledHandleMouseMove);
  59292. this.off(doc, "mouseup", this.handleMouseUpHandler_);
  59293. this.off(doc, "touchend", this.handleMouseUpHandler_);
  59294. }
  59295. handleMouseMove(event2) {
  59296. this.volumeBar.handleMouseMove(event2);
  59297. }
  59298. }
  59299. VolumeControl$1.prototype.options_ = {
  59300. children: ["volumeBar"]
  59301. };
  59302. Component$1$1.registerComponent("VolumeControl", VolumeControl$1);
  59303. const checkMuteSupport$1 = function(self2, player) {
  59304. if (player.tech_ && !player.tech_.featuresMuteControl) {
  59305. self2.addClass("vjs-hidden");
  59306. }
  59307. self2.on(player, "loadstart", function() {
  59308. if (!player.tech_.featuresMuteControl) {
  59309. self2.addClass("vjs-hidden");
  59310. } else {
  59311. self2.removeClass("vjs-hidden");
  59312. }
  59313. });
  59314. };
  59315. class MuteToggle$1 extends Button$1 {
  59316. constructor(player, options2) {
  59317. super(player, options2);
  59318. checkMuteSupport$1(this, player);
  59319. this.on(player, ["loadstart", "volumechange"], (e) => this.update(e));
  59320. }
  59321. buildCSSClass() {
  59322. return `vjs-mute-control ${super.buildCSSClass()}`;
  59323. }
  59324. handleClick(event2) {
  59325. const vol = this.player_.volume();
  59326. const lastVolume = this.player_.lastVolume_();
  59327. if (vol === 0) {
  59328. const volumeToSet = lastVolume < 0.1 ? 0.1 : lastVolume;
  59329. this.player_.volume(volumeToSet);
  59330. this.player_.muted(false);
  59331. } else {
  59332. this.player_.muted(this.player_.muted() ? false : true);
  59333. }
  59334. }
  59335. update(event2) {
  59336. this.updateIcon_();
  59337. this.updateControlText_();
  59338. }
  59339. updateIcon_() {
  59340. const vol = this.player_.volume();
  59341. let level = 3;
  59342. if (IS_IOS$1 && this.player_.tech_ && this.player_.tech_.el_) {
  59343. this.player_.muted(this.player_.tech_.el_.muted);
  59344. }
  59345. if (vol === 0 || this.player_.muted()) {
  59346. level = 0;
  59347. } else if (vol < 0.33) {
  59348. level = 1;
  59349. } else if (vol < 0.67) {
  59350. level = 2;
  59351. }
  59352. removeClass$1(this.el_, [0, 1, 2, 3].reduce((str, i2) => str + `${i2 ? " " : ""}vjs-vol-${i2}`, ""));
  59353. addClass$1(this.el_, `vjs-vol-${level}`);
  59354. }
  59355. updateControlText_() {
  59356. const soundOff = this.player_.muted() || this.player_.volume() === 0;
  59357. const text = soundOff ? "Unmute" : "Mute";
  59358. if (this.controlText() !== text) {
  59359. this.controlText(text);
  59360. }
  59361. }
  59362. }
  59363. MuteToggle$1.prototype.controlText_ = "Mute";
  59364. Component$1$1.registerComponent("MuteToggle", MuteToggle$1);
  59365. class VolumePanel$1 extends Component$1$1 {
  59366. constructor(player, options2 = {}) {
  59367. if (typeof options2.inline !== "undefined") {
  59368. options2.inline = options2.inline;
  59369. } else {
  59370. options2.inline = true;
  59371. }
  59372. if (typeof options2.volumeControl === "undefined" || isPlain$1(options2.volumeControl)) {
  59373. options2.volumeControl = options2.volumeControl || {};
  59374. options2.volumeControl.vertical = !options2.inline;
  59375. }
  59376. super(player, options2);
  59377. this.handleKeyPressHandler_ = (e) => this.handleKeyPress(e);
  59378. this.on(player, ["loadstart"], (e) => this.volumePanelState_(e));
  59379. this.on(this.muteToggle, "keyup", (e) => this.handleKeyPress(e));
  59380. this.on(this.volumeControl, "keyup", (e) => this.handleVolumeControlKeyUp(e));
  59381. this.on("keydown", (e) => this.handleKeyPress(e));
  59382. this.on("mouseover", (e) => this.handleMouseOver(e));
  59383. this.on("mouseout", (e) => this.handleMouseOut(e));
  59384. this.on(this.volumeControl, ["slideractive"], this.sliderActive_);
  59385. this.on(this.volumeControl, ["sliderinactive"], this.sliderInactive_);
  59386. }
  59387. sliderActive_() {
  59388. this.addClass("vjs-slider-active");
  59389. }
  59390. sliderInactive_() {
  59391. this.removeClass("vjs-slider-active");
  59392. }
  59393. volumePanelState_() {
  59394. if (this.volumeControl.hasClass("vjs-hidden") && this.muteToggle.hasClass("vjs-hidden")) {
  59395. this.addClass("vjs-hidden");
  59396. }
  59397. if (this.volumeControl.hasClass("vjs-hidden") && !this.muteToggle.hasClass("vjs-hidden")) {
  59398. this.addClass("vjs-mute-toggle-only");
  59399. }
  59400. }
  59401. createEl() {
  59402. let orientationClass = "vjs-volume-panel-horizontal";
  59403. if (!this.options_.inline) {
  59404. orientationClass = "vjs-volume-panel-vertical";
  59405. }
  59406. return super.createEl("div", {
  59407. className: `vjs-volume-panel vjs-control ${orientationClass}`
  59408. });
  59409. }
  59410. dispose() {
  59411. this.handleMouseOut();
  59412. super.dispose();
  59413. }
  59414. handleVolumeControlKeyUp(event2) {
  59415. if (keycode.isEventKey(event2, "Esc")) {
  59416. this.muteToggle.focus();
  59417. }
  59418. }
  59419. handleMouseOver(event2) {
  59420. this.addClass("vjs-hover");
  59421. on$1(document_1, "keyup", this.handleKeyPressHandler_);
  59422. }
  59423. handleMouseOut(event2) {
  59424. this.removeClass("vjs-hover");
  59425. off$1(document_1, "keyup", this.handleKeyPressHandler_);
  59426. }
  59427. handleKeyPress(event2) {
  59428. if (keycode.isEventKey(event2, "Esc")) {
  59429. this.handleMouseOut();
  59430. }
  59431. }
  59432. }
  59433. VolumePanel$1.prototype.options_ = {
  59434. children: ["muteToggle", "volumeControl"]
  59435. };
  59436. Component$1$1.registerComponent("VolumePanel", VolumePanel$1);
  59437. class SkipForward extends Button$1 {
  59438. constructor(player, options2) {
  59439. super(player, options2);
  59440. this.validOptions = [5, 10, 30];
  59441. this.skipTime = this.getSkipForwardTime();
  59442. if (this.skipTime && this.validOptions.includes(this.skipTime)) {
  59443. this.controlText(this.localize("Skip forward {1} seconds", [this.skipTime]));
  59444. this.show();
  59445. } else {
  59446. this.hide();
  59447. }
  59448. }
  59449. getSkipForwardTime() {
  59450. const playerOptions = this.options_.playerOptions;
  59451. return playerOptions.controlBar && playerOptions.controlBar.skipButtons && playerOptions.controlBar.skipButtons.forward;
  59452. }
  59453. buildCSSClass() {
  59454. return `vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`;
  59455. }
  59456. handleClick(event2) {
  59457. const currentVideoTime = this.player_.currentTime();
  59458. const liveTracker = this.player_.liveTracker;
  59459. const duration5 = liveTracker && liveTracker.isLive() ? liveTracker.seekableEnd() : this.player_.duration();
  59460. let newTime;
  59461. if (currentVideoTime + this.skipTime <= duration5) {
  59462. newTime = currentVideoTime + this.skipTime;
  59463. } else {
  59464. newTime = duration5;
  59465. }
  59466. this.player_.currentTime(newTime);
  59467. }
  59468. handleLanguagechange() {
  59469. this.controlText(this.localize("Skip forward {1} seconds", [this.skipTime]));
  59470. }
  59471. }
  59472. Component$1$1.registerComponent("SkipForward", SkipForward);
  59473. class SkipBackward extends Button$1 {
  59474. constructor(player, options2) {
  59475. super(player, options2);
  59476. this.validOptions = [5, 10, 30];
  59477. this.skipTime = this.getSkipBackwardTime();
  59478. if (this.skipTime && this.validOptions.includes(this.skipTime)) {
  59479. this.controlText(this.localize("Skip backward {1} seconds", [this.skipTime]));
  59480. this.show();
  59481. } else {
  59482. this.hide();
  59483. }
  59484. }
  59485. getSkipBackwardTime() {
  59486. const playerOptions = this.options_.playerOptions;
  59487. return playerOptions.controlBar && playerOptions.controlBar.skipButtons && playerOptions.controlBar.skipButtons.backward;
  59488. }
  59489. buildCSSClass() {
  59490. return `vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`;
  59491. }
  59492. handleClick(event2) {
  59493. const currentVideoTime = this.player_.currentTime();
  59494. const liveTracker = this.player_.liveTracker;
  59495. const seekableStart = liveTracker && liveTracker.isLive() && liveTracker.seekableStart();
  59496. let newTime;
  59497. if (seekableStart && currentVideoTime - this.skipTime <= seekableStart) {
  59498. newTime = seekableStart;
  59499. } else if (currentVideoTime >= this.skipTime) {
  59500. newTime = currentVideoTime - this.skipTime;
  59501. } else {
  59502. newTime = 0;
  59503. }
  59504. this.player_.currentTime(newTime);
  59505. }
  59506. handleLanguagechange() {
  59507. this.controlText(this.localize("Skip backward {1} seconds", [this.skipTime]));
  59508. }
  59509. }
  59510. SkipBackward.prototype.controlText_ = "Skip Backward";
  59511. Component$1$1.registerComponent("SkipBackward", SkipBackward);
  59512. class Menu$1 extends Component$1$1 {
  59513. constructor(player, options2) {
  59514. super(player, options2);
  59515. if (options2) {
  59516. this.menuButton_ = options2.menuButton;
  59517. }
  59518. this.focusedChild_ = -1;
  59519. this.on("keydown", (e) => this.handleKeyDown(e));
  59520. this.boundHandleBlur_ = (e) => this.handleBlur(e);
  59521. this.boundHandleTapClick_ = (e) => this.handleTapClick(e);
  59522. }
  59523. addEventListenerForItem(component) {
  59524. if (!(component instanceof Component$1$1)) {
  59525. return;
  59526. }
  59527. this.on(component, "blur", this.boundHandleBlur_);
  59528. this.on(component, ["tap", "click"], this.boundHandleTapClick_);
  59529. }
  59530. removeEventListenerForItem(component) {
  59531. if (!(component instanceof Component$1$1)) {
  59532. return;
  59533. }
  59534. this.off(component, "blur", this.boundHandleBlur_);
  59535. this.off(component, ["tap", "click"], this.boundHandleTapClick_);
  59536. }
  59537. removeChild(component) {
  59538. if (typeof component === "string") {
  59539. component = this.getChild(component);
  59540. }
  59541. this.removeEventListenerForItem(component);
  59542. super.removeChild(component);
  59543. }
  59544. addItem(component) {
  59545. const childComponent = this.addChild(component);
  59546. if (childComponent) {
  59547. this.addEventListenerForItem(childComponent);
  59548. }
  59549. }
  59550. createEl() {
  59551. const contentElType = this.options_.contentElType || "ul";
  59552. this.contentEl_ = createEl$1(contentElType, {
  59553. className: "vjs-menu-content"
  59554. });
  59555. this.contentEl_.setAttribute("role", "menu");
  59556. const el = super.createEl("div", {
  59557. append: this.contentEl_,
  59558. className: "vjs-menu"
  59559. });
  59560. el.appendChild(this.contentEl_);
  59561. on$1(el, "click", function(event2) {
  59562. event2.preventDefault();
  59563. event2.stopImmediatePropagation();
  59564. });
  59565. return el;
  59566. }
  59567. dispose() {
  59568. this.contentEl_ = null;
  59569. this.boundHandleBlur_ = null;
  59570. this.boundHandleTapClick_ = null;
  59571. super.dispose();
  59572. }
  59573. handleBlur(event2) {
  59574. const relatedTarget = event2.relatedTarget || document_1.activeElement;
  59575. if (!this.children().some((element) => {
  59576. return element.el() === relatedTarget;
  59577. })) {
  59578. const btn = this.menuButton_;
  59579. if (btn && btn.buttonPressed_ && relatedTarget !== btn.el().firstChild) {
  59580. btn.unpressButton();
  59581. }
  59582. }
  59583. }
  59584. handleTapClick(event2) {
  59585. if (this.menuButton_) {
  59586. this.menuButton_.unpressButton();
  59587. const childComponents = this.children();
  59588. if (!Array.isArray(childComponents)) {
  59589. return;
  59590. }
  59591. const foundComponent = childComponents.filter((component) => component.el() === event2.target)[0];
  59592. if (!foundComponent) {
  59593. return;
  59594. }
  59595. if (foundComponent.name() !== "CaptionSettingsMenuItem") {
  59596. this.menuButton_.focus();
  59597. }
  59598. }
  59599. }
  59600. handleKeyDown(event2) {
  59601. if (keycode.isEventKey(event2, "Left") || keycode.isEventKey(event2, "Down")) {
  59602. event2.preventDefault();
  59603. event2.stopPropagation();
  59604. this.stepForward();
  59605. } else if (keycode.isEventKey(event2, "Right") || keycode.isEventKey(event2, "Up")) {
  59606. event2.preventDefault();
  59607. event2.stopPropagation();
  59608. this.stepBack();
  59609. }
  59610. }
  59611. stepForward() {
  59612. let stepChild = 0;
  59613. if (this.focusedChild_ !== void 0) {
  59614. stepChild = this.focusedChild_ + 1;
  59615. }
  59616. this.focus(stepChild);
  59617. }
  59618. stepBack() {
  59619. let stepChild = 0;
  59620. if (this.focusedChild_ !== void 0) {
  59621. stepChild = this.focusedChild_ - 1;
  59622. }
  59623. this.focus(stepChild);
  59624. }
  59625. focus(item = 0) {
  59626. const children = this.children().slice();
  59627. const haveTitle = children.length && children[0].hasClass("vjs-menu-title");
  59628. if (haveTitle) {
  59629. children.shift();
  59630. }
  59631. if (children.length > 0) {
  59632. if (item < 0) {
  59633. item = 0;
  59634. } else if (item >= children.length) {
  59635. item = children.length - 1;
  59636. }
  59637. this.focusedChild_ = item;
  59638. children[item].el_.focus();
  59639. }
  59640. }
  59641. }
  59642. Component$1$1.registerComponent("Menu", Menu$1);
  59643. class MenuButton$1 extends Component$1$1 {
  59644. constructor(player, options2 = {}) {
  59645. super(player, options2);
  59646. this.menuButton_ = new Button$1(player, options2);
  59647. this.menuButton_.controlText(this.controlText_);
  59648. this.menuButton_.el_.setAttribute("aria-haspopup", "true");
  59649. const buttonClass = Button$1.prototype.buildCSSClass();
  59650. this.menuButton_.el_.className = this.buildCSSClass() + " " + buttonClass;
  59651. this.menuButton_.removeClass("vjs-control");
  59652. this.addChild(this.menuButton_);
  59653. this.update();
  59654. this.enabled_ = true;
  59655. const handleClick = (e) => this.handleClick(e);
  59656. this.handleMenuKeyUp_ = (e) => this.handleMenuKeyUp(e);
  59657. this.on(this.menuButton_, "tap", handleClick);
  59658. this.on(this.menuButton_, "click", handleClick);
  59659. this.on(this.menuButton_, "keydown", (e) => this.handleKeyDown(e));
  59660. this.on(this.menuButton_, "mouseenter", () => {
  59661. this.addClass("vjs-hover");
  59662. this.menu.show();
  59663. on$1(document_1, "keyup", this.handleMenuKeyUp_);
  59664. });
  59665. this.on("mouseleave", (e) => this.handleMouseLeave(e));
  59666. this.on("keydown", (e) => this.handleSubmenuKeyDown(e));
  59667. }
  59668. update() {
  59669. const menu = this.createMenu();
  59670. if (this.menu) {
  59671. this.menu.dispose();
  59672. this.removeChild(this.menu);
  59673. }
  59674. this.menu = menu;
  59675. this.addChild(menu);
  59676. this.buttonPressed_ = false;
  59677. this.menuButton_.el_.setAttribute("aria-expanded", "false");
  59678. if (this.items && this.items.length <= this.hideThreshold_) {
  59679. this.hide();
  59680. this.menu.contentEl_.removeAttribute("role");
  59681. } else {
  59682. this.show();
  59683. this.menu.contentEl_.setAttribute("role", "menu");
  59684. }
  59685. }
  59686. createMenu() {
  59687. const menu = new Menu$1(this.player_, {
  59688. menuButton: this
  59689. });
  59690. this.hideThreshold_ = 0;
  59691. if (this.options_.title) {
  59692. const titleEl = createEl$1("li", {
  59693. className: "vjs-menu-title",
  59694. textContent: toTitleCase$1$1(this.options_.title),
  59695. tabIndex: -1
  59696. });
  59697. const titleComponent = new Component$1$1(this.player_, {
  59698. el: titleEl
  59699. });
  59700. menu.addItem(titleComponent);
  59701. }
  59702. this.items = this.createItems();
  59703. if (this.items) {
  59704. for (let i2 = 0; i2 < this.items.length; i2++) {
  59705. menu.addItem(this.items[i2]);
  59706. }
  59707. }
  59708. return menu;
  59709. }
  59710. createItems() {
  59711. }
  59712. createEl() {
  59713. return super.createEl("div", {
  59714. className: this.buildWrapperCSSClass()
  59715. }, {});
  59716. }
  59717. buildWrapperCSSClass() {
  59718. let menuButtonClass = "vjs-menu-button";
  59719. if (this.options_.inline === true) {
  59720. menuButtonClass += "-inline";
  59721. } else {
  59722. menuButtonClass += "-popup";
  59723. }
  59724. const buttonClass = Button$1.prototype.buildCSSClass();
  59725. return `vjs-menu-button ${menuButtonClass} ${buttonClass} ${super.buildCSSClass()}`;
  59726. }
  59727. buildCSSClass() {
  59728. let menuButtonClass = "vjs-menu-button";
  59729. if (this.options_.inline === true) {
  59730. menuButtonClass += "-inline";
  59731. } else {
  59732. menuButtonClass += "-popup";
  59733. }
  59734. return `vjs-menu-button ${menuButtonClass} ${super.buildCSSClass()}`;
  59735. }
  59736. controlText(text, el = this.menuButton_.el()) {
  59737. return this.menuButton_.controlText(text, el);
  59738. }
  59739. dispose() {
  59740. this.handleMouseLeave();
  59741. super.dispose();
  59742. }
  59743. handleClick(event2) {
  59744. if (this.buttonPressed_) {
  59745. this.unpressButton();
  59746. } else {
  59747. this.pressButton();
  59748. }
  59749. }
  59750. handleMouseLeave(event2) {
  59751. this.removeClass("vjs-hover");
  59752. off$1(document_1, "keyup", this.handleMenuKeyUp_);
  59753. }
  59754. focus() {
  59755. this.menuButton_.focus();
  59756. }
  59757. blur() {
  59758. this.menuButton_.blur();
  59759. }
  59760. handleKeyDown(event2) {
  59761. if (keycode.isEventKey(event2, "Esc") || keycode.isEventKey(event2, "Tab")) {
  59762. if (this.buttonPressed_) {
  59763. this.unpressButton();
  59764. }
  59765. if (!keycode.isEventKey(event2, "Tab")) {
  59766. event2.preventDefault();
  59767. this.menuButton_.focus();
  59768. }
  59769. } else if (keycode.isEventKey(event2, "Up") || keycode.isEventKey(event2, "Down")) {
  59770. if (!this.buttonPressed_) {
  59771. event2.preventDefault();
  59772. this.pressButton();
  59773. }
  59774. }
  59775. }
  59776. handleMenuKeyUp(event2) {
  59777. if (keycode.isEventKey(event2, "Esc") || keycode.isEventKey(event2, "Tab")) {
  59778. this.removeClass("vjs-hover");
  59779. }
  59780. }
  59781. handleSubmenuKeyPress(event2) {
  59782. this.handleSubmenuKeyDown(event2);
  59783. }
  59784. handleSubmenuKeyDown(event2) {
  59785. if (keycode.isEventKey(event2, "Esc") || keycode.isEventKey(event2, "Tab")) {
  59786. if (this.buttonPressed_) {
  59787. this.unpressButton();
  59788. }
  59789. if (!keycode.isEventKey(event2, "Tab")) {
  59790. event2.preventDefault();
  59791. this.menuButton_.focus();
  59792. }
  59793. }
  59794. }
  59795. pressButton() {
  59796. if (this.enabled_) {
  59797. this.buttonPressed_ = true;
  59798. this.menu.show();
  59799. this.menu.lockShowing();
  59800. this.menuButton_.el_.setAttribute("aria-expanded", "true");
  59801. if (IS_IOS$1 && isInFrame$1()) {
  59802. return;
  59803. }
  59804. this.menu.focus();
  59805. }
  59806. }
  59807. unpressButton() {
  59808. if (this.enabled_) {
  59809. this.buttonPressed_ = false;
  59810. this.menu.unlockShowing();
  59811. this.menu.hide();
  59812. this.menuButton_.el_.setAttribute("aria-expanded", "false");
  59813. }
  59814. }
  59815. disable() {
  59816. this.unpressButton();
  59817. this.enabled_ = false;
  59818. this.addClass("vjs-disabled");
  59819. this.menuButton_.disable();
  59820. }
  59821. enable() {
  59822. this.enabled_ = true;
  59823. this.removeClass("vjs-disabled");
  59824. this.menuButton_.enable();
  59825. }
  59826. }
  59827. Component$1$1.registerComponent("MenuButton", MenuButton$1);
  59828. class TrackButton$1 extends MenuButton$1 {
  59829. constructor(player, options2) {
  59830. const tracks = options2.tracks;
  59831. super(player, options2);
  59832. if (this.items.length <= 1) {
  59833. this.hide();
  59834. }
  59835. if (!tracks) {
  59836. return;
  59837. }
  59838. const updateHandler = bind_(this, this.update);
  59839. tracks.addEventListener("removetrack", updateHandler);
  59840. tracks.addEventListener("addtrack", updateHandler);
  59841. tracks.addEventListener("labelchange", updateHandler);
  59842. this.player_.on("ready", updateHandler);
  59843. this.player_.on("dispose", function() {
  59844. tracks.removeEventListener("removetrack", updateHandler);
  59845. tracks.removeEventListener("addtrack", updateHandler);
  59846. tracks.removeEventListener("labelchange", updateHandler);
  59847. });
  59848. }
  59849. }
  59850. Component$1$1.registerComponent("TrackButton", TrackButton$1);
  59851. const MenuKeys$1 = ["Tab", "Esc", "Up", "Down", "Right", "Left"];
  59852. class MenuItem$1 extends ClickableComponent$1 {
  59853. constructor(player, options2) {
  59854. super(player, options2);
  59855. this.selectable = options2.selectable;
  59856. this.isSelected_ = options2.selected || false;
  59857. this.multiSelectable = options2.multiSelectable;
  59858. this.selected(this.isSelected_);
  59859. if (this.selectable) {
  59860. if (this.multiSelectable) {
  59861. this.el_.setAttribute("role", "menuitemcheckbox");
  59862. } else {
  59863. this.el_.setAttribute("role", "menuitemradio");
  59864. }
  59865. } else {
  59866. this.el_.setAttribute("role", "menuitem");
  59867. }
  59868. }
  59869. createEl(type2, props, attrs) {
  59870. this.nonIconControl = true;
  59871. const el = super.createEl("li", Object.assign({
  59872. className: "vjs-menu-item",
  59873. tabIndex: -1
  59874. }, props), attrs);
  59875. el.replaceChild(createEl$1("span", {
  59876. className: "vjs-menu-item-text",
  59877. textContent: this.localize(this.options_.label)
  59878. }), el.querySelector(".vjs-icon-placeholder"));
  59879. return el;
  59880. }
  59881. handleKeyDown(event2) {
  59882. if (!MenuKeys$1.some((key) => keycode.isEventKey(event2, key))) {
  59883. super.handleKeyDown(event2);
  59884. }
  59885. }
  59886. handleClick(event2) {
  59887. this.selected(true);
  59888. }
  59889. selected(selected) {
  59890. if (this.selectable) {
  59891. if (selected) {
  59892. this.addClass("vjs-selected");
  59893. this.el_.setAttribute("aria-checked", "true");
  59894. this.controlText(", selected");
  59895. this.isSelected_ = true;
  59896. } else {
  59897. this.removeClass("vjs-selected");
  59898. this.el_.setAttribute("aria-checked", "false");
  59899. this.controlText("");
  59900. this.isSelected_ = false;
  59901. }
  59902. }
  59903. }
  59904. }
  59905. Component$1$1.registerComponent("MenuItem", MenuItem$1);
  59906. class TextTrackMenuItem$1 extends MenuItem$1 {
  59907. constructor(player, options2) {
  59908. const track = options2.track;
  59909. const tracks = player.textTracks();
  59910. options2.label = track.label || track.language || "Unknown";
  59911. options2.selected = track.mode === "showing";
  59912. super(player, options2);
  59913. this.track = track;
  59914. this.kinds = (options2.kinds || [options2.kind || this.track.kind]).filter(Boolean);
  59915. const changeHandler = (...args) => {
  59916. this.handleTracksChange.apply(this, args);
  59917. };
  59918. const selectedLanguageChangeHandler = (...args) => {
  59919. this.handleSelectedLanguageChange.apply(this, args);
  59920. };
  59921. player.on(["loadstart", "texttrackchange"], changeHandler);
  59922. tracks.addEventListener("change", changeHandler);
  59923. tracks.addEventListener("selectedlanguagechange", selectedLanguageChangeHandler);
  59924. this.on("dispose", function() {
  59925. player.off(["loadstart", "texttrackchange"], changeHandler);
  59926. tracks.removeEventListener("change", changeHandler);
  59927. tracks.removeEventListener("selectedlanguagechange", selectedLanguageChangeHandler);
  59928. });
  59929. if (tracks.onchange === void 0) {
  59930. let event2;
  59931. this.on(["tap", "click"], function() {
  59932. if (typeof window_1.Event !== "object") {
  59933. try {
  59934. event2 = new window_1.Event("change");
  59935. } catch (err) {
  59936. }
  59937. }
  59938. if (!event2) {
  59939. event2 = document_1.createEvent("Event");
  59940. event2.initEvent("change", true, true);
  59941. }
  59942. tracks.dispatchEvent(event2);
  59943. });
  59944. }
  59945. this.handleTracksChange();
  59946. }
  59947. handleClick(event2) {
  59948. const referenceTrack = this.track;
  59949. const tracks = this.player_.textTracks();
  59950. super.handleClick(event2);
  59951. if (!tracks) {
  59952. return;
  59953. }
  59954. for (let i2 = 0; i2 < tracks.length; i2++) {
  59955. const track = tracks[i2];
  59956. if (this.kinds.indexOf(track.kind) === -1) {
  59957. continue;
  59958. }
  59959. if (track === referenceTrack) {
  59960. if (track.mode !== "showing") {
  59961. track.mode = "showing";
  59962. }
  59963. } else if (track.mode !== "disabled") {
  59964. track.mode = "disabled";
  59965. }
  59966. }
  59967. }
  59968. handleTracksChange(event2) {
  59969. const shouldBeSelected = this.track.mode === "showing";
  59970. if (shouldBeSelected !== this.isSelected_) {
  59971. this.selected(shouldBeSelected);
  59972. }
  59973. }
  59974. handleSelectedLanguageChange(event2) {
  59975. if (this.track.mode === "showing") {
  59976. const selectedLanguage = this.player_.cache_.selectedLanguage;
  59977. if (selectedLanguage && selectedLanguage.enabled && selectedLanguage.language === this.track.language && selectedLanguage.kind !== this.track.kind) {
  59978. return;
  59979. }
  59980. this.player_.cache_.selectedLanguage = {
  59981. enabled: true,
  59982. language: this.track.language,
  59983. kind: this.track.kind
  59984. };
  59985. }
  59986. }
  59987. dispose() {
  59988. this.track = null;
  59989. super.dispose();
  59990. }
  59991. }
  59992. Component$1$1.registerComponent("TextTrackMenuItem", TextTrackMenuItem$1);
  59993. class OffTextTrackMenuItem$1 extends TextTrackMenuItem$1 {
  59994. constructor(player, options2) {
  59995. options2.track = {
  59996. player,
  59997. kind: options2.kind,
  59998. kinds: options2.kinds,
  59999. default: false,
  60000. mode: "disabled"
  60001. };
  60002. if (!options2.kinds) {
  60003. options2.kinds = [options2.kind];
  60004. }
  60005. if (options2.label) {
  60006. options2.track.label = options2.label;
  60007. } else {
  60008. options2.track.label = options2.kinds.join(" and ") + " off";
  60009. }
  60010. options2.selectable = true;
  60011. options2.multiSelectable = false;
  60012. super(player, options2);
  60013. }
  60014. handleTracksChange(event2) {
  60015. const tracks = this.player().textTracks();
  60016. let shouldBeSelected = true;
  60017. for (let i2 = 0, l = tracks.length; i2 < l; i2++) {
  60018. const track = tracks[i2];
  60019. if (this.options_.kinds.indexOf(track.kind) > -1 && track.mode === "showing") {
  60020. shouldBeSelected = false;
  60021. break;
  60022. }
  60023. }
  60024. if (shouldBeSelected !== this.isSelected_) {
  60025. this.selected(shouldBeSelected);
  60026. }
  60027. }
  60028. handleSelectedLanguageChange(event2) {
  60029. const tracks = this.player().textTracks();
  60030. let allHidden = true;
  60031. for (let i2 = 0, l = tracks.length; i2 < l; i2++) {
  60032. const track = tracks[i2];
  60033. if (["captions", "descriptions", "subtitles"].indexOf(track.kind) > -1 && track.mode === "showing") {
  60034. allHidden = false;
  60035. break;
  60036. }
  60037. }
  60038. if (allHidden) {
  60039. this.player_.cache_.selectedLanguage = {
  60040. enabled: false
  60041. };
  60042. }
  60043. }
  60044. handleLanguagechange() {
  60045. this.$(".vjs-menu-item-text").textContent = this.player_.localize(this.options_.label);
  60046. super.handleLanguagechange();
  60047. }
  60048. }
  60049. Component$1$1.registerComponent("OffTextTrackMenuItem", OffTextTrackMenuItem$1);
  60050. class TextTrackButton$1 extends TrackButton$1 {
  60051. constructor(player, options2 = {}) {
  60052. options2.tracks = player.textTracks();
  60053. super(player, options2);
  60054. }
  60055. createItems(items = [], TrackMenuItem = TextTrackMenuItem$1) {
  60056. let label2;
  60057. if (this.label_) {
  60058. label2 = `${this.label_} off`;
  60059. }
  60060. items.push(new OffTextTrackMenuItem$1(this.player_, {
  60061. kinds: this.kinds_,
  60062. kind: this.kind_,
  60063. label: label2
  60064. }));
  60065. this.hideThreshold_ += 1;
  60066. const tracks = this.player_.textTracks();
  60067. if (!Array.isArray(this.kinds_)) {
  60068. this.kinds_ = [this.kind_];
  60069. }
  60070. for (let i2 = 0; i2 < tracks.length; i2++) {
  60071. const track = tracks[i2];
  60072. if (this.kinds_.indexOf(track.kind) > -1) {
  60073. const item = new TrackMenuItem(this.player_, {
  60074. track,
  60075. kinds: this.kinds_,
  60076. kind: this.kind_,
  60077. selectable: true,
  60078. multiSelectable: false
  60079. });
  60080. item.addClass(`vjs-${track.kind}-menu-item`);
  60081. items.push(item);
  60082. }
  60083. }
  60084. return items;
  60085. }
  60086. }
  60087. Component$1$1.registerComponent("TextTrackButton", TextTrackButton$1);
  60088. class ChaptersTrackMenuItem$1 extends MenuItem$1 {
  60089. constructor(player, options2) {
  60090. const track = options2.track;
  60091. const cue = options2.cue;
  60092. const currentTime = player.currentTime();
  60093. options2.selectable = true;
  60094. options2.multiSelectable = false;
  60095. options2.label = cue.text;
  60096. options2.selected = cue.startTime <= currentTime && currentTime < cue.endTime;
  60097. super(player, options2);
  60098. this.track = track;
  60099. this.cue = cue;
  60100. }
  60101. handleClick(event2) {
  60102. super.handleClick();
  60103. this.player_.currentTime(this.cue.startTime);
  60104. }
  60105. }
  60106. Component$1$1.registerComponent("ChaptersTrackMenuItem", ChaptersTrackMenuItem$1);
  60107. class ChaptersButton$1 extends TextTrackButton$1 {
  60108. constructor(player, options2, ready) {
  60109. super(player, options2, ready);
  60110. this.selectCurrentItem_ = () => {
  60111. this.items.forEach((item) => {
  60112. item.selected(this.track_.activeCues[0] === item.cue);
  60113. });
  60114. };
  60115. }
  60116. buildCSSClass() {
  60117. return `vjs-chapters-button ${super.buildCSSClass()}`;
  60118. }
  60119. buildWrapperCSSClass() {
  60120. return `vjs-chapters-button ${super.buildWrapperCSSClass()}`;
  60121. }
  60122. update(event2) {
  60123. if (event2 && event2.track && event2.track.kind !== "chapters") {
  60124. return;
  60125. }
  60126. const track = this.findChaptersTrack();
  60127. if (track !== this.track_) {
  60128. this.setTrack(track);
  60129. super.update();
  60130. } else if (!this.items || track && track.cues && track.cues.length !== this.items.length) {
  60131. super.update();
  60132. }
  60133. }
  60134. setTrack(track) {
  60135. if (this.track_ === track) {
  60136. return;
  60137. }
  60138. if (!this.updateHandler_) {
  60139. this.updateHandler_ = this.update.bind(this);
  60140. }
  60141. if (this.track_) {
  60142. const remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);
  60143. if (remoteTextTrackEl) {
  60144. remoteTextTrackEl.removeEventListener("load", this.updateHandler_);
  60145. }
  60146. this.track_.removeEventListener("cuechange", this.selectCurrentItem_);
  60147. this.track_ = null;
  60148. }
  60149. this.track_ = track;
  60150. if (this.track_) {
  60151. this.track_.mode = "hidden";
  60152. const remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);
  60153. if (remoteTextTrackEl) {
  60154. remoteTextTrackEl.addEventListener("load", this.updateHandler_);
  60155. }
  60156. this.track_.addEventListener("cuechange", this.selectCurrentItem_);
  60157. }
  60158. }
  60159. findChaptersTrack() {
  60160. const tracks = this.player_.textTracks() || [];
  60161. for (let i2 = tracks.length - 1; i2 >= 0; i2--) {
  60162. const track = tracks[i2];
  60163. if (track.kind === this.kind_) {
  60164. return track;
  60165. }
  60166. }
  60167. }
  60168. getMenuCaption() {
  60169. if (this.track_ && this.track_.label) {
  60170. return this.track_.label;
  60171. }
  60172. return this.localize(toTitleCase$1$1(this.kind_));
  60173. }
  60174. createMenu() {
  60175. this.options_.title = this.getMenuCaption();
  60176. return super.createMenu();
  60177. }
  60178. createItems() {
  60179. const items = [];
  60180. if (!this.track_) {
  60181. return items;
  60182. }
  60183. const cues = this.track_.cues;
  60184. if (!cues) {
  60185. return items;
  60186. }
  60187. for (let i2 = 0, l = cues.length; i2 < l; i2++) {
  60188. const cue = cues[i2];
  60189. const mi = new ChaptersTrackMenuItem$1(this.player_, {
  60190. track: this.track_,
  60191. cue
  60192. });
  60193. items.push(mi);
  60194. }
  60195. return items;
  60196. }
  60197. }
  60198. ChaptersButton$1.prototype.kind_ = "chapters";
  60199. ChaptersButton$1.prototype.controlText_ = "Chapters";
  60200. Component$1$1.registerComponent("ChaptersButton", ChaptersButton$1);
  60201. class DescriptionsButton$1 extends TextTrackButton$1 {
  60202. constructor(player, options2, ready) {
  60203. super(player, options2, ready);
  60204. const tracks = player.textTracks();
  60205. const changeHandler = bind_(this, this.handleTracksChange);
  60206. tracks.addEventListener("change", changeHandler);
  60207. this.on("dispose", function() {
  60208. tracks.removeEventListener("change", changeHandler);
  60209. });
  60210. }
  60211. handleTracksChange(event2) {
  60212. const tracks = this.player().textTracks();
  60213. let disabled = false;
  60214. for (let i2 = 0, l = tracks.length; i2 < l; i2++) {
  60215. const track = tracks[i2];
  60216. if (track.kind !== this.kind_ && track.mode === "showing") {
  60217. disabled = true;
  60218. break;
  60219. }
  60220. }
  60221. if (disabled) {
  60222. this.disable();
  60223. } else {
  60224. this.enable();
  60225. }
  60226. }
  60227. buildCSSClass() {
  60228. return `vjs-descriptions-button ${super.buildCSSClass()}`;
  60229. }
  60230. buildWrapperCSSClass() {
  60231. return `vjs-descriptions-button ${super.buildWrapperCSSClass()}`;
  60232. }
  60233. }
  60234. DescriptionsButton$1.prototype.kind_ = "descriptions";
  60235. DescriptionsButton$1.prototype.controlText_ = "Descriptions";
  60236. Component$1$1.registerComponent("DescriptionsButton", DescriptionsButton$1);
  60237. class SubtitlesButton$1 extends TextTrackButton$1 {
  60238. constructor(player, options2, ready) {
  60239. super(player, options2, ready);
  60240. }
  60241. buildCSSClass() {
  60242. return `vjs-subtitles-button ${super.buildCSSClass()}`;
  60243. }
  60244. buildWrapperCSSClass() {
  60245. return `vjs-subtitles-button ${super.buildWrapperCSSClass()}`;
  60246. }
  60247. }
  60248. SubtitlesButton$1.prototype.kind_ = "subtitles";
  60249. SubtitlesButton$1.prototype.controlText_ = "Subtitles";
  60250. Component$1$1.registerComponent("SubtitlesButton", SubtitlesButton$1);
  60251. class CaptionSettingsMenuItem$1 extends TextTrackMenuItem$1 {
  60252. constructor(player, options2) {
  60253. options2.track = {
  60254. player,
  60255. kind: options2.kind,
  60256. label: options2.kind + " settings",
  60257. selectable: false,
  60258. default: false,
  60259. mode: "disabled"
  60260. };
  60261. options2.selectable = false;
  60262. options2.name = "CaptionSettingsMenuItem";
  60263. super(player, options2);
  60264. this.addClass("vjs-texttrack-settings");
  60265. this.controlText(", opens " + options2.kind + " settings dialog");
  60266. }
  60267. handleClick(event2) {
  60268. this.player().getChild("textTrackSettings").open();
  60269. }
  60270. handleLanguagechange() {
  60271. this.$(".vjs-menu-item-text").textContent = this.player_.localize(this.options_.kind + " settings");
  60272. super.handleLanguagechange();
  60273. }
  60274. }
  60275. Component$1$1.registerComponent("CaptionSettingsMenuItem", CaptionSettingsMenuItem$1);
  60276. class CaptionsButton$1 extends TextTrackButton$1 {
  60277. constructor(player, options2, ready) {
  60278. super(player, options2, ready);
  60279. }
  60280. buildCSSClass() {
  60281. return `vjs-captions-button ${super.buildCSSClass()}`;
  60282. }
  60283. buildWrapperCSSClass() {
  60284. return `vjs-captions-button ${super.buildWrapperCSSClass()}`;
  60285. }
  60286. createItems() {
  60287. const items = [];
  60288. if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks) && this.player().getChild("textTrackSettings")) {
  60289. items.push(new CaptionSettingsMenuItem$1(this.player_, {
  60290. kind: this.kind_
  60291. }));
  60292. this.hideThreshold_ += 1;
  60293. }
  60294. return super.createItems(items);
  60295. }
  60296. }
  60297. CaptionsButton$1.prototype.kind_ = "captions";
  60298. CaptionsButton$1.prototype.controlText_ = "Captions";
  60299. Component$1$1.registerComponent("CaptionsButton", CaptionsButton$1);
  60300. class SubsCapsMenuItem$1 extends TextTrackMenuItem$1 {
  60301. createEl(type2, props, attrs) {
  60302. const el = super.createEl(type2, props, attrs);
  60303. const parentSpan = el.querySelector(".vjs-menu-item-text");
  60304. if (this.options_.track.kind === "captions") {
  60305. parentSpan.appendChild(createEl$1("span", {
  60306. className: "vjs-icon-placeholder"
  60307. }, {
  60308. "aria-hidden": true
  60309. }));
  60310. parentSpan.appendChild(createEl$1("span", {
  60311. className: "vjs-control-text",
  60312. textContent: ` ${this.localize("Captions")}`
  60313. }));
  60314. }
  60315. return el;
  60316. }
  60317. }
  60318. Component$1$1.registerComponent("SubsCapsMenuItem", SubsCapsMenuItem$1);
  60319. class SubsCapsButton$1 extends TextTrackButton$1 {
  60320. constructor(player, options2 = {}) {
  60321. super(player, options2);
  60322. this.label_ = "subtitles";
  60323. if (["en", "en-us", "en-ca", "fr-ca"].indexOf(this.player_.language_) > -1) {
  60324. this.label_ = "captions";
  60325. }
  60326. this.menuButton_.controlText(toTitleCase$1$1(this.label_));
  60327. }
  60328. buildCSSClass() {
  60329. return `vjs-subs-caps-button ${super.buildCSSClass()}`;
  60330. }
  60331. buildWrapperCSSClass() {
  60332. return `vjs-subs-caps-button ${super.buildWrapperCSSClass()}`;
  60333. }
  60334. createItems() {
  60335. let items = [];
  60336. if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks) && this.player().getChild("textTrackSettings")) {
  60337. items.push(new CaptionSettingsMenuItem$1(this.player_, {
  60338. kind: this.label_
  60339. }));
  60340. this.hideThreshold_ += 1;
  60341. }
  60342. items = super.createItems(items, SubsCapsMenuItem$1);
  60343. return items;
  60344. }
  60345. }
  60346. SubsCapsButton$1.prototype.kinds_ = ["captions", "subtitles"];
  60347. SubsCapsButton$1.prototype.controlText_ = "Subtitles";
  60348. Component$1$1.registerComponent("SubsCapsButton", SubsCapsButton$1);
  60349. class AudioTrackMenuItem$1 extends MenuItem$1 {
  60350. constructor(player, options2) {
  60351. const track = options2.track;
  60352. const tracks = player.audioTracks();
  60353. options2.label = track.label || track.language || "Unknown";
  60354. options2.selected = track.enabled;
  60355. super(player, options2);
  60356. this.track = track;
  60357. this.addClass(`vjs-${track.kind}-menu-item`);
  60358. const changeHandler = (...args) => {
  60359. this.handleTracksChange.apply(this, args);
  60360. };
  60361. tracks.addEventListener("change", changeHandler);
  60362. this.on("dispose", () => {
  60363. tracks.removeEventListener("change", changeHandler);
  60364. });
  60365. }
  60366. createEl(type2, props, attrs) {
  60367. const el = super.createEl(type2, props, attrs);
  60368. const parentSpan = el.querySelector(".vjs-menu-item-text");
  60369. if (this.options_.track.kind === "main-desc") {
  60370. parentSpan.appendChild(createEl$1("span", {
  60371. className: "vjs-icon-placeholder"
  60372. }, {
  60373. "aria-hidden": true
  60374. }));
  60375. parentSpan.appendChild(createEl$1("span", {
  60376. className: "vjs-control-text",
  60377. textContent: " " + this.localize("Descriptions")
  60378. }));
  60379. }
  60380. return el;
  60381. }
  60382. handleClick(event2) {
  60383. super.handleClick(event2);
  60384. this.track.enabled = true;
  60385. if (this.player_.tech_.featuresNativeAudioTracks) {
  60386. const tracks = this.player_.audioTracks();
  60387. for (let i2 = 0; i2 < tracks.length; i2++) {
  60388. const track = tracks[i2];
  60389. if (track === this.track) {
  60390. continue;
  60391. }
  60392. track.enabled = track === this.track;
  60393. }
  60394. }
  60395. }
  60396. handleTracksChange(event2) {
  60397. this.selected(this.track.enabled);
  60398. }
  60399. }
  60400. Component$1$1.registerComponent("AudioTrackMenuItem", AudioTrackMenuItem$1);
  60401. class AudioTrackButton$1 extends TrackButton$1 {
  60402. constructor(player, options2 = {}) {
  60403. options2.tracks = player.audioTracks();
  60404. super(player, options2);
  60405. }
  60406. buildCSSClass() {
  60407. return `vjs-audio-button ${super.buildCSSClass()}`;
  60408. }
  60409. buildWrapperCSSClass() {
  60410. return `vjs-audio-button ${super.buildWrapperCSSClass()}`;
  60411. }
  60412. createItems(items = []) {
  60413. this.hideThreshold_ = 1;
  60414. const tracks = this.player_.audioTracks();
  60415. for (let i2 = 0; i2 < tracks.length; i2++) {
  60416. const track = tracks[i2];
  60417. items.push(new AudioTrackMenuItem$1(this.player_, {
  60418. track,
  60419. selectable: true,
  60420. multiSelectable: false
  60421. }));
  60422. }
  60423. return items;
  60424. }
  60425. }
  60426. AudioTrackButton$1.prototype.controlText_ = "Audio Track";
  60427. Component$1$1.registerComponent("AudioTrackButton", AudioTrackButton$1);
  60428. class PlaybackRateMenuItem$1 extends MenuItem$1 {
  60429. constructor(player, options2) {
  60430. const label2 = options2.rate;
  60431. const rate = parseFloat(label2, 10);
  60432. options2.label = label2;
  60433. options2.selected = rate === player.playbackRate();
  60434. options2.selectable = true;
  60435. options2.multiSelectable = false;
  60436. super(player, options2);
  60437. this.label = label2;
  60438. this.rate = rate;
  60439. this.on(player, "ratechange", (e) => this.update(e));
  60440. }
  60441. handleClick(event2) {
  60442. super.handleClick();
  60443. this.player().playbackRate(this.rate);
  60444. }
  60445. update(event2) {
  60446. this.selected(this.player().playbackRate() === this.rate);
  60447. }
  60448. }
  60449. PlaybackRateMenuItem$1.prototype.contentElType = "button";
  60450. Component$1$1.registerComponent("PlaybackRateMenuItem", PlaybackRateMenuItem$1);
  60451. class PlaybackRateMenuButton$1 extends MenuButton$1 {
  60452. constructor(player, options2) {
  60453. super(player, options2);
  60454. this.menuButton_.el_.setAttribute("aria-describedby", this.labelElId_);
  60455. this.updateVisibility();
  60456. this.updateLabel();
  60457. this.on(player, "loadstart", (e) => this.updateVisibility(e));
  60458. this.on(player, "ratechange", (e) => this.updateLabel(e));
  60459. this.on(player, "playbackrateschange", (e) => this.handlePlaybackRateschange(e));
  60460. }
  60461. createEl() {
  60462. const el = super.createEl();
  60463. this.labelElId_ = "vjs-playback-rate-value-label-" + this.id_;
  60464. this.labelEl_ = createEl$1("div", {
  60465. className: "vjs-playback-rate-value",
  60466. id: this.labelElId_,
  60467. textContent: "1x"
  60468. });
  60469. el.appendChild(this.labelEl_);
  60470. return el;
  60471. }
  60472. dispose() {
  60473. this.labelEl_ = null;
  60474. super.dispose();
  60475. }
  60476. buildCSSClass() {
  60477. return `vjs-playback-rate ${super.buildCSSClass()}`;
  60478. }
  60479. buildWrapperCSSClass() {
  60480. return `vjs-playback-rate ${super.buildWrapperCSSClass()}`;
  60481. }
  60482. createItems() {
  60483. const rates = this.playbackRates();
  60484. const items = [];
  60485. for (let i2 = rates.length - 1; i2 >= 0; i2--) {
  60486. items.push(new PlaybackRateMenuItem$1(this.player(), {
  60487. rate: rates[i2] + "x"
  60488. }));
  60489. }
  60490. return items;
  60491. }
  60492. handlePlaybackRateschange(event2) {
  60493. this.update();
  60494. }
  60495. playbackRates() {
  60496. const player = this.player();
  60497. return player.playbackRates && player.playbackRates() || [];
  60498. }
  60499. playbackRateSupported() {
  60500. return this.player().tech_ && this.player().tech_.featuresPlaybackRate && this.playbackRates() && this.playbackRates().length > 0;
  60501. }
  60502. updateVisibility(event2) {
  60503. if (this.playbackRateSupported()) {
  60504. this.removeClass("vjs-hidden");
  60505. } else {
  60506. this.addClass("vjs-hidden");
  60507. }
  60508. }
  60509. updateLabel(event2) {
  60510. if (this.playbackRateSupported()) {
  60511. this.labelEl_.textContent = this.player().playbackRate() + "x";
  60512. }
  60513. }
  60514. }
  60515. PlaybackRateMenuButton$1.prototype.controlText_ = "Playback Rate";
  60516. Component$1$1.registerComponent("PlaybackRateMenuButton", PlaybackRateMenuButton$1);
  60517. class Spacer$1 extends Component$1$1 {
  60518. buildCSSClass() {
  60519. return `vjs-spacer ${super.buildCSSClass()}`;
  60520. }
  60521. createEl(tag = "div", props = {}, attributes = {}) {
  60522. if (!props.className) {
  60523. props.className = this.buildCSSClass();
  60524. }
  60525. return super.createEl(tag, props, attributes);
  60526. }
  60527. }
  60528. Component$1$1.registerComponent("Spacer", Spacer$1);
  60529. class CustomControlSpacer$1 extends Spacer$1 {
  60530. buildCSSClass() {
  60531. return `vjs-custom-control-spacer ${super.buildCSSClass()}`;
  60532. }
  60533. createEl() {
  60534. return super.createEl("div", {
  60535. className: this.buildCSSClass(),
  60536. textContent: "\xA0"
  60537. });
  60538. }
  60539. }
  60540. Component$1$1.registerComponent("CustomControlSpacer", CustomControlSpacer$1);
  60541. class ControlBar$1 extends Component$1$1 {
  60542. createEl() {
  60543. return super.createEl("div", {
  60544. className: "vjs-control-bar",
  60545. dir: "ltr"
  60546. });
  60547. }
  60548. }
  60549. ControlBar$1.prototype.options_ = {
  60550. children: ["playToggle", "skipBackward", "skipForward", "volumePanel", "currentTimeDisplay", "timeDivider", "durationDisplay", "progressControl", "liveDisplay", "seekToLive", "remainingTimeDisplay", "customControlSpacer", "playbackRateMenuButton", "chaptersButton", "descriptionsButton", "subsCapsButton", "audioTrackButton", "fullscreenToggle"]
  60551. };
  60552. if ("exitPictureInPicture" in document_1) {
  60553. ControlBar$1.prototype.options_.children.splice(ControlBar$1.prototype.options_.children.length - 1, 0, "pictureInPictureToggle");
  60554. }
  60555. Component$1$1.registerComponent("ControlBar", ControlBar$1);
  60556. class ErrorDisplay$1 extends ModalDialog$1 {
  60557. constructor(player, options2) {
  60558. super(player, options2);
  60559. this.on(player, "error", (e) => this.open(e));
  60560. }
  60561. buildCSSClass() {
  60562. return `vjs-error-display ${super.buildCSSClass()}`;
  60563. }
  60564. content() {
  60565. const error = this.player().error();
  60566. return error ? this.localize(error.message) : "";
  60567. }
  60568. }
  60569. ErrorDisplay$1.prototype.options_ = Object.assign({}, ModalDialog$1.prototype.options_, {
  60570. pauseOnOpen: false,
  60571. fillAlways: true,
  60572. temporary: false,
  60573. uncloseable: true
  60574. });
  60575. Component$1$1.registerComponent("ErrorDisplay", ErrorDisplay$1);
  60576. const LOCAL_STORAGE_KEY$1$1 = "vjs-text-track-settings";
  60577. const COLOR_BLACK$1 = ["#000", "Black"];
  60578. const COLOR_BLUE$1 = ["#00F", "Blue"];
  60579. const COLOR_CYAN$1 = ["#0FF", "Cyan"];
  60580. const COLOR_GREEN$1 = ["#0F0", "Green"];
  60581. const COLOR_MAGENTA$1 = ["#F0F", "Magenta"];
  60582. const COLOR_RED$1 = ["#F00", "Red"];
  60583. const COLOR_WHITE$1 = ["#FFF", "White"];
  60584. const COLOR_YELLOW$1 = ["#FF0", "Yellow"];
  60585. const OPACITY_OPAQUE$1 = ["1", "Opaque"];
  60586. const OPACITY_SEMI$1 = ["0.5", "Semi-Transparent"];
  60587. const OPACITY_TRANS$1 = ["0", "Transparent"];
  60588. const selectConfigs$1 = {
  60589. backgroundColor: {
  60590. selector: ".vjs-bg-color > select",
  60591. id: "captions-background-color-%s",
  60592. label: "Color",
  60593. options: [COLOR_BLACK$1, COLOR_WHITE$1, COLOR_RED$1, COLOR_GREEN$1, COLOR_BLUE$1, COLOR_YELLOW$1, COLOR_MAGENTA$1, COLOR_CYAN$1]
  60594. },
  60595. backgroundOpacity: {
  60596. selector: ".vjs-bg-opacity > select",
  60597. id: "captions-background-opacity-%s",
  60598. label: "Opacity",
  60599. options: [OPACITY_OPAQUE$1, OPACITY_SEMI$1, OPACITY_TRANS$1]
  60600. },
  60601. color: {
  60602. selector: ".vjs-text-color > select",
  60603. id: "captions-foreground-color-%s",
  60604. label: "Color",
  60605. options: [COLOR_WHITE$1, COLOR_BLACK$1, COLOR_RED$1, COLOR_GREEN$1, COLOR_BLUE$1, COLOR_YELLOW$1, COLOR_MAGENTA$1, COLOR_CYAN$1]
  60606. },
  60607. edgeStyle: {
  60608. selector: ".vjs-edge-style > select",
  60609. id: "%s",
  60610. label: "Text Edge Style",
  60611. options: [["none", "None"], ["raised", "Raised"], ["depressed", "Depressed"], ["uniform", "Uniform"], ["dropshadow", "Dropshadow"]]
  60612. },
  60613. fontFamily: {
  60614. selector: ".vjs-font-family > select",
  60615. id: "captions-font-family-%s",
  60616. label: "Font Family",
  60617. options: [["proportionalSansSerif", "Proportional Sans-Serif"], ["monospaceSansSerif", "Monospace Sans-Serif"], ["proportionalSerif", "Proportional Serif"], ["monospaceSerif", "Monospace Serif"], ["casual", "Casual"], ["script", "Script"], ["small-caps", "Small Caps"]]
  60618. },
  60619. fontPercent: {
  60620. selector: ".vjs-font-percent > select",
  60621. id: "captions-font-size-%s",
  60622. label: "Font Size",
  60623. options: [["0.50", "50%"], ["0.75", "75%"], ["1.00", "100%"], ["1.25", "125%"], ["1.50", "150%"], ["1.75", "175%"], ["2.00", "200%"], ["3.00", "300%"], ["4.00", "400%"]],
  60624. default: 2,
  60625. parser: (v) => v === "1.00" ? null : Number(v)
  60626. },
  60627. textOpacity: {
  60628. selector: ".vjs-text-opacity > select",
  60629. id: "captions-foreground-opacity-%s",
  60630. label: "Opacity",
  60631. options: [OPACITY_OPAQUE$1, OPACITY_SEMI$1]
  60632. },
  60633. windowColor: {
  60634. selector: ".vjs-window-color > select",
  60635. id: "captions-window-color-%s",
  60636. label: "Color"
  60637. },
  60638. windowOpacity: {
  60639. selector: ".vjs-window-opacity > select",
  60640. id: "captions-window-opacity-%s",
  60641. label: "Opacity",
  60642. options: [OPACITY_TRANS$1, OPACITY_SEMI$1, OPACITY_OPAQUE$1]
  60643. }
  60644. };
  60645. selectConfigs$1.windowColor.options = selectConfigs$1.backgroundColor.options;
  60646. function parseOptionValue$1(value, parser2) {
  60647. if (parser2) {
  60648. value = parser2(value);
  60649. }
  60650. if (value && value !== "none") {
  60651. return value;
  60652. }
  60653. }
  60654. function getSelectedOptionValue$1(el, parser2) {
  60655. const value = el.options[el.options.selectedIndex].value;
  60656. return parseOptionValue$1(value, parser2);
  60657. }
  60658. function setSelectedOption$1(el, value, parser2) {
  60659. if (!value) {
  60660. return;
  60661. }
  60662. for (let i2 = 0; i2 < el.options.length; i2++) {
  60663. if (parseOptionValue$1(el.options[i2].value, parser2) === value) {
  60664. el.selectedIndex = i2;
  60665. break;
  60666. }
  60667. }
  60668. }
  60669. class TextTrackSettings$1 extends ModalDialog$1 {
  60670. constructor(player, options2) {
  60671. options2.temporary = false;
  60672. super(player, options2);
  60673. this.updateDisplay = this.updateDisplay.bind(this);
  60674. this.fill();
  60675. this.hasBeenOpened_ = this.hasBeenFilled_ = true;
  60676. this.endDialog = createEl$1("p", {
  60677. className: "vjs-control-text",
  60678. textContent: this.localize("End of dialog window.")
  60679. });
  60680. this.el().appendChild(this.endDialog);
  60681. this.setDefaults();
  60682. if (options2.persistTextTrackSettings === void 0) {
  60683. this.options_.persistTextTrackSettings = this.options_.playerOptions.persistTextTrackSettings;
  60684. }
  60685. this.on(this.$(".vjs-done-button"), "click", () => {
  60686. this.saveSettings();
  60687. this.close();
  60688. });
  60689. this.on(this.$(".vjs-default-button"), "click", () => {
  60690. this.setDefaults();
  60691. this.updateDisplay();
  60692. });
  60693. each$1(selectConfigs$1, (config) => {
  60694. this.on(this.$(config.selector), "change", this.updateDisplay);
  60695. });
  60696. if (this.options_.persistTextTrackSettings) {
  60697. this.restoreSettings();
  60698. }
  60699. }
  60700. dispose() {
  60701. this.endDialog = null;
  60702. super.dispose();
  60703. }
  60704. createElSelect_(key, legendId = "", type2 = "label") {
  60705. const config = selectConfigs$1[key];
  60706. const id = config.id.replace("%s", this.id_);
  60707. const selectLabelledbyIds = [legendId, id].join(" ").trim();
  60708. return [`<${type2} id="${id}" class="${type2 === "label" ? "vjs-label" : ""}">`, this.localize(config.label), `</${type2}>`, `<select aria-labelledby="${selectLabelledbyIds}">`].concat(config.options.map((o) => {
  60709. const optionId = id + "-" + o[1].replace(/\W+/g, "");
  60710. return [`<option id="${optionId}" value="${o[0]}" `, `aria-labelledby="${selectLabelledbyIds} ${optionId}">`, this.localize(o[1]), "</option>"].join("");
  60711. })).concat("</select>").join("");
  60712. }
  60713. createElFgColor_() {
  60714. const legendId = `captions-text-legend-${this.id_}`;
  60715. return ['<fieldset class="vjs-fg vjs-track-setting">', `<legend id="${legendId}">`, this.localize("Text"), "</legend>", '<span class="vjs-text-color">', this.createElSelect_("color", legendId), "</span>", '<span class="vjs-text-opacity vjs-opacity">', this.createElSelect_("textOpacity", legendId), "</span>", "</fieldset>"].join("");
  60716. }
  60717. createElBgColor_() {
  60718. const legendId = `captions-background-${this.id_}`;
  60719. return ['<fieldset class="vjs-bg vjs-track-setting">', `<legend id="${legendId}">`, this.localize("Text Background"), "</legend>", '<span class="vjs-bg-color">', this.createElSelect_("backgroundColor", legendId), "</span>", '<span class="vjs-bg-opacity vjs-opacity">', this.createElSelect_("backgroundOpacity", legendId), "</span>", "</fieldset>"].join("");
  60720. }
  60721. createElWinColor_() {
  60722. const legendId = `captions-window-${this.id_}`;
  60723. return ['<fieldset class="vjs-window vjs-track-setting">', `<legend id="${legendId}">`, this.localize("Caption Area Background"), "</legend>", '<span class="vjs-window-color">', this.createElSelect_("windowColor", legendId), "</span>", '<span class="vjs-window-opacity vjs-opacity">', this.createElSelect_("windowOpacity", legendId), "</span>", "</fieldset>"].join("");
  60724. }
  60725. createElColors_() {
  60726. return createEl$1("div", {
  60727. className: "vjs-track-settings-colors",
  60728. innerHTML: [this.createElFgColor_(), this.createElBgColor_(), this.createElWinColor_()].join("")
  60729. });
  60730. }
  60731. createElFont_() {
  60732. return createEl$1("div", {
  60733. className: "vjs-track-settings-font",
  60734. innerHTML: ['<fieldset class="vjs-font-percent vjs-track-setting">', this.createElSelect_("fontPercent", "", "legend"), "</fieldset>", '<fieldset class="vjs-edge-style vjs-track-setting">', this.createElSelect_("edgeStyle", "", "legend"), "</fieldset>", '<fieldset class="vjs-font-family vjs-track-setting">', this.createElSelect_("fontFamily", "", "legend"), "</fieldset>"].join("")
  60735. });
  60736. }
  60737. createElControls_() {
  60738. const defaultsDescription = this.localize("restore all settings to the default values");
  60739. return createEl$1("div", {
  60740. className: "vjs-track-settings-controls",
  60741. innerHTML: [`<button type="button" class="vjs-default-button" title="${defaultsDescription}">`, this.localize("Reset"), `<span class="vjs-control-text"> ${defaultsDescription}</span>`, "</button>", `<button type="button" class="vjs-done-button">${this.localize("Done")}</button>`].join("")
  60742. });
  60743. }
  60744. content() {
  60745. return [this.createElColors_(), this.createElFont_(), this.createElControls_()];
  60746. }
  60747. label() {
  60748. return this.localize("Caption Settings Dialog");
  60749. }
  60750. description() {
  60751. return this.localize("Beginning of dialog window. Escape will cancel and close the window.");
  60752. }
  60753. buildCSSClass() {
  60754. return super.buildCSSClass() + " vjs-text-track-settings";
  60755. }
  60756. getValues() {
  60757. return reduce$1(selectConfigs$1, (accum, config, key) => {
  60758. const value = getSelectedOptionValue$1(this.$(config.selector), config.parser);
  60759. if (value !== void 0) {
  60760. accum[key] = value;
  60761. }
  60762. return accum;
  60763. }, {});
  60764. }
  60765. setValues(values3) {
  60766. each$1(selectConfigs$1, (config, key) => {
  60767. setSelectedOption$1(this.$(config.selector), values3[key], config.parser);
  60768. });
  60769. }
  60770. setDefaults() {
  60771. each$1(selectConfigs$1, (config) => {
  60772. const index2 = config.hasOwnProperty("default") ? config.default : 0;
  60773. this.$(config.selector).selectedIndex = index2;
  60774. });
  60775. }
  60776. restoreSettings() {
  60777. let values3;
  60778. try {
  60779. values3 = JSON.parse(window_1.localStorage.getItem(LOCAL_STORAGE_KEY$1$1));
  60780. } catch (err) {
  60781. log$1$1.warn(err);
  60782. }
  60783. if (values3) {
  60784. this.setValues(values3);
  60785. }
  60786. }
  60787. saveSettings() {
  60788. if (!this.options_.persistTextTrackSettings) {
  60789. return;
  60790. }
  60791. const values3 = this.getValues();
  60792. try {
  60793. if (Object.keys(values3).length) {
  60794. window_1.localStorage.setItem(LOCAL_STORAGE_KEY$1$1, JSON.stringify(values3));
  60795. } else {
  60796. window_1.localStorage.removeItem(LOCAL_STORAGE_KEY$1$1);
  60797. }
  60798. } catch (err) {
  60799. log$1$1.warn(err);
  60800. }
  60801. }
  60802. updateDisplay() {
  60803. const ttDisplay = this.player_.getChild("textTrackDisplay");
  60804. if (ttDisplay) {
  60805. ttDisplay.updateDisplay();
  60806. }
  60807. }
  60808. conditionalBlur_() {
  60809. this.previouslyActiveEl_ = null;
  60810. const cb = this.player_.controlBar;
  60811. const subsCapsBtn = cb && cb.subsCapsButton;
  60812. const ccBtn = cb && cb.captionsButton;
  60813. if (subsCapsBtn) {
  60814. subsCapsBtn.focus();
  60815. } else if (ccBtn) {
  60816. ccBtn.focus();
  60817. }
  60818. }
  60819. handleLanguagechange() {
  60820. this.fill();
  60821. }
  60822. }
  60823. Component$1$1.registerComponent("TextTrackSettings", TextTrackSettings$1);
  60824. class ResizeManager$1 extends Component$1$1 {
  60825. constructor(player, options2) {
  60826. let RESIZE_OBSERVER_AVAILABLE = options2.ResizeObserver || window_1.ResizeObserver;
  60827. if (options2.ResizeObserver === null) {
  60828. RESIZE_OBSERVER_AVAILABLE = false;
  60829. }
  60830. const options_ = merge$1({
  60831. createEl: !RESIZE_OBSERVER_AVAILABLE,
  60832. reportTouchActivity: false
  60833. }, options2);
  60834. super(player, options_);
  60835. this.ResizeObserver = options2.ResizeObserver || window_1.ResizeObserver;
  60836. this.loadListener_ = null;
  60837. this.resizeObserver_ = null;
  60838. this.debouncedHandler_ = debounce$1(() => {
  60839. this.resizeHandler();
  60840. }, 100, false, this);
  60841. if (RESIZE_OBSERVER_AVAILABLE) {
  60842. this.resizeObserver_ = new this.ResizeObserver(this.debouncedHandler_);
  60843. this.resizeObserver_.observe(player.el());
  60844. } else {
  60845. this.loadListener_ = () => {
  60846. if (!this.el_ || !this.el_.contentWindow) {
  60847. return;
  60848. }
  60849. const debouncedHandler_ = this.debouncedHandler_;
  60850. let unloadListener_ = this.unloadListener_ = function() {
  60851. off$1(this, "resize", debouncedHandler_);
  60852. off$1(this, "unload", unloadListener_);
  60853. unloadListener_ = null;
  60854. };
  60855. on$1(this.el_.contentWindow, "unload", unloadListener_);
  60856. on$1(this.el_.contentWindow, "resize", debouncedHandler_);
  60857. };
  60858. this.one("load", this.loadListener_);
  60859. }
  60860. }
  60861. createEl() {
  60862. return super.createEl("iframe", {
  60863. className: "vjs-resize-manager",
  60864. tabIndex: -1,
  60865. title: this.localize("No content")
  60866. }, {
  60867. "aria-hidden": "true"
  60868. });
  60869. }
  60870. resizeHandler() {
  60871. if (!this.player_ || !this.player_.trigger) {
  60872. return;
  60873. }
  60874. this.player_.trigger("playerresize");
  60875. }
  60876. dispose() {
  60877. if (this.debouncedHandler_) {
  60878. this.debouncedHandler_.cancel();
  60879. }
  60880. if (this.resizeObserver_) {
  60881. if (this.player_.el()) {
  60882. this.resizeObserver_.unobserve(this.player_.el());
  60883. }
  60884. this.resizeObserver_.disconnect();
  60885. }
  60886. if (this.loadListener_) {
  60887. this.off("load", this.loadListener_);
  60888. }
  60889. if (this.el_ && this.el_.contentWindow && this.unloadListener_) {
  60890. this.unloadListener_.call(this.el_.contentWindow);
  60891. }
  60892. this.ResizeObserver = null;
  60893. this.resizeObserver = null;
  60894. this.debouncedHandler_ = null;
  60895. this.loadListener_ = null;
  60896. super.dispose();
  60897. }
  60898. }
  60899. Component$1$1.registerComponent("ResizeManager", ResizeManager$1);
  60900. const defaults$2 = {
  60901. trackingThreshold: 20,
  60902. liveTolerance: 15
  60903. };
  60904. class LiveTracker$1 extends Component$1$1 {
  60905. constructor(player, options2) {
  60906. const options_ = merge$1(defaults$2, options2, {
  60907. createEl: false
  60908. });
  60909. super(player, options_);
  60910. this.trackLiveHandler_ = () => this.trackLive_();
  60911. this.handlePlay_ = (e) => this.handlePlay(e);
  60912. this.handleFirstTimeupdate_ = (e) => this.handleFirstTimeupdate(e);
  60913. this.handleSeeked_ = (e) => this.handleSeeked(e);
  60914. this.seekToLiveEdge_ = (e) => this.seekToLiveEdge(e);
  60915. this.reset_();
  60916. this.on(this.player_, "durationchange", (e) => this.handleDurationchange(e));
  60917. this.on(this.player_, "canplay", () => this.toggleTracking());
  60918. }
  60919. trackLive_() {
  60920. const seekable3 = this.player_.seekable();
  60921. if (!seekable3 || !seekable3.length) {
  60922. return;
  60923. }
  60924. const newTime = Number(window_1.performance.now().toFixed(4));
  60925. const deltaTime = this.lastTime_ === -1 ? 0 : (newTime - this.lastTime_) / 1e3;
  60926. this.lastTime_ = newTime;
  60927. this.pastSeekEnd_ = this.pastSeekEnd() + deltaTime;
  60928. const liveCurrentTime = this.liveCurrentTime();
  60929. const currentTime = this.player_.currentTime();
  60930. let isBehind = this.player_.paused() || this.seekedBehindLive_ || Math.abs(liveCurrentTime - currentTime) > this.options_.liveTolerance;
  60931. if (!this.timeupdateSeen_ || liveCurrentTime === Infinity) {
  60932. isBehind = false;
  60933. }
  60934. if (isBehind !== this.behindLiveEdge_) {
  60935. this.behindLiveEdge_ = isBehind;
  60936. this.trigger("liveedgechange");
  60937. }
  60938. }
  60939. handleDurationchange() {
  60940. this.toggleTracking();
  60941. }
  60942. toggleTracking() {
  60943. if (this.player_.duration() === Infinity && this.liveWindow() >= this.options_.trackingThreshold) {
  60944. if (this.player_.options_.liveui) {
  60945. this.player_.addClass("vjs-liveui");
  60946. }
  60947. this.startTracking();
  60948. } else {
  60949. this.player_.removeClass("vjs-liveui");
  60950. this.stopTracking();
  60951. }
  60952. }
  60953. startTracking() {
  60954. if (this.isTracking()) {
  60955. return;
  60956. }
  60957. if (!this.timeupdateSeen_) {
  60958. this.timeupdateSeen_ = this.player_.hasStarted();
  60959. }
  60960. this.trackingInterval_ = this.setInterval(this.trackLiveHandler_, UPDATE_REFRESH_INTERVAL$1);
  60961. this.trackLive_();
  60962. this.on(this.player_, ["play", "pause"], this.trackLiveHandler_);
  60963. if (!this.timeupdateSeen_) {
  60964. this.one(this.player_, "play", this.handlePlay_);
  60965. this.one(this.player_, "timeupdate", this.handleFirstTimeupdate_);
  60966. } else {
  60967. this.on(this.player_, "seeked", this.handleSeeked_);
  60968. }
  60969. }
  60970. handleFirstTimeupdate() {
  60971. this.timeupdateSeen_ = true;
  60972. this.on(this.player_, "seeked", this.handleSeeked_);
  60973. }
  60974. handleSeeked() {
  60975. const timeDiff = Math.abs(this.liveCurrentTime() - this.player_.currentTime());
  60976. this.seekedBehindLive_ = this.nextSeekedFromUser_ && timeDiff > 2;
  60977. this.nextSeekedFromUser_ = false;
  60978. this.trackLive_();
  60979. }
  60980. handlePlay() {
  60981. this.one(this.player_, "timeupdate", this.seekToLiveEdge_);
  60982. }
  60983. reset_() {
  60984. this.lastTime_ = -1;
  60985. this.pastSeekEnd_ = 0;
  60986. this.lastSeekEnd_ = -1;
  60987. this.behindLiveEdge_ = true;
  60988. this.timeupdateSeen_ = false;
  60989. this.seekedBehindLive_ = false;
  60990. this.nextSeekedFromUser_ = false;
  60991. this.clearInterval(this.trackingInterval_);
  60992. this.trackingInterval_ = null;
  60993. this.off(this.player_, ["play", "pause"], this.trackLiveHandler_);
  60994. this.off(this.player_, "seeked", this.handleSeeked_);
  60995. this.off(this.player_, "play", this.handlePlay_);
  60996. this.off(this.player_, "timeupdate", this.handleFirstTimeupdate_);
  60997. this.off(this.player_, "timeupdate", this.seekToLiveEdge_);
  60998. }
  60999. nextSeekedFromUser() {
  61000. this.nextSeekedFromUser_ = true;
  61001. }
  61002. stopTracking() {
  61003. if (!this.isTracking()) {
  61004. return;
  61005. }
  61006. this.reset_();
  61007. this.trigger("liveedgechange");
  61008. }
  61009. seekableEnd() {
  61010. const seekable3 = this.player_.seekable();
  61011. const seekableEnds = [];
  61012. let i2 = seekable3 ? seekable3.length : 0;
  61013. while (i2--) {
  61014. seekableEnds.push(seekable3.end(i2));
  61015. }
  61016. return seekableEnds.length ? seekableEnds.sort()[seekableEnds.length - 1] : Infinity;
  61017. }
  61018. seekableStart() {
  61019. const seekable3 = this.player_.seekable();
  61020. const seekableStarts = [];
  61021. let i2 = seekable3 ? seekable3.length : 0;
  61022. while (i2--) {
  61023. seekableStarts.push(seekable3.start(i2));
  61024. }
  61025. return seekableStarts.length ? seekableStarts.sort()[0] : 0;
  61026. }
  61027. liveWindow() {
  61028. const liveCurrentTime = this.liveCurrentTime();
  61029. if (liveCurrentTime === Infinity) {
  61030. return 0;
  61031. }
  61032. return liveCurrentTime - this.seekableStart();
  61033. }
  61034. isLive() {
  61035. return this.isTracking();
  61036. }
  61037. atLiveEdge() {
  61038. return !this.behindLiveEdge();
  61039. }
  61040. liveCurrentTime() {
  61041. return this.pastSeekEnd() + this.seekableEnd();
  61042. }
  61043. pastSeekEnd() {
  61044. const seekableEnd = this.seekableEnd();
  61045. if (this.lastSeekEnd_ !== -1 && seekableEnd !== this.lastSeekEnd_) {
  61046. this.pastSeekEnd_ = 0;
  61047. }
  61048. this.lastSeekEnd_ = seekableEnd;
  61049. return this.pastSeekEnd_;
  61050. }
  61051. behindLiveEdge() {
  61052. return this.behindLiveEdge_;
  61053. }
  61054. isTracking() {
  61055. return typeof this.trackingInterval_ === "number";
  61056. }
  61057. seekToLiveEdge() {
  61058. this.seekedBehindLive_ = false;
  61059. if (this.atLiveEdge()) {
  61060. return;
  61061. }
  61062. this.nextSeekedFromUser_ = false;
  61063. this.player_.currentTime(this.liveCurrentTime());
  61064. }
  61065. dispose() {
  61066. this.stopTracking();
  61067. super.dispose();
  61068. }
  61069. }
  61070. Component$1$1.registerComponent("LiveTracker", LiveTracker$1);
  61071. class TitleBar extends Component$1$1 {
  61072. constructor(player, options2) {
  61073. super(player, options2);
  61074. this.on("statechanged", (e) => this.updateDom_());
  61075. this.updateDom_();
  61076. }
  61077. createEl() {
  61078. this.els = {
  61079. title: createEl$1("div", {
  61080. className: "vjs-title-bar-title",
  61081. id: `vjs-title-bar-title-${newGUID$1()}`
  61082. }),
  61083. description: createEl$1("div", {
  61084. className: "vjs-title-bar-description",
  61085. id: `vjs-title-bar-description-${newGUID$1()}`
  61086. })
  61087. };
  61088. return createEl$1("div", {
  61089. className: "vjs-title-bar"
  61090. }, {}, Object.values(this.els));
  61091. }
  61092. updateDom_() {
  61093. const tech = this.player_.tech_;
  61094. const techEl = tech && tech.el_;
  61095. const techAriaAttrs = {
  61096. title: "aria-labelledby",
  61097. description: "aria-describedby"
  61098. };
  61099. ["title", "description"].forEach((k) => {
  61100. const value = this.state[k];
  61101. const el = this.els[k];
  61102. const techAriaAttr = techAriaAttrs[k];
  61103. emptyEl$1(el);
  61104. if (value) {
  61105. textContent$1(el, value);
  61106. }
  61107. if (techEl) {
  61108. techEl.removeAttribute(techAriaAttr);
  61109. if (value) {
  61110. techEl.setAttribute(techAriaAttr, el.id);
  61111. }
  61112. }
  61113. });
  61114. if (this.state.title || this.state.description) {
  61115. this.show();
  61116. } else {
  61117. this.hide();
  61118. }
  61119. }
  61120. update(options2) {
  61121. this.setState(options2);
  61122. }
  61123. dispose() {
  61124. const tech = this.player_.tech_;
  61125. const techEl = tech && tech.el_;
  61126. if (techEl) {
  61127. techEl.removeAttribute("aria-labelledby");
  61128. techEl.removeAttribute("aria-describedby");
  61129. }
  61130. super.dispose();
  61131. this.els = null;
  61132. }
  61133. }
  61134. Component$1$1.registerComponent("TitleBar", TitleBar);
  61135. const sourcesetLoad$1 = (tech) => {
  61136. const el = tech.el();
  61137. if (el.hasAttribute("src")) {
  61138. tech.triggerSourceset(el.src);
  61139. return true;
  61140. }
  61141. const sources = tech.$$("source");
  61142. const srcUrls = [];
  61143. let src = "";
  61144. if (!sources.length) {
  61145. return false;
  61146. }
  61147. for (let i2 = 0; i2 < sources.length; i2++) {
  61148. const url = sources[i2].src;
  61149. if (url && srcUrls.indexOf(url) === -1) {
  61150. srcUrls.push(url);
  61151. }
  61152. }
  61153. if (!srcUrls.length) {
  61154. return false;
  61155. }
  61156. if (srcUrls.length === 1) {
  61157. src = srcUrls[0];
  61158. }
  61159. tech.triggerSourceset(src);
  61160. return true;
  61161. };
  61162. const innerHTMLDescriptorPolyfill$1 = Object.defineProperty({}, "innerHTML", {
  61163. get() {
  61164. return this.cloneNode(true).innerHTML;
  61165. },
  61166. set(v) {
  61167. const dummy = document_1.createElement(this.nodeName.toLowerCase());
  61168. dummy.innerHTML = v;
  61169. const docFrag = document_1.createDocumentFragment();
  61170. while (dummy.childNodes.length) {
  61171. docFrag.appendChild(dummy.childNodes[0]);
  61172. }
  61173. this.innerText = "";
  61174. window_1.Element.prototype.appendChild.call(this, docFrag);
  61175. return this.innerHTML;
  61176. }
  61177. });
  61178. const getDescriptor$1 = (priority, prop) => {
  61179. let descriptor = {};
  61180. for (let i2 = 0; i2 < priority.length; i2++) {
  61181. descriptor = Object.getOwnPropertyDescriptor(priority[i2], prop);
  61182. if (descriptor && descriptor.set && descriptor.get) {
  61183. break;
  61184. }
  61185. }
  61186. descriptor.enumerable = true;
  61187. descriptor.configurable = true;
  61188. return descriptor;
  61189. };
  61190. const getInnerHTMLDescriptor$1 = (tech) => getDescriptor$1([tech.el(), window_1.HTMLMediaElement.prototype, window_1.Element.prototype, innerHTMLDescriptorPolyfill$1], "innerHTML");
  61191. const firstSourceWatch$1 = function(tech) {
  61192. const el = tech.el();
  61193. if (el.resetSourceWatch_) {
  61194. return;
  61195. }
  61196. const old = {};
  61197. const innerDescriptor = getInnerHTMLDescriptor$1(tech);
  61198. const appendWrapper = (appendFn) => (...args) => {
  61199. const retval = appendFn.apply(el, args);
  61200. sourcesetLoad$1(tech);
  61201. return retval;
  61202. };
  61203. ["append", "appendChild", "insertAdjacentHTML"].forEach((k) => {
  61204. if (!el[k]) {
  61205. return;
  61206. }
  61207. old[k] = el[k];
  61208. el[k] = appendWrapper(old[k]);
  61209. });
  61210. Object.defineProperty(el, "innerHTML", merge$1(innerDescriptor, {
  61211. set: appendWrapper(innerDescriptor.set)
  61212. }));
  61213. el.resetSourceWatch_ = () => {
  61214. el.resetSourceWatch_ = null;
  61215. Object.keys(old).forEach((k) => {
  61216. el[k] = old[k];
  61217. });
  61218. Object.defineProperty(el, "innerHTML", innerDescriptor);
  61219. };
  61220. tech.one("sourceset", el.resetSourceWatch_);
  61221. };
  61222. const srcDescriptorPolyfill$1 = Object.defineProperty({}, "src", {
  61223. get() {
  61224. if (this.hasAttribute("src")) {
  61225. return getAbsoluteURL$1(window_1.Element.prototype.getAttribute.call(this, "src"));
  61226. }
  61227. return "";
  61228. },
  61229. set(v) {
  61230. window_1.Element.prototype.setAttribute.call(this, "src", v);
  61231. return v;
  61232. }
  61233. });
  61234. const getSrcDescriptor$1 = (tech) => getDescriptor$1([tech.el(), window_1.HTMLMediaElement.prototype, srcDescriptorPolyfill$1], "src");
  61235. const setupSourceset$1 = function(tech) {
  61236. if (!tech.featuresSourceset) {
  61237. return;
  61238. }
  61239. const el = tech.el();
  61240. if (el.resetSourceset_) {
  61241. return;
  61242. }
  61243. const srcDescriptor = getSrcDescriptor$1(tech);
  61244. const oldSetAttribute = el.setAttribute;
  61245. const oldLoad = el.load;
  61246. Object.defineProperty(el, "src", merge$1(srcDescriptor, {
  61247. set: (v) => {
  61248. const retval = srcDescriptor.set.call(el, v);
  61249. tech.triggerSourceset(el.src);
  61250. return retval;
  61251. }
  61252. }));
  61253. el.setAttribute = (n, v) => {
  61254. const retval = oldSetAttribute.call(el, n, v);
  61255. if (/src/i.test(n)) {
  61256. tech.triggerSourceset(el.src);
  61257. }
  61258. return retval;
  61259. };
  61260. el.load = () => {
  61261. const retval = oldLoad.call(el);
  61262. if (!sourcesetLoad$1(tech)) {
  61263. tech.triggerSourceset("");
  61264. firstSourceWatch$1(tech);
  61265. }
  61266. return retval;
  61267. };
  61268. if (el.currentSrc) {
  61269. tech.triggerSourceset(el.currentSrc);
  61270. } else if (!sourcesetLoad$1(tech)) {
  61271. firstSourceWatch$1(tech);
  61272. }
  61273. el.resetSourceset_ = () => {
  61274. el.resetSourceset_ = null;
  61275. el.load = oldLoad;
  61276. el.setAttribute = oldSetAttribute;
  61277. Object.defineProperty(el, "src", srcDescriptor);
  61278. if (el.resetSourceWatch_) {
  61279. el.resetSourceWatch_();
  61280. }
  61281. };
  61282. };
  61283. class Html5$2 extends Tech$2 {
  61284. constructor(options2, ready) {
  61285. super(options2, ready);
  61286. const source = options2.source;
  61287. let crossoriginTracks = false;
  61288. this.featuresVideoFrameCallback = this.featuresVideoFrameCallback && this.el_.tagName === "VIDEO";
  61289. if (source && (this.el_.currentSrc !== source.src || options2.tag && options2.tag.initNetworkState_ === 3)) {
  61290. this.setSource(source);
  61291. } else {
  61292. this.handleLateInit_(this.el_);
  61293. }
  61294. if (options2.enableSourceset) {
  61295. this.setupSourcesetHandling_();
  61296. }
  61297. this.isScrubbing_ = false;
  61298. if (this.el_.hasChildNodes()) {
  61299. const nodes = this.el_.childNodes;
  61300. let nodesLength = nodes.length;
  61301. const removeNodes = [];
  61302. while (nodesLength--) {
  61303. const node = nodes[nodesLength];
  61304. const nodeName = node.nodeName.toLowerCase();
  61305. if (nodeName === "track") {
  61306. if (!this.featuresNativeTextTracks) {
  61307. removeNodes.push(node);
  61308. } else {
  61309. this.remoteTextTrackEls().addTrackElement_(node);
  61310. this.remoteTextTracks().addTrack(node.track);
  61311. this.textTracks().addTrack(node.track);
  61312. if (!crossoriginTracks && !this.el_.hasAttribute("crossorigin") && isCrossOrigin$1(node.src)) {
  61313. crossoriginTracks = true;
  61314. }
  61315. }
  61316. }
  61317. }
  61318. for (let i2 = 0; i2 < removeNodes.length; i2++) {
  61319. this.el_.removeChild(removeNodes[i2]);
  61320. }
  61321. }
  61322. this.proxyNativeTracks_();
  61323. if (this.featuresNativeTextTracks && crossoriginTracks) {
  61324. log$1$1.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading.");
  61325. }
  61326. this.restoreMetadataTracksInIOSNativePlayer_();
  61327. if ((TOUCH_ENABLED$1 || IS_IPHONE$1) && options2.nativeControlsForTouch === true) {
  61328. this.setControls(true);
  61329. }
  61330. this.proxyWebkitFullscreen_();
  61331. this.triggerReady();
  61332. }
  61333. dispose() {
  61334. if (this.el_ && this.el_.resetSourceset_) {
  61335. this.el_.resetSourceset_();
  61336. }
  61337. Html5$2.disposeMediaElement(this.el_);
  61338. this.options_ = null;
  61339. super.dispose();
  61340. }
  61341. setupSourcesetHandling_() {
  61342. setupSourceset$1(this);
  61343. }
  61344. restoreMetadataTracksInIOSNativePlayer_() {
  61345. const textTracks = this.textTracks();
  61346. let metadataTracksPreFullscreenState;
  61347. const takeMetadataTrackSnapshot = () => {
  61348. metadataTracksPreFullscreenState = [];
  61349. for (let i2 = 0; i2 < textTracks.length; i2++) {
  61350. const track = textTracks[i2];
  61351. if (track.kind === "metadata") {
  61352. metadataTracksPreFullscreenState.push({
  61353. track,
  61354. storedMode: track.mode
  61355. });
  61356. }
  61357. }
  61358. };
  61359. takeMetadataTrackSnapshot();
  61360. textTracks.addEventListener("change", takeMetadataTrackSnapshot);
  61361. this.on("dispose", () => textTracks.removeEventListener("change", takeMetadataTrackSnapshot));
  61362. const restoreTrackMode = () => {
  61363. for (let i2 = 0; i2 < metadataTracksPreFullscreenState.length; i2++) {
  61364. const storedTrack = metadataTracksPreFullscreenState[i2];
  61365. if (storedTrack.track.mode === "disabled" && storedTrack.track.mode !== storedTrack.storedMode) {
  61366. storedTrack.track.mode = storedTrack.storedMode;
  61367. }
  61368. }
  61369. textTracks.removeEventListener("change", restoreTrackMode);
  61370. };
  61371. this.on("webkitbeginfullscreen", () => {
  61372. textTracks.removeEventListener("change", takeMetadataTrackSnapshot);
  61373. textTracks.removeEventListener("change", restoreTrackMode);
  61374. textTracks.addEventListener("change", restoreTrackMode);
  61375. });
  61376. this.on("webkitendfullscreen", () => {
  61377. textTracks.removeEventListener("change", takeMetadataTrackSnapshot);
  61378. textTracks.addEventListener("change", takeMetadataTrackSnapshot);
  61379. textTracks.removeEventListener("change", restoreTrackMode);
  61380. });
  61381. }
  61382. overrideNative_(type2, override) {
  61383. if (override !== this[`featuresNative${type2}Tracks`]) {
  61384. return;
  61385. }
  61386. const lowerCaseType = type2.toLowerCase();
  61387. if (this[`${lowerCaseType}TracksListeners_`]) {
  61388. Object.keys(this[`${lowerCaseType}TracksListeners_`]).forEach((eventName) => {
  61389. const elTracks = this.el()[`${lowerCaseType}Tracks`];
  61390. elTracks.removeEventListener(eventName, this[`${lowerCaseType}TracksListeners_`][eventName]);
  61391. });
  61392. }
  61393. this[`featuresNative${type2}Tracks`] = !override;
  61394. this[`${lowerCaseType}TracksListeners_`] = null;
  61395. this.proxyNativeTracksForType_(lowerCaseType);
  61396. }
  61397. overrideNativeAudioTracks(override) {
  61398. this.overrideNative_("Audio", override);
  61399. }
  61400. overrideNativeVideoTracks(override) {
  61401. this.overrideNative_("Video", override);
  61402. }
  61403. proxyNativeTracksForType_(name) {
  61404. const props = NORMAL$1[name];
  61405. const elTracks = this.el()[props.getterName];
  61406. const techTracks = this[props.getterName]();
  61407. if (!this[`featuresNative${props.capitalName}Tracks`] || !elTracks || !elTracks.addEventListener) {
  61408. return;
  61409. }
  61410. const listeners = {
  61411. change: (e) => {
  61412. const event2 = {
  61413. type: "change",
  61414. target: techTracks,
  61415. currentTarget: techTracks,
  61416. srcElement: techTracks
  61417. };
  61418. techTracks.trigger(event2);
  61419. if (name === "text") {
  61420. this[REMOTE$1.remoteText.getterName]().trigger(event2);
  61421. }
  61422. },
  61423. addtrack(e) {
  61424. techTracks.addTrack(e.track);
  61425. },
  61426. removetrack(e) {
  61427. techTracks.removeTrack(e.track);
  61428. }
  61429. };
  61430. const removeOldTracks = function() {
  61431. const removeTracks = [];
  61432. for (let i2 = 0; i2 < techTracks.length; i2++) {
  61433. let found = false;
  61434. for (let j = 0; j < elTracks.length; j++) {
  61435. if (elTracks[j] === techTracks[i2]) {
  61436. found = true;
  61437. break;
  61438. }
  61439. }
  61440. if (!found) {
  61441. removeTracks.push(techTracks[i2]);
  61442. }
  61443. }
  61444. while (removeTracks.length) {
  61445. techTracks.removeTrack(removeTracks.shift());
  61446. }
  61447. };
  61448. this[props.getterName + "Listeners_"] = listeners;
  61449. Object.keys(listeners).forEach((eventName) => {
  61450. const listener = listeners[eventName];
  61451. elTracks.addEventListener(eventName, listener);
  61452. this.on("dispose", (e) => elTracks.removeEventListener(eventName, listener));
  61453. });
  61454. this.on("loadstart", removeOldTracks);
  61455. this.on("dispose", (e) => this.off("loadstart", removeOldTracks));
  61456. }
  61457. proxyNativeTracks_() {
  61458. NORMAL$1.names.forEach((name) => {
  61459. this.proxyNativeTracksForType_(name);
  61460. });
  61461. }
  61462. createEl() {
  61463. let el = this.options_.tag;
  61464. if (!el || !(this.options_.playerElIngest || this.movingMediaElementInDOM)) {
  61465. if (el) {
  61466. const clone = el.cloneNode(true);
  61467. if (el.parentNode) {
  61468. el.parentNode.insertBefore(clone, el);
  61469. }
  61470. Html5$2.disposeMediaElement(el);
  61471. el = clone;
  61472. } else {
  61473. el = document_1.createElement("video");
  61474. const tagAttributes = this.options_.tag && getAttributes$1(this.options_.tag);
  61475. const attributes = merge$1({}, tagAttributes);
  61476. if (!TOUCH_ENABLED$1 || this.options_.nativeControlsForTouch !== true) {
  61477. delete attributes.controls;
  61478. }
  61479. setAttributes$1(el, Object.assign(attributes, {
  61480. id: this.options_.techId,
  61481. class: "vjs-tech"
  61482. }));
  61483. }
  61484. el.playerId = this.options_.playerId;
  61485. }
  61486. if (typeof this.options_.preload !== "undefined") {
  61487. setAttribute$1(el, "preload", this.options_.preload);
  61488. }
  61489. if (this.options_.disablePictureInPicture !== void 0) {
  61490. el.disablePictureInPicture = this.options_.disablePictureInPicture;
  61491. }
  61492. const settingsAttrs = ["loop", "muted", "playsinline", "autoplay"];
  61493. for (let i2 = 0; i2 < settingsAttrs.length; i2++) {
  61494. const attr = settingsAttrs[i2];
  61495. const value = this.options_[attr];
  61496. if (typeof value !== "undefined") {
  61497. if (value) {
  61498. setAttribute$1(el, attr, attr);
  61499. } else {
  61500. removeAttribute$1(el, attr);
  61501. }
  61502. el[attr] = value;
  61503. }
  61504. }
  61505. return el;
  61506. }
  61507. handleLateInit_(el) {
  61508. if (el.networkState === 0 || el.networkState === 3) {
  61509. return;
  61510. }
  61511. if (el.readyState === 0) {
  61512. let loadstartFired = false;
  61513. const setLoadstartFired = function() {
  61514. loadstartFired = true;
  61515. };
  61516. this.on("loadstart", setLoadstartFired);
  61517. const triggerLoadstart = function() {
  61518. if (!loadstartFired) {
  61519. this.trigger("loadstart");
  61520. }
  61521. };
  61522. this.on("loadedmetadata", triggerLoadstart);
  61523. this.ready(function() {
  61524. this.off("loadstart", setLoadstartFired);
  61525. this.off("loadedmetadata", triggerLoadstart);
  61526. if (!loadstartFired) {
  61527. this.trigger("loadstart");
  61528. }
  61529. });
  61530. return;
  61531. }
  61532. const eventsToTrigger = ["loadstart"];
  61533. eventsToTrigger.push("loadedmetadata");
  61534. if (el.readyState >= 2) {
  61535. eventsToTrigger.push("loadeddata");
  61536. }
  61537. if (el.readyState >= 3) {
  61538. eventsToTrigger.push("canplay");
  61539. }
  61540. if (el.readyState >= 4) {
  61541. eventsToTrigger.push("canplaythrough");
  61542. }
  61543. this.ready(function() {
  61544. eventsToTrigger.forEach(function(type2) {
  61545. this.trigger(type2);
  61546. }, this);
  61547. });
  61548. }
  61549. setScrubbing(isScrubbing) {
  61550. this.isScrubbing_ = isScrubbing;
  61551. }
  61552. scrubbing() {
  61553. return this.isScrubbing_;
  61554. }
  61555. setCurrentTime(seconds) {
  61556. try {
  61557. if (this.isScrubbing_ && this.el_.fastSeek && IS_ANY_SAFARI$1) {
  61558. this.el_.fastSeek(seconds);
  61559. } else {
  61560. this.el_.currentTime = seconds;
  61561. }
  61562. } catch (e) {
  61563. log$1$1(e, "Video is not ready. (Video.js)");
  61564. }
  61565. }
  61566. duration() {
  61567. if (this.el_.duration === Infinity && IS_ANDROID$1 && IS_CHROME$1 && this.el_.currentTime === 0) {
  61568. const checkProgress = () => {
  61569. if (this.el_.currentTime > 0) {
  61570. if (this.el_.duration === Infinity) {
  61571. this.trigger("durationchange");
  61572. }
  61573. this.off("timeupdate", checkProgress);
  61574. }
  61575. };
  61576. this.on("timeupdate", checkProgress);
  61577. return NaN;
  61578. }
  61579. return this.el_.duration || NaN;
  61580. }
  61581. width() {
  61582. return this.el_.offsetWidth;
  61583. }
  61584. height() {
  61585. return this.el_.offsetHeight;
  61586. }
  61587. proxyWebkitFullscreen_() {
  61588. if (!("webkitDisplayingFullscreen" in this.el_)) {
  61589. return;
  61590. }
  61591. const endFn = function() {
  61592. this.trigger("fullscreenchange", {
  61593. isFullscreen: false
  61594. });
  61595. if (this.el_.controls && !this.options_.nativeControlsForTouch && this.controls()) {
  61596. this.el_.controls = false;
  61597. }
  61598. };
  61599. const beginFn = function() {
  61600. if ("webkitPresentationMode" in this.el_ && this.el_.webkitPresentationMode !== "picture-in-picture") {
  61601. this.one("webkitendfullscreen", endFn);
  61602. this.trigger("fullscreenchange", {
  61603. isFullscreen: true,
  61604. nativeIOSFullscreen: true
  61605. });
  61606. }
  61607. };
  61608. this.on("webkitbeginfullscreen", beginFn);
  61609. this.on("dispose", () => {
  61610. this.off("webkitbeginfullscreen", beginFn);
  61611. this.off("webkitendfullscreen", endFn);
  61612. });
  61613. }
  61614. supportsFullScreen() {
  61615. return typeof this.el_.webkitEnterFullScreen === "function";
  61616. }
  61617. enterFullScreen() {
  61618. const video = this.el_;
  61619. if (video.paused && video.networkState <= video.HAVE_METADATA) {
  61620. silencePromise$1(this.el_.play());
  61621. this.setTimeout(function() {
  61622. video.pause();
  61623. try {
  61624. video.webkitEnterFullScreen();
  61625. } catch (e) {
  61626. this.trigger("fullscreenerror", e);
  61627. }
  61628. }, 0);
  61629. } else {
  61630. try {
  61631. video.webkitEnterFullScreen();
  61632. } catch (e) {
  61633. this.trigger("fullscreenerror", e);
  61634. }
  61635. }
  61636. }
  61637. exitFullScreen() {
  61638. if (!this.el_.webkitDisplayingFullscreen) {
  61639. this.trigger("fullscreenerror", new Error("The video is not fullscreen"));
  61640. return;
  61641. }
  61642. this.el_.webkitExitFullScreen();
  61643. }
  61644. requestPictureInPicture() {
  61645. return this.el_.requestPictureInPicture();
  61646. }
  61647. requestVideoFrameCallback(cb) {
  61648. if (this.featuresVideoFrameCallback && !this.el_.webkitKeys) {
  61649. return this.el_.requestVideoFrameCallback(cb);
  61650. }
  61651. return super.requestVideoFrameCallback(cb);
  61652. }
  61653. cancelVideoFrameCallback(id) {
  61654. if (this.featuresVideoFrameCallback && !this.el_.webkitKeys) {
  61655. this.el_.cancelVideoFrameCallback(id);
  61656. } else {
  61657. super.cancelVideoFrameCallback(id);
  61658. }
  61659. }
  61660. src(src) {
  61661. if (src === void 0) {
  61662. return this.el_.src;
  61663. }
  61664. this.setSrc(src);
  61665. }
  61666. reset() {
  61667. Html5$2.resetMediaElement(this.el_);
  61668. }
  61669. currentSrc() {
  61670. if (this.currentSource_) {
  61671. return this.currentSource_.src;
  61672. }
  61673. return this.el_.currentSrc;
  61674. }
  61675. setControls(val) {
  61676. this.el_.controls = !!val;
  61677. }
  61678. addTextTrack(kind, label2, language) {
  61679. if (!this.featuresNativeTextTracks) {
  61680. return super.addTextTrack(kind, label2, language);
  61681. }
  61682. return this.el_.addTextTrack(kind, label2, language);
  61683. }
  61684. createRemoteTextTrack(options2) {
  61685. if (!this.featuresNativeTextTracks) {
  61686. return super.createRemoteTextTrack(options2);
  61687. }
  61688. const htmlTrackElement = document_1.createElement("track");
  61689. if (options2.kind) {
  61690. htmlTrackElement.kind = options2.kind;
  61691. }
  61692. if (options2.label) {
  61693. htmlTrackElement.label = options2.label;
  61694. }
  61695. if (options2.language || options2.srclang) {
  61696. htmlTrackElement.srclang = options2.language || options2.srclang;
  61697. }
  61698. if (options2.default) {
  61699. htmlTrackElement.default = options2.default;
  61700. }
  61701. if (options2.id) {
  61702. htmlTrackElement.id = options2.id;
  61703. }
  61704. if (options2.src) {
  61705. htmlTrackElement.src = options2.src;
  61706. }
  61707. return htmlTrackElement;
  61708. }
  61709. addRemoteTextTrack(options2, manualCleanup) {
  61710. const htmlTrackElement = super.addRemoteTextTrack(options2, manualCleanup);
  61711. if (this.featuresNativeTextTracks) {
  61712. this.el().appendChild(htmlTrackElement);
  61713. }
  61714. return htmlTrackElement;
  61715. }
  61716. removeRemoteTextTrack(track) {
  61717. super.removeRemoteTextTrack(track);
  61718. if (this.featuresNativeTextTracks) {
  61719. const tracks = this.$$("track");
  61720. let i2 = tracks.length;
  61721. while (i2--) {
  61722. if (track === tracks[i2] || track === tracks[i2].track) {
  61723. this.el().removeChild(tracks[i2]);
  61724. }
  61725. }
  61726. }
  61727. }
  61728. getVideoPlaybackQuality() {
  61729. if (typeof this.el().getVideoPlaybackQuality === "function") {
  61730. return this.el().getVideoPlaybackQuality();
  61731. }
  61732. const videoPlaybackQuality = {};
  61733. if (typeof this.el().webkitDroppedFrameCount !== "undefined" && typeof this.el().webkitDecodedFrameCount !== "undefined") {
  61734. videoPlaybackQuality.droppedVideoFrames = this.el().webkitDroppedFrameCount;
  61735. videoPlaybackQuality.totalVideoFrames = this.el().webkitDecodedFrameCount;
  61736. }
  61737. if (window_1.performance) {
  61738. videoPlaybackQuality.creationTime = window_1.performance.now();
  61739. }
  61740. return videoPlaybackQuality;
  61741. }
  61742. }
  61743. defineLazyProperty$1(Html5$2, "TEST_VID", function() {
  61744. if (!isReal$1()) {
  61745. return;
  61746. }
  61747. const video = document_1.createElement("video");
  61748. const track = document_1.createElement("track");
  61749. track.kind = "captions";
  61750. track.srclang = "en";
  61751. track.label = "English";
  61752. video.appendChild(track);
  61753. return video;
  61754. });
  61755. Html5$2.isSupported = function() {
  61756. try {
  61757. Html5$2.TEST_VID.volume = 0.5;
  61758. } catch (e) {
  61759. return false;
  61760. }
  61761. return !!(Html5$2.TEST_VID && Html5$2.TEST_VID.canPlayType);
  61762. };
  61763. Html5$2.canPlayType = function(type2) {
  61764. return Html5$2.TEST_VID.canPlayType(type2);
  61765. };
  61766. Html5$2.canPlaySource = function(srcObj, options2) {
  61767. return Html5$2.canPlayType(srcObj.type);
  61768. };
  61769. Html5$2.canControlVolume = function() {
  61770. try {
  61771. const volume = Html5$2.TEST_VID.volume;
  61772. Html5$2.TEST_VID.volume = volume / 2 + 0.1;
  61773. const canControl = volume !== Html5$2.TEST_VID.volume;
  61774. if (canControl && IS_IOS$1) {
  61775. window_1.setTimeout(() => {
  61776. if (Html5$2 && Html5$2.prototype) {
  61777. Html5$2.prototype.featuresVolumeControl = volume !== Html5$2.TEST_VID.volume;
  61778. }
  61779. });
  61780. return false;
  61781. }
  61782. return canControl;
  61783. } catch (e) {
  61784. return false;
  61785. }
  61786. };
  61787. Html5$2.canMuteVolume = function() {
  61788. try {
  61789. const muted = Html5$2.TEST_VID.muted;
  61790. Html5$2.TEST_VID.muted = !muted;
  61791. if (Html5$2.TEST_VID.muted) {
  61792. setAttribute$1(Html5$2.TEST_VID, "muted", "muted");
  61793. } else {
  61794. removeAttribute$1(Html5$2.TEST_VID, "muted", "muted");
  61795. }
  61796. return muted !== Html5$2.TEST_VID.muted;
  61797. } catch (e) {
  61798. return false;
  61799. }
  61800. };
  61801. Html5$2.canControlPlaybackRate = function() {
  61802. if (IS_ANDROID$1 && IS_CHROME$1 && CHROME_VERSION$1 < 58) {
  61803. return false;
  61804. }
  61805. try {
  61806. const playbackRate = Html5$2.TEST_VID.playbackRate;
  61807. Html5$2.TEST_VID.playbackRate = playbackRate / 2 + 0.1;
  61808. return playbackRate !== Html5$2.TEST_VID.playbackRate;
  61809. } catch (e) {
  61810. return false;
  61811. }
  61812. };
  61813. Html5$2.canOverrideAttributes = function() {
  61814. try {
  61815. const noop2 = () => {
  61816. };
  61817. Object.defineProperty(document_1.createElement("video"), "src", {
  61818. get: noop2,
  61819. set: noop2
  61820. });
  61821. Object.defineProperty(document_1.createElement("audio"), "src", {
  61822. get: noop2,
  61823. set: noop2
  61824. });
  61825. Object.defineProperty(document_1.createElement("video"), "innerHTML", {
  61826. get: noop2,
  61827. set: noop2
  61828. });
  61829. Object.defineProperty(document_1.createElement("audio"), "innerHTML", {
  61830. get: noop2,
  61831. set: noop2
  61832. });
  61833. } catch (e) {
  61834. return false;
  61835. }
  61836. return true;
  61837. };
  61838. Html5$2.supportsNativeTextTracks = function() {
  61839. return IS_ANY_SAFARI$1 || IS_IOS$1 && IS_CHROME$1;
  61840. };
  61841. Html5$2.supportsNativeVideoTracks = function() {
  61842. return !!(Html5$2.TEST_VID && Html5$2.TEST_VID.videoTracks);
  61843. };
  61844. Html5$2.supportsNativeAudioTracks = function() {
  61845. return !!(Html5$2.TEST_VID && Html5$2.TEST_VID.audioTracks);
  61846. };
  61847. Html5$2.Events = ["loadstart", "suspend", "abort", "error", "emptied", "stalled", "loadedmetadata", "loadeddata", "canplay", "canplaythrough", "playing", "waiting", "seeking", "seeked", "ended", "durationchange", "timeupdate", "progress", "play", "pause", "ratechange", "resize", "volumechange"];
  61848. [["featuresMuteControl", "canMuteVolume"], ["featuresPlaybackRate", "canControlPlaybackRate"], ["featuresSourceset", "canOverrideAttributes"], ["featuresNativeTextTracks", "supportsNativeTextTracks"], ["featuresNativeVideoTracks", "supportsNativeVideoTracks"], ["featuresNativeAudioTracks", "supportsNativeAudioTracks"]].forEach(function([key, fn2]) {
  61849. defineLazyProperty$1(Html5$2.prototype, key, () => Html5$2[fn2](), true);
  61850. });
  61851. Html5$2.prototype.featuresVolumeControl = Html5$2.canControlVolume();
  61852. Html5$2.prototype.movingMediaElementInDOM = !IS_IOS$1;
  61853. Html5$2.prototype.featuresFullscreenResize = true;
  61854. Html5$2.prototype.featuresProgressEvents = true;
  61855. Html5$2.prototype.featuresTimeupdateEvents = true;
  61856. Html5$2.prototype.featuresVideoFrameCallback = !!(Html5$2.TEST_VID && Html5$2.TEST_VID.requestVideoFrameCallback);
  61857. Html5$2.disposeMediaElement = function(el) {
  61858. if (!el) {
  61859. return;
  61860. }
  61861. if (el.parentNode) {
  61862. el.parentNode.removeChild(el);
  61863. }
  61864. while (el.hasChildNodes()) {
  61865. el.removeChild(el.firstChild);
  61866. }
  61867. el.removeAttribute("src");
  61868. if (typeof el.load === "function") {
  61869. (function() {
  61870. try {
  61871. el.load();
  61872. } catch (e) {
  61873. }
  61874. })();
  61875. }
  61876. };
  61877. Html5$2.resetMediaElement = function(el) {
  61878. if (!el) {
  61879. return;
  61880. }
  61881. const sources = el.querySelectorAll("source");
  61882. let i2 = sources.length;
  61883. while (i2--) {
  61884. el.removeChild(sources[i2]);
  61885. }
  61886. el.removeAttribute("src");
  61887. if (typeof el.load === "function") {
  61888. (function() {
  61889. try {
  61890. el.load();
  61891. } catch (e) {
  61892. }
  61893. })();
  61894. }
  61895. };
  61896. [
  61897. "muted",
  61898. "defaultMuted",
  61899. "autoplay",
  61900. "controls",
  61901. "loop",
  61902. "playsinline"
  61903. ].forEach(function(prop) {
  61904. Html5$2.prototype[prop] = function() {
  61905. return this.el_[prop] || this.el_.hasAttribute(prop);
  61906. };
  61907. });
  61908. [
  61909. "muted",
  61910. "defaultMuted",
  61911. "autoplay",
  61912. "loop",
  61913. "playsinline"
  61914. ].forEach(function(prop) {
  61915. Html5$2.prototype["set" + toTitleCase$1$1(prop)] = function(v) {
  61916. this.el_[prop] = v;
  61917. if (v) {
  61918. this.el_.setAttribute(prop, prop);
  61919. } else {
  61920. this.el_.removeAttribute(prop);
  61921. }
  61922. };
  61923. });
  61924. [
  61925. "paused",
  61926. "currentTime",
  61927. "buffered",
  61928. "volume",
  61929. "poster",
  61930. "preload",
  61931. "error",
  61932. "seeking",
  61933. "seekable",
  61934. "ended",
  61935. "playbackRate",
  61936. "defaultPlaybackRate",
  61937. "disablePictureInPicture",
  61938. "played",
  61939. "networkState",
  61940. "readyState",
  61941. "videoWidth",
  61942. "videoHeight",
  61943. "crossOrigin"
  61944. ].forEach(function(prop) {
  61945. Html5$2.prototype[prop] = function() {
  61946. return this.el_[prop];
  61947. };
  61948. });
  61949. [
  61950. "volume",
  61951. "src",
  61952. "poster",
  61953. "preload",
  61954. "playbackRate",
  61955. "defaultPlaybackRate",
  61956. "disablePictureInPicture",
  61957. "crossOrigin"
  61958. ].forEach(function(prop) {
  61959. Html5$2.prototype["set" + toTitleCase$1$1(prop)] = function(v) {
  61960. this.el_[prop] = v;
  61961. };
  61962. });
  61963. [
  61964. "pause",
  61965. "load",
  61966. "play"
  61967. ].forEach(function(prop) {
  61968. Html5$2.prototype[prop] = function() {
  61969. return this.el_[prop]();
  61970. };
  61971. });
  61972. Tech$2.withSourceHandlers(Html5$2);
  61973. Html5$2.nativeSourceHandler = {};
  61974. Html5$2.nativeSourceHandler.canPlayType = function(type2) {
  61975. try {
  61976. return Html5$2.TEST_VID.canPlayType(type2);
  61977. } catch (e) {
  61978. return "";
  61979. }
  61980. };
  61981. Html5$2.nativeSourceHandler.canHandleSource = function(source, options2) {
  61982. if (source.type) {
  61983. return Html5$2.nativeSourceHandler.canPlayType(source.type);
  61984. } else if (source.src) {
  61985. const ext = getFileExtension$1(source.src);
  61986. return Html5$2.nativeSourceHandler.canPlayType(`video/${ext}`);
  61987. }
  61988. return "";
  61989. };
  61990. Html5$2.nativeSourceHandler.handleSource = function(source, tech, options2) {
  61991. tech.setSrc(source.src);
  61992. };
  61993. Html5$2.nativeSourceHandler.dispose = function() {
  61994. };
  61995. Html5$2.registerSourceHandler(Html5$2.nativeSourceHandler);
  61996. Tech$2.registerTech("Html5", Html5$2);
  61997. const TECH_EVENTS_RETRIGGER$1 = [
  61998. "progress",
  61999. "abort",
  62000. "suspend",
  62001. "emptied",
  62002. "stalled",
  62003. "loadedmetadata",
  62004. "loadeddata",
  62005. "timeupdate",
  62006. "resize",
  62007. "volumechange",
  62008. "texttrackchange"
  62009. ];
  62010. const TECH_EVENTS_QUEUE$1 = {
  62011. canplay: "CanPlay",
  62012. canplaythrough: "CanPlayThrough",
  62013. playing: "Playing",
  62014. seeked: "Seeked"
  62015. };
  62016. const BREAKPOINT_ORDER$1 = ["tiny", "xsmall", "small", "medium", "large", "xlarge", "huge"];
  62017. const BREAKPOINT_CLASSES$1 = {};
  62018. BREAKPOINT_ORDER$1.forEach((k) => {
  62019. const v = k.charAt(0) === "x" ? `x-${k.substring(1)}` : k;
  62020. BREAKPOINT_CLASSES$1[k] = `vjs-layout-${v}`;
  62021. });
  62022. const DEFAULT_BREAKPOINTS$1 = {
  62023. tiny: 210,
  62024. xsmall: 320,
  62025. small: 425,
  62026. medium: 768,
  62027. large: 1440,
  62028. xlarge: 2560,
  62029. huge: Infinity
  62030. };
  62031. class Player$1 extends Component$1$1 {
  62032. constructor(tag, options2, ready) {
  62033. tag.id = tag.id || options2.id || `vjs_video_${newGUID$1()}`;
  62034. options2 = Object.assign(Player$1.getTagSettings(tag), options2);
  62035. options2.initChildren = false;
  62036. options2.createEl = false;
  62037. options2.evented = false;
  62038. options2.reportTouchActivity = false;
  62039. if (!options2.language) {
  62040. const closest = tag.closest("[lang]");
  62041. if (closest) {
  62042. options2.language = closest.getAttribute("lang");
  62043. }
  62044. }
  62045. super(null, options2, ready);
  62046. this.boundDocumentFullscreenChange_ = (e) => this.documentFullscreenChange_(e);
  62047. this.boundFullWindowOnEscKey_ = (e) => this.fullWindowOnEscKey(e);
  62048. this.boundUpdateStyleEl_ = (e) => this.updateStyleEl_(e);
  62049. this.boundApplyInitTime_ = (e) => this.applyInitTime_(e);
  62050. this.boundUpdateCurrentBreakpoint_ = (e) => this.updateCurrentBreakpoint_(e);
  62051. this.boundHandleTechClick_ = (e) => this.handleTechClick_(e);
  62052. this.boundHandleTechDoubleClick_ = (e) => this.handleTechDoubleClick_(e);
  62053. this.boundHandleTechTouchStart_ = (e) => this.handleTechTouchStart_(e);
  62054. this.boundHandleTechTouchMove_ = (e) => this.handleTechTouchMove_(e);
  62055. this.boundHandleTechTouchEnd_ = (e) => this.handleTechTouchEnd_(e);
  62056. this.boundHandleTechTap_ = (e) => this.handleTechTap_(e);
  62057. this.isFullscreen_ = false;
  62058. this.log = createLogger$2(this.id_);
  62059. this.fsApi_ = FullscreenApi$1;
  62060. this.isPosterFromTech_ = false;
  62061. this.queuedCallbacks_ = [];
  62062. this.isReady_ = false;
  62063. this.hasStarted_ = false;
  62064. this.userActive_ = false;
  62065. this.debugEnabled_ = false;
  62066. this.audioOnlyMode_ = false;
  62067. this.audioPosterMode_ = false;
  62068. this.audioOnlyCache_ = {
  62069. playerHeight: null,
  62070. hiddenChildren: []
  62071. };
  62072. if (!this.options_ || !this.options_.techOrder || !this.options_.techOrder.length) {
  62073. throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");
  62074. }
  62075. this.tag = tag;
  62076. this.tagAttributes = tag && getAttributes$1(tag);
  62077. this.language(this.options_.language);
  62078. if (options2.languages) {
  62079. const languagesToLower = {};
  62080. Object.getOwnPropertyNames(options2.languages).forEach(function(name) {
  62081. languagesToLower[name.toLowerCase()] = options2.languages[name];
  62082. });
  62083. this.languages_ = languagesToLower;
  62084. } else {
  62085. this.languages_ = Player$1.prototype.options_.languages;
  62086. }
  62087. this.resetCache_();
  62088. this.poster_ = options2.poster || "";
  62089. this.controls_ = !!options2.controls;
  62090. tag.controls = false;
  62091. tag.removeAttribute("controls");
  62092. this.changingSrc_ = false;
  62093. this.playCallbacks_ = [];
  62094. this.playTerminatedQueue_ = [];
  62095. if (tag.hasAttribute("autoplay")) {
  62096. this.autoplay(true);
  62097. } else {
  62098. this.autoplay(this.options_.autoplay);
  62099. }
  62100. if (options2.plugins) {
  62101. Object.keys(options2.plugins).forEach((name) => {
  62102. if (typeof this[name] !== "function") {
  62103. throw new Error(`plugin "${name}" does not exist`);
  62104. }
  62105. });
  62106. }
  62107. this.scrubbing_ = false;
  62108. this.el_ = this.createEl();
  62109. evented$1(this, {
  62110. eventBusKey: "el_"
  62111. });
  62112. if (this.fsApi_.requestFullscreen) {
  62113. on$1(document_1, this.fsApi_.fullscreenchange, this.boundDocumentFullscreenChange_);
  62114. this.on(this.fsApi_.fullscreenchange, this.boundDocumentFullscreenChange_);
  62115. }
  62116. if (this.fluid_) {
  62117. this.on(["playerreset", "resize"], this.boundUpdateStyleEl_);
  62118. }
  62119. const playerOptionsCopy = merge$1(this.options_);
  62120. if (options2.plugins) {
  62121. Object.keys(options2.plugins).forEach((name) => {
  62122. this[name](options2.plugins[name]);
  62123. });
  62124. }
  62125. if (options2.debug) {
  62126. this.debug(true);
  62127. }
  62128. this.options_.playerOptions = playerOptionsCopy;
  62129. this.middleware_ = [];
  62130. this.playbackRates(options2.playbackRates);
  62131. this.initChildren();
  62132. this.isAudio(tag.nodeName.toLowerCase() === "audio");
  62133. if (this.controls()) {
  62134. this.addClass("vjs-controls-enabled");
  62135. } else {
  62136. this.addClass("vjs-controls-disabled");
  62137. }
  62138. this.el_.setAttribute("role", "region");
  62139. if (this.isAudio()) {
  62140. this.el_.setAttribute("aria-label", this.localize("Audio Player"));
  62141. } else {
  62142. this.el_.setAttribute("aria-label", this.localize("Video Player"));
  62143. }
  62144. if (this.isAudio()) {
  62145. this.addClass("vjs-audio");
  62146. }
  62147. if (TOUCH_ENABLED$1) {
  62148. this.addClass("vjs-touch-enabled");
  62149. }
  62150. if (!IS_IOS$1) {
  62151. this.addClass("vjs-workinghover");
  62152. }
  62153. Player$1.players[this.id_] = this;
  62154. const majorVersion = version$6$1.split(".")[0];
  62155. this.addClass(`vjs-v${majorVersion}`);
  62156. this.userActive(true);
  62157. this.reportUserActivity();
  62158. this.one("play", (e) => this.listenForUserActivity_(e));
  62159. this.on("keydown", (e) => this.handleKeyDown(e));
  62160. this.on("languagechange", (e) => this.handleLanguagechange(e));
  62161. this.breakpoints(this.options_.breakpoints);
  62162. this.responsive(this.options_.responsive);
  62163. this.on("ready", () => {
  62164. this.audioPosterMode(this.options_.audioPosterMode);
  62165. this.audioOnlyMode(this.options_.audioOnlyMode);
  62166. });
  62167. }
  62168. dispose() {
  62169. this.trigger("dispose");
  62170. this.off("dispose");
  62171. off$1(document_1, this.fsApi_.fullscreenchange, this.boundDocumentFullscreenChange_);
  62172. off$1(document_1, "keydown", this.boundFullWindowOnEscKey_);
  62173. if (this.styleEl_ && this.styleEl_.parentNode) {
  62174. this.styleEl_.parentNode.removeChild(this.styleEl_);
  62175. this.styleEl_ = null;
  62176. }
  62177. Player$1.players[this.id_] = null;
  62178. if (this.tag && this.tag.player) {
  62179. this.tag.player = null;
  62180. }
  62181. if (this.el_ && this.el_.player) {
  62182. this.el_.player = null;
  62183. }
  62184. if (this.tech_) {
  62185. this.tech_.dispose();
  62186. this.isPosterFromTech_ = false;
  62187. this.poster_ = "";
  62188. }
  62189. if (this.playerElIngest_) {
  62190. this.playerElIngest_ = null;
  62191. }
  62192. if (this.tag) {
  62193. this.tag = null;
  62194. }
  62195. clearCacheForPlayer$1(this);
  62196. ALL$1.names.forEach((name) => {
  62197. const props = ALL$1[name];
  62198. const list = this[props.getterName]();
  62199. if (list && list.off) {
  62200. list.off();
  62201. }
  62202. });
  62203. super.dispose({
  62204. restoreEl: this.options_.restoreEl
  62205. });
  62206. }
  62207. createEl() {
  62208. let tag = this.tag;
  62209. let el;
  62210. let playerElIngest = this.playerElIngest_ = tag.parentNode && tag.parentNode.hasAttribute && tag.parentNode.hasAttribute("data-vjs-player");
  62211. const divEmbed = this.tag.tagName.toLowerCase() === "video-js";
  62212. if (playerElIngest) {
  62213. el = this.el_ = tag.parentNode;
  62214. } else if (!divEmbed) {
  62215. el = this.el_ = super.createEl("div");
  62216. }
  62217. const attrs = getAttributes$1(tag);
  62218. if (divEmbed) {
  62219. el = this.el_ = tag;
  62220. tag = this.tag = document_1.createElement("video");
  62221. while (el.children.length) {
  62222. tag.appendChild(el.firstChild);
  62223. }
  62224. if (!hasClass$1(el, "video-js")) {
  62225. addClass$1(el, "video-js");
  62226. }
  62227. el.appendChild(tag);
  62228. playerElIngest = this.playerElIngest_ = el;
  62229. Object.keys(el).forEach((k) => {
  62230. try {
  62231. tag[k] = el[k];
  62232. } catch (e) {
  62233. }
  62234. });
  62235. }
  62236. tag.setAttribute("tabindex", "-1");
  62237. attrs.tabindex = "-1";
  62238. if (IS_CHROME$1 && IS_WINDOWS$1) {
  62239. tag.setAttribute("role", "application");
  62240. attrs.role = "application";
  62241. }
  62242. tag.removeAttribute("width");
  62243. tag.removeAttribute("height");
  62244. if ("width" in attrs) {
  62245. delete attrs.width;
  62246. }
  62247. if ("height" in attrs) {
  62248. delete attrs.height;
  62249. }
  62250. Object.getOwnPropertyNames(attrs).forEach(function(attr) {
  62251. if (!(divEmbed && attr === "class")) {
  62252. el.setAttribute(attr, attrs[attr]);
  62253. }
  62254. if (divEmbed) {
  62255. tag.setAttribute(attr, attrs[attr]);
  62256. }
  62257. });
  62258. tag.playerId = tag.id;
  62259. tag.id += "_html5_api";
  62260. tag.className = "vjs-tech";
  62261. tag.player = el.player = this;
  62262. this.addClass("vjs-paused");
  62263. if (window_1.VIDEOJS_NO_DYNAMIC_STYLE !== true) {
  62264. this.styleEl_ = createStyleElement$1("vjs-styles-dimensions");
  62265. const defaultsStyleEl = $$1(".vjs-styles-defaults");
  62266. const head = $$1("head");
  62267. head.insertBefore(this.styleEl_, defaultsStyleEl ? defaultsStyleEl.nextSibling : head.firstChild);
  62268. }
  62269. this.fill_ = false;
  62270. this.fluid_ = false;
  62271. this.width(this.options_.width);
  62272. this.height(this.options_.height);
  62273. this.fill(this.options_.fill);
  62274. this.fluid(this.options_.fluid);
  62275. this.aspectRatio(this.options_.aspectRatio);
  62276. this.crossOrigin(this.options_.crossOrigin || this.options_.crossorigin);
  62277. const links = tag.getElementsByTagName("a");
  62278. for (let i2 = 0; i2 < links.length; i2++) {
  62279. const linkEl = links.item(i2);
  62280. addClass$1(linkEl, "vjs-hidden");
  62281. linkEl.setAttribute("hidden", "hidden");
  62282. }
  62283. tag.initNetworkState_ = tag.networkState;
  62284. if (tag.parentNode && !playerElIngest) {
  62285. tag.parentNode.insertBefore(el, tag);
  62286. }
  62287. prependTo$1(tag, el);
  62288. this.children_.unshift(tag);
  62289. this.el_.setAttribute("lang", this.language_);
  62290. this.el_.setAttribute("translate", "no");
  62291. this.el_ = el;
  62292. return el;
  62293. }
  62294. crossOrigin(value) {
  62295. if (typeof value === "undefined") {
  62296. return this.techGet_("crossOrigin");
  62297. }
  62298. if (value !== null && value !== "anonymous" && value !== "use-credentials") {
  62299. log$1$1.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${value}"`);
  62300. return;
  62301. }
  62302. this.techCall_("setCrossOrigin", value);
  62303. if (this.posterImage) {
  62304. this.posterImage.crossOrigin(value);
  62305. }
  62306. return;
  62307. }
  62308. width(value) {
  62309. return this.dimension("width", value);
  62310. }
  62311. height(value) {
  62312. return this.dimension("height", value);
  62313. }
  62314. dimension(dimension, value) {
  62315. const privDimension = dimension + "_";
  62316. if (value === void 0) {
  62317. return this[privDimension] || 0;
  62318. }
  62319. if (value === "" || value === "auto") {
  62320. this[privDimension] = void 0;
  62321. this.updateStyleEl_();
  62322. return;
  62323. }
  62324. const parsedVal = parseFloat(value);
  62325. if (isNaN(parsedVal)) {
  62326. log$1$1.error(`Improper value "${value}" supplied for for ${dimension}`);
  62327. return;
  62328. }
  62329. this[privDimension] = parsedVal;
  62330. this.updateStyleEl_();
  62331. }
  62332. fluid(bool) {
  62333. if (bool === void 0) {
  62334. return !!this.fluid_;
  62335. }
  62336. this.fluid_ = !!bool;
  62337. if (isEvented$1(this)) {
  62338. this.off(["playerreset", "resize"], this.boundUpdateStyleEl_);
  62339. }
  62340. if (bool) {
  62341. this.addClass("vjs-fluid");
  62342. this.fill(false);
  62343. addEventedCallback$1(this, () => {
  62344. this.on(["playerreset", "resize"], this.boundUpdateStyleEl_);
  62345. });
  62346. } else {
  62347. this.removeClass("vjs-fluid");
  62348. }
  62349. this.updateStyleEl_();
  62350. }
  62351. fill(bool) {
  62352. if (bool === void 0) {
  62353. return !!this.fill_;
  62354. }
  62355. this.fill_ = !!bool;
  62356. if (bool) {
  62357. this.addClass("vjs-fill");
  62358. this.fluid(false);
  62359. } else {
  62360. this.removeClass("vjs-fill");
  62361. }
  62362. }
  62363. aspectRatio(ratio) {
  62364. if (ratio === void 0) {
  62365. return this.aspectRatio_;
  62366. }
  62367. if (!/^\d+\:\d+$/.test(ratio)) {
  62368. throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");
  62369. }
  62370. this.aspectRatio_ = ratio;
  62371. this.fluid(true);
  62372. this.updateStyleEl_();
  62373. }
  62374. updateStyleEl_() {
  62375. if (window_1.VIDEOJS_NO_DYNAMIC_STYLE === true) {
  62376. const width3 = typeof this.width_ === "number" ? this.width_ : this.options_.width;
  62377. const height3 = typeof this.height_ === "number" ? this.height_ : this.options_.height;
  62378. const techEl = this.tech_ && this.tech_.el();
  62379. if (techEl) {
  62380. if (width3 >= 0) {
  62381. techEl.width = width3;
  62382. }
  62383. if (height3 >= 0) {
  62384. techEl.height = height3;
  62385. }
  62386. }
  62387. return;
  62388. }
  62389. let width2;
  62390. let height2;
  62391. let aspectRatio;
  62392. let idClass;
  62393. if (this.aspectRatio_ !== void 0 && this.aspectRatio_ !== "auto") {
  62394. aspectRatio = this.aspectRatio_;
  62395. } else if (this.videoWidth() > 0) {
  62396. aspectRatio = this.videoWidth() + ":" + this.videoHeight();
  62397. } else {
  62398. aspectRatio = "16:9";
  62399. }
  62400. const ratioParts = aspectRatio.split(":");
  62401. const ratioMultiplier = ratioParts[1] / ratioParts[0];
  62402. if (this.width_ !== void 0) {
  62403. width2 = this.width_;
  62404. } else if (this.height_ !== void 0) {
  62405. width2 = this.height_ / ratioMultiplier;
  62406. } else {
  62407. width2 = this.videoWidth() || 300;
  62408. }
  62409. if (this.height_ !== void 0) {
  62410. height2 = this.height_;
  62411. } else {
  62412. height2 = width2 * ratioMultiplier;
  62413. }
  62414. if (/^[^a-zA-Z]/.test(this.id())) {
  62415. idClass = "dimensions-" + this.id();
  62416. } else {
  62417. idClass = this.id() + "-dimensions";
  62418. }
  62419. this.addClass(idClass);
  62420. setTextContent$1(this.styleEl_, `
  62421. .${idClass} {
  62422. width: ${width2}px;
  62423. height: ${height2}px;
  62424. }
  62425. .${idClass}.vjs-fluid:not(.vjs-audio-only-mode) {
  62426. padding-top: ${ratioMultiplier * 100}%;
  62427. }
  62428. `);
  62429. }
  62430. loadTech_(techName, source) {
  62431. if (this.tech_) {
  62432. this.unloadTech_();
  62433. }
  62434. const titleTechName = toTitleCase$1$1(techName);
  62435. const camelTechName = techName.charAt(0).toLowerCase() + techName.slice(1);
  62436. if (titleTechName !== "Html5" && this.tag) {
  62437. Tech$2.getTech("Html5").disposeMediaElement(this.tag);
  62438. this.tag.player = null;
  62439. this.tag = null;
  62440. }
  62441. this.techName_ = titleTechName;
  62442. this.isReady_ = false;
  62443. let autoplay = this.autoplay();
  62444. if (typeof this.autoplay() === "string" || this.autoplay() === true && this.options_.normalizeAutoplay) {
  62445. autoplay = false;
  62446. }
  62447. const techOptions = {
  62448. source,
  62449. autoplay,
  62450. "nativeControlsForTouch": this.options_.nativeControlsForTouch,
  62451. "playerId": this.id(),
  62452. "techId": `${this.id()}_${camelTechName}_api`,
  62453. "playsinline": this.options_.playsinline,
  62454. "preload": this.options_.preload,
  62455. "loop": this.options_.loop,
  62456. "disablePictureInPicture": this.options_.disablePictureInPicture,
  62457. "muted": this.options_.muted,
  62458. "poster": this.poster(),
  62459. "language": this.language(),
  62460. "playerElIngest": this.playerElIngest_ || false,
  62461. "vtt.js": this.options_["vtt.js"],
  62462. "canOverridePoster": !!this.options_.techCanOverridePoster,
  62463. "enableSourceset": this.options_.enableSourceset
  62464. };
  62465. ALL$1.names.forEach((name) => {
  62466. const props = ALL$1[name];
  62467. techOptions[props.getterName] = this[props.privateName];
  62468. });
  62469. Object.assign(techOptions, this.options_[titleTechName]);
  62470. Object.assign(techOptions, this.options_[camelTechName]);
  62471. Object.assign(techOptions, this.options_[techName.toLowerCase()]);
  62472. if (this.tag) {
  62473. techOptions.tag = this.tag;
  62474. }
  62475. if (source && source.src === this.cache_.src && this.cache_.currentTime > 0) {
  62476. techOptions.startTime = this.cache_.currentTime;
  62477. }
  62478. const TechClass = Tech$2.getTech(techName);
  62479. if (!TechClass) {
  62480. throw new Error(`No Tech named '${titleTechName}' exists! '${titleTechName}' should be registered using videojs.registerTech()'`);
  62481. }
  62482. this.tech_ = new TechClass(techOptions);
  62483. this.tech_.ready(bind_(this, this.handleTechReady_), true);
  62484. textTrackConverter$1.jsonToTextTracks(this.textTracksJson_ || [], this.tech_);
  62485. TECH_EVENTS_RETRIGGER$1.forEach((event2) => {
  62486. this.on(this.tech_, event2, (e) => this[`handleTech${toTitleCase$1$1(event2)}_`](e));
  62487. });
  62488. Object.keys(TECH_EVENTS_QUEUE$1).forEach((event2) => {
  62489. this.on(this.tech_, event2, (eventObj) => {
  62490. if (this.tech_.playbackRate() === 0 && this.tech_.seeking()) {
  62491. this.queuedCallbacks_.push({
  62492. callback: this[`handleTech${TECH_EVENTS_QUEUE$1[event2]}_`].bind(this),
  62493. event: eventObj
  62494. });
  62495. return;
  62496. }
  62497. this[`handleTech${TECH_EVENTS_QUEUE$1[event2]}_`](eventObj);
  62498. });
  62499. });
  62500. this.on(this.tech_, "loadstart", (e) => this.handleTechLoadStart_(e));
  62501. this.on(this.tech_, "sourceset", (e) => this.handleTechSourceset_(e));
  62502. this.on(this.tech_, "waiting", (e) => this.handleTechWaiting_(e));
  62503. this.on(this.tech_, "ended", (e) => this.handleTechEnded_(e));
  62504. this.on(this.tech_, "seeking", (e) => this.handleTechSeeking_(e));
  62505. this.on(this.tech_, "play", (e) => this.handleTechPlay_(e));
  62506. this.on(this.tech_, "pause", (e) => this.handleTechPause_(e));
  62507. this.on(this.tech_, "durationchange", (e) => this.handleTechDurationChange_(e));
  62508. this.on(this.tech_, "fullscreenchange", (e, data) => this.handleTechFullscreenChange_(e, data));
  62509. this.on(this.tech_, "fullscreenerror", (e, err) => this.handleTechFullscreenError_(e, err));
  62510. this.on(this.tech_, "enterpictureinpicture", (e) => this.handleTechEnterPictureInPicture_(e));
  62511. this.on(this.tech_, "leavepictureinpicture", (e) => this.handleTechLeavePictureInPicture_(e));
  62512. this.on(this.tech_, "error", (e) => this.handleTechError_(e));
  62513. this.on(this.tech_, "posterchange", (e) => this.handleTechPosterChange_(e));
  62514. this.on(this.tech_, "textdata", (e) => this.handleTechTextData_(e));
  62515. this.on(this.tech_, "ratechange", (e) => this.handleTechRateChange_(e));
  62516. this.on(this.tech_, "loadedmetadata", this.boundUpdateStyleEl_);
  62517. this.usingNativeControls(this.techGet_("controls"));
  62518. if (this.controls() && !this.usingNativeControls()) {
  62519. this.addTechControlsListeners_();
  62520. }
  62521. if (this.tech_.el().parentNode !== this.el() && (titleTechName !== "Html5" || !this.tag)) {
  62522. prependTo$1(this.tech_.el(), this.el());
  62523. }
  62524. if (this.tag) {
  62525. this.tag.player = null;
  62526. this.tag = null;
  62527. }
  62528. }
  62529. unloadTech_() {
  62530. ALL$1.names.forEach((name) => {
  62531. const props = ALL$1[name];
  62532. this[props.privateName] = this[props.getterName]();
  62533. });
  62534. this.textTracksJson_ = textTrackConverter$1.textTracksToJson(this.tech_);
  62535. this.isReady_ = false;
  62536. this.tech_.dispose();
  62537. this.tech_ = false;
  62538. if (this.isPosterFromTech_) {
  62539. this.poster_ = "";
  62540. this.trigger("posterchange");
  62541. }
  62542. this.isPosterFromTech_ = false;
  62543. }
  62544. tech(safety) {
  62545. if (safety === void 0) {
  62546. log$1$1.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n");
  62547. }
  62548. return this.tech_;
  62549. }
  62550. addTechControlsListeners_() {
  62551. this.removeTechControlsListeners_();
  62552. this.on(this.tech_, "click", this.boundHandleTechClick_);
  62553. this.on(this.tech_, "dblclick", this.boundHandleTechDoubleClick_);
  62554. this.on(this.tech_, "touchstart", this.boundHandleTechTouchStart_);
  62555. this.on(this.tech_, "touchmove", this.boundHandleTechTouchMove_);
  62556. this.on(this.tech_, "touchend", this.boundHandleTechTouchEnd_);
  62557. this.on(this.tech_, "tap", this.boundHandleTechTap_);
  62558. }
  62559. removeTechControlsListeners_() {
  62560. this.off(this.tech_, "tap", this.boundHandleTechTap_);
  62561. this.off(this.tech_, "touchstart", this.boundHandleTechTouchStart_);
  62562. this.off(this.tech_, "touchmove", this.boundHandleTechTouchMove_);
  62563. this.off(this.tech_, "touchend", this.boundHandleTechTouchEnd_);
  62564. this.off(this.tech_, "click", this.boundHandleTechClick_);
  62565. this.off(this.tech_, "dblclick", this.boundHandleTechDoubleClick_);
  62566. }
  62567. handleTechReady_() {
  62568. this.triggerReady();
  62569. if (this.cache_.volume) {
  62570. this.techCall_("setVolume", this.cache_.volume);
  62571. }
  62572. this.handleTechPosterChange_();
  62573. this.handleTechDurationChange_();
  62574. }
  62575. handleTechLoadStart_() {
  62576. this.removeClass("vjs-ended", "vjs-seeking");
  62577. this.error(null);
  62578. this.handleTechDurationChange_();
  62579. if (!this.paused()) {
  62580. this.trigger("loadstart");
  62581. } else {
  62582. this.hasStarted(false);
  62583. this.trigger("loadstart");
  62584. }
  62585. this.manualAutoplay_(this.autoplay() === true && this.options_.normalizeAutoplay ? "play" : this.autoplay());
  62586. }
  62587. manualAutoplay_(type2) {
  62588. if (!this.tech_ || typeof type2 !== "string") {
  62589. return;
  62590. }
  62591. const resolveMuted = () => {
  62592. const previouslyMuted = this.muted();
  62593. this.muted(true);
  62594. const restoreMuted = () => {
  62595. this.muted(previouslyMuted);
  62596. };
  62597. this.playTerminatedQueue_.push(restoreMuted);
  62598. const mutedPromise = this.play();
  62599. if (!isPromise$1(mutedPromise)) {
  62600. return;
  62601. }
  62602. return mutedPromise.catch((err) => {
  62603. restoreMuted();
  62604. throw new Error(`Rejection at manualAutoplay. Restoring muted value. ${err ? err : ""}`);
  62605. });
  62606. };
  62607. let promise;
  62608. if (type2 === "any" && !this.muted()) {
  62609. promise = this.play();
  62610. if (isPromise$1(promise)) {
  62611. promise = promise.catch(resolveMuted);
  62612. }
  62613. } else if (type2 === "muted" && !this.muted()) {
  62614. promise = resolveMuted();
  62615. } else {
  62616. promise = this.play();
  62617. }
  62618. if (!isPromise$1(promise)) {
  62619. return;
  62620. }
  62621. return promise.then(() => {
  62622. this.trigger({
  62623. type: "autoplay-success",
  62624. autoplay: type2
  62625. });
  62626. }).catch(() => {
  62627. this.trigger({
  62628. type: "autoplay-failure",
  62629. autoplay: type2
  62630. });
  62631. });
  62632. }
  62633. updateSourceCaches_(srcObj = "") {
  62634. let src = srcObj;
  62635. let type2 = "";
  62636. if (typeof src !== "string") {
  62637. src = srcObj.src;
  62638. type2 = srcObj.type;
  62639. }
  62640. this.cache_.source = this.cache_.source || {};
  62641. this.cache_.sources = this.cache_.sources || [];
  62642. if (src && !type2) {
  62643. type2 = findMimetype$1(this, src);
  62644. }
  62645. this.cache_.source = merge$1({}, srcObj, {
  62646. src,
  62647. type: type2
  62648. });
  62649. const matchingSources = this.cache_.sources.filter((s) => s.src && s.src === src);
  62650. const sourceElSources = [];
  62651. const sourceEls = this.$$("source");
  62652. const matchingSourceEls = [];
  62653. for (let i2 = 0; i2 < sourceEls.length; i2++) {
  62654. const sourceObj = getAttributes$1(sourceEls[i2]);
  62655. sourceElSources.push(sourceObj);
  62656. if (sourceObj.src && sourceObj.src === src) {
  62657. matchingSourceEls.push(sourceObj.src);
  62658. }
  62659. }
  62660. if (matchingSourceEls.length && !matchingSources.length) {
  62661. this.cache_.sources = sourceElSources;
  62662. } else if (!matchingSources.length) {
  62663. this.cache_.sources = [this.cache_.source];
  62664. }
  62665. this.cache_.src = src;
  62666. }
  62667. handleTechSourceset_(event2) {
  62668. if (!this.changingSrc_) {
  62669. let updateSourceCaches = (src) => this.updateSourceCaches_(src);
  62670. const playerSrc = this.currentSource().src;
  62671. const eventSrc = event2.src;
  62672. if (playerSrc && !/^blob:/.test(playerSrc) && /^blob:/.test(eventSrc)) {
  62673. if (!this.lastSource_ || this.lastSource_.tech !== eventSrc && this.lastSource_.player !== playerSrc) {
  62674. updateSourceCaches = () => {
  62675. };
  62676. }
  62677. }
  62678. updateSourceCaches(eventSrc);
  62679. if (!event2.src) {
  62680. this.tech_.any(["sourceset", "loadstart"], (e) => {
  62681. if (e.type === "sourceset") {
  62682. return;
  62683. }
  62684. const techSrc = this.techGet("currentSrc");
  62685. this.lastSource_.tech = techSrc;
  62686. this.updateSourceCaches_(techSrc);
  62687. });
  62688. }
  62689. }
  62690. this.lastSource_ = {
  62691. player: this.currentSource().src,
  62692. tech: event2.src
  62693. };
  62694. this.trigger({
  62695. src: event2.src,
  62696. type: "sourceset"
  62697. });
  62698. }
  62699. hasStarted(request) {
  62700. if (request === void 0) {
  62701. return this.hasStarted_;
  62702. }
  62703. if (request === this.hasStarted_) {
  62704. return;
  62705. }
  62706. this.hasStarted_ = request;
  62707. if (this.hasStarted_) {
  62708. this.addClass("vjs-has-started");
  62709. } else {
  62710. this.removeClass("vjs-has-started");
  62711. }
  62712. }
  62713. handleTechPlay_() {
  62714. this.removeClass("vjs-ended", "vjs-paused");
  62715. this.addClass("vjs-playing");
  62716. this.hasStarted(true);
  62717. this.trigger("play");
  62718. }
  62719. handleTechRateChange_() {
  62720. if (this.tech_.playbackRate() > 0 && this.cache_.lastPlaybackRate === 0) {
  62721. this.queuedCallbacks_.forEach((queued) => queued.callback(queued.event));
  62722. this.queuedCallbacks_ = [];
  62723. }
  62724. this.cache_.lastPlaybackRate = this.tech_.playbackRate();
  62725. this.trigger("ratechange");
  62726. }
  62727. handleTechWaiting_() {
  62728. this.addClass("vjs-waiting");
  62729. this.trigger("waiting");
  62730. const timeWhenWaiting = this.currentTime();
  62731. const timeUpdateListener = () => {
  62732. if (timeWhenWaiting !== this.currentTime()) {
  62733. this.removeClass("vjs-waiting");
  62734. this.off("timeupdate", timeUpdateListener);
  62735. }
  62736. };
  62737. this.on("timeupdate", timeUpdateListener);
  62738. }
  62739. handleTechCanPlay_() {
  62740. this.removeClass("vjs-waiting");
  62741. this.trigger("canplay");
  62742. }
  62743. handleTechCanPlayThrough_() {
  62744. this.removeClass("vjs-waiting");
  62745. this.trigger("canplaythrough");
  62746. }
  62747. handleTechPlaying_() {
  62748. this.removeClass("vjs-waiting");
  62749. this.trigger("playing");
  62750. }
  62751. handleTechSeeking_() {
  62752. this.addClass("vjs-seeking");
  62753. this.trigger("seeking");
  62754. }
  62755. handleTechSeeked_() {
  62756. this.removeClass("vjs-seeking", "vjs-ended");
  62757. this.trigger("seeked");
  62758. }
  62759. handleTechPause_() {
  62760. this.removeClass("vjs-playing");
  62761. this.addClass("vjs-paused");
  62762. this.trigger("pause");
  62763. }
  62764. handleTechEnded_() {
  62765. this.addClass("vjs-ended");
  62766. this.removeClass("vjs-waiting");
  62767. if (this.options_.loop) {
  62768. this.currentTime(0);
  62769. this.play();
  62770. } else if (!this.paused()) {
  62771. this.pause();
  62772. }
  62773. this.trigger("ended");
  62774. }
  62775. handleTechDurationChange_() {
  62776. this.duration(this.techGet_("duration"));
  62777. }
  62778. handleTechClick_(event2) {
  62779. if (!this.controls_) {
  62780. return;
  62781. }
  62782. if (this.options_ === void 0 || this.options_.userActions === void 0 || this.options_.userActions.click === void 0 || this.options_.userActions.click !== false) {
  62783. if (this.options_ !== void 0 && this.options_.userActions !== void 0 && typeof this.options_.userActions.click === "function") {
  62784. this.options_.userActions.click.call(this, event2);
  62785. } else if (this.paused()) {
  62786. silencePromise$1(this.play());
  62787. } else {
  62788. this.pause();
  62789. }
  62790. }
  62791. }
  62792. handleTechDoubleClick_(event2) {
  62793. if (!this.controls_) {
  62794. return;
  62795. }
  62796. const inAllowedEls = Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"), (el) => el.contains(event2.target));
  62797. if (!inAllowedEls) {
  62798. if (this.options_ === void 0 || this.options_.userActions === void 0 || this.options_.userActions.doubleClick === void 0 || this.options_.userActions.doubleClick !== false) {
  62799. if (this.options_ !== void 0 && this.options_.userActions !== void 0 && typeof this.options_.userActions.doubleClick === "function") {
  62800. this.options_.userActions.doubleClick.call(this, event2);
  62801. } else if (this.isFullscreen()) {
  62802. this.exitFullscreen();
  62803. } else {
  62804. this.requestFullscreen();
  62805. }
  62806. }
  62807. }
  62808. }
  62809. handleTechTap_() {
  62810. this.userActive(!this.userActive());
  62811. }
  62812. handleTechTouchStart_() {
  62813. this.userWasActive = this.userActive();
  62814. }
  62815. handleTechTouchMove_() {
  62816. if (this.userWasActive) {
  62817. this.reportUserActivity();
  62818. }
  62819. }
  62820. handleTechTouchEnd_(event2) {
  62821. if (event2.cancelable) {
  62822. event2.preventDefault();
  62823. }
  62824. }
  62825. toggleFullscreenClass_() {
  62826. if (this.isFullscreen()) {
  62827. this.addClass("vjs-fullscreen");
  62828. } else {
  62829. this.removeClass("vjs-fullscreen");
  62830. }
  62831. }
  62832. documentFullscreenChange_(e) {
  62833. const targetPlayer = e.target.player;
  62834. if (targetPlayer && targetPlayer !== this) {
  62835. return;
  62836. }
  62837. const el = this.el();
  62838. let isFs = document_1[this.fsApi_.fullscreenElement] === el;
  62839. if (!isFs && el.matches) {
  62840. isFs = el.matches(":" + this.fsApi_.fullscreen);
  62841. } else if (!isFs && el.msMatchesSelector) {
  62842. isFs = el.msMatchesSelector(":" + this.fsApi_.fullscreen);
  62843. }
  62844. this.isFullscreen(isFs);
  62845. }
  62846. handleTechFullscreenChange_(event2, data) {
  62847. if (data) {
  62848. if (data.nativeIOSFullscreen) {
  62849. this.addClass("vjs-ios-native-fs");
  62850. this.tech_.one("webkitendfullscreen", () => {
  62851. this.removeClass("vjs-ios-native-fs");
  62852. });
  62853. }
  62854. this.isFullscreen(data.isFullscreen);
  62855. }
  62856. }
  62857. handleTechFullscreenError_(event2, err) {
  62858. this.trigger("fullscreenerror", err);
  62859. }
  62860. togglePictureInPictureClass_() {
  62861. if (this.isInPictureInPicture()) {
  62862. this.addClass("vjs-picture-in-picture");
  62863. } else {
  62864. this.removeClass("vjs-picture-in-picture");
  62865. }
  62866. }
  62867. handleTechEnterPictureInPicture_(event2) {
  62868. this.isInPictureInPicture(true);
  62869. }
  62870. handleTechLeavePictureInPicture_(event2) {
  62871. this.isInPictureInPicture(false);
  62872. }
  62873. handleTechError_() {
  62874. const error = this.tech_.error();
  62875. this.error(error);
  62876. }
  62877. handleTechTextData_() {
  62878. let data = null;
  62879. if (arguments.length > 1) {
  62880. data = arguments[1];
  62881. }
  62882. this.trigger("textdata", data);
  62883. }
  62884. getCache() {
  62885. return this.cache_;
  62886. }
  62887. resetCache_() {
  62888. this.cache_ = {
  62889. currentTime: 0,
  62890. initTime: 0,
  62891. inactivityTimeout: this.options_.inactivityTimeout,
  62892. duration: NaN,
  62893. lastVolume: 1,
  62894. lastPlaybackRate: this.defaultPlaybackRate(),
  62895. media: null,
  62896. src: "",
  62897. source: {},
  62898. sources: [],
  62899. playbackRates: [],
  62900. volume: 1
  62901. };
  62902. }
  62903. techCall_(method, arg) {
  62904. this.ready(function() {
  62905. if (method in allowedSetters$1) {
  62906. return set$1(this.middleware_, this.tech_, method, arg);
  62907. } else if (method in allowedMediators$1) {
  62908. return mediate$1(this.middleware_, this.tech_, method, arg);
  62909. }
  62910. try {
  62911. if (this.tech_) {
  62912. this.tech_[method](arg);
  62913. }
  62914. } catch (e) {
  62915. log$1$1(e);
  62916. throw e;
  62917. }
  62918. }, true);
  62919. }
  62920. techGet_(method) {
  62921. if (!this.tech_ || !this.tech_.isReady_) {
  62922. return;
  62923. }
  62924. if (method in allowedGetters$1) {
  62925. return get$1(this.middleware_, this.tech_, method);
  62926. } else if (method in allowedMediators$1) {
  62927. return mediate$1(this.middleware_, this.tech_, method);
  62928. }
  62929. try {
  62930. return this.tech_[method]();
  62931. } catch (e) {
  62932. if (this.tech_[method] === void 0) {
  62933. log$1$1(`Video.js: ${method} method not defined for ${this.techName_} playback technology.`, e);
  62934. throw e;
  62935. }
  62936. if (e.name === "TypeError") {
  62937. log$1$1(`Video.js: ${method} unavailable on ${this.techName_} playback technology element.`, e);
  62938. this.tech_.isReady_ = false;
  62939. throw e;
  62940. }
  62941. log$1$1(e);
  62942. throw e;
  62943. }
  62944. }
  62945. play() {
  62946. return new Promise((resolve2) => {
  62947. this.play_(resolve2);
  62948. });
  62949. }
  62950. play_(callback2 = silencePromise$1) {
  62951. this.playCallbacks_.push(callback2);
  62952. const isSrcReady = Boolean(!this.changingSrc_ && (this.src() || this.currentSrc()));
  62953. const isSafariOrIOS = Boolean(IS_ANY_SAFARI$1 || IS_IOS$1);
  62954. if (this.waitToPlay_) {
  62955. this.off(["ready", "loadstart"], this.waitToPlay_);
  62956. this.waitToPlay_ = null;
  62957. }
  62958. if (!this.isReady_ || !isSrcReady) {
  62959. this.waitToPlay_ = (e) => {
  62960. this.play_();
  62961. };
  62962. this.one(["ready", "loadstart"], this.waitToPlay_);
  62963. if (!isSrcReady && isSafariOrIOS) {
  62964. this.load();
  62965. }
  62966. return;
  62967. }
  62968. const val = this.techGet_("play");
  62969. const isNativeReplay = isSafariOrIOS && this.hasClass("vjs-ended");
  62970. if (isNativeReplay) {
  62971. this.resetProgressBar_();
  62972. }
  62973. if (val === null) {
  62974. this.runPlayTerminatedQueue_();
  62975. } else {
  62976. this.runPlayCallbacks_(val);
  62977. }
  62978. }
  62979. runPlayTerminatedQueue_() {
  62980. const queue = this.playTerminatedQueue_.slice(0);
  62981. this.playTerminatedQueue_ = [];
  62982. queue.forEach(function(q2) {
  62983. q2();
  62984. });
  62985. }
  62986. runPlayCallbacks_(val) {
  62987. const callbacks = this.playCallbacks_.slice(0);
  62988. this.playCallbacks_ = [];
  62989. this.playTerminatedQueue_ = [];
  62990. callbacks.forEach(function(cb) {
  62991. cb(val);
  62992. });
  62993. }
  62994. pause() {
  62995. this.techCall_("pause");
  62996. }
  62997. paused() {
  62998. return this.techGet_("paused") === false ? false : true;
  62999. }
  63000. played() {
  63001. return this.techGet_("played") || createTimeRanges$1(0, 0);
  63002. }
  63003. scrubbing(isScrubbing) {
  63004. if (typeof isScrubbing === "undefined") {
  63005. return this.scrubbing_;
  63006. }
  63007. this.scrubbing_ = !!isScrubbing;
  63008. this.techCall_("setScrubbing", this.scrubbing_);
  63009. if (isScrubbing) {
  63010. this.addClass("vjs-scrubbing");
  63011. } else {
  63012. this.removeClass("vjs-scrubbing");
  63013. }
  63014. }
  63015. currentTime(seconds) {
  63016. if (typeof seconds !== "undefined") {
  63017. if (seconds < 0) {
  63018. seconds = 0;
  63019. }
  63020. if (!this.isReady_ || this.changingSrc_ || !this.tech_ || !this.tech_.isReady_) {
  63021. this.cache_.initTime = seconds;
  63022. this.off("canplay", this.boundApplyInitTime_);
  63023. this.one("canplay", this.boundApplyInitTime_);
  63024. return;
  63025. }
  63026. this.techCall_("setCurrentTime", seconds);
  63027. this.cache_.initTime = 0;
  63028. return;
  63029. }
  63030. this.cache_.currentTime = this.techGet_("currentTime") || 0;
  63031. return this.cache_.currentTime;
  63032. }
  63033. applyInitTime_() {
  63034. this.currentTime(this.cache_.initTime);
  63035. }
  63036. duration(seconds) {
  63037. if (seconds === void 0) {
  63038. return this.cache_.duration !== void 0 ? this.cache_.duration : NaN;
  63039. }
  63040. seconds = parseFloat(seconds);
  63041. if (seconds < 0) {
  63042. seconds = Infinity;
  63043. }
  63044. if (seconds !== this.cache_.duration) {
  63045. this.cache_.duration = seconds;
  63046. if (seconds === Infinity) {
  63047. this.addClass("vjs-live");
  63048. } else {
  63049. this.removeClass("vjs-live");
  63050. }
  63051. if (!isNaN(seconds)) {
  63052. this.trigger("durationchange");
  63053. }
  63054. }
  63055. }
  63056. remainingTime() {
  63057. return this.duration() - this.currentTime();
  63058. }
  63059. remainingTimeDisplay() {
  63060. return Math.floor(this.duration()) - Math.floor(this.currentTime());
  63061. }
  63062. buffered() {
  63063. let buffered = this.techGet_("buffered");
  63064. if (!buffered || !buffered.length) {
  63065. buffered = createTimeRanges$1(0, 0);
  63066. }
  63067. return buffered;
  63068. }
  63069. bufferedPercent() {
  63070. return bufferedPercent$1(this.buffered(), this.duration());
  63071. }
  63072. bufferedEnd() {
  63073. const buffered = this.buffered();
  63074. const duration5 = this.duration();
  63075. let end = buffered.end(buffered.length - 1);
  63076. if (end > duration5) {
  63077. end = duration5;
  63078. }
  63079. return end;
  63080. }
  63081. volume(percentAsDecimal) {
  63082. let vol;
  63083. if (percentAsDecimal !== void 0) {
  63084. vol = Math.max(0, Math.min(1, parseFloat(percentAsDecimal)));
  63085. this.cache_.volume = vol;
  63086. this.techCall_("setVolume", vol);
  63087. if (vol > 0) {
  63088. this.lastVolume_(vol);
  63089. }
  63090. return;
  63091. }
  63092. vol = parseFloat(this.techGet_("volume"));
  63093. return isNaN(vol) ? 1 : vol;
  63094. }
  63095. muted(muted) {
  63096. if (muted !== void 0) {
  63097. this.techCall_("setMuted", muted);
  63098. return;
  63099. }
  63100. return this.techGet_("muted") || false;
  63101. }
  63102. defaultMuted(defaultMuted) {
  63103. if (defaultMuted !== void 0) {
  63104. return this.techCall_("setDefaultMuted", defaultMuted);
  63105. }
  63106. return this.techGet_("defaultMuted") || false;
  63107. }
  63108. lastVolume_(percentAsDecimal) {
  63109. if (percentAsDecimal !== void 0 && percentAsDecimal !== 0) {
  63110. this.cache_.lastVolume = percentAsDecimal;
  63111. return;
  63112. }
  63113. return this.cache_.lastVolume;
  63114. }
  63115. supportsFullScreen() {
  63116. return this.techGet_("supportsFullScreen") || false;
  63117. }
  63118. isFullscreen(isFS) {
  63119. if (isFS !== void 0) {
  63120. const oldValue = this.isFullscreen_;
  63121. this.isFullscreen_ = Boolean(isFS);
  63122. if (this.isFullscreen_ !== oldValue && this.fsApi_.prefixed) {
  63123. this.trigger("fullscreenchange");
  63124. }
  63125. this.toggleFullscreenClass_();
  63126. return;
  63127. }
  63128. return this.isFullscreen_;
  63129. }
  63130. requestFullscreen(fullscreenOptions) {
  63131. if (this.isInPictureInPicture()) {
  63132. this.exitPictureInPicture();
  63133. }
  63134. const self2 = this;
  63135. return new Promise((resolve2, reject2) => {
  63136. function offHandler() {
  63137. self2.off("fullscreenerror", errorHandler);
  63138. self2.off("fullscreenchange", changeHandler);
  63139. }
  63140. function changeHandler() {
  63141. offHandler();
  63142. resolve2();
  63143. }
  63144. function errorHandler(e, err) {
  63145. offHandler();
  63146. reject2(err);
  63147. }
  63148. self2.one("fullscreenchange", changeHandler);
  63149. self2.one("fullscreenerror", errorHandler);
  63150. const promise = self2.requestFullscreenHelper_(fullscreenOptions);
  63151. if (promise) {
  63152. promise.then(offHandler, offHandler);
  63153. promise.then(resolve2, reject2);
  63154. }
  63155. });
  63156. }
  63157. requestFullscreenHelper_(fullscreenOptions) {
  63158. let fsOptions;
  63159. if (!this.fsApi_.prefixed) {
  63160. fsOptions = this.options_.fullscreen && this.options_.fullscreen.options || {};
  63161. if (fullscreenOptions !== void 0) {
  63162. fsOptions = fullscreenOptions;
  63163. }
  63164. }
  63165. if (this.fsApi_.requestFullscreen) {
  63166. const promise = this.el_[this.fsApi_.requestFullscreen](fsOptions);
  63167. if (promise) {
  63168. promise.then(() => this.isFullscreen(true), () => this.isFullscreen(false));
  63169. }
  63170. return promise;
  63171. } else if (this.tech_.supportsFullScreen() && !this.options_.preferFullWindow === true) {
  63172. this.techCall_("enterFullScreen");
  63173. } else {
  63174. this.enterFullWindow();
  63175. }
  63176. }
  63177. exitFullscreen() {
  63178. const self2 = this;
  63179. return new Promise((resolve2, reject2) => {
  63180. function offHandler() {
  63181. self2.off("fullscreenerror", errorHandler);
  63182. self2.off("fullscreenchange", changeHandler);
  63183. }
  63184. function changeHandler() {
  63185. offHandler();
  63186. resolve2();
  63187. }
  63188. function errorHandler(e, err) {
  63189. offHandler();
  63190. reject2(err);
  63191. }
  63192. self2.one("fullscreenchange", changeHandler);
  63193. self2.one("fullscreenerror", errorHandler);
  63194. const promise = self2.exitFullscreenHelper_();
  63195. if (promise) {
  63196. promise.then(offHandler, offHandler);
  63197. promise.then(resolve2, reject2);
  63198. }
  63199. });
  63200. }
  63201. exitFullscreenHelper_() {
  63202. if (this.fsApi_.requestFullscreen) {
  63203. const promise = document_1[this.fsApi_.exitFullscreen]();
  63204. if (promise) {
  63205. silencePromise$1(promise.then(() => this.isFullscreen(false)));
  63206. }
  63207. return promise;
  63208. } else if (this.tech_.supportsFullScreen() && !this.options_.preferFullWindow === true) {
  63209. this.techCall_("exitFullScreen");
  63210. } else {
  63211. this.exitFullWindow();
  63212. }
  63213. }
  63214. enterFullWindow() {
  63215. this.isFullscreen(true);
  63216. this.isFullWindow = true;
  63217. this.docOrigOverflow = document_1.documentElement.style.overflow;
  63218. on$1(document_1, "keydown", this.boundFullWindowOnEscKey_);
  63219. document_1.documentElement.style.overflow = "hidden";
  63220. addClass$1(document_1.body, "vjs-full-window");
  63221. this.trigger("enterFullWindow");
  63222. }
  63223. fullWindowOnEscKey(event2) {
  63224. if (keycode.isEventKey(event2, "Esc")) {
  63225. if (this.isFullscreen() === true) {
  63226. if (!this.isFullWindow) {
  63227. this.exitFullscreen();
  63228. } else {
  63229. this.exitFullWindow();
  63230. }
  63231. }
  63232. }
  63233. }
  63234. exitFullWindow() {
  63235. this.isFullscreen(false);
  63236. this.isFullWindow = false;
  63237. off$1(document_1, "keydown", this.boundFullWindowOnEscKey_);
  63238. document_1.documentElement.style.overflow = this.docOrigOverflow;
  63239. removeClass$1(document_1.body, "vjs-full-window");
  63240. this.trigger("exitFullWindow");
  63241. }
  63242. disablePictureInPicture(value) {
  63243. if (value === void 0) {
  63244. return this.techGet_("disablePictureInPicture");
  63245. }
  63246. this.techCall_("setDisablePictureInPicture", value);
  63247. this.options_.disablePictureInPicture = value;
  63248. this.trigger("disablepictureinpicturechanged");
  63249. }
  63250. isInPictureInPicture(isPiP) {
  63251. if (isPiP !== void 0) {
  63252. this.isInPictureInPicture_ = !!isPiP;
  63253. this.togglePictureInPictureClass_();
  63254. return;
  63255. }
  63256. return !!this.isInPictureInPicture_;
  63257. }
  63258. requestPictureInPicture() {
  63259. if (this.options_.enableDocumentPictureInPicture && window_1.documentPictureInPicture) {
  63260. const pipContainer = document_1.createElement(this.el().tagName);
  63261. pipContainer.classList = this.el().classList;
  63262. pipContainer.classList.add("vjs-pip-container");
  63263. if (this.posterImage) {
  63264. pipContainer.appendChild(this.posterImage.el().cloneNode(true));
  63265. }
  63266. if (this.titleBar) {
  63267. pipContainer.appendChild(this.titleBar.el().cloneNode(true));
  63268. }
  63269. pipContainer.appendChild(createEl$1("p", {
  63270. className: "vjs-pip-text"
  63271. }, {}, this.localize("Playing in picture-in-picture")));
  63272. return window_1.documentPictureInPicture.requestWindow({
  63273. initialAspectRatio: this.videoWidth() / this.videoHeight(),
  63274. copyStyleSheets: true
  63275. }).then((pipWindow) => {
  63276. this.el_.parentNode.insertBefore(pipContainer, this.el_);
  63277. pipWindow.document.body.append(this.el_);
  63278. pipWindow.document.body.classList.add("vjs-pip-window");
  63279. this.player_.isInPictureInPicture(true);
  63280. this.player_.trigger("enterpictureinpicture");
  63281. pipWindow.addEventListener("unload", (event2) => {
  63282. const pipVideo = event2.target.querySelector(".video-js");
  63283. pipContainer.replaceWith(pipVideo);
  63284. this.player_.isInPictureInPicture(false);
  63285. this.player_.trigger("leavepictureinpicture");
  63286. });
  63287. return pipWindow;
  63288. });
  63289. }
  63290. if ("pictureInPictureEnabled" in document_1 && this.disablePictureInPicture() === false) {
  63291. return this.techGet_("requestPictureInPicture");
  63292. }
  63293. return Promise.reject("No PiP mode is available");
  63294. }
  63295. exitPictureInPicture() {
  63296. if (window_1.documentPictureInPicture && window_1.documentPictureInPicture.window) {
  63297. window_1.documentPictureInPicture.window.close();
  63298. return Promise.resolve();
  63299. }
  63300. if ("pictureInPictureEnabled" in document_1) {
  63301. return document_1.exitPictureInPicture();
  63302. }
  63303. }
  63304. handleKeyDown(event2) {
  63305. const {
  63306. userActions
  63307. } = this.options_;
  63308. if (!userActions || !userActions.hotkeys) {
  63309. return;
  63310. }
  63311. const excludeElement = (el) => {
  63312. const tagName = el.tagName.toLowerCase();
  63313. if (el.isContentEditable) {
  63314. return true;
  63315. }
  63316. const allowedInputTypes = ["button", "checkbox", "hidden", "radio", "reset", "submit"];
  63317. if (tagName === "input") {
  63318. return allowedInputTypes.indexOf(el.type) === -1;
  63319. }
  63320. const excludedTags = ["textarea"];
  63321. return excludedTags.indexOf(tagName) !== -1;
  63322. };
  63323. if (excludeElement(this.el_.ownerDocument.activeElement)) {
  63324. return;
  63325. }
  63326. if (typeof userActions.hotkeys === "function") {
  63327. userActions.hotkeys.call(this, event2);
  63328. } else {
  63329. this.handleHotkeys(event2);
  63330. }
  63331. }
  63332. handleHotkeys(event2) {
  63333. const hotkeys = this.options_.userActions ? this.options_.userActions.hotkeys : {};
  63334. const {
  63335. fullscreenKey = (keydownEvent) => keycode.isEventKey(keydownEvent, "f"),
  63336. muteKey = (keydownEvent) => keycode.isEventKey(keydownEvent, "m"),
  63337. playPauseKey = (keydownEvent) => keycode.isEventKey(keydownEvent, "k") || keycode.isEventKey(keydownEvent, "Space")
  63338. } = hotkeys;
  63339. if (fullscreenKey.call(this, event2)) {
  63340. event2.preventDefault();
  63341. event2.stopPropagation();
  63342. const FSToggle = Component$1$1.getComponent("FullscreenToggle");
  63343. if (document_1[this.fsApi_.fullscreenEnabled] !== false) {
  63344. FSToggle.prototype.handleClick.call(this, event2);
  63345. }
  63346. } else if (muteKey.call(this, event2)) {
  63347. event2.preventDefault();
  63348. event2.stopPropagation();
  63349. const MuteToggle2 = Component$1$1.getComponent("MuteToggle");
  63350. MuteToggle2.prototype.handleClick.call(this, event2);
  63351. } else if (playPauseKey.call(this, event2)) {
  63352. event2.preventDefault();
  63353. event2.stopPropagation();
  63354. const PlayToggle2 = Component$1$1.getComponent("PlayToggle");
  63355. PlayToggle2.prototype.handleClick.call(this, event2);
  63356. }
  63357. }
  63358. canPlayType(type2) {
  63359. let can;
  63360. for (let i2 = 0, j = this.options_.techOrder; i2 < j.length; i2++) {
  63361. const techName = j[i2];
  63362. let tech = Tech$2.getTech(techName);
  63363. if (!tech) {
  63364. tech = Component$1$1.getComponent(techName);
  63365. }
  63366. if (!tech) {
  63367. log$1$1.error(`The "${techName}" tech is undefined. Skipped browser support check for that tech.`);
  63368. continue;
  63369. }
  63370. if (tech.isSupported()) {
  63371. can = tech.canPlayType(type2);
  63372. if (can) {
  63373. return can;
  63374. }
  63375. }
  63376. }
  63377. return "";
  63378. }
  63379. selectSource(sources) {
  63380. const techs = this.options_.techOrder.map((techName) => {
  63381. return [techName, Tech$2.getTech(techName)];
  63382. }).filter(([techName, tech]) => {
  63383. if (tech) {
  63384. return tech.isSupported();
  63385. }
  63386. log$1$1.error(`The "${techName}" tech is undefined. Skipped browser support check for that tech.`);
  63387. return false;
  63388. });
  63389. const findFirstPassingTechSourcePair = function(outerArray, innerArray, tester) {
  63390. let found;
  63391. outerArray.some((outerChoice) => {
  63392. return innerArray.some((innerChoice) => {
  63393. found = tester(outerChoice, innerChoice);
  63394. if (found) {
  63395. return true;
  63396. }
  63397. });
  63398. });
  63399. return found;
  63400. };
  63401. let foundSourceAndTech;
  63402. const flip = (fn2) => (a, b) => fn2(b, a);
  63403. const finder = ([techName, tech], source) => {
  63404. if (tech.canPlaySource(source, this.options_[techName.toLowerCase()])) {
  63405. return {
  63406. source,
  63407. tech: techName
  63408. };
  63409. }
  63410. };
  63411. if (this.options_.sourceOrder) {
  63412. foundSourceAndTech = findFirstPassingTechSourcePair(sources, techs, flip(finder));
  63413. } else {
  63414. foundSourceAndTech = findFirstPassingTechSourcePair(techs, sources, finder);
  63415. }
  63416. return foundSourceAndTech || false;
  63417. }
  63418. handleSrc_(source, isRetry) {
  63419. if (typeof source === "undefined") {
  63420. return this.cache_.src || "";
  63421. }
  63422. if (this.resetRetryOnError_) {
  63423. this.resetRetryOnError_();
  63424. }
  63425. const sources = filterSource$1(source);
  63426. if (!sources.length) {
  63427. this.setTimeout(function() {
  63428. this.error({
  63429. code: 4,
  63430. message: this.options_.notSupportedMessage
  63431. });
  63432. }, 0);
  63433. return;
  63434. }
  63435. this.changingSrc_ = true;
  63436. if (!isRetry) {
  63437. this.cache_.sources = sources;
  63438. }
  63439. this.updateSourceCaches_(sources[0]);
  63440. setSource$1(this, sources[0], (middlewareSource, mws) => {
  63441. this.middleware_ = mws;
  63442. if (!isRetry) {
  63443. this.cache_.sources = sources;
  63444. }
  63445. this.updateSourceCaches_(middlewareSource);
  63446. const err = this.src_(middlewareSource);
  63447. if (err) {
  63448. if (sources.length > 1) {
  63449. return this.handleSrc_(sources.slice(1));
  63450. }
  63451. this.changingSrc_ = false;
  63452. this.setTimeout(function() {
  63453. this.error({
  63454. code: 4,
  63455. message: this.options_.notSupportedMessage
  63456. });
  63457. }, 0);
  63458. this.triggerReady();
  63459. return;
  63460. }
  63461. setTech$1(mws, this.tech_);
  63462. });
  63463. if (sources.length > 1) {
  63464. const retry = () => {
  63465. this.error(null);
  63466. this.handleSrc_(sources.slice(1), true);
  63467. };
  63468. const stopListeningForErrors = () => {
  63469. this.off("error", retry);
  63470. };
  63471. this.one("error", retry);
  63472. this.one("playing", stopListeningForErrors);
  63473. this.resetRetryOnError_ = () => {
  63474. this.off("error", retry);
  63475. this.off("playing", stopListeningForErrors);
  63476. };
  63477. }
  63478. }
  63479. src(source) {
  63480. return this.handleSrc_(source, false);
  63481. }
  63482. src_(source) {
  63483. const sourceTech = this.selectSource([source]);
  63484. if (!sourceTech) {
  63485. return true;
  63486. }
  63487. if (!titleCaseEquals$1(sourceTech.tech, this.techName_)) {
  63488. this.changingSrc_ = true;
  63489. this.loadTech_(sourceTech.tech, sourceTech.source);
  63490. this.tech_.ready(() => {
  63491. this.changingSrc_ = false;
  63492. });
  63493. return false;
  63494. }
  63495. this.ready(function() {
  63496. if (this.tech_.constructor.prototype.hasOwnProperty("setSource")) {
  63497. this.techCall_("setSource", source);
  63498. } else {
  63499. this.techCall_("src", source.src);
  63500. }
  63501. this.changingSrc_ = false;
  63502. }, true);
  63503. return false;
  63504. }
  63505. load() {
  63506. this.techCall_("load");
  63507. }
  63508. reset() {
  63509. if (this.paused()) {
  63510. this.doReset_();
  63511. } else {
  63512. const playPromise = this.play();
  63513. silencePromise$1(playPromise.then(() => this.doReset_()));
  63514. }
  63515. }
  63516. doReset_() {
  63517. if (this.tech_) {
  63518. this.tech_.clearTracks("text");
  63519. }
  63520. this.resetCache_();
  63521. this.poster("");
  63522. this.loadTech_(this.options_.techOrder[0], null);
  63523. this.techCall_("reset");
  63524. this.resetControlBarUI_();
  63525. if (isEvented$1(this)) {
  63526. this.trigger("playerreset");
  63527. }
  63528. }
  63529. resetControlBarUI_() {
  63530. this.resetProgressBar_();
  63531. this.resetPlaybackRate_();
  63532. this.resetVolumeBar_();
  63533. }
  63534. resetProgressBar_() {
  63535. this.currentTime(0);
  63536. const {
  63537. currentTimeDisplay,
  63538. durationDisplay,
  63539. progressControl,
  63540. remainingTimeDisplay
  63541. } = this.controlBar || {};
  63542. const {
  63543. seekBar
  63544. } = progressControl || {};
  63545. if (currentTimeDisplay) {
  63546. currentTimeDisplay.updateContent();
  63547. }
  63548. if (durationDisplay) {
  63549. durationDisplay.updateContent();
  63550. }
  63551. if (remainingTimeDisplay) {
  63552. remainingTimeDisplay.updateContent();
  63553. }
  63554. if (seekBar) {
  63555. seekBar.update();
  63556. if (seekBar.loadProgressBar) {
  63557. seekBar.loadProgressBar.update();
  63558. }
  63559. }
  63560. }
  63561. resetPlaybackRate_() {
  63562. this.playbackRate(this.defaultPlaybackRate());
  63563. this.handleTechRateChange_();
  63564. }
  63565. resetVolumeBar_() {
  63566. this.volume(1);
  63567. this.trigger("volumechange");
  63568. }
  63569. currentSources() {
  63570. const source = this.currentSource();
  63571. const sources = [];
  63572. if (Object.keys(source).length !== 0) {
  63573. sources.push(source);
  63574. }
  63575. return this.cache_.sources || sources;
  63576. }
  63577. currentSource() {
  63578. return this.cache_.source || {};
  63579. }
  63580. currentSrc() {
  63581. return this.currentSource() && this.currentSource().src || "";
  63582. }
  63583. currentType() {
  63584. return this.currentSource() && this.currentSource().type || "";
  63585. }
  63586. preload(value) {
  63587. if (value !== void 0) {
  63588. this.techCall_("setPreload", value);
  63589. this.options_.preload = value;
  63590. return;
  63591. }
  63592. return this.techGet_("preload");
  63593. }
  63594. autoplay(value) {
  63595. if (value === void 0) {
  63596. return this.options_.autoplay || false;
  63597. }
  63598. let techAutoplay;
  63599. if (typeof value === "string" && /(any|play|muted)/.test(value) || value === true && this.options_.normalizeAutoplay) {
  63600. this.options_.autoplay = value;
  63601. this.manualAutoplay_(typeof value === "string" ? value : "play");
  63602. techAutoplay = false;
  63603. } else if (!value) {
  63604. this.options_.autoplay = false;
  63605. } else {
  63606. this.options_.autoplay = true;
  63607. }
  63608. techAutoplay = typeof techAutoplay === "undefined" ? this.options_.autoplay : techAutoplay;
  63609. if (this.tech_) {
  63610. this.techCall_("setAutoplay", techAutoplay);
  63611. }
  63612. }
  63613. playsinline(value) {
  63614. if (value !== void 0) {
  63615. this.techCall_("setPlaysinline", value);
  63616. this.options_.playsinline = value;
  63617. return this;
  63618. }
  63619. return this.techGet_("playsinline");
  63620. }
  63621. loop(value) {
  63622. if (value !== void 0) {
  63623. this.techCall_("setLoop", value);
  63624. this.options_.loop = value;
  63625. return;
  63626. }
  63627. return this.techGet_("loop");
  63628. }
  63629. poster(src) {
  63630. if (src === void 0) {
  63631. return this.poster_;
  63632. }
  63633. if (!src) {
  63634. src = "";
  63635. }
  63636. if (src === this.poster_) {
  63637. return;
  63638. }
  63639. this.poster_ = src;
  63640. this.techCall_("setPoster", src);
  63641. this.isPosterFromTech_ = false;
  63642. this.trigger("posterchange");
  63643. }
  63644. handleTechPosterChange_() {
  63645. if ((!this.poster_ || this.options_.techCanOverridePoster) && this.tech_ && this.tech_.poster) {
  63646. const newPoster = this.tech_.poster() || "";
  63647. if (newPoster !== this.poster_) {
  63648. this.poster_ = newPoster;
  63649. this.isPosterFromTech_ = true;
  63650. this.trigger("posterchange");
  63651. }
  63652. }
  63653. }
  63654. controls(bool) {
  63655. if (bool === void 0) {
  63656. return !!this.controls_;
  63657. }
  63658. bool = !!bool;
  63659. if (this.controls_ === bool) {
  63660. return;
  63661. }
  63662. this.controls_ = bool;
  63663. if (this.usingNativeControls()) {
  63664. this.techCall_("setControls", bool);
  63665. }
  63666. if (this.controls_) {
  63667. this.removeClass("vjs-controls-disabled");
  63668. this.addClass("vjs-controls-enabled");
  63669. this.trigger("controlsenabled");
  63670. if (!this.usingNativeControls()) {
  63671. this.addTechControlsListeners_();
  63672. }
  63673. } else {
  63674. this.removeClass("vjs-controls-enabled");
  63675. this.addClass("vjs-controls-disabled");
  63676. this.trigger("controlsdisabled");
  63677. if (!this.usingNativeControls()) {
  63678. this.removeTechControlsListeners_();
  63679. }
  63680. }
  63681. }
  63682. usingNativeControls(bool) {
  63683. if (bool === void 0) {
  63684. return !!this.usingNativeControls_;
  63685. }
  63686. bool = !!bool;
  63687. if (this.usingNativeControls_ === bool) {
  63688. return;
  63689. }
  63690. this.usingNativeControls_ = bool;
  63691. if (this.usingNativeControls_) {
  63692. this.addClass("vjs-using-native-controls");
  63693. this.trigger("usingnativecontrols");
  63694. } else {
  63695. this.removeClass("vjs-using-native-controls");
  63696. this.trigger("usingcustomcontrols");
  63697. }
  63698. }
  63699. error(err) {
  63700. if (err === void 0) {
  63701. return this.error_ || null;
  63702. }
  63703. hooks$1("beforeerror").forEach((hookFunction) => {
  63704. const newErr = hookFunction(this, err);
  63705. if (!(isObject$2(newErr) && !Array.isArray(newErr) || typeof newErr === "string" || typeof newErr === "number" || newErr === null)) {
  63706. this.log.error("please return a value that MediaError expects in beforeerror hooks");
  63707. return;
  63708. }
  63709. err = newErr;
  63710. });
  63711. if (this.options_.suppressNotSupportedError && err && err.code === 4) {
  63712. const triggerSuppressedError = function() {
  63713. this.error(err);
  63714. };
  63715. this.options_.suppressNotSupportedError = false;
  63716. this.any(["click", "touchstart"], triggerSuppressedError);
  63717. this.one("loadstart", function() {
  63718. this.off(["click", "touchstart"], triggerSuppressedError);
  63719. });
  63720. return;
  63721. }
  63722. if (err === null) {
  63723. this.error_ = err;
  63724. this.removeClass("vjs-error");
  63725. if (this.errorDisplay) {
  63726. this.errorDisplay.close();
  63727. }
  63728. return;
  63729. }
  63730. this.error_ = new MediaError$1(err);
  63731. this.addClass("vjs-error");
  63732. log$1$1.error(`(CODE:${this.error_.code} ${MediaError$1.errorTypes[this.error_.code]})`, this.error_.message, this.error_);
  63733. this.trigger("error");
  63734. hooks$1("error").forEach((hookFunction) => hookFunction(this, this.error_));
  63735. return;
  63736. }
  63737. reportUserActivity(event2) {
  63738. this.userActivity_ = true;
  63739. }
  63740. userActive(bool) {
  63741. if (bool === void 0) {
  63742. return this.userActive_;
  63743. }
  63744. bool = !!bool;
  63745. if (bool === this.userActive_) {
  63746. return;
  63747. }
  63748. this.userActive_ = bool;
  63749. if (this.userActive_) {
  63750. this.userActivity_ = true;
  63751. this.removeClass("vjs-user-inactive");
  63752. this.addClass("vjs-user-active");
  63753. this.trigger("useractive");
  63754. return;
  63755. }
  63756. if (this.tech_) {
  63757. this.tech_.one("mousemove", function(e) {
  63758. e.stopPropagation();
  63759. e.preventDefault();
  63760. });
  63761. }
  63762. this.userActivity_ = false;
  63763. this.removeClass("vjs-user-active");
  63764. this.addClass("vjs-user-inactive");
  63765. this.trigger("userinactive");
  63766. }
  63767. listenForUserActivity_() {
  63768. let mouseInProgress;
  63769. let lastMoveX;
  63770. let lastMoveY;
  63771. const handleActivity = bind_(this, this.reportUserActivity);
  63772. const handleMouseMove = function(e) {
  63773. if (e.screenX !== lastMoveX || e.screenY !== lastMoveY) {
  63774. lastMoveX = e.screenX;
  63775. lastMoveY = e.screenY;
  63776. handleActivity();
  63777. }
  63778. };
  63779. const handleMouseDown = function() {
  63780. handleActivity();
  63781. this.clearInterval(mouseInProgress);
  63782. mouseInProgress = this.setInterval(handleActivity, 250);
  63783. };
  63784. const handleMouseUpAndMouseLeave = function(event2) {
  63785. handleActivity();
  63786. this.clearInterval(mouseInProgress);
  63787. };
  63788. this.on("mousedown", handleMouseDown);
  63789. this.on("mousemove", handleMouseMove);
  63790. this.on("mouseup", handleMouseUpAndMouseLeave);
  63791. this.on("mouseleave", handleMouseUpAndMouseLeave);
  63792. const controlBar = this.getChild("controlBar");
  63793. if (controlBar && !IS_IOS$1 && !IS_ANDROID$1) {
  63794. controlBar.on("mouseenter", function(event2) {
  63795. if (this.player().options_.inactivityTimeout !== 0) {
  63796. this.player().cache_.inactivityTimeout = this.player().options_.inactivityTimeout;
  63797. }
  63798. this.player().options_.inactivityTimeout = 0;
  63799. });
  63800. controlBar.on("mouseleave", function(event2) {
  63801. this.player().options_.inactivityTimeout = this.player().cache_.inactivityTimeout;
  63802. });
  63803. }
  63804. this.on("keydown", handleActivity);
  63805. this.on("keyup", handleActivity);
  63806. let inactivityTimeout;
  63807. this.setInterval(function() {
  63808. if (!this.userActivity_) {
  63809. return;
  63810. }
  63811. this.userActivity_ = false;
  63812. this.userActive(true);
  63813. this.clearTimeout(inactivityTimeout);
  63814. const timeout = this.options_.inactivityTimeout;
  63815. if (timeout <= 0) {
  63816. return;
  63817. }
  63818. inactivityTimeout = this.setTimeout(function() {
  63819. if (!this.userActivity_) {
  63820. this.userActive(false);
  63821. }
  63822. }, timeout);
  63823. }, 250);
  63824. }
  63825. playbackRate(rate) {
  63826. if (rate !== void 0) {
  63827. this.techCall_("setPlaybackRate", rate);
  63828. return;
  63829. }
  63830. if (this.tech_ && this.tech_.featuresPlaybackRate) {
  63831. return this.cache_.lastPlaybackRate || this.techGet_("playbackRate");
  63832. }
  63833. return 1;
  63834. }
  63835. defaultPlaybackRate(rate) {
  63836. if (rate !== void 0) {
  63837. return this.techCall_("setDefaultPlaybackRate", rate);
  63838. }
  63839. if (this.tech_ && this.tech_.featuresPlaybackRate) {
  63840. return this.techGet_("defaultPlaybackRate");
  63841. }
  63842. return 1;
  63843. }
  63844. isAudio(bool) {
  63845. if (bool !== void 0) {
  63846. this.isAudio_ = !!bool;
  63847. return;
  63848. }
  63849. return !!this.isAudio_;
  63850. }
  63851. enableAudioOnlyUI_() {
  63852. this.addClass("vjs-audio-only-mode");
  63853. const playerChildren = this.children();
  63854. const controlBar = this.getChild("ControlBar");
  63855. const controlBarHeight = controlBar && controlBar.currentHeight();
  63856. playerChildren.forEach((child) => {
  63857. if (child === controlBar) {
  63858. return;
  63859. }
  63860. if (child.el_ && !child.hasClass("vjs-hidden")) {
  63861. child.hide();
  63862. this.audioOnlyCache_.hiddenChildren.push(child);
  63863. }
  63864. });
  63865. this.audioOnlyCache_.playerHeight = this.currentHeight();
  63866. this.height(controlBarHeight);
  63867. this.trigger("audioonlymodechange");
  63868. }
  63869. disableAudioOnlyUI_() {
  63870. this.removeClass("vjs-audio-only-mode");
  63871. this.audioOnlyCache_.hiddenChildren.forEach((child) => child.show());
  63872. this.height(this.audioOnlyCache_.playerHeight);
  63873. this.trigger("audioonlymodechange");
  63874. }
  63875. audioOnlyMode(value) {
  63876. if (typeof value !== "boolean" || value === this.audioOnlyMode_) {
  63877. return this.audioOnlyMode_;
  63878. }
  63879. this.audioOnlyMode_ = value;
  63880. if (value) {
  63881. const exitPromises = [];
  63882. if (this.isInPictureInPicture()) {
  63883. exitPromises.push(this.exitPictureInPicture());
  63884. }
  63885. if (this.isFullscreen()) {
  63886. exitPromises.push(this.exitFullscreen());
  63887. }
  63888. if (this.audioPosterMode()) {
  63889. exitPromises.push(this.audioPosterMode(false));
  63890. }
  63891. return Promise.all(exitPromises).then(() => this.enableAudioOnlyUI_());
  63892. }
  63893. return Promise.resolve().then(() => this.disableAudioOnlyUI_());
  63894. }
  63895. enablePosterModeUI_() {
  63896. const tech = this.tech_ && this.tech_;
  63897. tech.hide();
  63898. this.addClass("vjs-audio-poster-mode");
  63899. this.trigger("audiopostermodechange");
  63900. }
  63901. disablePosterModeUI_() {
  63902. const tech = this.tech_ && this.tech_;
  63903. tech.show();
  63904. this.removeClass("vjs-audio-poster-mode");
  63905. this.trigger("audiopostermodechange");
  63906. }
  63907. audioPosterMode(value) {
  63908. if (typeof value !== "boolean" || value === this.audioPosterMode_) {
  63909. return this.audioPosterMode_;
  63910. }
  63911. this.audioPosterMode_ = value;
  63912. if (value) {
  63913. if (this.audioOnlyMode()) {
  63914. const audioOnlyModePromise = this.audioOnlyMode(false);
  63915. return audioOnlyModePromise.then(() => {
  63916. this.enablePosterModeUI_();
  63917. });
  63918. }
  63919. return Promise.resolve().then(() => {
  63920. this.enablePosterModeUI_();
  63921. });
  63922. }
  63923. return Promise.resolve().then(() => {
  63924. this.disablePosterModeUI_();
  63925. });
  63926. }
  63927. addTextTrack(kind, label2, language) {
  63928. if (this.tech_) {
  63929. return this.tech_.addTextTrack(kind, label2, language);
  63930. }
  63931. }
  63932. addRemoteTextTrack(options2, manualCleanup) {
  63933. if (this.tech_) {
  63934. return this.tech_.addRemoteTextTrack(options2, manualCleanup);
  63935. }
  63936. }
  63937. removeRemoteTextTrack(obj = {}) {
  63938. let {
  63939. track
  63940. } = obj;
  63941. if (!track) {
  63942. track = obj;
  63943. }
  63944. if (this.tech_) {
  63945. return this.tech_.removeRemoteTextTrack(track);
  63946. }
  63947. }
  63948. getVideoPlaybackQuality() {
  63949. return this.techGet_("getVideoPlaybackQuality");
  63950. }
  63951. videoWidth() {
  63952. return this.tech_ && this.tech_.videoWidth && this.tech_.videoWidth() || 0;
  63953. }
  63954. videoHeight() {
  63955. return this.tech_ && this.tech_.videoHeight && this.tech_.videoHeight() || 0;
  63956. }
  63957. language(code) {
  63958. if (code === void 0) {
  63959. return this.language_;
  63960. }
  63961. if (this.language_ !== String(code).toLowerCase()) {
  63962. this.language_ = String(code).toLowerCase();
  63963. if (isEvented$1(this)) {
  63964. this.trigger("languagechange");
  63965. }
  63966. }
  63967. }
  63968. languages() {
  63969. return merge$1(Player$1.prototype.options_.languages, this.languages_);
  63970. }
  63971. toJSON() {
  63972. const options2 = merge$1(this.options_);
  63973. const tracks = options2.tracks;
  63974. options2.tracks = [];
  63975. for (let i2 = 0; i2 < tracks.length; i2++) {
  63976. let track = tracks[i2];
  63977. track = merge$1(track);
  63978. track.player = void 0;
  63979. options2.tracks[i2] = track;
  63980. }
  63981. return options2;
  63982. }
  63983. createModal(content, options2) {
  63984. options2 = options2 || {};
  63985. options2.content = content || "";
  63986. const modal = new ModalDialog$1(this, options2);
  63987. this.addChild(modal);
  63988. modal.on("dispose", () => {
  63989. this.removeChild(modal);
  63990. });
  63991. modal.open();
  63992. return modal;
  63993. }
  63994. updateCurrentBreakpoint_() {
  63995. if (!this.responsive()) {
  63996. return;
  63997. }
  63998. const currentBreakpoint = this.currentBreakpoint();
  63999. const currentWidth = this.currentWidth();
  64000. for (let i2 = 0; i2 < BREAKPOINT_ORDER$1.length; i2++) {
  64001. const candidateBreakpoint = BREAKPOINT_ORDER$1[i2];
  64002. const maxWidth = this.breakpoints_[candidateBreakpoint];
  64003. if (currentWidth <= maxWidth) {
  64004. if (currentBreakpoint === candidateBreakpoint) {
  64005. return;
  64006. }
  64007. if (currentBreakpoint) {
  64008. this.removeClass(BREAKPOINT_CLASSES$1[currentBreakpoint]);
  64009. }
  64010. this.addClass(BREAKPOINT_CLASSES$1[candidateBreakpoint]);
  64011. this.breakpoint_ = candidateBreakpoint;
  64012. break;
  64013. }
  64014. }
  64015. }
  64016. removeCurrentBreakpoint_() {
  64017. const className = this.currentBreakpointClass();
  64018. this.breakpoint_ = "";
  64019. if (className) {
  64020. this.removeClass(className);
  64021. }
  64022. }
  64023. breakpoints(breakpoints) {
  64024. if (breakpoints === void 0) {
  64025. return Object.assign(this.breakpoints_);
  64026. }
  64027. this.breakpoint_ = "";
  64028. this.breakpoints_ = Object.assign({}, DEFAULT_BREAKPOINTS$1, breakpoints);
  64029. this.updateCurrentBreakpoint_();
  64030. return Object.assign(this.breakpoints_);
  64031. }
  64032. responsive(value) {
  64033. if (value === void 0) {
  64034. return this.responsive_;
  64035. }
  64036. value = Boolean(value);
  64037. const current = this.responsive_;
  64038. if (value === current) {
  64039. return;
  64040. }
  64041. this.responsive_ = value;
  64042. if (value) {
  64043. this.on("playerresize", this.boundUpdateCurrentBreakpoint_);
  64044. this.updateCurrentBreakpoint_();
  64045. } else {
  64046. this.off("playerresize", this.boundUpdateCurrentBreakpoint_);
  64047. this.removeCurrentBreakpoint_();
  64048. }
  64049. return value;
  64050. }
  64051. currentBreakpoint() {
  64052. return this.breakpoint_;
  64053. }
  64054. currentBreakpointClass() {
  64055. return BREAKPOINT_CLASSES$1[this.breakpoint_] || "";
  64056. }
  64057. loadMedia(media, ready) {
  64058. if (!media || typeof media !== "object") {
  64059. return;
  64060. }
  64061. this.reset();
  64062. this.cache_.media = merge$1(media);
  64063. const {
  64064. artist,
  64065. artwork,
  64066. description,
  64067. poster,
  64068. src,
  64069. textTracks,
  64070. title
  64071. } = this.cache_.media;
  64072. if (!artwork && poster) {
  64073. this.cache_.media.artwork = [{
  64074. src: poster,
  64075. type: getMimetype$1(poster)
  64076. }];
  64077. }
  64078. if (src) {
  64079. this.src(src);
  64080. }
  64081. if (poster) {
  64082. this.poster(poster);
  64083. }
  64084. if (Array.isArray(textTracks)) {
  64085. textTracks.forEach((tt2) => this.addRemoteTextTrack(tt2, false));
  64086. }
  64087. if (this.titleBar) {
  64088. this.titleBar.update({
  64089. title,
  64090. description: description || artist || ""
  64091. });
  64092. }
  64093. this.ready(ready);
  64094. }
  64095. getMedia() {
  64096. if (!this.cache_.media) {
  64097. const poster = this.poster();
  64098. const src = this.currentSources();
  64099. const textTracks = Array.prototype.map.call(this.remoteTextTracks(), (tt2) => ({
  64100. kind: tt2.kind,
  64101. label: tt2.label,
  64102. language: tt2.language,
  64103. src: tt2.src
  64104. }));
  64105. const media = {
  64106. src,
  64107. textTracks
  64108. };
  64109. if (poster) {
  64110. media.poster = poster;
  64111. media.artwork = [{
  64112. src: media.poster,
  64113. type: getMimetype$1(media.poster)
  64114. }];
  64115. }
  64116. return media;
  64117. }
  64118. return merge$1(this.cache_.media);
  64119. }
  64120. static getTagSettings(tag) {
  64121. const baseOptions = {
  64122. sources: [],
  64123. tracks: []
  64124. };
  64125. const tagOptions = getAttributes$1(tag);
  64126. const dataSetup = tagOptions["data-setup"];
  64127. if (hasClass$1(tag, "vjs-fill")) {
  64128. tagOptions.fill = true;
  64129. }
  64130. if (hasClass$1(tag, "vjs-fluid")) {
  64131. tagOptions.fluid = true;
  64132. }
  64133. if (dataSetup !== null) {
  64134. const [err, data] = tuple(dataSetup || "{}");
  64135. if (err) {
  64136. log$1$1.error(err);
  64137. }
  64138. Object.assign(tagOptions, data);
  64139. }
  64140. Object.assign(baseOptions, tagOptions);
  64141. if (tag.hasChildNodes()) {
  64142. const children = tag.childNodes;
  64143. for (let i2 = 0, j = children.length; i2 < j; i2++) {
  64144. const child = children[i2];
  64145. const childName = child.nodeName.toLowerCase();
  64146. if (childName === "source") {
  64147. baseOptions.sources.push(getAttributes$1(child));
  64148. } else if (childName === "track") {
  64149. baseOptions.tracks.push(getAttributes$1(child));
  64150. }
  64151. }
  64152. }
  64153. return baseOptions;
  64154. }
  64155. debug(enabled) {
  64156. if (enabled === void 0) {
  64157. return this.debugEnabled_;
  64158. }
  64159. if (enabled) {
  64160. this.trigger("debugon");
  64161. this.previousLogLevel_ = this.log.level;
  64162. this.log.level("debug");
  64163. this.debugEnabled_ = true;
  64164. } else {
  64165. this.trigger("debugoff");
  64166. this.log.level(this.previousLogLevel_);
  64167. this.previousLogLevel_ = void 0;
  64168. this.debugEnabled_ = false;
  64169. }
  64170. }
  64171. playbackRates(newRates) {
  64172. if (newRates === void 0) {
  64173. return this.cache_.playbackRates;
  64174. }
  64175. if (!Array.isArray(newRates)) {
  64176. return;
  64177. }
  64178. if (!newRates.every((rate) => typeof rate === "number")) {
  64179. return;
  64180. }
  64181. this.cache_.playbackRates = newRates;
  64182. this.trigger("playbackrateschange");
  64183. }
  64184. }
  64185. ALL$1.names.forEach(function(name) {
  64186. const props = ALL$1[name];
  64187. Player$1.prototype[props.getterName] = function() {
  64188. if (this.tech_) {
  64189. return this.tech_[props.getterName]();
  64190. }
  64191. this[props.privateName] = this[props.privateName] || new props.ListClass();
  64192. return this[props.privateName];
  64193. };
  64194. });
  64195. Player$1.prototype.crossorigin = Player$1.prototype.crossOrigin;
  64196. Player$1.players = {};
  64197. const navigator$3 = window_1.navigator;
  64198. Player$1.prototype.options_ = {
  64199. techOrder: Tech$2.defaultTechOrder_,
  64200. html5: {},
  64201. enableSourceset: true,
  64202. inactivityTimeout: 2e3,
  64203. playbackRates: [],
  64204. liveui: false,
  64205. children: ["mediaLoader", "posterImage", "titleBar", "textTrackDisplay", "loadingSpinner", "bigPlayButton", "liveTracker", "controlBar", "errorDisplay", "textTrackSettings", "resizeManager"],
  64206. language: navigator$3 && (navigator$3.languages && navigator$3.languages[0] || navigator$3.userLanguage || navigator$3.language) || "en",
  64207. languages: {},
  64208. notSupportedMessage: "No compatible source was found for this media.",
  64209. normalizeAutoplay: false,
  64210. fullscreen: {
  64211. options: {
  64212. navigationUI: "hide"
  64213. }
  64214. },
  64215. breakpoints: {},
  64216. responsive: false,
  64217. audioOnlyMode: false,
  64218. audioPosterMode: false
  64219. };
  64220. [
  64221. "ended",
  64222. "seeking",
  64223. "seekable",
  64224. "networkState",
  64225. "readyState"
  64226. ].forEach(function(fn2) {
  64227. Player$1.prototype[fn2] = function() {
  64228. return this.techGet_(fn2);
  64229. };
  64230. });
  64231. TECH_EVENTS_RETRIGGER$1.forEach(function(event2) {
  64232. Player$1.prototype[`handleTech${toTitleCase$1$1(event2)}_`] = function() {
  64233. return this.trigger(event2);
  64234. };
  64235. });
  64236. Component$1$1.registerComponent("Player", Player$1);
  64237. const BASE_PLUGIN_NAME$1 = "plugin";
  64238. const PLUGIN_CACHE_KEY$1 = "activePlugins_";
  64239. const pluginStorage$1 = {};
  64240. const pluginExists$1 = (name) => pluginStorage$1.hasOwnProperty(name);
  64241. const getPlugin$1 = (name) => pluginExists$1(name) ? pluginStorage$1[name] : void 0;
  64242. const markPluginAsActive$1 = (player, name) => {
  64243. player[PLUGIN_CACHE_KEY$1] = player[PLUGIN_CACHE_KEY$1] || {};
  64244. player[PLUGIN_CACHE_KEY$1][name] = true;
  64245. };
  64246. const triggerSetupEvent$1 = (player, hash, before) => {
  64247. const eventName = (before ? "before" : "") + "pluginsetup";
  64248. player.trigger(eventName, hash);
  64249. player.trigger(eventName + ":" + hash.name, hash);
  64250. };
  64251. const createBasicPlugin$1 = function(name, plugin) {
  64252. const basicPluginWrapper = function() {
  64253. triggerSetupEvent$1(this, {
  64254. name,
  64255. plugin,
  64256. instance: null
  64257. }, true);
  64258. const instance = plugin.apply(this, arguments);
  64259. markPluginAsActive$1(this, name);
  64260. triggerSetupEvent$1(this, {
  64261. name,
  64262. plugin,
  64263. instance
  64264. });
  64265. return instance;
  64266. };
  64267. Object.keys(plugin).forEach(function(prop) {
  64268. basicPluginWrapper[prop] = plugin[prop];
  64269. });
  64270. return basicPluginWrapper;
  64271. };
  64272. const createPluginFactory$1 = (name, PluginSubClass) => {
  64273. PluginSubClass.prototype.name = name;
  64274. return function(...args) {
  64275. triggerSetupEvent$1(this, {
  64276. name,
  64277. plugin: PluginSubClass,
  64278. instance: null
  64279. }, true);
  64280. const instance = new PluginSubClass(...[this, ...args]);
  64281. this[name] = () => instance;
  64282. triggerSetupEvent$1(this, instance.getEventHash());
  64283. return instance;
  64284. };
  64285. };
  64286. class Plugin$1 {
  64287. constructor(player) {
  64288. if (this.constructor === Plugin$1) {
  64289. throw new Error("Plugin must be sub-classed; not directly instantiated.");
  64290. }
  64291. this.player = player;
  64292. if (!this.log) {
  64293. this.log = this.player.log.createLogger(this.name);
  64294. }
  64295. evented$1(this);
  64296. delete this.trigger;
  64297. stateful$1(this, this.constructor.defaultState);
  64298. markPluginAsActive$1(player, this.name);
  64299. this.dispose = this.dispose.bind(this);
  64300. player.on("dispose", this.dispose);
  64301. }
  64302. version() {
  64303. return this.constructor.VERSION;
  64304. }
  64305. getEventHash(hash = {}) {
  64306. hash.name = this.name;
  64307. hash.plugin = this.constructor;
  64308. hash.instance = this;
  64309. return hash;
  64310. }
  64311. trigger(event2, hash = {}) {
  64312. return trigger$1(this.eventBusEl_, event2, this.getEventHash(hash));
  64313. }
  64314. handleStateChanged(e) {
  64315. }
  64316. dispose() {
  64317. const {
  64318. name,
  64319. player
  64320. } = this;
  64321. this.trigger("dispose");
  64322. this.off();
  64323. player.off("dispose", this.dispose);
  64324. player[PLUGIN_CACHE_KEY$1][name] = false;
  64325. this.player = this.state = null;
  64326. player[name] = createPluginFactory$1(name, pluginStorage$1[name]);
  64327. }
  64328. static isBasic(plugin) {
  64329. const p = typeof plugin === "string" ? getPlugin$1(plugin) : plugin;
  64330. return typeof p === "function" && !Plugin$1.prototype.isPrototypeOf(p.prototype);
  64331. }
  64332. static registerPlugin(name, plugin) {
  64333. if (typeof name !== "string") {
  64334. throw new Error(`Illegal plugin name, "${name}", must be a string, was ${typeof name}.`);
  64335. }
  64336. if (pluginExists$1(name)) {
  64337. log$1$1.warn(`A plugin named "${name}" already exists. You may want to avoid re-registering plugins!`);
  64338. } else if (Player$1.prototype.hasOwnProperty(name)) {
  64339. throw new Error(`Illegal plugin name, "${name}", cannot share a name with an existing player method!`);
  64340. }
  64341. if (typeof plugin !== "function") {
  64342. throw new Error(`Illegal plugin for "${name}", must be a function, was ${typeof plugin}.`);
  64343. }
  64344. pluginStorage$1[name] = plugin;
  64345. if (name !== BASE_PLUGIN_NAME$1) {
  64346. if (Plugin$1.isBasic(plugin)) {
  64347. Player$1.prototype[name] = createBasicPlugin$1(name, plugin);
  64348. } else {
  64349. Player$1.prototype[name] = createPluginFactory$1(name, plugin);
  64350. }
  64351. }
  64352. return plugin;
  64353. }
  64354. static deregisterPlugin(name) {
  64355. if (name === BASE_PLUGIN_NAME$1) {
  64356. throw new Error("Cannot de-register base plugin.");
  64357. }
  64358. if (pluginExists$1(name)) {
  64359. delete pluginStorage$1[name];
  64360. delete Player$1.prototype[name];
  64361. }
  64362. }
  64363. static getPlugins(names2 = Object.keys(pluginStorage$1)) {
  64364. let result;
  64365. names2.forEach((name) => {
  64366. const plugin = getPlugin$1(name);
  64367. if (plugin) {
  64368. result = result || {};
  64369. result[name] = plugin;
  64370. }
  64371. });
  64372. return result;
  64373. }
  64374. static getPluginVersion(name) {
  64375. const plugin = getPlugin$1(name);
  64376. return plugin && plugin.VERSION || "";
  64377. }
  64378. }
  64379. Plugin$1.getPlugin = getPlugin$1;
  64380. Plugin$1.BASE_PLUGIN_NAME = BASE_PLUGIN_NAME$1;
  64381. Plugin$1.registerPlugin(BASE_PLUGIN_NAME$1, Plugin$1);
  64382. Player$1.prototype.usingPlugin = function(name) {
  64383. return !!this[PLUGIN_CACHE_KEY$1] && this[PLUGIN_CACHE_KEY$1][name] === true;
  64384. };
  64385. Player$1.prototype.hasPlugin = function(name) {
  64386. return !!pluginExists$1(name);
  64387. };
  64388. function deprecate(message, fn2) {
  64389. let warned = false;
  64390. return function(...args) {
  64391. if (!warned) {
  64392. log$1$1.warn(message);
  64393. }
  64394. warned = true;
  64395. return fn2.apply(this, args);
  64396. };
  64397. }
  64398. function deprecateForMajor(major, oldName, newName, fn2) {
  64399. return deprecate(`${oldName} is deprecated and will be removed in ${major}.0; please use ${newName} instead.`, fn2);
  64400. }
  64401. const normalizeId$1 = (id) => id.indexOf("#") === 0 ? id.slice(1) : id;
  64402. function videojs$2(id, options2, ready) {
  64403. let player = videojs$2.getPlayer(id);
  64404. if (player) {
  64405. if (options2) {
  64406. log$1$1.warn(`Player "${id}" is already initialised. Options will not be applied.`);
  64407. }
  64408. if (ready) {
  64409. player.ready(ready);
  64410. }
  64411. return player;
  64412. }
  64413. const el = typeof id === "string" ? $$1("#" + normalizeId$1(id)) : id;
  64414. if (!isEl$1(el)) {
  64415. throw new TypeError("The element or ID supplied is not valid. (videojs)");
  64416. }
  64417. if (!el.ownerDocument.defaultView || !el.ownerDocument.body.contains(el)) {
  64418. log$1$1.warn("The element supplied is not included in the DOM");
  64419. }
  64420. options2 = options2 || {};
  64421. if (options2.restoreEl === true) {
  64422. options2.restoreEl = (el.parentNode && el.parentNode.hasAttribute("data-vjs-player") ? el.parentNode : el).cloneNode(true);
  64423. }
  64424. hooks$1("beforesetup").forEach((hookFunction) => {
  64425. const opts = hookFunction(el, merge$1(options2));
  64426. if (!isObject$2(opts) || Array.isArray(opts)) {
  64427. log$1$1.error("please return an object in beforesetup hooks");
  64428. return;
  64429. }
  64430. options2 = merge$1(options2, opts);
  64431. });
  64432. const PlayerComponent = Component$1$1.getComponent("Player");
  64433. player = new PlayerComponent(el, options2, ready);
  64434. hooks$1("setup").forEach((hookFunction) => hookFunction(player));
  64435. return player;
  64436. }
  64437. videojs$2.hooks_ = hooks_$1;
  64438. videojs$2.hooks = hooks$1;
  64439. videojs$2.hook = hook$1;
  64440. videojs$2.hookOnce = hookOnce$1;
  64441. videojs$2.removeHook = removeHook$1;
  64442. if (window_1.VIDEOJS_NO_DYNAMIC_STYLE !== true && isReal$1()) {
  64443. let style = $$1(".vjs-styles-defaults");
  64444. if (!style) {
  64445. style = createStyleElement$1("vjs-styles-defaults");
  64446. const head = $$1("head");
  64447. if (head) {
  64448. head.insertBefore(style, head.firstChild);
  64449. }
  64450. setTextContent$1(style, `
  64451. .video-js {
  64452. width: 300px;
  64453. height: 150px;
  64454. }
  64455. .vjs-fluid:not(.vjs-audio-only-mode) {
  64456. padding-top: 56.25%
  64457. }
  64458. `);
  64459. }
  64460. }
  64461. autoSetupTimeout$1(1, videojs$2);
  64462. videojs$2.VERSION = version$6$1;
  64463. videojs$2.options = Player$1.prototype.options_;
  64464. videojs$2.getPlayers = () => Player$1.players;
  64465. videojs$2.getPlayer = (id) => {
  64466. const players = Player$1.players;
  64467. let tag;
  64468. if (typeof id === "string") {
  64469. const nId = normalizeId$1(id);
  64470. const player = players[nId];
  64471. if (player) {
  64472. return player;
  64473. }
  64474. tag = $$1("#" + nId);
  64475. } else {
  64476. tag = id;
  64477. }
  64478. if (isEl$1(tag)) {
  64479. const {
  64480. player,
  64481. playerId
  64482. } = tag;
  64483. if (player || players[playerId]) {
  64484. return player || players[playerId];
  64485. }
  64486. }
  64487. };
  64488. videojs$2.getAllPlayers = () => Object.keys(Player$1.players).map((k) => Player$1.players[k]).filter(Boolean);
  64489. videojs$2.players = Player$1.players;
  64490. videojs$2.getComponent = Component$1$1.getComponent;
  64491. videojs$2.registerComponent = (name, comp) => {
  64492. if (Tech$2.isTech(comp)) {
  64493. log$1$1.warn(`The ${name} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`);
  64494. }
  64495. Component$1$1.registerComponent.call(Component$1$1, name, comp);
  64496. };
  64497. videojs$2.getTech = Tech$2.getTech;
  64498. videojs$2.registerTech = Tech$2.registerTech;
  64499. videojs$2.use = use$1;
  64500. Object.defineProperty(videojs$2, "middleware", {
  64501. value: {},
  64502. writeable: false,
  64503. enumerable: true
  64504. });
  64505. Object.defineProperty(videojs$2.middleware, "TERMINATOR", {
  64506. value: TERMINATOR$1,
  64507. writeable: false,
  64508. enumerable: true
  64509. });
  64510. videojs$2.browser = browser$1;
  64511. videojs$2.obj = Obj;
  64512. videojs$2.mergeOptions = deprecateForMajor(9, "videojs.mergeOptions", "videojs.obj.merge", merge$1);
  64513. videojs$2.defineLazyProperty = deprecateForMajor(9, "videojs.defineLazyProperty", "videojs.obj.defineLazyProperty", defineLazyProperty$1);
  64514. videojs$2.bind = deprecateForMajor(9, "videojs.bind", "native Function.prototype.bind", bind_);
  64515. videojs$2.registerPlugin = Plugin$1.registerPlugin;
  64516. videojs$2.deregisterPlugin = Plugin$1.deregisterPlugin;
  64517. videojs$2.plugin = (name, plugin) => {
  64518. log$1$1.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead");
  64519. return Plugin$1.registerPlugin(name, plugin);
  64520. };
  64521. videojs$2.getPlugins = Plugin$1.getPlugins;
  64522. videojs$2.getPlugin = Plugin$1.getPlugin;
  64523. videojs$2.getPluginVersion = Plugin$1.getPluginVersion;
  64524. videojs$2.addLanguage = function(code, data) {
  64525. code = ("" + code).toLowerCase();
  64526. videojs$2.options.languages = merge$1(videojs$2.options.languages, {
  64527. [code]: data
  64528. });
  64529. return videojs$2.options.languages[code];
  64530. };
  64531. videojs$2.log = log$1$1;
  64532. videojs$2.createLogger = createLogger$2;
  64533. videojs$2.time = Time;
  64534. videojs$2.createTimeRange = deprecateForMajor(9, "videojs.createTimeRange", "videojs.time.createTimeRanges", createTimeRanges$1);
  64535. videojs$2.createTimeRanges = deprecateForMajor(9, "videojs.createTimeRanges", "videojs.time.createTimeRanges", createTimeRanges$1);
  64536. videojs$2.formatTime = deprecateForMajor(9, "videojs.formatTime", "videojs.time.formatTime", formatTime$1);
  64537. videojs$2.setFormatTime = deprecateForMajor(9, "videojs.setFormatTime", "videojs.time.setFormatTime", setFormatTime$1);
  64538. videojs$2.resetFormatTime = deprecateForMajor(9, "videojs.resetFormatTime", "videojs.time.resetFormatTime", resetFormatTime$1);
  64539. videojs$2.parseUrl = deprecateForMajor(9, "videojs.parseUrl", "videojs.url.parseUrl", parseUrl$1);
  64540. videojs$2.isCrossOrigin = deprecateForMajor(9, "videojs.isCrossOrigin", "videojs.url.isCrossOrigin", isCrossOrigin$1);
  64541. videojs$2.EventTarget = EventTarget$2$1;
  64542. videojs$2.any = any$1;
  64543. videojs$2.on = on$1;
  64544. videojs$2.one = one$1;
  64545. videojs$2.off = off$1;
  64546. videojs$2.trigger = trigger$1;
  64547. videojs$2.xhr = XHR;
  64548. videojs$2.TextTrack = TextTrack$1;
  64549. videojs$2.AudioTrack = AudioTrack$1;
  64550. videojs$2.VideoTrack = VideoTrack$1;
  64551. ["isEl", "isTextNode", "createEl", "hasClass", "addClass", "removeClass", "toggleClass", "setAttributes", "getAttributes", "emptyEl", "appendContent", "insertContent"].forEach((k) => {
  64552. videojs$2[k] = function() {
  64553. log$1$1.warn(`videojs.${k}() is deprecated; use videojs.dom.${k}() instead`);
  64554. return Dom$2[k].apply(null, arguments);
  64555. };
  64556. });
  64557. videojs$2.computedStyle = deprecateForMajor(9, "videojs.computedStyle", "videojs.dom.computedStyle", computedStyle$1);
  64558. videojs$2.dom = Dom$2;
  64559. videojs$2.fn = Fn;
  64560. videojs$2.num = Num;
  64561. videojs$2.str = Str;
  64562. videojs$2.url = Url$2;
  64563. /*! @name videojs-contrib-quality-levels @version 3.0.0 @license Apache-2.0 */
  64564. class QualityLevel {
  64565. constructor(representation) {
  64566. let level = this;
  64567. level.id = representation.id;
  64568. level.label = level.id;
  64569. level.width = representation.width;
  64570. level.height = representation.height;
  64571. level.bitrate = representation.bandwidth;
  64572. level.frameRate = representation.frameRate;
  64573. level.enabled_ = representation.enabled;
  64574. Object.defineProperty(level, "enabled", {
  64575. get() {
  64576. return level.enabled_();
  64577. },
  64578. set(enable) {
  64579. level.enabled_(enable);
  64580. }
  64581. });
  64582. return level;
  64583. }
  64584. }
  64585. class QualityLevelList extends videojs$2.EventTarget {
  64586. constructor() {
  64587. super();
  64588. let list = this;
  64589. list.levels_ = [];
  64590. list.selectedIndex_ = -1;
  64591. Object.defineProperty(list, "selectedIndex", {
  64592. get() {
  64593. return list.selectedIndex_;
  64594. }
  64595. });
  64596. Object.defineProperty(list, "length", {
  64597. get() {
  64598. return list.levels_.length;
  64599. }
  64600. });
  64601. return list;
  64602. }
  64603. addQualityLevel(representation) {
  64604. let qualityLevel = this.getQualityLevelById(representation.id);
  64605. if (qualityLevel) {
  64606. return qualityLevel;
  64607. }
  64608. const index2 = this.levels_.length;
  64609. qualityLevel = new QualityLevel(representation);
  64610. if (!("" + index2 in this)) {
  64611. Object.defineProperty(this, index2, {
  64612. get() {
  64613. return this.levels_[index2];
  64614. }
  64615. });
  64616. }
  64617. this.levels_.push(qualityLevel);
  64618. this.trigger({
  64619. qualityLevel,
  64620. type: "addqualitylevel"
  64621. });
  64622. return qualityLevel;
  64623. }
  64624. removeQualityLevel(qualityLevel) {
  64625. let removed = null;
  64626. for (let i2 = 0, l = this.length; i2 < l; i2++) {
  64627. if (this[i2] === qualityLevel) {
  64628. removed = this.levels_.splice(i2, 1)[0];
  64629. if (this.selectedIndex_ === i2) {
  64630. this.selectedIndex_ = -1;
  64631. } else if (this.selectedIndex_ > i2) {
  64632. this.selectedIndex_--;
  64633. }
  64634. break;
  64635. }
  64636. }
  64637. if (removed) {
  64638. this.trigger({
  64639. qualityLevel,
  64640. type: "removequalitylevel"
  64641. });
  64642. }
  64643. return removed;
  64644. }
  64645. getQualityLevelById(id) {
  64646. for (let i2 = 0, l = this.length; i2 < l; i2++) {
  64647. const level = this[i2];
  64648. if (level.id === id) {
  64649. return level;
  64650. }
  64651. }
  64652. return null;
  64653. }
  64654. dispose() {
  64655. this.selectedIndex_ = -1;
  64656. this.levels_.length = 0;
  64657. }
  64658. }
  64659. QualityLevelList.prototype.allowedEvents_ = {
  64660. change: "change",
  64661. addqualitylevel: "addqualitylevel",
  64662. removequalitylevel: "removequalitylevel"
  64663. };
  64664. for (const event2 in QualityLevelList.prototype.allowedEvents_) {
  64665. QualityLevelList.prototype["on" + event2] = null;
  64666. }
  64667. var version$5$1 = "3.0.0";
  64668. const registerPlugin$1 = videojs$2.registerPlugin || videojs$2.plugin;
  64669. const initPlugin$1 = function(player, options2) {
  64670. const originalPluginFn = player.qualityLevels;
  64671. const qualityLevelList = new QualityLevelList();
  64672. const disposeHandler = function() {
  64673. qualityLevelList.dispose();
  64674. player.qualityLevels = originalPluginFn;
  64675. player.off("dispose", disposeHandler);
  64676. };
  64677. player.on("dispose", disposeHandler);
  64678. player.qualityLevels = () => qualityLevelList;
  64679. player.qualityLevels.VERSION = version$5$1;
  64680. return qualityLevelList;
  64681. };
  64682. const qualityLevels = function(options2) {
  64683. return initPlugin$1(this, videojs$2.mergeOptions({}, options2));
  64684. };
  64685. registerPlugin$1("qualityLevels", qualityLevels);
  64686. qualityLevels.VERSION = version$5$1;
  64687. /*! @name @videojs/http-streaming @version 3.0.2 @license Apache-2.0 */
  64688. const resolveUrl$2 = resolveUrl$4;
  64689. const resolveManifestRedirect$1 = (url, req) => {
  64690. if (req && req.responseURL && url !== req.responseURL) {
  64691. return req.responseURL;
  64692. }
  64693. return url;
  64694. };
  64695. const logger$1 = (source) => {
  64696. if (videojs$2.log.debug) {
  64697. return videojs$2.log.debug.bind(videojs$2, "VHS:", `${source} >`);
  64698. }
  64699. return function() {
  64700. };
  64701. };
  64702. function merge$2(...args) {
  64703. const context = videojs$2.obj || videojs$2;
  64704. const fn2 = context.merge || context.mergeOptions;
  64705. return fn2.apply(context, args);
  64706. }
  64707. function createTimeRanges$2(...args) {
  64708. const context = videojs$2.time || videojs$2;
  64709. const fn2 = context.createTimeRanges || context.createTimeRanges;
  64710. return fn2.apply(context, args);
  64711. }
  64712. const TIME_FUDGE_FACTOR$1 = 1 / 30;
  64713. const SAFE_TIME_DELTA$1 = TIME_FUDGE_FACTOR$1 * 3;
  64714. const filterRanges$1 = function(timeRanges, predicate) {
  64715. const results = [];
  64716. let i2;
  64717. if (timeRanges && timeRanges.length) {
  64718. for (i2 = 0; i2 < timeRanges.length; i2++) {
  64719. if (predicate(timeRanges.start(i2), timeRanges.end(i2))) {
  64720. results.push([timeRanges.start(i2), timeRanges.end(i2)]);
  64721. }
  64722. }
  64723. }
  64724. return createTimeRanges$2(results);
  64725. };
  64726. const findRange$1 = function(buffered, time) {
  64727. return filterRanges$1(buffered, function(start2, end) {
  64728. return start2 - SAFE_TIME_DELTA$1 <= time && end + SAFE_TIME_DELTA$1 >= time;
  64729. });
  64730. };
  64731. const findNextRange$1 = function(timeRanges, time) {
  64732. return filterRanges$1(timeRanges, function(start2) {
  64733. return start2 - TIME_FUDGE_FACTOR$1 >= time;
  64734. });
  64735. };
  64736. const findGaps$1 = function(buffered) {
  64737. if (buffered.length < 2) {
  64738. return createTimeRanges$2();
  64739. }
  64740. const ranges = [];
  64741. for (let i2 = 1; i2 < buffered.length; i2++) {
  64742. const start2 = buffered.end(i2 - 1);
  64743. const end = buffered.start(i2);
  64744. ranges.push([start2, end]);
  64745. }
  64746. return createTimeRanges$2(ranges);
  64747. };
  64748. const bufferIntersection$1 = function(bufferA, bufferB) {
  64749. let start2 = null;
  64750. let end = null;
  64751. let arity = 0;
  64752. const extents = [];
  64753. const ranges = [];
  64754. if (!bufferA || !bufferA.length || !bufferB || !bufferB.length) {
  64755. return createTimeRanges$2();
  64756. }
  64757. let count = bufferA.length;
  64758. while (count--) {
  64759. extents.push({
  64760. time: bufferA.start(count),
  64761. type: "start"
  64762. });
  64763. extents.push({
  64764. time: bufferA.end(count),
  64765. type: "end"
  64766. });
  64767. }
  64768. count = bufferB.length;
  64769. while (count--) {
  64770. extents.push({
  64771. time: bufferB.start(count),
  64772. type: "start"
  64773. });
  64774. extents.push({
  64775. time: bufferB.end(count),
  64776. type: "end"
  64777. });
  64778. }
  64779. extents.sort(function(a, b) {
  64780. return a.time - b.time;
  64781. });
  64782. for (count = 0; count < extents.length; count++) {
  64783. if (extents[count].type === "start") {
  64784. arity++;
  64785. if (arity === 2) {
  64786. start2 = extents[count].time;
  64787. }
  64788. } else if (extents[count].type === "end") {
  64789. arity--;
  64790. if (arity === 1) {
  64791. end = extents[count].time;
  64792. }
  64793. }
  64794. if (start2 !== null && end !== null) {
  64795. ranges.push([start2, end]);
  64796. start2 = null;
  64797. end = null;
  64798. }
  64799. }
  64800. return createTimeRanges$2(ranges);
  64801. };
  64802. const printableRange$1 = (range3) => {
  64803. const strArr = [];
  64804. if (!range3 || !range3.length) {
  64805. return "";
  64806. }
  64807. for (let i2 = 0; i2 < range3.length; i2++) {
  64808. strArr.push(range3.start(i2) + " => " + range3.end(i2));
  64809. }
  64810. return strArr.join(", ");
  64811. };
  64812. const timeUntilRebuffer$1 = function(buffered, currentTime, playbackRate = 1) {
  64813. const bufferedEnd = buffered.length ? buffered.end(buffered.length - 1) : 0;
  64814. return (bufferedEnd - currentTime) / playbackRate;
  64815. };
  64816. const timeRangesToArray$1 = (timeRanges) => {
  64817. const timeRangesList = [];
  64818. for (let i2 = 0; i2 < timeRanges.length; i2++) {
  64819. timeRangesList.push({
  64820. start: timeRanges.start(i2),
  64821. end: timeRanges.end(i2)
  64822. });
  64823. }
  64824. return timeRangesList;
  64825. };
  64826. const isRangeDifferent$1 = function(a, b) {
  64827. if (a === b) {
  64828. return false;
  64829. }
  64830. if (!a && b || !b && a) {
  64831. return true;
  64832. }
  64833. if (a.length !== b.length) {
  64834. return true;
  64835. }
  64836. for (let i2 = 0; i2 < a.length; i2++) {
  64837. if (a.start(i2) !== b.start(i2) || a.end(i2) !== b.end(i2)) {
  64838. return true;
  64839. }
  64840. }
  64841. return false;
  64842. };
  64843. const lastBufferedEnd$1 = function(a) {
  64844. if (!a || !a.length || !a.end) {
  64845. return;
  64846. }
  64847. return a.end(a.length - 1);
  64848. };
  64849. const timeAheadOf$1 = function(range3, startTime) {
  64850. let time = 0;
  64851. if (!range3 || !range3.length) {
  64852. return time;
  64853. }
  64854. for (let i2 = 0; i2 < range3.length; i2++) {
  64855. const start2 = range3.start(i2);
  64856. const end = range3.end(i2);
  64857. if (startTime > end) {
  64858. continue;
  64859. }
  64860. if (startTime > start2 && startTime <= end) {
  64861. time += end - startTime;
  64862. continue;
  64863. }
  64864. time += end - start2;
  64865. }
  64866. return time;
  64867. };
  64868. const segmentDurationWithParts$1 = (playlist, segment) => {
  64869. if (!segment.preload) {
  64870. return segment.duration;
  64871. }
  64872. let result = 0;
  64873. (segment.parts || []).forEach(function(p) {
  64874. result += p.duration;
  64875. });
  64876. (segment.preloadHints || []).forEach(function(p) {
  64877. if (p.type === "PART") {
  64878. result += playlist.partTargetDuration;
  64879. }
  64880. });
  64881. return result;
  64882. };
  64883. const getPartsAndSegments$1 = (playlist) => (playlist.segments || []).reduce((acc, segment, si) => {
  64884. if (segment.parts) {
  64885. segment.parts.forEach(function(part, pi) {
  64886. acc.push({
  64887. duration: part.duration,
  64888. segmentIndex: si,
  64889. partIndex: pi,
  64890. part,
  64891. segment
  64892. });
  64893. });
  64894. } else {
  64895. acc.push({
  64896. duration: segment.duration,
  64897. segmentIndex: si,
  64898. partIndex: null,
  64899. segment,
  64900. part: null
  64901. });
  64902. }
  64903. return acc;
  64904. }, []);
  64905. const getLastParts$1 = (media) => {
  64906. const lastSegment = media.segments && media.segments.length && media.segments[media.segments.length - 1];
  64907. return lastSegment && lastSegment.parts || [];
  64908. };
  64909. const getKnownPartCount$1 = ({
  64910. preloadSegment
  64911. }) => {
  64912. if (!preloadSegment) {
  64913. return;
  64914. }
  64915. const {
  64916. parts,
  64917. preloadHints
  64918. } = preloadSegment;
  64919. let partCount = (preloadHints || []).reduce((count, hint) => count + (hint.type === "PART" ? 1 : 0), 0);
  64920. partCount += parts && parts.length ? parts.length : 0;
  64921. return partCount;
  64922. };
  64923. const liveEdgeDelay$1 = (main, media) => {
  64924. if (media.endList) {
  64925. return 0;
  64926. }
  64927. if (main && main.suggestedPresentationDelay) {
  64928. return main.suggestedPresentationDelay;
  64929. }
  64930. const hasParts = getLastParts$1(media).length > 0;
  64931. if (hasParts && media.serverControl && media.serverControl.partHoldBack) {
  64932. return media.serverControl.partHoldBack;
  64933. } else if (hasParts && media.partTargetDuration) {
  64934. return media.partTargetDuration * 3;
  64935. } else if (media.serverControl && media.serverControl.holdBack) {
  64936. return media.serverControl.holdBack;
  64937. } else if (media.targetDuration) {
  64938. return media.targetDuration * 3;
  64939. }
  64940. return 0;
  64941. };
  64942. const backwardDuration$1 = function(playlist, endSequence) {
  64943. let result = 0;
  64944. let i2 = endSequence - playlist.mediaSequence;
  64945. let segment = playlist.segments[i2];
  64946. if (segment) {
  64947. if (typeof segment.start !== "undefined") {
  64948. return {
  64949. result: segment.start,
  64950. precise: true
  64951. };
  64952. }
  64953. if (typeof segment.end !== "undefined") {
  64954. return {
  64955. result: segment.end - segment.duration,
  64956. precise: true
  64957. };
  64958. }
  64959. }
  64960. while (i2--) {
  64961. segment = playlist.segments[i2];
  64962. if (typeof segment.end !== "undefined") {
  64963. return {
  64964. result: result + segment.end,
  64965. precise: true
  64966. };
  64967. }
  64968. result += segmentDurationWithParts$1(playlist, segment);
  64969. if (typeof segment.start !== "undefined") {
  64970. return {
  64971. result: result + segment.start,
  64972. precise: true
  64973. };
  64974. }
  64975. }
  64976. return {
  64977. result,
  64978. precise: false
  64979. };
  64980. };
  64981. const forwardDuration$1 = function(playlist, endSequence) {
  64982. let result = 0;
  64983. let segment;
  64984. let i2 = endSequence - playlist.mediaSequence;
  64985. for (; i2 < playlist.segments.length; i2++) {
  64986. segment = playlist.segments[i2];
  64987. if (typeof segment.start !== "undefined") {
  64988. return {
  64989. result: segment.start - result,
  64990. precise: true
  64991. };
  64992. }
  64993. result += segmentDurationWithParts$1(playlist, segment);
  64994. if (typeof segment.end !== "undefined") {
  64995. return {
  64996. result: segment.end - result,
  64997. precise: true
  64998. };
  64999. }
  65000. }
  65001. return {
  65002. result: -1,
  65003. precise: false
  65004. };
  65005. };
  65006. const intervalDuration$1 = function(playlist, endSequence, expired) {
  65007. if (typeof endSequence === "undefined") {
  65008. endSequence = playlist.mediaSequence + playlist.segments.length;
  65009. }
  65010. if (endSequence < playlist.mediaSequence) {
  65011. return 0;
  65012. }
  65013. const backward = backwardDuration$1(playlist, endSequence);
  65014. if (backward.precise) {
  65015. return backward.result;
  65016. }
  65017. const forward = forwardDuration$1(playlist, endSequence);
  65018. if (forward.precise) {
  65019. return forward.result;
  65020. }
  65021. return backward.result + expired;
  65022. };
  65023. const duration$1 = function(playlist, endSequence, expired) {
  65024. if (!playlist) {
  65025. return 0;
  65026. }
  65027. if (typeof expired !== "number") {
  65028. expired = 0;
  65029. }
  65030. if (typeof endSequence === "undefined") {
  65031. if (playlist.totalDuration) {
  65032. return playlist.totalDuration;
  65033. }
  65034. if (!playlist.endList) {
  65035. return window_1.Infinity;
  65036. }
  65037. }
  65038. return intervalDuration$1(playlist, endSequence, expired);
  65039. };
  65040. const sumDurations$1 = function({
  65041. defaultDuration,
  65042. durationList,
  65043. startIndex,
  65044. endIndex
  65045. }) {
  65046. let durations = 0;
  65047. if (startIndex > endIndex) {
  65048. [startIndex, endIndex] = [endIndex, startIndex];
  65049. }
  65050. if (startIndex < 0) {
  65051. for (let i2 = startIndex; i2 < Math.min(0, endIndex); i2++) {
  65052. durations += defaultDuration;
  65053. }
  65054. startIndex = 0;
  65055. }
  65056. for (let i2 = startIndex; i2 < endIndex; i2++) {
  65057. durations += durationList[i2].duration;
  65058. }
  65059. return durations;
  65060. };
  65061. const playlistEnd$1 = function(playlist, expired, useSafeLiveEnd, liveEdgePadding) {
  65062. if (!playlist || !playlist.segments) {
  65063. return null;
  65064. }
  65065. if (playlist.endList) {
  65066. return duration$1(playlist);
  65067. }
  65068. if (expired === null) {
  65069. return null;
  65070. }
  65071. expired = expired || 0;
  65072. let lastSegmentEndTime = intervalDuration$1(playlist, playlist.mediaSequence + playlist.segments.length, expired);
  65073. if (useSafeLiveEnd) {
  65074. liveEdgePadding = typeof liveEdgePadding === "number" ? liveEdgePadding : liveEdgeDelay$1(null, playlist);
  65075. lastSegmentEndTime -= liveEdgePadding;
  65076. }
  65077. return Math.max(0, lastSegmentEndTime);
  65078. };
  65079. const seekable$1 = function(playlist, expired, liveEdgePadding) {
  65080. const useSafeLiveEnd = true;
  65081. const seekableStart = expired || 0;
  65082. const seekableEnd = playlistEnd$1(playlist, expired, useSafeLiveEnd, liveEdgePadding);
  65083. if (seekableEnd === null) {
  65084. return createTimeRanges$2();
  65085. }
  65086. return createTimeRanges$2(seekableStart, seekableEnd);
  65087. };
  65088. const getMediaInfoForTime$1 = function({
  65089. playlist,
  65090. currentTime,
  65091. startingSegmentIndex,
  65092. startingPartIndex,
  65093. startTime,
  65094. exactManifestTimings
  65095. }) {
  65096. let time = currentTime - startTime;
  65097. const partsAndSegments = getPartsAndSegments$1(playlist);
  65098. let startIndex = 0;
  65099. for (let i2 = 0; i2 < partsAndSegments.length; i2++) {
  65100. const partAndSegment = partsAndSegments[i2];
  65101. if (startingSegmentIndex !== partAndSegment.segmentIndex) {
  65102. continue;
  65103. }
  65104. if (typeof startingPartIndex === "number" && typeof partAndSegment.partIndex === "number" && startingPartIndex !== partAndSegment.partIndex) {
  65105. continue;
  65106. }
  65107. startIndex = i2;
  65108. break;
  65109. }
  65110. if (time < 0) {
  65111. if (startIndex > 0) {
  65112. for (let i2 = startIndex - 1; i2 >= 0; i2--) {
  65113. const partAndSegment = partsAndSegments[i2];
  65114. time += partAndSegment.duration;
  65115. if (exactManifestTimings) {
  65116. if (time < 0) {
  65117. continue;
  65118. }
  65119. } else if (time + TIME_FUDGE_FACTOR$1 <= 0) {
  65120. continue;
  65121. }
  65122. return {
  65123. partIndex: partAndSegment.partIndex,
  65124. segmentIndex: partAndSegment.segmentIndex,
  65125. startTime: startTime - sumDurations$1({
  65126. defaultDuration: playlist.targetDuration,
  65127. durationList: partsAndSegments,
  65128. startIndex,
  65129. endIndex: i2
  65130. })
  65131. };
  65132. }
  65133. }
  65134. return {
  65135. partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null,
  65136. segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0,
  65137. startTime: currentTime
  65138. };
  65139. }
  65140. if (startIndex < 0) {
  65141. for (let i2 = startIndex; i2 < 0; i2++) {
  65142. time -= playlist.targetDuration;
  65143. if (time < 0) {
  65144. return {
  65145. partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null,
  65146. segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0,
  65147. startTime: currentTime
  65148. };
  65149. }
  65150. }
  65151. startIndex = 0;
  65152. }
  65153. for (let i2 = startIndex; i2 < partsAndSegments.length; i2++) {
  65154. const partAndSegment = partsAndSegments[i2];
  65155. time -= partAndSegment.duration;
  65156. if (exactManifestTimings) {
  65157. if (time > 0) {
  65158. continue;
  65159. }
  65160. } else if (time - TIME_FUDGE_FACTOR$1 >= 0) {
  65161. continue;
  65162. }
  65163. return {
  65164. partIndex: partAndSegment.partIndex,
  65165. segmentIndex: partAndSegment.segmentIndex,
  65166. startTime: startTime + sumDurations$1({
  65167. defaultDuration: playlist.targetDuration,
  65168. durationList: partsAndSegments,
  65169. startIndex,
  65170. endIndex: i2
  65171. })
  65172. };
  65173. }
  65174. return {
  65175. segmentIndex: partsAndSegments[partsAndSegments.length - 1].segmentIndex,
  65176. partIndex: partsAndSegments[partsAndSegments.length - 1].partIndex,
  65177. startTime: currentTime
  65178. };
  65179. };
  65180. const isExcluded = function(playlist) {
  65181. return playlist.excludeUntil && playlist.excludeUntil > Date.now();
  65182. };
  65183. const isIncompatible$1 = function(playlist) {
  65184. return playlist.excludeUntil && playlist.excludeUntil === Infinity;
  65185. };
  65186. const isEnabled$1 = function(playlist) {
  65187. const excluded = isExcluded(playlist);
  65188. return !playlist.disabled && !excluded;
  65189. };
  65190. const isDisabled$1 = function(playlist) {
  65191. return playlist.disabled;
  65192. };
  65193. const isAes$1 = function(media) {
  65194. for (let i2 = 0; i2 < media.segments.length; i2++) {
  65195. if (media.segments[i2].key) {
  65196. return true;
  65197. }
  65198. }
  65199. return false;
  65200. };
  65201. const hasAttribute$1 = function(attr, playlist) {
  65202. return playlist.attributes && playlist.attributes[attr];
  65203. };
  65204. const estimateSegmentRequestTime$1 = function(segmentDuration, bandwidth2, playlist, bytesReceived = 0) {
  65205. if (!hasAttribute$1("BANDWIDTH", playlist)) {
  65206. return NaN;
  65207. }
  65208. const size = segmentDuration * playlist.attributes.BANDWIDTH;
  65209. return (size - bytesReceived * 8) / bandwidth2;
  65210. };
  65211. const isLowestEnabledRendition$1 = (main, media) => {
  65212. if (main.playlists.length === 1) {
  65213. return true;
  65214. }
  65215. const currentBandwidth = media.attributes.BANDWIDTH || Number.MAX_VALUE;
  65216. return main.playlists.filter((playlist) => {
  65217. if (!isEnabled$1(playlist)) {
  65218. return false;
  65219. }
  65220. return (playlist.attributes.BANDWIDTH || 0) < currentBandwidth;
  65221. }).length === 0;
  65222. };
  65223. const playlistMatch$1 = (a, b) => {
  65224. if (!a && !b || !a && b || a && !b) {
  65225. return false;
  65226. }
  65227. if (a === b) {
  65228. return true;
  65229. }
  65230. if (a.id && b.id && a.id === b.id) {
  65231. return true;
  65232. }
  65233. if (a.resolvedUri && b.resolvedUri && a.resolvedUri === b.resolvedUri) {
  65234. return true;
  65235. }
  65236. if (a.uri && b.uri && a.uri === b.uri) {
  65237. return true;
  65238. }
  65239. return false;
  65240. };
  65241. const someAudioVariant$1 = function(main, callback2) {
  65242. const AUDIO5 = main && main.mediaGroups && main.mediaGroups.AUDIO || {};
  65243. let found = false;
  65244. for (const groupName in AUDIO5) {
  65245. for (const label2 in AUDIO5[groupName]) {
  65246. found = callback2(AUDIO5[groupName][label2]);
  65247. if (found) {
  65248. break;
  65249. }
  65250. }
  65251. if (found) {
  65252. break;
  65253. }
  65254. }
  65255. return !!found;
  65256. };
  65257. const isAudioOnly$1 = (main) => {
  65258. if (!main || !main.playlists || !main.playlists.length) {
  65259. const found = someAudioVariant$1(main, (variant) => variant.playlists && variant.playlists.length || variant.uri);
  65260. return found;
  65261. }
  65262. for (let i2 = 0; i2 < main.playlists.length; i2++) {
  65263. const playlist = main.playlists[i2];
  65264. const CODECS = playlist.attributes && playlist.attributes.CODECS;
  65265. if (CODECS && CODECS.split(",").every((c) => isAudioCodec$1(c))) {
  65266. continue;
  65267. }
  65268. const found = someAudioVariant$1(main, (variant) => playlistMatch$1(playlist, variant));
  65269. if (found) {
  65270. continue;
  65271. }
  65272. return false;
  65273. }
  65274. return true;
  65275. };
  65276. var Playlist$1 = {
  65277. liveEdgeDelay: liveEdgeDelay$1,
  65278. duration: duration$1,
  65279. seekable: seekable$1,
  65280. getMediaInfoForTime: getMediaInfoForTime$1,
  65281. isEnabled: isEnabled$1,
  65282. isDisabled: isDisabled$1,
  65283. isExcluded,
  65284. isIncompatible: isIncompatible$1,
  65285. playlistEnd: playlistEnd$1,
  65286. isAes: isAes$1,
  65287. hasAttribute: hasAttribute$1,
  65288. estimateSegmentRequestTime: estimateSegmentRequestTime$1,
  65289. isLowestEnabledRendition: isLowestEnabledRendition$1,
  65290. isAudioOnly: isAudioOnly$1,
  65291. playlistMatch: playlistMatch$1,
  65292. segmentDurationWithParts: segmentDurationWithParts$1
  65293. };
  65294. const {
  65295. log: log$2
  65296. } = videojs$2;
  65297. const createPlaylistID$1 = (index2, uri) => {
  65298. return `${index2}-${uri}`;
  65299. };
  65300. const groupID$1 = (type2, group, label2) => {
  65301. return `placeholder-uri-${type2}-${group}-${label2}`;
  65302. };
  65303. const parseManifest$1 = ({
  65304. onwarn,
  65305. oninfo,
  65306. manifestString,
  65307. customTagParsers = [],
  65308. customTagMappers = [],
  65309. llhls
  65310. }) => {
  65311. const parser2 = new Parser$1();
  65312. if (onwarn) {
  65313. parser2.on("warn", onwarn);
  65314. }
  65315. if (oninfo) {
  65316. parser2.on("info", oninfo);
  65317. }
  65318. customTagParsers.forEach((customParser) => parser2.addParser(customParser));
  65319. customTagMappers.forEach((mapper) => parser2.addTagMapper(mapper));
  65320. parser2.push(manifestString);
  65321. parser2.end();
  65322. const manifest = parser2.manifest;
  65323. if (!llhls) {
  65324. ["preloadSegment", "skip", "serverControl", "renditionReports", "partInf", "partTargetDuration"].forEach(function(k) {
  65325. if (manifest.hasOwnProperty(k)) {
  65326. delete manifest[k];
  65327. }
  65328. });
  65329. if (manifest.segments) {
  65330. manifest.segments.forEach(function(segment) {
  65331. ["parts", "preloadHints"].forEach(function(k) {
  65332. if (segment.hasOwnProperty(k)) {
  65333. delete segment[k];
  65334. }
  65335. });
  65336. });
  65337. }
  65338. }
  65339. if (!manifest.targetDuration) {
  65340. let targetDuration = 10;
  65341. if (manifest.segments && manifest.segments.length) {
  65342. targetDuration = manifest.segments.reduce((acc, s) => Math.max(acc, s.duration), 0);
  65343. }
  65344. if (onwarn) {
  65345. onwarn(`manifest has no targetDuration defaulting to ${targetDuration}`);
  65346. }
  65347. manifest.targetDuration = targetDuration;
  65348. }
  65349. const parts = getLastParts$1(manifest);
  65350. if (parts.length && !manifest.partTargetDuration) {
  65351. const partTargetDuration = parts.reduce((acc, p) => Math.max(acc, p.duration), 0);
  65352. if (onwarn) {
  65353. onwarn(`manifest has no partTargetDuration defaulting to ${partTargetDuration}`);
  65354. log$2.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.");
  65355. }
  65356. manifest.partTargetDuration = partTargetDuration;
  65357. }
  65358. return manifest;
  65359. };
  65360. const forEachMediaGroup$2 = (main, callback2) => {
  65361. if (!main.mediaGroups) {
  65362. return;
  65363. }
  65364. ["AUDIO", "SUBTITLES"].forEach((mediaType) => {
  65365. if (!main.mediaGroups[mediaType]) {
  65366. return;
  65367. }
  65368. for (const groupKey in main.mediaGroups[mediaType]) {
  65369. for (const labelKey in main.mediaGroups[mediaType][groupKey]) {
  65370. const mediaProperties = main.mediaGroups[mediaType][groupKey][labelKey];
  65371. callback2(mediaProperties, mediaType, groupKey, labelKey);
  65372. }
  65373. }
  65374. });
  65375. };
  65376. const setupMediaPlaylist$1 = ({
  65377. playlist,
  65378. uri,
  65379. id
  65380. }) => {
  65381. playlist.id = id;
  65382. playlist.playlistErrors_ = 0;
  65383. if (uri) {
  65384. playlist.uri = uri;
  65385. }
  65386. playlist.attributes = playlist.attributes || {};
  65387. };
  65388. const setupMediaPlaylists$1 = (main) => {
  65389. let i2 = main.playlists.length;
  65390. while (i2--) {
  65391. const playlist = main.playlists[i2];
  65392. setupMediaPlaylist$1({
  65393. playlist,
  65394. id: createPlaylistID$1(i2, playlist.uri)
  65395. });
  65396. playlist.resolvedUri = resolveUrl$2(main.uri, playlist.uri);
  65397. main.playlists[playlist.id] = playlist;
  65398. main.playlists[playlist.uri] = playlist;
  65399. if (!playlist.attributes.BANDWIDTH) {
  65400. log$2.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.");
  65401. }
  65402. }
  65403. };
  65404. const resolveMediaGroupUris$1 = (main) => {
  65405. forEachMediaGroup$2(main, (properties) => {
  65406. if (properties.uri) {
  65407. properties.resolvedUri = resolveUrl$2(main.uri, properties.uri);
  65408. }
  65409. });
  65410. };
  65411. const mainForMedia = (media, uri) => {
  65412. const id = createPlaylistID$1(0, uri);
  65413. const main = {
  65414. mediaGroups: {
  65415. "AUDIO": {},
  65416. "VIDEO": {},
  65417. "CLOSED-CAPTIONS": {},
  65418. "SUBTITLES": {}
  65419. },
  65420. uri: window_1.location.href,
  65421. resolvedUri: window_1.location.href,
  65422. playlists: [{
  65423. uri,
  65424. id,
  65425. resolvedUri: uri,
  65426. attributes: {}
  65427. }]
  65428. };
  65429. main.playlists[id] = main.playlists[0];
  65430. main.playlists[uri] = main.playlists[0];
  65431. return main;
  65432. };
  65433. const addPropertiesToMain = (main, uri, createGroupID = groupID$1) => {
  65434. main.uri = uri;
  65435. for (let i2 = 0; i2 < main.playlists.length; i2++) {
  65436. if (!main.playlists[i2].uri) {
  65437. const phonyUri = `placeholder-uri-${i2}`;
  65438. main.playlists[i2].uri = phonyUri;
  65439. }
  65440. }
  65441. const audioOnlyMain = isAudioOnly$1(main);
  65442. forEachMediaGroup$2(main, (properties, mediaType, groupKey, labelKey) => {
  65443. if (!properties.playlists || !properties.playlists.length) {
  65444. if (audioOnlyMain && mediaType === "AUDIO" && !properties.uri) {
  65445. for (let i2 = 0; i2 < main.playlists.length; i2++) {
  65446. const p = main.playlists[i2];
  65447. if (p.attributes && p.attributes.AUDIO && p.attributes.AUDIO === groupKey) {
  65448. return;
  65449. }
  65450. }
  65451. }
  65452. properties.playlists = [_extends$2({}, properties)];
  65453. }
  65454. properties.playlists.forEach(function(p, i2) {
  65455. const groupId = createGroupID(mediaType, groupKey, labelKey, p);
  65456. const id = createPlaylistID$1(i2, groupId);
  65457. if (p.uri) {
  65458. p.resolvedUri = p.resolvedUri || resolveUrl$2(main.uri, p.uri);
  65459. } else {
  65460. p.uri = i2 === 0 ? groupId : id;
  65461. p.resolvedUri = p.uri;
  65462. }
  65463. p.id = p.id || id;
  65464. p.attributes = p.attributes || {};
  65465. main.playlists[p.id] = p;
  65466. main.playlists[p.uri] = p;
  65467. });
  65468. });
  65469. setupMediaPlaylists$1(main);
  65470. resolveMediaGroupUris$1(main);
  65471. };
  65472. const {
  65473. EventTarget: EventTarget$1$1
  65474. } = videojs$2;
  65475. const addLLHLSQueryDirectives$1 = (uri, media) => {
  65476. if (media.endList || !media.serverControl) {
  65477. return uri;
  65478. }
  65479. const parameters = {};
  65480. if (media.serverControl.canBlockReload) {
  65481. const {
  65482. preloadSegment
  65483. } = media;
  65484. let nextMSN = media.mediaSequence + media.segments.length;
  65485. if (preloadSegment) {
  65486. const parts = preloadSegment.parts || [];
  65487. const nextPart = getKnownPartCount$1(media) - 1;
  65488. if (nextPart > -1 && nextPart !== parts.length - 1) {
  65489. parameters._HLS_part = nextPart;
  65490. }
  65491. if (nextPart > -1 || parts.length) {
  65492. nextMSN--;
  65493. }
  65494. }
  65495. parameters._HLS_msn = nextMSN;
  65496. }
  65497. if (media.serverControl && media.serverControl.canSkipUntil) {
  65498. parameters._HLS_skip = media.serverControl.canSkipDateranges ? "v2" : "YES";
  65499. }
  65500. if (Object.keys(parameters).length) {
  65501. const parsedUri = new window_1.URL(uri);
  65502. ["_HLS_skip", "_HLS_msn", "_HLS_part"].forEach(function(name) {
  65503. if (!parameters.hasOwnProperty(name)) {
  65504. return;
  65505. }
  65506. parsedUri.searchParams.set(name, parameters[name]);
  65507. });
  65508. uri = parsedUri.toString();
  65509. }
  65510. return uri;
  65511. };
  65512. const updateSegment$1 = (a, b) => {
  65513. if (!a) {
  65514. return b;
  65515. }
  65516. const result = merge$2(a, b);
  65517. if (a.preloadHints && !b.preloadHints) {
  65518. delete result.preloadHints;
  65519. }
  65520. if (a.parts && !b.parts) {
  65521. delete result.parts;
  65522. } else if (a.parts && b.parts) {
  65523. for (let i2 = 0; i2 < b.parts.length; i2++) {
  65524. if (a.parts && a.parts[i2]) {
  65525. result.parts[i2] = merge$2(a.parts[i2], b.parts[i2]);
  65526. }
  65527. }
  65528. }
  65529. if (!a.skipped && b.skipped) {
  65530. result.skipped = false;
  65531. }
  65532. if (a.preload && !b.preload) {
  65533. result.preload = false;
  65534. }
  65535. return result;
  65536. };
  65537. const updateSegments$1 = (original, update, offset) => {
  65538. const oldSegments = original.slice();
  65539. const newSegments = update.slice();
  65540. offset = offset || 0;
  65541. const result = [];
  65542. let currentMap;
  65543. for (let newIndex = 0; newIndex < newSegments.length; newIndex++) {
  65544. const oldSegment = oldSegments[newIndex + offset];
  65545. const newSegment = newSegments[newIndex];
  65546. if (oldSegment) {
  65547. currentMap = oldSegment.map || currentMap;
  65548. result.push(updateSegment$1(oldSegment, newSegment));
  65549. } else {
  65550. if (currentMap && !newSegment.map) {
  65551. newSegment.map = currentMap;
  65552. }
  65553. result.push(newSegment);
  65554. }
  65555. }
  65556. return result;
  65557. };
  65558. const resolveSegmentUris$1 = (segment, baseUri) => {
  65559. if (!segment.resolvedUri && segment.uri) {
  65560. segment.resolvedUri = resolveUrl$2(baseUri, segment.uri);
  65561. }
  65562. if (segment.key && !segment.key.resolvedUri) {
  65563. segment.key.resolvedUri = resolveUrl$2(baseUri, segment.key.uri);
  65564. }
  65565. if (segment.map && !segment.map.resolvedUri) {
  65566. segment.map.resolvedUri = resolveUrl$2(baseUri, segment.map.uri);
  65567. }
  65568. if (segment.map && segment.map.key && !segment.map.key.resolvedUri) {
  65569. segment.map.key.resolvedUri = resolveUrl$2(baseUri, segment.map.key.uri);
  65570. }
  65571. if (segment.parts && segment.parts.length) {
  65572. segment.parts.forEach((p) => {
  65573. if (p.resolvedUri) {
  65574. return;
  65575. }
  65576. p.resolvedUri = resolveUrl$2(baseUri, p.uri);
  65577. });
  65578. }
  65579. if (segment.preloadHints && segment.preloadHints.length) {
  65580. segment.preloadHints.forEach((p) => {
  65581. if (p.resolvedUri) {
  65582. return;
  65583. }
  65584. p.resolvedUri = resolveUrl$2(baseUri, p.uri);
  65585. });
  65586. }
  65587. };
  65588. const getAllSegments$1 = function(media) {
  65589. const segments = media.segments || [];
  65590. const preloadSegment = media.preloadSegment;
  65591. if (preloadSegment && preloadSegment.parts && preloadSegment.parts.length) {
  65592. if (preloadSegment.preloadHints) {
  65593. for (let i2 = 0; i2 < preloadSegment.preloadHints.length; i2++) {
  65594. if (preloadSegment.preloadHints[i2].type === "MAP") {
  65595. return segments;
  65596. }
  65597. }
  65598. }
  65599. preloadSegment.duration = media.targetDuration;
  65600. preloadSegment.preload = true;
  65601. segments.push(preloadSegment);
  65602. }
  65603. return segments;
  65604. };
  65605. const isPlaylistUnchanged$1 = (a, b) => a === b || a.segments && b.segments && a.segments.length === b.segments.length && a.endList === b.endList && a.mediaSequence === b.mediaSequence && a.preloadSegment === b.preloadSegment;
  65606. const updateMain$1 = (main, newMedia, unchangedCheck = isPlaylistUnchanged$1) => {
  65607. const result = merge$2(main, {});
  65608. const oldMedia = result.playlists[newMedia.id];
  65609. if (!oldMedia) {
  65610. return null;
  65611. }
  65612. if (unchangedCheck(oldMedia, newMedia)) {
  65613. return null;
  65614. }
  65615. newMedia.segments = getAllSegments$1(newMedia);
  65616. const mergedPlaylist = merge$2(oldMedia, newMedia);
  65617. if (mergedPlaylist.preloadSegment && !newMedia.preloadSegment) {
  65618. delete mergedPlaylist.preloadSegment;
  65619. }
  65620. if (oldMedia.segments) {
  65621. if (newMedia.skip) {
  65622. newMedia.segments = newMedia.segments || [];
  65623. for (let i2 = 0; i2 < newMedia.skip.skippedSegments; i2++) {
  65624. newMedia.segments.unshift({
  65625. skipped: true
  65626. });
  65627. }
  65628. }
  65629. mergedPlaylist.segments = updateSegments$1(oldMedia.segments, newMedia.segments, newMedia.mediaSequence - oldMedia.mediaSequence);
  65630. }
  65631. mergedPlaylist.segments.forEach((segment) => {
  65632. resolveSegmentUris$1(segment, mergedPlaylist.resolvedUri);
  65633. });
  65634. for (let i2 = 0; i2 < result.playlists.length; i2++) {
  65635. if (result.playlists[i2].id === newMedia.id) {
  65636. result.playlists[i2] = mergedPlaylist;
  65637. }
  65638. }
  65639. result.playlists[newMedia.id] = mergedPlaylist;
  65640. result.playlists[newMedia.uri] = mergedPlaylist;
  65641. forEachMediaGroup$2(main, (properties, mediaType, groupKey, labelKey) => {
  65642. if (!properties.playlists) {
  65643. return;
  65644. }
  65645. for (let i2 = 0; i2 < properties.playlists.length; i2++) {
  65646. if (newMedia.id === properties.playlists[i2].id) {
  65647. properties.playlists[i2] = mergedPlaylist;
  65648. }
  65649. }
  65650. });
  65651. return result;
  65652. };
  65653. const refreshDelay$1 = (media, update) => {
  65654. const segments = media.segments || [];
  65655. const lastSegment = segments[segments.length - 1];
  65656. const lastPart = lastSegment && lastSegment.parts && lastSegment.parts[lastSegment.parts.length - 1];
  65657. const lastDuration = lastPart && lastPart.duration || lastSegment && lastSegment.duration;
  65658. if (update && lastDuration) {
  65659. return lastDuration * 1e3;
  65660. }
  65661. return (media.partTargetDuration || media.targetDuration || 10) * 500;
  65662. };
  65663. class PlaylistLoader$1 extends EventTarget$1$1 {
  65664. constructor(src, vhs, options2 = {}) {
  65665. super();
  65666. if (!src) {
  65667. throw new Error("A non-empty playlist URL or object is required");
  65668. }
  65669. this.logger_ = logger$1("PlaylistLoader");
  65670. const {
  65671. withCredentials = false
  65672. } = options2;
  65673. this.src = src;
  65674. this.vhs_ = vhs;
  65675. this.withCredentials = withCredentials;
  65676. const vhsOptions = vhs.options_;
  65677. this.customTagParsers = vhsOptions && vhsOptions.customTagParsers || [];
  65678. this.customTagMappers = vhsOptions && vhsOptions.customTagMappers || [];
  65679. this.llhls = vhsOptions && vhsOptions.llhls;
  65680. this.state = "HAVE_NOTHING";
  65681. this.handleMediaupdatetimeout_ = this.handleMediaupdatetimeout_.bind(this);
  65682. this.on("mediaupdatetimeout", this.handleMediaupdatetimeout_);
  65683. }
  65684. handleMediaupdatetimeout_() {
  65685. if (this.state !== "HAVE_METADATA") {
  65686. return;
  65687. }
  65688. const media = this.media();
  65689. let uri = resolveUrl$2(this.main.uri, media.uri);
  65690. if (this.llhls) {
  65691. uri = addLLHLSQueryDirectives$1(uri, media);
  65692. }
  65693. this.state = "HAVE_CURRENT_METADATA";
  65694. this.request = this.vhs_.xhr({
  65695. uri,
  65696. withCredentials: this.withCredentials
  65697. }, (error, req) => {
  65698. if (!this.request) {
  65699. return;
  65700. }
  65701. if (error) {
  65702. return this.playlistRequestError(this.request, this.media(), "HAVE_METADATA");
  65703. }
  65704. this.haveMetadata({
  65705. playlistString: this.request.responseText,
  65706. url: this.media().uri,
  65707. id: this.media().id
  65708. });
  65709. });
  65710. }
  65711. playlistRequestError(xhr, playlist, startingState) {
  65712. const {
  65713. uri,
  65714. id
  65715. } = playlist;
  65716. this.request = null;
  65717. if (startingState) {
  65718. this.state = startingState;
  65719. }
  65720. this.error = {
  65721. playlist: this.main.playlists[id],
  65722. status: xhr.status,
  65723. message: `HLS playlist request error at URL: ${uri}.`,
  65724. responseText: xhr.responseText,
  65725. code: xhr.status >= 500 ? 4 : 2
  65726. };
  65727. this.trigger("error");
  65728. }
  65729. parseManifest_({
  65730. url,
  65731. manifestString
  65732. }) {
  65733. return parseManifest$1({
  65734. onwarn: ({
  65735. message
  65736. }) => this.logger_(`m3u8-parser warn for ${url}: ${message}`),
  65737. oninfo: ({
  65738. message
  65739. }) => this.logger_(`m3u8-parser info for ${url}: ${message}`),
  65740. manifestString,
  65741. customTagParsers: this.customTagParsers,
  65742. customTagMappers: this.customTagMappers,
  65743. llhls: this.llhls
  65744. });
  65745. }
  65746. haveMetadata({
  65747. playlistString,
  65748. playlistObject,
  65749. url,
  65750. id
  65751. }) {
  65752. this.request = null;
  65753. this.state = "HAVE_METADATA";
  65754. const playlist = playlistObject || this.parseManifest_({
  65755. url,
  65756. manifestString: playlistString
  65757. });
  65758. playlist.lastRequest = Date.now();
  65759. setupMediaPlaylist$1({
  65760. playlist,
  65761. uri: url,
  65762. id
  65763. });
  65764. const update = updateMain$1(this.main, playlist);
  65765. this.targetDuration = playlist.partTargetDuration || playlist.targetDuration;
  65766. this.pendingMedia_ = null;
  65767. if (update) {
  65768. this.main = update;
  65769. this.media_ = this.main.playlists[id];
  65770. } else {
  65771. this.trigger("playlistunchanged");
  65772. }
  65773. this.updateMediaUpdateTimeout_(refreshDelay$1(this.media(), !!update));
  65774. this.trigger("loadedplaylist");
  65775. }
  65776. dispose() {
  65777. this.trigger("dispose");
  65778. this.stopRequest();
  65779. window_1.clearTimeout(this.mediaUpdateTimeout);
  65780. window_1.clearTimeout(this.finalRenditionTimeout);
  65781. this.off();
  65782. }
  65783. stopRequest() {
  65784. if (this.request) {
  65785. const oldRequest = this.request;
  65786. this.request = null;
  65787. oldRequest.onreadystatechange = null;
  65788. oldRequest.abort();
  65789. }
  65790. }
  65791. media(playlist, shouldDelay) {
  65792. if (!playlist) {
  65793. return this.media_;
  65794. }
  65795. if (this.state === "HAVE_NOTHING") {
  65796. throw new Error("Cannot switch media playlist from " + this.state);
  65797. }
  65798. if (typeof playlist === "string") {
  65799. if (!this.main.playlists[playlist]) {
  65800. throw new Error("Unknown playlist URI: " + playlist);
  65801. }
  65802. playlist = this.main.playlists[playlist];
  65803. }
  65804. window_1.clearTimeout(this.finalRenditionTimeout);
  65805. if (shouldDelay) {
  65806. const delay = (playlist.partTargetDuration || playlist.targetDuration) / 2 * 1e3 || 5 * 1e3;
  65807. this.finalRenditionTimeout = window_1.setTimeout(this.media.bind(this, playlist, false), delay);
  65808. return;
  65809. }
  65810. const startingState = this.state;
  65811. const mediaChange = !this.media_ || playlist.id !== this.media_.id;
  65812. const mainPlaylistRef = this.main.playlists[playlist.id];
  65813. if (mainPlaylistRef && mainPlaylistRef.endList || playlist.endList && playlist.segments.length) {
  65814. if (this.request) {
  65815. this.request.onreadystatechange = null;
  65816. this.request.abort();
  65817. this.request = null;
  65818. }
  65819. this.state = "HAVE_METADATA";
  65820. this.media_ = playlist;
  65821. if (mediaChange) {
  65822. this.trigger("mediachanging");
  65823. if (startingState === "HAVE_MAIN_MANIFEST") {
  65824. this.trigger("loadedmetadata");
  65825. } else {
  65826. this.trigger("mediachange");
  65827. }
  65828. }
  65829. return;
  65830. }
  65831. this.updateMediaUpdateTimeout_(refreshDelay$1(playlist, true));
  65832. if (!mediaChange) {
  65833. return;
  65834. }
  65835. this.state = "SWITCHING_MEDIA";
  65836. if (this.request) {
  65837. if (playlist.resolvedUri === this.request.url) {
  65838. return;
  65839. }
  65840. this.request.onreadystatechange = null;
  65841. this.request.abort();
  65842. this.request = null;
  65843. }
  65844. if (this.media_) {
  65845. this.trigger("mediachanging");
  65846. }
  65847. this.pendingMedia_ = playlist;
  65848. this.request = this.vhs_.xhr({
  65849. uri: playlist.resolvedUri,
  65850. withCredentials: this.withCredentials
  65851. }, (error, req) => {
  65852. if (!this.request) {
  65853. return;
  65854. }
  65855. playlist.lastRequest = Date.now();
  65856. playlist.resolvedUri = resolveManifestRedirect$1(playlist.resolvedUri, req);
  65857. if (error) {
  65858. return this.playlistRequestError(this.request, playlist, startingState);
  65859. }
  65860. this.haveMetadata({
  65861. playlistString: req.responseText,
  65862. url: playlist.uri,
  65863. id: playlist.id
  65864. });
  65865. if (startingState === "HAVE_MAIN_MANIFEST") {
  65866. this.trigger("loadedmetadata");
  65867. } else {
  65868. this.trigger("mediachange");
  65869. }
  65870. });
  65871. }
  65872. pause() {
  65873. if (this.mediaUpdateTimeout) {
  65874. window_1.clearTimeout(this.mediaUpdateTimeout);
  65875. this.mediaUpdateTimeout = null;
  65876. }
  65877. this.stopRequest();
  65878. if (this.state === "HAVE_NOTHING") {
  65879. this.started = false;
  65880. }
  65881. if (this.state === "SWITCHING_MEDIA") {
  65882. if (this.media_) {
  65883. this.state = "HAVE_METADATA";
  65884. } else {
  65885. this.state = "HAVE_MAIN_MANIFEST";
  65886. }
  65887. } else if (this.state === "HAVE_CURRENT_METADATA") {
  65888. this.state = "HAVE_METADATA";
  65889. }
  65890. }
  65891. load(shouldDelay) {
  65892. if (this.mediaUpdateTimeout) {
  65893. window_1.clearTimeout(this.mediaUpdateTimeout);
  65894. this.mediaUpdateTimeout = null;
  65895. }
  65896. const media = this.media();
  65897. if (shouldDelay) {
  65898. const delay = media ? (media.partTargetDuration || media.targetDuration) / 2 * 1e3 : 5 * 1e3;
  65899. this.mediaUpdateTimeout = window_1.setTimeout(() => {
  65900. this.mediaUpdateTimeout = null;
  65901. this.load();
  65902. }, delay);
  65903. return;
  65904. }
  65905. if (!this.started) {
  65906. this.start();
  65907. return;
  65908. }
  65909. if (media && !media.endList) {
  65910. this.trigger("mediaupdatetimeout");
  65911. } else {
  65912. this.trigger("loadedplaylist");
  65913. }
  65914. }
  65915. updateMediaUpdateTimeout_(delay) {
  65916. if (this.mediaUpdateTimeout) {
  65917. window_1.clearTimeout(this.mediaUpdateTimeout);
  65918. this.mediaUpdateTimeout = null;
  65919. }
  65920. if (!this.media() || this.media().endList) {
  65921. return;
  65922. }
  65923. this.mediaUpdateTimeout = window_1.setTimeout(() => {
  65924. this.mediaUpdateTimeout = null;
  65925. this.trigger("mediaupdatetimeout");
  65926. this.updateMediaUpdateTimeout_(delay);
  65927. }, delay);
  65928. }
  65929. start() {
  65930. this.started = true;
  65931. if (typeof this.src === "object") {
  65932. if (!this.src.uri) {
  65933. this.src.uri = window_1.location.href;
  65934. }
  65935. this.src.resolvedUri = this.src.uri;
  65936. setTimeout(() => {
  65937. this.setupInitialPlaylist(this.src);
  65938. }, 0);
  65939. return;
  65940. }
  65941. this.request = this.vhs_.xhr({
  65942. uri: this.src,
  65943. withCredentials: this.withCredentials
  65944. }, (error, req) => {
  65945. if (!this.request) {
  65946. return;
  65947. }
  65948. this.request = null;
  65949. if (error) {
  65950. this.error = {
  65951. status: req.status,
  65952. message: `HLS playlist request error at URL: ${this.src}.`,
  65953. responseText: req.responseText,
  65954. code: 2
  65955. };
  65956. if (this.state === "HAVE_NOTHING") {
  65957. this.started = false;
  65958. }
  65959. return this.trigger("error");
  65960. }
  65961. this.src = resolveManifestRedirect$1(this.src, req);
  65962. const manifest = this.parseManifest_({
  65963. manifestString: req.responseText,
  65964. url: this.src
  65965. });
  65966. this.setupInitialPlaylist(manifest);
  65967. });
  65968. }
  65969. srcUri() {
  65970. return typeof this.src === "string" ? this.src : this.src.uri;
  65971. }
  65972. setupInitialPlaylist(manifest) {
  65973. this.state = "HAVE_MAIN_MANIFEST";
  65974. if (manifest.playlists) {
  65975. this.main = manifest;
  65976. addPropertiesToMain(this.main, this.srcUri());
  65977. manifest.playlists.forEach((playlist) => {
  65978. playlist.segments = getAllSegments$1(playlist);
  65979. playlist.segments.forEach((segment) => {
  65980. resolveSegmentUris$1(segment, playlist.resolvedUri);
  65981. });
  65982. });
  65983. this.trigger("loadedplaylist");
  65984. if (!this.request) {
  65985. this.media(this.main.playlists[0]);
  65986. }
  65987. return;
  65988. }
  65989. const uri = this.srcUri() || window_1.location.href;
  65990. this.main = mainForMedia(manifest, uri);
  65991. this.haveMetadata({
  65992. playlistObject: manifest,
  65993. url: uri,
  65994. id: this.main.playlists[0].id
  65995. });
  65996. this.trigger("loadedmetadata");
  65997. }
  65998. }
  65999. const {
  66000. xhr: videojsXHR$1
  66001. } = videojs$2;
  66002. const callbackWrapper$1 = function(request, error, response, callback2) {
  66003. const reqResponse = request.responseType === "arraybuffer" ? request.response : request.responseText;
  66004. if (!error && reqResponse) {
  66005. request.responseTime = Date.now();
  66006. request.roundTripTime = request.responseTime - request.requestTime;
  66007. request.bytesReceived = reqResponse.byteLength || reqResponse.length;
  66008. if (!request.bandwidth) {
  66009. request.bandwidth = Math.floor(request.bytesReceived / request.roundTripTime * 8 * 1e3);
  66010. }
  66011. }
  66012. if (response.headers) {
  66013. request.responseHeaders = response.headers;
  66014. }
  66015. if (error && error.code === "ETIMEDOUT") {
  66016. request.timedout = true;
  66017. }
  66018. if (!error && !request.aborted && response.statusCode !== 200 && response.statusCode !== 206 && response.statusCode !== 0) {
  66019. error = new Error("XHR Failed with a response of: " + (request && (reqResponse || request.responseText)));
  66020. }
  66021. callback2(error, request);
  66022. };
  66023. const xhrFactory$1 = function() {
  66024. const xhr = function XhrFunction(options2, callback2) {
  66025. options2 = merge$2({
  66026. timeout: 45e3
  66027. }, options2);
  66028. const beforeRequest = XhrFunction.beforeRequest || videojs$2.Vhs.xhr.beforeRequest;
  66029. if (beforeRequest && typeof beforeRequest === "function") {
  66030. const newOptions = beforeRequest(options2);
  66031. if (newOptions) {
  66032. options2 = newOptions;
  66033. }
  66034. }
  66035. const xhrMethod = videojs$2.Vhs.xhr.original === true ? videojsXHR$1 : videojs$2.Vhs.xhr;
  66036. const request = xhrMethod(options2, function(error, response) {
  66037. return callbackWrapper$1(request, error, response, callback2);
  66038. });
  66039. const originalAbort = request.abort;
  66040. request.abort = function() {
  66041. request.aborted = true;
  66042. return originalAbort.apply(request, arguments);
  66043. };
  66044. request.uri = options2.uri;
  66045. request.requestTime = Date.now();
  66046. return request;
  66047. };
  66048. xhr.original = true;
  66049. return xhr;
  66050. };
  66051. const byterangeStr$1 = function(byterange) {
  66052. let byterangeEnd;
  66053. const byterangeStart = byterange.offset;
  66054. if (typeof byterange.offset === "bigint" || typeof byterange.length === "bigint") {
  66055. byterangeEnd = window_1.BigInt(byterange.offset) + window_1.BigInt(byterange.length) - window_1.BigInt(1);
  66056. } else {
  66057. byterangeEnd = byterange.offset + byterange.length - 1;
  66058. }
  66059. return "bytes=" + byterangeStart + "-" + byterangeEnd;
  66060. };
  66061. const segmentXhrHeaders$1 = function(segment) {
  66062. const headers = {};
  66063. if (segment.byterange) {
  66064. headers.Range = byterangeStr$1(segment.byterange);
  66065. }
  66066. return headers;
  66067. };
  66068. const textRange$1 = function(range3, i2) {
  66069. return range3.start(i2) + "-" + range3.end(i2);
  66070. };
  66071. const formatHexString$1 = function(e, i2) {
  66072. const value = e.toString(16);
  66073. return "00".substring(0, 2 - value.length) + value + (i2 % 2 ? " " : "");
  66074. };
  66075. const formatAsciiString$1 = function(e) {
  66076. if (e >= 32 && e < 126) {
  66077. return String.fromCharCode(e);
  66078. }
  66079. return ".";
  66080. };
  66081. const createTransferableMessage$1 = function(message) {
  66082. const transferable = {};
  66083. Object.keys(message).forEach((key) => {
  66084. const value = message[key];
  66085. if (isArrayBufferView$1(value)) {
  66086. transferable[key] = {
  66087. bytes: value.buffer,
  66088. byteOffset: value.byteOffset,
  66089. byteLength: value.byteLength
  66090. };
  66091. } else {
  66092. transferable[key] = value;
  66093. }
  66094. });
  66095. return transferable;
  66096. };
  66097. const initSegmentId$1 = function(initSegment) {
  66098. const byterange = initSegment.byterange || {
  66099. length: Infinity,
  66100. offset: 0
  66101. };
  66102. return [byterange.length, byterange.offset, initSegment.resolvedUri].join(",");
  66103. };
  66104. const segmentKeyId$1 = function(key) {
  66105. return key.resolvedUri;
  66106. };
  66107. const hexDump$1 = (data) => {
  66108. const bytes = Array.prototype.slice.call(data);
  66109. const step = 16;
  66110. let result = "";
  66111. let hex;
  66112. let ascii;
  66113. for (let j = 0; j < bytes.length / step; j++) {
  66114. hex = bytes.slice(j * step, j * step + step).map(formatHexString$1).join("");
  66115. ascii = bytes.slice(j * step, j * step + step).map(formatAsciiString$1).join("");
  66116. result += hex + " " + ascii + "\n";
  66117. }
  66118. return result;
  66119. };
  66120. const tagDump$1 = ({
  66121. bytes
  66122. }) => hexDump$1(bytes);
  66123. const textRanges$1 = (ranges) => {
  66124. let result = "";
  66125. let i2;
  66126. for (i2 = 0; i2 < ranges.length; i2++) {
  66127. result += textRange$1(ranges, i2) + " ";
  66128. }
  66129. return result;
  66130. };
  66131. var utils$1 = /* @__PURE__ */ Object.freeze({
  66132. __proto__: null,
  66133. createTransferableMessage: createTransferableMessage$1,
  66134. initSegmentId: initSegmentId$1,
  66135. segmentKeyId: segmentKeyId$1,
  66136. hexDump: hexDump$1,
  66137. tagDump: tagDump$1,
  66138. textRanges: textRanges$1
  66139. });
  66140. const SEGMENT_END_FUDGE_PERCENT$1 = 0.25;
  66141. const playerTimeToProgramTime$1 = (playerTime, segment) => {
  66142. if (!segment.dateTimeObject) {
  66143. return null;
  66144. }
  66145. const transmuxerPrependedSeconds = segment.videoTimingInfo.transmuxerPrependedSeconds;
  66146. const transmuxedStart = segment.videoTimingInfo.transmuxedPresentationStart;
  66147. const startOfSegment = transmuxedStart + transmuxerPrependedSeconds;
  66148. const offsetFromSegmentStart = playerTime - startOfSegment;
  66149. return new Date(segment.dateTimeObject.getTime() + offsetFromSegmentStart * 1e3);
  66150. };
  66151. const originalSegmentVideoDuration$1 = (videoTimingInfo) => {
  66152. return videoTimingInfo.transmuxedPresentationEnd - videoTimingInfo.transmuxedPresentationStart - videoTimingInfo.transmuxerPrependedSeconds;
  66153. };
  66154. const findSegmentForProgramTime$1 = (programTime, playlist) => {
  66155. let dateTimeObject;
  66156. try {
  66157. dateTimeObject = new Date(programTime);
  66158. } catch (e) {
  66159. return null;
  66160. }
  66161. if (!playlist || !playlist.segments || playlist.segments.length === 0) {
  66162. return null;
  66163. }
  66164. let segment = playlist.segments[0];
  66165. if (dateTimeObject < segment.dateTimeObject) {
  66166. return null;
  66167. }
  66168. for (let i2 = 0; i2 < playlist.segments.length - 1; i2++) {
  66169. segment = playlist.segments[i2];
  66170. const nextSegmentStart = playlist.segments[i2 + 1].dateTimeObject;
  66171. if (dateTimeObject < nextSegmentStart) {
  66172. break;
  66173. }
  66174. }
  66175. const lastSegment = playlist.segments[playlist.segments.length - 1];
  66176. const lastSegmentStart = lastSegment.dateTimeObject;
  66177. const lastSegmentDuration = lastSegment.videoTimingInfo ? originalSegmentVideoDuration$1(lastSegment.videoTimingInfo) : lastSegment.duration + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT$1;
  66178. const lastSegmentEnd = new Date(lastSegmentStart.getTime() + lastSegmentDuration * 1e3);
  66179. if (dateTimeObject > lastSegmentEnd) {
  66180. return null;
  66181. }
  66182. if (dateTimeObject > lastSegmentStart) {
  66183. segment = lastSegment;
  66184. }
  66185. return {
  66186. segment,
  66187. estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : Playlist$1.duration(playlist, playlist.mediaSequence + playlist.segments.indexOf(segment)),
  66188. type: segment.videoTimingInfo ? "accurate" : "estimate"
  66189. };
  66190. };
  66191. const findSegmentForPlayerTime$1 = (time, playlist) => {
  66192. if (!playlist || !playlist.segments || playlist.segments.length === 0) {
  66193. return null;
  66194. }
  66195. let segmentEnd = 0;
  66196. let segment;
  66197. for (let i2 = 0; i2 < playlist.segments.length; i2++) {
  66198. segment = playlist.segments[i2];
  66199. segmentEnd = segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationEnd : segmentEnd + segment.duration;
  66200. if (time <= segmentEnd) {
  66201. break;
  66202. }
  66203. }
  66204. const lastSegment = playlist.segments[playlist.segments.length - 1];
  66205. if (lastSegment.videoTimingInfo && lastSegment.videoTimingInfo.transmuxedPresentationEnd < time) {
  66206. return null;
  66207. }
  66208. if (time > segmentEnd) {
  66209. if (time > segmentEnd + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT$1) {
  66210. return null;
  66211. }
  66212. segment = lastSegment;
  66213. }
  66214. return {
  66215. segment,
  66216. estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : segmentEnd - segment.duration,
  66217. type: segment.videoTimingInfo ? "accurate" : "estimate"
  66218. };
  66219. };
  66220. const getOffsetFromTimestamp$1 = (comparisonTimeStamp, programTime) => {
  66221. let segmentDateTime;
  66222. let programDateTime;
  66223. try {
  66224. segmentDateTime = new Date(comparisonTimeStamp);
  66225. programDateTime = new Date(programTime);
  66226. } catch (e) {
  66227. }
  66228. const segmentTimeEpoch = segmentDateTime.getTime();
  66229. const programTimeEpoch = programDateTime.getTime();
  66230. return (programTimeEpoch - segmentTimeEpoch) / 1e3;
  66231. };
  66232. const verifyProgramDateTimeTags$1 = (playlist) => {
  66233. if (!playlist.segments || playlist.segments.length === 0) {
  66234. return false;
  66235. }
  66236. for (let i2 = 0; i2 < playlist.segments.length; i2++) {
  66237. const segment = playlist.segments[i2];
  66238. if (!segment.dateTimeObject) {
  66239. return false;
  66240. }
  66241. }
  66242. return true;
  66243. };
  66244. const getProgramTime$1 = ({
  66245. playlist,
  66246. time = void 0,
  66247. callback: callback2
  66248. }) => {
  66249. if (!callback2) {
  66250. throw new Error("getProgramTime: callback must be provided");
  66251. }
  66252. if (!playlist || time === void 0) {
  66253. return callback2({
  66254. message: "getProgramTime: playlist and time must be provided"
  66255. });
  66256. }
  66257. const matchedSegment = findSegmentForPlayerTime$1(time, playlist);
  66258. if (!matchedSegment) {
  66259. return callback2({
  66260. message: "valid programTime was not found"
  66261. });
  66262. }
  66263. if (matchedSegment.type === "estimate") {
  66264. return callback2({
  66265. message: "Accurate programTime could not be determined. Please seek to e.seekTime and try again",
  66266. seekTime: matchedSegment.estimatedStart
  66267. });
  66268. }
  66269. const programTimeObject = {
  66270. mediaSeconds: time
  66271. };
  66272. const programTime = playerTimeToProgramTime$1(time, matchedSegment.segment);
  66273. if (programTime) {
  66274. programTimeObject.programDateTime = programTime.toISOString();
  66275. }
  66276. return callback2(null, programTimeObject);
  66277. };
  66278. const seekToProgramTime$1 = ({
  66279. programTime,
  66280. playlist,
  66281. retryCount = 2,
  66282. seekTo,
  66283. pauseAfterSeek = true,
  66284. tech,
  66285. callback: callback2
  66286. }) => {
  66287. if (!callback2) {
  66288. throw new Error("seekToProgramTime: callback must be provided");
  66289. }
  66290. if (typeof programTime === "undefined" || !playlist || !seekTo) {
  66291. return callback2({
  66292. message: "seekToProgramTime: programTime, seekTo and playlist must be provided"
  66293. });
  66294. }
  66295. if (!playlist.endList && !tech.hasStarted_) {
  66296. return callback2({
  66297. message: "player must be playing a live stream to start buffering"
  66298. });
  66299. }
  66300. if (!verifyProgramDateTimeTags$1(playlist)) {
  66301. return callback2({
  66302. message: "programDateTime tags must be provided in the manifest " + playlist.resolvedUri
  66303. });
  66304. }
  66305. const matchedSegment = findSegmentForProgramTime$1(programTime, playlist);
  66306. if (!matchedSegment) {
  66307. return callback2({
  66308. message: `${programTime} was not found in the stream`
  66309. });
  66310. }
  66311. const segment = matchedSegment.segment;
  66312. const mediaOffset = getOffsetFromTimestamp$1(segment.dateTimeObject, programTime);
  66313. if (matchedSegment.type === "estimate") {
  66314. if (retryCount === 0) {
  66315. return callback2({
  66316. message: `${programTime} is not buffered yet. Try again`
  66317. });
  66318. }
  66319. seekTo(matchedSegment.estimatedStart + mediaOffset);
  66320. tech.one("seeked", () => {
  66321. seekToProgramTime$1({
  66322. programTime,
  66323. playlist,
  66324. retryCount: retryCount - 1,
  66325. seekTo,
  66326. pauseAfterSeek,
  66327. tech,
  66328. callback: callback2
  66329. });
  66330. });
  66331. return;
  66332. }
  66333. const seekToTime = segment.start + mediaOffset;
  66334. const seekedCallback = () => {
  66335. return callback2(null, tech.currentTime());
  66336. };
  66337. tech.one("seeked", seekedCallback);
  66338. if (pauseAfterSeek) {
  66339. tech.pause();
  66340. }
  66341. seekTo(seekToTime);
  66342. };
  66343. const callbackOnCompleted$1 = (request, cb) => {
  66344. if (request.readyState === 4) {
  66345. return cb();
  66346. }
  66347. return;
  66348. };
  66349. const containerRequest$1 = (uri, xhr, cb) => {
  66350. let bytes = [];
  66351. let id3Offset;
  66352. let finished = false;
  66353. const endRequestAndCallback = function(err, req, type2, _bytes) {
  66354. req.abort();
  66355. finished = true;
  66356. return cb(err, req, type2, _bytes);
  66357. };
  66358. const progressListener = function(error, request2) {
  66359. if (finished) {
  66360. return;
  66361. }
  66362. if (error) {
  66363. return endRequestAndCallback(error, request2, "", bytes);
  66364. }
  66365. const newPart = request2.responseText.substring(bytes && bytes.byteLength || 0, request2.responseText.length);
  66366. bytes = concatTypedArrays$1(bytes, stringToBytes$1(newPart, true));
  66367. id3Offset = id3Offset || getId3Offset$1(bytes);
  66368. if (bytes.length < 10 || id3Offset && bytes.length < id3Offset + 2) {
  66369. return callbackOnCompleted$1(request2, () => endRequestAndCallback(error, request2, "", bytes));
  66370. }
  66371. const type2 = detectContainerForBytes$1(bytes);
  66372. if (type2 === "ts" && bytes.length < 188) {
  66373. return callbackOnCompleted$1(request2, () => endRequestAndCallback(error, request2, "", bytes));
  66374. }
  66375. if (!type2 && bytes.length < 376) {
  66376. return callbackOnCompleted$1(request2, () => endRequestAndCallback(error, request2, "", bytes));
  66377. }
  66378. return endRequestAndCallback(null, request2, type2, bytes);
  66379. };
  66380. const options2 = {
  66381. uri,
  66382. beforeSend(request2) {
  66383. request2.overrideMimeType("text/plain; charset=x-user-defined");
  66384. request2.addEventListener("progress", function({
  66385. total,
  66386. loaded
  66387. }) {
  66388. return callbackWrapper$1(request2, null, {
  66389. statusCode: request2.status
  66390. }, progressListener);
  66391. });
  66392. }
  66393. };
  66394. const request = xhr(options2, function(error, response) {
  66395. return callbackWrapper$1(request, error, response, progressListener);
  66396. });
  66397. return request;
  66398. };
  66399. const {
  66400. EventTarget: EventTarget$3
  66401. } = videojs$2;
  66402. const dashPlaylistUnchanged$1 = function(a, b) {
  66403. if (!isPlaylistUnchanged$1(a, b)) {
  66404. return false;
  66405. }
  66406. if (a.sidx && b.sidx && (a.sidx.offset !== b.sidx.offset || a.sidx.length !== b.sidx.length)) {
  66407. return false;
  66408. } else if (!a.sidx && b.sidx || a.sidx && !b.sidx) {
  66409. return false;
  66410. }
  66411. if (a.segments && !b.segments || !a.segments && b.segments) {
  66412. return false;
  66413. }
  66414. if (!a.segments && !b.segments) {
  66415. return true;
  66416. }
  66417. for (let i2 = 0; i2 < a.segments.length; i2++) {
  66418. const aSegment = a.segments[i2];
  66419. const bSegment = b.segments[i2];
  66420. if (aSegment.uri !== bSegment.uri) {
  66421. return false;
  66422. }
  66423. if (!aSegment.byterange && !bSegment.byterange) {
  66424. continue;
  66425. }
  66426. const aByterange = aSegment.byterange;
  66427. const bByterange = bSegment.byterange;
  66428. if (aByterange && !bByterange || !aByterange && bByterange) {
  66429. return false;
  66430. }
  66431. if (aByterange.offset !== bByterange.offset || aByterange.length !== bByterange.length) {
  66432. return false;
  66433. }
  66434. }
  66435. return true;
  66436. };
  66437. const dashGroupId$1 = (type2, group, label2, playlist) => {
  66438. const playlistId = playlist.attributes.NAME || label2;
  66439. return `placeholder-uri-${type2}-${group}-${playlistId}`;
  66440. };
  66441. const parseMainXml = ({
  66442. mainXml,
  66443. srcUrl,
  66444. clientOffset,
  66445. sidxMapping,
  66446. previousManifest
  66447. }) => {
  66448. const manifest = parse$1(mainXml, {
  66449. manifestUri: srcUrl,
  66450. clientOffset,
  66451. sidxMapping,
  66452. previousManifest
  66453. });
  66454. addPropertiesToMain(manifest, srcUrl, dashGroupId$1);
  66455. return manifest;
  66456. };
  66457. const removeOldMediaGroupLabels$1 = (update, newMain) => {
  66458. forEachMediaGroup$2(update, (properties, type2, group, label2) => {
  66459. if (!(label2 in newMain.mediaGroups[type2][group])) {
  66460. delete update.mediaGroups[type2][group][label2];
  66461. }
  66462. });
  66463. };
  66464. const updateMain = (oldMain, newMain, sidxMapping) => {
  66465. let noChanges = true;
  66466. let update = merge$2(oldMain, {
  66467. duration: newMain.duration,
  66468. minimumUpdatePeriod: newMain.minimumUpdatePeriod,
  66469. timelineStarts: newMain.timelineStarts
  66470. });
  66471. for (let i2 = 0; i2 < newMain.playlists.length; i2++) {
  66472. const playlist = newMain.playlists[i2];
  66473. if (playlist.sidx) {
  66474. const sidxKey = generateSidxKey$1(playlist.sidx);
  66475. if (sidxMapping && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx) {
  66476. addSidxSegmentsToPlaylist$1$1(playlist, sidxMapping[sidxKey].sidx, playlist.sidx.resolvedUri);
  66477. }
  66478. }
  66479. const playlistUpdate = updateMain$1(update, playlist, dashPlaylistUnchanged$1);
  66480. if (playlistUpdate) {
  66481. update = playlistUpdate;
  66482. noChanges = false;
  66483. }
  66484. }
  66485. forEachMediaGroup$2(newMain, (properties, type2, group, label2) => {
  66486. if (properties.playlists && properties.playlists.length) {
  66487. const id = properties.playlists[0].id;
  66488. const playlistUpdate = updateMain$1(update, properties.playlists[0], dashPlaylistUnchanged$1);
  66489. if (playlistUpdate) {
  66490. update = playlistUpdate;
  66491. if (!(label2 in update.mediaGroups[type2][group])) {
  66492. update.mediaGroups[type2][group][label2] = properties;
  66493. }
  66494. update.mediaGroups[type2][group][label2].playlists[0] = update.playlists[id];
  66495. noChanges = false;
  66496. }
  66497. }
  66498. });
  66499. removeOldMediaGroupLabels$1(update, newMain);
  66500. if (newMain.minimumUpdatePeriod !== oldMain.minimumUpdatePeriod) {
  66501. noChanges = false;
  66502. }
  66503. if (noChanges) {
  66504. return null;
  66505. }
  66506. return update;
  66507. };
  66508. const equivalentSidx$1 = (a, b) => {
  66509. const neitherMap = Boolean(!a.map && !b.map);
  66510. const equivalentMap = neitherMap || Boolean(a.map && b.map && a.map.byterange.offset === b.map.byterange.offset && a.map.byterange.length === b.map.byterange.length);
  66511. return equivalentMap && a.uri === b.uri && a.byterange.offset === b.byterange.offset && a.byterange.length === b.byterange.length;
  66512. };
  66513. const compareSidxEntry$1 = (playlists, oldSidxMapping) => {
  66514. const newSidxMapping = {};
  66515. for (const id in playlists) {
  66516. const playlist = playlists[id];
  66517. const currentSidxInfo = playlist.sidx;
  66518. if (currentSidxInfo) {
  66519. const key = generateSidxKey$1(currentSidxInfo);
  66520. if (!oldSidxMapping[key]) {
  66521. break;
  66522. }
  66523. const savedSidxInfo = oldSidxMapping[key].sidxInfo;
  66524. if (equivalentSidx$1(savedSidxInfo, currentSidxInfo)) {
  66525. newSidxMapping[key] = oldSidxMapping[key];
  66526. }
  66527. }
  66528. }
  66529. return newSidxMapping;
  66530. };
  66531. const filterChangedSidxMappings$1 = (main, oldSidxMapping) => {
  66532. const videoSidx = compareSidxEntry$1(main.playlists, oldSidxMapping);
  66533. let mediaGroupSidx = videoSidx;
  66534. forEachMediaGroup$2(main, (properties, mediaType, groupKey, labelKey) => {
  66535. if (properties.playlists && properties.playlists.length) {
  66536. const playlists = properties.playlists;
  66537. mediaGroupSidx = merge$2(mediaGroupSidx, compareSidxEntry$1(playlists, oldSidxMapping));
  66538. }
  66539. });
  66540. return mediaGroupSidx;
  66541. };
  66542. class DashPlaylistLoader$1 extends EventTarget$3 {
  66543. constructor(srcUrlOrPlaylist, vhs, options2 = {}, mainPlaylistLoader) {
  66544. super();
  66545. this.mainPlaylistLoader_ = mainPlaylistLoader || this;
  66546. if (!mainPlaylistLoader) {
  66547. this.isMain_ = true;
  66548. }
  66549. const {
  66550. withCredentials = false
  66551. } = options2;
  66552. this.vhs_ = vhs;
  66553. this.withCredentials = withCredentials;
  66554. if (!srcUrlOrPlaylist) {
  66555. throw new Error("A non-empty playlist URL or object is required");
  66556. }
  66557. this.on("minimumUpdatePeriod", () => {
  66558. this.refreshXml_();
  66559. });
  66560. this.on("mediaupdatetimeout", () => {
  66561. this.refreshMedia_(this.media().id);
  66562. });
  66563. this.state = "HAVE_NOTHING";
  66564. this.loadedPlaylists_ = {};
  66565. this.logger_ = logger$1("DashPlaylistLoader");
  66566. if (this.isMain_) {
  66567. this.mainPlaylistLoader_.srcUrl = srcUrlOrPlaylist;
  66568. this.mainPlaylistLoader_.sidxMapping_ = {};
  66569. } else {
  66570. this.childPlaylist_ = srcUrlOrPlaylist;
  66571. }
  66572. }
  66573. requestErrored_(err, request, startingState) {
  66574. if (!this.request) {
  66575. return true;
  66576. }
  66577. this.request = null;
  66578. if (err) {
  66579. this.error = typeof err === "object" && !(err instanceof Error) ? err : {
  66580. status: request.status,
  66581. message: "DASH request error at URL: " + request.uri,
  66582. response: request.response,
  66583. code: 2
  66584. };
  66585. if (startingState) {
  66586. this.state = startingState;
  66587. }
  66588. this.trigger("error");
  66589. return true;
  66590. }
  66591. }
  66592. addSidxSegments_(playlist, startingState, cb) {
  66593. const sidxKey = playlist.sidx && generateSidxKey$1(playlist.sidx);
  66594. if (!playlist.sidx || !sidxKey || this.mainPlaylistLoader_.sidxMapping_[sidxKey]) {
  66595. this.mediaRequest_ = window_1.setTimeout(() => cb(false), 0);
  66596. return;
  66597. }
  66598. const uri = resolveManifestRedirect$1(playlist.sidx.resolvedUri);
  66599. const fin = (err, request) => {
  66600. if (this.requestErrored_(err, request, startingState)) {
  66601. return;
  66602. }
  66603. const sidxMapping = this.mainPlaylistLoader_.sidxMapping_;
  66604. let sidx;
  66605. try {
  66606. sidx = parseSidx_1$1(toUint8$1(request.response).subarray(8));
  66607. } catch (e) {
  66608. this.requestErrored_(e, request, startingState);
  66609. return;
  66610. }
  66611. sidxMapping[sidxKey] = {
  66612. sidxInfo: playlist.sidx,
  66613. sidx
  66614. };
  66615. addSidxSegmentsToPlaylist$1$1(playlist, sidx, playlist.sidx.resolvedUri);
  66616. return cb(true);
  66617. };
  66618. this.request = containerRequest$1(uri, this.vhs_.xhr, (err, request, container, bytes) => {
  66619. if (err) {
  66620. return fin(err, request);
  66621. }
  66622. if (!container || container !== "mp4") {
  66623. return fin({
  66624. status: request.status,
  66625. message: `Unsupported ${container || "unknown"} container type for sidx segment at URL: ${uri}`,
  66626. response: "",
  66627. playlist,
  66628. internal: true,
  66629. playlistExclusionDuration: Infinity,
  66630. code: 2
  66631. }, request);
  66632. }
  66633. const {
  66634. offset,
  66635. length
  66636. } = playlist.sidx.byterange;
  66637. if (bytes.length >= length + offset) {
  66638. return fin(err, {
  66639. response: bytes.subarray(offset, offset + length),
  66640. status: request.status,
  66641. uri: request.uri
  66642. });
  66643. }
  66644. this.request = this.vhs_.xhr({
  66645. uri,
  66646. responseType: "arraybuffer",
  66647. headers: segmentXhrHeaders$1({
  66648. byterange: playlist.sidx.byterange
  66649. })
  66650. }, fin);
  66651. });
  66652. }
  66653. dispose() {
  66654. this.trigger("dispose");
  66655. this.stopRequest();
  66656. this.loadedPlaylists_ = {};
  66657. window_1.clearTimeout(this.minimumUpdatePeriodTimeout_);
  66658. window_1.clearTimeout(this.mediaRequest_);
  66659. window_1.clearTimeout(this.mediaUpdateTimeout);
  66660. this.mediaUpdateTimeout = null;
  66661. this.mediaRequest_ = null;
  66662. this.minimumUpdatePeriodTimeout_ = null;
  66663. if (this.mainPlaylistLoader_.createMupOnMedia_) {
  66664. this.off("loadedmetadata", this.mainPlaylistLoader_.createMupOnMedia_);
  66665. this.mainPlaylistLoader_.createMupOnMedia_ = null;
  66666. }
  66667. this.off();
  66668. }
  66669. hasPendingRequest() {
  66670. return this.request || this.mediaRequest_;
  66671. }
  66672. stopRequest() {
  66673. if (this.request) {
  66674. const oldRequest = this.request;
  66675. this.request = null;
  66676. oldRequest.onreadystatechange = null;
  66677. oldRequest.abort();
  66678. }
  66679. }
  66680. media(playlist) {
  66681. if (!playlist) {
  66682. return this.media_;
  66683. }
  66684. if (this.state === "HAVE_NOTHING") {
  66685. throw new Error("Cannot switch media playlist from " + this.state);
  66686. }
  66687. const startingState = this.state;
  66688. if (typeof playlist === "string") {
  66689. if (!this.mainPlaylistLoader_.main.playlists[playlist]) {
  66690. throw new Error("Unknown playlist URI: " + playlist);
  66691. }
  66692. playlist = this.mainPlaylistLoader_.main.playlists[playlist];
  66693. }
  66694. const mediaChange = !this.media_ || playlist.id !== this.media_.id;
  66695. if (mediaChange && this.loadedPlaylists_[playlist.id] && this.loadedPlaylists_[playlist.id].endList) {
  66696. this.state = "HAVE_METADATA";
  66697. this.media_ = playlist;
  66698. if (mediaChange) {
  66699. this.trigger("mediachanging");
  66700. this.trigger("mediachange");
  66701. }
  66702. return;
  66703. }
  66704. if (!mediaChange) {
  66705. return;
  66706. }
  66707. if (this.media_) {
  66708. this.trigger("mediachanging");
  66709. }
  66710. this.addSidxSegments_(playlist, startingState, (sidxChanged) => {
  66711. this.haveMetadata({
  66712. startingState,
  66713. playlist
  66714. });
  66715. });
  66716. }
  66717. haveMetadata({
  66718. startingState,
  66719. playlist
  66720. }) {
  66721. this.state = "HAVE_METADATA";
  66722. this.loadedPlaylists_[playlist.id] = playlist;
  66723. this.mediaRequest_ = null;
  66724. this.refreshMedia_(playlist.id);
  66725. if (startingState === "HAVE_MAIN_MANIFEST") {
  66726. this.trigger("loadedmetadata");
  66727. } else {
  66728. this.trigger("mediachange");
  66729. }
  66730. }
  66731. pause() {
  66732. if (this.mainPlaylistLoader_.createMupOnMedia_) {
  66733. this.off("loadedmetadata", this.mainPlaylistLoader_.createMupOnMedia_);
  66734. this.mainPlaylistLoader_.createMupOnMedia_ = null;
  66735. }
  66736. this.stopRequest();
  66737. window_1.clearTimeout(this.mediaUpdateTimeout);
  66738. this.mediaUpdateTimeout = null;
  66739. if (this.isMain_) {
  66740. window_1.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_);
  66741. this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_ = null;
  66742. }
  66743. if (this.state === "HAVE_NOTHING") {
  66744. this.started = false;
  66745. }
  66746. }
  66747. load(isFinalRendition) {
  66748. window_1.clearTimeout(this.mediaUpdateTimeout);
  66749. this.mediaUpdateTimeout = null;
  66750. const media = this.media();
  66751. if (isFinalRendition) {
  66752. const delay = media ? media.targetDuration / 2 * 1e3 : 5 * 1e3;
  66753. this.mediaUpdateTimeout = window_1.setTimeout(() => this.load(), delay);
  66754. return;
  66755. }
  66756. if (!this.started) {
  66757. this.start();
  66758. return;
  66759. }
  66760. if (media && !media.endList) {
  66761. if (this.isMain_ && !this.minimumUpdatePeriodTimeout_) {
  66762. this.trigger("minimumUpdatePeriod");
  66763. this.updateMinimumUpdatePeriodTimeout_();
  66764. }
  66765. this.trigger("mediaupdatetimeout");
  66766. } else {
  66767. this.trigger("loadedplaylist");
  66768. }
  66769. }
  66770. start() {
  66771. this.started = true;
  66772. if (!this.isMain_) {
  66773. this.mediaRequest_ = window_1.setTimeout(() => this.haveMain_(), 0);
  66774. return;
  66775. }
  66776. this.requestMain_((req, mainChanged) => {
  66777. this.haveMain_();
  66778. if (!this.hasPendingRequest() && !this.media_) {
  66779. this.media(this.mainPlaylistLoader_.main.playlists[0]);
  66780. }
  66781. });
  66782. }
  66783. requestMain_(cb) {
  66784. this.request = this.vhs_.xhr({
  66785. uri: this.mainPlaylistLoader_.srcUrl,
  66786. withCredentials: this.withCredentials
  66787. }, (error, req) => {
  66788. if (this.requestErrored_(error, req)) {
  66789. if (this.state === "HAVE_NOTHING") {
  66790. this.started = false;
  66791. }
  66792. return;
  66793. }
  66794. const mainChanged = req.responseText !== this.mainPlaylistLoader_.mainXml_;
  66795. this.mainPlaylistLoader_.mainXml_ = req.responseText;
  66796. if (req.responseHeaders && req.responseHeaders.date) {
  66797. this.mainLoaded_ = Date.parse(req.responseHeaders.date);
  66798. } else {
  66799. this.mainLoaded_ = Date.now();
  66800. }
  66801. this.mainPlaylistLoader_.srcUrl = resolveManifestRedirect$1(this.mainPlaylistLoader_.srcUrl, req);
  66802. if (mainChanged) {
  66803. this.handleMain_();
  66804. this.syncClientServerClock_(() => {
  66805. return cb(req, mainChanged);
  66806. });
  66807. return;
  66808. }
  66809. return cb(req, mainChanged);
  66810. });
  66811. }
  66812. syncClientServerClock_(done) {
  66813. const utcTiming = parseUTCTiming$1(this.mainPlaylistLoader_.mainXml_);
  66814. if (utcTiming === null) {
  66815. this.mainPlaylistLoader_.clientOffset_ = this.mainLoaded_ - Date.now();
  66816. return done();
  66817. }
  66818. if (utcTiming.method === "DIRECT") {
  66819. this.mainPlaylistLoader_.clientOffset_ = utcTiming.value - Date.now();
  66820. return done();
  66821. }
  66822. this.request = this.vhs_.xhr({
  66823. uri: resolveUrl$2(this.mainPlaylistLoader_.srcUrl, utcTiming.value),
  66824. method: utcTiming.method,
  66825. withCredentials: this.withCredentials
  66826. }, (error, req) => {
  66827. if (!this.request) {
  66828. return;
  66829. }
  66830. if (error) {
  66831. this.mainPlaylistLoader_.clientOffset_ = this.mainLoaded_ - Date.now();
  66832. return done();
  66833. }
  66834. let serverTime;
  66835. if (utcTiming.method === "HEAD") {
  66836. if (!req.responseHeaders || !req.responseHeaders.date) {
  66837. serverTime = this.mainLoaded_;
  66838. } else {
  66839. serverTime = Date.parse(req.responseHeaders.date);
  66840. }
  66841. } else {
  66842. serverTime = Date.parse(req.responseText);
  66843. }
  66844. this.mainPlaylistLoader_.clientOffset_ = serverTime - Date.now();
  66845. done();
  66846. });
  66847. }
  66848. haveMain_() {
  66849. this.state = "HAVE_MAIN_MANIFEST";
  66850. if (this.isMain_) {
  66851. this.trigger("loadedplaylist");
  66852. } else if (!this.media_) {
  66853. this.media(this.childPlaylist_);
  66854. }
  66855. }
  66856. handleMain_() {
  66857. this.mediaRequest_ = null;
  66858. const oldMain = this.mainPlaylistLoader_.main;
  66859. let newMain = parseMainXml({
  66860. mainXml: this.mainPlaylistLoader_.mainXml_,
  66861. srcUrl: this.mainPlaylistLoader_.srcUrl,
  66862. clientOffset: this.mainPlaylistLoader_.clientOffset_,
  66863. sidxMapping: this.mainPlaylistLoader_.sidxMapping_,
  66864. previousManifest: oldMain
  66865. });
  66866. if (oldMain) {
  66867. newMain = updateMain(oldMain, newMain, this.mainPlaylistLoader_.sidxMapping_);
  66868. }
  66869. this.mainPlaylistLoader_.main = newMain ? newMain : oldMain;
  66870. const location = this.mainPlaylistLoader_.main.locations && this.mainPlaylistLoader_.main.locations[0];
  66871. if (location && location !== this.mainPlaylistLoader_.srcUrl) {
  66872. this.mainPlaylistLoader_.srcUrl = location;
  66873. }
  66874. if (!oldMain || newMain && newMain.minimumUpdatePeriod !== oldMain.minimumUpdatePeriod) {
  66875. this.updateMinimumUpdatePeriodTimeout_();
  66876. }
  66877. return Boolean(newMain);
  66878. }
  66879. updateMinimumUpdatePeriodTimeout_() {
  66880. const mpl = this.mainPlaylistLoader_;
  66881. if (mpl.createMupOnMedia_) {
  66882. mpl.off("loadedmetadata", mpl.createMupOnMedia_);
  66883. mpl.createMupOnMedia_ = null;
  66884. }
  66885. if (mpl.minimumUpdatePeriodTimeout_) {
  66886. window_1.clearTimeout(mpl.minimumUpdatePeriodTimeout_);
  66887. mpl.minimumUpdatePeriodTimeout_ = null;
  66888. }
  66889. let mup = mpl.main && mpl.main.minimumUpdatePeriod;
  66890. if (mup === 0) {
  66891. if (mpl.media()) {
  66892. mup = mpl.media().targetDuration * 1e3;
  66893. } else {
  66894. mpl.createMupOnMedia_ = mpl.updateMinimumUpdatePeriodTimeout_;
  66895. mpl.one("loadedmetadata", mpl.createMupOnMedia_);
  66896. }
  66897. }
  66898. if (typeof mup !== "number" || mup <= 0) {
  66899. if (mup < 0) {
  66900. this.logger_(`found invalid minimumUpdatePeriod of ${mup}, not setting a timeout`);
  66901. }
  66902. return;
  66903. }
  66904. this.createMUPTimeout_(mup);
  66905. }
  66906. createMUPTimeout_(mup) {
  66907. const mpl = this.mainPlaylistLoader_;
  66908. mpl.minimumUpdatePeriodTimeout_ = window_1.setTimeout(() => {
  66909. mpl.minimumUpdatePeriodTimeout_ = null;
  66910. mpl.trigger("minimumUpdatePeriod");
  66911. mpl.createMUPTimeout_(mup);
  66912. }, mup);
  66913. }
  66914. refreshXml_() {
  66915. this.requestMain_((req, mainChanged) => {
  66916. if (!mainChanged) {
  66917. return;
  66918. }
  66919. if (this.media_) {
  66920. this.media_ = this.mainPlaylistLoader_.main.playlists[this.media_.id];
  66921. }
  66922. this.mainPlaylistLoader_.sidxMapping_ = filterChangedSidxMappings$1(this.mainPlaylistLoader_.main, this.mainPlaylistLoader_.sidxMapping_);
  66923. this.addSidxSegments_(this.media(), this.state, (sidxChanged) => {
  66924. this.refreshMedia_(this.media().id);
  66925. });
  66926. });
  66927. }
  66928. refreshMedia_(mediaID) {
  66929. if (!mediaID) {
  66930. throw new Error("refreshMedia_ must take a media id");
  66931. }
  66932. if (this.media_ && this.isMain_) {
  66933. this.handleMain_();
  66934. }
  66935. const playlists = this.mainPlaylistLoader_.main.playlists;
  66936. const mediaChanged = !this.media_ || this.media_ !== playlists[mediaID];
  66937. if (mediaChanged) {
  66938. this.media_ = playlists[mediaID];
  66939. } else {
  66940. this.trigger("playlistunchanged");
  66941. }
  66942. if (!this.mediaUpdateTimeout) {
  66943. const createMediaUpdateTimeout = () => {
  66944. if (this.media().endList) {
  66945. return;
  66946. }
  66947. this.mediaUpdateTimeout = window_1.setTimeout(() => {
  66948. this.trigger("mediaupdatetimeout");
  66949. createMediaUpdateTimeout();
  66950. }, refreshDelay$1(this.media(), Boolean(mediaChanged)));
  66951. };
  66952. createMediaUpdateTimeout();
  66953. }
  66954. this.trigger("loadedplaylist");
  66955. }
  66956. }
  66957. var Config$1 = {
  66958. GOAL_BUFFER_LENGTH: 30,
  66959. MAX_GOAL_BUFFER_LENGTH: 60,
  66960. BACK_BUFFER_LENGTH: 30,
  66961. GOAL_BUFFER_LENGTH_RATE: 1,
  66962. INITIAL_BANDWIDTH: 4194304,
  66963. BANDWIDTH_VARIANCE: 1.2,
  66964. BUFFER_LOW_WATER_LINE: 0,
  66965. MAX_BUFFER_LOW_WATER_LINE: 30,
  66966. EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE: 16,
  66967. BUFFER_LOW_WATER_LINE_RATE: 1,
  66968. BUFFER_HIGH_WATER_LINE: 30
  66969. };
  66970. const stringToArrayBuffer$1 = (string) => {
  66971. const view = new Uint8Array(new ArrayBuffer(string.length));
  66972. for (let i2 = 0; i2 < string.length; i2++) {
  66973. view[i2] = string.charCodeAt(i2);
  66974. }
  66975. return view.buffer;
  66976. };
  66977. const browserWorkerPolyFill$1 = function(workerObj) {
  66978. workerObj.on = workerObj.addEventListener;
  66979. workerObj.off = workerObj.removeEventListener;
  66980. return workerObj;
  66981. };
  66982. const createObjectURL$1 = function(str) {
  66983. try {
  66984. return URL.createObjectURL(new Blob([str], {
  66985. type: "application/javascript"
  66986. }));
  66987. } catch (e) {
  66988. const blob = new BlobBuilder();
  66989. blob.append(str);
  66990. return URL.createObjectURL(blob.getBlob());
  66991. }
  66992. };
  66993. const factory$1 = function(code) {
  66994. return function() {
  66995. const objectUrl = createObjectURL$1(code);
  66996. const worker = browserWorkerPolyFill$1(new Worker(objectUrl));
  66997. worker.objURL = objectUrl;
  66998. const terminate = worker.terminate;
  66999. worker.on = worker.addEventListener;
  67000. worker.off = worker.removeEventListener;
  67001. worker.terminate = function() {
  67002. URL.revokeObjectURL(objectUrl);
  67003. return terminate.call(this);
  67004. };
  67005. return worker;
  67006. };
  67007. };
  67008. const transform$1 = function(code) {
  67009. return `var browserWorkerPolyFill = ${browserWorkerPolyFill$1.toString()};
  67010. browserWorkerPolyFill(self);
  67011. ` + code;
  67012. };
  67013. const getWorkerString$1 = function(fn2) {
  67014. return fn2.toString().replace(/^function.+?{/, "").slice(0, -1);
  67015. };
  67016. const workerCode$1$1 = transform$1(getWorkerString$1(function() {
  67017. var commonjsGlobal2 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  67018. var Stream$8 = function() {
  67019. this.init = function() {
  67020. var listeners = {};
  67021. this.on = function(type3, listener) {
  67022. if (!listeners[type3]) {
  67023. listeners[type3] = [];
  67024. }
  67025. listeners[type3] = listeners[type3].concat(listener);
  67026. };
  67027. this.off = function(type3, listener) {
  67028. var index2;
  67029. if (!listeners[type3]) {
  67030. return false;
  67031. }
  67032. index2 = listeners[type3].indexOf(listener);
  67033. listeners[type3] = listeners[type3].slice();
  67034. listeners[type3].splice(index2, 1);
  67035. return index2 > -1;
  67036. };
  67037. this.trigger = function(type3) {
  67038. var callbacks, i2, length, args;
  67039. callbacks = listeners[type3];
  67040. if (!callbacks) {
  67041. return;
  67042. }
  67043. if (arguments.length === 2) {
  67044. length = callbacks.length;
  67045. for (i2 = 0; i2 < length; ++i2) {
  67046. callbacks[i2].call(this, arguments[1]);
  67047. }
  67048. } else {
  67049. args = [];
  67050. i2 = arguments.length;
  67051. for (i2 = 1; i2 < arguments.length; ++i2) {
  67052. args.push(arguments[i2]);
  67053. }
  67054. length = callbacks.length;
  67055. for (i2 = 0; i2 < length; ++i2) {
  67056. callbacks[i2].apply(this, args);
  67057. }
  67058. }
  67059. };
  67060. this.dispose = function() {
  67061. listeners = {};
  67062. };
  67063. };
  67064. };
  67065. Stream$8.prototype.pipe = function(destination2) {
  67066. this.on("data", function(data) {
  67067. destination2.push(data);
  67068. });
  67069. this.on("done", function(flushSource) {
  67070. destination2.flush(flushSource);
  67071. });
  67072. this.on("partialdone", function(flushSource) {
  67073. destination2.partialFlush(flushSource);
  67074. });
  67075. this.on("endedtimeline", function(flushSource) {
  67076. destination2.endTimeline(flushSource);
  67077. });
  67078. this.on("reset", function(flushSource) {
  67079. destination2.reset(flushSource);
  67080. });
  67081. return destination2;
  67082. };
  67083. Stream$8.prototype.push = function(data) {
  67084. this.trigger("data", data);
  67085. };
  67086. Stream$8.prototype.flush = function(flushSource) {
  67087. this.trigger("done", flushSource);
  67088. };
  67089. Stream$8.prototype.partialFlush = function(flushSource) {
  67090. this.trigger("partialdone", flushSource);
  67091. };
  67092. Stream$8.prototype.endTimeline = function(flushSource) {
  67093. this.trigger("endedtimeline", flushSource);
  67094. };
  67095. Stream$8.prototype.reset = function(flushSource) {
  67096. this.trigger("reset", flushSource);
  67097. };
  67098. var stream = Stream$8;
  67099. var MAX_UINT32$12 = Math.pow(2, 32);
  67100. var getUint64$32 = function(uint8) {
  67101. var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength);
  67102. var value;
  67103. if (dv.getBigUint64) {
  67104. value = dv.getBigUint64(0);
  67105. if (value < Number.MAX_SAFE_INTEGER) {
  67106. return Number(value);
  67107. }
  67108. return value;
  67109. }
  67110. return dv.getUint32(0) * MAX_UINT32$12 + dv.getUint32(4);
  67111. };
  67112. var numbers2 = {
  67113. getUint64: getUint64$32,
  67114. MAX_UINT32: MAX_UINT32$12
  67115. };
  67116. var MAX_UINT322 = numbers2.MAX_UINT32;
  67117. var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun$1, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS;
  67118. (function() {
  67119. var i2;
  67120. types = {
  67121. avc1: [],
  67122. avcC: [],
  67123. btrt: [],
  67124. dinf: [],
  67125. dref: [],
  67126. esds: [],
  67127. ftyp: [],
  67128. hdlr: [],
  67129. mdat: [],
  67130. mdhd: [],
  67131. mdia: [],
  67132. mfhd: [],
  67133. minf: [],
  67134. moof: [],
  67135. moov: [],
  67136. mp4a: [],
  67137. mvex: [],
  67138. mvhd: [],
  67139. pasp: [],
  67140. sdtp: [],
  67141. smhd: [],
  67142. stbl: [],
  67143. stco: [],
  67144. stsc: [],
  67145. stsd: [],
  67146. stsz: [],
  67147. stts: [],
  67148. styp: [],
  67149. tfdt: [],
  67150. tfhd: [],
  67151. traf: [],
  67152. trak: [],
  67153. trun: [],
  67154. trex: [],
  67155. tkhd: [],
  67156. vmhd: []
  67157. };
  67158. if (typeof Uint8Array === "undefined") {
  67159. return;
  67160. }
  67161. for (i2 in types) {
  67162. if (types.hasOwnProperty(i2)) {
  67163. types[i2] = [i2.charCodeAt(0), i2.charCodeAt(1), i2.charCodeAt(2), i2.charCodeAt(3)];
  67164. }
  67165. }
  67166. MAJOR_BRAND = new Uint8Array(["i".charCodeAt(0), "s".charCodeAt(0), "o".charCodeAt(0), "m".charCodeAt(0)]);
  67167. AVC1_BRAND = new Uint8Array(["a".charCodeAt(0), "v".charCodeAt(0), "c".charCodeAt(0), "1".charCodeAt(0)]);
  67168. MINOR_VERSION = new Uint8Array([0, 0, 0, 1]);
  67169. VIDEO_HDLR = new Uint8Array([
  67170. 0,
  67171. 0,
  67172. 0,
  67173. 0,
  67174. 0,
  67175. 0,
  67176. 0,
  67177. 0,
  67178. 118,
  67179. 105,
  67180. 100,
  67181. 101,
  67182. 0,
  67183. 0,
  67184. 0,
  67185. 0,
  67186. 0,
  67187. 0,
  67188. 0,
  67189. 0,
  67190. 0,
  67191. 0,
  67192. 0,
  67193. 0,
  67194. 86,
  67195. 105,
  67196. 100,
  67197. 101,
  67198. 111,
  67199. 72,
  67200. 97,
  67201. 110,
  67202. 100,
  67203. 108,
  67204. 101,
  67205. 114,
  67206. 0
  67207. ]);
  67208. AUDIO_HDLR = new Uint8Array([
  67209. 0,
  67210. 0,
  67211. 0,
  67212. 0,
  67213. 0,
  67214. 0,
  67215. 0,
  67216. 0,
  67217. 115,
  67218. 111,
  67219. 117,
  67220. 110,
  67221. 0,
  67222. 0,
  67223. 0,
  67224. 0,
  67225. 0,
  67226. 0,
  67227. 0,
  67228. 0,
  67229. 0,
  67230. 0,
  67231. 0,
  67232. 0,
  67233. 83,
  67234. 111,
  67235. 117,
  67236. 110,
  67237. 100,
  67238. 72,
  67239. 97,
  67240. 110,
  67241. 100,
  67242. 108,
  67243. 101,
  67244. 114,
  67245. 0
  67246. ]);
  67247. HDLR_TYPES = {
  67248. video: VIDEO_HDLR,
  67249. audio: AUDIO_HDLR
  67250. };
  67251. DREF = new Uint8Array([
  67252. 0,
  67253. 0,
  67254. 0,
  67255. 0,
  67256. 0,
  67257. 0,
  67258. 0,
  67259. 1,
  67260. 0,
  67261. 0,
  67262. 0,
  67263. 12,
  67264. 117,
  67265. 114,
  67266. 108,
  67267. 32,
  67268. 0,
  67269. 0,
  67270. 0,
  67271. 1
  67272. ]);
  67273. SMHD = new Uint8Array([
  67274. 0,
  67275. 0,
  67276. 0,
  67277. 0,
  67278. 0,
  67279. 0,
  67280. 0,
  67281. 0
  67282. ]);
  67283. STCO = new Uint8Array([
  67284. 0,
  67285. 0,
  67286. 0,
  67287. 0,
  67288. 0,
  67289. 0,
  67290. 0,
  67291. 0
  67292. ]);
  67293. STSC = STCO;
  67294. STSZ = new Uint8Array([
  67295. 0,
  67296. 0,
  67297. 0,
  67298. 0,
  67299. 0,
  67300. 0,
  67301. 0,
  67302. 0,
  67303. 0,
  67304. 0,
  67305. 0,
  67306. 0
  67307. ]);
  67308. STTS = STCO;
  67309. VMHD = new Uint8Array([
  67310. 0,
  67311. 0,
  67312. 0,
  67313. 1,
  67314. 0,
  67315. 0,
  67316. 0,
  67317. 0,
  67318. 0,
  67319. 0,
  67320. 0,
  67321. 0
  67322. ]);
  67323. })();
  67324. box = function(type3) {
  67325. var payload = [], size = 0, i2, result, view;
  67326. for (i2 = 1; i2 < arguments.length; i2++) {
  67327. payload.push(arguments[i2]);
  67328. }
  67329. i2 = payload.length;
  67330. while (i2--) {
  67331. size += payload[i2].byteLength;
  67332. }
  67333. result = new Uint8Array(size + 8);
  67334. view = new DataView(result.buffer, result.byteOffset, result.byteLength);
  67335. view.setUint32(0, result.byteLength);
  67336. result.set(type3, 4);
  67337. for (i2 = 0, size = 8; i2 < payload.length; i2++) {
  67338. result.set(payload[i2], size);
  67339. size += payload[i2].byteLength;
  67340. }
  67341. return result;
  67342. };
  67343. dinf = function() {
  67344. return box(types.dinf, box(types.dref, DREF));
  67345. };
  67346. esds = function(track) {
  67347. return box(types.esds, new Uint8Array([
  67348. 0,
  67349. 0,
  67350. 0,
  67351. 0,
  67352. 3,
  67353. 25,
  67354. 0,
  67355. 0,
  67356. 0,
  67357. 4,
  67358. 17,
  67359. 64,
  67360. 21,
  67361. 0,
  67362. 6,
  67363. 0,
  67364. 0,
  67365. 0,
  67366. 218,
  67367. 192,
  67368. 0,
  67369. 0,
  67370. 218,
  67371. 192,
  67372. 5,
  67373. 2,
  67374. track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1,
  67375. track.samplingfrequencyindex << 7 | track.channelcount << 3,
  67376. 6,
  67377. 1,
  67378. 2
  67379. ]));
  67380. };
  67381. ftyp = function() {
  67382. return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND);
  67383. };
  67384. hdlr = function(type3) {
  67385. return box(types.hdlr, HDLR_TYPES[type3]);
  67386. };
  67387. mdat = function(data) {
  67388. return box(types.mdat, data);
  67389. };
  67390. mdhd = function(track) {
  67391. var result = new Uint8Array([
  67392. 0,
  67393. 0,
  67394. 0,
  67395. 0,
  67396. 0,
  67397. 0,
  67398. 0,
  67399. 2,
  67400. 0,
  67401. 0,
  67402. 0,
  67403. 3,
  67404. 0,
  67405. 1,
  67406. 95,
  67407. 144,
  67408. track.duration >>> 24 & 255,
  67409. track.duration >>> 16 & 255,
  67410. track.duration >>> 8 & 255,
  67411. track.duration & 255,
  67412. 85,
  67413. 196,
  67414. 0,
  67415. 0
  67416. ]);
  67417. if (track.samplerate) {
  67418. result[12] = track.samplerate >>> 24 & 255;
  67419. result[13] = track.samplerate >>> 16 & 255;
  67420. result[14] = track.samplerate >>> 8 & 255;
  67421. result[15] = track.samplerate & 255;
  67422. }
  67423. return box(types.mdhd, result);
  67424. };
  67425. mdia = function(track) {
  67426. return box(types.mdia, mdhd(track), hdlr(track.type), minf(track));
  67427. };
  67428. mfhd = function(sequenceNumber) {
  67429. return box(types.mfhd, new Uint8Array([
  67430. 0,
  67431. 0,
  67432. 0,
  67433. 0,
  67434. (sequenceNumber & 4278190080) >> 24,
  67435. (sequenceNumber & 16711680) >> 16,
  67436. (sequenceNumber & 65280) >> 8,
  67437. sequenceNumber & 255
  67438. ]));
  67439. };
  67440. minf = function(track) {
  67441. return box(types.minf, track.type === "video" ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track));
  67442. };
  67443. moof = function(sequenceNumber, tracks) {
  67444. var trackFragments = [], i2 = tracks.length;
  67445. while (i2--) {
  67446. trackFragments[i2] = traf(tracks[i2]);
  67447. }
  67448. return box.apply(null, [types.moof, mfhd(sequenceNumber)].concat(trackFragments));
  67449. };
  67450. moov = function(tracks) {
  67451. var i2 = tracks.length, boxes = [];
  67452. while (i2--) {
  67453. boxes[i2] = trak(tracks[i2]);
  67454. }
  67455. return box.apply(null, [types.moov, mvhd(4294967295)].concat(boxes).concat(mvex(tracks)));
  67456. };
  67457. mvex = function(tracks) {
  67458. var i2 = tracks.length, boxes = [];
  67459. while (i2--) {
  67460. boxes[i2] = trex(tracks[i2]);
  67461. }
  67462. return box.apply(null, [types.mvex].concat(boxes));
  67463. };
  67464. mvhd = function(duration5) {
  67465. var bytes = new Uint8Array([
  67466. 0,
  67467. 0,
  67468. 0,
  67469. 0,
  67470. 0,
  67471. 0,
  67472. 0,
  67473. 1,
  67474. 0,
  67475. 0,
  67476. 0,
  67477. 2,
  67478. 0,
  67479. 1,
  67480. 95,
  67481. 144,
  67482. (duration5 & 4278190080) >> 24,
  67483. (duration5 & 16711680) >> 16,
  67484. (duration5 & 65280) >> 8,
  67485. duration5 & 255,
  67486. 0,
  67487. 1,
  67488. 0,
  67489. 0,
  67490. 1,
  67491. 0,
  67492. 0,
  67493. 0,
  67494. 0,
  67495. 0,
  67496. 0,
  67497. 0,
  67498. 0,
  67499. 0,
  67500. 0,
  67501. 0,
  67502. 0,
  67503. 1,
  67504. 0,
  67505. 0,
  67506. 0,
  67507. 0,
  67508. 0,
  67509. 0,
  67510. 0,
  67511. 0,
  67512. 0,
  67513. 0,
  67514. 0,
  67515. 0,
  67516. 0,
  67517. 0,
  67518. 0,
  67519. 1,
  67520. 0,
  67521. 0,
  67522. 0,
  67523. 0,
  67524. 0,
  67525. 0,
  67526. 0,
  67527. 0,
  67528. 0,
  67529. 0,
  67530. 0,
  67531. 0,
  67532. 0,
  67533. 0,
  67534. 64,
  67535. 0,
  67536. 0,
  67537. 0,
  67538. 0,
  67539. 0,
  67540. 0,
  67541. 0,
  67542. 0,
  67543. 0,
  67544. 0,
  67545. 0,
  67546. 0,
  67547. 0,
  67548. 0,
  67549. 0,
  67550. 0,
  67551. 0,
  67552. 0,
  67553. 0,
  67554. 0,
  67555. 0,
  67556. 0,
  67557. 0,
  67558. 0,
  67559. 0,
  67560. 0,
  67561. 0,
  67562. 255,
  67563. 255,
  67564. 255,
  67565. 255
  67566. ]);
  67567. return box(types.mvhd, bytes);
  67568. };
  67569. sdtp = function(track) {
  67570. var samples = track.samples || [], bytes = new Uint8Array(4 + samples.length), flags, i2;
  67571. for (i2 = 0; i2 < samples.length; i2++) {
  67572. flags = samples[i2].flags;
  67573. bytes[i2 + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy;
  67574. }
  67575. return box(types.sdtp, bytes);
  67576. };
  67577. stbl = function(track) {
  67578. return box(types.stbl, stsd(track), box(types.stts, STTS), box(types.stsc, STSC), box(types.stsz, STSZ), box(types.stco, STCO));
  67579. };
  67580. (function() {
  67581. var videoSample, audioSample;
  67582. stsd = function(track) {
  67583. return box(types.stsd, new Uint8Array([
  67584. 0,
  67585. 0,
  67586. 0,
  67587. 0,
  67588. 0,
  67589. 0,
  67590. 0,
  67591. 1
  67592. ]), track.type === "video" ? videoSample(track) : audioSample(track));
  67593. };
  67594. videoSample = function(track) {
  67595. var sps = track.sps || [], pps = track.pps || [], sequenceParameterSets = [], pictureParameterSets = [], i2, avc1Box;
  67596. for (i2 = 0; i2 < sps.length; i2++) {
  67597. sequenceParameterSets.push((sps[i2].byteLength & 65280) >>> 8);
  67598. sequenceParameterSets.push(sps[i2].byteLength & 255);
  67599. sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i2]));
  67600. }
  67601. for (i2 = 0; i2 < pps.length; i2++) {
  67602. pictureParameterSets.push((pps[i2].byteLength & 65280) >>> 8);
  67603. pictureParameterSets.push(pps[i2].byteLength & 255);
  67604. pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i2]));
  67605. }
  67606. avc1Box = [types.avc1, new Uint8Array([
  67607. 0,
  67608. 0,
  67609. 0,
  67610. 0,
  67611. 0,
  67612. 0,
  67613. 0,
  67614. 1,
  67615. 0,
  67616. 0,
  67617. 0,
  67618. 0,
  67619. 0,
  67620. 0,
  67621. 0,
  67622. 0,
  67623. 0,
  67624. 0,
  67625. 0,
  67626. 0,
  67627. 0,
  67628. 0,
  67629. 0,
  67630. 0,
  67631. (track.width & 65280) >> 8,
  67632. track.width & 255,
  67633. (track.height & 65280) >> 8,
  67634. track.height & 255,
  67635. 0,
  67636. 72,
  67637. 0,
  67638. 0,
  67639. 0,
  67640. 72,
  67641. 0,
  67642. 0,
  67643. 0,
  67644. 0,
  67645. 0,
  67646. 0,
  67647. 0,
  67648. 1,
  67649. 19,
  67650. 118,
  67651. 105,
  67652. 100,
  67653. 101,
  67654. 111,
  67655. 106,
  67656. 115,
  67657. 45,
  67658. 99,
  67659. 111,
  67660. 110,
  67661. 116,
  67662. 114,
  67663. 105,
  67664. 98,
  67665. 45,
  67666. 104,
  67667. 108,
  67668. 115,
  67669. 0,
  67670. 0,
  67671. 0,
  67672. 0,
  67673. 0,
  67674. 0,
  67675. 0,
  67676. 0,
  67677. 0,
  67678. 0,
  67679. 0,
  67680. 0,
  67681. 0,
  67682. 24,
  67683. 17,
  67684. 17
  67685. ]), box(types.avcC, new Uint8Array([
  67686. 1,
  67687. track.profileIdc,
  67688. track.profileCompatibility,
  67689. track.levelIdc,
  67690. 255
  67691. ].concat(
  67692. [sps.length],
  67693. sequenceParameterSets,
  67694. [pps.length],
  67695. pictureParameterSets
  67696. ))), box(types.btrt, new Uint8Array([
  67697. 0,
  67698. 28,
  67699. 156,
  67700. 128,
  67701. 0,
  67702. 45,
  67703. 198,
  67704. 192,
  67705. 0,
  67706. 45,
  67707. 198,
  67708. 192
  67709. ]))];
  67710. if (track.sarRatio) {
  67711. var hSpacing = track.sarRatio[0], vSpacing = track.sarRatio[1];
  67712. avc1Box.push(box(types.pasp, new Uint8Array([(hSpacing & 4278190080) >> 24, (hSpacing & 16711680) >> 16, (hSpacing & 65280) >> 8, hSpacing & 255, (vSpacing & 4278190080) >> 24, (vSpacing & 16711680) >> 16, (vSpacing & 65280) >> 8, vSpacing & 255])));
  67713. }
  67714. return box.apply(null, avc1Box);
  67715. };
  67716. audioSample = function(track) {
  67717. return box(types.mp4a, new Uint8Array([
  67718. 0,
  67719. 0,
  67720. 0,
  67721. 0,
  67722. 0,
  67723. 0,
  67724. 0,
  67725. 1,
  67726. 0,
  67727. 0,
  67728. 0,
  67729. 0,
  67730. 0,
  67731. 0,
  67732. 0,
  67733. 0,
  67734. (track.channelcount & 65280) >> 8,
  67735. track.channelcount & 255,
  67736. (track.samplesize & 65280) >> 8,
  67737. track.samplesize & 255,
  67738. 0,
  67739. 0,
  67740. 0,
  67741. 0,
  67742. (track.samplerate & 65280) >> 8,
  67743. track.samplerate & 255,
  67744. 0,
  67745. 0
  67746. ]), esds(track));
  67747. };
  67748. })();
  67749. tkhd = function(track) {
  67750. var result = new Uint8Array([
  67751. 0,
  67752. 0,
  67753. 0,
  67754. 7,
  67755. 0,
  67756. 0,
  67757. 0,
  67758. 0,
  67759. 0,
  67760. 0,
  67761. 0,
  67762. 0,
  67763. (track.id & 4278190080) >> 24,
  67764. (track.id & 16711680) >> 16,
  67765. (track.id & 65280) >> 8,
  67766. track.id & 255,
  67767. 0,
  67768. 0,
  67769. 0,
  67770. 0,
  67771. (track.duration & 4278190080) >> 24,
  67772. (track.duration & 16711680) >> 16,
  67773. (track.duration & 65280) >> 8,
  67774. track.duration & 255,
  67775. 0,
  67776. 0,
  67777. 0,
  67778. 0,
  67779. 0,
  67780. 0,
  67781. 0,
  67782. 0,
  67783. 0,
  67784. 0,
  67785. 0,
  67786. 0,
  67787. 1,
  67788. 0,
  67789. 0,
  67790. 0,
  67791. 0,
  67792. 1,
  67793. 0,
  67794. 0,
  67795. 0,
  67796. 0,
  67797. 0,
  67798. 0,
  67799. 0,
  67800. 0,
  67801. 0,
  67802. 0,
  67803. 0,
  67804. 0,
  67805. 0,
  67806. 0,
  67807. 0,
  67808. 1,
  67809. 0,
  67810. 0,
  67811. 0,
  67812. 0,
  67813. 0,
  67814. 0,
  67815. 0,
  67816. 0,
  67817. 0,
  67818. 0,
  67819. 0,
  67820. 0,
  67821. 0,
  67822. 0,
  67823. 64,
  67824. 0,
  67825. 0,
  67826. 0,
  67827. (track.width & 65280) >> 8,
  67828. track.width & 255,
  67829. 0,
  67830. 0,
  67831. (track.height & 65280) >> 8,
  67832. track.height & 255,
  67833. 0,
  67834. 0
  67835. ]);
  67836. return box(types.tkhd, result);
  67837. };
  67838. traf = function(track) {
  67839. var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable, dataOffset, upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime;
  67840. trackFragmentHeader = box(types.tfhd, new Uint8Array([
  67841. 0,
  67842. 0,
  67843. 0,
  67844. 58,
  67845. (track.id & 4278190080) >> 24,
  67846. (track.id & 16711680) >> 16,
  67847. (track.id & 65280) >> 8,
  67848. track.id & 255,
  67849. 0,
  67850. 0,
  67851. 0,
  67852. 1,
  67853. 0,
  67854. 0,
  67855. 0,
  67856. 0,
  67857. 0,
  67858. 0,
  67859. 0,
  67860. 0,
  67861. 0,
  67862. 0,
  67863. 0,
  67864. 0
  67865. ]));
  67866. upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / MAX_UINT322);
  67867. lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % MAX_UINT322);
  67868. trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([
  67869. 1,
  67870. 0,
  67871. 0,
  67872. 0,
  67873. upperWordBaseMediaDecodeTime >>> 24 & 255,
  67874. upperWordBaseMediaDecodeTime >>> 16 & 255,
  67875. upperWordBaseMediaDecodeTime >>> 8 & 255,
  67876. upperWordBaseMediaDecodeTime & 255,
  67877. lowerWordBaseMediaDecodeTime >>> 24 & 255,
  67878. lowerWordBaseMediaDecodeTime >>> 16 & 255,
  67879. lowerWordBaseMediaDecodeTime >>> 8 & 255,
  67880. lowerWordBaseMediaDecodeTime & 255
  67881. ]));
  67882. dataOffset = 32 + 20 + 8 + 16 + 8 + 8;
  67883. if (track.type === "audio") {
  67884. trackFragmentRun = trun$1(track, dataOffset);
  67885. return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun);
  67886. }
  67887. sampleDependencyTable = sdtp(track);
  67888. trackFragmentRun = trun$1(track, sampleDependencyTable.length + dataOffset);
  67889. return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable);
  67890. };
  67891. trak = function(track) {
  67892. track.duration = track.duration || 4294967295;
  67893. return box(types.trak, tkhd(track), mdia(track));
  67894. };
  67895. trex = function(track) {
  67896. var result = new Uint8Array([
  67897. 0,
  67898. 0,
  67899. 0,
  67900. 0,
  67901. (track.id & 4278190080) >> 24,
  67902. (track.id & 16711680) >> 16,
  67903. (track.id & 65280) >> 8,
  67904. track.id & 255,
  67905. 0,
  67906. 0,
  67907. 0,
  67908. 1,
  67909. 0,
  67910. 0,
  67911. 0,
  67912. 0,
  67913. 0,
  67914. 0,
  67915. 0,
  67916. 0,
  67917. 0,
  67918. 1,
  67919. 0,
  67920. 1
  67921. ]);
  67922. if (track.type !== "video") {
  67923. result[result.length - 1] = 0;
  67924. }
  67925. return box(types.trex, result);
  67926. };
  67927. (function() {
  67928. var audioTrun, videoTrun, trunHeader;
  67929. trunHeader = function(samples, offset) {
  67930. var durationPresent = 0, sizePresent = 0, flagsPresent = 0, compositionTimeOffset = 0;
  67931. if (samples.length) {
  67932. if (samples[0].duration !== void 0) {
  67933. durationPresent = 1;
  67934. }
  67935. if (samples[0].size !== void 0) {
  67936. sizePresent = 2;
  67937. }
  67938. if (samples[0].flags !== void 0) {
  67939. flagsPresent = 4;
  67940. }
  67941. if (samples[0].compositionTimeOffset !== void 0) {
  67942. compositionTimeOffset = 8;
  67943. }
  67944. }
  67945. return [
  67946. 0,
  67947. 0,
  67948. durationPresent | sizePresent | flagsPresent | compositionTimeOffset,
  67949. 1,
  67950. (samples.length & 4278190080) >>> 24,
  67951. (samples.length & 16711680) >>> 16,
  67952. (samples.length & 65280) >>> 8,
  67953. samples.length & 255,
  67954. (offset & 4278190080) >>> 24,
  67955. (offset & 16711680) >>> 16,
  67956. (offset & 65280) >>> 8,
  67957. offset & 255
  67958. ];
  67959. };
  67960. videoTrun = function(track, offset) {
  67961. var bytesOffest, bytes, header, samples, sample, i2;
  67962. samples = track.samples || [];
  67963. offset += 8 + 12 + 16 * samples.length;
  67964. header = trunHeader(samples, offset);
  67965. bytes = new Uint8Array(header.length + samples.length * 16);
  67966. bytes.set(header);
  67967. bytesOffest = header.length;
  67968. for (i2 = 0; i2 < samples.length; i2++) {
  67969. sample = samples[i2];
  67970. bytes[bytesOffest++] = (sample.duration & 4278190080) >>> 24;
  67971. bytes[bytesOffest++] = (sample.duration & 16711680) >>> 16;
  67972. bytes[bytesOffest++] = (sample.duration & 65280) >>> 8;
  67973. bytes[bytesOffest++] = sample.duration & 255;
  67974. bytes[bytesOffest++] = (sample.size & 4278190080) >>> 24;
  67975. bytes[bytesOffest++] = (sample.size & 16711680) >>> 16;
  67976. bytes[bytesOffest++] = (sample.size & 65280) >>> 8;
  67977. bytes[bytesOffest++] = sample.size & 255;
  67978. bytes[bytesOffest++] = sample.flags.isLeading << 2 | sample.flags.dependsOn;
  67979. bytes[bytesOffest++] = sample.flags.isDependedOn << 6 | sample.flags.hasRedundancy << 4 | sample.flags.paddingValue << 1 | sample.flags.isNonSyncSample;
  67980. bytes[bytesOffest++] = sample.flags.degradationPriority & 240 << 8;
  67981. bytes[bytesOffest++] = sample.flags.degradationPriority & 15;
  67982. bytes[bytesOffest++] = (sample.compositionTimeOffset & 4278190080) >>> 24;
  67983. bytes[bytesOffest++] = (sample.compositionTimeOffset & 16711680) >>> 16;
  67984. bytes[bytesOffest++] = (sample.compositionTimeOffset & 65280) >>> 8;
  67985. bytes[bytesOffest++] = sample.compositionTimeOffset & 255;
  67986. }
  67987. return box(types.trun, bytes);
  67988. };
  67989. audioTrun = function(track, offset) {
  67990. var bytes, bytesOffest, header, samples, sample, i2;
  67991. samples = track.samples || [];
  67992. offset += 8 + 12 + 8 * samples.length;
  67993. header = trunHeader(samples, offset);
  67994. bytes = new Uint8Array(header.length + samples.length * 8);
  67995. bytes.set(header);
  67996. bytesOffest = header.length;
  67997. for (i2 = 0; i2 < samples.length; i2++) {
  67998. sample = samples[i2];
  67999. bytes[bytesOffest++] = (sample.duration & 4278190080) >>> 24;
  68000. bytes[bytesOffest++] = (sample.duration & 16711680) >>> 16;
  68001. bytes[bytesOffest++] = (sample.duration & 65280) >>> 8;
  68002. bytes[bytesOffest++] = sample.duration & 255;
  68003. bytes[bytesOffest++] = (sample.size & 4278190080) >>> 24;
  68004. bytes[bytesOffest++] = (sample.size & 16711680) >>> 16;
  68005. bytes[bytesOffest++] = (sample.size & 65280) >>> 8;
  68006. bytes[bytesOffest++] = sample.size & 255;
  68007. }
  68008. return box(types.trun, bytes);
  68009. };
  68010. trun$1 = function(track, offset) {
  68011. if (track.type === "audio") {
  68012. return audioTrun(track, offset);
  68013. }
  68014. return videoTrun(track, offset);
  68015. };
  68016. })();
  68017. var mp4Generator = {
  68018. ftyp,
  68019. mdat,
  68020. moof,
  68021. moov,
  68022. initSegment: function(tracks) {
  68023. var fileType = ftyp(), movie = moov(tracks), result;
  68024. result = new Uint8Array(fileType.byteLength + movie.byteLength);
  68025. result.set(fileType);
  68026. result.set(movie, fileType.byteLength);
  68027. return result;
  68028. }
  68029. };
  68030. var groupNalsIntoFrames = function(nalUnits) {
  68031. var i2, currentNal, currentFrame = [], frames = [];
  68032. frames.byteLength = 0;
  68033. frames.nalCount = 0;
  68034. frames.duration = 0;
  68035. currentFrame.byteLength = 0;
  68036. for (i2 = 0; i2 < nalUnits.length; i2++) {
  68037. currentNal = nalUnits[i2];
  68038. if (currentNal.nalUnitType === "access_unit_delimiter_rbsp") {
  68039. if (currentFrame.length) {
  68040. currentFrame.duration = currentNal.dts - currentFrame.dts;
  68041. frames.byteLength += currentFrame.byteLength;
  68042. frames.nalCount += currentFrame.length;
  68043. frames.duration += currentFrame.duration;
  68044. frames.push(currentFrame);
  68045. }
  68046. currentFrame = [currentNal];
  68047. currentFrame.byteLength = currentNal.data.byteLength;
  68048. currentFrame.pts = currentNal.pts;
  68049. currentFrame.dts = currentNal.dts;
  68050. } else {
  68051. if (currentNal.nalUnitType === "slice_layer_without_partitioning_rbsp_idr") {
  68052. currentFrame.keyFrame = true;
  68053. }
  68054. currentFrame.duration = currentNal.dts - currentFrame.dts;
  68055. currentFrame.byteLength += currentNal.data.byteLength;
  68056. currentFrame.push(currentNal);
  68057. }
  68058. }
  68059. if (frames.length && (!currentFrame.duration || currentFrame.duration <= 0)) {
  68060. currentFrame.duration = frames[frames.length - 1].duration;
  68061. }
  68062. frames.byteLength += currentFrame.byteLength;
  68063. frames.nalCount += currentFrame.length;
  68064. frames.duration += currentFrame.duration;
  68065. frames.push(currentFrame);
  68066. return frames;
  68067. };
  68068. var groupFramesIntoGops = function(frames) {
  68069. var i2, currentFrame, currentGop = [], gops = [];
  68070. currentGop.byteLength = 0;
  68071. currentGop.nalCount = 0;
  68072. currentGop.duration = 0;
  68073. currentGop.pts = frames[0].pts;
  68074. currentGop.dts = frames[0].dts;
  68075. gops.byteLength = 0;
  68076. gops.nalCount = 0;
  68077. gops.duration = 0;
  68078. gops.pts = frames[0].pts;
  68079. gops.dts = frames[0].dts;
  68080. for (i2 = 0; i2 < frames.length; i2++) {
  68081. currentFrame = frames[i2];
  68082. if (currentFrame.keyFrame) {
  68083. if (currentGop.length) {
  68084. gops.push(currentGop);
  68085. gops.byteLength += currentGop.byteLength;
  68086. gops.nalCount += currentGop.nalCount;
  68087. gops.duration += currentGop.duration;
  68088. }
  68089. currentGop = [currentFrame];
  68090. currentGop.nalCount = currentFrame.length;
  68091. currentGop.byteLength = currentFrame.byteLength;
  68092. currentGop.pts = currentFrame.pts;
  68093. currentGop.dts = currentFrame.dts;
  68094. currentGop.duration = currentFrame.duration;
  68095. } else {
  68096. currentGop.duration += currentFrame.duration;
  68097. currentGop.nalCount += currentFrame.length;
  68098. currentGop.byteLength += currentFrame.byteLength;
  68099. currentGop.push(currentFrame);
  68100. }
  68101. }
  68102. if (gops.length && currentGop.duration <= 0) {
  68103. currentGop.duration = gops[gops.length - 1].duration;
  68104. }
  68105. gops.byteLength += currentGop.byteLength;
  68106. gops.nalCount += currentGop.nalCount;
  68107. gops.duration += currentGop.duration;
  68108. gops.push(currentGop);
  68109. return gops;
  68110. };
  68111. var extendFirstKeyFrame = function(gops) {
  68112. var currentGop;
  68113. if (!gops[0][0].keyFrame && gops.length > 1) {
  68114. currentGop = gops.shift();
  68115. gops.byteLength -= currentGop.byteLength;
  68116. gops.nalCount -= currentGop.nalCount;
  68117. gops[0][0].dts = currentGop.dts;
  68118. gops[0][0].pts = currentGop.pts;
  68119. gops[0][0].duration += currentGop.duration;
  68120. }
  68121. return gops;
  68122. };
  68123. var createDefaultSample = function() {
  68124. return {
  68125. size: 0,
  68126. flags: {
  68127. isLeading: 0,
  68128. dependsOn: 1,
  68129. isDependedOn: 0,
  68130. hasRedundancy: 0,
  68131. degradationPriority: 0,
  68132. isNonSyncSample: 1
  68133. }
  68134. };
  68135. };
  68136. var sampleForFrame = function(frame, dataOffset) {
  68137. var sample = createDefaultSample();
  68138. sample.dataOffset = dataOffset;
  68139. sample.compositionTimeOffset = frame.pts - frame.dts;
  68140. sample.duration = frame.duration;
  68141. sample.size = 4 * frame.length;
  68142. sample.size += frame.byteLength;
  68143. if (frame.keyFrame) {
  68144. sample.flags.dependsOn = 2;
  68145. sample.flags.isNonSyncSample = 0;
  68146. }
  68147. return sample;
  68148. };
  68149. var generateSampleTable$1 = function(gops, baseDataOffset) {
  68150. var h2, i2, sample, currentGop, currentFrame, dataOffset = baseDataOffset || 0, samples = [];
  68151. for (h2 = 0; h2 < gops.length; h2++) {
  68152. currentGop = gops[h2];
  68153. for (i2 = 0; i2 < currentGop.length; i2++) {
  68154. currentFrame = currentGop[i2];
  68155. sample = sampleForFrame(currentFrame, dataOffset);
  68156. dataOffset += sample.size;
  68157. samples.push(sample);
  68158. }
  68159. }
  68160. return samples;
  68161. };
  68162. var concatenateNalData = function(gops) {
  68163. var h2, i2, j, currentGop, currentFrame, currentNal, dataOffset = 0, nalsByteLength = gops.byteLength, numberOfNals = gops.nalCount, totalByteLength = nalsByteLength + 4 * numberOfNals, data = new Uint8Array(totalByteLength), view = new DataView(data.buffer);
  68164. for (h2 = 0; h2 < gops.length; h2++) {
  68165. currentGop = gops[h2];
  68166. for (i2 = 0; i2 < currentGop.length; i2++) {
  68167. currentFrame = currentGop[i2];
  68168. for (j = 0; j < currentFrame.length; j++) {
  68169. currentNal = currentFrame[j];
  68170. view.setUint32(dataOffset, currentNal.data.byteLength);
  68171. dataOffset += 4;
  68172. data.set(currentNal.data, dataOffset);
  68173. dataOffset += currentNal.data.byteLength;
  68174. }
  68175. }
  68176. }
  68177. return data;
  68178. };
  68179. var generateSampleTableForFrame = function(frame, baseDataOffset) {
  68180. var sample, dataOffset = baseDataOffset || 0, samples = [];
  68181. sample = sampleForFrame(frame, dataOffset);
  68182. samples.push(sample);
  68183. return samples;
  68184. };
  68185. var concatenateNalDataForFrame = function(frame) {
  68186. var i2, currentNal, dataOffset = 0, nalsByteLength = frame.byteLength, numberOfNals = frame.length, totalByteLength = nalsByteLength + 4 * numberOfNals, data = new Uint8Array(totalByteLength), view = new DataView(data.buffer);
  68187. for (i2 = 0; i2 < frame.length; i2++) {
  68188. currentNal = frame[i2];
  68189. view.setUint32(dataOffset, currentNal.data.byteLength);
  68190. dataOffset += 4;
  68191. data.set(currentNal.data, dataOffset);
  68192. dataOffset += currentNal.data.byteLength;
  68193. }
  68194. return data;
  68195. };
  68196. var frameUtils$1 = {
  68197. groupNalsIntoFrames,
  68198. groupFramesIntoGops,
  68199. extendFirstKeyFrame,
  68200. generateSampleTable: generateSampleTable$1,
  68201. concatenateNalData,
  68202. generateSampleTableForFrame,
  68203. concatenateNalDataForFrame
  68204. };
  68205. var highPrefix = [33, 16, 5, 32, 164, 27];
  68206. var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252];
  68207. var zeroFill = function(count) {
  68208. var a = [];
  68209. while (count--) {
  68210. a.push(0);
  68211. }
  68212. return a;
  68213. };
  68214. var makeTable = function(metaTable) {
  68215. return Object.keys(metaTable).reduce(function(obj, key) {
  68216. obj[key] = new Uint8Array(metaTable[key].reduce(function(arr, part) {
  68217. return arr.concat(part);
  68218. }, []));
  68219. return obj;
  68220. }, {});
  68221. };
  68222. var silence;
  68223. var silence_1 = function() {
  68224. if (!silence) {
  68225. var coneOfSilence2 = {
  68226. 96e3: [highPrefix, [227, 64], zeroFill(154), [56]],
  68227. 88200: [highPrefix, [231], zeroFill(170), [56]],
  68228. 64e3: [highPrefix, [248, 192], zeroFill(240), [56]],
  68229. 48e3: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]],
  68230. 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]],
  68231. 32e3: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]],
  68232. 24e3: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]],
  68233. 16e3: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]],
  68234. 12e3: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 253, 128], zeroFill(259), [56]],
  68235. 11025: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 255, 192], zeroFill(268), [55, 175, 128], zeroFill(108), [112]],
  68236. 8e3: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]]
  68237. };
  68238. silence = makeTable(coneOfSilence2);
  68239. }
  68240. return silence;
  68241. };
  68242. var ONE_SECOND_IN_TS$4 = 9e4, secondsToVideoTs2, secondsToAudioTs2, videoTsToSeconds2, audioTsToSeconds2, audioTsToVideoTs2, videoTsToAudioTs2, metadataTsToSeconds2;
  68243. secondsToVideoTs2 = function(seconds) {
  68244. return seconds * ONE_SECOND_IN_TS$4;
  68245. };
  68246. secondsToAudioTs2 = function(seconds, sampleRate) {
  68247. return seconds * sampleRate;
  68248. };
  68249. videoTsToSeconds2 = function(timestamp) {
  68250. return timestamp / ONE_SECOND_IN_TS$4;
  68251. };
  68252. audioTsToSeconds2 = function(timestamp, sampleRate) {
  68253. return timestamp / sampleRate;
  68254. };
  68255. audioTsToVideoTs2 = function(timestamp, sampleRate) {
  68256. return secondsToVideoTs2(audioTsToSeconds2(timestamp, sampleRate));
  68257. };
  68258. videoTsToAudioTs2 = function(timestamp, sampleRate) {
  68259. return secondsToAudioTs2(videoTsToSeconds2(timestamp), sampleRate);
  68260. };
  68261. metadataTsToSeconds2 = function(timestamp, timelineStartPts, keepOriginalTimestamps) {
  68262. return videoTsToSeconds2(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts);
  68263. };
  68264. var clock$2 = {
  68265. ONE_SECOND_IN_TS: ONE_SECOND_IN_TS$4,
  68266. secondsToVideoTs: secondsToVideoTs2,
  68267. secondsToAudioTs: secondsToAudioTs2,
  68268. videoTsToSeconds: videoTsToSeconds2,
  68269. audioTsToSeconds: audioTsToSeconds2,
  68270. audioTsToVideoTs: audioTsToVideoTs2,
  68271. videoTsToAudioTs: videoTsToAudioTs2,
  68272. metadataTsToSeconds: metadataTsToSeconds2
  68273. };
  68274. var coneOfSilence = silence_1;
  68275. var clock$12 = clock$2;
  68276. var sumFrameByteLengths = function(array) {
  68277. var i2, currentObj, sum = 0;
  68278. for (i2 = 0; i2 < array.length; i2++) {
  68279. currentObj = array[i2];
  68280. sum += currentObj.data.byteLength;
  68281. }
  68282. return sum;
  68283. };
  68284. var prefixWithSilence = function(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) {
  68285. var baseMediaDecodeTimeTs, frameDuration = 0, audioGapDuration = 0, audioFillFrameCount = 0, audioFillDuration = 0, silentFrame, i2, firstFrame;
  68286. if (!frames.length) {
  68287. return;
  68288. }
  68289. baseMediaDecodeTimeTs = clock$12.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate);
  68290. frameDuration = Math.ceil(clock$12.ONE_SECOND_IN_TS / (track.samplerate / 1024));
  68291. if (audioAppendStartTs && videoBaseMediaDecodeTime) {
  68292. audioGapDuration = baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime);
  68293. audioFillFrameCount = Math.floor(audioGapDuration / frameDuration);
  68294. audioFillDuration = audioFillFrameCount * frameDuration;
  68295. }
  68296. if (audioFillFrameCount < 1 || audioFillDuration > clock$12.ONE_SECOND_IN_TS / 2) {
  68297. return;
  68298. }
  68299. silentFrame = coneOfSilence()[track.samplerate];
  68300. if (!silentFrame) {
  68301. silentFrame = frames[0].data;
  68302. }
  68303. for (i2 = 0; i2 < audioFillFrameCount; i2++) {
  68304. firstFrame = frames[0];
  68305. frames.splice(0, 0, {
  68306. data: silentFrame,
  68307. dts: firstFrame.dts - frameDuration,
  68308. pts: firstFrame.pts - frameDuration
  68309. });
  68310. }
  68311. track.baseMediaDecodeTime -= Math.floor(clock$12.videoTsToAudioTs(audioFillDuration, track.samplerate));
  68312. return audioFillDuration;
  68313. };
  68314. var trimAdtsFramesByEarliestDts = function(adtsFrames, track, earliestAllowedDts) {
  68315. if (track.minSegmentDts >= earliestAllowedDts) {
  68316. return adtsFrames;
  68317. }
  68318. track.minSegmentDts = Infinity;
  68319. return adtsFrames.filter(function(currentFrame) {
  68320. if (currentFrame.dts >= earliestAllowedDts) {
  68321. track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts);
  68322. track.minSegmentPts = track.minSegmentDts;
  68323. return true;
  68324. }
  68325. return false;
  68326. });
  68327. };
  68328. var generateSampleTable = function(frames) {
  68329. var i2, currentFrame, samples = [];
  68330. for (i2 = 0; i2 < frames.length; i2++) {
  68331. currentFrame = frames[i2];
  68332. samples.push({
  68333. size: currentFrame.data.byteLength,
  68334. duration: 1024
  68335. });
  68336. }
  68337. return samples;
  68338. };
  68339. var concatenateFrameData = function(frames) {
  68340. var i2, currentFrame, dataOffset = 0, data = new Uint8Array(sumFrameByteLengths(frames));
  68341. for (i2 = 0; i2 < frames.length; i2++) {
  68342. currentFrame = frames[i2];
  68343. data.set(currentFrame.data, dataOffset);
  68344. dataOffset += currentFrame.data.byteLength;
  68345. }
  68346. return data;
  68347. };
  68348. var audioFrameUtils$1 = {
  68349. prefixWithSilence,
  68350. trimAdtsFramesByEarliestDts,
  68351. generateSampleTable,
  68352. concatenateFrameData
  68353. };
  68354. var ONE_SECOND_IN_TS$3 = clock$2.ONE_SECOND_IN_TS;
  68355. var collectDtsInfo = function(track, data) {
  68356. if (typeof data.pts === "number") {
  68357. if (track.timelineStartInfo.pts === void 0) {
  68358. track.timelineStartInfo.pts = data.pts;
  68359. }
  68360. if (track.minSegmentPts === void 0) {
  68361. track.minSegmentPts = data.pts;
  68362. } else {
  68363. track.minSegmentPts = Math.min(track.minSegmentPts, data.pts);
  68364. }
  68365. if (track.maxSegmentPts === void 0) {
  68366. track.maxSegmentPts = data.pts;
  68367. } else {
  68368. track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts);
  68369. }
  68370. }
  68371. if (typeof data.dts === "number") {
  68372. if (track.timelineStartInfo.dts === void 0) {
  68373. track.timelineStartInfo.dts = data.dts;
  68374. }
  68375. if (track.minSegmentDts === void 0) {
  68376. track.minSegmentDts = data.dts;
  68377. } else {
  68378. track.minSegmentDts = Math.min(track.minSegmentDts, data.dts);
  68379. }
  68380. if (track.maxSegmentDts === void 0) {
  68381. track.maxSegmentDts = data.dts;
  68382. } else {
  68383. track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts);
  68384. }
  68385. }
  68386. };
  68387. var clearDtsInfo = function(track) {
  68388. delete track.minSegmentDts;
  68389. delete track.maxSegmentDts;
  68390. delete track.minSegmentPts;
  68391. delete track.maxSegmentPts;
  68392. };
  68393. var calculateTrackBaseMediaDecodeTime = function(track, keepOriginalTimestamps) {
  68394. var baseMediaDecodeTime, scale, minSegmentDts = track.minSegmentDts;
  68395. if (!keepOriginalTimestamps) {
  68396. minSegmentDts -= track.timelineStartInfo.dts;
  68397. }
  68398. baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime;
  68399. baseMediaDecodeTime += minSegmentDts;
  68400. baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime);
  68401. if (track.type === "audio") {
  68402. scale = track.samplerate / ONE_SECOND_IN_TS$3;
  68403. baseMediaDecodeTime *= scale;
  68404. baseMediaDecodeTime = Math.floor(baseMediaDecodeTime);
  68405. }
  68406. return baseMediaDecodeTime;
  68407. };
  68408. var trackDecodeInfo$1 = {
  68409. clearDtsInfo,
  68410. calculateTrackBaseMediaDecodeTime,
  68411. collectDtsInfo
  68412. };
  68413. var USER_DATA_REGISTERED_ITU_T_T35 = 4, RBSP_TRAILING_BITS = 128;
  68414. var parseSei = function(bytes) {
  68415. var i2 = 0, result = {
  68416. payloadType: -1,
  68417. payloadSize: 0
  68418. }, payloadType = 0, payloadSize = 0;
  68419. while (i2 < bytes.byteLength) {
  68420. if (bytes[i2] === RBSP_TRAILING_BITS) {
  68421. break;
  68422. }
  68423. while (bytes[i2] === 255) {
  68424. payloadType += 255;
  68425. i2++;
  68426. }
  68427. payloadType += bytes[i2++];
  68428. while (bytes[i2] === 255) {
  68429. payloadSize += 255;
  68430. i2++;
  68431. }
  68432. payloadSize += bytes[i2++];
  68433. if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) {
  68434. var userIdentifier = String.fromCharCode(bytes[i2 + 3], bytes[i2 + 4], bytes[i2 + 5], bytes[i2 + 6]);
  68435. if (userIdentifier === "GA94") {
  68436. result.payloadType = payloadType;
  68437. result.payloadSize = payloadSize;
  68438. result.payload = bytes.subarray(i2, i2 + payloadSize);
  68439. break;
  68440. } else {
  68441. result.payload = void 0;
  68442. }
  68443. }
  68444. i2 += payloadSize;
  68445. payloadType = 0;
  68446. payloadSize = 0;
  68447. }
  68448. return result;
  68449. };
  68450. var parseUserData = function(sei) {
  68451. if (sei.payload[0] !== 181) {
  68452. return null;
  68453. }
  68454. if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) {
  68455. return null;
  68456. }
  68457. if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== "GA94") {
  68458. return null;
  68459. }
  68460. if (sei.payload[7] !== 3) {
  68461. return null;
  68462. }
  68463. return sei.payload.subarray(8, sei.payload.length - 1);
  68464. };
  68465. var parseCaptionPackets = function(pts, userData) {
  68466. var results = [], i2, count, offset, data;
  68467. if (!(userData[0] & 64)) {
  68468. return results;
  68469. }
  68470. count = userData[0] & 31;
  68471. for (i2 = 0; i2 < count; i2++) {
  68472. offset = i2 * 3;
  68473. data = {
  68474. type: userData[offset + 2] & 3,
  68475. pts
  68476. };
  68477. if (userData[offset + 2] & 4) {
  68478. data.ccData = userData[offset + 3] << 8 | userData[offset + 4];
  68479. results.push(data);
  68480. }
  68481. }
  68482. return results;
  68483. };
  68484. var discardEmulationPreventionBytes$12 = function(data) {
  68485. var length = data.byteLength, emulationPreventionBytesPositions = [], i2 = 1, newLength, newData;
  68486. while (i2 < length - 2) {
  68487. if (data[i2] === 0 && data[i2 + 1] === 0 && data[i2 + 2] === 3) {
  68488. emulationPreventionBytesPositions.push(i2 + 2);
  68489. i2 += 2;
  68490. } else {
  68491. i2++;
  68492. }
  68493. }
  68494. if (emulationPreventionBytesPositions.length === 0) {
  68495. return data;
  68496. }
  68497. newLength = length - emulationPreventionBytesPositions.length;
  68498. newData = new Uint8Array(newLength);
  68499. var sourceIndex = 0;
  68500. for (i2 = 0; i2 < newLength; sourceIndex++, i2++) {
  68501. if (sourceIndex === emulationPreventionBytesPositions[0]) {
  68502. sourceIndex++;
  68503. emulationPreventionBytesPositions.shift();
  68504. }
  68505. newData[i2] = data[sourceIndex];
  68506. }
  68507. return newData;
  68508. };
  68509. var captionPacketParser = {
  68510. parseSei,
  68511. parseUserData,
  68512. parseCaptionPackets,
  68513. discardEmulationPreventionBytes: discardEmulationPreventionBytes$12,
  68514. USER_DATA_REGISTERED_ITU_T_T35
  68515. };
  68516. var Stream$7 = stream;
  68517. var cea708Parser = captionPacketParser;
  68518. var CaptionStream$2 = function(options2) {
  68519. options2 = options2 || {};
  68520. CaptionStream$2.prototype.init.call(this);
  68521. this.parse708captions_ = typeof options2.parse708captions === "boolean" ? options2.parse708captions : true;
  68522. this.captionPackets_ = [];
  68523. this.ccStreams_ = [
  68524. new Cea608Stream(0, 0),
  68525. new Cea608Stream(0, 1),
  68526. new Cea608Stream(1, 0),
  68527. new Cea608Stream(1, 1)
  68528. ];
  68529. if (this.parse708captions_) {
  68530. this.cc708Stream_ = new Cea708Stream({
  68531. captionServices: options2.captionServices
  68532. });
  68533. }
  68534. this.reset();
  68535. this.ccStreams_.forEach(function(cc) {
  68536. cc.on("data", this.trigger.bind(this, "data"));
  68537. cc.on("partialdone", this.trigger.bind(this, "partialdone"));
  68538. cc.on("done", this.trigger.bind(this, "done"));
  68539. }, this);
  68540. if (this.parse708captions_) {
  68541. this.cc708Stream_.on("data", this.trigger.bind(this, "data"));
  68542. this.cc708Stream_.on("partialdone", this.trigger.bind(this, "partialdone"));
  68543. this.cc708Stream_.on("done", this.trigger.bind(this, "done"));
  68544. }
  68545. };
  68546. CaptionStream$2.prototype = new Stream$7();
  68547. CaptionStream$2.prototype.push = function(event2) {
  68548. var sei, userData, newCaptionPackets;
  68549. if (event2.nalUnitType !== "sei_rbsp") {
  68550. return;
  68551. }
  68552. sei = cea708Parser.parseSei(event2.escapedRBSP);
  68553. if (!sei.payload) {
  68554. return;
  68555. }
  68556. if (sei.payloadType !== cea708Parser.USER_DATA_REGISTERED_ITU_T_T35) {
  68557. return;
  68558. }
  68559. userData = cea708Parser.parseUserData(sei);
  68560. if (!userData) {
  68561. return;
  68562. }
  68563. if (event2.dts < this.latestDts_) {
  68564. this.ignoreNextEqualDts_ = true;
  68565. return;
  68566. } else if (event2.dts === this.latestDts_ && this.ignoreNextEqualDts_) {
  68567. this.numSameDts_--;
  68568. if (!this.numSameDts_) {
  68569. this.ignoreNextEqualDts_ = false;
  68570. }
  68571. return;
  68572. }
  68573. newCaptionPackets = cea708Parser.parseCaptionPackets(event2.pts, userData);
  68574. this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets);
  68575. if (this.latestDts_ !== event2.dts) {
  68576. this.numSameDts_ = 0;
  68577. }
  68578. this.numSameDts_++;
  68579. this.latestDts_ = event2.dts;
  68580. };
  68581. CaptionStream$2.prototype.flushCCStreams = function(flushType) {
  68582. this.ccStreams_.forEach(function(cc) {
  68583. return flushType === "flush" ? cc.flush() : cc.partialFlush();
  68584. }, this);
  68585. };
  68586. CaptionStream$2.prototype.flushStream = function(flushType) {
  68587. if (!this.captionPackets_.length) {
  68588. this.flushCCStreams(flushType);
  68589. return;
  68590. }
  68591. this.captionPackets_.forEach(function(elem, idx) {
  68592. elem.presortIndex = idx;
  68593. });
  68594. this.captionPackets_.sort(function(a, b) {
  68595. if (a.pts === b.pts) {
  68596. return a.presortIndex - b.presortIndex;
  68597. }
  68598. return a.pts - b.pts;
  68599. });
  68600. this.captionPackets_.forEach(function(packet) {
  68601. if (packet.type < 2) {
  68602. this.dispatchCea608Packet(packet);
  68603. } else {
  68604. this.dispatchCea708Packet(packet);
  68605. }
  68606. }, this);
  68607. this.captionPackets_.length = 0;
  68608. this.flushCCStreams(flushType);
  68609. };
  68610. CaptionStream$2.prototype.flush = function() {
  68611. return this.flushStream("flush");
  68612. };
  68613. CaptionStream$2.prototype.partialFlush = function() {
  68614. return this.flushStream("partialFlush");
  68615. };
  68616. CaptionStream$2.prototype.reset = function() {
  68617. this.latestDts_ = null;
  68618. this.ignoreNextEqualDts_ = false;
  68619. this.numSameDts_ = 0;
  68620. this.activeCea608Channel_ = [null, null];
  68621. this.ccStreams_.forEach(function(ccStream) {
  68622. ccStream.reset();
  68623. });
  68624. };
  68625. CaptionStream$2.prototype.dispatchCea608Packet = function(packet) {
  68626. if (this.setsTextOrXDSActive(packet)) {
  68627. this.activeCea608Channel_[packet.type] = null;
  68628. } else if (this.setsChannel1Active(packet)) {
  68629. this.activeCea608Channel_[packet.type] = 0;
  68630. } else if (this.setsChannel2Active(packet)) {
  68631. this.activeCea608Channel_[packet.type] = 1;
  68632. }
  68633. if (this.activeCea608Channel_[packet.type] === null) {
  68634. return;
  68635. }
  68636. this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet);
  68637. };
  68638. CaptionStream$2.prototype.setsChannel1Active = function(packet) {
  68639. return (packet.ccData & 30720) === 4096;
  68640. };
  68641. CaptionStream$2.prototype.setsChannel2Active = function(packet) {
  68642. return (packet.ccData & 30720) === 6144;
  68643. };
  68644. CaptionStream$2.prototype.setsTextOrXDSActive = function(packet) {
  68645. return (packet.ccData & 28928) === 256 || (packet.ccData & 30974) === 4138 || (packet.ccData & 30974) === 6186;
  68646. };
  68647. CaptionStream$2.prototype.dispatchCea708Packet = function(packet) {
  68648. if (this.parse708captions_) {
  68649. this.cc708Stream_.push(packet);
  68650. }
  68651. };
  68652. var CHARACTER_TRANSLATION_708 = {
  68653. 127: 9834,
  68654. 4128: 32,
  68655. 4129: 160,
  68656. 4133: 8230,
  68657. 4138: 352,
  68658. 4140: 338,
  68659. 4144: 9608,
  68660. 4145: 8216,
  68661. 4146: 8217,
  68662. 4147: 8220,
  68663. 4148: 8221,
  68664. 4149: 8226,
  68665. 4153: 8482,
  68666. 4154: 353,
  68667. 4156: 339,
  68668. 4157: 8480,
  68669. 4159: 376,
  68670. 4214: 8539,
  68671. 4215: 8540,
  68672. 4216: 8541,
  68673. 4217: 8542,
  68674. 4218: 9168,
  68675. 4219: 9124,
  68676. 4220: 9123,
  68677. 4221: 9135,
  68678. 4222: 9126,
  68679. 4223: 9121,
  68680. 4256: 12600
  68681. };
  68682. var get708CharFromCode = function(code) {
  68683. var newCode = CHARACTER_TRANSLATION_708[code] || code;
  68684. if (code & 4096 && code === newCode) {
  68685. return "";
  68686. }
  68687. return String.fromCharCode(newCode);
  68688. };
  68689. var within708TextBlock = function(b) {
  68690. return 32 <= b && b <= 127 || 160 <= b && b <= 255;
  68691. };
  68692. var Cea708Window = function(windowNum) {
  68693. this.windowNum = windowNum;
  68694. this.reset();
  68695. };
  68696. Cea708Window.prototype.reset = function() {
  68697. this.clearText();
  68698. this.pendingNewLine = false;
  68699. this.winAttr = {};
  68700. this.penAttr = {};
  68701. this.penLoc = {};
  68702. this.penColor = {};
  68703. this.visible = 0;
  68704. this.rowLock = 0;
  68705. this.columnLock = 0;
  68706. this.priority = 0;
  68707. this.relativePositioning = 0;
  68708. this.anchorVertical = 0;
  68709. this.anchorHorizontal = 0;
  68710. this.anchorPoint = 0;
  68711. this.rowCount = 1;
  68712. this.virtualRowCount = this.rowCount + 1;
  68713. this.columnCount = 41;
  68714. this.windowStyle = 0;
  68715. this.penStyle = 0;
  68716. };
  68717. Cea708Window.prototype.getText = function() {
  68718. return this.rows.join("\n");
  68719. };
  68720. Cea708Window.prototype.clearText = function() {
  68721. this.rows = [""];
  68722. this.rowIdx = 0;
  68723. };
  68724. Cea708Window.prototype.newLine = function(pts) {
  68725. if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === "function") {
  68726. this.beforeRowOverflow(pts);
  68727. }
  68728. if (this.rows.length > 0) {
  68729. this.rows.push("");
  68730. this.rowIdx++;
  68731. }
  68732. while (this.rows.length > this.virtualRowCount) {
  68733. this.rows.shift();
  68734. this.rowIdx--;
  68735. }
  68736. };
  68737. Cea708Window.prototype.isEmpty = function() {
  68738. if (this.rows.length === 0) {
  68739. return true;
  68740. } else if (this.rows.length === 1) {
  68741. return this.rows[0] === "";
  68742. }
  68743. return false;
  68744. };
  68745. Cea708Window.prototype.addText = function(text) {
  68746. this.rows[this.rowIdx] += text;
  68747. };
  68748. Cea708Window.prototype.backspace = function() {
  68749. if (!this.isEmpty()) {
  68750. var row = this.rows[this.rowIdx];
  68751. this.rows[this.rowIdx] = row.substr(0, row.length - 1);
  68752. }
  68753. };
  68754. var Cea708Service = function(serviceNum, encoding, stream2) {
  68755. this.serviceNum = serviceNum;
  68756. this.text = "";
  68757. this.currentWindow = new Cea708Window(-1);
  68758. this.windows = [];
  68759. this.stream = stream2;
  68760. if (typeof encoding === "string") {
  68761. this.createTextDecoder(encoding);
  68762. }
  68763. };
  68764. Cea708Service.prototype.init = function(pts, beforeRowOverflow) {
  68765. this.startPts = pts;
  68766. for (var win3 = 0; win3 < 8; win3++) {
  68767. this.windows[win3] = new Cea708Window(win3);
  68768. if (typeof beforeRowOverflow === "function") {
  68769. this.windows[win3].beforeRowOverflow = beforeRowOverflow;
  68770. }
  68771. }
  68772. };
  68773. Cea708Service.prototype.setCurrentWindow = function(windowNum) {
  68774. this.currentWindow = this.windows[windowNum];
  68775. };
  68776. Cea708Service.prototype.createTextDecoder = function(encoding) {
  68777. if (typeof TextDecoder === "undefined") {
  68778. this.stream.trigger("log", {
  68779. level: "warn",
  68780. message: "The `encoding` option is unsupported without TextDecoder support"
  68781. });
  68782. } else {
  68783. try {
  68784. this.textDecoder_ = new TextDecoder(encoding);
  68785. } catch (error) {
  68786. this.stream.trigger("log", {
  68787. level: "warn",
  68788. message: "TextDecoder could not be created with " + encoding + " encoding. " + error
  68789. });
  68790. }
  68791. }
  68792. };
  68793. var Cea708Stream = function(options2) {
  68794. options2 = options2 || {};
  68795. Cea708Stream.prototype.init.call(this);
  68796. var self2 = this;
  68797. var captionServices = options2.captionServices || {};
  68798. var captionServiceEncodings = {};
  68799. var serviceProps;
  68800. Object.keys(captionServices).forEach((serviceName) => {
  68801. serviceProps = captionServices[serviceName];
  68802. if (/^SERVICE/.test(serviceName)) {
  68803. captionServiceEncodings[serviceName] = serviceProps.encoding;
  68804. }
  68805. });
  68806. this.serviceEncodings = captionServiceEncodings;
  68807. this.current708Packet = null;
  68808. this.services = {};
  68809. this.push = function(packet) {
  68810. if (packet.type === 3) {
  68811. self2.new708Packet();
  68812. self2.add708Bytes(packet);
  68813. } else {
  68814. if (self2.current708Packet === null) {
  68815. self2.new708Packet();
  68816. }
  68817. self2.add708Bytes(packet);
  68818. }
  68819. };
  68820. };
  68821. Cea708Stream.prototype = new Stream$7();
  68822. Cea708Stream.prototype.new708Packet = function() {
  68823. if (this.current708Packet !== null) {
  68824. this.push708Packet();
  68825. }
  68826. this.current708Packet = {
  68827. data: [],
  68828. ptsVals: []
  68829. };
  68830. };
  68831. Cea708Stream.prototype.add708Bytes = function(packet) {
  68832. var data = packet.ccData;
  68833. var byte0 = data >>> 8;
  68834. var byte1 = data & 255;
  68835. this.current708Packet.ptsVals.push(packet.pts);
  68836. this.current708Packet.data.push(byte0);
  68837. this.current708Packet.data.push(byte1);
  68838. };
  68839. Cea708Stream.prototype.push708Packet = function() {
  68840. var packet708 = this.current708Packet;
  68841. var packetData = packet708.data;
  68842. var serviceNum = null;
  68843. var blockSize = null;
  68844. var i2 = 0;
  68845. var b = packetData[i2++];
  68846. packet708.seq = b >> 6;
  68847. packet708.sizeCode = b & 63;
  68848. for (; i2 < packetData.length; i2++) {
  68849. b = packetData[i2++];
  68850. serviceNum = b >> 5;
  68851. blockSize = b & 31;
  68852. if (serviceNum === 7 && blockSize > 0) {
  68853. b = packetData[i2++];
  68854. serviceNum = b;
  68855. }
  68856. this.pushServiceBlock(serviceNum, i2, blockSize);
  68857. if (blockSize > 0) {
  68858. i2 += blockSize - 1;
  68859. }
  68860. }
  68861. };
  68862. Cea708Stream.prototype.pushServiceBlock = function(serviceNum, start2, size) {
  68863. var b;
  68864. var i2 = start2;
  68865. var packetData = this.current708Packet.data;
  68866. var service = this.services[serviceNum];
  68867. if (!service) {
  68868. service = this.initService(serviceNum, i2);
  68869. }
  68870. for (; i2 < start2 + size && i2 < packetData.length; i2++) {
  68871. b = packetData[i2];
  68872. if (within708TextBlock(b)) {
  68873. i2 = this.handleText(i2, service);
  68874. } else if (b === 24) {
  68875. i2 = this.multiByteCharacter(i2, service);
  68876. } else if (b === 16) {
  68877. i2 = this.extendedCommands(i2, service);
  68878. } else if (128 <= b && b <= 135) {
  68879. i2 = this.setCurrentWindow(i2, service);
  68880. } else if (152 <= b && b <= 159) {
  68881. i2 = this.defineWindow(i2, service);
  68882. } else if (b === 136) {
  68883. i2 = this.clearWindows(i2, service);
  68884. } else if (b === 140) {
  68885. i2 = this.deleteWindows(i2, service);
  68886. } else if (b === 137) {
  68887. i2 = this.displayWindows(i2, service);
  68888. } else if (b === 138) {
  68889. i2 = this.hideWindows(i2, service);
  68890. } else if (b === 139) {
  68891. i2 = this.toggleWindows(i2, service);
  68892. } else if (b === 151) {
  68893. i2 = this.setWindowAttributes(i2, service);
  68894. } else if (b === 144) {
  68895. i2 = this.setPenAttributes(i2, service);
  68896. } else if (b === 145) {
  68897. i2 = this.setPenColor(i2, service);
  68898. } else if (b === 146) {
  68899. i2 = this.setPenLocation(i2, service);
  68900. } else if (b === 143) {
  68901. service = this.reset(i2, service);
  68902. } else if (b === 8) {
  68903. service.currentWindow.backspace();
  68904. } else if (b === 12) {
  68905. service.currentWindow.clearText();
  68906. } else if (b === 13) {
  68907. service.currentWindow.pendingNewLine = true;
  68908. } else if (b === 14) {
  68909. service.currentWindow.clearText();
  68910. } else if (b === 141) {
  68911. i2++;
  68912. } else
  68913. ;
  68914. }
  68915. };
  68916. Cea708Stream.prototype.extendedCommands = function(i2, service) {
  68917. var packetData = this.current708Packet.data;
  68918. var b = packetData[++i2];
  68919. if (within708TextBlock(b)) {
  68920. i2 = this.handleText(i2, service, {
  68921. isExtended: true
  68922. });
  68923. }
  68924. return i2;
  68925. };
  68926. Cea708Stream.prototype.getPts = function(byteIndex) {
  68927. return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)];
  68928. };
  68929. Cea708Stream.prototype.initService = function(serviceNum, i2) {
  68930. var serviceName = "SERVICE" + serviceNum;
  68931. var self2 = this;
  68932. var serviceName;
  68933. var encoding;
  68934. if (serviceName in this.serviceEncodings) {
  68935. encoding = this.serviceEncodings[serviceName];
  68936. }
  68937. this.services[serviceNum] = new Cea708Service(serviceNum, encoding, self2);
  68938. this.services[serviceNum].init(this.getPts(i2), function(pts) {
  68939. self2.flushDisplayed(pts, self2.services[serviceNum]);
  68940. });
  68941. return this.services[serviceNum];
  68942. };
  68943. Cea708Stream.prototype.handleText = function(i2, service, options2) {
  68944. var isExtended = options2 && options2.isExtended;
  68945. var isMultiByte = options2 && options2.isMultiByte;
  68946. var packetData = this.current708Packet.data;
  68947. var extended = isExtended ? 4096 : 0;
  68948. var currentByte = packetData[i2];
  68949. var nextByte = packetData[i2 + 1];
  68950. var win3 = service.currentWindow;
  68951. var char;
  68952. var charCodeArray;
  68953. if (service.textDecoder_ && !isExtended) {
  68954. if (isMultiByte) {
  68955. charCodeArray = [currentByte, nextByte];
  68956. i2++;
  68957. } else {
  68958. charCodeArray = [currentByte];
  68959. }
  68960. char = service.textDecoder_.decode(new Uint8Array(charCodeArray));
  68961. } else {
  68962. char = get708CharFromCode(extended | currentByte);
  68963. }
  68964. if (win3.pendingNewLine && !win3.isEmpty()) {
  68965. win3.newLine(this.getPts(i2));
  68966. }
  68967. win3.pendingNewLine = false;
  68968. win3.addText(char);
  68969. return i2;
  68970. };
  68971. Cea708Stream.prototype.multiByteCharacter = function(i2, service) {
  68972. var packetData = this.current708Packet.data;
  68973. var firstByte = packetData[i2 + 1];
  68974. var secondByte = packetData[i2 + 2];
  68975. if (within708TextBlock(firstByte) && within708TextBlock(secondByte)) {
  68976. i2 = this.handleText(++i2, service, {
  68977. isMultiByte: true
  68978. });
  68979. }
  68980. return i2;
  68981. };
  68982. Cea708Stream.prototype.setCurrentWindow = function(i2, service) {
  68983. var packetData = this.current708Packet.data;
  68984. var b = packetData[i2];
  68985. var windowNum = b & 7;
  68986. service.setCurrentWindow(windowNum);
  68987. return i2;
  68988. };
  68989. Cea708Stream.prototype.defineWindow = function(i2, service) {
  68990. var packetData = this.current708Packet.data;
  68991. var b = packetData[i2];
  68992. var windowNum = b & 7;
  68993. service.setCurrentWindow(windowNum);
  68994. var win3 = service.currentWindow;
  68995. b = packetData[++i2];
  68996. win3.visible = (b & 32) >> 5;
  68997. win3.rowLock = (b & 16) >> 4;
  68998. win3.columnLock = (b & 8) >> 3;
  68999. win3.priority = b & 7;
  69000. b = packetData[++i2];
  69001. win3.relativePositioning = (b & 128) >> 7;
  69002. win3.anchorVertical = b & 127;
  69003. b = packetData[++i2];
  69004. win3.anchorHorizontal = b;
  69005. b = packetData[++i2];
  69006. win3.anchorPoint = (b & 240) >> 4;
  69007. win3.rowCount = b & 15;
  69008. b = packetData[++i2];
  69009. win3.columnCount = b & 63;
  69010. b = packetData[++i2];
  69011. win3.windowStyle = (b & 56) >> 3;
  69012. win3.penStyle = b & 7;
  69013. win3.virtualRowCount = win3.rowCount + 1;
  69014. return i2;
  69015. };
  69016. Cea708Stream.prototype.setWindowAttributes = function(i2, service) {
  69017. var packetData = this.current708Packet.data;
  69018. var b = packetData[i2];
  69019. var winAttr = service.currentWindow.winAttr;
  69020. b = packetData[++i2];
  69021. winAttr.fillOpacity = (b & 192) >> 6;
  69022. winAttr.fillRed = (b & 48) >> 4;
  69023. winAttr.fillGreen = (b & 12) >> 2;
  69024. winAttr.fillBlue = b & 3;
  69025. b = packetData[++i2];
  69026. winAttr.borderType = (b & 192) >> 6;
  69027. winAttr.borderRed = (b & 48) >> 4;
  69028. winAttr.borderGreen = (b & 12) >> 2;
  69029. winAttr.borderBlue = b & 3;
  69030. b = packetData[++i2];
  69031. winAttr.borderType += (b & 128) >> 5;
  69032. winAttr.wordWrap = (b & 64) >> 6;
  69033. winAttr.printDirection = (b & 48) >> 4;
  69034. winAttr.scrollDirection = (b & 12) >> 2;
  69035. winAttr.justify = b & 3;
  69036. b = packetData[++i2];
  69037. winAttr.effectSpeed = (b & 240) >> 4;
  69038. winAttr.effectDirection = (b & 12) >> 2;
  69039. winAttr.displayEffect = b & 3;
  69040. return i2;
  69041. };
  69042. Cea708Stream.prototype.flushDisplayed = function(pts, service) {
  69043. var displayedText = [];
  69044. for (var winId = 0; winId < 8; winId++) {
  69045. if (service.windows[winId].visible && !service.windows[winId].isEmpty()) {
  69046. displayedText.push(service.windows[winId].getText());
  69047. }
  69048. }
  69049. service.endPts = pts;
  69050. service.text = displayedText.join("\n\n");
  69051. this.pushCaption(service);
  69052. service.startPts = pts;
  69053. };
  69054. Cea708Stream.prototype.pushCaption = function(service) {
  69055. if (service.text !== "") {
  69056. this.trigger("data", {
  69057. startPts: service.startPts,
  69058. endPts: service.endPts,
  69059. text: service.text,
  69060. stream: "cc708_" + service.serviceNum
  69061. });
  69062. service.text = "";
  69063. service.startPts = service.endPts;
  69064. }
  69065. };
  69066. Cea708Stream.prototype.displayWindows = function(i2, service) {
  69067. var packetData = this.current708Packet.data;
  69068. var b = packetData[++i2];
  69069. var pts = this.getPts(i2);
  69070. this.flushDisplayed(pts, service);
  69071. for (var winId = 0; winId < 8; winId++) {
  69072. if (b & 1 << winId) {
  69073. service.windows[winId].visible = 1;
  69074. }
  69075. }
  69076. return i2;
  69077. };
  69078. Cea708Stream.prototype.hideWindows = function(i2, service) {
  69079. var packetData = this.current708Packet.data;
  69080. var b = packetData[++i2];
  69081. var pts = this.getPts(i2);
  69082. this.flushDisplayed(pts, service);
  69083. for (var winId = 0; winId < 8; winId++) {
  69084. if (b & 1 << winId) {
  69085. service.windows[winId].visible = 0;
  69086. }
  69087. }
  69088. return i2;
  69089. };
  69090. Cea708Stream.prototype.toggleWindows = function(i2, service) {
  69091. var packetData = this.current708Packet.data;
  69092. var b = packetData[++i2];
  69093. var pts = this.getPts(i2);
  69094. this.flushDisplayed(pts, service);
  69095. for (var winId = 0; winId < 8; winId++) {
  69096. if (b & 1 << winId) {
  69097. service.windows[winId].visible ^= 1;
  69098. }
  69099. }
  69100. return i2;
  69101. };
  69102. Cea708Stream.prototype.clearWindows = function(i2, service) {
  69103. var packetData = this.current708Packet.data;
  69104. var b = packetData[++i2];
  69105. var pts = this.getPts(i2);
  69106. this.flushDisplayed(pts, service);
  69107. for (var winId = 0; winId < 8; winId++) {
  69108. if (b & 1 << winId) {
  69109. service.windows[winId].clearText();
  69110. }
  69111. }
  69112. return i2;
  69113. };
  69114. Cea708Stream.prototype.deleteWindows = function(i2, service) {
  69115. var packetData = this.current708Packet.data;
  69116. var b = packetData[++i2];
  69117. var pts = this.getPts(i2);
  69118. this.flushDisplayed(pts, service);
  69119. for (var winId = 0; winId < 8; winId++) {
  69120. if (b & 1 << winId) {
  69121. service.windows[winId].reset();
  69122. }
  69123. }
  69124. return i2;
  69125. };
  69126. Cea708Stream.prototype.setPenAttributes = function(i2, service) {
  69127. var packetData = this.current708Packet.data;
  69128. var b = packetData[i2];
  69129. var penAttr = service.currentWindow.penAttr;
  69130. b = packetData[++i2];
  69131. penAttr.textTag = (b & 240) >> 4;
  69132. penAttr.offset = (b & 12) >> 2;
  69133. penAttr.penSize = b & 3;
  69134. b = packetData[++i2];
  69135. penAttr.italics = (b & 128) >> 7;
  69136. penAttr.underline = (b & 64) >> 6;
  69137. penAttr.edgeType = (b & 56) >> 3;
  69138. penAttr.fontStyle = b & 7;
  69139. return i2;
  69140. };
  69141. Cea708Stream.prototype.setPenColor = function(i2, service) {
  69142. var packetData = this.current708Packet.data;
  69143. var b = packetData[i2];
  69144. var penColor = service.currentWindow.penColor;
  69145. b = packetData[++i2];
  69146. penColor.fgOpacity = (b & 192) >> 6;
  69147. penColor.fgRed = (b & 48) >> 4;
  69148. penColor.fgGreen = (b & 12) >> 2;
  69149. penColor.fgBlue = b & 3;
  69150. b = packetData[++i2];
  69151. penColor.bgOpacity = (b & 192) >> 6;
  69152. penColor.bgRed = (b & 48) >> 4;
  69153. penColor.bgGreen = (b & 12) >> 2;
  69154. penColor.bgBlue = b & 3;
  69155. b = packetData[++i2];
  69156. penColor.edgeRed = (b & 48) >> 4;
  69157. penColor.edgeGreen = (b & 12) >> 2;
  69158. penColor.edgeBlue = b & 3;
  69159. return i2;
  69160. };
  69161. Cea708Stream.prototype.setPenLocation = function(i2, service) {
  69162. var packetData = this.current708Packet.data;
  69163. var b = packetData[i2];
  69164. var penLoc = service.currentWindow.penLoc;
  69165. service.currentWindow.pendingNewLine = true;
  69166. b = packetData[++i2];
  69167. penLoc.row = b & 15;
  69168. b = packetData[++i2];
  69169. penLoc.column = b & 63;
  69170. return i2;
  69171. };
  69172. Cea708Stream.prototype.reset = function(i2, service) {
  69173. var pts = this.getPts(i2);
  69174. this.flushDisplayed(pts, service);
  69175. return this.initService(service.serviceNum, i2);
  69176. };
  69177. var CHARACTER_TRANSLATION = {
  69178. 42: 225,
  69179. 92: 233,
  69180. 94: 237,
  69181. 95: 243,
  69182. 96: 250,
  69183. 123: 231,
  69184. 124: 247,
  69185. 125: 209,
  69186. 126: 241,
  69187. 127: 9608,
  69188. 304: 174,
  69189. 305: 176,
  69190. 306: 189,
  69191. 307: 191,
  69192. 308: 8482,
  69193. 309: 162,
  69194. 310: 163,
  69195. 311: 9834,
  69196. 312: 224,
  69197. 313: 160,
  69198. 314: 232,
  69199. 315: 226,
  69200. 316: 234,
  69201. 317: 238,
  69202. 318: 244,
  69203. 319: 251,
  69204. 544: 193,
  69205. 545: 201,
  69206. 546: 211,
  69207. 547: 218,
  69208. 548: 220,
  69209. 549: 252,
  69210. 550: 8216,
  69211. 551: 161,
  69212. 552: 42,
  69213. 553: 39,
  69214. 554: 8212,
  69215. 555: 169,
  69216. 556: 8480,
  69217. 557: 8226,
  69218. 558: 8220,
  69219. 559: 8221,
  69220. 560: 192,
  69221. 561: 194,
  69222. 562: 199,
  69223. 563: 200,
  69224. 564: 202,
  69225. 565: 203,
  69226. 566: 235,
  69227. 567: 206,
  69228. 568: 207,
  69229. 569: 239,
  69230. 570: 212,
  69231. 571: 217,
  69232. 572: 249,
  69233. 573: 219,
  69234. 574: 171,
  69235. 575: 187,
  69236. 800: 195,
  69237. 801: 227,
  69238. 802: 205,
  69239. 803: 204,
  69240. 804: 236,
  69241. 805: 210,
  69242. 806: 242,
  69243. 807: 213,
  69244. 808: 245,
  69245. 809: 123,
  69246. 810: 125,
  69247. 811: 92,
  69248. 812: 94,
  69249. 813: 95,
  69250. 814: 124,
  69251. 815: 126,
  69252. 816: 196,
  69253. 817: 228,
  69254. 818: 214,
  69255. 819: 246,
  69256. 820: 223,
  69257. 821: 165,
  69258. 822: 164,
  69259. 823: 9474,
  69260. 824: 197,
  69261. 825: 229,
  69262. 826: 216,
  69263. 827: 248,
  69264. 828: 9484,
  69265. 829: 9488,
  69266. 830: 9492,
  69267. 831: 9496
  69268. };
  69269. var getCharFromCode = function(code) {
  69270. if (code === null) {
  69271. return "";
  69272. }
  69273. code = CHARACTER_TRANSLATION[code] || code;
  69274. return String.fromCharCode(code);
  69275. };
  69276. var BOTTOM_ROW = 14;
  69277. var ROWS = [4352, 4384, 4608, 4640, 5376, 5408, 5632, 5664, 5888, 5920, 4096, 4864, 4896, 5120, 5152];
  69278. var createDisplayBuffer = function() {
  69279. var result = [], i2 = BOTTOM_ROW + 1;
  69280. while (i2--) {
  69281. result.push("");
  69282. }
  69283. return result;
  69284. };
  69285. var Cea608Stream = function(field, dataChannel) {
  69286. Cea608Stream.prototype.init.call(this);
  69287. this.field_ = field || 0;
  69288. this.dataChannel_ = dataChannel || 0;
  69289. this.name_ = "CC" + ((this.field_ << 1 | this.dataChannel_) + 1);
  69290. this.setConstants();
  69291. this.reset();
  69292. this.push = function(packet) {
  69293. var data, swap, char0, char1, text;
  69294. data = packet.ccData & 32639;
  69295. if (data === this.lastControlCode_) {
  69296. this.lastControlCode_ = null;
  69297. return;
  69298. }
  69299. if ((data & 61440) === 4096) {
  69300. this.lastControlCode_ = data;
  69301. } else if (data !== this.PADDING_) {
  69302. this.lastControlCode_ = null;
  69303. }
  69304. char0 = data >>> 8;
  69305. char1 = data & 255;
  69306. if (data === this.PADDING_) {
  69307. return;
  69308. } else if (data === this.RESUME_CAPTION_LOADING_) {
  69309. this.mode_ = "popOn";
  69310. } else if (data === this.END_OF_CAPTION_) {
  69311. this.mode_ = "popOn";
  69312. this.clearFormatting(packet.pts);
  69313. this.flushDisplayed(packet.pts);
  69314. swap = this.displayed_;
  69315. this.displayed_ = this.nonDisplayed_;
  69316. this.nonDisplayed_ = swap;
  69317. this.startPts_ = packet.pts;
  69318. } else if (data === this.ROLL_UP_2_ROWS_) {
  69319. this.rollUpRows_ = 2;
  69320. this.setRollUp(packet.pts);
  69321. } else if (data === this.ROLL_UP_3_ROWS_) {
  69322. this.rollUpRows_ = 3;
  69323. this.setRollUp(packet.pts);
  69324. } else if (data === this.ROLL_UP_4_ROWS_) {
  69325. this.rollUpRows_ = 4;
  69326. this.setRollUp(packet.pts);
  69327. } else if (data === this.CARRIAGE_RETURN_) {
  69328. this.clearFormatting(packet.pts);
  69329. this.flushDisplayed(packet.pts);
  69330. this.shiftRowsUp_();
  69331. this.startPts_ = packet.pts;
  69332. } else if (data === this.BACKSPACE_) {
  69333. if (this.mode_ === "popOn") {
  69334. this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1);
  69335. } else {
  69336. this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1);
  69337. }
  69338. } else if (data === this.ERASE_DISPLAYED_MEMORY_) {
  69339. this.flushDisplayed(packet.pts);
  69340. this.displayed_ = createDisplayBuffer();
  69341. } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) {
  69342. this.nonDisplayed_ = createDisplayBuffer();
  69343. } else if (data === this.RESUME_DIRECT_CAPTIONING_) {
  69344. if (this.mode_ !== "paintOn") {
  69345. this.flushDisplayed(packet.pts);
  69346. this.displayed_ = createDisplayBuffer();
  69347. }
  69348. this.mode_ = "paintOn";
  69349. this.startPts_ = packet.pts;
  69350. } else if (this.isSpecialCharacter(char0, char1)) {
  69351. char0 = (char0 & 3) << 8;
  69352. text = getCharFromCode(char0 | char1);
  69353. this[this.mode_](packet.pts, text);
  69354. this.column_++;
  69355. } else if (this.isExtCharacter(char0, char1)) {
  69356. if (this.mode_ === "popOn") {
  69357. this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1);
  69358. } else {
  69359. this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1);
  69360. }
  69361. char0 = (char0 & 3) << 8;
  69362. text = getCharFromCode(char0 | char1);
  69363. this[this.mode_](packet.pts, text);
  69364. this.column_++;
  69365. } else if (this.isMidRowCode(char0, char1)) {
  69366. this.clearFormatting(packet.pts);
  69367. this[this.mode_](packet.pts, " ");
  69368. this.column_++;
  69369. if ((char1 & 14) === 14) {
  69370. this.addFormatting(packet.pts, ["i"]);
  69371. }
  69372. if ((char1 & 1) === 1) {
  69373. this.addFormatting(packet.pts, ["u"]);
  69374. }
  69375. } else if (this.isOffsetControlCode(char0, char1)) {
  69376. this.column_ += char1 & 3;
  69377. } else if (this.isPAC(char0, char1)) {
  69378. var row = ROWS.indexOf(data & 7968);
  69379. if (this.mode_ === "rollUp") {
  69380. if (row - this.rollUpRows_ + 1 < 0) {
  69381. row = this.rollUpRows_ - 1;
  69382. }
  69383. this.setRollUp(packet.pts, row);
  69384. }
  69385. if (row !== this.row_) {
  69386. this.clearFormatting(packet.pts);
  69387. this.row_ = row;
  69388. }
  69389. if (char1 & 1 && this.formatting_.indexOf("u") === -1) {
  69390. this.addFormatting(packet.pts, ["u"]);
  69391. }
  69392. if ((data & 16) === 16) {
  69393. this.column_ = ((data & 14) >> 1) * 4;
  69394. }
  69395. if (this.isColorPAC(char1)) {
  69396. if ((char1 & 14) === 14) {
  69397. this.addFormatting(packet.pts, ["i"]);
  69398. }
  69399. }
  69400. } else if (this.isNormalChar(char0)) {
  69401. if (char1 === 0) {
  69402. char1 = null;
  69403. }
  69404. text = getCharFromCode(char0);
  69405. text += getCharFromCode(char1);
  69406. this[this.mode_](packet.pts, text);
  69407. this.column_ += text.length;
  69408. }
  69409. };
  69410. };
  69411. Cea608Stream.prototype = new Stream$7();
  69412. Cea608Stream.prototype.flushDisplayed = function(pts) {
  69413. var content = this.displayed_.map(function(row, index2) {
  69414. try {
  69415. return row.trim();
  69416. } catch (e) {
  69417. this.trigger("log", {
  69418. level: "warn",
  69419. message: "Skipping a malformed 608 caption at index " + index2 + "."
  69420. });
  69421. return "";
  69422. }
  69423. }, this).join("\n").replace(/^\n+|\n+$/g, "");
  69424. if (content.length) {
  69425. this.trigger("data", {
  69426. startPts: this.startPts_,
  69427. endPts: pts,
  69428. text: content,
  69429. stream: this.name_
  69430. });
  69431. }
  69432. };
  69433. Cea608Stream.prototype.reset = function() {
  69434. this.mode_ = "popOn";
  69435. this.topRow_ = 0;
  69436. this.startPts_ = 0;
  69437. this.displayed_ = createDisplayBuffer();
  69438. this.nonDisplayed_ = createDisplayBuffer();
  69439. this.lastControlCode_ = null;
  69440. this.column_ = 0;
  69441. this.row_ = BOTTOM_ROW;
  69442. this.rollUpRows_ = 2;
  69443. this.formatting_ = [];
  69444. };
  69445. Cea608Stream.prototype.setConstants = function() {
  69446. if (this.dataChannel_ === 0) {
  69447. this.BASE_ = 16;
  69448. this.EXT_ = 17;
  69449. this.CONTROL_ = (20 | this.field_) << 8;
  69450. this.OFFSET_ = 23;
  69451. } else if (this.dataChannel_ === 1) {
  69452. this.BASE_ = 24;
  69453. this.EXT_ = 25;
  69454. this.CONTROL_ = (28 | this.field_) << 8;
  69455. this.OFFSET_ = 31;
  69456. }
  69457. this.PADDING_ = 0;
  69458. this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 32;
  69459. this.END_OF_CAPTION_ = this.CONTROL_ | 47;
  69460. this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 37;
  69461. this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 38;
  69462. this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 39;
  69463. this.CARRIAGE_RETURN_ = this.CONTROL_ | 45;
  69464. this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 41;
  69465. this.BACKSPACE_ = this.CONTROL_ | 33;
  69466. this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 44;
  69467. this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 46;
  69468. };
  69469. Cea608Stream.prototype.isSpecialCharacter = function(char0, char1) {
  69470. return char0 === this.EXT_ && char1 >= 48 && char1 <= 63;
  69471. };
  69472. Cea608Stream.prototype.isExtCharacter = function(char0, char1) {
  69473. return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 32 && char1 <= 63;
  69474. };
  69475. Cea608Stream.prototype.isMidRowCode = function(char0, char1) {
  69476. return char0 === this.EXT_ && char1 >= 32 && char1 <= 47;
  69477. };
  69478. Cea608Stream.prototype.isOffsetControlCode = function(char0, char1) {
  69479. return char0 === this.OFFSET_ && char1 >= 33 && char1 <= 35;
  69480. };
  69481. Cea608Stream.prototype.isPAC = function(char0, char1) {
  69482. return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 64 && char1 <= 127;
  69483. };
  69484. Cea608Stream.prototype.isColorPAC = function(char1) {
  69485. return char1 >= 64 && char1 <= 79 || char1 >= 96 && char1 <= 127;
  69486. };
  69487. Cea608Stream.prototype.isNormalChar = function(char) {
  69488. return char >= 32 && char <= 127;
  69489. };
  69490. Cea608Stream.prototype.setRollUp = function(pts, newBaseRow) {
  69491. if (this.mode_ !== "rollUp") {
  69492. this.row_ = BOTTOM_ROW;
  69493. this.mode_ = "rollUp";
  69494. this.flushDisplayed(pts);
  69495. this.nonDisplayed_ = createDisplayBuffer();
  69496. this.displayed_ = createDisplayBuffer();
  69497. }
  69498. if (newBaseRow !== void 0 && newBaseRow !== this.row_) {
  69499. for (var i2 = 0; i2 < this.rollUpRows_; i2++) {
  69500. this.displayed_[newBaseRow - i2] = this.displayed_[this.row_ - i2];
  69501. this.displayed_[this.row_ - i2] = "";
  69502. }
  69503. }
  69504. if (newBaseRow === void 0) {
  69505. newBaseRow = this.row_;
  69506. }
  69507. this.topRow_ = newBaseRow - this.rollUpRows_ + 1;
  69508. };
  69509. Cea608Stream.prototype.addFormatting = function(pts, format) {
  69510. this.formatting_ = this.formatting_.concat(format);
  69511. var text = format.reduce(function(text2, format2) {
  69512. return text2 + "<" + format2 + ">";
  69513. }, "");
  69514. this[this.mode_](pts, text);
  69515. };
  69516. Cea608Stream.prototype.clearFormatting = function(pts) {
  69517. if (!this.formatting_.length) {
  69518. return;
  69519. }
  69520. var text = this.formatting_.reverse().reduce(function(text2, format) {
  69521. return text2 + "</" + format + ">";
  69522. }, "");
  69523. this.formatting_ = [];
  69524. this[this.mode_](pts, text);
  69525. };
  69526. Cea608Stream.prototype.popOn = function(pts, text) {
  69527. var baseRow = this.nonDisplayed_[this.row_];
  69528. baseRow += text;
  69529. this.nonDisplayed_[this.row_] = baseRow;
  69530. };
  69531. Cea608Stream.prototype.rollUp = function(pts, text) {
  69532. var baseRow = this.displayed_[this.row_];
  69533. baseRow += text;
  69534. this.displayed_[this.row_] = baseRow;
  69535. };
  69536. Cea608Stream.prototype.shiftRowsUp_ = function() {
  69537. var i2;
  69538. for (i2 = 0; i2 < this.topRow_; i2++) {
  69539. this.displayed_[i2] = "";
  69540. }
  69541. for (i2 = this.row_ + 1; i2 < BOTTOM_ROW + 1; i2++) {
  69542. this.displayed_[i2] = "";
  69543. }
  69544. for (i2 = this.topRow_; i2 < this.row_; i2++) {
  69545. this.displayed_[i2] = this.displayed_[i2 + 1];
  69546. }
  69547. this.displayed_[this.row_] = "";
  69548. };
  69549. Cea608Stream.prototype.paintOn = function(pts, text) {
  69550. var baseRow = this.displayed_[this.row_];
  69551. baseRow += text;
  69552. this.displayed_[this.row_] = baseRow;
  69553. };
  69554. var captionStream = {
  69555. CaptionStream: CaptionStream$2,
  69556. Cea608Stream,
  69557. Cea708Stream
  69558. };
  69559. var streamTypes = {
  69560. H264_STREAM_TYPE: 27,
  69561. ADTS_STREAM_TYPE: 15,
  69562. METADATA_STREAM_TYPE: 21
  69563. };
  69564. var Stream$6 = stream;
  69565. var MAX_TS = 8589934592;
  69566. var RO_THRESH = 4294967296;
  69567. var TYPE_SHARED = "shared";
  69568. var handleRollover$1 = function(value, reference) {
  69569. var direction = 1;
  69570. if (value > reference) {
  69571. direction = -1;
  69572. }
  69573. while (Math.abs(reference - value) > RO_THRESH) {
  69574. value += direction * MAX_TS;
  69575. }
  69576. return value;
  69577. };
  69578. var TimestampRolloverStream$1 = function(type3) {
  69579. var lastDTS, referenceDTS;
  69580. TimestampRolloverStream$1.prototype.init.call(this);
  69581. this.type_ = type3 || TYPE_SHARED;
  69582. this.push = function(data) {
  69583. if (this.type_ !== TYPE_SHARED && data.type !== this.type_) {
  69584. return;
  69585. }
  69586. if (referenceDTS === void 0) {
  69587. referenceDTS = data.dts;
  69588. }
  69589. data.dts = handleRollover$1(data.dts, referenceDTS);
  69590. data.pts = handleRollover$1(data.pts, referenceDTS);
  69591. lastDTS = data.dts;
  69592. this.trigger("data", data);
  69593. };
  69594. this.flush = function() {
  69595. referenceDTS = lastDTS;
  69596. this.trigger("done");
  69597. };
  69598. this.endTimeline = function() {
  69599. this.flush();
  69600. this.trigger("endedtimeline");
  69601. };
  69602. this.discontinuity = function() {
  69603. referenceDTS = void 0;
  69604. lastDTS = void 0;
  69605. };
  69606. this.reset = function() {
  69607. this.discontinuity();
  69608. this.trigger("reset");
  69609. };
  69610. };
  69611. TimestampRolloverStream$1.prototype = new Stream$6();
  69612. var timestampRolloverStream = {
  69613. TimestampRolloverStream: TimestampRolloverStream$1,
  69614. handleRollover: handleRollover$1
  69615. };
  69616. var typedArrayIndexOf$1 = (typedArray2, element, fromIndex) => {
  69617. if (!typedArray2) {
  69618. return -1;
  69619. }
  69620. var currentIndex = fromIndex;
  69621. for (; currentIndex < typedArray2.length; currentIndex++) {
  69622. if (typedArray2[currentIndex] === element) {
  69623. return currentIndex;
  69624. }
  69625. }
  69626. return -1;
  69627. };
  69628. var typedArray = {
  69629. typedArrayIndexOf: typedArrayIndexOf$1
  69630. };
  69631. var typedArrayIndexOf = typedArray.typedArrayIndexOf, textEncodingDescriptionByte = {
  69632. Iso88591: 0,
  69633. Utf16: 1,
  69634. Utf16be: 2,
  69635. Utf8: 3
  69636. }, percentEncode$1 = function(bytes, start2, end) {
  69637. var i2, result = "";
  69638. for (i2 = start2; i2 < end; i2++) {
  69639. result += "%" + ("00" + bytes[i2].toString(16)).slice(-2);
  69640. }
  69641. return result;
  69642. }, parseUtf8 = function(bytes, start2, end) {
  69643. return decodeURIComponent(percentEncode$1(bytes, start2, end));
  69644. }, parseIso88591$1 = function(bytes, start2, end) {
  69645. return unescape(percentEncode$1(bytes, start2, end));
  69646. }, parseSyncSafeInteger$1 = function(data) {
  69647. return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3];
  69648. }, frameParsers = {
  69649. "APIC": function(frame) {
  69650. var i2 = 1, mimeTypeEndIndex, descriptionEndIndex, LINK_MIME_TYPE = "-->";
  69651. if (frame.data[0] !== textEncodingDescriptionByte.Utf8) {
  69652. return;
  69653. }
  69654. mimeTypeEndIndex = typedArrayIndexOf(frame.data, 0, i2);
  69655. if (mimeTypeEndIndex < 0) {
  69656. return;
  69657. }
  69658. frame.mimeType = parseIso88591$1(frame.data, i2, mimeTypeEndIndex);
  69659. i2 = mimeTypeEndIndex + 1;
  69660. frame.pictureType = frame.data[i2];
  69661. i2++;
  69662. descriptionEndIndex = typedArrayIndexOf(frame.data, 0, i2);
  69663. if (descriptionEndIndex < 0) {
  69664. return;
  69665. }
  69666. frame.description = parseUtf8(frame.data, i2, descriptionEndIndex);
  69667. i2 = descriptionEndIndex + 1;
  69668. if (frame.mimeType === LINK_MIME_TYPE) {
  69669. frame.url = parseIso88591$1(frame.data, i2, frame.data.length);
  69670. } else {
  69671. frame.pictureData = frame.data.subarray(i2, frame.data.length);
  69672. }
  69673. },
  69674. "T*": function(frame) {
  69675. if (frame.data[0] !== textEncodingDescriptionByte.Utf8) {
  69676. return;
  69677. }
  69678. frame.value = parseUtf8(frame.data, 1, frame.data.length).replace(/\0*$/, "");
  69679. frame.values = frame.value.split("\0");
  69680. },
  69681. "TXXX": function(frame) {
  69682. var descriptionEndIndex;
  69683. if (frame.data[0] !== textEncodingDescriptionByte.Utf8) {
  69684. return;
  69685. }
  69686. descriptionEndIndex = typedArrayIndexOf(frame.data, 0, 1);
  69687. if (descriptionEndIndex === -1) {
  69688. return;
  69689. }
  69690. frame.description = parseUtf8(frame.data, 1, descriptionEndIndex);
  69691. frame.value = parseUtf8(frame.data, descriptionEndIndex + 1, frame.data.length).replace(/\0*$/, "");
  69692. frame.data = frame.value;
  69693. },
  69694. "W*": function(frame) {
  69695. frame.url = parseIso88591$1(frame.data, 0, frame.data.length).replace(/\0.*$/, "");
  69696. },
  69697. "WXXX": function(frame) {
  69698. var descriptionEndIndex;
  69699. if (frame.data[0] !== textEncodingDescriptionByte.Utf8) {
  69700. return;
  69701. }
  69702. descriptionEndIndex = typedArrayIndexOf(frame.data, 0, 1);
  69703. if (descriptionEndIndex === -1) {
  69704. return;
  69705. }
  69706. frame.description = parseUtf8(frame.data, 1, descriptionEndIndex);
  69707. frame.url = parseIso88591$1(frame.data, descriptionEndIndex + 1, frame.data.length).replace(/\0.*$/, "");
  69708. },
  69709. "PRIV": function(frame) {
  69710. var i2;
  69711. for (i2 = 0; i2 < frame.data.length; i2++) {
  69712. if (frame.data[i2] === 0) {
  69713. frame.owner = parseIso88591$1(frame.data, 0, i2);
  69714. break;
  69715. }
  69716. }
  69717. frame.privateData = frame.data.subarray(i2 + 1);
  69718. frame.data = frame.privateData;
  69719. }
  69720. };
  69721. var parseId3Frames$1 = function(data) {
  69722. var frameSize, frameHeader, frameStart = 10, tagSize = 0, frames = [];
  69723. if (data.length < 10 || data[0] !== "I".charCodeAt(0) || data[1] !== "D".charCodeAt(0) || data[2] !== "3".charCodeAt(0)) {
  69724. return;
  69725. }
  69726. tagSize = parseSyncSafeInteger$1(data.subarray(6, 10));
  69727. tagSize += 10;
  69728. var hasExtendedHeader = data[5] & 64;
  69729. if (hasExtendedHeader) {
  69730. frameStart += 4;
  69731. frameStart += parseSyncSafeInteger$1(data.subarray(10, 14));
  69732. tagSize -= parseSyncSafeInteger$1(data.subarray(16, 20));
  69733. }
  69734. do {
  69735. frameSize = parseSyncSafeInteger$1(data.subarray(frameStart + 4, frameStart + 8));
  69736. if (frameSize < 1) {
  69737. break;
  69738. }
  69739. frameHeader = String.fromCharCode(data[frameStart], data[frameStart + 1], data[frameStart + 2], data[frameStart + 3]);
  69740. var frame = {
  69741. id: frameHeader,
  69742. data: data.subarray(frameStart + 10, frameStart + frameSize + 10)
  69743. };
  69744. frame.key = frame.id;
  69745. if (frameParsers[frame.id]) {
  69746. frameParsers[frame.id](frame);
  69747. } else if (frame.id[0] === "T") {
  69748. frameParsers["T*"](frame);
  69749. } else if (frame.id[0] === "W") {
  69750. frameParsers["W*"](frame);
  69751. }
  69752. frames.push(frame);
  69753. frameStart += 10;
  69754. frameStart += frameSize;
  69755. } while (frameStart < tagSize);
  69756. return frames;
  69757. };
  69758. var parseId3 = {
  69759. parseId3Frames: parseId3Frames$1,
  69760. parseSyncSafeInteger: parseSyncSafeInteger$1,
  69761. frameParsers
  69762. };
  69763. var Stream$5 = stream, StreamTypes$3 = streamTypes, id3 = parseId3, MetadataStream;
  69764. MetadataStream = function(options2) {
  69765. var settings = {
  69766. descriptor: options2 && options2.descriptor
  69767. }, tagSize = 0, buffer = [], bufferSize = 0, i2;
  69768. MetadataStream.prototype.init.call(this);
  69769. this.dispatchType = StreamTypes$3.METADATA_STREAM_TYPE.toString(16);
  69770. if (settings.descriptor) {
  69771. for (i2 = 0; i2 < settings.descriptor.length; i2++) {
  69772. this.dispatchType += ("00" + settings.descriptor[i2].toString(16)).slice(-2);
  69773. }
  69774. }
  69775. this.push = function(chunk) {
  69776. var tag, frameStart, frameSize, frame, i3, frameHeader;
  69777. if (chunk.type !== "timed-metadata") {
  69778. return;
  69779. }
  69780. if (chunk.dataAlignmentIndicator) {
  69781. bufferSize = 0;
  69782. buffer.length = 0;
  69783. }
  69784. if (buffer.length === 0 && (chunk.data.length < 10 || chunk.data[0] !== "I".charCodeAt(0) || chunk.data[1] !== "D".charCodeAt(0) || chunk.data[2] !== "3".charCodeAt(0))) {
  69785. this.trigger("log", {
  69786. level: "warn",
  69787. message: "Skipping unrecognized metadata packet"
  69788. });
  69789. return;
  69790. }
  69791. buffer.push(chunk);
  69792. bufferSize += chunk.data.byteLength;
  69793. if (buffer.length === 1) {
  69794. tagSize = id3.parseSyncSafeInteger(chunk.data.subarray(6, 10));
  69795. tagSize += 10;
  69796. }
  69797. if (bufferSize < tagSize) {
  69798. return;
  69799. }
  69800. tag = {
  69801. data: new Uint8Array(tagSize),
  69802. frames: [],
  69803. pts: buffer[0].pts,
  69804. dts: buffer[0].dts
  69805. };
  69806. for (i3 = 0; i3 < tagSize; ) {
  69807. tag.data.set(buffer[0].data.subarray(0, tagSize - i3), i3);
  69808. i3 += buffer[0].data.byteLength;
  69809. bufferSize -= buffer[0].data.byteLength;
  69810. buffer.shift();
  69811. }
  69812. frameStart = 10;
  69813. if (tag.data[5] & 64) {
  69814. frameStart += 4;
  69815. frameStart += id3.parseSyncSafeInteger(tag.data.subarray(10, 14));
  69816. tagSize -= id3.parseSyncSafeInteger(tag.data.subarray(16, 20));
  69817. }
  69818. do {
  69819. frameSize = id3.parseSyncSafeInteger(tag.data.subarray(frameStart + 4, frameStart + 8));
  69820. if (frameSize < 1) {
  69821. this.trigger("log", {
  69822. level: "warn",
  69823. message: "Malformed ID3 frame encountered. Skipping remaining metadata parsing."
  69824. });
  69825. break;
  69826. }
  69827. frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]);
  69828. frame = {
  69829. id: frameHeader,
  69830. data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10)
  69831. };
  69832. frame.key = frame.id;
  69833. if (id3.frameParsers[frame.id]) {
  69834. id3.frameParsers[frame.id](frame);
  69835. } else if (frame.id[0] === "T") {
  69836. id3.frameParsers["T*"](frame);
  69837. } else if (frame.id[0] === "W") {
  69838. id3.frameParsers["W*"](frame);
  69839. }
  69840. if (frame.owner === "com.apple.streaming.transportStreamTimestamp") {
  69841. var d2 = frame.data, size = (d2[3] & 1) << 30 | d2[4] << 22 | d2[5] << 14 | d2[6] << 6 | d2[7] >>> 2;
  69842. size *= 4;
  69843. size += d2[7] & 3;
  69844. frame.timeStamp = size;
  69845. if (tag.pts === void 0 && tag.dts === void 0) {
  69846. tag.pts = frame.timeStamp;
  69847. tag.dts = frame.timeStamp;
  69848. }
  69849. this.trigger("timestamp", frame);
  69850. }
  69851. tag.frames.push(frame);
  69852. frameStart += 10;
  69853. frameStart += frameSize;
  69854. } while (frameStart < tagSize);
  69855. this.trigger("data", tag);
  69856. };
  69857. };
  69858. MetadataStream.prototype = new Stream$5();
  69859. var metadataStream = MetadataStream;
  69860. var Stream$4 = stream, CaptionStream$1 = captionStream, StreamTypes$2 = streamTypes, TimestampRolloverStream = timestampRolloverStream.TimestampRolloverStream;
  69861. var TransportPacketStream, TransportParseStream, ElementaryStream;
  69862. var MP2T_PACKET_LENGTH$1 = 188, SYNC_BYTE$1 = 71;
  69863. TransportPacketStream = function() {
  69864. var buffer = new Uint8Array(MP2T_PACKET_LENGTH$1), bytesInBuffer = 0;
  69865. TransportPacketStream.prototype.init.call(this);
  69866. this.push = function(bytes) {
  69867. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH$1, everything;
  69868. if (bytesInBuffer) {
  69869. everything = new Uint8Array(bytes.byteLength + bytesInBuffer);
  69870. everything.set(buffer.subarray(0, bytesInBuffer));
  69871. everything.set(bytes, bytesInBuffer);
  69872. bytesInBuffer = 0;
  69873. } else {
  69874. everything = bytes;
  69875. }
  69876. while (endIndex < everything.byteLength) {
  69877. if (everything[startIndex] === SYNC_BYTE$1 && everything[endIndex] === SYNC_BYTE$1) {
  69878. this.trigger("data", everything.subarray(startIndex, endIndex));
  69879. startIndex += MP2T_PACKET_LENGTH$1;
  69880. endIndex += MP2T_PACKET_LENGTH$1;
  69881. continue;
  69882. }
  69883. startIndex++;
  69884. endIndex++;
  69885. }
  69886. if (startIndex < everything.byteLength) {
  69887. buffer.set(everything.subarray(startIndex), 0);
  69888. bytesInBuffer = everything.byteLength - startIndex;
  69889. }
  69890. };
  69891. this.flush = function() {
  69892. if (bytesInBuffer === MP2T_PACKET_LENGTH$1 && buffer[0] === SYNC_BYTE$1) {
  69893. this.trigger("data", buffer);
  69894. bytesInBuffer = 0;
  69895. }
  69896. this.trigger("done");
  69897. };
  69898. this.endTimeline = function() {
  69899. this.flush();
  69900. this.trigger("endedtimeline");
  69901. };
  69902. this.reset = function() {
  69903. bytesInBuffer = 0;
  69904. this.trigger("reset");
  69905. };
  69906. };
  69907. TransportPacketStream.prototype = new Stream$4();
  69908. TransportParseStream = function() {
  69909. var parsePsi, parsePat2, parsePmt2, self2;
  69910. TransportParseStream.prototype.init.call(this);
  69911. self2 = this;
  69912. this.packetsWaitingForPmt = [];
  69913. this.programMapTable = void 0;
  69914. parsePsi = function(payload, psi) {
  69915. var offset = 0;
  69916. if (psi.payloadUnitStartIndicator) {
  69917. offset += payload[offset] + 1;
  69918. }
  69919. if (psi.type === "pat") {
  69920. parsePat2(payload.subarray(offset), psi);
  69921. } else {
  69922. parsePmt2(payload.subarray(offset), psi);
  69923. }
  69924. };
  69925. parsePat2 = function(payload, pat) {
  69926. pat.section_number = payload[7];
  69927. pat.last_section_number = payload[8];
  69928. self2.pmtPid = (payload[10] & 31) << 8 | payload[11];
  69929. pat.pmtPid = self2.pmtPid;
  69930. };
  69931. parsePmt2 = function(payload, pmt) {
  69932. var sectionLength, tableEnd, programInfoLength, offset;
  69933. if (!(payload[5] & 1)) {
  69934. return;
  69935. }
  69936. self2.programMapTable = {
  69937. video: null,
  69938. audio: null,
  69939. "timed-metadata": {}
  69940. };
  69941. sectionLength = (payload[1] & 15) << 8 | payload[2];
  69942. tableEnd = 3 + sectionLength - 4;
  69943. programInfoLength = (payload[10] & 15) << 8 | payload[11];
  69944. offset = 12 + programInfoLength;
  69945. while (offset < tableEnd) {
  69946. var streamType = payload[offset];
  69947. var pid = (payload[offset + 1] & 31) << 8 | payload[offset + 2];
  69948. if (streamType === StreamTypes$2.H264_STREAM_TYPE && self2.programMapTable.video === null) {
  69949. self2.programMapTable.video = pid;
  69950. } else if (streamType === StreamTypes$2.ADTS_STREAM_TYPE && self2.programMapTable.audio === null) {
  69951. self2.programMapTable.audio = pid;
  69952. } else if (streamType === StreamTypes$2.METADATA_STREAM_TYPE) {
  69953. self2.programMapTable["timed-metadata"][pid] = streamType;
  69954. }
  69955. offset += ((payload[offset + 3] & 15) << 8 | payload[offset + 4]) + 5;
  69956. }
  69957. pmt.programMapTable = self2.programMapTable;
  69958. };
  69959. this.push = function(packet) {
  69960. var result = {}, offset = 4;
  69961. result.payloadUnitStartIndicator = !!(packet[1] & 64);
  69962. result.pid = packet[1] & 31;
  69963. result.pid <<= 8;
  69964. result.pid |= packet[2];
  69965. if ((packet[3] & 48) >>> 4 > 1) {
  69966. offset += packet[offset] + 1;
  69967. }
  69968. if (result.pid === 0) {
  69969. result.type = "pat";
  69970. parsePsi(packet.subarray(offset), result);
  69971. this.trigger("data", result);
  69972. } else if (result.pid === this.pmtPid) {
  69973. result.type = "pmt";
  69974. parsePsi(packet.subarray(offset), result);
  69975. this.trigger("data", result);
  69976. while (this.packetsWaitingForPmt.length) {
  69977. this.processPes_.apply(this, this.packetsWaitingForPmt.shift());
  69978. }
  69979. } else if (this.programMapTable === void 0) {
  69980. this.packetsWaitingForPmt.push([packet, offset, result]);
  69981. } else {
  69982. this.processPes_(packet, offset, result);
  69983. }
  69984. };
  69985. this.processPes_ = function(packet, offset, result) {
  69986. if (result.pid === this.programMapTable.video) {
  69987. result.streamType = StreamTypes$2.H264_STREAM_TYPE;
  69988. } else if (result.pid === this.programMapTable.audio) {
  69989. result.streamType = StreamTypes$2.ADTS_STREAM_TYPE;
  69990. } else {
  69991. result.streamType = this.programMapTable["timed-metadata"][result.pid];
  69992. }
  69993. result.type = "pes";
  69994. result.data = packet.subarray(offset);
  69995. this.trigger("data", result);
  69996. };
  69997. };
  69998. TransportParseStream.prototype = new Stream$4();
  69999. TransportParseStream.STREAM_TYPES = {
  70000. h264: 27,
  70001. adts: 15
  70002. };
  70003. ElementaryStream = function() {
  70004. var self2 = this, segmentHadPmt = false, video = {
  70005. data: [],
  70006. size: 0
  70007. }, audio = {
  70008. data: [],
  70009. size: 0
  70010. }, timedMetadata = {
  70011. data: [],
  70012. size: 0
  70013. }, programMapTable, parsePes = function(payload, pes) {
  70014. var ptsDtsFlags;
  70015. const startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2];
  70016. pes.data = new Uint8Array();
  70017. if (startPrefix !== 1) {
  70018. return;
  70019. }
  70020. pes.packetLength = 6 + (payload[4] << 8 | payload[5]);
  70021. pes.dataAlignmentIndicator = (payload[6] & 4) !== 0;
  70022. ptsDtsFlags = payload[7];
  70023. if (ptsDtsFlags & 192) {
  70024. pes.pts = (payload[9] & 14) << 27 | (payload[10] & 255) << 20 | (payload[11] & 254) << 12 | (payload[12] & 255) << 5 | (payload[13] & 254) >>> 3;
  70025. pes.pts *= 4;
  70026. pes.pts += (payload[13] & 6) >>> 1;
  70027. pes.dts = pes.pts;
  70028. if (ptsDtsFlags & 64) {
  70029. pes.dts = (payload[14] & 14) << 27 | (payload[15] & 255) << 20 | (payload[16] & 254) << 12 | (payload[17] & 255) << 5 | (payload[18] & 254) >>> 3;
  70030. pes.dts *= 4;
  70031. pes.dts += (payload[18] & 6) >>> 1;
  70032. }
  70033. }
  70034. pes.data = payload.subarray(9 + payload[8]);
  70035. }, flushStream = function(stream2, type3, forceFlush) {
  70036. var packetData = new Uint8Array(stream2.size), event2 = {
  70037. type: type3
  70038. }, i2 = 0, offset = 0, packetFlushable = false, fragment;
  70039. if (!stream2.data.length || stream2.size < 9) {
  70040. return;
  70041. }
  70042. event2.trackId = stream2.data[0].pid;
  70043. for (i2 = 0; i2 < stream2.data.length; i2++) {
  70044. fragment = stream2.data[i2];
  70045. packetData.set(fragment.data, offset);
  70046. offset += fragment.data.byteLength;
  70047. }
  70048. parsePes(packetData, event2);
  70049. packetFlushable = type3 === "video" || event2.packetLength <= stream2.size;
  70050. if (forceFlush || packetFlushable) {
  70051. stream2.size = 0;
  70052. stream2.data.length = 0;
  70053. }
  70054. if (packetFlushable) {
  70055. self2.trigger("data", event2);
  70056. }
  70057. };
  70058. ElementaryStream.prototype.init.call(this);
  70059. this.push = function(data) {
  70060. ({
  70061. pat: function() {
  70062. },
  70063. pes: function() {
  70064. var stream2, streamType;
  70065. switch (data.streamType) {
  70066. case StreamTypes$2.H264_STREAM_TYPE:
  70067. stream2 = video;
  70068. streamType = "video";
  70069. break;
  70070. case StreamTypes$2.ADTS_STREAM_TYPE:
  70071. stream2 = audio;
  70072. streamType = "audio";
  70073. break;
  70074. case StreamTypes$2.METADATA_STREAM_TYPE:
  70075. stream2 = timedMetadata;
  70076. streamType = "timed-metadata";
  70077. break;
  70078. default:
  70079. return;
  70080. }
  70081. if (data.payloadUnitStartIndicator) {
  70082. flushStream(stream2, streamType, true);
  70083. }
  70084. stream2.data.push(data);
  70085. stream2.size += data.data.byteLength;
  70086. },
  70087. pmt: function() {
  70088. var event2 = {
  70089. type: "metadata",
  70090. tracks: []
  70091. };
  70092. programMapTable = data.programMapTable;
  70093. if (programMapTable.video !== null) {
  70094. event2.tracks.push({
  70095. timelineStartInfo: {
  70096. baseMediaDecodeTime: 0
  70097. },
  70098. id: +programMapTable.video,
  70099. codec: "avc",
  70100. type: "video"
  70101. });
  70102. }
  70103. if (programMapTable.audio !== null) {
  70104. event2.tracks.push({
  70105. timelineStartInfo: {
  70106. baseMediaDecodeTime: 0
  70107. },
  70108. id: +programMapTable.audio,
  70109. codec: "adts",
  70110. type: "audio"
  70111. });
  70112. }
  70113. segmentHadPmt = true;
  70114. self2.trigger("data", event2);
  70115. }
  70116. })[data.type]();
  70117. };
  70118. this.reset = function() {
  70119. video.size = 0;
  70120. video.data.length = 0;
  70121. audio.size = 0;
  70122. audio.data.length = 0;
  70123. this.trigger("reset");
  70124. };
  70125. this.flushStreams_ = function() {
  70126. flushStream(video, "video");
  70127. flushStream(audio, "audio");
  70128. flushStream(timedMetadata, "timed-metadata");
  70129. };
  70130. this.flush = function() {
  70131. if (!segmentHadPmt && programMapTable) {
  70132. var pmt = {
  70133. type: "metadata",
  70134. tracks: []
  70135. };
  70136. if (programMapTable.video !== null) {
  70137. pmt.tracks.push({
  70138. timelineStartInfo: {
  70139. baseMediaDecodeTime: 0
  70140. },
  70141. id: +programMapTable.video,
  70142. codec: "avc",
  70143. type: "video"
  70144. });
  70145. }
  70146. if (programMapTable.audio !== null) {
  70147. pmt.tracks.push({
  70148. timelineStartInfo: {
  70149. baseMediaDecodeTime: 0
  70150. },
  70151. id: +programMapTable.audio,
  70152. codec: "adts",
  70153. type: "audio"
  70154. });
  70155. }
  70156. self2.trigger("data", pmt);
  70157. }
  70158. segmentHadPmt = false;
  70159. this.flushStreams_();
  70160. this.trigger("done");
  70161. };
  70162. };
  70163. ElementaryStream.prototype = new Stream$4();
  70164. var m2ts$1 = {
  70165. PAT_PID: 0,
  70166. MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH$1,
  70167. TransportPacketStream,
  70168. TransportParseStream,
  70169. ElementaryStream,
  70170. TimestampRolloverStream,
  70171. CaptionStream: CaptionStream$1.CaptionStream,
  70172. Cea608Stream: CaptionStream$1.Cea608Stream,
  70173. Cea708Stream: CaptionStream$1.Cea708Stream,
  70174. MetadataStream: metadataStream
  70175. };
  70176. for (var type2 in StreamTypes$2) {
  70177. if (StreamTypes$2.hasOwnProperty(type2)) {
  70178. m2ts$1[type2] = StreamTypes$2[type2];
  70179. }
  70180. }
  70181. var m2ts_1 = m2ts$1;
  70182. var Stream$3 = stream;
  70183. var ONE_SECOND_IN_TS$2 = clock$2.ONE_SECOND_IN_TS;
  70184. var AdtsStream$1;
  70185. var ADTS_SAMPLING_FREQUENCIES$1 = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
  70186. AdtsStream$1 = function(handlePartialSegments) {
  70187. var buffer, frameNum = 0;
  70188. AdtsStream$1.prototype.init.call(this);
  70189. this.skipWarn_ = function(start2, end) {
  70190. this.trigger("log", {
  70191. level: "warn",
  70192. message: `adts skiping bytes ${start2} to ${end} in frame ${frameNum} outside syncword`
  70193. });
  70194. };
  70195. this.push = function(packet) {
  70196. var i2 = 0, frameLength, protectionSkipBytes, oldBuffer, sampleCount, adtsFrameDuration;
  70197. if (!handlePartialSegments) {
  70198. frameNum = 0;
  70199. }
  70200. if (packet.type !== "audio") {
  70201. return;
  70202. }
  70203. if (buffer && buffer.length) {
  70204. oldBuffer = buffer;
  70205. buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength);
  70206. buffer.set(oldBuffer);
  70207. buffer.set(packet.data, oldBuffer.byteLength);
  70208. } else {
  70209. buffer = packet.data;
  70210. }
  70211. var skip;
  70212. while (i2 + 7 < buffer.length) {
  70213. if (buffer[i2] !== 255 || (buffer[i2 + 1] & 246) !== 240) {
  70214. if (typeof skip !== "number") {
  70215. skip = i2;
  70216. }
  70217. i2++;
  70218. continue;
  70219. }
  70220. if (typeof skip === "number") {
  70221. this.skipWarn_(skip, i2);
  70222. skip = null;
  70223. }
  70224. protectionSkipBytes = (~buffer[i2 + 1] & 1) * 2;
  70225. frameLength = (buffer[i2 + 3] & 3) << 11 | buffer[i2 + 4] << 3 | (buffer[i2 + 5] & 224) >> 5;
  70226. sampleCount = ((buffer[i2 + 6] & 3) + 1) * 1024;
  70227. adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS$2 / ADTS_SAMPLING_FREQUENCIES$1[(buffer[i2 + 2] & 60) >>> 2];
  70228. if (buffer.byteLength - i2 < frameLength) {
  70229. break;
  70230. }
  70231. this.trigger("data", {
  70232. pts: packet.pts + frameNum * adtsFrameDuration,
  70233. dts: packet.dts + frameNum * adtsFrameDuration,
  70234. sampleCount,
  70235. audioobjecttype: (buffer[i2 + 2] >>> 6 & 3) + 1,
  70236. channelcount: (buffer[i2 + 2] & 1) << 2 | (buffer[i2 + 3] & 192) >>> 6,
  70237. samplerate: ADTS_SAMPLING_FREQUENCIES$1[(buffer[i2 + 2] & 60) >>> 2],
  70238. samplingfrequencyindex: (buffer[i2 + 2] & 60) >>> 2,
  70239. samplesize: 16,
  70240. data: buffer.subarray(i2 + 7 + protectionSkipBytes, i2 + frameLength)
  70241. });
  70242. frameNum++;
  70243. i2 += frameLength;
  70244. }
  70245. if (typeof skip === "number") {
  70246. this.skipWarn_(skip, i2);
  70247. skip = null;
  70248. }
  70249. buffer = buffer.subarray(i2);
  70250. };
  70251. this.flush = function() {
  70252. frameNum = 0;
  70253. this.trigger("done");
  70254. };
  70255. this.reset = function() {
  70256. buffer = void 0;
  70257. this.trigger("reset");
  70258. };
  70259. this.endTimeline = function() {
  70260. buffer = void 0;
  70261. this.trigger("endedtimeline");
  70262. };
  70263. };
  70264. AdtsStream$1.prototype = new Stream$3();
  70265. var adts = AdtsStream$1;
  70266. var ExpGolomb$1;
  70267. ExpGolomb$1 = function(workingData) {
  70268. var workingBytesAvailable = workingData.byteLength, workingWord = 0, workingBitsAvailable = 0;
  70269. this.length = function() {
  70270. return 8 * workingBytesAvailable;
  70271. };
  70272. this.bitsAvailable = function() {
  70273. return 8 * workingBytesAvailable + workingBitsAvailable;
  70274. };
  70275. this.loadWord = function() {
  70276. var position2 = workingData.byteLength - workingBytesAvailable, workingBytes = new Uint8Array(4), availableBytes = Math.min(4, workingBytesAvailable);
  70277. if (availableBytes === 0) {
  70278. throw new Error("no bytes available");
  70279. }
  70280. workingBytes.set(workingData.subarray(position2, position2 + availableBytes));
  70281. workingWord = new DataView(workingBytes.buffer).getUint32(0);
  70282. workingBitsAvailable = availableBytes * 8;
  70283. workingBytesAvailable -= availableBytes;
  70284. };
  70285. this.skipBits = function(count) {
  70286. var skipBytes;
  70287. if (workingBitsAvailable > count) {
  70288. workingWord <<= count;
  70289. workingBitsAvailable -= count;
  70290. } else {
  70291. count -= workingBitsAvailable;
  70292. skipBytes = Math.floor(count / 8);
  70293. count -= skipBytes * 8;
  70294. workingBytesAvailable -= skipBytes;
  70295. this.loadWord();
  70296. workingWord <<= count;
  70297. workingBitsAvailable -= count;
  70298. }
  70299. };
  70300. this.readBits = function(size) {
  70301. var bits = Math.min(workingBitsAvailable, size), valu = workingWord >>> 32 - bits;
  70302. workingBitsAvailable -= bits;
  70303. if (workingBitsAvailable > 0) {
  70304. workingWord <<= bits;
  70305. } else if (workingBytesAvailable > 0) {
  70306. this.loadWord();
  70307. }
  70308. bits = size - bits;
  70309. if (bits > 0) {
  70310. return valu << bits | this.readBits(bits);
  70311. }
  70312. return valu;
  70313. };
  70314. this.skipLeadingZeros = function() {
  70315. var leadingZeroCount;
  70316. for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) {
  70317. if ((workingWord & 2147483648 >>> leadingZeroCount) !== 0) {
  70318. workingWord <<= leadingZeroCount;
  70319. workingBitsAvailable -= leadingZeroCount;
  70320. return leadingZeroCount;
  70321. }
  70322. }
  70323. this.loadWord();
  70324. return leadingZeroCount + this.skipLeadingZeros();
  70325. };
  70326. this.skipUnsignedExpGolomb = function() {
  70327. this.skipBits(1 + this.skipLeadingZeros());
  70328. };
  70329. this.skipExpGolomb = function() {
  70330. this.skipBits(1 + this.skipLeadingZeros());
  70331. };
  70332. this.readUnsignedExpGolomb = function() {
  70333. var clz = this.skipLeadingZeros();
  70334. return this.readBits(clz + 1) - 1;
  70335. };
  70336. this.readExpGolomb = function() {
  70337. var valu = this.readUnsignedExpGolomb();
  70338. if (1 & valu) {
  70339. return 1 + valu >>> 1;
  70340. }
  70341. return -1 * (valu >>> 1);
  70342. };
  70343. this.readBoolean = function() {
  70344. return this.readBits(1) === 1;
  70345. };
  70346. this.readUnsignedByte = function() {
  70347. return this.readBits(8);
  70348. };
  70349. this.loadWord();
  70350. };
  70351. var expGolomb = ExpGolomb$1;
  70352. var Stream$2 = stream;
  70353. var ExpGolomb = expGolomb;
  70354. var H264Stream$1, NalByteStream;
  70355. var PROFILES_WITH_OPTIONAL_SPS_DATA;
  70356. NalByteStream = function() {
  70357. var syncPoint = 0, i2, buffer;
  70358. NalByteStream.prototype.init.call(this);
  70359. this.push = function(data) {
  70360. var swapBuffer;
  70361. if (!buffer) {
  70362. buffer = data.data;
  70363. } else {
  70364. swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength);
  70365. swapBuffer.set(buffer);
  70366. swapBuffer.set(data.data, buffer.byteLength);
  70367. buffer = swapBuffer;
  70368. }
  70369. var len = buffer.byteLength;
  70370. for (; syncPoint < len - 3; syncPoint++) {
  70371. if (buffer[syncPoint + 2] === 1) {
  70372. i2 = syncPoint + 5;
  70373. break;
  70374. }
  70375. }
  70376. while (i2 < len) {
  70377. switch (buffer[i2]) {
  70378. case 0:
  70379. if (buffer[i2 - 1] !== 0) {
  70380. i2 += 2;
  70381. break;
  70382. } else if (buffer[i2 - 2] !== 0) {
  70383. i2++;
  70384. break;
  70385. }
  70386. if (syncPoint + 3 !== i2 - 2) {
  70387. this.trigger("data", buffer.subarray(syncPoint + 3, i2 - 2));
  70388. }
  70389. do {
  70390. i2++;
  70391. } while (buffer[i2] !== 1 && i2 < len);
  70392. syncPoint = i2 - 2;
  70393. i2 += 3;
  70394. break;
  70395. case 1:
  70396. if (buffer[i2 - 1] !== 0 || buffer[i2 - 2] !== 0) {
  70397. i2 += 3;
  70398. break;
  70399. }
  70400. this.trigger("data", buffer.subarray(syncPoint + 3, i2 - 2));
  70401. syncPoint = i2 - 2;
  70402. i2 += 3;
  70403. break;
  70404. default:
  70405. i2 += 3;
  70406. break;
  70407. }
  70408. }
  70409. buffer = buffer.subarray(syncPoint);
  70410. i2 -= syncPoint;
  70411. syncPoint = 0;
  70412. };
  70413. this.reset = function() {
  70414. buffer = null;
  70415. syncPoint = 0;
  70416. this.trigger("reset");
  70417. };
  70418. this.flush = function() {
  70419. if (buffer && buffer.byteLength > 3) {
  70420. this.trigger("data", buffer.subarray(syncPoint + 3));
  70421. }
  70422. buffer = null;
  70423. syncPoint = 0;
  70424. this.trigger("done");
  70425. };
  70426. this.endTimeline = function() {
  70427. this.flush();
  70428. this.trigger("endedtimeline");
  70429. };
  70430. };
  70431. NalByteStream.prototype = new Stream$2();
  70432. PROFILES_WITH_OPTIONAL_SPS_DATA = {
  70433. 100: true,
  70434. 110: true,
  70435. 122: true,
  70436. 244: true,
  70437. 44: true,
  70438. 83: true,
  70439. 86: true,
  70440. 118: true,
  70441. 128: true,
  70442. 138: true,
  70443. 139: true,
  70444. 134: true
  70445. };
  70446. H264Stream$1 = function() {
  70447. var nalByteStream = new NalByteStream(), self2, trackId, currentPts, currentDts, discardEmulationPreventionBytes5, readSequenceParameterSet, skipScalingList;
  70448. H264Stream$1.prototype.init.call(this);
  70449. self2 = this;
  70450. this.push = function(packet) {
  70451. if (packet.type !== "video") {
  70452. return;
  70453. }
  70454. trackId = packet.trackId;
  70455. currentPts = packet.pts;
  70456. currentDts = packet.dts;
  70457. nalByteStream.push(packet);
  70458. };
  70459. nalByteStream.on("data", function(data) {
  70460. var event2 = {
  70461. trackId,
  70462. pts: currentPts,
  70463. dts: currentDts,
  70464. data,
  70465. nalUnitTypeCode: data[0] & 31
  70466. };
  70467. switch (event2.nalUnitTypeCode) {
  70468. case 5:
  70469. event2.nalUnitType = "slice_layer_without_partitioning_rbsp_idr";
  70470. break;
  70471. case 6:
  70472. event2.nalUnitType = "sei_rbsp";
  70473. event2.escapedRBSP = discardEmulationPreventionBytes5(data.subarray(1));
  70474. break;
  70475. case 7:
  70476. event2.nalUnitType = "seq_parameter_set_rbsp";
  70477. event2.escapedRBSP = discardEmulationPreventionBytes5(data.subarray(1));
  70478. event2.config = readSequenceParameterSet(event2.escapedRBSP);
  70479. break;
  70480. case 8:
  70481. event2.nalUnitType = "pic_parameter_set_rbsp";
  70482. break;
  70483. case 9:
  70484. event2.nalUnitType = "access_unit_delimiter_rbsp";
  70485. break;
  70486. }
  70487. self2.trigger("data", event2);
  70488. });
  70489. nalByteStream.on("done", function() {
  70490. self2.trigger("done");
  70491. });
  70492. nalByteStream.on("partialdone", function() {
  70493. self2.trigger("partialdone");
  70494. });
  70495. nalByteStream.on("reset", function() {
  70496. self2.trigger("reset");
  70497. });
  70498. nalByteStream.on("endedtimeline", function() {
  70499. self2.trigger("endedtimeline");
  70500. });
  70501. this.flush = function() {
  70502. nalByteStream.flush();
  70503. };
  70504. this.partialFlush = function() {
  70505. nalByteStream.partialFlush();
  70506. };
  70507. this.reset = function() {
  70508. nalByteStream.reset();
  70509. };
  70510. this.endTimeline = function() {
  70511. nalByteStream.endTimeline();
  70512. };
  70513. skipScalingList = function(count, expGolombDecoder) {
  70514. var lastScale = 8, nextScale = 8, j, deltaScale;
  70515. for (j = 0; j < count; j++) {
  70516. if (nextScale !== 0) {
  70517. deltaScale = expGolombDecoder.readExpGolomb();
  70518. nextScale = (lastScale + deltaScale + 256) % 256;
  70519. }
  70520. lastScale = nextScale === 0 ? lastScale : nextScale;
  70521. }
  70522. };
  70523. discardEmulationPreventionBytes5 = function(data) {
  70524. var length = data.byteLength, emulationPreventionBytesPositions = [], i2 = 1, newLength, newData;
  70525. while (i2 < length - 2) {
  70526. if (data[i2] === 0 && data[i2 + 1] === 0 && data[i2 + 2] === 3) {
  70527. emulationPreventionBytesPositions.push(i2 + 2);
  70528. i2 += 2;
  70529. } else {
  70530. i2++;
  70531. }
  70532. }
  70533. if (emulationPreventionBytesPositions.length === 0) {
  70534. return data;
  70535. }
  70536. newLength = length - emulationPreventionBytesPositions.length;
  70537. newData = new Uint8Array(newLength);
  70538. var sourceIndex = 0;
  70539. for (i2 = 0; i2 < newLength; sourceIndex++, i2++) {
  70540. if (sourceIndex === emulationPreventionBytesPositions[0]) {
  70541. sourceIndex++;
  70542. emulationPreventionBytesPositions.shift();
  70543. }
  70544. newData[i2] = data[sourceIndex];
  70545. }
  70546. return newData;
  70547. };
  70548. readSequenceParameterSet = function(data) {
  70549. var frameCropLeftOffset = 0, frameCropRightOffset = 0, frameCropTopOffset = 0, frameCropBottomOffset = 0, expGolombDecoder, profileIdc, levelIdc, profileCompatibility, chromaFormatIdc, picOrderCntType, numRefFramesInPicOrderCntCycle, picWidthInMbsMinus1, picHeightInMapUnitsMinus1, frameMbsOnlyFlag, scalingListCount, sarRatio = [1, 1], aspectRatioIdc, i2;
  70550. expGolombDecoder = new ExpGolomb(data);
  70551. profileIdc = expGolombDecoder.readUnsignedByte();
  70552. profileCompatibility = expGolombDecoder.readUnsignedByte();
  70553. levelIdc = expGolombDecoder.readUnsignedByte();
  70554. expGolombDecoder.skipUnsignedExpGolomb();
  70555. if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) {
  70556. chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb();
  70557. if (chromaFormatIdc === 3) {
  70558. expGolombDecoder.skipBits(1);
  70559. }
  70560. expGolombDecoder.skipUnsignedExpGolomb();
  70561. expGolombDecoder.skipUnsignedExpGolomb();
  70562. expGolombDecoder.skipBits(1);
  70563. if (expGolombDecoder.readBoolean()) {
  70564. scalingListCount = chromaFormatIdc !== 3 ? 8 : 12;
  70565. for (i2 = 0; i2 < scalingListCount; i2++) {
  70566. if (expGolombDecoder.readBoolean()) {
  70567. if (i2 < 6) {
  70568. skipScalingList(16, expGolombDecoder);
  70569. } else {
  70570. skipScalingList(64, expGolombDecoder);
  70571. }
  70572. }
  70573. }
  70574. }
  70575. }
  70576. expGolombDecoder.skipUnsignedExpGolomb();
  70577. picOrderCntType = expGolombDecoder.readUnsignedExpGolomb();
  70578. if (picOrderCntType === 0) {
  70579. expGolombDecoder.readUnsignedExpGolomb();
  70580. } else if (picOrderCntType === 1) {
  70581. expGolombDecoder.skipBits(1);
  70582. expGolombDecoder.skipExpGolomb();
  70583. expGolombDecoder.skipExpGolomb();
  70584. numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb();
  70585. for (i2 = 0; i2 < numRefFramesInPicOrderCntCycle; i2++) {
  70586. expGolombDecoder.skipExpGolomb();
  70587. }
  70588. }
  70589. expGolombDecoder.skipUnsignedExpGolomb();
  70590. expGolombDecoder.skipBits(1);
  70591. picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb();
  70592. picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb();
  70593. frameMbsOnlyFlag = expGolombDecoder.readBits(1);
  70594. if (frameMbsOnlyFlag === 0) {
  70595. expGolombDecoder.skipBits(1);
  70596. }
  70597. expGolombDecoder.skipBits(1);
  70598. if (expGolombDecoder.readBoolean()) {
  70599. frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb();
  70600. frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb();
  70601. frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb();
  70602. frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb();
  70603. }
  70604. if (expGolombDecoder.readBoolean()) {
  70605. if (expGolombDecoder.readBoolean()) {
  70606. aspectRatioIdc = expGolombDecoder.readUnsignedByte();
  70607. switch (aspectRatioIdc) {
  70608. case 1:
  70609. sarRatio = [1, 1];
  70610. break;
  70611. case 2:
  70612. sarRatio = [12, 11];
  70613. break;
  70614. case 3:
  70615. sarRatio = [10, 11];
  70616. break;
  70617. case 4:
  70618. sarRatio = [16, 11];
  70619. break;
  70620. case 5:
  70621. sarRatio = [40, 33];
  70622. break;
  70623. case 6:
  70624. sarRatio = [24, 11];
  70625. break;
  70626. case 7:
  70627. sarRatio = [20, 11];
  70628. break;
  70629. case 8:
  70630. sarRatio = [32, 11];
  70631. break;
  70632. case 9:
  70633. sarRatio = [80, 33];
  70634. break;
  70635. case 10:
  70636. sarRatio = [18, 11];
  70637. break;
  70638. case 11:
  70639. sarRatio = [15, 11];
  70640. break;
  70641. case 12:
  70642. sarRatio = [64, 33];
  70643. break;
  70644. case 13:
  70645. sarRatio = [160, 99];
  70646. break;
  70647. case 14:
  70648. sarRatio = [4, 3];
  70649. break;
  70650. case 15:
  70651. sarRatio = [3, 2];
  70652. break;
  70653. case 16:
  70654. sarRatio = [2, 1];
  70655. break;
  70656. case 255: {
  70657. sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()];
  70658. break;
  70659. }
  70660. }
  70661. if (sarRatio) {
  70662. sarRatio[0] / sarRatio[1];
  70663. }
  70664. }
  70665. }
  70666. return {
  70667. profileIdc,
  70668. levelIdc,
  70669. profileCompatibility,
  70670. width: (picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2,
  70671. height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2,
  70672. sarRatio
  70673. };
  70674. };
  70675. };
  70676. H264Stream$1.prototype = new Stream$2();
  70677. var h2643 = {
  70678. H264Stream: H264Stream$1,
  70679. NalByteStream
  70680. };
  70681. var ADTS_SAMPLING_FREQUENCIES = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
  70682. var parseId3TagSize = function(header, byteIndex) {
  70683. var returnSize = header[byteIndex + 6] << 21 | header[byteIndex + 7] << 14 | header[byteIndex + 8] << 7 | header[byteIndex + 9], flags = header[byteIndex + 5], footerPresent = (flags & 16) >> 4;
  70684. returnSize = returnSize >= 0 ? returnSize : 0;
  70685. if (footerPresent) {
  70686. return returnSize + 20;
  70687. }
  70688. return returnSize + 10;
  70689. };
  70690. var getId3Offset4 = function(data, offset) {
  70691. if (data.length - offset < 10 || data[offset] !== "I".charCodeAt(0) || data[offset + 1] !== "D".charCodeAt(0) || data[offset + 2] !== "3".charCodeAt(0)) {
  70692. return offset;
  70693. }
  70694. offset += parseId3TagSize(data, offset);
  70695. return getId3Offset4(data, offset);
  70696. };
  70697. var isLikelyAacData$1 = function(data) {
  70698. var offset = getId3Offset4(data, 0);
  70699. return data.length >= offset + 2 && (data[offset] & 255) === 255 && (data[offset + 1] & 240) === 240 && (data[offset + 1] & 22) === 16;
  70700. };
  70701. var parseSyncSafeInteger = function(data) {
  70702. return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3];
  70703. };
  70704. var percentEncode = function(bytes, start2, end) {
  70705. var i2, result = "";
  70706. for (i2 = start2; i2 < end; i2++) {
  70707. result += "%" + ("00" + bytes[i2].toString(16)).slice(-2);
  70708. }
  70709. return result;
  70710. };
  70711. var parseIso88591 = function(bytes, start2, end) {
  70712. return unescape(percentEncode(bytes, start2, end));
  70713. };
  70714. var parseAdtsSize = function(header, byteIndex) {
  70715. var lowThree = (header[byteIndex + 5] & 224) >> 5, middle = header[byteIndex + 4] << 3, highTwo = header[byteIndex + 3] & 3 << 11;
  70716. return highTwo | middle | lowThree;
  70717. };
  70718. var parseType$4 = function(header, byteIndex) {
  70719. if (header[byteIndex] === "I".charCodeAt(0) && header[byteIndex + 1] === "D".charCodeAt(0) && header[byteIndex + 2] === "3".charCodeAt(0)) {
  70720. return "timed-metadata";
  70721. } else if (header[byteIndex] & true && (header[byteIndex + 1] & 240) === 240) {
  70722. return "audio";
  70723. }
  70724. return null;
  70725. };
  70726. var parseSampleRate = function(packet) {
  70727. var i2 = 0;
  70728. while (i2 + 5 < packet.length) {
  70729. if (packet[i2] !== 255 || (packet[i2 + 1] & 246) !== 240) {
  70730. i2++;
  70731. continue;
  70732. }
  70733. return ADTS_SAMPLING_FREQUENCIES[(packet[i2 + 2] & 60) >>> 2];
  70734. }
  70735. return null;
  70736. };
  70737. var parseAacTimestamp = function(packet) {
  70738. var frameStart, frameSize, frame, frameHeader;
  70739. frameStart = 10;
  70740. if (packet[5] & 64) {
  70741. frameStart += 4;
  70742. frameStart += parseSyncSafeInteger(packet.subarray(10, 14));
  70743. }
  70744. do {
  70745. frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8));
  70746. if (frameSize < 1) {
  70747. return null;
  70748. }
  70749. frameHeader = String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3]);
  70750. if (frameHeader === "PRIV") {
  70751. frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10);
  70752. for (var i2 = 0; i2 < frame.byteLength; i2++) {
  70753. if (frame[i2] === 0) {
  70754. var owner = parseIso88591(frame, 0, i2);
  70755. if (owner === "com.apple.streaming.transportStreamTimestamp") {
  70756. var d2 = frame.subarray(i2 + 1);
  70757. var size = (d2[3] & 1) << 30 | d2[4] << 22 | d2[5] << 14 | d2[6] << 6 | d2[7] >>> 2;
  70758. size *= 4;
  70759. size += d2[7] & 3;
  70760. return size;
  70761. }
  70762. break;
  70763. }
  70764. }
  70765. }
  70766. frameStart += 10;
  70767. frameStart += frameSize;
  70768. } while (frameStart < packet.byteLength);
  70769. return null;
  70770. };
  70771. var utils2 = {
  70772. isLikelyAacData: isLikelyAacData$1,
  70773. parseId3TagSize,
  70774. parseAdtsSize,
  70775. parseType: parseType$4,
  70776. parseSampleRate,
  70777. parseAacTimestamp
  70778. };
  70779. var Stream$12 = stream;
  70780. var aacUtils = utils2;
  70781. var AacStream$1;
  70782. AacStream$1 = function() {
  70783. var everything = new Uint8Array(), timeStamp = 0;
  70784. AacStream$1.prototype.init.call(this);
  70785. this.setTimestamp = function(timestamp) {
  70786. timeStamp = timestamp;
  70787. };
  70788. this.push = function(bytes) {
  70789. var frameSize = 0, byteIndex = 0, bytesLeft, chunk, packet, tempLength;
  70790. if (everything.length) {
  70791. tempLength = everything.length;
  70792. everything = new Uint8Array(bytes.byteLength + tempLength);
  70793. everything.set(everything.subarray(0, tempLength));
  70794. everything.set(bytes, tempLength);
  70795. } else {
  70796. everything = bytes;
  70797. }
  70798. while (everything.length - byteIndex >= 3) {
  70799. if (everything[byteIndex] === "I".charCodeAt(0) && everything[byteIndex + 1] === "D".charCodeAt(0) && everything[byteIndex + 2] === "3".charCodeAt(0)) {
  70800. if (everything.length - byteIndex < 10) {
  70801. break;
  70802. }
  70803. frameSize = aacUtils.parseId3TagSize(everything, byteIndex);
  70804. if (byteIndex + frameSize > everything.length) {
  70805. break;
  70806. }
  70807. chunk = {
  70808. type: "timed-metadata",
  70809. data: everything.subarray(byteIndex, byteIndex + frameSize)
  70810. };
  70811. this.trigger("data", chunk);
  70812. byteIndex += frameSize;
  70813. continue;
  70814. } else if ((everything[byteIndex] & 255) === 255 && (everything[byteIndex + 1] & 240) === 240) {
  70815. if (everything.length - byteIndex < 7) {
  70816. break;
  70817. }
  70818. frameSize = aacUtils.parseAdtsSize(everything, byteIndex);
  70819. if (byteIndex + frameSize > everything.length) {
  70820. break;
  70821. }
  70822. packet = {
  70823. type: "audio",
  70824. data: everything.subarray(byteIndex, byteIndex + frameSize),
  70825. pts: timeStamp,
  70826. dts: timeStamp
  70827. };
  70828. this.trigger("data", packet);
  70829. byteIndex += frameSize;
  70830. continue;
  70831. }
  70832. byteIndex++;
  70833. }
  70834. bytesLeft = everything.length - byteIndex;
  70835. if (bytesLeft > 0) {
  70836. everything = everything.subarray(byteIndex);
  70837. } else {
  70838. everything = new Uint8Array();
  70839. }
  70840. };
  70841. this.reset = function() {
  70842. everything = new Uint8Array();
  70843. this.trigger("reset");
  70844. };
  70845. this.endTimeline = function() {
  70846. everything = new Uint8Array();
  70847. this.trigger("endedtimeline");
  70848. };
  70849. };
  70850. AacStream$1.prototype = new Stream$12();
  70851. var aac3 = AacStream$1;
  70852. var AUDIO_PROPERTIES$1 = ["audioobjecttype", "channelcount", "samplerate", "samplingfrequencyindex", "samplesize"];
  70853. var audioProperties = AUDIO_PROPERTIES$1;
  70854. var VIDEO_PROPERTIES$1 = ["width", "height", "profileIdc", "levelIdc", "profileCompatibility", "sarRatio"];
  70855. var videoProperties = VIDEO_PROPERTIES$1;
  70856. var Stream2 = stream;
  70857. var mp43 = mp4Generator;
  70858. var frameUtils = frameUtils$1;
  70859. var audioFrameUtils = audioFrameUtils$1;
  70860. var trackDecodeInfo = trackDecodeInfo$1;
  70861. var m2ts = m2ts_1;
  70862. var clock2 = clock$2;
  70863. var AdtsStream = adts;
  70864. var H264Stream = h2643.H264Stream;
  70865. var AacStream = aac3;
  70866. var isLikelyAacData = utils2.isLikelyAacData;
  70867. var ONE_SECOND_IN_TS$12 = clock$2.ONE_SECOND_IN_TS;
  70868. var AUDIO_PROPERTIES = audioProperties;
  70869. var VIDEO_PROPERTIES = videoProperties;
  70870. var VideoSegmentStream, AudioSegmentStream, Transmuxer, CoalesceStream;
  70871. var retriggerForStream = function(key, event2) {
  70872. event2.stream = key;
  70873. this.trigger("log", event2);
  70874. };
  70875. var addPipelineLogRetriggers = function(transmuxer2, pipeline) {
  70876. var keys3 = Object.keys(pipeline);
  70877. for (var i2 = 0; i2 < keys3.length; i2++) {
  70878. var key = keys3[i2];
  70879. if (key === "headOfPipeline" || !pipeline[key].on) {
  70880. continue;
  70881. }
  70882. pipeline[key].on("log", retriggerForStream.bind(transmuxer2, key));
  70883. }
  70884. };
  70885. var arrayEquals = function(a, b) {
  70886. var i2;
  70887. if (a.length !== b.length) {
  70888. return false;
  70889. }
  70890. for (i2 = 0; i2 < a.length; i2++) {
  70891. if (a[i2] !== b[i2]) {
  70892. return false;
  70893. }
  70894. }
  70895. return true;
  70896. };
  70897. var generateSegmentTimingInfo = function(baseMediaDecodeTime, startDts, startPts, endDts, endPts, prependedContentDuration) {
  70898. var ptsOffsetFromDts = startPts - startDts, decodeDuration = endDts - startDts, presentationDuration = endPts - startPts;
  70899. return {
  70900. start: {
  70901. dts: baseMediaDecodeTime,
  70902. pts: baseMediaDecodeTime + ptsOffsetFromDts
  70903. },
  70904. end: {
  70905. dts: baseMediaDecodeTime + decodeDuration,
  70906. pts: baseMediaDecodeTime + presentationDuration
  70907. },
  70908. prependedContentDuration,
  70909. baseMediaDecodeTime
  70910. };
  70911. };
  70912. AudioSegmentStream = function(track, options2) {
  70913. var adtsFrames = [], sequenceNumber, earliestAllowedDts = 0, audioAppendStartTs = 0, videoBaseMediaDecodeTime = Infinity;
  70914. options2 = options2 || {};
  70915. sequenceNumber = options2.firstSequenceNumber || 0;
  70916. AudioSegmentStream.prototype.init.call(this);
  70917. this.push = function(data) {
  70918. trackDecodeInfo.collectDtsInfo(track, data);
  70919. if (track) {
  70920. AUDIO_PROPERTIES.forEach(function(prop) {
  70921. track[prop] = data[prop];
  70922. });
  70923. }
  70924. adtsFrames.push(data);
  70925. };
  70926. this.setEarliestDts = function(earliestDts) {
  70927. earliestAllowedDts = earliestDts;
  70928. };
  70929. this.setVideoBaseMediaDecodeTime = function(baseMediaDecodeTime) {
  70930. videoBaseMediaDecodeTime = baseMediaDecodeTime;
  70931. };
  70932. this.setAudioAppendStart = function(timestamp) {
  70933. audioAppendStartTs = timestamp;
  70934. };
  70935. this.flush = function() {
  70936. var frames, moof2, mdat2, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed;
  70937. if (adtsFrames.length === 0) {
  70938. this.trigger("done", "AudioSegmentStream");
  70939. return;
  70940. }
  70941. frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts);
  70942. track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options2.keepOriginalTimestamps);
  70943. videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime);
  70944. track.samples = audioFrameUtils.generateSampleTable(frames);
  70945. mdat2 = mp43.mdat(audioFrameUtils.concatenateFrameData(frames));
  70946. adtsFrames = [];
  70947. moof2 = mp43.moof(sequenceNumber, [track]);
  70948. boxes = new Uint8Array(moof2.byteLength + mdat2.byteLength);
  70949. sequenceNumber++;
  70950. boxes.set(moof2);
  70951. boxes.set(mdat2, moof2.byteLength);
  70952. trackDecodeInfo.clearDtsInfo(track);
  70953. frameDuration = Math.ceil(ONE_SECOND_IN_TS$12 * 1024 / track.samplerate);
  70954. if (frames.length) {
  70955. segmentDuration = frames.length * frameDuration;
  70956. this.trigger("segmentTimingInfo", generateSegmentTimingInfo(
  70957. clock2.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate),
  70958. frames[0].dts,
  70959. frames[0].pts,
  70960. frames[0].dts + segmentDuration,
  70961. frames[0].pts + segmentDuration,
  70962. videoClockCyclesOfSilencePrefixed || 0
  70963. ));
  70964. this.trigger("timingInfo", {
  70965. start: frames[0].pts,
  70966. end: frames[0].pts + segmentDuration
  70967. });
  70968. }
  70969. this.trigger("data", {
  70970. track,
  70971. boxes
  70972. });
  70973. this.trigger("done", "AudioSegmentStream");
  70974. };
  70975. this.reset = function() {
  70976. trackDecodeInfo.clearDtsInfo(track);
  70977. adtsFrames = [];
  70978. this.trigger("reset");
  70979. };
  70980. };
  70981. AudioSegmentStream.prototype = new Stream2();
  70982. VideoSegmentStream = function(track, options2) {
  70983. var sequenceNumber, nalUnits = [], gopsToAlignWith = [], config, pps;
  70984. options2 = options2 || {};
  70985. sequenceNumber = options2.firstSequenceNumber || 0;
  70986. VideoSegmentStream.prototype.init.call(this);
  70987. delete track.minPTS;
  70988. this.gopCache_ = [];
  70989. this.push = function(nalUnit) {
  70990. trackDecodeInfo.collectDtsInfo(track, nalUnit);
  70991. if (nalUnit.nalUnitType === "seq_parameter_set_rbsp" && !config) {
  70992. config = nalUnit.config;
  70993. track.sps = [nalUnit.data];
  70994. VIDEO_PROPERTIES.forEach(function(prop) {
  70995. track[prop] = config[prop];
  70996. }, this);
  70997. }
  70998. if (nalUnit.nalUnitType === "pic_parameter_set_rbsp" && !pps) {
  70999. pps = nalUnit.data;
  71000. track.pps = [nalUnit.data];
  71001. }
  71002. nalUnits.push(nalUnit);
  71003. };
  71004. this.flush = function() {
  71005. var frames, gopForFusion, gops, moof2, mdat2, boxes, prependedContentDuration = 0, firstGop, lastGop;
  71006. while (nalUnits.length) {
  71007. if (nalUnits[0].nalUnitType === "access_unit_delimiter_rbsp") {
  71008. break;
  71009. }
  71010. nalUnits.shift();
  71011. }
  71012. if (nalUnits.length === 0) {
  71013. this.resetStream_();
  71014. this.trigger("done", "VideoSegmentStream");
  71015. return;
  71016. }
  71017. frames = frameUtils.groupNalsIntoFrames(nalUnits);
  71018. gops = frameUtils.groupFramesIntoGops(frames);
  71019. if (!gops[0][0].keyFrame) {
  71020. gopForFusion = this.getGopForFusion_(nalUnits[0], track);
  71021. if (gopForFusion) {
  71022. prependedContentDuration = gopForFusion.duration;
  71023. gops.unshift(gopForFusion);
  71024. gops.byteLength += gopForFusion.byteLength;
  71025. gops.nalCount += gopForFusion.nalCount;
  71026. gops.pts = gopForFusion.pts;
  71027. gops.dts = gopForFusion.dts;
  71028. gops.duration += gopForFusion.duration;
  71029. } else {
  71030. gops = frameUtils.extendFirstKeyFrame(gops);
  71031. }
  71032. }
  71033. if (gopsToAlignWith.length) {
  71034. var alignedGops;
  71035. if (options2.alignGopsAtEnd) {
  71036. alignedGops = this.alignGopsAtEnd_(gops);
  71037. } else {
  71038. alignedGops = this.alignGopsAtStart_(gops);
  71039. }
  71040. if (!alignedGops) {
  71041. this.gopCache_.unshift({
  71042. gop: gops.pop(),
  71043. pps: track.pps,
  71044. sps: track.sps
  71045. });
  71046. this.gopCache_.length = Math.min(6, this.gopCache_.length);
  71047. nalUnits = [];
  71048. this.resetStream_();
  71049. this.trigger("done", "VideoSegmentStream");
  71050. return;
  71051. }
  71052. trackDecodeInfo.clearDtsInfo(track);
  71053. gops = alignedGops;
  71054. }
  71055. trackDecodeInfo.collectDtsInfo(track, gops);
  71056. track.samples = frameUtils.generateSampleTable(gops);
  71057. mdat2 = mp43.mdat(frameUtils.concatenateNalData(gops));
  71058. track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options2.keepOriginalTimestamps);
  71059. this.trigger("processedGopsInfo", gops.map(function(gop) {
  71060. return {
  71061. pts: gop.pts,
  71062. dts: gop.dts,
  71063. byteLength: gop.byteLength
  71064. };
  71065. }));
  71066. firstGop = gops[0];
  71067. lastGop = gops[gops.length - 1];
  71068. this.trigger("segmentTimingInfo", generateSegmentTimingInfo(track.baseMediaDecodeTime, firstGop.dts, firstGop.pts, lastGop.dts + lastGop.duration, lastGop.pts + lastGop.duration, prependedContentDuration));
  71069. this.trigger("timingInfo", {
  71070. start: gops[0].pts,
  71071. end: gops[gops.length - 1].pts + gops[gops.length - 1].duration
  71072. });
  71073. this.gopCache_.unshift({
  71074. gop: gops.pop(),
  71075. pps: track.pps,
  71076. sps: track.sps
  71077. });
  71078. this.gopCache_.length = Math.min(6, this.gopCache_.length);
  71079. nalUnits = [];
  71080. this.trigger("baseMediaDecodeTime", track.baseMediaDecodeTime);
  71081. this.trigger("timelineStartInfo", track.timelineStartInfo);
  71082. moof2 = mp43.moof(sequenceNumber, [track]);
  71083. boxes = new Uint8Array(moof2.byteLength + mdat2.byteLength);
  71084. sequenceNumber++;
  71085. boxes.set(moof2);
  71086. boxes.set(mdat2, moof2.byteLength);
  71087. this.trigger("data", {
  71088. track,
  71089. boxes
  71090. });
  71091. this.resetStream_();
  71092. this.trigger("done", "VideoSegmentStream");
  71093. };
  71094. this.reset = function() {
  71095. this.resetStream_();
  71096. nalUnits = [];
  71097. this.gopCache_.length = 0;
  71098. gopsToAlignWith.length = 0;
  71099. this.trigger("reset");
  71100. };
  71101. this.resetStream_ = function() {
  71102. trackDecodeInfo.clearDtsInfo(track);
  71103. config = void 0;
  71104. pps = void 0;
  71105. };
  71106. this.getGopForFusion_ = function(nalUnit) {
  71107. var halfSecond = 45e3, allowableOverlap = 1e4, nearestDistance = Infinity, dtsDistance, nearestGopObj, currentGop, currentGopObj, i2;
  71108. for (i2 = 0; i2 < this.gopCache_.length; i2++) {
  71109. currentGopObj = this.gopCache_[i2];
  71110. currentGop = currentGopObj.gop;
  71111. if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) {
  71112. continue;
  71113. }
  71114. if (currentGop.dts < track.timelineStartInfo.dts) {
  71115. continue;
  71116. }
  71117. dtsDistance = nalUnit.dts - currentGop.dts - currentGop.duration;
  71118. if (dtsDistance >= -allowableOverlap && dtsDistance <= halfSecond) {
  71119. if (!nearestGopObj || nearestDistance > dtsDistance) {
  71120. nearestGopObj = currentGopObj;
  71121. nearestDistance = dtsDistance;
  71122. }
  71123. }
  71124. }
  71125. if (nearestGopObj) {
  71126. return nearestGopObj.gop;
  71127. }
  71128. return null;
  71129. };
  71130. this.alignGopsAtStart_ = function(gops) {
  71131. var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration5, alignedGops;
  71132. byteLength = gops.byteLength;
  71133. nalCount = gops.nalCount;
  71134. duration5 = gops.duration;
  71135. alignIndex = gopIndex = 0;
  71136. while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) {
  71137. align = gopsToAlignWith[alignIndex];
  71138. gop = gops[gopIndex];
  71139. if (align.pts === gop.pts) {
  71140. break;
  71141. }
  71142. if (gop.pts > align.pts) {
  71143. alignIndex++;
  71144. continue;
  71145. }
  71146. gopIndex++;
  71147. byteLength -= gop.byteLength;
  71148. nalCount -= gop.nalCount;
  71149. duration5 -= gop.duration;
  71150. }
  71151. if (gopIndex === 0) {
  71152. return gops;
  71153. }
  71154. if (gopIndex === gops.length) {
  71155. return null;
  71156. }
  71157. alignedGops = gops.slice(gopIndex);
  71158. alignedGops.byteLength = byteLength;
  71159. alignedGops.duration = duration5;
  71160. alignedGops.nalCount = nalCount;
  71161. alignedGops.pts = alignedGops[0].pts;
  71162. alignedGops.dts = alignedGops[0].dts;
  71163. return alignedGops;
  71164. };
  71165. this.alignGopsAtEnd_ = function(gops) {
  71166. var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound;
  71167. alignIndex = gopsToAlignWith.length - 1;
  71168. gopIndex = gops.length - 1;
  71169. alignEndIndex = null;
  71170. matchFound = false;
  71171. while (alignIndex >= 0 && gopIndex >= 0) {
  71172. align = gopsToAlignWith[alignIndex];
  71173. gop = gops[gopIndex];
  71174. if (align.pts === gop.pts) {
  71175. matchFound = true;
  71176. break;
  71177. }
  71178. if (align.pts > gop.pts) {
  71179. alignIndex--;
  71180. continue;
  71181. }
  71182. if (alignIndex === gopsToAlignWith.length - 1) {
  71183. alignEndIndex = gopIndex;
  71184. }
  71185. gopIndex--;
  71186. }
  71187. if (!matchFound && alignEndIndex === null) {
  71188. return null;
  71189. }
  71190. var trimIndex;
  71191. if (matchFound) {
  71192. trimIndex = gopIndex;
  71193. } else {
  71194. trimIndex = alignEndIndex;
  71195. }
  71196. if (trimIndex === 0) {
  71197. return gops;
  71198. }
  71199. var alignedGops = gops.slice(trimIndex);
  71200. var metadata = alignedGops.reduce(function(total, gop2) {
  71201. total.byteLength += gop2.byteLength;
  71202. total.duration += gop2.duration;
  71203. total.nalCount += gop2.nalCount;
  71204. return total;
  71205. }, {
  71206. byteLength: 0,
  71207. duration: 0,
  71208. nalCount: 0
  71209. });
  71210. alignedGops.byteLength = metadata.byteLength;
  71211. alignedGops.duration = metadata.duration;
  71212. alignedGops.nalCount = metadata.nalCount;
  71213. alignedGops.pts = alignedGops[0].pts;
  71214. alignedGops.dts = alignedGops[0].dts;
  71215. return alignedGops;
  71216. };
  71217. this.alignGopsWith = function(newGopsToAlignWith) {
  71218. gopsToAlignWith = newGopsToAlignWith;
  71219. };
  71220. };
  71221. VideoSegmentStream.prototype = new Stream2();
  71222. CoalesceStream = function(options2, metadataStream2) {
  71223. this.numberOfTracks = 0;
  71224. this.metadataStream = metadataStream2;
  71225. options2 = options2 || {};
  71226. if (typeof options2.remux !== "undefined") {
  71227. this.remuxTracks = !!options2.remux;
  71228. } else {
  71229. this.remuxTracks = true;
  71230. }
  71231. if (typeof options2.keepOriginalTimestamps === "boolean") {
  71232. this.keepOriginalTimestamps = options2.keepOriginalTimestamps;
  71233. } else {
  71234. this.keepOriginalTimestamps = false;
  71235. }
  71236. this.pendingTracks = [];
  71237. this.videoTrack = null;
  71238. this.pendingBoxes = [];
  71239. this.pendingCaptions = [];
  71240. this.pendingMetadata = [];
  71241. this.pendingBytes = 0;
  71242. this.emittedTracks = 0;
  71243. CoalesceStream.prototype.init.call(this);
  71244. this.push = function(output) {
  71245. if (output.text) {
  71246. return this.pendingCaptions.push(output);
  71247. }
  71248. if (output.frames) {
  71249. return this.pendingMetadata.push(output);
  71250. }
  71251. this.pendingTracks.push(output.track);
  71252. this.pendingBytes += output.boxes.byteLength;
  71253. if (output.track.type === "video") {
  71254. this.videoTrack = output.track;
  71255. this.pendingBoxes.push(output.boxes);
  71256. }
  71257. if (output.track.type === "audio") {
  71258. this.audioTrack = output.track;
  71259. this.pendingBoxes.unshift(output.boxes);
  71260. }
  71261. };
  71262. };
  71263. CoalesceStream.prototype = new Stream2();
  71264. CoalesceStream.prototype.flush = function(flushSource) {
  71265. var offset = 0, event2 = {
  71266. captions: [],
  71267. captionStreams: {},
  71268. metadata: [],
  71269. info: {}
  71270. }, caption, id32, initSegment, timelineStartPts = 0, i2;
  71271. if (this.pendingTracks.length < this.numberOfTracks) {
  71272. if (flushSource !== "VideoSegmentStream" && flushSource !== "AudioSegmentStream") {
  71273. return;
  71274. } else if (this.remuxTracks) {
  71275. return;
  71276. } else if (this.pendingTracks.length === 0) {
  71277. this.emittedTracks++;
  71278. if (this.emittedTracks >= this.numberOfTracks) {
  71279. this.trigger("done");
  71280. this.emittedTracks = 0;
  71281. }
  71282. return;
  71283. }
  71284. }
  71285. if (this.videoTrack) {
  71286. timelineStartPts = this.videoTrack.timelineStartInfo.pts;
  71287. VIDEO_PROPERTIES.forEach(function(prop) {
  71288. event2.info[prop] = this.videoTrack[prop];
  71289. }, this);
  71290. } else if (this.audioTrack) {
  71291. timelineStartPts = this.audioTrack.timelineStartInfo.pts;
  71292. AUDIO_PROPERTIES.forEach(function(prop) {
  71293. event2.info[prop] = this.audioTrack[prop];
  71294. }, this);
  71295. }
  71296. if (this.videoTrack || this.audioTrack) {
  71297. if (this.pendingTracks.length === 1) {
  71298. event2.type = this.pendingTracks[0].type;
  71299. } else {
  71300. event2.type = "combined";
  71301. }
  71302. this.emittedTracks += this.pendingTracks.length;
  71303. initSegment = mp43.initSegment(this.pendingTracks);
  71304. event2.initSegment = new Uint8Array(initSegment.byteLength);
  71305. event2.initSegment.set(initSegment);
  71306. event2.data = new Uint8Array(this.pendingBytes);
  71307. for (i2 = 0; i2 < this.pendingBoxes.length; i2++) {
  71308. event2.data.set(this.pendingBoxes[i2], offset);
  71309. offset += this.pendingBoxes[i2].byteLength;
  71310. }
  71311. for (i2 = 0; i2 < this.pendingCaptions.length; i2++) {
  71312. caption = this.pendingCaptions[i2];
  71313. caption.startTime = clock2.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps);
  71314. caption.endTime = clock2.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps);
  71315. event2.captionStreams[caption.stream] = true;
  71316. event2.captions.push(caption);
  71317. }
  71318. for (i2 = 0; i2 < this.pendingMetadata.length; i2++) {
  71319. id32 = this.pendingMetadata[i2];
  71320. id32.cueTime = clock2.metadataTsToSeconds(id32.pts, timelineStartPts, this.keepOriginalTimestamps);
  71321. event2.metadata.push(id32);
  71322. }
  71323. event2.metadata.dispatchType = this.metadataStream.dispatchType;
  71324. this.pendingTracks.length = 0;
  71325. this.videoTrack = null;
  71326. this.pendingBoxes.length = 0;
  71327. this.pendingCaptions.length = 0;
  71328. this.pendingBytes = 0;
  71329. this.pendingMetadata.length = 0;
  71330. this.trigger("data", event2);
  71331. for (i2 = 0; i2 < event2.captions.length; i2++) {
  71332. caption = event2.captions[i2];
  71333. this.trigger("caption", caption);
  71334. }
  71335. for (i2 = 0; i2 < event2.metadata.length; i2++) {
  71336. id32 = event2.metadata[i2];
  71337. this.trigger("id3Frame", id32);
  71338. }
  71339. }
  71340. if (this.emittedTracks >= this.numberOfTracks) {
  71341. this.trigger("done");
  71342. this.emittedTracks = 0;
  71343. }
  71344. };
  71345. CoalesceStream.prototype.setRemux = function(val) {
  71346. this.remuxTracks = val;
  71347. };
  71348. Transmuxer = function(options2) {
  71349. var self2 = this, hasFlushed = true, videoTrack, audioTrack;
  71350. Transmuxer.prototype.init.call(this);
  71351. options2 = options2 || {};
  71352. this.baseMediaDecodeTime = options2.baseMediaDecodeTime || 0;
  71353. this.transmuxPipeline_ = {};
  71354. this.setupAacPipeline = function() {
  71355. var pipeline = {};
  71356. this.transmuxPipeline_ = pipeline;
  71357. pipeline.type = "aac";
  71358. pipeline.metadataStream = new m2ts.MetadataStream();
  71359. pipeline.aacStream = new AacStream();
  71360. pipeline.audioTimestampRolloverStream = new m2ts.TimestampRolloverStream("audio");
  71361. pipeline.timedMetadataTimestampRolloverStream = new m2ts.TimestampRolloverStream("timed-metadata");
  71362. pipeline.adtsStream = new AdtsStream();
  71363. pipeline.coalesceStream = new CoalesceStream(options2, pipeline.metadataStream);
  71364. pipeline.headOfPipeline = pipeline.aacStream;
  71365. pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream);
  71366. pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream);
  71367. pipeline.metadataStream.on("timestamp", function(frame) {
  71368. pipeline.aacStream.setTimestamp(frame.timeStamp);
  71369. });
  71370. pipeline.aacStream.on("data", function(data) {
  71371. if (data.type !== "timed-metadata" && data.type !== "audio" || pipeline.audioSegmentStream) {
  71372. return;
  71373. }
  71374. audioTrack = audioTrack || {
  71375. timelineStartInfo: {
  71376. baseMediaDecodeTime: self2.baseMediaDecodeTime
  71377. },
  71378. codec: "adts",
  71379. type: "audio"
  71380. };
  71381. pipeline.coalesceStream.numberOfTracks++;
  71382. pipeline.audioSegmentStream = new AudioSegmentStream(audioTrack, options2);
  71383. pipeline.audioSegmentStream.on("log", self2.getLogTrigger_("audioSegmentStream"));
  71384. pipeline.audioSegmentStream.on("timingInfo", self2.trigger.bind(self2, "audioTimingInfo"));
  71385. pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream);
  71386. self2.trigger("trackinfo", {
  71387. hasAudio: !!audioTrack,
  71388. hasVideo: !!videoTrack
  71389. });
  71390. });
  71391. pipeline.coalesceStream.on("data", this.trigger.bind(this, "data"));
  71392. pipeline.coalesceStream.on("done", this.trigger.bind(this, "done"));
  71393. addPipelineLogRetriggers(this, pipeline);
  71394. };
  71395. this.setupTsPipeline = function() {
  71396. var pipeline = {};
  71397. this.transmuxPipeline_ = pipeline;
  71398. pipeline.type = "ts";
  71399. pipeline.metadataStream = new m2ts.MetadataStream();
  71400. pipeline.packetStream = new m2ts.TransportPacketStream();
  71401. pipeline.parseStream = new m2ts.TransportParseStream();
  71402. pipeline.elementaryStream = new m2ts.ElementaryStream();
  71403. pipeline.timestampRolloverStream = new m2ts.TimestampRolloverStream();
  71404. pipeline.adtsStream = new AdtsStream();
  71405. pipeline.h264Stream = new H264Stream();
  71406. pipeline.captionStream = new m2ts.CaptionStream(options2);
  71407. pipeline.coalesceStream = new CoalesceStream(options2, pipeline.metadataStream);
  71408. pipeline.headOfPipeline = pipeline.packetStream;
  71409. pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream);
  71410. pipeline.timestampRolloverStream.pipe(pipeline.h264Stream);
  71411. pipeline.timestampRolloverStream.pipe(pipeline.adtsStream);
  71412. pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream);
  71413. pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream);
  71414. pipeline.elementaryStream.on("data", function(data) {
  71415. var i2;
  71416. if (data.type === "metadata") {
  71417. i2 = data.tracks.length;
  71418. while (i2--) {
  71419. if (!videoTrack && data.tracks[i2].type === "video") {
  71420. videoTrack = data.tracks[i2];
  71421. videoTrack.timelineStartInfo.baseMediaDecodeTime = self2.baseMediaDecodeTime;
  71422. } else if (!audioTrack && data.tracks[i2].type === "audio") {
  71423. audioTrack = data.tracks[i2];
  71424. audioTrack.timelineStartInfo.baseMediaDecodeTime = self2.baseMediaDecodeTime;
  71425. }
  71426. }
  71427. if (videoTrack && !pipeline.videoSegmentStream) {
  71428. pipeline.coalesceStream.numberOfTracks++;
  71429. pipeline.videoSegmentStream = new VideoSegmentStream(videoTrack, options2);
  71430. pipeline.videoSegmentStream.on("log", self2.getLogTrigger_("videoSegmentStream"));
  71431. pipeline.videoSegmentStream.on("timelineStartInfo", function(timelineStartInfo) {
  71432. if (audioTrack && !options2.keepOriginalTimestamps) {
  71433. audioTrack.timelineStartInfo = timelineStartInfo;
  71434. pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self2.baseMediaDecodeTime);
  71435. }
  71436. });
  71437. pipeline.videoSegmentStream.on("processedGopsInfo", self2.trigger.bind(self2, "gopInfo"));
  71438. pipeline.videoSegmentStream.on("segmentTimingInfo", self2.trigger.bind(self2, "videoSegmentTimingInfo"));
  71439. pipeline.videoSegmentStream.on("baseMediaDecodeTime", function(baseMediaDecodeTime) {
  71440. if (audioTrack) {
  71441. pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime);
  71442. }
  71443. });
  71444. pipeline.videoSegmentStream.on("timingInfo", self2.trigger.bind(self2, "videoTimingInfo"));
  71445. pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream);
  71446. }
  71447. if (audioTrack && !pipeline.audioSegmentStream) {
  71448. pipeline.coalesceStream.numberOfTracks++;
  71449. pipeline.audioSegmentStream = new AudioSegmentStream(audioTrack, options2);
  71450. pipeline.audioSegmentStream.on("log", self2.getLogTrigger_("audioSegmentStream"));
  71451. pipeline.audioSegmentStream.on("timingInfo", self2.trigger.bind(self2, "audioTimingInfo"));
  71452. pipeline.audioSegmentStream.on("segmentTimingInfo", self2.trigger.bind(self2, "audioSegmentTimingInfo"));
  71453. pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream);
  71454. }
  71455. self2.trigger("trackinfo", {
  71456. hasAudio: !!audioTrack,
  71457. hasVideo: !!videoTrack
  71458. });
  71459. }
  71460. });
  71461. pipeline.coalesceStream.on("data", this.trigger.bind(this, "data"));
  71462. pipeline.coalesceStream.on("id3Frame", function(id3Frame) {
  71463. id3Frame.dispatchType = pipeline.metadataStream.dispatchType;
  71464. self2.trigger("id3Frame", id3Frame);
  71465. });
  71466. pipeline.coalesceStream.on("caption", this.trigger.bind(this, "caption"));
  71467. pipeline.coalesceStream.on("done", this.trigger.bind(this, "done"));
  71468. addPipelineLogRetriggers(this, pipeline);
  71469. };
  71470. this.setBaseMediaDecodeTime = function(baseMediaDecodeTime) {
  71471. var pipeline = this.transmuxPipeline_;
  71472. if (!options2.keepOriginalTimestamps) {
  71473. this.baseMediaDecodeTime = baseMediaDecodeTime;
  71474. }
  71475. if (audioTrack) {
  71476. audioTrack.timelineStartInfo.dts = void 0;
  71477. audioTrack.timelineStartInfo.pts = void 0;
  71478. trackDecodeInfo.clearDtsInfo(audioTrack);
  71479. if (pipeline.audioTimestampRolloverStream) {
  71480. pipeline.audioTimestampRolloverStream.discontinuity();
  71481. }
  71482. }
  71483. if (videoTrack) {
  71484. if (pipeline.videoSegmentStream) {
  71485. pipeline.videoSegmentStream.gopCache_ = [];
  71486. }
  71487. videoTrack.timelineStartInfo.dts = void 0;
  71488. videoTrack.timelineStartInfo.pts = void 0;
  71489. trackDecodeInfo.clearDtsInfo(videoTrack);
  71490. pipeline.captionStream.reset();
  71491. }
  71492. if (pipeline.timestampRolloverStream) {
  71493. pipeline.timestampRolloverStream.discontinuity();
  71494. }
  71495. };
  71496. this.setAudioAppendStart = function(timestamp) {
  71497. if (audioTrack) {
  71498. this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp);
  71499. }
  71500. };
  71501. this.setRemux = function(val) {
  71502. var pipeline = this.transmuxPipeline_;
  71503. options2.remux = val;
  71504. if (pipeline && pipeline.coalesceStream) {
  71505. pipeline.coalesceStream.setRemux(val);
  71506. }
  71507. };
  71508. this.alignGopsWith = function(gopsToAlignWith) {
  71509. if (videoTrack && this.transmuxPipeline_.videoSegmentStream) {
  71510. this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith);
  71511. }
  71512. };
  71513. this.getLogTrigger_ = function(key) {
  71514. var self3 = this;
  71515. return function(event2) {
  71516. event2.stream = key;
  71517. self3.trigger("log", event2);
  71518. };
  71519. };
  71520. this.push = function(data) {
  71521. if (hasFlushed) {
  71522. var isAac = isLikelyAacData(data);
  71523. if (isAac && this.transmuxPipeline_.type !== "aac") {
  71524. this.setupAacPipeline();
  71525. } else if (!isAac && this.transmuxPipeline_.type !== "ts") {
  71526. this.setupTsPipeline();
  71527. }
  71528. hasFlushed = false;
  71529. }
  71530. this.transmuxPipeline_.headOfPipeline.push(data);
  71531. };
  71532. this.flush = function() {
  71533. hasFlushed = true;
  71534. this.transmuxPipeline_.headOfPipeline.flush();
  71535. };
  71536. this.endTimeline = function() {
  71537. this.transmuxPipeline_.headOfPipeline.endTimeline();
  71538. };
  71539. this.reset = function() {
  71540. if (this.transmuxPipeline_.headOfPipeline) {
  71541. this.transmuxPipeline_.headOfPipeline.reset();
  71542. }
  71543. };
  71544. this.resetCaptions = function() {
  71545. if (this.transmuxPipeline_.captionStream) {
  71546. this.transmuxPipeline_.captionStream.reset();
  71547. }
  71548. };
  71549. };
  71550. Transmuxer.prototype = new Stream2();
  71551. var transmuxer = {
  71552. Transmuxer,
  71553. VideoSegmentStream,
  71554. AudioSegmentStream,
  71555. AUDIO_PROPERTIES,
  71556. VIDEO_PROPERTIES,
  71557. generateSegmentTimingInfo
  71558. };
  71559. var toUnsigned$3 = function(value) {
  71560. return value >>> 0;
  71561. };
  71562. var toHexString$1 = function(value) {
  71563. return ("00" + value.toString(16)).slice(-2);
  71564. };
  71565. var bin = {
  71566. toUnsigned: toUnsigned$3,
  71567. toHexString: toHexString$1
  71568. };
  71569. var parseType$3 = function(buffer) {
  71570. var result = "";
  71571. result += String.fromCharCode(buffer[0]);
  71572. result += String.fromCharCode(buffer[1]);
  71573. result += String.fromCharCode(buffer[2]);
  71574. result += String.fromCharCode(buffer[3]);
  71575. return result;
  71576. };
  71577. var parseType_1 = parseType$3;
  71578. var toUnsigned$2 = bin.toUnsigned;
  71579. var parseType$2 = parseType_1;
  71580. var findBox$2 = function(data, path) {
  71581. var results = [], i2, size, type3, end, subresults;
  71582. if (!path.length) {
  71583. return null;
  71584. }
  71585. for (i2 = 0; i2 < data.byteLength; ) {
  71586. size = toUnsigned$2(data[i2] << 24 | data[i2 + 1] << 16 | data[i2 + 2] << 8 | data[i2 + 3]);
  71587. type3 = parseType$2(data.subarray(i2 + 4, i2 + 8));
  71588. end = size > 1 ? i2 + size : data.byteLength;
  71589. if (type3 === path[0]) {
  71590. if (path.length === 1) {
  71591. results.push(data.subarray(i2 + 8, end));
  71592. } else {
  71593. subresults = findBox$2(data.subarray(i2 + 8, end), path.slice(1));
  71594. if (subresults.length) {
  71595. results = results.concat(subresults);
  71596. }
  71597. }
  71598. }
  71599. i2 = end;
  71600. }
  71601. return results;
  71602. };
  71603. var findBox_1 = findBox$2;
  71604. var toUnsigned$1 = bin.toUnsigned;
  71605. var getUint64$22 = numbers2.getUint64;
  71606. var tfdt = function(data) {
  71607. var result = {
  71608. version: data[0],
  71609. flags: new Uint8Array(data.subarray(1, 4))
  71610. };
  71611. if (result.version === 1) {
  71612. result.baseMediaDecodeTime = getUint64$22(data.subarray(4));
  71613. } else {
  71614. result.baseMediaDecodeTime = toUnsigned$1(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]);
  71615. }
  71616. return result;
  71617. };
  71618. var parseTfdt$2 = tfdt;
  71619. var parseSampleFlags$1 = function(flags) {
  71620. return {
  71621. isLeading: (flags[0] & 12) >>> 2,
  71622. dependsOn: flags[0] & 3,
  71623. isDependedOn: (flags[1] & 192) >>> 6,
  71624. hasRedundancy: (flags[1] & 48) >>> 4,
  71625. paddingValue: (flags[1] & 14) >>> 1,
  71626. isNonSyncSample: flags[1] & 1,
  71627. degradationPriority: flags[2] << 8 | flags[3]
  71628. };
  71629. };
  71630. var parseSampleFlags_1 = parseSampleFlags$1;
  71631. var parseSampleFlags = parseSampleFlags_1;
  71632. var trun = function(data) {
  71633. var result = {
  71634. version: data[0],
  71635. flags: new Uint8Array(data.subarray(1, 4)),
  71636. samples: []
  71637. }, view = new DataView(data.buffer, data.byteOffset, data.byteLength), dataOffsetPresent = result.flags[2] & 1, firstSampleFlagsPresent = result.flags[2] & 4, sampleDurationPresent = result.flags[1] & 1, sampleSizePresent = result.flags[1] & 2, sampleFlagsPresent = result.flags[1] & 4, sampleCompositionTimeOffsetPresent = result.flags[1] & 8, sampleCount = view.getUint32(4), offset = 8, sample;
  71638. if (dataOffsetPresent) {
  71639. result.dataOffset = view.getInt32(offset);
  71640. offset += 4;
  71641. }
  71642. if (firstSampleFlagsPresent && sampleCount) {
  71643. sample = {
  71644. flags: parseSampleFlags(data.subarray(offset, offset + 4))
  71645. };
  71646. offset += 4;
  71647. if (sampleDurationPresent) {
  71648. sample.duration = view.getUint32(offset);
  71649. offset += 4;
  71650. }
  71651. if (sampleSizePresent) {
  71652. sample.size = view.getUint32(offset);
  71653. offset += 4;
  71654. }
  71655. if (sampleCompositionTimeOffsetPresent) {
  71656. if (result.version === 1) {
  71657. sample.compositionTimeOffset = view.getInt32(offset);
  71658. } else {
  71659. sample.compositionTimeOffset = view.getUint32(offset);
  71660. }
  71661. offset += 4;
  71662. }
  71663. result.samples.push(sample);
  71664. sampleCount--;
  71665. }
  71666. while (sampleCount--) {
  71667. sample = {};
  71668. if (sampleDurationPresent) {
  71669. sample.duration = view.getUint32(offset);
  71670. offset += 4;
  71671. }
  71672. if (sampleSizePresent) {
  71673. sample.size = view.getUint32(offset);
  71674. offset += 4;
  71675. }
  71676. if (sampleFlagsPresent) {
  71677. sample.flags = parseSampleFlags(data.subarray(offset, offset + 4));
  71678. offset += 4;
  71679. }
  71680. if (sampleCompositionTimeOffsetPresent) {
  71681. if (result.version === 1) {
  71682. sample.compositionTimeOffset = view.getInt32(offset);
  71683. } else {
  71684. sample.compositionTimeOffset = view.getUint32(offset);
  71685. }
  71686. offset += 4;
  71687. }
  71688. result.samples.push(sample);
  71689. }
  71690. return result;
  71691. };
  71692. var parseTrun$2 = trun;
  71693. var tfhd = function(data) {
  71694. var view = new DataView(data.buffer, data.byteOffset, data.byteLength), result = {
  71695. version: data[0],
  71696. flags: new Uint8Array(data.subarray(1, 4)),
  71697. trackId: view.getUint32(4)
  71698. }, baseDataOffsetPresent = result.flags[2] & 1, sampleDescriptionIndexPresent = result.flags[2] & 2, defaultSampleDurationPresent = result.flags[2] & 8, defaultSampleSizePresent = result.flags[2] & 16, defaultSampleFlagsPresent = result.flags[2] & 32, durationIsEmpty = result.flags[0] & 65536, defaultBaseIsMoof = result.flags[0] & 131072, i2;
  71699. i2 = 8;
  71700. if (baseDataOffsetPresent) {
  71701. i2 += 4;
  71702. result.baseDataOffset = view.getUint32(12);
  71703. i2 += 4;
  71704. }
  71705. if (sampleDescriptionIndexPresent) {
  71706. result.sampleDescriptionIndex = view.getUint32(i2);
  71707. i2 += 4;
  71708. }
  71709. if (defaultSampleDurationPresent) {
  71710. result.defaultSampleDuration = view.getUint32(i2);
  71711. i2 += 4;
  71712. }
  71713. if (defaultSampleSizePresent) {
  71714. result.defaultSampleSize = view.getUint32(i2);
  71715. i2 += 4;
  71716. }
  71717. if (defaultSampleFlagsPresent) {
  71718. result.defaultSampleFlags = view.getUint32(i2);
  71719. }
  71720. if (durationIsEmpty) {
  71721. result.durationIsEmpty = true;
  71722. }
  71723. if (!baseDataOffsetPresent && defaultBaseIsMoof) {
  71724. result.baseDataOffsetIsMoof = true;
  71725. }
  71726. return result;
  71727. };
  71728. var parseTfhd$2 = tfhd;
  71729. var win2;
  71730. if (typeof window !== "undefined") {
  71731. win2 = window;
  71732. } else if (typeof commonjsGlobal2 !== "undefined") {
  71733. win2 = commonjsGlobal2;
  71734. } else if (typeof self !== "undefined") {
  71735. win2 = self;
  71736. } else {
  71737. win2 = {};
  71738. }
  71739. var window_12 = win2;
  71740. var discardEmulationPreventionBytes4 = captionPacketParser.discardEmulationPreventionBytes;
  71741. var CaptionStream = captionStream.CaptionStream;
  71742. var findBox$12 = findBox_1;
  71743. var parseTfdt$1 = parseTfdt$2;
  71744. var parseTrun$1 = parseTrun$2;
  71745. var parseTfhd$1 = parseTfhd$2;
  71746. var window$22 = window_12;
  71747. var mapToSample = function(offset, samples) {
  71748. var approximateOffset = offset;
  71749. for (var i2 = 0; i2 < samples.length; i2++) {
  71750. var sample = samples[i2];
  71751. if (approximateOffset < sample.size) {
  71752. return sample;
  71753. }
  71754. approximateOffset -= sample.size;
  71755. }
  71756. return null;
  71757. };
  71758. var findSeiNals = function(avcStream, samples, trackId) {
  71759. var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), result = {
  71760. logs: [],
  71761. seiNals: []
  71762. }, seiNal, i2, length, lastMatchedSample;
  71763. for (i2 = 0; i2 + 4 < avcStream.length; i2 += length) {
  71764. length = avcView.getUint32(i2);
  71765. i2 += 4;
  71766. if (length <= 0) {
  71767. continue;
  71768. }
  71769. switch (avcStream[i2] & 31) {
  71770. case 6:
  71771. var data = avcStream.subarray(i2 + 1, i2 + 1 + length);
  71772. var matchingSample = mapToSample(i2, samples);
  71773. seiNal = {
  71774. nalUnitType: "sei_rbsp",
  71775. size: length,
  71776. data,
  71777. escapedRBSP: discardEmulationPreventionBytes4(data),
  71778. trackId
  71779. };
  71780. if (matchingSample) {
  71781. seiNal.pts = matchingSample.pts;
  71782. seiNal.dts = matchingSample.dts;
  71783. lastMatchedSample = matchingSample;
  71784. } else if (lastMatchedSample) {
  71785. seiNal.pts = lastMatchedSample.pts;
  71786. seiNal.dts = lastMatchedSample.dts;
  71787. } else {
  71788. result.logs.push({
  71789. level: "warn",
  71790. message: "We've encountered a nal unit without data at " + i2 + " for trackId " + trackId + ". See mux.js#223."
  71791. });
  71792. break;
  71793. }
  71794. result.seiNals.push(seiNal);
  71795. break;
  71796. }
  71797. }
  71798. return result;
  71799. };
  71800. var parseSamples = function(truns, baseMediaDecodeTime, tfhd2) {
  71801. var currentDts = baseMediaDecodeTime;
  71802. var defaultSampleDuration = tfhd2.defaultSampleDuration || 0;
  71803. var defaultSampleSize = tfhd2.defaultSampleSize || 0;
  71804. var trackId = tfhd2.trackId;
  71805. var allSamples = [];
  71806. truns.forEach(function(trun2) {
  71807. var trackRun = parseTrun$1(trun2);
  71808. var samples = trackRun.samples;
  71809. samples.forEach(function(sample) {
  71810. if (sample.duration === void 0) {
  71811. sample.duration = defaultSampleDuration;
  71812. }
  71813. if (sample.size === void 0) {
  71814. sample.size = defaultSampleSize;
  71815. }
  71816. sample.trackId = trackId;
  71817. sample.dts = currentDts;
  71818. if (sample.compositionTimeOffset === void 0) {
  71819. sample.compositionTimeOffset = 0;
  71820. }
  71821. if (typeof currentDts === "bigint") {
  71822. sample.pts = currentDts + window$22.BigInt(sample.compositionTimeOffset);
  71823. currentDts += window$22.BigInt(sample.duration);
  71824. } else {
  71825. sample.pts = currentDts + sample.compositionTimeOffset;
  71826. currentDts += sample.duration;
  71827. }
  71828. });
  71829. allSamples = allSamples.concat(samples);
  71830. });
  71831. return allSamples;
  71832. };
  71833. var parseCaptionNals = function(segment, videoTrackId) {
  71834. var trafs = findBox$12(segment, ["moof", "traf"]);
  71835. var mdats = findBox$12(segment, ["mdat"]);
  71836. var captionNals = {};
  71837. var mdatTrafPairs = [];
  71838. mdats.forEach(function(mdat2, index2) {
  71839. var matchingTraf = trafs[index2];
  71840. mdatTrafPairs.push({
  71841. mdat: mdat2,
  71842. traf: matchingTraf
  71843. });
  71844. });
  71845. mdatTrafPairs.forEach(function(pair) {
  71846. var mdat2 = pair.mdat;
  71847. var traf2 = pair.traf;
  71848. var tfhd2 = findBox$12(traf2, ["tfhd"]);
  71849. var headerInfo = parseTfhd$1(tfhd2[0]);
  71850. var trackId = headerInfo.trackId;
  71851. var tfdt2 = findBox$12(traf2, ["tfdt"]);
  71852. var baseMediaDecodeTime = tfdt2.length > 0 ? parseTfdt$1(tfdt2[0]).baseMediaDecodeTime : 0;
  71853. var truns = findBox$12(traf2, ["trun"]);
  71854. var samples;
  71855. var result;
  71856. if (videoTrackId === trackId && truns.length > 0) {
  71857. samples = parseSamples(truns, baseMediaDecodeTime, headerInfo);
  71858. result = findSeiNals(mdat2, samples, trackId);
  71859. if (!captionNals[trackId]) {
  71860. captionNals[trackId] = {
  71861. seiNals: [],
  71862. logs: []
  71863. };
  71864. }
  71865. captionNals[trackId].seiNals = captionNals[trackId].seiNals.concat(result.seiNals);
  71866. captionNals[trackId].logs = captionNals[trackId].logs.concat(result.logs);
  71867. }
  71868. });
  71869. return captionNals;
  71870. };
  71871. var parseEmbeddedCaptions = function(segment, trackId, timescale3) {
  71872. var captionNals;
  71873. if (trackId === null) {
  71874. return null;
  71875. }
  71876. captionNals = parseCaptionNals(segment, trackId);
  71877. var trackNals = captionNals[trackId] || {};
  71878. return {
  71879. seiNals: trackNals.seiNals,
  71880. logs: trackNals.logs,
  71881. timescale: timescale3
  71882. };
  71883. };
  71884. var CaptionParser = function() {
  71885. var isInitialized = false;
  71886. var captionStream2;
  71887. var segmentCache;
  71888. var trackId;
  71889. var timescale3;
  71890. var parsedCaptions;
  71891. var parsingPartial;
  71892. this.isInitialized = function() {
  71893. return isInitialized;
  71894. };
  71895. this.init = function(options2) {
  71896. captionStream2 = new CaptionStream();
  71897. isInitialized = true;
  71898. parsingPartial = options2 ? options2.isPartial : false;
  71899. captionStream2.on("data", function(event2) {
  71900. event2.startTime = event2.startPts / timescale3;
  71901. event2.endTime = event2.endPts / timescale3;
  71902. parsedCaptions.captions.push(event2);
  71903. parsedCaptions.captionStreams[event2.stream] = true;
  71904. });
  71905. captionStream2.on("log", function(log2) {
  71906. parsedCaptions.logs.push(log2);
  71907. });
  71908. };
  71909. this.isNewInit = function(videoTrackIds, timescales) {
  71910. if (videoTrackIds && videoTrackIds.length === 0 || timescales && typeof timescales === "object" && Object.keys(timescales).length === 0) {
  71911. return false;
  71912. }
  71913. return trackId !== videoTrackIds[0] || timescale3 !== timescales[trackId];
  71914. };
  71915. this.parse = function(segment, videoTrackIds, timescales) {
  71916. var parsedData;
  71917. if (!this.isInitialized()) {
  71918. return null;
  71919. } else if (!videoTrackIds || !timescales) {
  71920. return null;
  71921. } else if (this.isNewInit(videoTrackIds, timescales)) {
  71922. trackId = videoTrackIds[0];
  71923. timescale3 = timescales[trackId];
  71924. } else if (trackId === null || !timescale3) {
  71925. segmentCache.push(segment);
  71926. return null;
  71927. }
  71928. while (segmentCache.length > 0) {
  71929. var cachedSegment = segmentCache.shift();
  71930. this.parse(cachedSegment, videoTrackIds, timescales);
  71931. }
  71932. parsedData = parseEmbeddedCaptions(segment, trackId, timescale3);
  71933. if (parsedData && parsedData.logs) {
  71934. parsedCaptions.logs = parsedCaptions.logs.concat(parsedData.logs);
  71935. }
  71936. if (parsedData === null || !parsedData.seiNals) {
  71937. if (parsedCaptions.logs.length) {
  71938. return {
  71939. logs: parsedCaptions.logs,
  71940. captions: [],
  71941. captionStreams: []
  71942. };
  71943. }
  71944. return null;
  71945. }
  71946. this.pushNals(parsedData.seiNals);
  71947. this.flushStream();
  71948. return parsedCaptions;
  71949. };
  71950. this.pushNals = function(nals) {
  71951. if (!this.isInitialized() || !nals || nals.length === 0) {
  71952. return null;
  71953. }
  71954. nals.forEach(function(nal) {
  71955. captionStream2.push(nal);
  71956. });
  71957. };
  71958. this.flushStream = function() {
  71959. if (!this.isInitialized()) {
  71960. return null;
  71961. }
  71962. if (!parsingPartial) {
  71963. captionStream2.flush();
  71964. } else {
  71965. captionStream2.partialFlush();
  71966. }
  71967. };
  71968. this.clearParsedCaptions = function() {
  71969. parsedCaptions.captions = [];
  71970. parsedCaptions.captionStreams = {};
  71971. parsedCaptions.logs = [];
  71972. };
  71973. this.resetCaptionStream = function() {
  71974. if (!this.isInitialized()) {
  71975. return null;
  71976. }
  71977. captionStream2.reset();
  71978. };
  71979. this.clearAllCaptions = function() {
  71980. this.clearParsedCaptions();
  71981. this.resetCaptionStream();
  71982. };
  71983. this.reset = function() {
  71984. segmentCache = [];
  71985. trackId = null;
  71986. timescale3 = null;
  71987. if (!parsedCaptions) {
  71988. parsedCaptions = {
  71989. captions: [],
  71990. captionStreams: {},
  71991. logs: []
  71992. };
  71993. } else {
  71994. this.clearParsedCaptions();
  71995. }
  71996. this.resetCaptionStream();
  71997. };
  71998. this.reset();
  71999. };
  72000. var captionParser = CaptionParser;
  72001. var uint8ToCString$1 = function(data) {
  72002. var index2 = 0;
  72003. var curChar = String.fromCharCode(data[index2]);
  72004. var retString = "";
  72005. while (curChar !== "\0") {
  72006. retString += curChar;
  72007. index2++;
  72008. curChar = String.fromCharCode(data[index2]);
  72009. }
  72010. retString += curChar;
  72011. return retString;
  72012. };
  72013. var string = {
  72014. uint8ToCString: uint8ToCString$1
  72015. };
  72016. var uint8ToCString = string.uint8ToCString;
  72017. var getUint64$12 = numbers2.getUint64;
  72018. var parseEmsgBox = function(boxData) {
  72019. var offset = 4;
  72020. var version2 = boxData[0];
  72021. var scheme_id_uri, value, timescale3, presentation_time, presentation_time_delta, event_duration, id, message_data;
  72022. if (version2 === 0) {
  72023. scheme_id_uri = uint8ToCString(boxData.subarray(offset));
  72024. offset += scheme_id_uri.length;
  72025. value = uint8ToCString(boxData.subarray(offset));
  72026. offset += value.length;
  72027. var dv = new DataView(boxData.buffer);
  72028. timescale3 = dv.getUint32(offset);
  72029. offset += 4;
  72030. presentation_time_delta = dv.getUint32(offset);
  72031. offset += 4;
  72032. event_duration = dv.getUint32(offset);
  72033. offset += 4;
  72034. id = dv.getUint32(offset);
  72035. offset += 4;
  72036. } else if (version2 === 1) {
  72037. var dv = new DataView(boxData.buffer);
  72038. timescale3 = dv.getUint32(offset);
  72039. offset += 4;
  72040. presentation_time = getUint64$12(boxData.subarray(offset));
  72041. offset += 8;
  72042. event_duration = dv.getUint32(offset);
  72043. offset += 4;
  72044. id = dv.getUint32(offset);
  72045. offset += 4;
  72046. scheme_id_uri = uint8ToCString(boxData.subarray(offset));
  72047. offset += scheme_id_uri.length;
  72048. value = uint8ToCString(boxData.subarray(offset));
  72049. offset += value.length;
  72050. }
  72051. message_data = new Uint8Array(boxData.subarray(offset, boxData.byteLength));
  72052. var emsgBox = {
  72053. scheme_id_uri,
  72054. value,
  72055. timescale: timescale3 ? timescale3 : 1,
  72056. presentation_time,
  72057. presentation_time_delta,
  72058. event_duration,
  72059. id,
  72060. message_data
  72061. };
  72062. return isValidEmsgBox(version2, emsgBox) ? emsgBox : void 0;
  72063. };
  72064. var scaleTime = function(presentationTime, timescale3, timeDelta, offset) {
  72065. return presentationTime || presentationTime === 0 ? presentationTime / timescale3 : offset + timeDelta / timescale3;
  72066. };
  72067. var isValidEmsgBox = function(version2, emsg2) {
  72068. var hasScheme = emsg2.scheme_id_uri !== "\0";
  72069. var isValidV0Box = version2 === 0 && isDefined(emsg2.presentation_time_delta) && hasScheme;
  72070. var isValidV1Box = version2 === 1 && isDefined(emsg2.presentation_time) && hasScheme;
  72071. return !(version2 > 1) && isValidV0Box || isValidV1Box;
  72072. };
  72073. var isDefined = function(data) {
  72074. return data !== void 0 || data !== null;
  72075. };
  72076. var emsg$1 = {
  72077. parseEmsgBox,
  72078. scaleTime
  72079. };
  72080. var toUnsigned = bin.toUnsigned;
  72081. var toHexString = bin.toHexString;
  72082. var findBox4 = findBox_1;
  72083. var parseType$1 = parseType_1;
  72084. var emsg = emsg$1;
  72085. var parseTfhd = parseTfhd$2;
  72086. var parseTrun = parseTrun$2;
  72087. var parseTfdt = parseTfdt$2;
  72088. var getUint642 = numbers2.getUint64;
  72089. var timescale2, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader, getEmsgID3;
  72090. var window$12 = window_12;
  72091. var parseId3Frames = parseId3.parseId3Frames;
  72092. timescale2 = function(init) {
  72093. var result = {}, traks = findBox4(init, ["moov", "trak"]);
  72094. return traks.reduce(function(result2, trak2) {
  72095. var tkhd2, version2, index2, id, mdhd2;
  72096. tkhd2 = findBox4(trak2, ["tkhd"])[0];
  72097. if (!tkhd2) {
  72098. return null;
  72099. }
  72100. version2 = tkhd2[0];
  72101. index2 = version2 === 0 ? 12 : 20;
  72102. id = toUnsigned(tkhd2[index2] << 24 | tkhd2[index2 + 1] << 16 | tkhd2[index2 + 2] << 8 | tkhd2[index2 + 3]);
  72103. mdhd2 = findBox4(trak2, ["mdia", "mdhd"])[0];
  72104. if (!mdhd2) {
  72105. return null;
  72106. }
  72107. version2 = mdhd2[0];
  72108. index2 = version2 === 0 ? 12 : 20;
  72109. result2[id] = toUnsigned(mdhd2[index2] << 24 | mdhd2[index2 + 1] << 16 | mdhd2[index2 + 2] << 8 | mdhd2[index2 + 3]);
  72110. return result2;
  72111. }, result);
  72112. };
  72113. startTime = function(timescale3, fragment) {
  72114. var trafs;
  72115. trafs = findBox4(fragment, ["moof", "traf"]);
  72116. var lowestTime = trafs.reduce(function(acc, traf2) {
  72117. var tfhd2 = findBox4(traf2, ["tfhd"])[0];
  72118. var id = toUnsigned(tfhd2[4] << 24 | tfhd2[5] << 16 | tfhd2[6] << 8 | tfhd2[7]);
  72119. var scale = timescale3[id] || 9e4;
  72120. var tfdt2 = findBox4(traf2, ["tfdt"])[0];
  72121. var dv = new DataView(tfdt2.buffer, tfdt2.byteOffset, tfdt2.byteLength);
  72122. var baseTime;
  72123. if (tfdt2[0] === 1) {
  72124. baseTime = getUint642(tfdt2.subarray(4, 12));
  72125. } else {
  72126. baseTime = dv.getUint32(4);
  72127. }
  72128. let seconds;
  72129. if (typeof baseTime === "bigint") {
  72130. seconds = baseTime / window$12.BigInt(scale);
  72131. } else if (typeof baseTime === "number" && !isNaN(baseTime)) {
  72132. seconds = baseTime / scale;
  72133. }
  72134. if (seconds < Number.MAX_SAFE_INTEGER) {
  72135. seconds = Number(seconds);
  72136. }
  72137. if (seconds < acc) {
  72138. acc = seconds;
  72139. }
  72140. return acc;
  72141. }, Infinity);
  72142. return typeof lowestTime === "bigint" || isFinite(lowestTime) ? lowestTime : 0;
  72143. };
  72144. compositionStartTime = function(timescales, fragment) {
  72145. var trafBoxes = findBox4(fragment, ["moof", "traf"]);
  72146. var baseMediaDecodeTime = 0;
  72147. var compositionTimeOffset = 0;
  72148. var trackId;
  72149. if (trafBoxes && trafBoxes.length) {
  72150. var tfhd2 = findBox4(trafBoxes[0], ["tfhd"])[0];
  72151. var trun2 = findBox4(trafBoxes[0], ["trun"])[0];
  72152. var tfdt2 = findBox4(trafBoxes[0], ["tfdt"])[0];
  72153. if (tfhd2) {
  72154. var parsedTfhd = parseTfhd(tfhd2);
  72155. trackId = parsedTfhd.trackId;
  72156. }
  72157. if (tfdt2) {
  72158. var parsedTfdt = parseTfdt(tfdt2);
  72159. baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime;
  72160. }
  72161. if (trun2) {
  72162. var parsedTrun = parseTrun(trun2);
  72163. if (parsedTrun.samples && parsedTrun.samples.length) {
  72164. compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0;
  72165. }
  72166. }
  72167. }
  72168. var timescale3 = timescales[trackId] || 9e4;
  72169. if (typeof baseMediaDecodeTime === "bigint") {
  72170. compositionTimeOffset = window$12.BigInt(compositionTimeOffset);
  72171. timescale3 = window$12.BigInt(timescale3);
  72172. }
  72173. var result = (baseMediaDecodeTime + compositionTimeOffset) / timescale3;
  72174. if (typeof result === "bigint" && result < Number.MAX_SAFE_INTEGER) {
  72175. result = Number(result);
  72176. }
  72177. return result;
  72178. };
  72179. getVideoTrackIds = function(init) {
  72180. var traks = findBox4(init, ["moov", "trak"]);
  72181. var videoTrackIds = [];
  72182. traks.forEach(function(trak2) {
  72183. var hdlrs = findBox4(trak2, ["mdia", "hdlr"]);
  72184. var tkhds = findBox4(trak2, ["tkhd"]);
  72185. hdlrs.forEach(function(hdlr2, index2) {
  72186. var handlerType = parseType$1(hdlr2.subarray(8, 12));
  72187. var tkhd2 = tkhds[index2];
  72188. var view;
  72189. var version2;
  72190. var trackId;
  72191. if (handlerType === "vide") {
  72192. view = new DataView(tkhd2.buffer, tkhd2.byteOffset, tkhd2.byteLength);
  72193. version2 = view.getUint8(0);
  72194. trackId = version2 === 0 ? view.getUint32(12) : view.getUint32(20);
  72195. videoTrackIds.push(trackId);
  72196. }
  72197. });
  72198. });
  72199. return videoTrackIds;
  72200. };
  72201. getTimescaleFromMediaHeader = function(mdhd2) {
  72202. var version2 = mdhd2[0];
  72203. var index2 = version2 === 0 ? 12 : 20;
  72204. return toUnsigned(mdhd2[index2] << 24 | mdhd2[index2 + 1] << 16 | mdhd2[index2 + 2] << 8 | mdhd2[index2 + 3]);
  72205. };
  72206. getTracks = function(init) {
  72207. var traks = findBox4(init, ["moov", "trak"]);
  72208. var tracks = [];
  72209. traks.forEach(function(trak2) {
  72210. var track = {};
  72211. var tkhd2 = findBox4(trak2, ["tkhd"])[0];
  72212. var view, tkhdVersion;
  72213. if (tkhd2) {
  72214. view = new DataView(tkhd2.buffer, tkhd2.byteOffset, tkhd2.byteLength);
  72215. tkhdVersion = view.getUint8(0);
  72216. track.id = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20);
  72217. }
  72218. var hdlr2 = findBox4(trak2, ["mdia", "hdlr"])[0];
  72219. if (hdlr2) {
  72220. var type3 = parseType$1(hdlr2.subarray(8, 12));
  72221. if (type3 === "vide") {
  72222. track.type = "video";
  72223. } else if (type3 === "soun") {
  72224. track.type = "audio";
  72225. } else {
  72226. track.type = type3;
  72227. }
  72228. }
  72229. var stsd2 = findBox4(trak2, ["mdia", "minf", "stbl", "stsd"])[0];
  72230. if (stsd2) {
  72231. var sampleDescriptions = stsd2.subarray(8);
  72232. track.codec = parseType$1(sampleDescriptions.subarray(4, 8));
  72233. var codecBox = findBox4(sampleDescriptions, [track.codec])[0];
  72234. var codecConfig, codecConfigType;
  72235. if (codecBox) {
  72236. if (/^[asm]vc[1-9]$/i.test(track.codec)) {
  72237. codecConfig = codecBox.subarray(78);
  72238. codecConfigType = parseType$1(codecConfig.subarray(4, 8));
  72239. if (codecConfigType === "avcC" && codecConfig.length > 11) {
  72240. track.codec += ".";
  72241. track.codec += toHexString(codecConfig[9]);
  72242. track.codec += toHexString(codecConfig[10]);
  72243. track.codec += toHexString(codecConfig[11]);
  72244. } else {
  72245. track.codec = "avc1.4d400d";
  72246. }
  72247. } else if (/^mp4[a,v]$/i.test(track.codec)) {
  72248. codecConfig = codecBox.subarray(28);
  72249. codecConfigType = parseType$1(codecConfig.subarray(4, 8));
  72250. if (codecConfigType === "esds" && codecConfig.length > 20 && codecConfig[19] !== 0) {
  72251. track.codec += "." + toHexString(codecConfig[19]);
  72252. track.codec += "." + toHexString(codecConfig[20] >>> 2 & 63).replace(/^0/, "");
  72253. } else {
  72254. track.codec = "mp4a.40.2";
  72255. }
  72256. } else {
  72257. track.codec = track.codec.toLowerCase();
  72258. }
  72259. }
  72260. }
  72261. var mdhd2 = findBox4(trak2, ["mdia", "mdhd"])[0];
  72262. if (mdhd2) {
  72263. track.timescale = getTimescaleFromMediaHeader(mdhd2);
  72264. }
  72265. tracks.push(track);
  72266. });
  72267. return tracks;
  72268. };
  72269. getEmsgID3 = function(segmentData, offset = 0) {
  72270. var emsgBoxes = findBox4(segmentData, ["emsg"]);
  72271. return emsgBoxes.map((data) => {
  72272. var parsedBox = emsg.parseEmsgBox(new Uint8Array(data));
  72273. var parsedId3Frames = parseId3Frames(parsedBox.message_data);
  72274. return {
  72275. cueTime: emsg.scaleTime(parsedBox.presentation_time, parsedBox.timescale, parsedBox.presentation_time_delta, offset),
  72276. duration: emsg.scaleTime(parsedBox.event_duration, parsedBox.timescale),
  72277. frames: parsedId3Frames
  72278. };
  72279. });
  72280. };
  72281. var probe$2 = {
  72282. findBox: findBox4,
  72283. parseType: parseType$1,
  72284. timescale: timescale2,
  72285. startTime,
  72286. compositionStartTime,
  72287. videoTrackIds: getVideoTrackIds,
  72288. tracks: getTracks,
  72289. getTimescaleFromMediaHeader,
  72290. getEmsgID3
  72291. };
  72292. var StreamTypes$1 = streamTypes;
  72293. var parsePid = function(packet) {
  72294. var pid = packet[1] & 31;
  72295. pid <<= 8;
  72296. pid |= packet[2];
  72297. return pid;
  72298. };
  72299. var parsePayloadUnitStartIndicator = function(packet) {
  72300. return !!(packet[1] & 64);
  72301. };
  72302. var parseAdaptionField = function(packet) {
  72303. var offset = 0;
  72304. if ((packet[3] & 48) >>> 4 > 1) {
  72305. offset += packet[4] + 1;
  72306. }
  72307. return offset;
  72308. };
  72309. var parseType = function(packet, pmtPid) {
  72310. var pid = parsePid(packet);
  72311. if (pid === 0) {
  72312. return "pat";
  72313. } else if (pid === pmtPid) {
  72314. return "pmt";
  72315. } else if (pmtPid) {
  72316. return "pes";
  72317. }
  72318. return null;
  72319. };
  72320. var parsePat = function(packet) {
  72321. var pusi = parsePayloadUnitStartIndicator(packet);
  72322. var offset = 4 + parseAdaptionField(packet);
  72323. if (pusi) {
  72324. offset += packet[offset] + 1;
  72325. }
  72326. return (packet[offset + 10] & 31) << 8 | packet[offset + 11];
  72327. };
  72328. var parsePmt = function(packet) {
  72329. var programMapTable = {};
  72330. var pusi = parsePayloadUnitStartIndicator(packet);
  72331. var payloadOffset = 4 + parseAdaptionField(packet);
  72332. if (pusi) {
  72333. payloadOffset += packet[payloadOffset] + 1;
  72334. }
  72335. if (!(packet[payloadOffset + 5] & 1)) {
  72336. return;
  72337. }
  72338. var sectionLength, tableEnd, programInfoLength;
  72339. sectionLength = (packet[payloadOffset + 1] & 15) << 8 | packet[payloadOffset + 2];
  72340. tableEnd = 3 + sectionLength - 4;
  72341. programInfoLength = (packet[payloadOffset + 10] & 15) << 8 | packet[payloadOffset + 11];
  72342. var offset = 12 + programInfoLength;
  72343. while (offset < tableEnd) {
  72344. var i2 = payloadOffset + offset;
  72345. programMapTable[(packet[i2 + 1] & 31) << 8 | packet[i2 + 2]] = packet[i2];
  72346. offset += ((packet[i2 + 3] & 15) << 8 | packet[i2 + 4]) + 5;
  72347. }
  72348. return programMapTable;
  72349. };
  72350. var parsePesType = function(packet, programMapTable) {
  72351. var pid = parsePid(packet);
  72352. var type3 = programMapTable[pid];
  72353. switch (type3) {
  72354. case StreamTypes$1.H264_STREAM_TYPE:
  72355. return "video";
  72356. case StreamTypes$1.ADTS_STREAM_TYPE:
  72357. return "audio";
  72358. case StreamTypes$1.METADATA_STREAM_TYPE:
  72359. return "timed-metadata";
  72360. default:
  72361. return null;
  72362. }
  72363. };
  72364. var parsePesTime = function(packet) {
  72365. var pusi = parsePayloadUnitStartIndicator(packet);
  72366. if (!pusi) {
  72367. return null;
  72368. }
  72369. var offset = 4 + parseAdaptionField(packet);
  72370. if (offset >= packet.byteLength) {
  72371. return null;
  72372. }
  72373. var pes = null;
  72374. var ptsDtsFlags;
  72375. ptsDtsFlags = packet[offset + 7];
  72376. if (ptsDtsFlags & 192) {
  72377. pes = {};
  72378. pes.pts = (packet[offset + 9] & 14) << 27 | (packet[offset + 10] & 255) << 20 | (packet[offset + 11] & 254) << 12 | (packet[offset + 12] & 255) << 5 | (packet[offset + 13] & 254) >>> 3;
  72379. pes.pts *= 4;
  72380. pes.pts += (packet[offset + 13] & 6) >>> 1;
  72381. pes.dts = pes.pts;
  72382. if (ptsDtsFlags & 64) {
  72383. pes.dts = (packet[offset + 14] & 14) << 27 | (packet[offset + 15] & 255) << 20 | (packet[offset + 16] & 254) << 12 | (packet[offset + 17] & 255) << 5 | (packet[offset + 18] & 254) >>> 3;
  72384. pes.dts *= 4;
  72385. pes.dts += (packet[offset + 18] & 6) >>> 1;
  72386. }
  72387. }
  72388. return pes;
  72389. };
  72390. var parseNalUnitType = function(type3) {
  72391. switch (type3) {
  72392. case 5:
  72393. return "slice_layer_without_partitioning_rbsp_idr";
  72394. case 6:
  72395. return "sei_rbsp";
  72396. case 7:
  72397. return "seq_parameter_set_rbsp";
  72398. case 8:
  72399. return "pic_parameter_set_rbsp";
  72400. case 9:
  72401. return "access_unit_delimiter_rbsp";
  72402. default:
  72403. return null;
  72404. }
  72405. };
  72406. var videoPacketContainsKeyFrame = function(packet) {
  72407. var offset = 4 + parseAdaptionField(packet);
  72408. var frameBuffer = packet.subarray(offset);
  72409. var frameI = 0;
  72410. var frameSyncPoint = 0;
  72411. var foundKeyFrame = false;
  72412. var nalType;
  72413. for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) {
  72414. if (frameBuffer[frameSyncPoint + 2] === 1) {
  72415. frameI = frameSyncPoint + 5;
  72416. break;
  72417. }
  72418. }
  72419. while (frameI < frameBuffer.byteLength) {
  72420. switch (frameBuffer[frameI]) {
  72421. case 0:
  72422. if (frameBuffer[frameI - 1] !== 0) {
  72423. frameI += 2;
  72424. break;
  72425. } else if (frameBuffer[frameI - 2] !== 0) {
  72426. frameI++;
  72427. break;
  72428. }
  72429. if (frameSyncPoint + 3 !== frameI - 2) {
  72430. nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 31);
  72431. if (nalType === "slice_layer_without_partitioning_rbsp_idr") {
  72432. foundKeyFrame = true;
  72433. }
  72434. }
  72435. do {
  72436. frameI++;
  72437. } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length);
  72438. frameSyncPoint = frameI - 2;
  72439. frameI += 3;
  72440. break;
  72441. case 1:
  72442. if (frameBuffer[frameI - 1] !== 0 || frameBuffer[frameI - 2] !== 0) {
  72443. frameI += 3;
  72444. break;
  72445. }
  72446. nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 31);
  72447. if (nalType === "slice_layer_without_partitioning_rbsp_idr") {
  72448. foundKeyFrame = true;
  72449. }
  72450. frameSyncPoint = frameI - 2;
  72451. frameI += 3;
  72452. break;
  72453. default:
  72454. frameI += 3;
  72455. break;
  72456. }
  72457. }
  72458. frameBuffer = frameBuffer.subarray(frameSyncPoint);
  72459. frameI -= frameSyncPoint;
  72460. frameSyncPoint = 0;
  72461. if (frameBuffer && frameBuffer.byteLength > 3) {
  72462. nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 31);
  72463. if (nalType === "slice_layer_without_partitioning_rbsp_idr") {
  72464. foundKeyFrame = true;
  72465. }
  72466. }
  72467. return foundKeyFrame;
  72468. };
  72469. var probe$1 = {
  72470. parseType,
  72471. parsePat,
  72472. parsePmt,
  72473. parsePayloadUnitStartIndicator,
  72474. parsePesType,
  72475. parsePesTime,
  72476. videoPacketContainsKeyFrame
  72477. };
  72478. var StreamTypes = streamTypes;
  72479. var handleRollover = timestampRolloverStream.handleRollover;
  72480. var probe = {};
  72481. probe.ts = probe$1;
  72482. probe.aac = utils2;
  72483. var ONE_SECOND_IN_TS2 = clock$2.ONE_SECOND_IN_TS;
  72484. var MP2T_PACKET_LENGTH = 188, SYNC_BYTE = 71;
  72485. var parsePsi_ = function(bytes, pmt) {
  72486. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH, packet, type3;
  72487. while (endIndex < bytes.byteLength) {
  72488. if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {
  72489. packet = bytes.subarray(startIndex, endIndex);
  72490. type3 = probe.ts.parseType(packet, pmt.pid);
  72491. switch (type3) {
  72492. case "pat":
  72493. pmt.pid = probe.ts.parsePat(packet);
  72494. break;
  72495. case "pmt":
  72496. var table = probe.ts.parsePmt(packet);
  72497. pmt.table = pmt.table || {};
  72498. Object.keys(table).forEach(function(key) {
  72499. pmt.table[key] = table[key];
  72500. });
  72501. break;
  72502. }
  72503. startIndex += MP2T_PACKET_LENGTH;
  72504. endIndex += MP2T_PACKET_LENGTH;
  72505. continue;
  72506. }
  72507. startIndex++;
  72508. endIndex++;
  72509. }
  72510. };
  72511. var parseAudioPes_ = function(bytes, pmt, result) {
  72512. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH, packet, type3, pesType, pusi, parsed;
  72513. var endLoop = false;
  72514. while (endIndex <= bytes.byteLength) {
  72515. if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) {
  72516. packet = bytes.subarray(startIndex, endIndex);
  72517. type3 = probe.ts.parseType(packet, pmt.pid);
  72518. switch (type3) {
  72519. case "pes":
  72520. pesType = probe.ts.parsePesType(packet, pmt.table);
  72521. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  72522. if (pesType === "audio" && pusi) {
  72523. parsed = probe.ts.parsePesTime(packet);
  72524. if (parsed) {
  72525. parsed.type = "audio";
  72526. result.audio.push(parsed);
  72527. endLoop = true;
  72528. }
  72529. }
  72530. break;
  72531. }
  72532. if (endLoop) {
  72533. break;
  72534. }
  72535. startIndex += MP2T_PACKET_LENGTH;
  72536. endIndex += MP2T_PACKET_LENGTH;
  72537. continue;
  72538. }
  72539. startIndex++;
  72540. endIndex++;
  72541. }
  72542. endIndex = bytes.byteLength;
  72543. startIndex = endIndex - MP2T_PACKET_LENGTH;
  72544. endLoop = false;
  72545. while (startIndex >= 0) {
  72546. if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) {
  72547. packet = bytes.subarray(startIndex, endIndex);
  72548. type3 = probe.ts.parseType(packet, pmt.pid);
  72549. switch (type3) {
  72550. case "pes":
  72551. pesType = probe.ts.parsePesType(packet, pmt.table);
  72552. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  72553. if (pesType === "audio" && pusi) {
  72554. parsed = probe.ts.parsePesTime(packet);
  72555. if (parsed) {
  72556. parsed.type = "audio";
  72557. result.audio.push(parsed);
  72558. endLoop = true;
  72559. }
  72560. }
  72561. break;
  72562. }
  72563. if (endLoop) {
  72564. break;
  72565. }
  72566. startIndex -= MP2T_PACKET_LENGTH;
  72567. endIndex -= MP2T_PACKET_LENGTH;
  72568. continue;
  72569. }
  72570. startIndex--;
  72571. endIndex--;
  72572. }
  72573. };
  72574. var parseVideoPes_ = function(bytes, pmt, result) {
  72575. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH, packet, type3, pesType, pusi, parsed, frame, i2, pes;
  72576. var endLoop = false;
  72577. var currentFrame = {
  72578. data: [],
  72579. size: 0
  72580. };
  72581. while (endIndex < bytes.byteLength) {
  72582. if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {
  72583. packet = bytes.subarray(startIndex, endIndex);
  72584. type3 = probe.ts.parseType(packet, pmt.pid);
  72585. switch (type3) {
  72586. case "pes":
  72587. pesType = probe.ts.parsePesType(packet, pmt.table);
  72588. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  72589. if (pesType === "video") {
  72590. if (pusi && !endLoop) {
  72591. parsed = probe.ts.parsePesTime(packet);
  72592. if (parsed) {
  72593. parsed.type = "video";
  72594. result.video.push(parsed);
  72595. endLoop = true;
  72596. }
  72597. }
  72598. if (!result.firstKeyFrame) {
  72599. if (pusi) {
  72600. if (currentFrame.size !== 0) {
  72601. frame = new Uint8Array(currentFrame.size);
  72602. i2 = 0;
  72603. while (currentFrame.data.length) {
  72604. pes = currentFrame.data.shift();
  72605. frame.set(pes, i2);
  72606. i2 += pes.byteLength;
  72607. }
  72608. if (probe.ts.videoPacketContainsKeyFrame(frame)) {
  72609. var firstKeyFrame = probe.ts.parsePesTime(frame);
  72610. if (firstKeyFrame) {
  72611. result.firstKeyFrame = firstKeyFrame;
  72612. result.firstKeyFrame.type = "video";
  72613. } else {
  72614. console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.");
  72615. }
  72616. }
  72617. currentFrame.size = 0;
  72618. }
  72619. }
  72620. currentFrame.data.push(packet);
  72621. currentFrame.size += packet.byteLength;
  72622. }
  72623. }
  72624. break;
  72625. }
  72626. if (endLoop && result.firstKeyFrame) {
  72627. break;
  72628. }
  72629. startIndex += MP2T_PACKET_LENGTH;
  72630. endIndex += MP2T_PACKET_LENGTH;
  72631. continue;
  72632. }
  72633. startIndex++;
  72634. endIndex++;
  72635. }
  72636. endIndex = bytes.byteLength;
  72637. startIndex = endIndex - MP2T_PACKET_LENGTH;
  72638. endLoop = false;
  72639. while (startIndex >= 0) {
  72640. if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {
  72641. packet = bytes.subarray(startIndex, endIndex);
  72642. type3 = probe.ts.parseType(packet, pmt.pid);
  72643. switch (type3) {
  72644. case "pes":
  72645. pesType = probe.ts.parsePesType(packet, pmt.table);
  72646. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  72647. if (pesType === "video" && pusi) {
  72648. parsed = probe.ts.parsePesTime(packet);
  72649. if (parsed) {
  72650. parsed.type = "video";
  72651. result.video.push(parsed);
  72652. endLoop = true;
  72653. }
  72654. }
  72655. break;
  72656. }
  72657. if (endLoop) {
  72658. break;
  72659. }
  72660. startIndex -= MP2T_PACKET_LENGTH;
  72661. endIndex -= MP2T_PACKET_LENGTH;
  72662. continue;
  72663. }
  72664. startIndex--;
  72665. endIndex--;
  72666. }
  72667. };
  72668. var adjustTimestamp_ = function(segmentInfo, baseTimestamp) {
  72669. if (segmentInfo.audio && segmentInfo.audio.length) {
  72670. var audioBaseTimestamp = baseTimestamp;
  72671. if (typeof audioBaseTimestamp === "undefined" || isNaN(audioBaseTimestamp)) {
  72672. audioBaseTimestamp = segmentInfo.audio[0].dts;
  72673. }
  72674. segmentInfo.audio.forEach(function(info) {
  72675. info.dts = handleRollover(info.dts, audioBaseTimestamp);
  72676. info.pts = handleRollover(info.pts, audioBaseTimestamp);
  72677. info.dtsTime = info.dts / ONE_SECOND_IN_TS2;
  72678. info.ptsTime = info.pts / ONE_SECOND_IN_TS2;
  72679. });
  72680. }
  72681. if (segmentInfo.video && segmentInfo.video.length) {
  72682. var videoBaseTimestamp = baseTimestamp;
  72683. if (typeof videoBaseTimestamp === "undefined" || isNaN(videoBaseTimestamp)) {
  72684. videoBaseTimestamp = segmentInfo.video[0].dts;
  72685. }
  72686. segmentInfo.video.forEach(function(info) {
  72687. info.dts = handleRollover(info.dts, videoBaseTimestamp);
  72688. info.pts = handleRollover(info.pts, videoBaseTimestamp);
  72689. info.dtsTime = info.dts / ONE_SECOND_IN_TS2;
  72690. info.ptsTime = info.pts / ONE_SECOND_IN_TS2;
  72691. });
  72692. if (segmentInfo.firstKeyFrame) {
  72693. var frame = segmentInfo.firstKeyFrame;
  72694. frame.dts = handleRollover(frame.dts, videoBaseTimestamp);
  72695. frame.pts = handleRollover(frame.pts, videoBaseTimestamp);
  72696. frame.dtsTime = frame.dts / ONE_SECOND_IN_TS2;
  72697. frame.ptsTime = frame.pts / ONE_SECOND_IN_TS2;
  72698. }
  72699. }
  72700. };
  72701. var inspectAac_ = function(bytes) {
  72702. var endLoop = false, audioCount = 0, sampleRate = null, timestamp = null, frameSize = 0, byteIndex = 0, packet;
  72703. while (bytes.length - byteIndex >= 3) {
  72704. var type3 = probe.aac.parseType(bytes, byteIndex);
  72705. switch (type3) {
  72706. case "timed-metadata":
  72707. if (bytes.length - byteIndex < 10) {
  72708. endLoop = true;
  72709. break;
  72710. }
  72711. frameSize = probe.aac.parseId3TagSize(bytes, byteIndex);
  72712. if (frameSize > bytes.length) {
  72713. endLoop = true;
  72714. break;
  72715. }
  72716. if (timestamp === null) {
  72717. packet = bytes.subarray(byteIndex, byteIndex + frameSize);
  72718. timestamp = probe.aac.parseAacTimestamp(packet);
  72719. }
  72720. byteIndex += frameSize;
  72721. break;
  72722. case "audio":
  72723. if (bytes.length - byteIndex < 7) {
  72724. endLoop = true;
  72725. break;
  72726. }
  72727. frameSize = probe.aac.parseAdtsSize(bytes, byteIndex);
  72728. if (frameSize > bytes.length) {
  72729. endLoop = true;
  72730. break;
  72731. }
  72732. if (sampleRate === null) {
  72733. packet = bytes.subarray(byteIndex, byteIndex + frameSize);
  72734. sampleRate = probe.aac.parseSampleRate(packet);
  72735. }
  72736. audioCount++;
  72737. byteIndex += frameSize;
  72738. break;
  72739. default:
  72740. byteIndex++;
  72741. break;
  72742. }
  72743. if (endLoop) {
  72744. return null;
  72745. }
  72746. }
  72747. if (sampleRate === null || timestamp === null) {
  72748. return null;
  72749. }
  72750. var audioTimescale = ONE_SECOND_IN_TS2 / sampleRate;
  72751. var result = {
  72752. audio: [{
  72753. type: "audio",
  72754. dts: timestamp,
  72755. pts: timestamp
  72756. }, {
  72757. type: "audio",
  72758. dts: timestamp + audioCount * 1024 * audioTimescale,
  72759. pts: timestamp + audioCount * 1024 * audioTimescale
  72760. }]
  72761. };
  72762. return result;
  72763. };
  72764. var inspectTs_ = function(bytes) {
  72765. var pmt = {
  72766. pid: null,
  72767. table: null
  72768. };
  72769. var result = {};
  72770. parsePsi_(bytes, pmt);
  72771. for (var pid in pmt.table) {
  72772. if (pmt.table.hasOwnProperty(pid)) {
  72773. var type3 = pmt.table[pid];
  72774. switch (type3) {
  72775. case StreamTypes.H264_STREAM_TYPE:
  72776. result.video = [];
  72777. parseVideoPes_(bytes, pmt, result);
  72778. if (result.video.length === 0) {
  72779. delete result.video;
  72780. }
  72781. break;
  72782. case StreamTypes.ADTS_STREAM_TYPE:
  72783. result.audio = [];
  72784. parseAudioPes_(bytes, pmt, result);
  72785. if (result.audio.length === 0) {
  72786. delete result.audio;
  72787. }
  72788. break;
  72789. }
  72790. }
  72791. }
  72792. return result;
  72793. };
  72794. var inspect = function(bytes, baseTimestamp) {
  72795. var isAacData = probe.aac.isLikelyAacData(bytes);
  72796. var result;
  72797. if (isAacData) {
  72798. result = inspectAac_(bytes);
  72799. } else {
  72800. result = inspectTs_(bytes);
  72801. }
  72802. if (!result || !result.audio && !result.video) {
  72803. return null;
  72804. }
  72805. adjustTimestamp_(result, baseTimestamp);
  72806. return result;
  72807. };
  72808. var tsInspector = {
  72809. inspect,
  72810. parseAudioPes_
  72811. };
  72812. const wireTransmuxerEvents = function(self2, transmuxer2) {
  72813. transmuxer2.on("data", function(segment) {
  72814. const initArray = segment.initSegment;
  72815. segment.initSegment = {
  72816. data: initArray.buffer,
  72817. byteOffset: initArray.byteOffset,
  72818. byteLength: initArray.byteLength
  72819. };
  72820. const typedArray2 = segment.data;
  72821. segment.data = typedArray2.buffer;
  72822. self2.postMessage({
  72823. action: "data",
  72824. segment,
  72825. byteOffset: typedArray2.byteOffset,
  72826. byteLength: typedArray2.byteLength
  72827. }, [segment.data]);
  72828. });
  72829. transmuxer2.on("done", function(data) {
  72830. self2.postMessage({
  72831. action: "done"
  72832. });
  72833. });
  72834. transmuxer2.on("gopInfo", function(gopInfo) {
  72835. self2.postMessage({
  72836. action: "gopInfo",
  72837. gopInfo
  72838. });
  72839. });
  72840. transmuxer2.on("videoSegmentTimingInfo", function(timingInfo) {
  72841. const videoSegmentTimingInfo = {
  72842. start: {
  72843. decode: clock$2.videoTsToSeconds(timingInfo.start.dts),
  72844. presentation: clock$2.videoTsToSeconds(timingInfo.start.pts)
  72845. },
  72846. end: {
  72847. decode: clock$2.videoTsToSeconds(timingInfo.end.dts),
  72848. presentation: clock$2.videoTsToSeconds(timingInfo.end.pts)
  72849. },
  72850. baseMediaDecodeTime: clock$2.videoTsToSeconds(timingInfo.baseMediaDecodeTime)
  72851. };
  72852. if (timingInfo.prependedContentDuration) {
  72853. videoSegmentTimingInfo.prependedContentDuration = clock$2.videoTsToSeconds(timingInfo.prependedContentDuration);
  72854. }
  72855. self2.postMessage({
  72856. action: "videoSegmentTimingInfo",
  72857. videoSegmentTimingInfo
  72858. });
  72859. });
  72860. transmuxer2.on("audioSegmentTimingInfo", function(timingInfo) {
  72861. const audioSegmentTimingInfo = {
  72862. start: {
  72863. decode: clock$2.videoTsToSeconds(timingInfo.start.dts),
  72864. presentation: clock$2.videoTsToSeconds(timingInfo.start.pts)
  72865. },
  72866. end: {
  72867. decode: clock$2.videoTsToSeconds(timingInfo.end.dts),
  72868. presentation: clock$2.videoTsToSeconds(timingInfo.end.pts)
  72869. },
  72870. baseMediaDecodeTime: clock$2.videoTsToSeconds(timingInfo.baseMediaDecodeTime)
  72871. };
  72872. if (timingInfo.prependedContentDuration) {
  72873. audioSegmentTimingInfo.prependedContentDuration = clock$2.videoTsToSeconds(timingInfo.prependedContentDuration);
  72874. }
  72875. self2.postMessage({
  72876. action: "audioSegmentTimingInfo",
  72877. audioSegmentTimingInfo
  72878. });
  72879. });
  72880. transmuxer2.on("id3Frame", function(id3Frame) {
  72881. self2.postMessage({
  72882. action: "id3Frame",
  72883. id3Frame
  72884. });
  72885. });
  72886. transmuxer2.on("caption", function(caption) {
  72887. self2.postMessage({
  72888. action: "caption",
  72889. caption
  72890. });
  72891. });
  72892. transmuxer2.on("trackinfo", function(trackInfo) {
  72893. self2.postMessage({
  72894. action: "trackinfo",
  72895. trackInfo
  72896. });
  72897. });
  72898. transmuxer2.on("audioTimingInfo", function(audioTimingInfo) {
  72899. self2.postMessage({
  72900. action: "audioTimingInfo",
  72901. audioTimingInfo: {
  72902. start: clock$2.videoTsToSeconds(audioTimingInfo.start),
  72903. end: clock$2.videoTsToSeconds(audioTimingInfo.end)
  72904. }
  72905. });
  72906. });
  72907. transmuxer2.on("videoTimingInfo", function(videoTimingInfo) {
  72908. self2.postMessage({
  72909. action: "videoTimingInfo",
  72910. videoTimingInfo: {
  72911. start: clock$2.videoTsToSeconds(videoTimingInfo.start),
  72912. end: clock$2.videoTsToSeconds(videoTimingInfo.end)
  72913. }
  72914. });
  72915. });
  72916. transmuxer2.on("log", function(log2) {
  72917. self2.postMessage({
  72918. action: "log",
  72919. log: log2
  72920. });
  72921. });
  72922. };
  72923. class MessageHandlers {
  72924. constructor(self2, options2) {
  72925. this.options = options2 || {};
  72926. this.self = self2;
  72927. this.init();
  72928. }
  72929. init() {
  72930. if (this.transmuxer) {
  72931. this.transmuxer.dispose();
  72932. }
  72933. this.transmuxer = new transmuxer.Transmuxer(this.options);
  72934. wireTransmuxerEvents(this.self, this.transmuxer);
  72935. }
  72936. pushMp4Captions(data) {
  72937. if (!this.captionParser) {
  72938. this.captionParser = new captionParser();
  72939. this.captionParser.init();
  72940. }
  72941. const segment = new Uint8Array(data.data, data.byteOffset, data.byteLength);
  72942. const parsed = this.captionParser.parse(segment, data.trackIds, data.timescales);
  72943. this.self.postMessage({
  72944. action: "mp4Captions",
  72945. captions: parsed && parsed.captions || [],
  72946. logs: parsed && parsed.logs || [],
  72947. data: segment.buffer
  72948. }, [segment.buffer]);
  72949. }
  72950. probeMp4StartTime({
  72951. timescales,
  72952. data
  72953. }) {
  72954. const startTime2 = probe$2.startTime(timescales, data);
  72955. this.self.postMessage({
  72956. action: "probeMp4StartTime",
  72957. startTime: startTime2,
  72958. data
  72959. }, [data.buffer]);
  72960. }
  72961. probeMp4Tracks({
  72962. data
  72963. }) {
  72964. const tracks = probe$2.tracks(data);
  72965. this.self.postMessage({
  72966. action: "probeMp4Tracks",
  72967. tracks,
  72968. data
  72969. }, [data.buffer]);
  72970. }
  72971. probeTs({
  72972. data,
  72973. baseStartTime
  72974. }) {
  72975. const tsStartTime = typeof baseStartTime === "number" && !isNaN(baseStartTime) ? baseStartTime * clock$2.ONE_SECOND_IN_TS : void 0;
  72976. const timeInfo = tsInspector.inspect(data, tsStartTime);
  72977. let result = null;
  72978. if (timeInfo) {
  72979. result = {
  72980. hasVideo: timeInfo.video && timeInfo.video.length === 2 || false,
  72981. hasAudio: timeInfo.audio && timeInfo.audio.length === 2 || false
  72982. };
  72983. if (result.hasVideo) {
  72984. result.videoStart = timeInfo.video[0].ptsTime;
  72985. }
  72986. if (result.hasAudio) {
  72987. result.audioStart = timeInfo.audio[0].ptsTime;
  72988. }
  72989. }
  72990. this.self.postMessage({
  72991. action: "probeTs",
  72992. result,
  72993. data
  72994. }, [data.buffer]);
  72995. }
  72996. clearAllMp4Captions() {
  72997. if (this.captionParser) {
  72998. this.captionParser.clearAllCaptions();
  72999. }
  73000. }
  73001. clearParsedMp4Captions() {
  73002. if (this.captionParser) {
  73003. this.captionParser.clearParsedCaptions();
  73004. }
  73005. }
  73006. push(data) {
  73007. const segment = new Uint8Array(data.data, data.byteOffset, data.byteLength);
  73008. this.transmuxer.push(segment);
  73009. }
  73010. reset() {
  73011. this.transmuxer.reset();
  73012. }
  73013. setTimestampOffset(data) {
  73014. const timestampOffset2 = data.timestampOffset || 0;
  73015. this.transmuxer.setBaseMediaDecodeTime(Math.round(clock$2.secondsToVideoTs(timestampOffset2)));
  73016. }
  73017. setAudioAppendStart(data) {
  73018. this.transmuxer.setAudioAppendStart(Math.ceil(clock$2.secondsToVideoTs(data.appendStart)));
  73019. }
  73020. setRemux(data) {
  73021. this.transmuxer.setRemux(data.remux);
  73022. }
  73023. flush(data) {
  73024. this.transmuxer.flush();
  73025. self.postMessage({
  73026. action: "done",
  73027. type: "transmuxed"
  73028. });
  73029. }
  73030. endTimeline() {
  73031. this.transmuxer.endTimeline();
  73032. self.postMessage({
  73033. action: "endedtimeline",
  73034. type: "transmuxed"
  73035. });
  73036. }
  73037. alignGopsWith(data) {
  73038. this.transmuxer.alignGopsWith(data.gopsToAlignWith.slice());
  73039. }
  73040. }
  73041. self.onmessage = function(event2) {
  73042. if (event2.data.action === "init" && event2.data.options) {
  73043. this.messageHandlers = new MessageHandlers(self, event2.data.options);
  73044. return;
  73045. }
  73046. if (!this.messageHandlers) {
  73047. this.messageHandlers = new MessageHandlers(self);
  73048. }
  73049. if (event2.data && event2.data.action && event2.data.action !== "init") {
  73050. if (this.messageHandlers[event2.data.action]) {
  73051. this.messageHandlers[event2.data.action](event2.data);
  73052. }
  73053. }
  73054. };
  73055. }));
  73056. var TransmuxWorker$1 = factory$1(workerCode$1$1);
  73057. const handleData_$1 = (event2, transmuxedData, callback2) => {
  73058. const {
  73059. type: type2,
  73060. initSegment,
  73061. captions,
  73062. captionStreams,
  73063. metadata,
  73064. videoFrameDtsTime,
  73065. videoFramePtsTime
  73066. } = event2.data.segment;
  73067. transmuxedData.buffer.push({
  73068. captions,
  73069. captionStreams,
  73070. metadata
  73071. });
  73072. const boxes = event2.data.segment.boxes || {
  73073. data: event2.data.segment.data
  73074. };
  73075. const result = {
  73076. type: type2,
  73077. data: new Uint8Array(boxes.data, boxes.data.byteOffset, boxes.data.byteLength),
  73078. initSegment: new Uint8Array(initSegment.data, initSegment.byteOffset, initSegment.byteLength)
  73079. };
  73080. if (typeof videoFrameDtsTime !== "undefined") {
  73081. result.videoFrameDtsTime = videoFrameDtsTime;
  73082. }
  73083. if (typeof videoFramePtsTime !== "undefined") {
  73084. result.videoFramePtsTime = videoFramePtsTime;
  73085. }
  73086. callback2(result);
  73087. };
  73088. const handleDone_$1 = ({
  73089. transmuxedData,
  73090. callback: callback2
  73091. }) => {
  73092. transmuxedData.buffer = [];
  73093. callback2(transmuxedData);
  73094. };
  73095. const handleGopInfo_$1 = (event2, transmuxedData) => {
  73096. transmuxedData.gopInfo = event2.data.gopInfo;
  73097. };
  73098. const processTransmux$1 = (options2) => {
  73099. const {
  73100. transmuxer,
  73101. bytes,
  73102. audioAppendStart,
  73103. gopsToAlignWith,
  73104. remux,
  73105. onData,
  73106. onTrackInfo,
  73107. onAudioTimingInfo,
  73108. onVideoTimingInfo,
  73109. onVideoSegmentTimingInfo,
  73110. onAudioSegmentTimingInfo,
  73111. onId3,
  73112. onCaptions,
  73113. onDone,
  73114. onEndedTimeline,
  73115. onTransmuxerLog,
  73116. isEndOfTimeline
  73117. } = options2;
  73118. const transmuxedData = {
  73119. buffer: []
  73120. };
  73121. let waitForEndedTimelineEvent = isEndOfTimeline;
  73122. const handleMessage = (event2) => {
  73123. if (transmuxer.currentTransmux !== options2) {
  73124. return;
  73125. }
  73126. if (event2.data.action === "data") {
  73127. handleData_$1(event2, transmuxedData, onData);
  73128. }
  73129. if (event2.data.action === "trackinfo") {
  73130. onTrackInfo(event2.data.trackInfo);
  73131. }
  73132. if (event2.data.action === "gopInfo") {
  73133. handleGopInfo_$1(event2, transmuxedData);
  73134. }
  73135. if (event2.data.action === "audioTimingInfo") {
  73136. onAudioTimingInfo(event2.data.audioTimingInfo);
  73137. }
  73138. if (event2.data.action === "videoTimingInfo") {
  73139. onVideoTimingInfo(event2.data.videoTimingInfo);
  73140. }
  73141. if (event2.data.action === "videoSegmentTimingInfo") {
  73142. onVideoSegmentTimingInfo(event2.data.videoSegmentTimingInfo);
  73143. }
  73144. if (event2.data.action === "audioSegmentTimingInfo") {
  73145. onAudioSegmentTimingInfo(event2.data.audioSegmentTimingInfo);
  73146. }
  73147. if (event2.data.action === "id3Frame") {
  73148. onId3([event2.data.id3Frame], event2.data.id3Frame.dispatchType);
  73149. }
  73150. if (event2.data.action === "caption") {
  73151. onCaptions(event2.data.caption);
  73152. }
  73153. if (event2.data.action === "endedtimeline") {
  73154. waitForEndedTimelineEvent = false;
  73155. onEndedTimeline();
  73156. }
  73157. if (event2.data.action === "log") {
  73158. onTransmuxerLog(event2.data.log);
  73159. }
  73160. if (event2.data.type !== "transmuxed") {
  73161. return;
  73162. }
  73163. if (waitForEndedTimelineEvent) {
  73164. return;
  73165. }
  73166. transmuxer.onmessage = null;
  73167. handleDone_$1({
  73168. transmuxedData,
  73169. callback: onDone
  73170. });
  73171. dequeue$1(transmuxer);
  73172. };
  73173. transmuxer.onmessage = handleMessage;
  73174. if (audioAppendStart) {
  73175. transmuxer.postMessage({
  73176. action: "setAudioAppendStart",
  73177. appendStart: audioAppendStart
  73178. });
  73179. }
  73180. if (Array.isArray(gopsToAlignWith)) {
  73181. transmuxer.postMessage({
  73182. action: "alignGopsWith",
  73183. gopsToAlignWith
  73184. });
  73185. }
  73186. if (typeof remux !== "undefined") {
  73187. transmuxer.postMessage({
  73188. action: "setRemux",
  73189. remux
  73190. });
  73191. }
  73192. if (bytes.byteLength) {
  73193. const buffer = bytes instanceof ArrayBuffer ? bytes : bytes.buffer;
  73194. const byteOffset = bytes instanceof ArrayBuffer ? 0 : bytes.byteOffset;
  73195. transmuxer.postMessage({
  73196. action: "push",
  73197. data: buffer,
  73198. byteOffset,
  73199. byteLength: bytes.byteLength
  73200. }, [buffer]);
  73201. }
  73202. if (isEndOfTimeline) {
  73203. transmuxer.postMessage({
  73204. action: "endTimeline"
  73205. });
  73206. }
  73207. transmuxer.postMessage({
  73208. action: "flush"
  73209. });
  73210. };
  73211. const dequeue$1 = (transmuxer) => {
  73212. transmuxer.currentTransmux = null;
  73213. if (transmuxer.transmuxQueue.length) {
  73214. transmuxer.currentTransmux = transmuxer.transmuxQueue.shift();
  73215. if (typeof transmuxer.currentTransmux === "function") {
  73216. transmuxer.currentTransmux();
  73217. } else {
  73218. processTransmux$1(transmuxer.currentTransmux);
  73219. }
  73220. }
  73221. };
  73222. const processAction$1 = (transmuxer, action) => {
  73223. transmuxer.postMessage({
  73224. action
  73225. });
  73226. dequeue$1(transmuxer);
  73227. };
  73228. const enqueueAction$1 = (action, transmuxer) => {
  73229. if (!transmuxer.currentTransmux) {
  73230. transmuxer.currentTransmux = action;
  73231. processAction$1(transmuxer, action);
  73232. return;
  73233. }
  73234. transmuxer.transmuxQueue.push(processAction$1.bind(null, transmuxer, action));
  73235. };
  73236. const reset$1 = (transmuxer) => {
  73237. enqueueAction$1("reset", transmuxer);
  73238. };
  73239. const endTimeline$1 = (transmuxer) => {
  73240. enqueueAction$1("endTimeline", transmuxer);
  73241. };
  73242. const transmux$1 = (options2) => {
  73243. if (!options2.transmuxer.currentTransmux) {
  73244. options2.transmuxer.currentTransmux = options2;
  73245. processTransmux$1(options2);
  73246. return;
  73247. }
  73248. options2.transmuxer.transmuxQueue.push(options2);
  73249. };
  73250. const createTransmuxer$1 = (options2) => {
  73251. const transmuxer = new TransmuxWorker$1();
  73252. transmuxer.currentTransmux = null;
  73253. transmuxer.transmuxQueue = [];
  73254. const term = transmuxer.terminate;
  73255. transmuxer.terminate = () => {
  73256. transmuxer.currentTransmux = null;
  73257. transmuxer.transmuxQueue.length = 0;
  73258. return term.call(transmuxer);
  73259. };
  73260. transmuxer.postMessage({
  73261. action: "init",
  73262. options: options2
  73263. });
  73264. return transmuxer;
  73265. };
  73266. var segmentTransmuxer$1 = {
  73267. reset: reset$1,
  73268. endTimeline: endTimeline$1,
  73269. transmux: transmux$1,
  73270. createTransmuxer: createTransmuxer$1
  73271. };
  73272. const workerCallback$1 = function(options2) {
  73273. const transmuxer = options2.transmuxer;
  73274. const endAction = options2.endAction || options2.action;
  73275. const callback2 = options2.callback;
  73276. const message = _extends$2({}, options2, {
  73277. endAction: null,
  73278. transmuxer: null,
  73279. callback: null
  73280. });
  73281. const listenForEndEvent = (event2) => {
  73282. if (event2.data.action !== endAction) {
  73283. return;
  73284. }
  73285. transmuxer.removeEventListener("message", listenForEndEvent);
  73286. if (event2.data.data) {
  73287. event2.data.data = new Uint8Array(event2.data.data, options2.byteOffset || 0, options2.byteLength || event2.data.data.byteLength);
  73288. if (options2.data) {
  73289. options2.data = event2.data.data;
  73290. }
  73291. }
  73292. callback2(event2.data);
  73293. };
  73294. transmuxer.addEventListener("message", listenForEndEvent);
  73295. if (options2.data) {
  73296. const isArrayBuffer = options2.data instanceof ArrayBuffer;
  73297. message.byteOffset = isArrayBuffer ? 0 : options2.data.byteOffset;
  73298. message.byteLength = options2.data.byteLength;
  73299. const transfers = [isArrayBuffer ? options2.data : options2.data.buffer];
  73300. transmuxer.postMessage(message, transfers);
  73301. } else {
  73302. transmuxer.postMessage(message);
  73303. }
  73304. };
  73305. const REQUEST_ERRORS$1 = {
  73306. FAILURE: 2,
  73307. TIMEOUT: -101,
  73308. ABORTED: -102
  73309. };
  73310. const abortAll$1 = (activeXhrs) => {
  73311. activeXhrs.forEach((xhr) => {
  73312. xhr.abort();
  73313. });
  73314. };
  73315. const getRequestStats$1 = (request) => {
  73316. return {
  73317. bandwidth: request.bandwidth,
  73318. bytesReceived: request.bytesReceived || 0,
  73319. roundTripTime: request.roundTripTime || 0
  73320. };
  73321. };
  73322. const getProgressStats$1 = (progressEvent) => {
  73323. const request = progressEvent.target;
  73324. const roundTripTime = Date.now() - request.requestTime;
  73325. const stats = {
  73326. bandwidth: Infinity,
  73327. bytesReceived: 0,
  73328. roundTripTime: roundTripTime || 0
  73329. };
  73330. stats.bytesReceived = progressEvent.loaded;
  73331. stats.bandwidth = Math.floor(stats.bytesReceived / stats.roundTripTime * 8 * 1e3);
  73332. return stats;
  73333. };
  73334. const handleErrors$1 = (error, request) => {
  73335. if (request.timedout) {
  73336. return {
  73337. status: request.status,
  73338. message: "HLS request timed-out at URL: " + request.uri,
  73339. code: REQUEST_ERRORS$1.TIMEOUT,
  73340. xhr: request
  73341. };
  73342. }
  73343. if (request.aborted) {
  73344. return {
  73345. status: request.status,
  73346. message: "HLS request aborted at URL: " + request.uri,
  73347. code: REQUEST_ERRORS$1.ABORTED,
  73348. xhr: request
  73349. };
  73350. }
  73351. if (error) {
  73352. return {
  73353. status: request.status,
  73354. message: "HLS request errored at URL: " + request.uri,
  73355. code: REQUEST_ERRORS$1.FAILURE,
  73356. xhr: request
  73357. };
  73358. }
  73359. if (request.responseType === "arraybuffer" && request.response.byteLength === 0) {
  73360. return {
  73361. status: request.status,
  73362. message: "Empty HLS response at URL: " + request.uri,
  73363. code: REQUEST_ERRORS$1.FAILURE,
  73364. xhr: request
  73365. };
  73366. }
  73367. return null;
  73368. };
  73369. const handleKeyResponse$1 = (segment, objects, finishProcessingFn) => (error, request) => {
  73370. const response = request.response;
  73371. const errorObj = handleErrors$1(error, request);
  73372. if (errorObj) {
  73373. return finishProcessingFn(errorObj, segment);
  73374. }
  73375. if (response.byteLength !== 16) {
  73376. return finishProcessingFn({
  73377. status: request.status,
  73378. message: "Invalid HLS key at URL: " + request.uri,
  73379. code: REQUEST_ERRORS$1.FAILURE,
  73380. xhr: request
  73381. }, segment);
  73382. }
  73383. const view = new DataView(response);
  73384. const bytes = new Uint32Array([view.getUint32(0), view.getUint32(4), view.getUint32(8), view.getUint32(12)]);
  73385. for (let i2 = 0; i2 < objects.length; i2++) {
  73386. objects[i2].bytes = bytes;
  73387. }
  73388. return finishProcessingFn(null, segment);
  73389. };
  73390. const parseInitSegment$1 = (segment, callback2) => {
  73391. const type2 = detectContainerForBytes$1(segment.map.bytes);
  73392. if (type2 !== "mp4") {
  73393. const uri = segment.map.resolvedUri || segment.map.uri;
  73394. return callback2({
  73395. internal: true,
  73396. message: `Found unsupported ${type2 || "unknown"} container for initialization segment at URL: ${uri}`,
  73397. code: REQUEST_ERRORS$1.FAILURE
  73398. });
  73399. }
  73400. workerCallback$1({
  73401. action: "probeMp4Tracks",
  73402. data: segment.map.bytes,
  73403. transmuxer: segment.transmuxer,
  73404. callback: ({
  73405. tracks,
  73406. data
  73407. }) => {
  73408. segment.map.bytes = data;
  73409. tracks.forEach(function(track) {
  73410. segment.map.tracks = segment.map.tracks || {};
  73411. if (segment.map.tracks[track.type]) {
  73412. return;
  73413. }
  73414. segment.map.tracks[track.type] = track;
  73415. if (typeof track.id === "number" && track.timescale) {
  73416. segment.map.timescales = segment.map.timescales || {};
  73417. segment.map.timescales[track.id] = track.timescale;
  73418. }
  73419. });
  73420. return callback2(null);
  73421. }
  73422. });
  73423. };
  73424. const handleInitSegmentResponse$1 = ({
  73425. segment,
  73426. finishProcessingFn
  73427. }) => (error, request) => {
  73428. const errorObj = handleErrors$1(error, request);
  73429. if (errorObj) {
  73430. return finishProcessingFn(errorObj, segment);
  73431. }
  73432. const bytes = new Uint8Array(request.response);
  73433. if (segment.map.key) {
  73434. segment.map.encryptedBytes = bytes;
  73435. return finishProcessingFn(null, segment);
  73436. }
  73437. segment.map.bytes = bytes;
  73438. parseInitSegment$1(segment, function(parseError) {
  73439. if (parseError) {
  73440. parseError.xhr = request;
  73441. parseError.status = request.status;
  73442. return finishProcessingFn(parseError, segment);
  73443. }
  73444. finishProcessingFn(null, segment);
  73445. });
  73446. };
  73447. const handleSegmentResponse$1 = ({
  73448. segment,
  73449. finishProcessingFn,
  73450. responseType
  73451. }) => (error, request) => {
  73452. const errorObj = handleErrors$1(error, request);
  73453. if (errorObj) {
  73454. return finishProcessingFn(errorObj, segment);
  73455. }
  73456. const newBytes = responseType === "arraybuffer" || !request.responseText ? request.response : stringToArrayBuffer$1(request.responseText.substring(segment.lastReachedChar || 0));
  73457. segment.stats = getRequestStats$1(request);
  73458. if (segment.key) {
  73459. segment.encryptedBytes = new Uint8Array(newBytes);
  73460. } else {
  73461. segment.bytes = new Uint8Array(newBytes);
  73462. }
  73463. return finishProcessingFn(null, segment);
  73464. };
  73465. const transmuxAndNotify$1 = ({
  73466. segment,
  73467. bytes,
  73468. trackInfoFn,
  73469. timingInfoFn,
  73470. videoSegmentTimingInfoFn,
  73471. audioSegmentTimingInfoFn,
  73472. id3Fn,
  73473. captionsFn,
  73474. isEndOfTimeline,
  73475. endedTimelineFn,
  73476. dataFn,
  73477. doneFn,
  73478. onTransmuxerLog
  73479. }) => {
  73480. const fmp4Tracks = segment.map && segment.map.tracks || {};
  73481. const isMuxed3 = Boolean(fmp4Tracks.audio && fmp4Tracks.video);
  73482. let audioStartFn = timingInfoFn.bind(null, segment, "audio", "start");
  73483. const audioEndFn = timingInfoFn.bind(null, segment, "audio", "end");
  73484. let videoStartFn = timingInfoFn.bind(null, segment, "video", "start");
  73485. const videoEndFn = timingInfoFn.bind(null, segment, "video", "end");
  73486. const finish = () => transmux$1({
  73487. bytes,
  73488. transmuxer: segment.transmuxer,
  73489. audioAppendStart: segment.audioAppendStart,
  73490. gopsToAlignWith: segment.gopsToAlignWith,
  73491. remux: isMuxed3,
  73492. onData: (result) => {
  73493. result.type = result.type === "combined" ? "video" : result.type;
  73494. dataFn(segment, result);
  73495. },
  73496. onTrackInfo: (trackInfo) => {
  73497. if (trackInfoFn) {
  73498. if (isMuxed3) {
  73499. trackInfo.isMuxed = true;
  73500. }
  73501. trackInfoFn(segment, trackInfo);
  73502. }
  73503. },
  73504. onAudioTimingInfo: (audioTimingInfo) => {
  73505. if (audioStartFn && typeof audioTimingInfo.start !== "undefined") {
  73506. audioStartFn(audioTimingInfo.start);
  73507. audioStartFn = null;
  73508. }
  73509. if (audioEndFn && typeof audioTimingInfo.end !== "undefined") {
  73510. audioEndFn(audioTimingInfo.end);
  73511. }
  73512. },
  73513. onVideoTimingInfo: (videoTimingInfo) => {
  73514. if (videoStartFn && typeof videoTimingInfo.start !== "undefined") {
  73515. videoStartFn(videoTimingInfo.start);
  73516. videoStartFn = null;
  73517. }
  73518. if (videoEndFn && typeof videoTimingInfo.end !== "undefined") {
  73519. videoEndFn(videoTimingInfo.end);
  73520. }
  73521. },
  73522. onVideoSegmentTimingInfo: (videoSegmentTimingInfo) => {
  73523. videoSegmentTimingInfoFn(videoSegmentTimingInfo);
  73524. },
  73525. onAudioSegmentTimingInfo: (audioSegmentTimingInfo) => {
  73526. audioSegmentTimingInfoFn(audioSegmentTimingInfo);
  73527. },
  73528. onId3: (id3Frames, dispatchType) => {
  73529. id3Fn(segment, id3Frames, dispatchType);
  73530. },
  73531. onCaptions: (captions) => {
  73532. captionsFn(segment, [captions]);
  73533. },
  73534. isEndOfTimeline,
  73535. onEndedTimeline: () => {
  73536. endedTimelineFn();
  73537. },
  73538. onTransmuxerLog,
  73539. onDone: (result) => {
  73540. if (!doneFn) {
  73541. return;
  73542. }
  73543. result.type = result.type === "combined" ? "video" : result.type;
  73544. doneFn(null, segment, result);
  73545. }
  73546. });
  73547. workerCallback$1({
  73548. action: "probeTs",
  73549. transmuxer: segment.transmuxer,
  73550. data: bytes,
  73551. baseStartTime: segment.baseStartTime,
  73552. callback: (data) => {
  73553. segment.bytes = bytes = data.data;
  73554. const probeResult = data.result;
  73555. if (probeResult) {
  73556. trackInfoFn(segment, {
  73557. hasAudio: probeResult.hasAudio,
  73558. hasVideo: probeResult.hasVideo,
  73559. isMuxed: isMuxed3
  73560. });
  73561. trackInfoFn = null;
  73562. if (probeResult.hasAudio && !isMuxed3) {
  73563. audioStartFn(probeResult.audioStart);
  73564. }
  73565. if (probeResult.hasVideo) {
  73566. videoStartFn(probeResult.videoStart);
  73567. }
  73568. audioStartFn = null;
  73569. videoStartFn = null;
  73570. }
  73571. finish();
  73572. }
  73573. });
  73574. };
  73575. const handleSegmentBytes$1 = ({
  73576. segment,
  73577. bytes,
  73578. trackInfoFn,
  73579. timingInfoFn,
  73580. videoSegmentTimingInfoFn,
  73581. audioSegmentTimingInfoFn,
  73582. id3Fn,
  73583. captionsFn,
  73584. isEndOfTimeline,
  73585. endedTimelineFn,
  73586. dataFn,
  73587. doneFn,
  73588. onTransmuxerLog
  73589. }) => {
  73590. let bytesAsUint8Array = new Uint8Array(bytes);
  73591. if (isLikelyFmp4MediaSegment$1(bytesAsUint8Array)) {
  73592. segment.isFmp4 = true;
  73593. const {
  73594. tracks
  73595. } = segment.map;
  73596. const trackInfo = {
  73597. isFmp4: true,
  73598. hasVideo: !!tracks.video,
  73599. hasAudio: !!tracks.audio
  73600. };
  73601. if (tracks.audio && tracks.audio.codec && tracks.audio.codec !== "enca") {
  73602. trackInfo.audioCodec = tracks.audio.codec;
  73603. }
  73604. if (tracks.video && tracks.video.codec && tracks.video.codec !== "encv") {
  73605. trackInfo.videoCodec = tracks.video.codec;
  73606. }
  73607. if (tracks.video && tracks.audio) {
  73608. trackInfo.isMuxed = true;
  73609. }
  73610. trackInfoFn(segment, trackInfo);
  73611. const finishLoading = (captions) => {
  73612. dataFn(segment, {
  73613. data: bytesAsUint8Array,
  73614. type: trackInfo.hasAudio && !trackInfo.isMuxed ? "audio" : "video"
  73615. });
  73616. if (captions && captions.length) {
  73617. captionsFn(segment, captions);
  73618. }
  73619. doneFn(null, segment, {});
  73620. };
  73621. workerCallback$1({
  73622. action: "probeMp4StartTime",
  73623. timescales: segment.map.timescales,
  73624. data: bytesAsUint8Array,
  73625. transmuxer: segment.transmuxer,
  73626. callback: ({
  73627. data,
  73628. startTime
  73629. }) => {
  73630. bytes = data.buffer;
  73631. segment.bytes = bytesAsUint8Array = data;
  73632. if (trackInfo.hasAudio && !trackInfo.isMuxed) {
  73633. timingInfoFn(segment, "audio", "start", startTime);
  73634. }
  73635. if (trackInfo.hasVideo) {
  73636. timingInfoFn(segment, "video", "start", startTime);
  73637. }
  73638. if (!tracks.video || !data.byteLength || !segment.transmuxer) {
  73639. finishLoading();
  73640. return;
  73641. }
  73642. workerCallback$1({
  73643. action: "pushMp4Captions",
  73644. endAction: "mp4Captions",
  73645. transmuxer: segment.transmuxer,
  73646. data: bytesAsUint8Array,
  73647. timescales: segment.map.timescales,
  73648. trackIds: [tracks.video.id],
  73649. callback: (message) => {
  73650. bytes = message.data.buffer;
  73651. segment.bytes = bytesAsUint8Array = message.data;
  73652. message.logs.forEach(function(log2) {
  73653. onTransmuxerLog(merge$2(log2, {
  73654. stream: "mp4CaptionParser"
  73655. }));
  73656. });
  73657. finishLoading(message.captions);
  73658. }
  73659. });
  73660. }
  73661. });
  73662. return;
  73663. }
  73664. if (!segment.transmuxer) {
  73665. doneFn(null, segment, {});
  73666. return;
  73667. }
  73668. if (typeof segment.container === "undefined") {
  73669. segment.container = detectContainerForBytes$1(bytesAsUint8Array);
  73670. }
  73671. if (segment.container !== "ts" && segment.container !== "aac") {
  73672. trackInfoFn(segment, {
  73673. hasAudio: false,
  73674. hasVideo: false
  73675. });
  73676. doneFn(null, segment, {});
  73677. return;
  73678. }
  73679. transmuxAndNotify$1({
  73680. segment,
  73681. bytes,
  73682. trackInfoFn,
  73683. timingInfoFn,
  73684. videoSegmentTimingInfoFn,
  73685. audioSegmentTimingInfoFn,
  73686. id3Fn,
  73687. captionsFn,
  73688. isEndOfTimeline,
  73689. endedTimelineFn,
  73690. dataFn,
  73691. doneFn,
  73692. onTransmuxerLog
  73693. });
  73694. };
  73695. const decrypt$1 = function({
  73696. id,
  73697. key,
  73698. encryptedBytes,
  73699. decryptionWorker
  73700. }, callback2) {
  73701. const decryptionHandler = (event2) => {
  73702. if (event2.data.source === id) {
  73703. decryptionWorker.removeEventListener("message", decryptionHandler);
  73704. const decrypted = event2.data.decrypted;
  73705. callback2(new Uint8Array(decrypted.bytes, decrypted.byteOffset, decrypted.byteLength));
  73706. }
  73707. };
  73708. decryptionWorker.addEventListener("message", decryptionHandler);
  73709. let keyBytes;
  73710. if (key.bytes.slice) {
  73711. keyBytes = key.bytes.slice();
  73712. } else {
  73713. keyBytes = new Uint32Array(Array.prototype.slice.call(key.bytes));
  73714. }
  73715. decryptionWorker.postMessage(createTransferableMessage$1({
  73716. source: id,
  73717. encrypted: encryptedBytes,
  73718. key: keyBytes,
  73719. iv: key.iv
  73720. }), [encryptedBytes.buffer, keyBytes.buffer]);
  73721. };
  73722. const decryptSegment$1 = ({
  73723. decryptionWorker,
  73724. segment,
  73725. trackInfoFn,
  73726. timingInfoFn,
  73727. videoSegmentTimingInfoFn,
  73728. audioSegmentTimingInfoFn,
  73729. id3Fn,
  73730. captionsFn,
  73731. isEndOfTimeline,
  73732. endedTimelineFn,
  73733. dataFn,
  73734. doneFn,
  73735. onTransmuxerLog
  73736. }) => {
  73737. decrypt$1({
  73738. id: segment.requestId,
  73739. key: segment.key,
  73740. encryptedBytes: segment.encryptedBytes,
  73741. decryptionWorker
  73742. }, (decryptedBytes) => {
  73743. segment.bytes = decryptedBytes;
  73744. handleSegmentBytes$1({
  73745. segment,
  73746. bytes: segment.bytes,
  73747. trackInfoFn,
  73748. timingInfoFn,
  73749. videoSegmentTimingInfoFn,
  73750. audioSegmentTimingInfoFn,
  73751. id3Fn,
  73752. captionsFn,
  73753. isEndOfTimeline,
  73754. endedTimelineFn,
  73755. dataFn,
  73756. doneFn,
  73757. onTransmuxerLog
  73758. });
  73759. });
  73760. };
  73761. const waitForCompletion$1 = ({
  73762. activeXhrs,
  73763. decryptionWorker,
  73764. trackInfoFn,
  73765. timingInfoFn,
  73766. videoSegmentTimingInfoFn,
  73767. audioSegmentTimingInfoFn,
  73768. id3Fn,
  73769. captionsFn,
  73770. isEndOfTimeline,
  73771. endedTimelineFn,
  73772. dataFn,
  73773. doneFn,
  73774. onTransmuxerLog
  73775. }) => {
  73776. let count = 0;
  73777. let didError = false;
  73778. return (error, segment) => {
  73779. if (didError) {
  73780. return;
  73781. }
  73782. if (error) {
  73783. didError = true;
  73784. abortAll$1(activeXhrs);
  73785. return doneFn(error, segment);
  73786. }
  73787. count += 1;
  73788. if (count === activeXhrs.length) {
  73789. const segmentFinish = function() {
  73790. if (segment.encryptedBytes) {
  73791. return decryptSegment$1({
  73792. decryptionWorker,
  73793. segment,
  73794. trackInfoFn,
  73795. timingInfoFn,
  73796. videoSegmentTimingInfoFn,
  73797. audioSegmentTimingInfoFn,
  73798. id3Fn,
  73799. captionsFn,
  73800. isEndOfTimeline,
  73801. endedTimelineFn,
  73802. dataFn,
  73803. doneFn,
  73804. onTransmuxerLog
  73805. });
  73806. }
  73807. handleSegmentBytes$1({
  73808. segment,
  73809. bytes: segment.bytes,
  73810. trackInfoFn,
  73811. timingInfoFn,
  73812. videoSegmentTimingInfoFn,
  73813. audioSegmentTimingInfoFn,
  73814. id3Fn,
  73815. captionsFn,
  73816. isEndOfTimeline,
  73817. endedTimelineFn,
  73818. dataFn,
  73819. doneFn,
  73820. onTransmuxerLog
  73821. });
  73822. };
  73823. segment.endOfAllRequests = Date.now();
  73824. if (segment.map && segment.map.encryptedBytes && !segment.map.bytes) {
  73825. return decrypt$1({
  73826. decryptionWorker,
  73827. id: segment.requestId + "-init",
  73828. encryptedBytes: segment.map.encryptedBytes,
  73829. key: segment.map.key
  73830. }, (decryptedBytes) => {
  73831. segment.map.bytes = decryptedBytes;
  73832. parseInitSegment$1(segment, (parseError) => {
  73833. if (parseError) {
  73834. abortAll$1(activeXhrs);
  73835. return doneFn(parseError, segment);
  73836. }
  73837. segmentFinish();
  73838. });
  73839. });
  73840. }
  73841. segmentFinish();
  73842. }
  73843. };
  73844. };
  73845. const handleLoadEnd$1 = ({
  73846. loadendState,
  73847. abortFn
  73848. }) => (event2) => {
  73849. const request = event2.target;
  73850. if (request.aborted && abortFn && !loadendState.calledAbortFn) {
  73851. abortFn();
  73852. loadendState.calledAbortFn = true;
  73853. }
  73854. };
  73855. const handleProgress$1 = ({
  73856. segment,
  73857. progressFn,
  73858. trackInfoFn,
  73859. timingInfoFn,
  73860. videoSegmentTimingInfoFn,
  73861. audioSegmentTimingInfoFn,
  73862. id3Fn,
  73863. captionsFn,
  73864. isEndOfTimeline,
  73865. endedTimelineFn,
  73866. dataFn
  73867. }) => (event2) => {
  73868. const request = event2.target;
  73869. if (request.aborted) {
  73870. return;
  73871. }
  73872. segment.stats = merge$2(segment.stats, getProgressStats$1(event2));
  73873. if (!segment.stats.firstBytesReceivedAt && segment.stats.bytesReceived) {
  73874. segment.stats.firstBytesReceivedAt = Date.now();
  73875. }
  73876. return progressFn(event2, segment);
  73877. };
  73878. const mediaSegmentRequest$1 = ({
  73879. xhr,
  73880. xhrOptions,
  73881. decryptionWorker,
  73882. segment,
  73883. abortFn,
  73884. progressFn,
  73885. trackInfoFn,
  73886. timingInfoFn,
  73887. videoSegmentTimingInfoFn,
  73888. audioSegmentTimingInfoFn,
  73889. id3Fn,
  73890. captionsFn,
  73891. isEndOfTimeline,
  73892. endedTimelineFn,
  73893. dataFn,
  73894. doneFn,
  73895. onTransmuxerLog
  73896. }) => {
  73897. const activeXhrs = [];
  73898. const finishProcessingFn = waitForCompletion$1({
  73899. activeXhrs,
  73900. decryptionWorker,
  73901. trackInfoFn,
  73902. timingInfoFn,
  73903. videoSegmentTimingInfoFn,
  73904. audioSegmentTimingInfoFn,
  73905. id3Fn,
  73906. captionsFn,
  73907. isEndOfTimeline,
  73908. endedTimelineFn,
  73909. dataFn,
  73910. doneFn,
  73911. onTransmuxerLog
  73912. });
  73913. if (segment.key && !segment.key.bytes) {
  73914. const objects = [segment.key];
  73915. if (segment.map && !segment.map.bytes && segment.map.key && segment.map.key.resolvedUri === segment.key.resolvedUri) {
  73916. objects.push(segment.map.key);
  73917. }
  73918. const keyRequestOptions = merge$2(xhrOptions, {
  73919. uri: segment.key.resolvedUri,
  73920. responseType: "arraybuffer"
  73921. });
  73922. const keyRequestCallback = handleKeyResponse$1(segment, objects, finishProcessingFn);
  73923. const keyXhr = xhr(keyRequestOptions, keyRequestCallback);
  73924. activeXhrs.push(keyXhr);
  73925. }
  73926. if (segment.map && !segment.map.bytes) {
  73927. const differentMapKey = segment.map.key && (!segment.key || segment.key.resolvedUri !== segment.map.key.resolvedUri);
  73928. if (differentMapKey) {
  73929. const mapKeyRequestOptions = merge$2(xhrOptions, {
  73930. uri: segment.map.key.resolvedUri,
  73931. responseType: "arraybuffer"
  73932. });
  73933. const mapKeyRequestCallback = handleKeyResponse$1(segment, [segment.map.key], finishProcessingFn);
  73934. const mapKeyXhr = xhr(mapKeyRequestOptions, mapKeyRequestCallback);
  73935. activeXhrs.push(mapKeyXhr);
  73936. }
  73937. const initSegmentOptions = merge$2(xhrOptions, {
  73938. uri: segment.map.resolvedUri,
  73939. responseType: "arraybuffer",
  73940. headers: segmentXhrHeaders$1(segment.map)
  73941. });
  73942. const initSegmentRequestCallback = handleInitSegmentResponse$1({
  73943. segment,
  73944. finishProcessingFn
  73945. });
  73946. const initSegmentXhr = xhr(initSegmentOptions, initSegmentRequestCallback);
  73947. activeXhrs.push(initSegmentXhr);
  73948. }
  73949. const segmentRequestOptions = merge$2(xhrOptions, {
  73950. uri: segment.part && segment.part.resolvedUri || segment.resolvedUri,
  73951. responseType: "arraybuffer",
  73952. headers: segmentXhrHeaders$1(segment)
  73953. });
  73954. const segmentRequestCallback = handleSegmentResponse$1({
  73955. segment,
  73956. finishProcessingFn,
  73957. responseType: segmentRequestOptions.responseType
  73958. });
  73959. const segmentXhr = xhr(segmentRequestOptions, segmentRequestCallback);
  73960. segmentXhr.addEventListener("progress", handleProgress$1({
  73961. segment,
  73962. progressFn,
  73963. trackInfoFn,
  73964. timingInfoFn,
  73965. videoSegmentTimingInfoFn,
  73966. audioSegmentTimingInfoFn,
  73967. id3Fn,
  73968. captionsFn,
  73969. isEndOfTimeline,
  73970. endedTimelineFn,
  73971. dataFn
  73972. }));
  73973. activeXhrs.push(segmentXhr);
  73974. const loadendState = {};
  73975. activeXhrs.forEach((activeXhr) => {
  73976. activeXhr.addEventListener("loadend", handleLoadEnd$1({
  73977. loadendState,
  73978. abortFn
  73979. }));
  73980. });
  73981. return () => abortAll$1(activeXhrs);
  73982. };
  73983. const logFn$1$1 = logger$1("CodecUtils");
  73984. const getCodecs$1 = function(media) {
  73985. const mediaAttributes = media.attributes || {};
  73986. if (mediaAttributes.CODECS) {
  73987. return parseCodecs$1(mediaAttributes.CODECS);
  73988. }
  73989. };
  73990. const isMaat$1 = (main, media) => {
  73991. const mediaAttributes = media.attributes || {};
  73992. return main && main.mediaGroups && main.mediaGroups.AUDIO && mediaAttributes.AUDIO && main.mediaGroups.AUDIO[mediaAttributes.AUDIO];
  73993. };
  73994. const isMuxed$1 = (main, media) => {
  73995. if (!isMaat$1(main, media)) {
  73996. return true;
  73997. }
  73998. const mediaAttributes = media.attributes || {};
  73999. const audioGroup = main.mediaGroups.AUDIO[mediaAttributes.AUDIO];
  74000. for (const groupId in audioGroup) {
  74001. if (!audioGroup[groupId].uri && !audioGroup[groupId].playlists) {
  74002. return true;
  74003. }
  74004. }
  74005. return false;
  74006. };
  74007. const unwrapCodecList$1 = function(codecList) {
  74008. const codecs = {};
  74009. codecList.forEach(({
  74010. mediaType,
  74011. type: type2,
  74012. details
  74013. }) => {
  74014. codecs[mediaType] = codecs[mediaType] || [];
  74015. codecs[mediaType].push(translateLegacyCodec$1(`${type2}${details}`));
  74016. });
  74017. Object.keys(codecs).forEach(function(mediaType) {
  74018. if (codecs[mediaType].length > 1) {
  74019. logFn$1$1(`multiple ${mediaType} codecs found as attributes: ${codecs[mediaType].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`);
  74020. codecs[mediaType] = null;
  74021. return;
  74022. }
  74023. codecs[mediaType] = codecs[mediaType][0];
  74024. });
  74025. return codecs;
  74026. };
  74027. const codecCount$1 = function(codecObj) {
  74028. let count = 0;
  74029. if (codecObj.audio) {
  74030. count++;
  74031. }
  74032. if (codecObj.video) {
  74033. count++;
  74034. }
  74035. return count;
  74036. };
  74037. const codecsForPlaylist$1 = function(main, media) {
  74038. const mediaAttributes = media.attributes || {};
  74039. const codecInfo = unwrapCodecList$1(getCodecs$1(media) || []);
  74040. if (isMaat$1(main, media) && !codecInfo.audio) {
  74041. if (!isMuxed$1(main, media)) {
  74042. const defaultCodecs = unwrapCodecList$1(codecsFromDefault$1(main, mediaAttributes.AUDIO) || []);
  74043. if (defaultCodecs.audio) {
  74044. codecInfo.audio = defaultCodecs.audio;
  74045. }
  74046. }
  74047. }
  74048. return codecInfo;
  74049. };
  74050. const logFn$2 = logger$1("PlaylistSelector");
  74051. const representationToString$1 = function(representation) {
  74052. if (!representation || !representation.playlist) {
  74053. return;
  74054. }
  74055. const playlist = representation.playlist;
  74056. return JSON.stringify({
  74057. id: playlist.id,
  74058. bandwidth: representation.bandwidth,
  74059. width: representation.width,
  74060. height: representation.height,
  74061. codecs: playlist.attributes && playlist.attributes.CODECS || ""
  74062. });
  74063. };
  74064. const safeGetComputedStyle$1 = function(el, property) {
  74065. if (!el) {
  74066. return "";
  74067. }
  74068. const result = window_1.getComputedStyle(el);
  74069. if (!result) {
  74070. return "";
  74071. }
  74072. return result[property];
  74073. };
  74074. const stableSort$1 = function(array, sortFn) {
  74075. const newArray = array.slice();
  74076. array.sort(function(left, right) {
  74077. const cmp = sortFn(left, right);
  74078. if (cmp === 0) {
  74079. return newArray.indexOf(left) - newArray.indexOf(right);
  74080. }
  74081. return cmp;
  74082. });
  74083. };
  74084. const comparePlaylistBandwidth$1 = function(left, right) {
  74085. let leftBandwidth;
  74086. let rightBandwidth;
  74087. if (left.attributes.BANDWIDTH) {
  74088. leftBandwidth = left.attributes.BANDWIDTH;
  74089. }
  74090. leftBandwidth = leftBandwidth || window_1.Number.MAX_VALUE;
  74091. if (right.attributes.BANDWIDTH) {
  74092. rightBandwidth = right.attributes.BANDWIDTH;
  74093. }
  74094. rightBandwidth = rightBandwidth || window_1.Number.MAX_VALUE;
  74095. return leftBandwidth - rightBandwidth;
  74096. };
  74097. const comparePlaylistResolution$1 = function(left, right) {
  74098. let leftWidth;
  74099. let rightWidth;
  74100. if (left.attributes.RESOLUTION && left.attributes.RESOLUTION.width) {
  74101. leftWidth = left.attributes.RESOLUTION.width;
  74102. }
  74103. leftWidth = leftWidth || window_1.Number.MAX_VALUE;
  74104. if (right.attributes.RESOLUTION && right.attributes.RESOLUTION.width) {
  74105. rightWidth = right.attributes.RESOLUTION.width;
  74106. }
  74107. rightWidth = rightWidth || window_1.Number.MAX_VALUE;
  74108. if (leftWidth === rightWidth && left.attributes.BANDWIDTH && right.attributes.BANDWIDTH) {
  74109. return left.attributes.BANDWIDTH - right.attributes.BANDWIDTH;
  74110. }
  74111. return leftWidth - rightWidth;
  74112. };
  74113. let simpleSelector$1 = function(main, playerBandwidth, playerWidth, playerHeight, limitRenditionByPlayerDimensions, playlistController) {
  74114. if (!main) {
  74115. return;
  74116. }
  74117. const options2 = {
  74118. bandwidth: playerBandwidth,
  74119. width: playerWidth,
  74120. height: playerHeight,
  74121. limitRenditionByPlayerDimensions
  74122. };
  74123. let playlists = main.playlists;
  74124. if (Playlist$1.isAudioOnly(main)) {
  74125. playlists = playlistController.getAudioTrackPlaylists_();
  74126. options2.audioOnly = true;
  74127. }
  74128. let sortedPlaylistReps = playlists.map((playlist) => {
  74129. let bandwidth2;
  74130. const width2 = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.width;
  74131. const height2 = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height;
  74132. bandwidth2 = playlist.attributes && playlist.attributes.BANDWIDTH;
  74133. bandwidth2 = bandwidth2 || window_1.Number.MAX_VALUE;
  74134. return {
  74135. bandwidth: bandwidth2,
  74136. width: width2,
  74137. height: height2,
  74138. playlist
  74139. };
  74140. });
  74141. stableSort$1(sortedPlaylistReps, (left, right) => left.bandwidth - right.bandwidth);
  74142. sortedPlaylistReps = sortedPlaylistReps.filter((rep2) => !Playlist$1.isIncompatible(rep2.playlist));
  74143. let enabledPlaylistReps = sortedPlaylistReps.filter((rep2) => Playlist$1.isEnabled(rep2.playlist));
  74144. if (!enabledPlaylistReps.length) {
  74145. enabledPlaylistReps = sortedPlaylistReps.filter((rep2) => !Playlist$1.isDisabled(rep2.playlist));
  74146. }
  74147. const bandwidthPlaylistReps = enabledPlaylistReps.filter((rep2) => rep2.bandwidth * Config$1.BANDWIDTH_VARIANCE < playerBandwidth);
  74148. let highestRemainingBandwidthRep = bandwidthPlaylistReps[bandwidthPlaylistReps.length - 1];
  74149. const bandwidthBestRep = bandwidthPlaylistReps.filter((rep2) => rep2.bandwidth === highestRemainingBandwidthRep.bandwidth)[0];
  74150. if (limitRenditionByPlayerDimensions === false) {
  74151. const chosenRep2 = bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0];
  74152. if (chosenRep2 && chosenRep2.playlist) {
  74153. let type2 = "sortedPlaylistReps";
  74154. if (bandwidthBestRep) {
  74155. type2 = "bandwidthBestRep";
  74156. }
  74157. if (enabledPlaylistReps[0]) {
  74158. type2 = "enabledPlaylistReps";
  74159. }
  74160. logFn$2(`choosing ${representationToString$1(chosenRep2)} using ${type2} with options`, options2);
  74161. return chosenRep2.playlist;
  74162. }
  74163. logFn$2("could not choose a playlist with options", options2);
  74164. return null;
  74165. }
  74166. const haveResolution = bandwidthPlaylistReps.filter((rep2) => rep2.width && rep2.height);
  74167. stableSort$1(haveResolution, (left, right) => left.width - right.width);
  74168. const resolutionBestRepList = haveResolution.filter((rep2) => rep2.width === playerWidth && rep2.height === playerHeight);
  74169. highestRemainingBandwidthRep = resolutionBestRepList[resolutionBestRepList.length - 1];
  74170. const resolutionBestRep = resolutionBestRepList.filter((rep2) => rep2.bandwidth === highestRemainingBandwidthRep.bandwidth)[0];
  74171. let resolutionPlusOneList;
  74172. let resolutionPlusOneSmallest;
  74173. let resolutionPlusOneRep;
  74174. if (!resolutionBestRep) {
  74175. resolutionPlusOneList = haveResolution.filter((rep2) => rep2.width > playerWidth || rep2.height > playerHeight);
  74176. resolutionPlusOneSmallest = resolutionPlusOneList.filter((rep2) => rep2.width === resolutionPlusOneList[0].width && rep2.height === resolutionPlusOneList[0].height);
  74177. highestRemainingBandwidthRep = resolutionPlusOneSmallest[resolutionPlusOneSmallest.length - 1];
  74178. resolutionPlusOneRep = resolutionPlusOneSmallest.filter((rep2) => rep2.bandwidth === highestRemainingBandwidthRep.bandwidth)[0];
  74179. }
  74180. let leastPixelDiffRep;
  74181. if (playlistController.leastPixelDiffSelector) {
  74182. const leastPixelDiffList = haveResolution.map((rep2) => {
  74183. rep2.pixelDiff = Math.abs(rep2.width - playerWidth) + Math.abs(rep2.height - playerHeight);
  74184. return rep2;
  74185. });
  74186. stableSort$1(leastPixelDiffList, (left, right) => {
  74187. if (left.pixelDiff === right.pixelDiff) {
  74188. return right.bandwidth - left.bandwidth;
  74189. }
  74190. return left.pixelDiff - right.pixelDiff;
  74191. });
  74192. leastPixelDiffRep = leastPixelDiffList[0];
  74193. }
  74194. const chosenRep = leastPixelDiffRep || resolutionPlusOneRep || resolutionBestRep || bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0];
  74195. if (chosenRep && chosenRep.playlist) {
  74196. let type2 = "sortedPlaylistReps";
  74197. if (leastPixelDiffRep) {
  74198. type2 = "leastPixelDiffRep";
  74199. } else if (resolutionPlusOneRep) {
  74200. type2 = "resolutionPlusOneRep";
  74201. } else if (resolutionBestRep) {
  74202. type2 = "resolutionBestRep";
  74203. } else if (bandwidthBestRep) {
  74204. type2 = "bandwidthBestRep";
  74205. } else if (enabledPlaylistReps[0]) {
  74206. type2 = "enabledPlaylistReps";
  74207. }
  74208. logFn$2(`choosing ${representationToString$1(chosenRep)} using ${type2} with options`, options2);
  74209. return chosenRep.playlist;
  74210. }
  74211. logFn$2("could not choose a playlist with options", options2);
  74212. return null;
  74213. };
  74214. const lastBandwidthSelector$1 = function() {
  74215. const pixelRatio = this.useDevicePixelRatio ? window_1.devicePixelRatio || 1 : 1;
  74216. return simpleSelector$1(this.playlists.main, this.systemBandwidth, parseInt(safeGetComputedStyle$1(this.tech_.el(), "width"), 10) * pixelRatio, parseInt(safeGetComputedStyle$1(this.tech_.el(), "height"), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.playlistController_);
  74217. };
  74218. const movingAverageBandwidthSelector$1 = function(decay) {
  74219. let average = -1;
  74220. let lastSystemBandwidth = -1;
  74221. if (decay < 0 || decay > 1) {
  74222. throw new Error("Moving average bandwidth decay must be between 0 and 1.");
  74223. }
  74224. return function() {
  74225. const pixelRatio = this.useDevicePixelRatio ? window_1.devicePixelRatio || 1 : 1;
  74226. if (average < 0) {
  74227. average = this.systemBandwidth;
  74228. lastSystemBandwidth = this.systemBandwidth;
  74229. }
  74230. if (this.systemBandwidth > 0 && this.systemBandwidth !== lastSystemBandwidth) {
  74231. average = decay * this.systemBandwidth + (1 - decay) * average;
  74232. lastSystemBandwidth = this.systemBandwidth;
  74233. }
  74234. return simpleSelector$1(this.playlists.main, average, parseInt(safeGetComputedStyle$1(this.tech_.el(), "width"), 10) * pixelRatio, parseInt(safeGetComputedStyle$1(this.tech_.el(), "height"), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.playlistController_);
  74235. };
  74236. };
  74237. const minRebufferMaxBandwidthSelector$1 = function(settings) {
  74238. const {
  74239. main,
  74240. currentTime,
  74241. bandwidth: bandwidth2,
  74242. duration: duration5,
  74243. segmentDuration,
  74244. timeUntilRebuffer: timeUntilRebuffer3,
  74245. currentTimeline,
  74246. syncController
  74247. } = settings;
  74248. const compatiblePlaylists = main.playlists.filter((playlist) => !Playlist$1.isIncompatible(playlist));
  74249. let enabledPlaylists = compatiblePlaylists.filter(Playlist$1.isEnabled);
  74250. if (!enabledPlaylists.length) {
  74251. enabledPlaylists = compatiblePlaylists.filter((playlist) => !Playlist$1.isDisabled(playlist));
  74252. }
  74253. const bandwidthPlaylists = enabledPlaylists.filter(Playlist$1.hasAttribute.bind(null, "BANDWIDTH"));
  74254. const rebufferingEstimates = bandwidthPlaylists.map((playlist) => {
  74255. const syncPoint = syncController.getSyncPoint(playlist, duration5, currentTimeline, currentTime);
  74256. const numRequests = syncPoint ? 1 : 2;
  74257. const requestTimeEstimate = Playlist$1.estimateSegmentRequestTime(segmentDuration, bandwidth2, playlist);
  74258. const rebufferingImpact = requestTimeEstimate * numRequests - timeUntilRebuffer3;
  74259. return {
  74260. playlist,
  74261. rebufferingImpact
  74262. };
  74263. });
  74264. const noRebufferingPlaylists = rebufferingEstimates.filter((estimate) => estimate.rebufferingImpact <= 0);
  74265. stableSort$1(noRebufferingPlaylists, (a, b) => comparePlaylistBandwidth$1(b.playlist, a.playlist));
  74266. if (noRebufferingPlaylists.length) {
  74267. return noRebufferingPlaylists[0];
  74268. }
  74269. stableSort$1(rebufferingEstimates, (a, b) => a.rebufferingImpact - b.rebufferingImpact);
  74270. return rebufferingEstimates[0] || null;
  74271. };
  74272. const lowestBitrateCompatibleVariantSelector$1 = function() {
  74273. const playlists = this.playlists.main.playlists.filter(Playlist$1.isEnabled);
  74274. stableSort$1(playlists, (a, b) => comparePlaylistBandwidth$1(a, b));
  74275. const playlistsWithVideo = playlists.filter((playlist) => !!codecsForPlaylist$1(this.playlists.main, playlist).video);
  74276. return playlistsWithVideo[0] || null;
  74277. };
  74278. const concatSegments$1 = (segmentObj) => {
  74279. let offset = 0;
  74280. let tempBuffer;
  74281. if (segmentObj.bytes) {
  74282. tempBuffer = new Uint8Array(segmentObj.bytes);
  74283. segmentObj.segments.forEach((segment) => {
  74284. tempBuffer.set(segment, offset);
  74285. offset += segment.byteLength;
  74286. });
  74287. }
  74288. return tempBuffer;
  74289. };
  74290. const createCaptionsTrackIfNotExists$1 = function(inbandTextTracks, tech, captionStream) {
  74291. if (!inbandTextTracks[captionStream]) {
  74292. tech.trigger({
  74293. type: "usage",
  74294. name: "vhs-608"
  74295. });
  74296. let instreamId = captionStream;
  74297. if (/^cc708_/.test(captionStream)) {
  74298. instreamId = "SERVICE" + captionStream.split("_")[1];
  74299. }
  74300. const track = tech.textTracks().getTrackById(instreamId);
  74301. if (track) {
  74302. inbandTextTracks[captionStream] = track;
  74303. } else {
  74304. const captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {};
  74305. let label2 = captionStream;
  74306. let language = captionStream;
  74307. let def = false;
  74308. const captionService = captionServices[instreamId];
  74309. if (captionService) {
  74310. label2 = captionService.label;
  74311. language = captionService.language;
  74312. def = captionService.default;
  74313. }
  74314. inbandTextTracks[captionStream] = tech.addRemoteTextTrack({
  74315. kind: "captions",
  74316. id: instreamId,
  74317. default: def,
  74318. label: label2,
  74319. language
  74320. }, false).track;
  74321. }
  74322. }
  74323. };
  74324. const addCaptionData$1 = function({
  74325. inbandTextTracks,
  74326. captionArray,
  74327. timestampOffset: timestampOffset2
  74328. }) {
  74329. if (!captionArray) {
  74330. return;
  74331. }
  74332. const Cue = window_1.WebKitDataCue || window_1.VTTCue;
  74333. captionArray.forEach((caption) => {
  74334. const track = caption.stream;
  74335. inbandTextTracks[track].addCue(new Cue(caption.startTime + timestampOffset2, caption.endTime + timestampOffset2, caption.text));
  74336. });
  74337. };
  74338. const deprecateOldCue$1 = function(cue) {
  74339. Object.defineProperties(cue.frame, {
  74340. id: {
  74341. get() {
  74342. videojs$2.log.warn("cue.frame.id is deprecated. Use cue.value.key instead.");
  74343. return cue.value.key;
  74344. }
  74345. },
  74346. value: {
  74347. get() {
  74348. videojs$2.log.warn("cue.frame.value is deprecated. Use cue.value.data instead.");
  74349. return cue.value.data;
  74350. }
  74351. },
  74352. privateData: {
  74353. get() {
  74354. videojs$2.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead.");
  74355. return cue.value.data;
  74356. }
  74357. }
  74358. });
  74359. };
  74360. const addMetadata$1 = ({
  74361. inbandTextTracks,
  74362. metadataArray,
  74363. timestampOffset: timestampOffset2,
  74364. videoDuration
  74365. }) => {
  74366. if (!metadataArray) {
  74367. return;
  74368. }
  74369. const Cue = window_1.WebKitDataCue || window_1.VTTCue;
  74370. const metadataTrack = inbandTextTracks.metadataTrack_;
  74371. if (!metadataTrack) {
  74372. return;
  74373. }
  74374. metadataArray.forEach((metadata) => {
  74375. const time = metadata.cueTime + timestampOffset2;
  74376. if (typeof time !== "number" || window_1.isNaN(time) || time < 0 || !(time < Infinity)) {
  74377. return;
  74378. }
  74379. metadata.frames.forEach((frame) => {
  74380. const cue = new Cue(time, time, frame.value || frame.url || frame.data || "");
  74381. cue.frame = frame;
  74382. cue.value = frame;
  74383. deprecateOldCue$1(cue);
  74384. metadataTrack.addCue(cue);
  74385. });
  74386. });
  74387. if (!metadataTrack.cues || !metadataTrack.cues.length) {
  74388. return;
  74389. }
  74390. const cues = metadataTrack.cues;
  74391. const cuesArray = [];
  74392. for (let i2 = 0; i2 < cues.length; i2++) {
  74393. if (cues[i2]) {
  74394. cuesArray.push(cues[i2]);
  74395. }
  74396. }
  74397. const cuesGroupedByStartTime = cuesArray.reduce((obj, cue) => {
  74398. const timeSlot = obj[cue.startTime] || [];
  74399. timeSlot.push(cue);
  74400. obj[cue.startTime] = timeSlot;
  74401. return obj;
  74402. }, {});
  74403. const sortedStartTimes = Object.keys(cuesGroupedByStartTime).sort((a, b) => Number(a) - Number(b));
  74404. sortedStartTimes.forEach((startTime, idx) => {
  74405. const cueGroup = cuesGroupedByStartTime[startTime];
  74406. const nextTime = Number(sortedStartTimes[idx + 1]) || videoDuration;
  74407. cueGroup.forEach((cue) => {
  74408. cue.endTime = nextTime;
  74409. });
  74410. });
  74411. };
  74412. const createMetadataTrackIfNotExists$1 = (inbandTextTracks, dispatchType, tech) => {
  74413. if (inbandTextTracks.metadataTrack_) {
  74414. return;
  74415. }
  74416. inbandTextTracks.metadataTrack_ = tech.addRemoteTextTrack({
  74417. kind: "metadata",
  74418. label: "Timed Metadata"
  74419. }, false).track;
  74420. inbandTextTracks.metadataTrack_.inBandMetadataTrackDispatchType = dispatchType;
  74421. };
  74422. const removeCuesFromTrack$1 = function(start2, end, track) {
  74423. let i2;
  74424. let cue;
  74425. if (!track) {
  74426. return;
  74427. }
  74428. if (!track.cues) {
  74429. return;
  74430. }
  74431. i2 = track.cues.length;
  74432. while (i2--) {
  74433. cue = track.cues[i2];
  74434. if (cue.startTime >= start2 && cue.endTime <= end) {
  74435. track.removeCue(cue);
  74436. }
  74437. }
  74438. };
  74439. const removeDuplicateCuesFromTrack$1 = function(track) {
  74440. const cues = track.cues;
  74441. if (!cues) {
  74442. return;
  74443. }
  74444. for (let i2 = 0; i2 < cues.length; i2++) {
  74445. const duplicates = [];
  74446. let occurrences = 0;
  74447. for (let j = 0; j < cues.length; j++) {
  74448. if (cues[i2].startTime === cues[j].startTime && cues[i2].endTime === cues[j].endTime && cues[i2].text === cues[j].text) {
  74449. occurrences++;
  74450. if (occurrences > 1) {
  74451. duplicates.push(cues[j]);
  74452. }
  74453. }
  74454. }
  74455. if (duplicates.length) {
  74456. duplicates.forEach((dupe) => track.removeCue(dupe));
  74457. }
  74458. }
  74459. };
  74460. const gopsSafeToAlignWith$1 = (buffer, currentTime, mapping) => {
  74461. if (typeof currentTime === "undefined" || currentTime === null || !buffer.length) {
  74462. return [];
  74463. }
  74464. const currentTimePts = Math.ceil((currentTime - mapping + 3) * clock$1.ONE_SECOND_IN_TS);
  74465. let i2;
  74466. for (i2 = 0; i2 < buffer.length; i2++) {
  74467. if (buffer[i2].pts > currentTimePts) {
  74468. break;
  74469. }
  74470. }
  74471. return buffer.slice(i2);
  74472. };
  74473. const updateGopBuffer$1 = (buffer, gops, replace) => {
  74474. if (!gops.length) {
  74475. return buffer;
  74476. }
  74477. if (replace) {
  74478. return gops.slice();
  74479. }
  74480. const start2 = gops[0].pts;
  74481. let i2 = 0;
  74482. for (i2; i2 < buffer.length; i2++) {
  74483. if (buffer[i2].pts >= start2) {
  74484. break;
  74485. }
  74486. }
  74487. return buffer.slice(0, i2).concat(gops);
  74488. };
  74489. const removeGopBuffer$1 = (buffer, start2, end, mapping) => {
  74490. const startPts = Math.ceil((start2 - mapping) * clock$1.ONE_SECOND_IN_TS);
  74491. const endPts = Math.ceil((end - mapping) * clock$1.ONE_SECOND_IN_TS);
  74492. const updatedBuffer = buffer.slice();
  74493. let i2 = buffer.length;
  74494. while (i2--) {
  74495. if (buffer[i2].pts <= endPts) {
  74496. break;
  74497. }
  74498. }
  74499. if (i2 === -1) {
  74500. return updatedBuffer;
  74501. }
  74502. let j = i2 + 1;
  74503. while (j--) {
  74504. if (buffer[j].pts <= startPts) {
  74505. break;
  74506. }
  74507. }
  74508. j = Math.max(j, 0);
  74509. updatedBuffer.splice(j, i2 - j + 1);
  74510. return updatedBuffer;
  74511. };
  74512. const shallowEqual$1 = function(a, b) {
  74513. if (!a && !b || !a && b || a && !b) {
  74514. return false;
  74515. }
  74516. if (a === b) {
  74517. return true;
  74518. }
  74519. const akeys = Object.keys(a).sort();
  74520. const bkeys = Object.keys(b).sort();
  74521. if (akeys.length !== bkeys.length) {
  74522. return false;
  74523. }
  74524. for (let i2 = 0; i2 < akeys.length; i2++) {
  74525. const key = akeys[i2];
  74526. if (key !== bkeys[i2]) {
  74527. return false;
  74528. }
  74529. if (a[key] !== b[key]) {
  74530. return false;
  74531. }
  74532. }
  74533. return true;
  74534. };
  74535. const QUOTA_EXCEEDED_ERR$1 = 22;
  74536. const getSyncSegmentCandidate$1 = function(currentTimeline, segments, targetTime) {
  74537. segments = segments || [];
  74538. const timelineSegments = [];
  74539. let time = 0;
  74540. for (let i2 = 0; i2 < segments.length; i2++) {
  74541. const segment = segments[i2];
  74542. if (currentTimeline === segment.timeline) {
  74543. timelineSegments.push(i2);
  74544. time += segment.duration;
  74545. if (time > targetTime) {
  74546. return i2;
  74547. }
  74548. }
  74549. }
  74550. if (timelineSegments.length === 0) {
  74551. return 0;
  74552. }
  74553. return timelineSegments[timelineSegments.length - 1];
  74554. };
  74555. const MIN_BACK_BUFFER$1 = 1;
  74556. const CHECK_BUFFER_DELAY$1 = 500;
  74557. const finite$1 = (num) => typeof num === "number" && isFinite(num);
  74558. const MIN_SEGMENT_DURATION_TO_SAVE_STATS$1 = 1 / 60;
  74559. const illegalMediaSwitch$1 = (loaderType, startingMedia, trackInfo) => {
  74560. if (loaderType !== "main" || !startingMedia || !trackInfo) {
  74561. return null;
  74562. }
  74563. if (!trackInfo.hasAudio && !trackInfo.hasVideo) {
  74564. return "Neither audio nor video found in segment.";
  74565. }
  74566. if (startingMedia.hasVideo && !trackInfo.hasVideo) {
  74567. return "Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.";
  74568. }
  74569. if (!startingMedia.hasVideo && trackInfo.hasVideo) {
  74570. return "Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.";
  74571. }
  74572. return null;
  74573. };
  74574. const safeBackBufferTrimTime$1 = (seekable3, currentTime, targetDuration) => {
  74575. let trimTime = currentTime - Config$1.BACK_BUFFER_LENGTH;
  74576. if (seekable3.length) {
  74577. trimTime = Math.max(trimTime, seekable3.start(0));
  74578. }
  74579. const maxTrimTime = currentTime - targetDuration;
  74580. return Math.min(maxTrimTime, trimTime);
  74581. };
  74582. const segmentInfoString$1 = (segmentInfo) => {
  74583. const {
  74584. startOfSegment,
  74585. duration: duration5,
  74586. segment,
  74587. part,
  74588. playlist: {
  74589. mediaSequence: seq,
  74590. id,
  74591. segments = []
  74592. },
  74593. mediaIndex: index2,
  74594. partIndex,
  74595. timeline
  74596. } = segmentInfo;
  74597. const segmentLen = segments.length - 1;
  74598. let selection = "mediaIndex/partIndex increment";
  74599. if (segmentInfo.getMediaInfoForTime) {
  74600. selection = `getMediaInfoForTime (${segmentInfo.getMediaInfoForTime})`;
  74601. } else if (segmentInfo.isSyncRequest) {
  74602. selection = "getSyncSegmentCandidate (isSyncRequest)";
  74603. }
  74604. if (segmentInfo.independent) {
  74605. selection += ` with independent ${segmentInfo.independent}`;
  74606. }
  74607. const hasPartIndex = typeof partIndex === "number";
  74608. const name = segmentInfo.segment.uri ? "segment" : "pre-segment";
  74609. const zeroBasedPartCount = hasPartIndex ? getKnownPartCount$1({
  74610. preloadSegment: segment
  74611. }) - 1 : 0;
  74612. return `${name} [${seq + index2}/${seq + segmentLen}]` + (hasPartIndex ? ` part [${partIndex}/${zeroBasedPartCount}]` : "") + ` segment start/end [${segment.start} => ${segment.end}]` + (hasPartIndex ? ` part start/end [${part.start} => ${part.end}]` : "") + ` startOfSegment [${startOfSegment}] duration [${duration5}] timeline [${timeline}] selected by [${selection}] playlist [${id}]`;
  74613. };
  74614. const timingInfoPropertyForMedia$1 = (mediaType) => `${mediaType}TimingInfo`;
  74615. const timestampOffsetForSegment$1 = ({
  74616. segmentTimeline,
  74617. currentTimeline,
  74618. startOfSegment,
  74619. buffered,
  74620. overrideCheck
  74621. }) => {
  74622. if (!overrideCheck && segmentTimeline === currentTimeline) {
  74623. return null;
  74624. }
  74625. if (segmentTimeline < currentTimeline) {
  74626. return startOfSegment;
  74627. }
  74628. return buffered.length ? buffered.end(buffered.length - 1) : startOfSegment;
  74629. };
  74630. const shouldWaitForTimelineChange$1 = ({
  74631. timelineChangeController,
  74632. currentTimeline,
  74633. segmentTimeline,
  74634. loaderType,
  74635. audioDisabled
  74636. }) => {
  74637. if (currentTimeline === segmentTimeline) {
  74638. return false;
  74639. }
  74640. if (loaderType === "audio") {
  74641. const lastMainTimelineChange = timelineChangeController.lastTimelineChange({
  74642. type: "main"
  74643. });
  74644. return !lastMainTimelineChange || lastMainTimelineChange.to !== segmentTimeline;
  74645. }
  74646. if (loaderType === "main" && audioDisabled) {
  74647. const pendingAudioTimelineChange = timelineChangeController.pendingTimelineChange({
  74648. type: "audio"
  74649. });
  74650. if (pendingAudioTimelineChange && pendingAudioTimelineChange.to === segmentTimeline) {
  74651. return false;
  74652. }
  74653. return true;
  74654. }
  74655. return false;
  74656. };
  74657. const mediaDuration$1 = (timingInfos) => {
  74658. let maxDuration = 0;
  74659. ["video", "audio"].forEach(function(type2) {
  74660. const typeTimingInfo = timingInfos[`${type2}TimingInfo`];
  74661. if (!typeTimingInfo) {
  74662. return;
  74663. }
  74664. const {
  74665. start: start2,
  74666. end
  74667. } = typeTimingInfo;
  74668. let duration5;
  74669. if (typeof start2 === "bigint" || typeof end === "bigint") {
  74670. duration5 = window_1.BigInt(end) - window_1.BigInt(start2);
  74671. } else if (typeof start2 === "number" && typeof end === "number") {
  74672. duration5 = end - start2;
  74673. }
  74674. if (typeof duration5 !== "undefined" && duration5 > maxDuration) {
  74675. maxDuration = duration5;
  74676. }
  74677. });
  74678. if (typeof maxDuration === "bigint" && maxDuration < Number.MAX_SAFE_INTEGER) {
  74679. maxDuration = Number(maxDuration);
  74680. }
  74681. return maxDuration;
  74682. };
  74683. const segmentTooLong$1 = ({
  74684. segmentDuration,
  74685. maxDuration
  74686. }) => {
  74687. if (!segmentDuration) {
  74688. return false;
  74689. }
  74690. return Math.round(segmentDuration) > maxDuration + TIME_FUDGE_FACTOR$1;
  74691. };
  74692. const getTroublesomeSegmentDurationMessage$1 = (segmentInfo, sourceType) => {
  74693. if (sourceType !== "hls") {
  74694. return null;
  74695. }
  74696. const segmentDuration = mediaDuration$1({
  74697. audioTimingInfo: segmentInfo.audioTimingInfo,
  74698. videoTimingInfo: segmentInfo.videoTimingInfo
  74699. });
  74700. if (!segmentDuration) {
  74701. return null;
  74702. }
  74703. const targetDuration = segmentInfo.playlist.targetDuration;
  74704. const isSegmentWayTooLong = segmentTooLong$1({
  74705. segmentDuration,
  74706. maxDuration: targetDuration * 2
  74707. });
  74708. const isSegmentSlightlyTooLong = segmentTooLong$1({
  74709. segmentDuration,
  74710. maxDuration: targetDuration
  74711. });
  74712. const segmentTooLongMessage = `Segment with index ${segmentInfo.mediaIndex} from playlist ${segmentInfo.playlist.id} has a duration of ${segmentDuration} when the reported duration is ${segmentInfo.duration} and the target duration is ${targetDuration}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;
  74713. if (isSegmentWayTooLong || isSegmentSlightlyTooLong) {
  74714. return {
  74715. severity: isSegmentWayTooLong ? "warn" : "info",
  74716. message: segmentTooLongMessage
  74717. };
  74718. }
  74719. return null;
  74720. };
  74721. class SegmentLoader$1 extends videojs$2.EventTarget {
  74722. constructor(settings, options2 = {}) {
  74723. super();
  74724. if (!settings) {
  74725. throw new TypeError("Initialization settings are required");
  74726. }
  74727. if (typeof settings.currentTime !== "function") {
  74728. throw new TypeError("No currentTime getter specified");
  74729. }
  74730. if (!settings.mediaSource) {
  74731. throw new TypeError("No MediaSource specified");
  74732. }
  74733. this.bandwidth = settings.bandwidth;
  74734. this.throughput = {
  74735. rate: 0,
  74736. count: 0
  74737. };
  74738. this.roundTrip = NaN;
  74739. this.resetStats_();
  74740. this.mediaIndex = null;
  74741. this.partIndex = null;
  74742. this.hasPlayed_ = settings.hasPlayed;
  74743. this.currentTime_ = settings.currentTime;
  74744. this.seekable_ = settings.seekable;
  74745. this.seeking_ = settings.seeking;
  74746. this.duration_ = settings.duration;
  74747. this.mediaSource_ = settings.mediaSource;
  74748. this.vhs_ = settings.vhs;
  74749. this.loaderType_ = settings.loaderType;
  74750. this.currentMediaInfo_ = void 0;
  74751. this.startingMediaInfo_ = void 0;
  74752. this.segmentMetadataTrack_ = settings.segmentMetadataTrack;
  74753. this.goalBufferLength_ = settings.goalBufferLength;
  74754. this.sourceType_ = settings.sourceType;
  74755. this.sourceUpdater_ = settings.sourceUpdater;
  74756. this.inbandTextTracks_ = settings.inbandTextTracks;
  74757. this.state_ = "INIT";
  74758. this.timelineChangeController_ = settings.timelineChangeController;
  74759. this.shouldSaveSegmentTimingInfo_ = true;
  74760. this.parse708captions_ = settings.parse708captions;
  74761. this.useDtsForTimestampOffset_ = settings.useDtsForTimestampOffset;
  74762. this.captionServices_ = settings.captionServices;
  74763. this.exactManifestTimings = settings.exactManifestTimings;
  74764. this.checkBufferTimeout_ = null;
  74765. this.error_ = void 0;
  74766. this.currentTimeline_ = -1;
  74767. this.pendingSegment_ = null;
  74768. this.xhrOptions_ = null;
  74769. this.pendingSegments_ = [];
  74770. this.audioDisabled_ = false;
  74771. this.isPendingTimestampOffset_ = false;
  74772. this.gopBuffer_ = [];
  74773. this.timeMapping_ = 0;
  74774. this.safeAppend_ = videojs$2.browser.IE_VERSION >= 11;
  74775. this.appendInitSegment_ = {
  74776. audio: true,
  74777. video: true
  74778. };
  74779. this.playlistOfLastInitSegment_ = {
  74780. audio: null,
  74781. video: null
  74782. };
  74783. this.callQueue_ = [];
  74784. this.loadQueue_ = [];
  74785. this.metadataQueue_ = {
  74786. id3: [],
  74787. caption: []
  74788. };
  74789. this.waitingOnRemove_ = false;
  74790. this.quotaExceededErrorRetryTimeout_ = null;
  74791. this.activeInitSegmentId_ = null;
  74792. this.initSegments_ = {};
  74793. this.cacheEncryptionKeys_ = settings.cacheEncryptionKeys;
  74794. this.keyCache_ = {};
  74795. this.decrypter_ = settings.decrypter;
  74796. this.syncController_ = settings.syncController;
  74797. this.syncPoint_ = {
  74798. segmentIndex: 0,
  74799. time: 0
  74800. };
  74801. this.transmuxer_ = this.createTransmuxer_();
  74802. this.triggerSyncInfoUpdate_ = () => this.trigger("syncinfoupdate");
  74803. this.syncController_.on("syncinfoupdate", this.triggerSyncInfoUpdate_);
  74804. this.mediaSource_.addEventListener("sourceopen", () => {
  74805. if (!this.isEndOfStream_()) {
  74806. this.ended_ = false;
  74807. }
  74808. });
  74809. this.fetchAtBuffer_ = false;
  74810. this.logger_ = logger$1(`SegmentLoader[${this.loaderType_}]`);
  74811. Object.defineProperty(this, "state", {
  74812. get() {
  74813. return this.state_;
  74814. },
  74815. set(newState) {
  74816. if (newState !== this.state_) {
  74817. this.logger_(`${this.state_} -> ${newState}`);
  74818. this.state_ = newState;
  74819. this.trigger("statechange");
  74820. }
  74821. }
  74822. });
  74823. this.sourceUpdater_.on("ready", () => {
  74824. if (this.hasEnoughInfoToAppend_()) {
  74825. this.processCallQueue_();
  74826. }
  74827. });
  74828. if (this.loaderType_ === "main") {
  74829. this.timelineChangeController_.on("pendingtimelinechange", () => {
  74830. if (this.hasEnoughInfoToAppend_()) {
  74831. this.processCallQueue_();
  74832. }
  74833. });
  74834. }
  74835. if (this.loaderType_ === "audio") {
  74836. this.timelineChangeController_.on("timelinechange", () => {
  74837. if (this.hasEnoughInfoToLoad_()) {
  74838. this.processLoadQueue_();
  74839. }
  74840. if (this.hasEnoughInfoToAppend_()) {
  74841. this.processCallQueue_();
  74842. }
  74843. });
  74844. }
  74845. }
  74846. createTransmuxer_() {
  74847. return segmentTransmuxer$1.createTransmuxer({
  74848. remux: false,
  74849. alignGopsAtEnd: this.safeAppend_,
  74850. keepOriginalTimestamps: true,
  74851. parse708captions: this.parse708captions_,
  74852. captionServices: this.captionServices_
  74853. });
  74854. }
  74855. resetStats_() {
  74856. this.mediaBytesTransferred = 0;
  74857. this.mediaRequests = 0;
  74858. this.mediaRequestsAborted = 0;
  74859. this.mediaRequestsTimedout = 0;
  74860. this.mediaRequestsErrored = 0;
  74861. this.mediaTransferDuration = 0;
  74862. this.mediaSecondsLoaded = 0;
  74863. this.mediaAppends = 0;
  74864. }
  74865. dispose() {
  74866. this.trigger("dispose");
  74867. this.state = "DISPOSED";
  74868. this.pause();
  74869. this.abort_();
  74870. if (this.transmuxer_) {
  74871. this.transmuxer_.terminate();
  74872. }
  74873. this.resetStats_();
  74874. if (this.checkBufferTimeout_) {
  74875. window_1.clearTimeout(this.checkBufferTimeout_);
  74876. }
  74877. if (this.syncController_ && this.triggerSyncInfoUpdate_) {
  74878. this.syncController_.off("syncinfoupdate", this.triggerSyncInfoUpdate_);
  74879. }
  74880. this.off();
  74881. }
  74882. setAudio(enable) {
  74883. this.audioDisabled_ = !enable;
  74884. if (enable) {
  74885. this.appendInitSegment_.audio = true;
  74886. } else {
  74887. this.sourceUpdater_.removeAudio(0, this.duration_());
  74888. }
  74889. }
  74890. abort() {
  74891. if (this.state !== "WAITING") {
  74892. if (this.pendingSegment_) {
  74893. this.pendingSegment_ = null;
  74894. }
  74895. return;
  74896. }
  74897. this.abort_();
  74898. this.state = "READY";
  74899. if (!this.paused()) {
  74900. this.monitorBuffer_();
  74901. }
  74902. }
  74903. abort_() {
  74904. if (this.pendingSegment_ && this.pendingSegment_.abortRequests) {
  74905. this.pendingSegment_.abortRequests();
  74906. }
  74907. this.pendingSegment_ = null;
  74908. this.callQueue_ = [];
  74909. this.loadQueue_ = [];
  74910. this.metadataQueue_.id3 = [];
  74911. this.metadataQueue_.caption = [];
  74912. this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);
  74913. this.waitingOnRemove_ = false;
  74914. window_1.clearTimeout(this.quotaExceededErrorRetryTimeout_);
  74915. this.quotaExceededErrorRetryTimeout_ = null;
  74916. }
  74917. checkForAbort_(requestId) {
  74918. if (this.state === "APPENDING" && !this.pendingSegment_) {
  74919. this.state = "READY";
  74920. return true;
  74921. }
  74922. if (!this.pendingSegment_ || this.pendingSegment_.requestId !== requestId) {
  74923. return true;
  74924. }
  74925. return false;
  74926. }
  74927. error(error) {
  74928. if (typeof error !== "undefined") {
  74929. this.logger_("error occurred:", error);
  74930. this.error_ = error;
  74931. }
  74932. this.pendingSegment_ = null;
  74933. return this.error_;
  74934. }
  74935. endOfStream() {
  74936. this.ended_ = true;
  74937. if (this.transmuxer_) {
  74938. segmentTransmuxer$1.reset(this.transmuxer_);
  74939. }
  74940. this.gopBuffer_.length = 0;
  74941. this.pause();
  74942. this.trigger("ended");
  74943. }
  74944. buffered_() {
  74945. const trackInfo = this.getMediaInfo_();
  74946. if (!this.sourceUpdater_ || !trackInfo) {
  74947. return createTimeRanges$2();
  74948. }
  74949. if (this.loaderType_ === "main") {
  74950. const {
  74951. hasAudio,
  74952. hasVideo,
  74953. isMuxed: isMuxed3
  74954. } = trackInfo;
  74955. if (hasVideo && hasAudio && !this.audioDisabled_ && !isMuxed3) {
  74956. return this.sourceUpdater_.buffered();
  74957. }
  74958. if (hasVideo) {
  74959. return this.sourceUpdater_.videoBuffered();
  74960. }
  74961. }
  74962. return this.sourceUpdater_.audioBuffered();
  74963. }
  74964. initSegmentForMap(map, set4 = false) {
  74965. if (!map) {
  74966. return null;
  74967. }
  74968. const id = initSegmentId$1(map);
  74969. let storedMap = this.initSegments_[id];
  74970. if (set4 && !storedMap && map.bytes) {
  74971. this.initSegments_[id] = storedMap = {
  74972. resolvedUri: map.resolvedUri,
  74973. byterange: map.byterange,
  74974. bytes: map.bytes,
  74975. tracks: map.tracks,
  74976. timescales: map.timescales
  74977. };
  74978. }
  74979. return storedMap || map;
  74980. }
  74981. segmentKey(key, set4 = false) {
  74982. if (!key) {
  74983. return null;
  74984. }
  74985. const id = segmentKeyId$1(key);
  74986. let storedKey = this.keyCache_[id];
  74987. if (this.cacheEncryptionKeys_ && set4 && !storedKey && key.bytes) {
  74988. this.keyCache_[id] = storedKey = {
  74989. resolvedUri: key.resolvedUri,
  74990. bytes: key.bytes
  74991. };
  74992. }
  74993. const result = {
  74994. resolvedUri: (storedKey || key).resolvedUri
  74995. };
  74996. if (storedKey) {
  74997. result.bytes = storedKey.bytes;
  74998. }
  74999. return result;
  75000. }
  75001. couldBeginLoading_() {
  75002. return this.playlist_ && !this.paused();
  75003. }
  75004. load() {
  75005. this.monitorBuffer_();
  75006. if (!this.playlist_) {
  75007. return;
  75008. }
  75009. if (this.state === "INIT" && this.couldBeginLoading_()) {
  75010. return this.init_();
  75011. }
  75012. if (!this.couldBeginLoading_() || this.state !== "READY" && this.state !== "INIT") {
  75013. return;
  75014. }
  75015. this.state = "READY";
  75016. }
  75017. init_() {
  75018. this.state = "READY";
  75019. this.resetEverything();
  75020. return this.monitorBuffer_();
  75021. }
  75022. playlist(newPlaylist, options2 = {}) {
  75023. if (!newPlaylist) {
  75024. return;
  75025. }
  75026. const oldPlaylist = this.playlist_;
  75027. const segmentInfo = this.pendingSegment_;
  75028. this.playlist_ = newPlaylist;
  75029. this.xhrOptions_ = options2;
  75030. if (this.state === "INIT") {
  75031. newPlaylist.syncInfo = {
  75032. mediaSequence: newPlaylist.mediaSequence,
  75033. time: 0
  75034. };
  75035. if (this.loaderType_ === "main") {
  75036. this.syncController_.setDateTimeMappingForStart(newPlaylist);
  75037. }
  75038. }
  75039. let oldId = null;
  75040. if (oldPlaylist) {
  75041. if (oldPlaylist.id) {
  75042. oldId = oldPlaylist.id;
  75043. } else if (oldPlaylist.uri) {
  75044. oldId = oldPlaylist.uri;
  75045. }
  75046. }
  75047. this.logger_(`playlist update [${oldId} => ${newPlaylist.id || newPlaylist.uri}]`);
  75048. this.trigger("syncinfoupdate");
  75049. if (this.state === "INIT" && this.couldBeginLoading_()) {
  75050. return this.init_();
  75051. }
  75052. if (!oldPlaylist || oldPlaylist.uri !== newPlaylist.uri) {
  75053. if (this.mediaIndex !== null) {
  75054. if (!newPlaylist.endList) {
  75055. this.resetLoader();
  75056. } else {
  75057. this.resyncLoader();
  75058. }
  75059. }
  75060. this.currentMediaInfo_ = void 0;
  75061. this.trigger("playlistupdate");
  75062. return;
  75063. }
  75064. const mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence;
  75065. this.logger_(`live window shift [${mediaSequenceDiff}]`);
  75066. if (this.mediaIndex !== null) {
  75067. this.mediaIndex -= mediaSequenceDiff;
  75068. if (this.mediaIndex < 0) {
  75069. this.mediaIndex = null;
  75070. this.partIndex = null;
  75071. } else {
  75072. const segment = this.playlist_.segments[this.mediaIndex];
  75073. if (this.partIndex && (!segment.parts || !segment.parts.length || !segment.parts[this.partIndex])) {
  75074. const mediaIndex = this.mediaIndex;
  75075. this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`);
  75076. this.resetLoader();
  75077. this.mediaIndex = mediaIndex;
  75078. }
  75079. }
  75080. }
  75081. if (segmentInfo) {
  75082. segmentInfo.mediaIndex -= mediaSequenceDiff;
  75083. if (segmentInfo.mediaIndex < 0) {
  75084. segmentInfo.mediaIndex = null;
  75085. segmentInfo.partIndex = null;
  75086. } else {
  75087. if (segmentInfo.mediaIndex >= 0) {
  75088. segmentInfo.segment = newPlaylist.segments[segmentInfo.mediaIndex];
  75089. }
  75090. if (segmentInfo.partIndex >= 0 && segmentInfo.segment.parts) {
  75091. segmentInfo.part = segmentInfo.segment.parts[segmentInfo.partIndex];
  75092. }
  75093. }
  75094. }
  75095. this.syncController_.saveExpiredSegmentInfo(oldPlaylist, newPlaylist);
  75096. }
  75097. pause() {
  75098. if (this.checkBufferTimeout_) {
  75099. window_1.clearTimeout(this.checkBufferTimeout_);
  75100. this.checkBufferTimeout_ = null;
  75101. }
  75102. }
  75103. paused() {
  75104. return this.checkBufferTimeout_ === null;
  75105. }
  75106. resetEverything(done) {
  75107. this.ended_ = false;
  75108. this.activeInitSegmentId_ = null;
  75109. this.appendInitSegment_ = {
  75110. audio: true,
  75111. video: true
  75112. };
  75113. this.resetLoader();
  75114. this.remove(0, Infinity, done);
  75115. if (this.transmuxer_) {
  75116. this.transmuxer_.postMessage({
  75117. action: "clearAllMp4Captions"
  75118. });
  75119. this.transmuxer_.postMessage({
  75120. action: "reset"
  75121. });
  75122. }
  75123. }
  75124. resetLoader() {
  75125. this.fetchAtBuffer_ = false;
  75126. this.resyncLoader();
  75127. }
  75128. resyncLoader() {
  75129. if (this.transmuxer_) {
  75130. segmentTransmuxer$1.reset(this.transmuxer_);
  75131. }
  75132. this.mediaIndex = null;
  75133. this.partIndex = null;
  75134. this.syncPoint_ = null;
  75135. this.isPendingTimestampOffset_ = false;
  75136. this.callQueue_ = [];
  75137. this.loadQueue_ = [];
  75138. this.metadataQueue_.id3 = [];
  75139. this.metadataQueue_.caption = [];
  75140. this.abort();
  75141. if (this.transmuxer_) {
  75142. this.transmuxer_.postMessage({
  75143. action: "clearParsedMp4Captions"
  75144. });
  75145. }
  75146. }
  75147. remove(start2, end, done = () => {
  75148. }, force = false) {
  75149. if (end === Infinity) {
  75150. end = this.duration_();
  75151. }
  75152. if (end <= start2) {
  75153. this.logger_("skipping remove because end ${end} is <= start ${start}");
  75154. return;
  75155. }
  75156. if (!this.sourceUpdater_ || !this.getMediaInfo_()) {
  75157. this.logger_("skipping remove because no source updater or starting media info");
  75158. return;
  75159. }
  75160. let removesRemaining = 1;
  75161. const removeFinished = () => {
  75162. removesRemaining--;
  75163. if (removesRemaining === 0) {
  75164. done();
  75165. }
  75166. };
  75167. if (force || !this.audioDisabled_) {
  75168. removesRemaining++;
  75169. this.sourceUpdater_.removeAudio(start2, end, removeFinished);
  75170. }
  75171. if (force || this.loaderType_ === "main") {
  75172. this.gopBuffer_ = removeGopBuffer$1(this.gopBuffer_, start2, end, this.timeMapping_);
  75173. removesRemaining++;
  75174. this.sourceUpdater_.removeVideo(start2, end, removeFinished);
  75175. }
  75176. for (const track in this.inbandTextTracks_) {
  75177. removeCuesFromTrack$1(start2, end, this.inbandTextTracks_[track]);
  75178. }
  75179. removeCuesFromTrack$1(start2, end, this.segmentMetadataTrack_);
  75180. removeFinished();
  75181. }
  75182. monitorBuffer_() {
  75183. if (this.checkBufferTimeout_) {
  75184. window_1.clearTimeout(this.checkBufferTimeout_);
  75185. }
  75186. this.checkBufferTimeout_ = window_1.setTimeout(this.monitorBufferTick_.bind(this), 1);
  75187. }
  75188. monitorBufferTick_() {
  75189. if (this.state === "READY") {
  75190. this.fillBuffer_();
  75191. }
  75192. if (this.checkBufferTimeout_) {
  75193. window_1.clearTimeout(this.checkBufferTimeout_);
  75194. }
  75195. this.checkBufferTimeout_ = window_1.setTimeout(this.monitorBufferTick_.bind(this), CHECK_BUFFER_DELAY$1);
  75196. }
  75197. fillBuffer_() {
  75198. if (this.sourceUpdater_.updating()) {
  75199. return;
  75200. }
  75201. const segmentInfo = this.chooseNextRequest_();
  75202. if (!segmentInfo) {
  75203. return;
  75204. }
  75205. if (typeof segmentInfo.timestampOffset === "number") {
  75206. this.isPendingTimestampOffset_ = false;
  75207. this.timelineChangeController_.pendingTimelineChange({
  75208. type: this.loaderType_,
  75209. from: this.currentTimeline_,
  75210. to: segmentInfo.timeline
  75211. });
  75212. }
  75213. this.loadSegment_(segmentInfo);
  75214. }
  75215. isEndOfStream_(mediaIndex = this.mediaIndex, playlist = this.playlist_, partIndex = this.partIndex) {
  75216. if (!playlist || !this.mediaSource_) {
  75217. return false;
  75218. }
  75219. const segment = typeof mediaIndex === "number" && playlist.segments[mediaIndex];
  75220. const appendedLastSegment = mediaIndex + 1 === playlist.segments.length;
  75221. const appendedLastPart = !segment || !segment.parts || partIndex + 1 === segment.parts.length;
  75222. return playlist.endList && this.mediaSource_.readyState === "open" && appendedLastSegment && appendedLastPart;
  75223. }
  75224. chooseNextRequest_() {
  75225. const buffered = this.buffered_();
  75226. const bufferedEnd = lastBufferedEnd$1(buffered) || 0;
  75227. const bufferedTime = timeAheadOf$1(buffered, this.currentTime_());
  75228. const preloaded = !this.hasPlayed_() && bufferedTime >= 1;
  75229. const haveEnoughBuffer = bufferedTime >= this.goalBufferLength_();
  75230. const segments = this.playlist_.segments;
  75231. if (!segments.length || preloaded || haveEnoughBuffer) {
  75232. return null;
  75233. }
  75234. this.syncPoint_ = this.syncPoint_ || this.syncController_.getSyncPoint(this.playlist_, this.duration_(), this.currentTimeline_, this.currentTime_());
  75235. const next = {
  75236. partIndex: null,
  75237. mediaIndex: null,
  75238. startOfSegment: null,
  75239. playlist: this.playlist_,
  75240. isSyncRequest: Boolean(!this.syncPoint_)
  75241. };
  75242. if (next.isSyncRequest) {
  75243. next.mediaIndex = getSyncSegmentCandidate$1(this.currentTimeline_, segments, bufferedEnd);
  75244. } else if (this.mediaIndex !== null) {
  75245. const segment = segments[this.mediaIndex];
  75246. const partIndex = typeof this.partIndex === "number" ? this.partIndex : -1;
  75247. next.startOfSegment = segment.end ? segment.end : bufferedEnd;
  75248. if (segment.parts && segment.parts[partIndex + 1]) {
  75249. next.mediaIndex = this.mediaIndex;
  75250. next.partIndex = partIndex + 1;
  75251. } else {
  75252. next.mediaIndex = this.mediaIndex + 1;
  75253. }
  75254. } else {
  75255. const {
  75256. segmentIndex,
  75257. startTime,
  75258. partIndex
  75259. } = Playlist$1.getMediaInfoForTime({
  75260. exactManifestTimings: this.exactManifestTimings,
  75261. playlist: this.playlist_,
  75262. currentTime: this.fetchAtBuffer_ ? bufferedEnd : this.currentTime_(),
  75263. startingPartIndex: this.syncPoint_.partIndex,
  75264. startingSegmentIndex: this.syncPoint_.segmentIndex,
  75265. startTime: this.syncPoint_.time
  75266. });
  75267. next.getMediaInfoForTime = this.fetchAtBuffer_ ? `bufferedEnd ${bufferedEnd}` : `currentTime ${this.currentTime_()}`;
  75268. next.mediaIndex = segmentIndex;
  75269. next.startOfSegment = startTime;
  75270. next.partIndex = partIndex;
  75271. }
  75272. const nextSegment = segments[next.mediaIndex];
  75273. let nextPart = nextSegment && typeof next.partIndex === "number" && nextSegment.parts && nextSegment.parts[next.partIndex];
  75274. if (!nextSegment || typeof next.partIndex === "number" && !nextPart) {
  75275. return null;
  75276. }
  75277. if (typeof next.partIndex !== "number" && nextSegment.parts) {
  75278. next.partIndex = 0;
  75279. nextPart = nextSegment.parts[0];
  75280. }
  75281. if (!bufferedTime && nextPart && !nextPart.independent) {
  75282. if (next.partIndex === 0) {
  75283. const lastSegment = segments[next.mediaIndex - 1];
  75284. const lastSegmentLastPart = lastSegment.parts && lastSegment.parts.length && lastSegment.parts[lastSegment.parts.length - 1];
  75285. if (lastSegmentLastPart && lastSegmentLastPart.independent) {
  75286. next.mediaIndex -= 1;
  75287. next.partIndex = lastSegment.parts.length - 1;
  75288. next.independent = "previous segment";
  75289. }
  75290. } else if (nextSegment.parts[next.partIndex - 1].independent) {
  75291. next.partIndex -= 1;
  75292. next.independent = "previous part";
  75293. }
  75294. }
  75295. const ended = this.mediaSource_ && this.mediaSource_.readyState === "ended";
  75296. if (next.mediaIndex >= segments.length - 1 && ended && !this.seeking_()) {
  75297. return null;
  75298. }
  75299. return this.generateSegmentInfo_(next);
  75300. }
  75301. generateSegmentInfo_(options2) {
  75302. const {
  75303. independent,
  75304. playlist,
  75305. mediaIndex,
  75306. startOfSegment,
  75307. isSyncRequest,
  75308. partIndex,
  75309. forceTimestampOffset,
  75310. getMediaInfoForTime: getMediaInfoForTime3
  75311. } = options2;
  75312. const segment = playlist.segments[mediaIndex];
  75313. const part = typeof partIndex === "number" && segment.parts[partIndex];
  75314. const segmentInfo = {
  75315. requestId: "segment-loader-" + Math.random(),
  75316. uri: part && part.resolvedUri || segment.resolvedUri,
  75317. mediaIndex,
  75318. partIndex: part ? partIndex : null,
  75319. isSyncRequest,
  75320. startOfSegment,
  75321. playlist,
  75322. bytes: null,
  75323. encryptedBytes: null,
  75324. timestampOffset: null,
  75325. timeline: segment.timeline,
  75326. duration: part && part.duration || segment.duration,
  75327. segment,
  75328. part,
  75329. byteLength: 0,
  75330. transmuxer: this.transmuxer_,
  75331. getMediaInfoForTime: getMediaInfoForTime3,
  75332. independent
  75333. };
  75334. const overrideCheck = typeof forceTimestampOffset !== "undefined" ? forceTimestampOffset : this.isPendingTimestampOffset_;
  75335. segmentInfo.timestampOffset = this.timestampOffsetForSegment_({
  75336. segmentTimeline: segment.timeline,
  75337. currentTimeline: this.currentTimeline_,
  75338. startOfSegment,
  75339. buffered: this.buffered_(),
  75340. overrideCheck
  75341. });
  75342. const audioBufferedEnd = lastBufferedEnd$1(this.sourceUpdater_.audioBuffered());
  75343. if (typeof audioBufferedEnd === "number") {
  75344. segmentInfo.audioAppendStart = audioBufferedEnd - this.sourceUpdater_.audioTimestampOffset();
  75345. }
  75346. if (this.sourceUpdater_.videoBuffered().length) {
  75347. segmentInfo.gopsToAlignWith = gopsSafeToAlignWith$1(
  75348. this.gopBuffer_,
  75349. this.currentTime_() - this.sourceUpdater_.videoTimestampOffset(),
  75350. this.timeMapping_
  75351. );
  75352. }
  75353. return segmentInfo;
  75354. }
  75355. timestampOffsetForSegment_(options2) {
  75356. return timestampOffsetForSegment$1(options2);
  75357. }
  75358. earlyAbortWhenNeeded_(stats) {
  75359. if (this.vhs_.tech_.paused() || !this.xhrOptions_.timeout || !this.playlist_.attributes.BANDWIDTH) {
  75360. return;
  75361. }
  75362. if (Date.now() - (stats.firstBytesReceivedAt || Date.now()) < 1e3) {
  75363. return;
  75364. }
  75365. const currentTime = this.currentTime_();
  75366. const measuredBandwidth = stats.bandwidth;
  75367. const segmentDuration = this.pendingSegment_.duration;
  75368. const requestTimeRemaining = Playlist$1.estimateSegmentRequestTime(segmentDuration, measuredBandwidth, this.playlist_, stats.bytesReceived);
  75369. const timeUntilRebuffer$1$1 = timeUntilRebuffer$1(this.buffered_(), currentTime, this.vhs_.tech_.playbackRate()) - 1;
  75370. if (requestTimeRemaining <= timeUntilRebuffer$1$1) {
  75371. return;
  75372. }
  75373. const switchCandidate = minRebufferMaxBandwidthSelector$1({
  75374. main: this.vhs_.playlists.main,
  75375. currentTime,
  75376. bandwidth: measuredBandwidth,
  75377. duration: this.duration_(),
  75378. segmentDuration,
  75379. timeUntilRebuffer: timeUntilRebuffer$1$1,
  75380. currentTimeline: this.currentTimeline_,
  75381. syncController: this.syncController_
  75382. });
  75383. if (!switchCandidate) {
  75384. return;
  75385. }
  75386. const rebufferingImpact = requestTimeRemaining - timeUntilRebuffer$1$1;
  75387. const timeSavedBySwitching = rebufferingImpact - switchCandidate.rebufferingImpact;
  75388. let minimumTimeSaving = 0.5;
  75389. if (timeUntilRebuffer$1$1 <= TIME_FUDGE_FACTOR$1) {
  75390. minimumTimeSaving = 1;
  75391. }
  75392. if (!switchCandidate.playlist || switchCandidate.playlist.uri === this.playlist_.uri || timeSavedBySwitching < minimumTimeSaving) {
  75393. return;
  75394. }
  75395. this.bandwidth = switchCandidate.playlist.attributes.BANDWIDTH * Config$1.BANDWIDTH_VARIANCE + 1;
  75396. this.trigger("earlyabort");
  75397. }
  75398. handleAbort_(segmentInfo) {
  75399. this.logger_(`Aborting ${segmentInfoString$1(segmentInfo)}`);
  75400. this.mediaRequestsAborted += 1;
  75401. }
  75402. handleProgress_(event2, simpleSegment) {
  75403. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  75404. if (this.checkForAbort_(simpleSegment.requestId)) {
  75405. return;
  75406. }
  75407. this.trigger("progress");
  75408. }
  75409. handleTrackInfo_(simpleSegment, trackInfo) {
  75410. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  75411. if (this.checkForAbort_(simpleSegment.requestId)) {
  75412. return;
  75413. }
  75414. if (this.checkForIllegalMediaSwitch(trackInfo)) {
  75415. return;
  75416. }
  75417. trackInfo = trackInfo || {};
  75418. if (!shallowEqual$1(this.currentMediaInfo_, trackInfo)) {
  75419. this.appendInitSegment_ = {
  75420. audio: true,
  75421. video: true
  75422. };
  75423. this.startingMediaInfo_ = trackInfo;
  75424. this.currentMediaInfo_ = trackInfo;
  75425. this.logger_("trackinfo update", trackInfo);
  75426. this.trigger("trackinfo");
  75427. }
  75428. if (this.checkForAbort_(simpleSegment.requestId)) {
  75429. return;
  75430. }
  75431. this.pendingSegment_.trackInfo = trackInfo;
  75432. if (this.hasEnoughInfoToAppend_()) {
  75433. this.processCallQueue_();
  75434. }
  75435. }
  75436. handleTimingInfo_(simpleSegment, mediaType, timeType, time) {
  75437. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  75438. if (this.checkForAbort_(simpleSegment.requestId)) {
  75439. return;
  75440. }
  75441. const segmentInfo = this.pendingSegment_;
  75442. const timingInfoProperty = timingInfoPropertyForMedia$1(mediaType);
  75443. segmentInfo[timingInfoProperty] = segmentInfo[timingInfoProperty] || {};
  75444. segmentInfo[timingInfoProperty][timeType] = time;
  75445. this.logger_(`timinginfo: ${mediaType} - ${timeType} - ${time}`);
  75446. if (this.hasEnoughInfoToAppend_()) {
  75447. this.processCallQueue_();
  75448. }
  75449. }
  75450. handleCaptions_(simpleSegment, captionData) {
  75451. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  75452. if (this.checkForAbort_(simpleSegment.requestId)) {
  75453. return;
  75454. }
  75455. if (captionData.length === 0) {
  75456. this.logger_("SegmentLoader received no captions from a caption event");
  75457. return;
  75458. }
  75459. const segmentInfo = this.pendingSegment_;
  75460. if (!segmentInfo.hasAppendedData_) {
  75461. this.metadataQueue_.caption.push(this.handleCaptions_.bind(this, simpleSegment, captionData));
  75462. return;
  75463. }
  75464. const timestampOffset2 = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset();
  75465. const captionTracks = {};
  75466. captionData.forEach((caption) => {
  75467. captionTracks[caption.stream] = captionTracks[caption.stream] || {
  75468. startTime: Infinity,
  75469. captions: [],
  75470. endTime: 0
  75471. };
  75472. const captionTrack = captionTracks[caption.stream];
  75473. captionTrack.startTime = Math.min(captionTrack.startTime, caption.startTime + timestampOffset2);
  75474. captionTrack.endTime = Math.max(captionTrack.endTime, caption.endTime + timestampOffset2);
  75475. captionTrack.captions.push(caption);
  75476. });
  75477. Object.keys(captionTracks).forEach((trackName) => {
  75478. const {
  75479. startTime,
  75480. endTime,
  75481. captions
  75482. } = captionTracks[trackName];
  75483. const inbandTextTracks = this.inbandTextTracks_;
  75484. this.logger_(`adding cues from ${startTime} -> ${endTime} for ${trackName}`);
  75485. createCaptionsTrackIfNotExists$1(inbandTextTracks, this.vhs_.tech_, trackName);
  75486. removeCuesFromTrack$1(startTime, endTime, inbandTextTracks[trackName]);
  75487. addCaptionData$1({
  75488. captionArray: captions,
  75489. inbandTextTracks,
  75490. timestampOffset: timestampOffset2
  75491. });
  75492. });
  75493. if (this.transmuxer_) {
  75494. this.transmuxer_.postMessage({
  75495. action: "clearParsedMp4Captions"
  75496. });
  75497. }
  75498. }
  75499. handleId3_(simpleSegment, id3Frames, dispatchType) {
  75500. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  75501. if (this.checkForAbort_(simpleSegment.requestId)) {
  75502. return;
  75503. }
  75504. const segmentInfo = this.pendingSegment_;
  75505. if (!segmentInfo.hasAppendedData_) {
  75506. this.metadataQueue_.id3.push(this.handleId3_.bind(this, simpleSegment, id3Frames, dispatchType));
  75507. return;
  75508. }
  75509. const timestampOffset2 = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset();
  75510. createMetadataTrackIfNotExists$1(this.inbandTextTracks_, dispatchType, this.vhs_.tech_);
  75511. addMetadata$1({
  75512. inbandTextTracks: this.inbandTextTracks_,
  75513. metadataArray: id3Frames,
  75514. timestampOffset: timestampOffset2,
  75515. videoDuration: this.duration_()
  75516. });
  75517. }
  75518. processMetadataQueue_() {
  75519. this.metadataQueue_.id3.forEach((fn2) => fn2());
  75520. this.metadataQueue_.caption.forEach((fn2) => fn2());
  75521. this.metadataQueue_.id3 = [];
  75522. this.metadataQueue_.caption = [];
  75523. }
  75524. processCallQueue_() {
  75525. const callQueue = this.callQueue_;
  75526. this.callQueue_ = [];
  75527. callQueue.forEach((fun) => fun());
  75528. }
  75529. processLoadQueue_() {
  75530. const loadQueue = this.loadQueue_;
  75531. this.loadQueue_ = [];
  75532. loadQueue.forEach((fun) => fun());
  75533. }
  75534. hasEnoughInfoToLoad_() {
  75535. if (this.loaderType_ !== "audio") {
  75536. return true;
  75537. }
  75538. const segmentInfo = this.pendingSegment_;
  75539. if (!segmentInfo) {
  75540. return false;
  75541. }
  75542. if (!this.getCurrentMediaInfo_()) {
  75543. return true;
  75544. }
  75545. if (shouldWaitForTimelineChange$1({
  75546. timelineChangeController: this.timelineChangeController_,
  75547. currentTimeline: this.currentTimeline_,
  75548. segmentTimeline: segmentInfo.timeline,
  75549. loaderType: this.loaderType_,
  75550. audioDisabled: this.audioDisabled_
  75551. })) {
  75552. return false;
  75553. }
  75554. return true;
  75555. }
  75556. getCurrentMediaInfo_(segmentInfo = this.pendingSegment_) {
  75557. return segmentInfo && segmentInfo.trackInfo || this.currentMediaInfo_;
  75558. }
  75559. getMediaInfo_(segmentInfo = this.pendingSegment_) {
  75560. return this.getCurrentMediaInfo_(segmentInfo) || this.startingMediaInfo_;
  75561. }
  75562. getPendingSegmentPlaylist() {
  75563. return this.pendingSegment_ ? this.pendingSegment_.playlist : null;
  75564. }
  75565. hasEnoughInfoToAppend_() {
  75566. if (!this.sourceUpdater_.ready()) {
  75567. return false;
  75568. }
  75569. if (this.waitingOnRemove_ || this.quotaExceededErrorRetryTimeout_) {
  75570. return false;
  75571. }
  75572. const segmentInfo = this.pendingSegment_;
  75573. const trackInfo = this.getCurrentMediaInfo_();
  75574. if (!segmentInfo || !trackInfo) {
  75575. return false;
  75576. }
  75577. const {
  75578. hasAudio,
  75579. hasVideo,
  75580. isMuxed: isMuxed3
  75581. } = trackInfo;
  75582. if (hasVideo && !segmentInfo.videoTimingInfo) {
  75583. return false;
  75584. }
  75585. if (hasAudio && !this.audioDisabled_ && !isMuxed3 && !segmentInfo.audioTimingInfo) {
  75586. return false;
  75587. }
  75588. if (shouldWaitForTimelineChange$1({
  75589. timelineChangeController: this.timelineChangeController_,
  75590. currentTimeline: this.currentTimeline_,
  75591. segmentTimeline: segmentInfo.timeline,
  75592. loaderType: this.loaderType_,
  75593. audioDisabled: this.audioDisabled_
  75594. })) {
  75595. return false;
  75596. }
  75597. return true;
  75598. }
  75599. handleData_(simpleSegment, result) {
  75600. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  75601. if (this.checkForAbort_(simpleSegment.requestId)) {
  75602. return;
  75603. }
  75604. if (this.callQueue_.length || !this.hasEnoughInfoToAppend_()) {
  75605. this.callQueue_.push(this.handleData_.bind(this, simpleSegment, result));
  75606. return;
  75607. }
  75608. const segmentInfo = this.pendingSegment_;
  75609. this.setTimeMapping_(segmentInfo.timeline);
  75610. this.updateMediaSecondsLoaded_(segmentInfo.part || segmentInfo.segment);
  75611. if (this.mediaSource_.readyState === "closed") {
  75612. return;
  75613. }
  75614. if (simpleSegment.map) {
  75615. simpleSegment.map = this.initSegmentForMap(simpleSegment.map, true);
  75616. segmentInfo.segment.map = simpleSegment.map;
  75617. }
  75618. if (simpleSegment.key) {
  75619. this.segmentKey(simpleSegment.key, true);
  75620. }
  75621. segmentInfo.isFmp4 = simpleSegment.isFmp4;
  75622. segmentInfo.timingInfo = segmentInfo.timingInfo || {};
  75623. if (segmentInfo.isFmp4) {
  75624. this.trigger("fmp4");
  75625. segmentInfo.timingInfo.start = segmentInfo[timingInfoPropertyForMedia$1(result.type)].start;
  75626. } else {
  75627. const trackInfo = this.getCurrentMediaInfo_();
  75628. const useVideoTimingInfo = this.loaderType_ === "main" && trackInfo && trackInfo.hasVideo;
  75629. let firstVideoFrameTimeForData;
  75630. if (useVideoTimingInfo) {
  75631. firstVideoFrameTimeForData = segmentInfo.videoTimingInfo.start;
  75632. }
  75633. segmentInfo.timingInfo.start = this.trueSegmentStart_({
  75634. currentStart: segmentInfo.timingInfo.start,
  75635. playlist: segmentInfo.playlist,
  75636. mediaIndex: segmentInfo.mediaIndex,
  75637. currentVideoTimestampOffset: this.sourceUpdater_.videoTimestampOffset(),
  75638. useVideoTimingInfo,
  75639. firstVideoFrameTimeForData,
  75640. videoTimingInfo: segmentInfo.videoTimingInfo,
  75641. audioTimingInfo: segmentInfo.audioTimingInfo
  75642. });
  75643. }
  75644. this.updateAppendInitSegmentStatus(segmentInfo, result.type);
  75645. this.updateSourceBufferTimestampOffset_(segmentInfo);
  75646. if (segmentInfo.isSyncRequest) {
  75647. this.updateTimingInfoEnd_(segmentInfo);
  75648. this.syncController_.saveSegmentTimingInfo({
  75649. segmentInfo,
  75650. shouldSaveTimelineMapping: this.loaderType_ === "main"
  75651. });
  75652. const next = this.chooseNextRequest_();
  75653. if (next.mediaIndex !== segmentInfo.mediaIndex || next.partIndex !== segmentInfo.partIndex) {
  75654. this.logger_("sync segment was incorrect, not appending");
  75655. return;
  75656. }
  75657. this.logger_("sync segment was correct, appending");
  75658. }
  75659. segmentInfo.hasAppendedData_ = true;
  75660. this.processMetadataQueue_();
  75661. this.appendData_(segmentInfo, result);
  75662. }
  75663. updateAppendInitSegmentStatus(segmentInfo, type2) {
  75664. if (this.loaderType_ === "main" && typeof segmentInfo.timestampOffset === "number" && !segmentInfo.changedTimestampOffset) {
  75665. this.appendInitSegment_ = {
  75666. audio: true,
  75667. video: true
  75668. };
  75669. }
  75670. if (this.playlistOfLastInitSegment_[type2] !== segmentInfo.playlist) {
  75671. this.appendInitSegment_[type2] = true;
  75672. }
  75673. }
  75674. getInitSegmentAndUpdateState_({
  75675. type: type2,
  75676. initSegment,
  75677. map,
  75678. playlist
  75679. }) {
  75680. if (map) {
  75681. const id = initSegmentId$1(map);
  75682. if (this.activeInitSegmentId_ === id) {
  75683. return null;
  75684. }
  75685. initSegment = this.initSegmentForMap(map, true).bytes;
  75686. this.activeInitSegmentId_ = id;
  75687. }
  75688. if (initSegment && this.appendInitSegment_[type2]) {
  75689. this.playlistOfLastInitSegment_[type2] = playlist;
  75690. this.appendInitSegment_[type2] = false;
  75691. this.activeInitSegmentId_ = null;
  75692. return initSegment;
  75693. }
  75694. return null;
  75695. }
  75696. handleQuotaExceededError_({
  75697. segmentInfo,
  75698. type: type2,
  75699. bytes
  75700. }, error) {
  75701. const audioBuffered = this.sourceUpdater_.audioBuffered();
  75702. const videoBuffered = this.sourceUpdater_.videoBuffered();
  75703. if (audioBuffered.length > 1) {
  75704. this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: " + timeRangesToArray$1(audioBuffered).join(", "));
  75705. }
  75706. if (videoBuffered.length > 1) {
  75707. this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: " + timeRangesToArray$1(videoBuffered).join(", "));
  75708. }
  75709. const audioBufferStart = audioBuffered.length ? audioBuffered.start(0) : 0;
  75710. const audioBufferEnd = audioBuffered.length ? audioBuffered.end(audioBuffered.length - 1) : 0;
  75711. const videoBufferStart = videoBuffered.length ? videoBuffered.start(0) : 0;
  75712. const videoBufferEnd = videoBuffered.length ? videoBuffered.end(videoBuffered.length - 1) : 0;
  75713. if (audioBufferEnd - audioBufferStart <= MIN_BACK_BUFFER$1 && videoBufferEnd - videoBufferStart <= MIN_BACK_BUFFER$1) {
  75714. this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${bytes.byteLength}, audio buffer: ${timeRangesToArray$1(audioBuffered).join(", ")}, video buffer: ${timeRangesToArray$1(videoBuffered).join(", ")}, `);
  75715. this.error({
  75716. message: "Quota exceeded error with append of a single segment of content",
  75717. excludeUntil: Infinity
  75718. });
  75719. this.trigger("error");
  75720. return;
  75721. }
  75722. this.waitingOnRemove_ = true;
  75723. this.callQueue_.push(this.appendToSourceBuffer_.bind(this, {
  75724. segmentInfo,
  75725. type: type2,
  75726. bytes
  75727. }));
  75728. const currentTime = this.currentTime_();
  75729. const timeToRemoveUntil = currentTime - MIN_BACK_BUFFER$1;
  75730. this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${timeToRemoveUntil}`);
  75731. this.remove(0, timeToRemoveUntil, () => {
  75732. this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${MIN_BACK_BUFFER$1}s`);
  75733. this.waitingOnRemove_ = false;
  75734. this.quotaExceededErrorRetryTimeout_ = window_1.setTimeout(() => {
  75735. this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue");
  75736. this.quotaExceededErrorRetryTimeout_ = null;
  75737. this.processCallQueue_();
  75738. }, MIN_BACK_BUFFER$1 * 1e3);
  75739. }, true);
  75740. }
  75741. handleAppendError_({
  75742. segmentInfo,
  75743. type: type2,
  75744. bytes
  75745. }, error) {
  75746. if (!error) {
  75747. return;
  75748. }
  75749. if (error.code === QUOTA_EXCEEDED_ERR$1) {
  75750. this.handleQuotaExceededError_({
  75751. segmentInfo,
  75752. type: type2,
  75753. bytes
  75754. });
  75755. return;
  75756. }
  75757. this.logger_("Received non QUOTA_EXCEEDED_ERR on append", error);
  75758. this.error(`${type2} append of ${bytes.length}b failed for segment #${segmentInfo.mediaIndex} in playlist ${segmentInfo.playlist.id}`);
  75759. this.trigger("appenderror");
  75760. }
  75761. appendToSourceBuffer_({
  75762. segmentInfo,
  75763. type: type2,
  75764. initSegment,
  75765. data,
  75766. bytes
  75767. }) {
  75768. if (!bytes) {
  75769. const segments = [data];
  75770. let byteLength = data.byteLength;
  75771. if (initSegment) {
  75772. segments.unshift(initSegment);
  75773. byteLength += initSegment.byteLength;
  75774. }
  75775. bytes = concatSegments$1({
  75776. bytes: byteLength,
  75777. segments
  75778. });
  75779. }
  75780. this.sourceUpdater_.appendBuffer({
  75781. segmentInfo,
  75782. type: type2,
  75783. bytes
  75784. }, this.handleAppendError_.bind(this, {
  75785. segmentInfo,
  75786. type: type2,
  75787. bytes
  75788. }));
  75789. }
  75790. handleSegmentTimingInfo_(type2, requestId, segmentTimingInfo) {
  75791. if (!this.pendingSegment_ || requestId !== this.pendingSegment_.requestId) {
  75792. return;
  75793. }
  75794. const segment = this.pendingSegment_.segment;
  75795. const timingInfoProperty = `${type2}TimingInfo`;
  75796. if (!segment[timingInfoProperty]) {
  75797. segment[timingInfoProperty] = {};
  75798. }
  75799. segment[timingInfoProperty].transmuxerPrependedSeconds = segmentTimingInfo.prependedContentDuration || 0;
  75800. segment[timingInfoProperty].transmuxedPresentationStart = segmentTimingInfo.start.presentation;
  75801. segment[timingInfoProperty].transmuxedDecodeStart = segmentTimingInfo.start.decode;
  75802. segment[timingInfoProperty].transmuxedPresentationEnd = segmentTimingInfo.end.presentation;
  75803. segment[timingInfoProperty].transmuxedDecodeEnd = segmentTimingInfo.end.decode;
  75804. segment[timingInfoProperty].baseMediaDecodeTime = segmentTimingInfo.baseMediaDecodeTime;
  75805. }
  75806. appendData_(segmentInfo, result) {
  75807. const {
  75808. type: type2,
  75809. data
  75810. } = result;
  75811. if (!data || !data.byteLength) {
  75812. return;
  75813. }
  75814. if (type2 === "audio" && this.audioDisabled_) {
  75815. return;
  75816. }
  75817. const initSegment = this.getInitSegmentAndUpdateState_({
  75818. type: type2,
  75819. initSegment: result.initSegment,
  75820. playlist: segmentInfo.playlist,
  75821. map: segmentInfo.isFmp4 ? segmentInfo.segment.map : null
  75822. });
  75823. this.appendToSourceBuffer_({
  75824. segmentInfo,
  75825. type: type2,
  75826. initSegment,
  75827. data
  75828. });
  75829. }
  75830. loadSegment_(segmentInfo) {
  75831. this.state = "WAITING";
  75832. this.pendingSegment_ = segmentInfo;
  75833. this.trimBackBuffer_(segmentInfo);
  75834. if (typeof segmentInfo.timestampOffset === "number") {
  75835. if (this.transmuxer_) {
  75836. this.transmuxer_.postMessage({
  75837. action: "clearAllMp4Captions"
  75838. });
  75839. }
  75840. }
  75841. if (!this.hasEnoughInfoToLoad_()) {
  75842. this.loadQueue_.push(() => {
  75843. const options2 = _extends$2({}, segmentInfo, {
  75844. forceTimestampOffset: true
  75845. });
  75846. _extends$2(segmentInfo, this.generateSegmentInfo_(options2));
  75847. this.isPendingTimestampOffset_ = false;
  75848. this.updateTransmuxerAndRequestSegment_(segmentInfo);
  75849. });
  75850. return;
  75851. }
  75852. this.updateTransmuxerAndRequestSegment_(segmentInfo);
  75853. }
  75854. updateTransmuxerAndRequestSegment_(segmentInfo) {
  75855. if (this.shouldUpdateTransmuxerTimestampOffset_(segmentInfo.timestampOffset)) {
  75856. this.gopBuffer_.length = 0;
  75857. segmentInfo.gopsToAlignWith = [];
  75858. this.timeMapping_ = 0;
  75859. this.transmuxer_.postMessage({
  75860. action: "reset"
  75861. });
  75862. this.transmuxer_.postMessage({
  75863. action: "setTimestampOffset",
  75864. timestampOffset: segmentInfo.timestampOffset
  75865. });
  75866. }
  75867. const simpleSegment = this.createSimplifiedSegmentObj_(segmentInfo);
  75868. const isEndOfStream = this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex);
  75869. const isWalkingForward = this.mediaIndex !== null;
  75870. const isDiscontinuity = segmentInfo.timeline !== this.currentTimeline_ && segmentInfo.timeline > 0;
  75871. const isEndOfTimeline = isEndOfStream || isWalkingForward && isDiscontinuity;
  75872. this.logger_(`Requesting ${segmentInfoString$1(segmentInfo)}`);
  75873. if (simpleSegment.map && !simpleSegment.map.bytes) {
  75874. this.logger_("going to request init segment.");
  75875. this.appendInitSegment_ = {
  75876. video: true,
  75877. audio: true
  75878. };
  75879. }
  75880. segmentInfo.abortRequests = mediaSegmentRequest$1({
  75881. xhr: this.vhs_.xhr,
  75882. xhrOptions: this.xhrOptions_,
  75883. decryptionWorker: this.decrypter_,
  75884. segment: simpleSegment,
  75885. abortFn: this.handleAbort_.bind(this, segmentInfo),
  75886. progressFn: this.handleProgress_.bind(this),
  75887. trackInfoFn: this.handleTrackInfo_.bind(this),
  75888. timingInfoFn: this.handleTimingInfo_.bind(this),
  75889. videoSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, "video", segmentInfo.requestId),
  75890. audioSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, "audio", segmentInfo.requestId),
  75891. captionsFn: this.handleCaptions_.bind(this),
  75892. isEndOfTimeline,
  75893. endedTimelineFn: () => {
  75894. this.logger_("received endedtimeline callback");
  75895. },
  75896. id3Fn: this.handleId3_.bind(this),
  75897. dataFn: this.handleData_.bind(this),
  75898. doneFn: this.segmentRequestFinished_.bind(this),
  75899. onTransmuxerLog: ({
  75900. message,
  75901. level,
  75902. stream
  75903. }) => {
  75904. this.logger_(`${segmentInfoString$1(segmentInfo)} logged from transmuxer stream ${stream} as a ${level}: ${message}`);
  75905. }
  75906. });
  75907. }
  75908. trimBackBuffer_(segmentInfo) {
  75909. const removeToTime = safeBackBufferTrimTime$1(this.seekable_(), this.currentTime_(), this.playlist_.targetDuration || 10);
  75910. if (removeToTime > 0) {
  75911. this.remove(0, removeToTime);
  75912. }
  75913. }
  75914. createSimplifiedSegmentObj_(segmentInfo) {
  75915. const segment = segmentInfo.segment;
  75916. const part = segmentInfo.part;
  75917. const simpleSegment = {
  75918. resolvedUri: part ? part.resolvedUri : segment.resolvedUri,
  75919. byterange: part ? part.byterange : segment.byterange,
  75920. requestId: segmentInfo.requestId,
  75921. transmuxer: segmentInfo.transmuxer,
  75922. audioAppendStart: segmentInfo.audioAppendStart,
  75923. gopsToAlignWith: segmentInfo.gopsToAlignWith,
  75924. part: segmentInfo.part
  75925. };
  75926. const previousSegment = segmentInfo.playlist.segments[segmentInfo.mediaIndex - 1];
  75927. if (previousSegment && previousSegment.timeline === segment.timeline) {
  75928. if (previousSegment.videoTimingInfo) {
  75929. simpleSegment.baseStartTime = previousSegment.videoTimingInfo.transmuxedDecodeEnd;
  75930. } else if (previousSegment.audioTimingInfo) {
  75931. simpleSegment.baseStartTime = previousSegment.audioTimingInfo.transmuxedDecodeEnd;
  75932. }
  75933. }
  75934. if (segment.key) {
  75935. const iv = segment.key.iv || new Uint32Array([0, 0, 0, segmentInfo.mediaIndex + segmentInfo.playlist.mediaSequence]);
  75936. simpleSegment.key = this.segmentKey(segment.key);
  75937. simpleSegment.key.iv = iv;
  75938. }
  75939. if (segment.map) {
  75940. simpleSegment.map = this.initSegmentForMap(segment.map);
  75941. }
  75942. return simpleSegment;
  75943. }
  75944. saveTransferStats_(stats) {
  75945. this.mediaRequests += 1;
  75946. if (stats) {
  75947. this.mediaBytesTransferred += stats.bytesReceived;
  75948. this.mediaTransferDuration += stats.roundTripTime;
  75949. }
  75950. }
  75951. saveBandwidthRelatedStats_(duration5, stats) {
  75952. this.pendingSegment_.byteLength = stats.bytesReceived;
  75953. if (duration5 < MIN_SEGMENT_DURATION_TO_SAVE_STATS$1) {
  75954. this.logger_(`Ignoring segment's bandwidth because its duration of ${duration5} is less than the min to record ${MIN_SEGMENT_DURATION_TO_SAVE_STATS$1}`);
  75955. return;
  75956. }
  75957. this.bandwidth = stats.bandwidth;
  75958. this.roundTrip = stats.roundTripTime;
  75959. }
  75960. handleTimeout_() {
  75961. this.mediaRequestsTimedout += 1;
  75962. this.bandwidth = 1;
  75963. this.roundTrip = NaN;
  75964. this.trigger("bandwidthupdate");
  75965. this.trigger("timeout");
  75966. }
  75967. segmentRequestFinished_(error, simpleSegment, result) {
  75968. if (this.callQueue_.length) {
  75969. this.callQueue_.push(this.segmentRequestFinished_.bind(this, error, simpleSegment, result));
  75970. return;
  75971. }
  75972. this.saveTransferStats_(simpleSegment.stats);
  75973. if (!this.pendingSegment_) {
  75974. return;
  75975. }
  75976. if (simpleSegment.requestId !== this.pendingSegment_.requestId) {
  75977. return;
  75978. }
  75979. if (error) {
  75980. this.pendingSegment_ = null;
  75981. this.state = "READY";
  75982. if (error.code === REQUEST_ERRORS$1.ABORTED) {
  75983. return;
  75984. }
  75985. this.pause();
  75986. if (error.code === REQUEST_ERRORS$1.TIMEOUT) {
  75987. this.handleTimeout_();
  75988. return;
  75989. }
  75990. this.mediaRequestsErrored += 1;
  75991. this.error(error);
  75992. this.trigger("error");
  75993. return;
  75994. }
  75995. const segmentInfo = this.pendingSegment_;
  75996. this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats);
  75997. segmentInfo.endOfAllRequests = simpleSegment.endOfAllRequests;
  75998. if (result.gopInfo) {
  75999. this.gopBuffer_ = updateGopBuffer$1(this.gopBuffer_, result.gopInfo, this.safeAppend_);
  76000. }
  76001. this.state = "APPENDING";
  76002. this.trigger("appending");
  76003. this.waitForAppendsToComplete_(segmentInfo);
  76004. }
  76005. setTimeMapping_(timeline) {
  76006. const timelineMapping = this.syncController_.mappingForTimeline(timeline);
  76007. if (timelineMapping !== null) {
  76008. this.timeMapping_ = timelineMapping;
  76009. }
  76010. }
  76011. updateMediaSecondsLoaded_(segment) {
  76012. if (typeof segment.start === "number" && typeof segment.end === "number") {
  76013. this.mediaSecondsLoaded += segment.end - segment.start;
  76014. } else {
  76015. this.mediaSecondsLoaded += segment.duration;
  76016. }
  76017. }
  76018. shouldUpdateTransmuxerTimestampOffset_(timestampOffset2) {
  76019. if (timestampOffset2 === null) {
  76020. return false;
  76021. }
  76022. if (this.loaderType_ === "main" && timestampOffset2 !== this.sourceUpdater_.videoTimestampOffset()) {
  76023. return true;
  76024. }
  76025. if (!this.audioDisabled_ && timestampOffset2 !== this.sourceUpdater_.audioTimestampOffset()) {
  76026. return true;
  76027. }
  76028. return false;
  76029. }
  76030. trueSegmentStart_({
  76031. currentStart,
  76032. playlist,
  76033. mediaIndex,
  76034. firstVideoFrameTimeForData,
  76035. currentVideoTimestampOffset,
  76036. useVideoTimingInfo,
  76037. videoTimingInfo,
  76038. audioTimingInfo
  76039. }) {
  76040. if (typeof currentStart !== "undefined") {
  76041. return currentStart;
  76042. }
  76043. if (!useVideoTimingInfo) {
  76044. return audioTimingInfo.start;
  76045. }
  76046. const previousSegment = playlist.segments[mediaIndex - 1];
  76047. if (mediaIndex === 0 || !previousSegment || typeof previousSegment.start === "undefined" || previousSegment.end !== firstVideoFrameTimeForData + currentVideoTimestampOffset) {
  76048. return firstVideoFrameTimeForData;
  76049. }
  76050. return videoTimingInfo.start;
  76051. }
  76052. waitForAppendsToComplete_(segmentInfo) {
  76053. const trackInfo = this.getCurrentMediaInfo_(segmentInfo);
  76054. if (!trackInfo) {
  76055. this.error({
  76056. message: "No starting media returned, likely due to an unsupported media format.",
  76057. playlistExclusionDuration: Infinity
  76058. });
  76059. this.trigger("error");
  76060. return;
  76061. }
  76062. const {
  76063. hasAudio,
  76064. hasVideo,
  76065. isMuxed: isMuxed3
  76066. } = trackInfo;
  76067. const waitForVideo = this.loaderType_ === "main" && hasVideo;
  76068. const waitForAudio = !this.audioDisabled_ && hasAudio && !isMuxed3;
  76069. segmentInfo.waitingOnAppends = 0;
  76070. if (!segmentInfo.hasAppendedData_) {
  76071. if (!segmentInfo.timingInfo && typeof segmentInfo.timestampOffset === "number") {
  76072. this.isPendingTimestampOffset_ = true;
  76073. }
  76074. segmentInfo.timingInfo = {
  76075. start: 0
  76076. };
  76077. segmentInfo.waitingOnAppends++;
  76078. if (!this.isPendingTimestampOffset_) {
  76079. this.updateSourceBufferTimestampOffset_(segmentInfo);
  76080. this.processMetadataQueue_();
  76081. }
  76082. this.checkAppendsDone_(segmentInfo);
  76083. return;
  76084. }
  76085. if (waitForVideo) {
  76086. segmentInfo.waitingOnAppends++;
  76087. }
  76088. if (waitForAudio) {
  76089. segmentInfo.waitingOnAppends++;
  76090. }
  76091. if (waitForVideo) {
  76092. this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo));
  76093. }
  76094. if (waitForAudio) {
  76095. this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo));
  76096. }
  76097. }
  76098. checkAppendsDone_(segmentInfo) {
  76099. if (this.checkForAbort_(segmentInfo.requestId)) {
  76100. return;
  76101. }
  76102. segmentInfo.waitingOnAppends--;
  76103. if (segmentInfo.waitingOnAppends === 0) {
  76104. this.handleAppendsDone_();
  76105. }
  76106. }
  76107. checkForIllegalMediaSwitch(trackInfo) {
  76108. const illegalMediaSwitchError = illegalMediaSwitch$1(this.loaderType_, this.getCurrentMediaInfo_(), trackInfo);
  76109. if (illegalMediaSwitchError) {
  76110. this.error({
  76111. message: illegalMediaSwitchError,
  76112. playlistExclusionDuration: Infinity
  76113. });
  76114. this.trigger("error");
  76115. return true;
  76116. }
  76117. return false;
  76118. }
  76119. updateSourceBufferTimestampOffset_(segmentInfo) {
  76120. if (segmentInfo.timestampOffset === null || typeof segmentInfo.timingInfo.start !== "number" || segmentInfo.changedTimestampOffset || this.loaderType_ !== "main") {
  76121. return;
  76122. }
  76123. let didChange = false;
  76124. segmentInfo.timestampOffset -= this.getSegmentStartTimeForTimestampOffsetCalculation_({
  76125. videoTimingInfo: segmentInfo.segment.videoTimingInfo,
  76126. audioTimingInfo: segmentInfo.segment.audioTimingInfo,
  76127. timingInfo: segmentInfo.timingInfo
  76128. });
  76129. segmentInfo.changedTimestampOffset = true;
  76130. if (segmentInfo.timestampOffset !== this.sourceUpdater_.videoTimestampOffset()) {
  76131. this.sourceUpdater_.videoTimestampOffset(segmentInfo.timestampOffset);
  76132. didChange = true;
  76133. }
  76134. if (segmentInfo.timestampOffset !== this.sourceUpdater_.audioTimestampOffset()) {
  76135. this.sourceUpdater_.audioTimestampOffset(segmentInfo.timestampOffset);
  76136. didChange = true;
  76137. }
  76138. if (didChange) {
  76139. this.trigger("timestampoffset");
  76140. }
  76141. }
  76142. getSegmentStartTimeForTimestampOffsetCalculation_({
  76143. videoTimingInfo,
  76144. audioTimingInfo,
  76145. timingInfo
  76146. }) {
  76147. if (!this.useDtsForTimestampOffset_) {
  76148. return timingInfo.start;
  76149. }
  76150. if (videoTimingInfo && typeof videoTimingInfo.transmuxedDecodeStart === "number") {
  76151. return videoTimingInfo.transmuxedDecodeStart;
  76152. }
  76153. if (audioTimingInfo && typeof audioTimingInfo.transmuxedDecodeStart === "number") {
  76154. return audioTimingInfo.transmuxedDecodeStart;
  76155. }
  76156. return timingInfo.start;
  76157. }
  76158. updateTimingInfoEnd_(segmentInfo) {
  76159. segmentInfo.timingInfo = segmentInfo.timingInfo || {};
  76160. const trackInfo = this.getMediaInfo_();
  76161. const useVideoTimingInfo = this.loaderType_ === "main" && trackInfo && trackInfo.hasVideo;
  76162. const prioritizedTimingInfo = useVideoTimingInfo && segmentInfo.videoTimingInfo ? segmentInfo.videoTimingInfo : segmentInfo.audioTimingInfo;
  76163. if (!prioritizedTimingInfo) {
  76164. return;
  76165. }
  76166. segmentInfo.timingInfo.end = typeof prioritizedTimingInfo.end === "number" ? prioritizedTimingInfo.end : prioritizedTimingInfo.start + segmentInfo.duration;
  76167. }
  76168. handleAppendsDone_() {
  76169. if (this.pendingSegment_) {
  76170. this.trigger("appendsdone");
  76171. }
  76172. if (!this.pendingSegment_) {
  76173. this.state = "READY";
  76174. if (!this.paused()) {
  76175. this.monitorBuffer_();
  76176. }
  76177. return;
  76178. }
  76179. const segmentInfo = this.pendingSegment_;
  76180. this.updateTimingInfoEnd_(segmentInfo);
  76181. if (this.shouldSaveSegmentTimingInfo_) {
  76182. this.syncController_.saveSegmentTimingInfo({
  76183. segmentInfo,
  76184. shouldSaveTimelineMapping: this.loaderType_ === "main"
  76185. });
  76186. }
  76187. const segmentDurationMessage = getTroublesomeSegmentDurationMessage$1(segmentInfo, this.sourceType_);
  76188. if (segmentDurationMessage) {
  76189. if (segmentDurationMessage.severity === "warn") {
  76190. videojs$2.log.warn(segmentDurationMessage.message);
  76191. } else {
  76192. this.logger_(segmentDurationMessage.message);
  76193. }
  76194. }
  76195. this.recordThroughput_(segmentInfo);
  76196. this.pendingSegment_ = null;
  76197. this.state = "READY";
  76198. if (segmentInfo.isSyncRequest) {
  76199. this.trigger("syncinfoupdate");
  76200. if (!segmentInfo.hasAppendedData_) {
  76201. this.logger_(`Throwing away un-appended sync request ${segmentInfoString$1(segmentInfo)}`);
  76202. return;
  76203. }
  76204. }
  76205. this.logger_(`Appended ${segmentInfoString$1(segmentInfo)}`);
  76206. this.addSegmentMetadataCue_(segmentInfo);
  76207. this.fetchAtBuffer_ = true;
  76208. if (this.currentTimeline_ !== segmentInfo.timeline) {
  76209. this.timelineChangeController_.lastTimelineChange({
  76210. type: this.loaderType_,
  76211. from: this.currentTimeline_,
  76212. to: segmentInfo.timeline
  76213. });
  76214. if (this.loaderType_ === "main" && !this.audioDisabled_) {
  76215. this.timelineChangeController_.lastTimelineChange({
  76216. type: "audio",
  76217. from: this.currentTimeline_,
  76218. to: segmentInfo.timeline
  76219. });
  76220. }
  76221. }
  76222. this.currentTimeline_ = segmentInfo.timeline;
  76223. this.trigger("syncinfoupdate");
  76224. const segment = segmentInfo.segment;
  76225. const part = segmentInfo.part;
  76226. const badSegmentGuess = segment.end && this.currentTime_() - segment.end > segmentInfo.playlist.targetDuration * 3;
  76227. const badPartGuess = part && part.end && this.currentTime_() - part.end > segmentInfo.playlist.partTargetDuration * 3;
  76228. if (badSegmentGuess || badPartGuess) {
  76229. this.logger_(`bad ${badSegmentGuess ? "segment" : "part"} ${segmentInfoString$1(segmentInfo)}`);
  76230. this.resetEverything();
  76231. return;
  76232. }
  76233. const isWalkingForward = this.mediaIndex !== null;
  76234. if (isWalkingForward) {
  76235. this.trigger("bandwidthupdate");
  76236. }
  76237. this.trigger("progress");
  76238. this.mediaIndex = segmentInfo.mediaIndex;
  76239. this.partIndex = segmentInfo.partIndex;
  76240. if (this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex)) {
  76241. this.endOfStream();
  76242. }
  76243. this.trigger("appended");
  76244. if (segmentInfo.hasAppendedData_) {
  76245. this.mediaAppends++;
  76246. }
  76247. if (!this.paused()) {
  76248. this.monitorBuffer_();
  76249. }
  76250. }
  76251. recordThroughput_(segmentInfo) {
  76252. if (segmentInfo.duration < MIN_SEGMENT_DURATION_TO_SAVE_STATS$1) {
  76253. this.logger_(`Ignoring segment's throughput because its duration of ${segmentInfo.duration} is less than the min to record ${MIN_SEGMENT_DURATION_TO_SAVE_STATS$1}`);
  76254. return;
  76255. }
  76256. const rate = this.throughput.rate;
  76257. const segmentProcessingTime = Date.now() - segmentInfo.endOfAllRequests + 1;
  76258. const segmentProcessingThroughput = Math.floor(segmentInfo.byteLength / segmentProcessingTime * 8 * 1e3);
  76259. this.throughput.rate += (segmentProcessingThroughput - rate) / ++this.throughput.count;
  76260. }
  76261. addSegmentMetadataCue_(segmentInfo) {
  76262. if (!this.segmentMetadataTrack_) {
  76263. return;
  76264. }
  76265. const segment = segmentInfo.segment;
  76266. const start2 = segment.start;
  76267. const end = segment.end;
  76268. if (!finite$1(start2) || !finite$1(end)) {
  76269. return;
  76270. }
  76271. removeCuesFromTrack$1(start2, end, this.segmentMetadataTrack_);
  76272. const Cue = window_1.WebKitDataCue || window_1.VTTCue;
  76273. const value = {
  76274. custom: segment.custom,
  76275. dateTimeObject: segment.dateTimeObject,
  76276. dateTimeString: segment.dateTimeString,
  76277. bandwidth: segmentInfo.playlist.attributes.BANDWIDTH,
  76278. resolution: segmentInfo.playlist.attributes.RESOLUTION,
  76279. codecs: segmentInfo.playlist.attributes.CODECS,
  76280. byteLength: segmentInfo.byteLength,
  76281. uri: segmentInfo.uri,
  76282. timeline: segmentInfo.timeline,
  76283. playlist: segmentInfo.playlist.id,
  76284. start: start2,
  76285. end
  76286. };
  76287. const data = JSON.stringify(value);
  76288. const cue = new Cue(start2, end, data);
  76289. cue.value = value;
  76290. this.segmentMetadataTrack_.addCue(cue);
  76291. }
  76292. }
  76293. function noop$1() {
  76294. }
  76295. const toTitleCase$2 = function(string) {
  76296. if (typeof string !== "string") {
  76297. return string;
  76298. }
  76299. return string.replace(/./, (w) => w.toUpperCase());
  76300. };
  76301. const bufferTypes$1 = ["video", "audio"];
  76302. const updating = (type2, sourceUpdater) => {
  76303. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76304. return sourceBuffer && sourceBuffer.updating || sourceUpdater.queuePending[type2];
  76305. };
  76306. const nextQueueIndexOfType$1 = (type2, queue) => {
  76307. for (let i2 = 0; i2 < queue.length; i2++) {
  76308. const queueEntry = queue[i2];
  76309. if (queueEntry.type === "mediaSource") {
  76310. return null;
  76311. }
  76312. if (queueEntry.type === type2) {
  76313. return i2;
  76314. }
  76315. }
  76316. return null;
  76317. };
  76318. const shiftQueue$1 = (type2, sourceUpdater) => {
  76319. if (sourceUpdater.queue.length === 0) {
  76320. return;
  76321. }
  76322. let queueIndex = 0;
  76323. let queueEntry = sourceUpdater.queue[queueIndex];
  76324. if (queueEntry.type === "mediaSource") {
  76325. if (!sourceUpdater.updating() && sourceUpdater.mediaSource.readyState !== "closed") {
  76326. sourceUpdater.queue.shift();
  76327. queueEntry.action(sourceUpdater);
  76328. if (queueEntry.doneFn) {
  76329. queueEntry.doneFn();
  76330. }
  76331. shiftQueue$1("audio", sourceUpdater);
  76332. shiftQueue$1("video", sourceUpdater);
  76333. }
  76334. return;
  76335. }
  76336. if (type2 === "mediaSource") {
  76337. return;
  76338. }
  76339. if (!sourceUpdater.ready() || sourceUpdater.mediaSource.readyState === "closed" || updating(type2, sourceUpdater)) {
  76340. return;
  76341. }
  76342. if (queueEntry.type !== type2) {
  76343. queueIndex = nextQueueIndexOfType$1(type2, sourceUpdater.queue);
  76344. if (queueIndex === null) {
  76345. return;
  76346. }
  76347. queueEntry = sourceUpdater.queue[queueIndex];
  76348. }
  76349. sourceUpdater.queue.splice(queueIndex, 1);
  76350. sourceUpdater.queuePending[type2] = queueEntry;
  76351. queueEntry.action(type2, sourceUpdater);
  76352. if (!queueEntry.doneFn) {
  76353. sourceUpdater.queuePending[type2] = null;
  76354. shiftQueue$1(type2, sourceUpdater);
  76355. return;
  76356. }
  76357. };
  76358. const cleanupBuffer$1 = (type2, sourceUpdater) => {
  76359. const buffer = sourceUpdater[`${type2}Buffer`];
  76360. const titleType = toTitleCase$2(type2);
  76361. if (!buffer) {
  76362. return;
  76363. }
  76364. buffer.removeEventListener("updateend", sourceUpdater[`on${titleType}UpdateEnd_`]);
  76365. buffer.removeEventListener("error", sourceUpdater[`on${titleType}Error_`]);
  76366. sourceUpdater.codecs[type2] = null;
  76367. sourceUpdater[`${type2}Buffer`] = null;
  76368. };
  76369. const inSourceBuffers$1 = (mediaSource, sourceBuffer) => mediaSource && sourceBuffer && Array.prototype.indexOf.call(mediaSource.sourceBuffers, sourceBuffer) !== -1;
  76370. const actions$1 = {
  76371. appendBuffer: (bytes, segmentInfo, onError2) => (type2, sourceUpdater) => {
  76372. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76373. if (!inSourceBuffers$1(sourceUpdater.mediaSource, sourceBuffer)) {
  76374. return;
  76375. }
  76376. sourceUpdater.logger_(`Appending segment ${segmentInfo.mediaIndex}'s ${bytes.length} bytes to ${type2}Buffer`);
  76377. try {
  76378. sourceBuffer.appendBuffer(bytes);
  76379. } catch (e) {
  76380. sourceUpdater.logger_(`Error with code ${e.code} ` + (e.code === QUOTA_EXCEEDED_ERR$1 ? "(QUOTA_EXCEEDED_ERR) " : "") + `when appending segment ${segmentInfo.mediaIndex} to ${type2}Buffer`);
  76381. sourceUpdater.queuePending[type2] = null;
  76382. onError2(e);
  76383. }
  76384. },
  76385. remove: (start2, end) => (type2, sourceUpdater) => {
  76386. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76387. if (!inSourceBuffers$1(sourceUpdater.mediaSource, sourceBuffer)) {
  76388. return;
  76389. }
  76390. sourceUpdater.logger_(`Removing ${start2} to ${end} from ${type2}Buffer`);
  76391. try {
  76392. sourceBuffer.remove(start2, end);
  76393. } catch (e) {
  76394. sourceUpdater.logger_(`Remove ${start2} to ${end} from ${type2}Buffer failed`);
  76395. }
  76396. },
  76397. timestampOffset: (offset) => (type2, sourceUpdater) => {
  76398. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76399. if (!inSourceBuffers$1(sourceUpdater.mediaSource, sourceBuffer)) {
  76400. return;
  76401. }
  76402. sourceUpdater.logger_(`Setting ${type2}timestampOffset to ${offset}`);
  76403. sourceBuffer.timestampOffset = offset;
  76404. },
  76405. callback: (callback2) => (type2, sourceUpdater) => {
  76406. callback2();
  76407. },
  76408. endOfStream: (error) => (sourceUpdater) => {
  76409. if (sourceUpdater.mediaSource.readyState !== "open") {
  76410. return;
  76411. }
  76412. sourceUpdater.logger_(`Calling mediaSource endOfStream(${error || ""})`);
  76413. try {
  76414. sourceUpdater.mediaSource.endOfStream(error);
  76415. } catch (e) {
  76416. videojs$2.log.warn("Failed to call media source endOfStream", e);
  76417. }
  76418. },
  76419. duration: (duration5) => (sourceUpdater) => {
  76420. sourceUpdater.logger_(`Setting mediaSource duration to ${duration5}`);
  76421. try {
  76422. sourceUpdater.mediaSource.duration = duration5;
  76423. } catch (e) {
  76424. videojs$2.log.warn("Failed to set media source duration", e);
  76425. }
  76426. },
  76427. abort: () => (type2, sourceUpdater) => {
  76428. if (sourceUpdater.mediaSource.readyState !== "open") {
  76429. return;
  76430. }
  76431. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76432. if (!inSourceBuffers$1(sourceUpdater.mediaSource, sourceBuffer)) {
  76433. return;
  76434. }
  76435. sourceUpdater.logger_(`calling abort on ${type2}Buffer`);
  76436. try {
  76437. sourceBuffer.abort();
  76438. } catch (e) {
  76439. videojs$2.log.warn(`Failed to abort on ${type2}Buffer`, e);
  76440. }
  76441. },
  76442. addSourceBuffer: (type2, codec) => (sourceUpdater) => {
  76443. const titleType = toTitleCase$2(type2);
  76444. const mime = getMimeForCodec$1(codec);
  76445. sourceUpdater.logger_(`Adding ${type2}Buffer with codec ${codec} to mediaSource`);
  76446. const sourceBuffer = sourceUpdater.mediaSource.addSourceBuffer(mime);
  76447. sourceBuffer.addEventListener("updateend", sourceUpdater[`on${titleType}UpdateEnd_`]);
  76448. sourceBuffer.addEventListener("error", sourceUpdater[`on${titleType}Error_`]);
  76449. sourceUpdater.codecs[type2] = codec;
  76450. sourceUpdater[`${type2}Buffer`] = sourceBuffer;
  76451. },
  76452. removeSourceBuffer: (type2) => (sourceUpdater) => {
  76453. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76454. cleanupBuffer$1(type2, sourceUpdater);
  76455. if (!inSourceBuffers$1(sourceUpdater.mediaSource, sourceBuffer)) {
  76456. return;
  76457. }
  76458. sourceUpdater.logger_(`Removing ${type2}Buffer with codec ${sourceUpdater.codecs[type2]} from mediaSource`);
  76459. try {
  76460. sourceUpdater.mediaSource.removeSourceBuffer(sourceBuffer);
  76461. } catch (e) {
  76462. videojs$2.log.warn(`Failed to removeSourceBuffer ${type2}Buffer`, e);
  76463. }
  76464. },
  76465. changeType: (codec) => (type2, sourceUpdater) => {
  76466. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76467. const mime = getMimeForCodec$1(codec);
  76468. if (!inSourceBuffers$1(sourceUpdater.mediaSource, sourceBuffer)) {
  76469. return;
  76470. }
  76471. if (sourceUpdater.codecs[type2] === codec) {
  76472. return;
  76473. }
  76474. sourceUpdater.logger_(`changing ${type2}Buffer codec from ${sourceUpdater.codecs[type2]} to ${codec}`);
  76475. sourceBuffer.changeType(mime);
  76476. sourceUpdater.codecs[type2] = codec;
  76477. }
  76478. };
  76479. const pushQueue$1 = ({
  76480. type: type2,
  76481. sourceUpdater,
  76482. action,
  76483. doneFn,
  76484. name
  76485. }) => {
  76486. sourceUpdater.queue.push({
  76487. type: type2,
  76488. action,
  76489. doneFn,
  76490. name
  76491. });
  76492. shiftQueue$1(type2, sourceUpdater);
  76493. };
  76494. const onUpdateend$1 = (type2, sourceUpdater) => (e) => {
  76495. if (sourceUpdater.queuePending[type2]) {
  76496. const doneFn = sourceUpdater.queuePending[type2].doneFn;
  76497. sourceUpdater.queuePending[type2] = null;
  76498. if (doneFn) {
  76499. doneFn(sourceUpdater[`${type2}Error_`]);
  76500. }
  76501. }
  76502. shiftQueue$1(type2, sourceUpdater);
  76503. };
  76504. class SourceUpdater$1 extends videojs$2.EventTarget {
  76505. constructor(mediaSource) {
  76506. super();
  76507. this.mediaSource = mediaSource;
  76508. this.sourceopenListener_ = () => shiftQueue$1("mediaSource", this);
  76509. this.mediaSource.addEventListener("sourceopen", this.sourceopenListener_);
  76510. this.logger_ = logger$1("SourceUpdater");
  76511. this.audioTimestampOffset_ = 0;
  76512. this.videoTimestampOffset_ = 0;
  76513. this.queue = [];
  76514. this.queuePending = {
  76515. audio: null,
  76516. video: null
  76517. };
  76518. this.delayedAudioAppendQueue_ = [];
  76519. this.videoAppendQueued_ = false;
  76520. this.codecs = {};
  76521. this.onVideoUpdateEnd_ = onUpdateend$1("video", this);
  76522. this.onAudioUpdateEnd_ = onUpdateend$1("audio", this);
  76523. this.onVideoError_ = (e) => {
  76524. this.videoError_ = e;
  76525. };
  76526. this.onAudioError_ = (e) => {
  76527. this.audioError_ = e;
  76528. };
  76529. this.createdSourceBuffers_ = false;
  76530. this.initializedEme_ = false;
  76531. this.triggeredReady_ = false;
  76532. }
  76533. initializedEme() {
  76534. this.initializedEme_ = true;
  76535. this.triggerReady();
  76536. }
  76537. hasCreatedSourceBuffers() {
  76538. return this.createdSourceBuffers_;
  76539. }
  76540. hasInitializedAnyEme() {
  76541. return this.initializedEme_;
  76542. }
  76543. ready() {
  76544. return this.hasCreatedSourceBuffers() && this.hasInitializedAnyEme();
  76545. }
  76546. createSourceBuffers(codecs) {
  76547. if (this.hasCreatedSourceBuffers()) {
  76548. return;
  76549. }
  76550. this.addOrChangeSourceBuffers(codecs);
  76551. this.createdSourceBuffers_ = true;
  76552. this.trigger("createdsourcebuffers");
  76553. this.triggerReady();
  76554. }
  76555. triggerReady() {
  76556. if (this.ready() && !this.triggeredReady_) {
  76557. this.triggeredReady_ = true;
  76558. this.trigger("ready");
  76559. }
  76560. }
  76561. addSourceBuffer(type2, codec) {
  76562. pushQueue$1({
  76563. type: "mediaSource",
  76564. sourceUpdater: this,
  76565. action: actions$1.addSourceBuffer(type2, codec),
  76566. name: "addSourceBuffer"
  76567. });
  76568. }
  76569. abort(type2) {
  76570. pushQueue$1({
  76571. type: type2,
  76572. sourceUpdater: this,
  76573. action: actions$1.abort(type2),
  76574. name: "abort"
  76575. });
  76576. }
  76577. removeSourceBuffer(type2) {
  76578. if (!this.canRemoveSourceBuffer()) {
  76579. videojs$2.log.error("removeSourceBuffer is not supported!");
  76580. return;
  76581. }
  76582. pushQueue$1({
  76583. type: "mediaSource",
  76584. sourceUpdater: this,
  76585. action: actions$1.removeSourceBuffer(type2),
  76586. name: "removeSourceBuffer"
  76587. });
  76588. }
  76589. canRemoveSourceBuffer() {
  76590. return !videojs$2.browser.IE_VERSION && !videojs$2.browser.IS_FIREFOX && window_1.MediaSource && window_1.MediaSource.prototype && typeof window_1.MediaSource.prototype.removeSourceBuffer === "function";
  76591. }
  76592. static canChangeType() {
  76593. return window_1.SourceBuffer && window_1.SourceBuffer.prototype && typeof window_1.SourceBuffer.prototype.changeType === "function";
  76594. }
  76595. canChangeType() {
  76596. return this.constructor.canChangeType();
  76597. }
  76598. changeType(type2, codec) {
  76599. if (!this.canChangeType()) {
  76600. videojs$2.log.error("changeType is not supported!");
  76601. return;
  76602. }
  76603. pushQueue$1({
  76604. type: type2,
  76605. sourceUpdater: this,
  76606. action: actions$1.changeType(codec),
  76607. name: "changeType"
  76608. });
  76609. }
  76610. addOrChangeSourceBuffers(codecs) {
  76611. if (!codecs || typeof codecs !== "object" || Object.keys(codecs).length === 0) {
  76612. throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");
  76613. }
  76614. Object.keys(codecs).forEach((type2) => {
  76615. const codec = codecs[type2];
  76616. if (!this.hasCreatedSourceBuffers()) {
  76617. return this.addSourceBuffer(type2, codec);
  76618. }
  76619. if (this.canChangeType()) {
  76620. this.changeType(type2, codec);
  76621. }
  76622. });
  76623. }
  76624. appendBuffer(options2, doneFn) {
  76625. const {
  76626. segmentInfo,
  76627. type: type2,
  76628. bytes
  76629. } = options2;
  76630. this.processedAppend_ = true;
  76631. if (type2 === "audio" && this.videoBuffer && !this.videoAppendQueued_) {
  76632. this.delayedAudioAppendQueue_.push([options2, doneFn]);
  76633. this.logger_(`delayed audio append of ${bytes.length} until video append`);
  76634. return;
  76635. }
  76636. const onError2 = doneFn;
  76637. pushQueue$1({
  76638. type: type2,
  76639. sourceUpdater: this,
  76640. action: actions$1.appendBuffer(bytes, segmentInfo || {
  76641. mediaIndex: -1
  76642. }, onError2),
  76643. doneFn,
  76644. name: "appendBuffer"
  76645. });
  76646. if (type2 === "video") {
  76647. this.videoAppendQueued_ = true;
  76648. if (!this.delayedAudioAppendQueue_.length) {
  76649. return;
  76650. }
  76651. const queue = this.delayedAudioAppendQueue_.slice();
  76652. this.logger_(`queuing delayed audio ${queue.length} appendBuffers`);
  76653. this.delayedAudioAppendQueue_.length = 0;
  76654. queue.forEach((que) => {
  76655. this.appendBuffer.apply(this, que);
  76656. });
  76657. }
  76658. }
  76659. audioBuffered() {
  76660. if (!inSourceBuffers$1(this.mediaSource, this.audioBuffer)) {
  76661. return createTimeRanges$2();
  76662. }
  76663. return this.audioBuffer.buffered ? this.audioBuffer.buffered : createTimeRanges$2();
  76664. }
  76665. videoBuffered() {
  76666. if (!inSourceBuffers$1(this.mediaSource, this.videoBuffer)) {
  76667. return createTimeRanges$2();
  76668. }
  76669. return this.videoBuffer.buffered ? this.videoBuffer.buffered : createTimeRanges$2();
  76670. }
  76671. buffered() {
  76672. const video = inSourceBuffers$1(this.mediaSource, this.videoBuffer) ? this.videoBuffer : null;
  76673. const audio = inSourceBuffers$1(this.mediaSource, this.audioBuffer) ? this.audioBuffer : null;
  76674. if (audio && !video) {
  76675. return this.audioBuffered();
  76676. }
  76677. if (video && !audio) {
  76678. return this.videoBuffered();
  76679. }
  76680. return bufferIntersection$1(this.audioBuffered(), this.videoBuffered());
  76681. }
  76682. setDuration(duration5, doneFn = noop$1) {
  76683. pushQueue$1({
  76684. type: "mediaSource",
  76685. sourceUpdater: this,
  76686. action: actions$1.duration(duration5),
  76687. name: "duration",
  76688. doneFn
  76689. });
  76690. }
  76691. endOfStream(error = null, doneFn = noop$1) {
  76692. if (typeof error !== "string") {
  76693. error = void 0;
  76694. }
  76695. pushQueue$1({
  76696. type: "mediaSource",
  76697. sourceUpdater: this,
  76698. action: actions$1.endOfStream(error),
  76699. name: "endOfStream",
  76700. doneFn
  76701. });
  76702. }
  76703. removeAudio(start2, end, done = noop$1) {
  76704. if (!this.audioBuffered().length || this.audioBuffered().end(0) === 0) {
  76705. done();
  76706. return;
  76707. }
  76708. pushQueue$1({
  76709. type: "audio",
  76710. sourceUpdater: this,
  76711. action: actions$1.remove(start2, end),
  76712. doneFn: done,
  76713. name: "remove"
  76714. });
  76715. }
  76716. removeVideo(start2, end, done = noop$1) {
  76717. if (!this.videoBuffered().length || this.videoBuffered().end(0) === 0) {
  76718. done();
  76719. return;
  76720. }
  76721. pushQueue$1({
  76722. type: "video",
  76723. sourceUpdater: this,
  76724. action: actions$1.remove(start2, end),
  76725. doneFn: done,
  76726. name: "remove"
  76727. });
  76728. }
  76729. updating() {
  76730. if (updating("audio", this) || updating("video", this)) {
  76731. return true;
  76732. }
  76733. return false;
  76734. }
  76735. audioTimestampOffset(offset) {
  76736. if (typeof offset !== "undefined" && this.audioBuffer && this.audioTimestampOffset_ !== offset) {
  76737. pushQueue$1({
  76738. type: "audio",
  76739. sourceUpdater: this,
  76740. action: actions$1.timestampOffset(offset),
  76741. name: "timestampOffset"
  76742. });
  76743. this.audioTimestampOffset_ = offset;
  76744. }
  76745. return this.audioTimestampOffset_;
  76746. }
  76747. videoTimestampOffset(offset) {
  76748. if (typeof offset !== "undefined" && this.videoBuffer && this.videoTimestampOffset !== offset) {
  76749. pushQueue$1({
  76750. type: "video",
  76751. sourceUpdater: this,
  76752. action: actions$1.timestampOffset(offset),
  76753. name: "timestampOffset"
  76754. });
  76755. this.videoTimestampOffset_ = offset;
  76756. }
  76757. return this.videoTimestampOffset_;
  76758. }
  76759. audioQueueCallback(callback2) {
  76760. if (!this.audioBuffer) {
  76761. return;
  76762. }
  76763. pushQueue$1({
  76764. type: "audio",
  76765. sourceUpdater: this,
  76766. action: actions$1.callback(callback2),
  76767. name: "callback"
  76768. });
  76769. }
  76770. videoQueueCallback(callback2) {
  76771. if (!this.videoBuffer) {
  76772. return;
  76773. }
  76774. pushQueue$1({
  76775. type: "video",
  76776. sourceUpdater: this,
  76777. action: actions$1.callback(callback2),
  76778. name: "callback"
  76779. });
  76780. }
  76781. dispose() {
  76782. this.trigger("dispose");
  76783. bufferTypes$1.forEach((type2) => {
  76784. this.abort(type2);
  76785. if (this.canRemoveSourceBuffer()) {
  76786. this.removeSourceBuffer(type2);
  76787. } else {
  76788. this[`${type2}QueueCallback`](() => cleanupBuffer$1(type2, this));
  76789. }
  76790. });
  76791. this.videoAppendQueued_ = false;
  76792. this.delayedAudioAppendQueue_.length = 0;
  76793. if (this.sourceopenListener_) {
  76794. this.mediaSource.removeEventListener("sourceopen", this.sourceopenListener_);
  76795. }
  76796. this.off();
  76797. }
  76798. }
  76799. const uint8ToUtf8$1 = (uintArray) => decodeURIComponent(escape(String.fromCharCode.apply(null, uintArray)));
  76800. const VTT_LINE_TERMINATORS$1 = new Uint8Array("\n\n".split("").map((char) => char.charCodeAt(0)));
  76801. class NoVttJsError$1 extends Error {
  76802. constructor() {
  76803. super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.");
  76804. }
  76805. }
  76806. class VTTSegmentLoader$1 extends SegmentLoader$1 {
  76807. constructor(settings, options2 = {}) {
  76808. super(settings, options2);
  76809. this.mediaSource_ = null;
  76810. this.subtitlesTrack_ = null;
  76811. this.loaderType_ = "subtitle";
  76812. this.featuresNativeTextTracks_ = settings.featuresNativeTextTracks;
  76813. this.loadVttJs = settings.loadVttJs;
  76814. this.shouldSaveSegmentTimingInfo_ = false;
  76815. }
  76816. createTransmuxer_() {
  76817. return null;
  76818. }
  76819. buffered_() {
  76820. if (!this.subtitlesTrack_ || !this.subtitlesTrack_.cues || !this.subtitlesTrack_.cues.length) {
  76821. return createTimeRanges$2();
  76822. }
  76823. const cues = this.subtitlesTrack_.cues;
  76824. const start2 = cues[0].startTime;
  76825. const end = cues[cues.length - 1].startTime;
  76826. return createTimeRanges$2([[start2, end]]);
  76827. }
  76828. initSegmentForMap(map, set4 = false) {
  76829. if (!map) {
  76830. return null;
  76831. }
  76832. const id = initSegmentId$1(map);
  76833. let storedMap = this.initSegments_[id];
  76834. if (set4 && !storedMap && map.bytes) {
  76835. const combinedByteLength = VTT_LINE_TERMINATORS$1.byteLength + map.bytes.byteLength;
  76836. const combinedSegment = new Uint8Array(combinedByteLength);
  76837. combinedSegment.set(map.bytes);
  76838. combinedSegment.set(VTT_LINE_TERMINATORS$1, map.bytes.byteLength);
  76839. this.initSegments_[id] = storedMap = {
  76840. resolvedUri: map.resolvedUri,
  76841. byterange: map.byterange,
  76842. bytes: combinedSegment
  76843. };
  76844. }
  76845. return storedMap || map;
  76846. }
  76847. couldBeginLoading_() {
  76848. return this.playlist_ && this.subtitlesTrack_ && !this.paused();
  76849. }
  76850. init_() {
  76851. this.state = "READY";
  76852. this.resetEverything();
  76853. return this.monitorBuffer_();
  76854. }
  76855. track(track) {
  76856. if (typeof track === "undefined") {
  76857. return this.subtitlesTrack_;
  76858. }
  76859. this.subtitlesTrack_ = track;
  76860. if (this.state === "INIT" && this.couldBeginLoading_()) {
  76861. this.init_();
  76862. }
  76863. return this.subtitlesTrack_;
  76864. }
  76865. remove(start2, end) {
  76866. removeCuesFromTrack$1(start2, end, this.subtitlesTrack_);
  76867. }
  76868. fillBuffer_() {
  76869. const segmentInfo = this.chooseNextRequest_();
  76870. if (!segmentInfo) {
  76871. return;
  76872. }
  76873. if (this.syncController_.timestampOffsetForTimeline(segmentInfo.timeline) === null) {
  76874. const checkTimestampOffset = () => {
  76875. this.state = "READY";
  76876. if (!this.paused()) {
  76877. this.monitorBuffer_();
  76878. }
  76879. };
  76880. this.syncController_.one("timestampoffset", checkTimestampOffset);
  76881. this.state = "WAITING_ON_TIMELINE";
  76882. return;
  76883. }
  76884. this.loadSegment_(segmentInfo);
  76885. }
  76886. timestampOffsetForSegment_() {
  76887. return null;
  76888. }
  76889. chooseNextRequest_() {
  76890. return this.skipEmptySegments_(super.chooseNextRequest_());
  76891. }
  76892. skipEmptySegments_(segmentInfo) {
  76893. while (segmentInfo && segmentInfo.segment.empty) {
  76894. if (segmentInfo.mediaIndex + 1 >= segmentInfo.playlist.segments.length) {
  76895. segmentInfo = null;
  76896. break;
  76897. }
  76898. segmentInfo = this.generateSegmentInfo_({
  76899. playlist: segmentInfo.playlist,
  76900. mediaIndex: segmentInfo.mediaIndex + 1,
  76901. startOfSegment: segmentInfo.startOfSegment + segmentInfo.duration,
  76902. isSyncRequest: segmentInfo.isSyncRequest
  76903. });
  76904. }
  76905. return segmentInfo;
  76906. }
  76907. stopForError(error) {
  76908. this.error(error);
  76909. this.state = "READY";
  76910. this.pause();
  76911. this.trigger("error");
  76912. }
  76913. segmentRequestFinished_(error, simpleSegment, result) {
  76914. if (!this.subtitlesTrack_) {
  76915. this.state = "READY";
  76916. return;
  76917. }
  76918. this.saveTransferStats_(simpleSegment.stats);
  76919. if (!this.pendingSegment_) {
  76920. this.state = "READY";
  76921. this.mediaRequestsAborted += 1;
  76922. return;
  76923. }
  76924. if (error) {
  76925. if (error.code === REQUEST_ERRORS$1.TIMEOUT) {
  76926. this.handleTimeout_();
  76927. }
  76928. if (error.code === REQUEST_ERRORS$1.ABORTED) {
  76929. this.mediaRequestsAborted += 1;
  76930. } else {
  76931. this.mediaRequestsErrored += 1;
  76932. }
  76933. this.stopForError(error);
  76934. return;
  76935. }
  76936. const segmentInfo = this.pendingSegment_;
  76937. this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats);
  76938. if (simpleSegment.key) {
  76939. this.segmentKey(simpleSegment.key, true);
  76940. }
  76941. this.state = "APPENDING";
  76942. this.trigger("appending");
  76943. const segment = segmentInfo.segment;
  76944. if (segment.map) {
  76945. segment.map.bytes = simpleSegment.map.bytes;
  76946. }
  76947. segmentInfo.bytes = simpleSegment.bytes;
  76948. if (typeof window_1.WebVTT !== "function" && typeof this.loadVttJs === "function") {
  76949. this.state = "WAITING_ON_VTTJS";
  76950. this.loadVttJs().then(() => this.segmentRequestFinished_(error, simpleSegment, result), () => this.stopForError({
  76951. message: "Error loading vtt.js"
  76952. }));
  76953. return;
  76954. }
  76955. segment.requested = true;
  76956. try {
  76957. this.parseVTTCues_(segmentInfo);
  76958. } catch (e) {
  76959. this.stopForError({
  76960. message: e.message
  76961. });
  76962. return;
  76963. }
  76964. this.updateTimeMapping_(segmentInfo, this.syncController_.timelines[segmentInfo.timeline], this.playlist_);
  76965. if (segmentInfo.cues.length) {
  76966. segmentInfo.timingInfo = {
  76967. start: segmentInfo.cues[0].startTime,
  76968. end: segmentInfo.cues[segmentInfo.cues.length - 1].endTime
  76969. };
  76970. } else {
  76971. segmentInfo.timingInfo = {
  76972. start: segmentInfo.startOfSegment,
  76973. end: segmentInfo.startOfSegment + segmentInfo.duration
  76974. };
  76975. }
  76976. if (segmentInfo.isSyncRequest) {
  76977. this.trigger("syncinfoupdate");
  76978. this.pendingSegment_ = null;
  76979. this.state = "READY";
  76980. return;
  76981. }
  76982. segmentInfo.byteLength = segmentInfo.bytes.byteLength;
  76983. this.mediaSecondsLoaded += segment.duration;
  76984. segmentInfo.cues.forEach((cue) => {
  76985. this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_ ? new window_1.VTTCue(cue.startTime, cue.endTime, cue.text) : cue);
  76986. });
  76987. removeDuplicateCuesFromTrack$1(this.subtitlesTrack_);
  76988. this.handleAppendsDone_();
  76989. }
  76990. handleData_() {
  76991. }
  76992. updateTimingInfoEnd_() {
  76993. }
  76994. parseVTTCues_(segmentInfo) {
  76995. let decoder;
  76996. let decodeBytesToString = false;
  76997. if (typeof window_1.WebVTT !== "function") {
  76998. throw new NoVttJsError$1();
  76999. }
  77000. if (typeof window_1.TextDecoder === "function") {
  77001. decoder = new window_1.TextDecoder("utf8");
  77002. } else {
  77003. decoder = window_1.WebVTT.StringDecoder();
  77004. decodeBytesToString = true;
  77005. }
  77006. const parser2 = new window_1.WebVTT.Parser(window_1, window_1.vttjs, decoder);
  77007. segmentInfo.cues = [];
  77008. segmentInfo.timestampmap = {
  77009. MPEGTS: 0,
  77010. LOCAL: 0
  77011. };
  77012. parser2.oncue = segmentInfo.cues.push.bind(segmentInfo.cues);
  77013. parser2.ontimestampmap = (map) => {
  77014. segmentInfo.timestampmap = map;
  77015. };
  77016. parser2.onparsingerror = (error) => {
  77017. videojs$2.log.warn("Error encountered when parsing cues: " + error.message);
  77018. };
  77019. if (segmentInfo.segment.map) {
  77020. let mapData = segmentInfo.segment.map.bytes;
  77021. if (decodeBytesToString) {
  77022. mapData = uint8ToUtf8$1(mapData);
  77023. }
  77024. parser2.parse(mapData);
  77025. }
  77026. let segmentData = segmentInfo.bytes;
  77027. if (decodeBytesToString) {
  77028. segmentData = uint8ToUtf8$1(segmentData);
  77029. }
  77030. parser2.parse(segmentData);
  77031. parser2.flush();
  77032. }
  77033. updateTimeMapping_(segmentInfo, mappingObj, playlist) {
  77034. const segment = segmentInfo.segment;
  77035. if (!mappingObj) {
  77036. return;
  77037. }
  77038. if (!segmentInfo.cues.length) {
  77039. segment.empty = true;
  77040. return;
  77041. }
  77042. const timestampmap = segmentInfo.timestampmap;
  77043. const diff = timestampmap.MPEGTS / clock$1.ONE_SECOND_IN_TS - timestampmap.LOCAL + mappingObj.mapping;
  77044. segmentInfo.cues.forEach((cue) => {
  77045. cue.startTime += diff;
  77046. cue.endTime += diff;
  77047. });
  77048. if (!playlist.syncInfo) {
  77049. const firstStart = segmentInfo.cues[0].startTime;
  77050. const lastStart = segmentInfo.cues[segmentInfo.cues.length - 1].startTime;
  77051. playlist.syncInfo = {
  77052. mediaSequence: playlist.mediaSequence + segmentInfo.mediaIndex,
  77053. time: Math.min(firstStart, lastStart - segment.duration)
  77054. };
  77055. }
  77056. }
  77057. }
  77058. const findAdCue$1 = function(track, mediaTime) {
  77059. const cues = track.cues;
  77060. for (let i2 = 0; i2 < cues.length; i2++) {
  77061. const cue = cues[i2];
  77062. if (mediaTime >= cue.adStartTime && mediaTime <= cue.adEndTime) {
  77063. return cue;
  77064. }
  77065. }
  77066. return null;
  77067. };
  77068. const updateAdCues$1 = function(media, track, offset = 0) {
  77069. if (!media.segments) {
  77070. return;
  77071. }
  77072. let mediaTime = offset;
  77073. let cue;
  77074. for (let i2 = 0; i2 < media.segments.length; i2++) {
  77075. const segment = media.segments[i2];
  77076. if (!cue) {
  77077. cue = findAdCue$1(track, mediaTime + segment.duration / 2);
  77078. }
  77079. if (cue) {
  77080. if ("cueIn" in segment) {
  77081. cue.endTime = mediaTime;
  77082. cue.adEndTime = mediaTime;
  77083. mediaTime += segment.duration;
  77084. cue = null;
  77085. continue;
  77086. }
  77087. if (mediaTime < cue.endTime) {
  77088. mediaTime += segment.duration;
  77089. continue;
  77090. }
  77091. cue.endTime += segment.duration;
  77092. } else {
  77093. if ("cueOut" in segment) {
  77094. cue = new window_1.VTTCue(mediaTime, mediaTime + segment.duration, segment.cueOut);
  77095. cue.adStartTime = mediaTime;
  77096. cue.adEndTime = mediaTime + parseFloat(segment.cueOut);
  77097. track.addCue(cue);
  77098. }
  77099. if ("cueOutCont" in segment) {
  77100. const [adOffset, adTotal] = segment.cueOutCont.split("/").map(parseFloat);
  77101. cue = new window_1.VTTCue(mediaTime, mediaTime + segment.duration, "");
  77102. cue.adStartTime = mediaTime - adOffset;
  77103. cue.adEndTime = cue.adStartTime + adTotal;
  77104. track.addCue(cue);
  77105. }
  77106. }
  77107. mediaTime += segment.duration;
  77108. }
  77109. };
  77110. const MAX_MEDIA_SEQUENCE_DIFF_FOR_SYNC$1 = 86400;
  77111. const syncPointStrategies$1 = [
  77112. {
  77113. name: "VOD",
  77114. run: (syncController, playlist, duration5, currentTimeline, currentTime) => {
  77115. if (duration5 !== Infinity) {
  77116. const syncPoint = {
  77117. time: 0,
  77118. segmentIndex: 0,
  77119. partIndex: null
  77120. };
  77121. return syncPoint;
  77122. }
  77123. return null;
  77124. }
  77125. },
  77126. {
  77127. name: "ProgramDateTime",
  77128. run: (syncController, playlist, duration5, currentTimeline, currentTime) => {
  77129. if (!Object.keys(syncController.timelineToDatetimeMappings).length) {
  77130. return null;
  77131. }
  77132. let syncPoint = null;
  77133. let lastDistance = null;
  77134. const partsAndSegments = getPartsAndSegments$1(playlist);
  77135. currentTime = currentTime || 0;
  77136. for (let i2 = 0; i2 < partsAndSegments.length; i2++) {
  77137. const index2 = playlist.endList || currentTime === 0 ? i2 : partsAndSegments.length - (i2 + 1);
  77138. const partAndSegment = partsAndSegments[index2];
  77139. const segment = partAndSegment.segment;
  77140. const datetimeMapping = syncController.timelineToDatetimeMappings[segment.timeline];
  77141. if (!datetimeMapping || !segment.dateTimeObject) {
  77142. continue;
  77143. }
  77144. const segmentTime = segment.dateTimeObject.getTime() / 1e3;
  77145. let start2 = segmentTime + datetimeMapping;
  77146. if (segment.parts && typeof partAndSegment.partIndex === "number") {
  77147. for (let z = 0; z < partAndSegment.partIndex; z++) {
  77148. start2 += segment.parts[z].duration;
  77149. }
  77150. }
  77151. const distance2 = Math.abs(currentTime - start2);
  77152. if (lastDistance !== null && (distance2 === 0 || lastDistance < distance2)) {
  77153. break;
  77154. }
  77155. lastDistance = distance2;
  77156. syncPoint = {
  77157. time: start2,
  77158. segmentIndex: partAndSegment.segmentIndex,
  77159. partIndex: partAndSegment.partIndex
  77160. };
  77161. }
  77162. return syncPoint;
  77163. }
  77164. },
  77165. {
  77166. name: "Segment",
  77167. run: (syncController, playlist, duration5, currentTimeline, currentTime) => {
  77168. let syncPoint = null;
  77169. let lastDistance = null;
  77170. currentTime = currentTime || 0;
  77171. const partsAndSegments = getPartsAndSegments$1(playlist);
  77172. for (let i2 = 0; i2 < partsAndSegments.length; i2++) {
  77173. const index2 = playlist.endList || currentTime === 0 ? i2 : partsAndSegments.length - (i2 + 1);
  77174. const partAndSegment = partsAndSegments[index2];
  77175. const segment = partAndSegment.segment;
  77176. const start2 = partAndSegment.part && partAndSegment.part.start || segment && segment.start;
  77177. if (segment.timeline === currentTimeline && typeof start2 !== "undefined") {
  77178. const distance2 = Math.abs(currentTime - start2);
  77179. if (lastDistance !== null && lastDistance < distance2) {
  77180. break;
  77181. }
  77182. if (!syncPoint || lastDistance === null || lastDistance >= distance2) {
  77183. lastDistance = distance2;
  77184. syncPoint = {
  77185. time: start2,
  77186. segmentIndex: partAndSegment.segmentIndex,
  77187. partIndex: partAndSegment.partIndex
  77188. };
  77189. }
  77190. }
  77191. }
  77192. return syncPoint;
  77193. }
  77194. },
  77195. {
  77196. name: "Discontinuity",
  77197. run: (syncController, playlist, duration5, currentTimeline, currentTime) => {
  77198. let syncPoint = null;
  77199. currentTime = currentTime || 0;
  77200. if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) {
  77201. let lastDistance = null;
  77202. for (let i2 = 0; i2 < playlist.discontinuityStarts.length; i2++) {
  77203. const segmentIndex = playlist.discontinuityStarts[i2];
  77204. const discontinuity = playlist.discontinuitySequence + i2 + 1;
  77205. const discontinuitySync = syncController.discontinuities[discontinuity];
  77206. if (discontinuitySync) {
  77207. const distance2 = Math.abs(currentTime - discontinuitySync.time);
  77208. if (lastDistance !== null && lastDistance < distance2) {
  77209. break;
  77210. }
  77211. if (!syncPoint || lastDistance === null || lastDistance >= distance2) {
  77212. lastDistance = distance2;
  77213. syncPoint = {
  77214. time: discontinuitySync.time,
  77215. segmentIndex,
  77216. partIndex: null
  77217. };
  77218. }
  77219. }
  77220. }
  77221. }
  77222. return syncPoint;
  77223. }
  77224. },
  77225. {
  77226. name: "Playlist",
  77227. run: (syncController, playlist, duration5, currentTimeline, currentTime) => {
  77228. if (playlist.syncInfo) {
  77229. const syncPoint = {
  77230. time: playlist.syncInfo.time,
  77231. segmentIndex: playlist.syncInfo.mediaSequence - playlist.mediaSequence,
  77232. partIndex: null
  77233. };
  77234. return syncPoint;
  77235. }
  77236. return null;
  77237. }
  77238. }
  77239. ];
  77240. class SyncController$1 extends videojs$2.EventTarget {
  77241. constructor(options2 = {}) {
  77242. super();
  77243. this.timelines = [];
  77244. this.discontinuities = [];
  77245. this.timelineToDatetimeMappings = {};
  77246. this.logger_ = logger$1("SyncController");
  77247. }
  77248. getSyncPoint(playlist, duration5, currentTimeline, currentTime) {
  77249. const syncPoints = this.runStrategies_(playlist, duration5, currentTimeline, currentTime);
  77250. if (!syncPoints.length) {
  77251. return null;
  77252. }
  77253. return this.selectSyncPoint_(syncPoints, {
  77254. key: "time",
  77255. value: currentTime
  77256. });
  77257. }
  77258. getExpiredTime(playlist, duration5) {
  77259. if (!playlist || !playlist.segments) {
  77260. return null;
  77261. }
  77262. const syncPoints = this.runStrategies_(playlist, duration5, playlist.discontinuitySequence, 0);
  77263. if (!syncPoints.length) {
  77264. return null;
  77265. }
  77266. const syncPoint = this.selectSyncPoint_(syncPoints, {
  77267. key: "segmentIndex",
  77268. value: 0
  77269. });
  77270. if (syncPoint.segmentIndex > 0) {
  77271. syncPoint.time *= -1;
  77272. }
  77273. return Math.abs(syncPoint.time + sumDurations$1({
  77274. defaultDuration: playlist.targetDuration,
  77275. durationList: playlist.segments,
  77276. startIndex: syncPoint.segmentIndex,
  77277. endIndex: 0
  77278. }));
  77279. }
  77280. runStrategies_(playlist, duration5, currentTimeline, currentTime) {
  77281. const syncPoints = [];
  77282. for (let i2 = 0; i2 < syncPointStrategies$1.length; i2++) {
  77283. const strategy = syncPointStrategies$1[i2];
  77284. const syncPoint = strategy.run(this, playlist, duration5, currentTimeline, currentTime);
  77285. if (syncPoint) {
  77286. syncPoint.strategy = strategy.name;
  77287. syncPoints.push({
  77288. strategy: strategy.name,
  77289. syncPoint
  77290. });
  77291. }
  77292. }
  77293. return syncPoints;
  77294. }
  77295. selectSyncPoint_(syncPoints, target) {
  77296. let bestSyncPoint = syncPoints[0].syncPoint;
  77297. let bestDistance = Math.abs(syncPoints[0].syncPoint[target.key] - target.value);
  77298. let bestStrategy = syncPoints[0].strategy;
  77299. for (let i2 = 1; i2 < syncPoints.length; i2++) {
  77300. const newDistance = Math.abs(syncPoints[i2].syncPoint[target.key] - target.value);
  77301. if (newDistance < bestDistance) {
  77302. bestDistance = newDistance;
  77303. bestSyncPoint = syncPoints[i2].syncPoint;
  77304. bestStrategy = syncPoints[i2].strategy;
  77305. }
  77306. }
  77307. this.logger_(`syncPoint for [${target.key}: ${target.value}] chosen with strategy [${bestStrategy}]: [time:${bestSyncPoint.time}, segmentIndex:${bestSyncPoint.segmentIndex}` + (typeof bestSyncPoint.partIndex === "number" ? `,partIndex:${bestSyncPoint.partIndex}` : "") + "]");
  77308. return bestSyncPoint;
  77309. }
  77310. saveExpiredSegmentInfo(oldPlaylist, newPlaylist) {
  77311. const mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence;
  77312. if (mediaSequenceDiff > MAX_MEDIA_SEQUENCE_DIFF_FOR_SYNC$1) {
  77313. videojs$2.log.warn(`Not saving expired segment info. Media sequence gap ${mediaSequenceDiff} is too large.`);
  77314. return;
  77315. }
  77316. for (let i2 = mediaSequenceDiff - 1; i2 >= 0; i2--) {
  77317. const lastRemovedSegment = oldPlaylist.segments[i2];
  77318. if (lastRemovedSegment && typeof lastRemovedSegment.start !== "undefined") {
  77319. newPlaylist.syncInfo = {
  77320. mediaSequence: oldPlaylist.mediaSequence + i2,
  77321. time: lastRemovedSegment.start
  77322. };
  77323. this.logger_(`playlist refresh sync: [time:${newPlaylist.syncInfo.time}, mediaSequence: ${newPlaylist.syncInfo.mediaSequence}]`);
  77324. this.trigger("syncinfoupdate");
  77325. break;
  77326. }
  77327. }
  77328. }
  77329. setDateTimeMappingForStart(playlist) {
  77330. this.timelineToDatetimeMappings = {};
  77331. if (playlist.segments && playlist.segments.length && playlist.segments[0].dateTimeObject) {
  77332. const firstSegment = playlist.segments[0];
  77333. const playlistTimestamp = firstSegment.dateTimeObject.getTime() / 1e3;
  77334. this.timelineToDatetimeMappings[firstSegment.timeline] = -playlistTimestamp;
  77335. }
  77336. }
  77337. saveSegmentTimingInfo({
  77338. segmentInfo,
  77339. shouldSaveTimelineMapping
  77340. }) {
  77341. const didCalculateSegmentTimeMapping = this.calculateSegmentTimeMapping_(segmentInfo, segmentInfo.timingInfo, shouldSaveTimelineMapping);
  77342. const segment = segmentInfo.segment;
  77343. if (didCalculateSegmentTimeMapping) {
  77344. this.saveDiscontinuitySyncInfo_(segmentInfo);
  77345. if (!segmentInfo.playlist.syncInfo) {
  77346. segmentInfo.playlist.syncInfo = {
  77347. mediaSequence: segmentInfo.playlist.mediaSequence + segmentInfo.mediaIndex,
  77348. time: segment.start
  77349. };
  77350. }
  77351. }
  77352. const dateTime = segment.dateTimeObject;
  77353. if (segment.discontinuity && shouldSaveTimelineMapping && dateTime) {
  77354. this.timelineToDatetimeMappings[segment.timeline] = -(dateTime.getTime() / 1e3);
  77355. }
  77356. }
  77357. timestampOffsetForTimeline(timeline) {
  77358. if (typeof this.timelines[timeline] === "undefined") {
  77359. return null;
  77360. }
  77361. return this.timelines[timeline].time;
  77362. }
  77363. mappingForTimeline(timeline) {
  77364. if (typeof this.timelines[timeline] === "undefined") {
  77365. return null;
  77366. }
  77367. return this.timelines[timeline].mapping;
  77368. }
  77369. calculateSegmentTimeMapping_(segmentInfo, timingInfo, shouldSaveTimelineMapping) {
  77370. const segment = segmentInfo.segment;
  77371. const part = segmentInfo.part;
  77372. let mappingObj = this.timelines[segmentInfo.timeline];
  77373. let start2;
  77374. let end;
  77375. if (typeof segmentInfo.timestampOffset === "number") {
  77376. mappingObj = {
  77377. time: segmentInfo.startOfSegment,
  77378. mapping: segmentInfo.startOfSegment - timingInfo.start
  77379. };
  77380. if (shouldSaveTimelineMapping) {
  77381. this.timelines[segmentInfo.timeline] = mappingObj;
  77382. this.trigger("timestampoffset");
  77383. this.logger_(`time mapping for timeline ${segmentInfo.timeline}: [time: ${mappingObj.time}] [mapping: ${mappingObj.mapping}]`);
  77384. }
  77385. start2 = segmentInfo.startOfSegment;
  77386. end = timingInfo.end + mappingObj.mapping;
  77387. } else if (mappingObj) {
  77388. start2 = timingInfo.start + mappingObj.mapping;
  77389. end = timingInfo.end + mappingObj.mapping;
  77390. } else {
  77391. return false;
  77392. }
  77393. if (part) {
  77394. part.start = start2;
  77395. part.end = end;
  77396. }
  77397. if (!segment.start || start2 < segment.start) {
  77398. segment.start = start2;
  77399. }
  77400. segment.end = end;
  77401. return true;
  77402. }
  77403. saveDiscontinuitySyncInfo_(segmentInfo) {
  77404. const playlist = segmentInfo.playlist;
  77405. const segment = segmentInfo.segment;
  77406. if (segment.discontinuity) {
  77407. this.discontinuities[segment.timeline] = {
  77408. time: segment.start,
  77409. accuracy: 0
  77410. };
  77411. } else if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) {
  77412. for (let i2 = 0; i2 < playlist.discontinuityStarts.length; i2++) {
  77413. const segmentIndex = playlist.discontinuityStarts[i2];
  77414. const discontinuity = playlist.discontinuitySequence + i2 + 1;
  77415. const mediaIndexDiff = segmentIndex - segmentInfo.mediaIndex;
  77416. const accuracy = Math.abs(mediaIndexDiff);
  77417. if (!this.discontinuities[discontinuity] || this.discontinuities[discontinuity].accuracy > accuracy) {
  77418. let time;
  77419. if (mediaIndexDiff < 0) {
  77420. time = segment.start - sumDurations$1({
  77421. defaultDuration: playlist.targetDuration,
  77422. durationList: playlist.segments,
  77423. startIndex: segmentInfo.mediaIndex,
  77424. endIndex: segmentIndex
  77425. });
  77426. } else {
  77427. time = segment.end + sumDurations$1({
  77428. defaultDuration: playlist.targetDuration,
  77429. durationList: playlist.segments,
  77430. startIndex: segmentInfo.mediaIndex + 1,
  77431. endIndex: segmentIndex
  77432. });
  77433. }
  77434. this.discontinuities[discontinuity] = {
  77435. time,
  77436. accuracy
  77437. };
  77438. }
  77439. }
  77440. }
  77441. }
  77442. dispose() {
  77443. this.trigger("dispose");
  77444. this.off();
  77445. }
  77446. }
  77447. class TimelineChangeController$1 extends videojs$2.EventTarget {
  77448. constructor() {
  77449. super();
  77450. this.pendingTimelineChanges_ = {};
  77451. this.lastTimelineChanges_ = {};
  77452. }
  77453. clearPendingTimelineChange(type2) {
  77454. this.pendingTimelineChanges_[type2] = null;
  77455. this.trigger("pendingtimelinechange");
  77456. }
  77457. pendingTimelineChange({
  77458. type: type2,
  77459. from: from3,
  77460. to
  77461. }) {
  77462. if (typeof from3 === "number" && typeof to === "number") {
  77463. this.pendingTimelineChanges_[type2] = {
  77464. type: type2,
  77465. from: from3,
  77466. to
  77467. };
  77468. this.trigger("pendingtimelinechange");
  77469. }
  77470. return this.pendingTimelineChanges_[type2];
  77471. }
  77472. lastTimelineChange({
  77473. type: type2,
  77474. from: from3,
  77475. to
  77476. }) {
  77477. if (typeof from3 === "number" && typeof to === "number") {
  77478. this.lastTimelineChanges_[type2] = {
  77479. type: type2,
  77480. from: from3,
  77481. to
  77482. };
  77483. delete this.pendingTimelineChanges_[type2];
  77484. this.trigger("timelinechange");
  77485. }
  77486. return this.lastTimelineChanges_[type2];
  77487. }
  77488. dispose() {
  77489. this.trigger("dispose");
  77490. this.pendingTimelineChanges_ = {};
  77491. this.lastTimelineChanges_ = {};
  77492. this.off();
  77493. }
  77494. }
  77495. const workerCode$2 = transform$1(getWorkerString$1(function() {
  77496. var Stream2 = /* @__PURE__ */ function() {
  77497. function Stream3() {
  77498. this.listeners = {};
  77499. }
  77500. var _proto = Stream3.prototype;
  77501. _proto.on = function on3(type2, listener) {
  77502. if (!this.listeners[type2]) {
  77503. this.listeners[type2] = [];
  77504. }
  77505. this.listeners[type2].push(listener);
  77506. };
  77507. _proto.off = function off2(type2, listener) {
  77508. if (!this.listeners[type2]) {
  77509. return false;
  77510. }
  77511. var index2 = this.listeners[type2].indexOf(listener);
  77512. this.listeners[type2] = this.listeners[type2].slice(0);
  77513. this.listeners[type2].splice(index2, 1);
  77514. return index2 > -1;
  77515. };
  77516. _proto.trigger = function trigger2(type2) {
  77517. var callbacks = this.listeners[type2];
  77518. if (!callbacks) {
  77519. return;
  77520. }
  77521. if (arguments.length === 2) {
  77522. var length = callbacks.length;
  77523. for (var i2 = 0; i2 < length; ++i2) {
  77524. callbacks[i2].call(this, arguments[1]);
  77525. }
  77526. } else {
  77527. var args = Array.prototype.slice.call(arguments, 1);
  77528. var _length = callbacks.length;
  77529. for (var _i = 0; _i < _length; ++_i) {
  77530. callbacks[_i].apply(this, args);
  77531. }
  77532. }
  77533. };
  77534. _proto.dispose = function dispose() {
  77535. this.listeners = {};
  77536. };
  77537. _proto.pipe = function pipe(destination2) {
  77538. this.on("data", function(data) {
  77539. destination2.push(data);
  77540. });
  77541. };
  77542. return Stream3;
  77543. }();
  77544. /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */
  77545. function unpad(padded) {
  77546. return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]);
  77547. }
  77548. /*! @name aes-decrypter @version 4.0.1 @license Apache-2.0 */
  77549. const precompute = function() {
  77550. const tables = [[[], [], [], [], []], [[], [], [], [], []]];
  77551. const encTable = tables[0];
  77552. const decTable = tables[1];
  77553. const sbox = encTable[4];
  77554. const sboxInv = decTable[4];
  77555. let i2;
  77556. let x;
  77557. let xInv;
  77558. const d2 = [];
  77559. const th = [];
  77560. let x2;
  77561. let x4;
  77562. let x8;
  77563. let s;
  77564. let tEnc;
  77565. let tDec;
  77566. for (i2 = 0; i2 < 256; i2++) {
  77567. th[(d2[i2] = i2 << 1 ^ (i2 >> 7) * 283) ^ i2] = i2;
  77568. }
  77569. for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) {
  77570. s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4;
  77571. s = s >> 8 ^ s & 255 ^ 99;
  77572. sbox[x] = s;
  77573. sboxInv[s] = x;
  77574. x8 = d2[x4 = d2[x2 = d2[x]]];
  77575. tDec = x8 * 16843009 ^ x4 * 65537 ^ x2 * 257 ^ x * 16843008;
  77576. tEnc = d2[s] * 257 ^ s * 16843008;
  77577. for (i2 = 0; i2 < 4; i2++) {
  77578. encTable[i2][x] = tEnc = tEnc << 24 ^ tEnc >>> 8;
  77579. decTable[i2][s] = tDec = tDec << 24 ^ tDec >>> 8;
  77580. }
  77581. }
  77582. for (i2 = 0; i2 < 5; i2++) {
  77583. encTable[i2] = encTable[i2].slice(0);
  77584. decTable[i2] = decTable[i2].slice(0);
  77585. }
  77586. return tables;
  77587. };
  77588. let aesTables = null;
  77589. class AES {
  77590. constructor(key) {
  77591. if (!aesTables) {
  77592. aesTables = precompute();
  77593. }
  77594. this._tables = [[aesTables[0][0].slice(), aesTables[0][1].slice(), aesTables[0][2].slice(), aesTables[0][3].slice(), aesTables[0][4].slice()], [aesTables[1][0].slice(), aesTables[1][1].slice(), aesTables[1][2].slice(), aesTables[1][3].slice(), aesTables[1][4].slice()]];
  77595. let i2;
  77596. let j;
  77597. let tmp;
  77598. const sbox = this._tables[0][4];
  77599. const decTable = this._tables[1];
  77600. const keyLen = key.length;
  77601. let rcon = 1;
  77602. if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) {
  77603. throw new Error("Invalid aes key size");
  77604. }
  77605. const encKey = key.slice(0);
  77606. const decKey = [];
  77607. this._key = [encKey, decKey];
  77608. for (i2 = keyLen; i2 < 4 * keyLen + 28; i2++) {
  77609. tmp = encKey[i2 - 1];
  77610. if (i2 % keyLen === 0 || keyLen === 8 && i2 % keyLen === 4) {
  77611. tmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255];
  77612. if (i2 % keyLen === 0) {
  77613. tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24;
  77614. rcon = rcon << 1 ^ (rcon >> 7) * 283;
  77615. }
  77616. }
  77617. encKey[i2] = encKey[i2 - keyLen] ^ tmp;
  77618. }
  77619. for (j = 0; i2; j++, i2--) {
  77620. tmp = encKey[j & 3 ? i2 : i2 - 4];
  77621. if (i2 <= 4 || j < 4) {
  77622. decKey[j] = tmp;
  77623. } else {
  77624. decKey[j] = decTable[0][sbox[tmp >>> 24]] ^ decTable[1][sbox[tmp >> 16 & 255]] ^ decTable[2][sbox[tmp >> 8 & 255]] ^ decTable[3][sbox[tmp & 255]];
  77625. }
  77626. }
  77627. }
  77628. decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) {
  77629. const key = this._key[1];
  77630. let a = encrypted0 ^ key[0];
  77631. let b = encrypted3 ^ key[1];
  77632. let c = encrypted2 ^ key[2];
  77633. let d2 = encrypted1 ^ key[3];
  77634. let a2;
  77635. let b2;
  77636. let c2;
  77637. const nInnerRounds = key.length / 4 - 2;
  77638. let i2;
  77639. let kIndex = 4;
  77640. const table = this._tables[1];
  77641. const table0 = table[0];
  77642. const table1 = table[1];
  77643. const table2 = table[2];
  77644. const table3 = table[3];
  77645. const sbox = table[4];
  77646. for (i2 = 0; i2 < nInnerRounds; i2++) {
  77647. a2 = table0[a >>> 24] ^ table1[b >> 16 & 255] ^ table2[c >> 8 & 255] ^ table3[d2 & 255] ^ key[kIndex];
  77648. b2 = table0[b >>> 24] ^ table1[c >> 16 & 255] ^ table2[d2 >> 8 & 255] ^ table3[a & 255] ^ key[kIndex + 1];
  77649. c2 = table0[c >>> 24] ^ table1[d2 >> 16 & 255] ^ table2[a >> 8 & 255] ^ table3[b & 255] ^ key[kIndex + 2];
  77650. d2 = table0[d2 >>> 24] ^ table1[a >> 16 & 255] ^ table2[b >> 8 & 255] ^ table3[c & 255] ^ key[kIndex + 3];
  77651. kIndex += 4;
  77652. a = a2;
  77653. b = b2;
  77654. c = c2;
  77655. }
  77656. for (i2 = 0; i2 < 4; i2++) {
  77657. out[(3 & -i2) + offset] = sbox[a >>> 24] << 24 ^ sbox[b >> 16 & 255] << 16 ^ sbox[c >> 8 & 255] << 8 ^ sbox[d2 & 255] ^ key[kIndex++];
  77658. a2 = a;
  77659. a = b;
  77660. b = c;
  77661. c = d2;
  77662. d2 = a2;
  77663. }
  77664. }
  77665. }
  77666. class AsyncStream extends Stream2 {
  77667. constructor() {
  77668. super(Stream2);
  77669. this.jobs = [];
  77670. this.delay = 1;
  77671. this.timeout_ = null;
  77672. }
  77673. processJob_() {
  77674. this.jobs.shift()();
  77675. if (this.jobs.length) {
  77676. this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay);
  77677. } else {
  77678. this.timeout_ = null;
  77679. }
  77680. }
  77681. push(job) {
  77682. this.jobs.push(job);
  77683. if (!this.timeout_) {
  77684. this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay);
  77685. }
  77686. }
  77687. }
  77688. const ntoh = function(word) {
  77689. return word << 24 | (word & 65280) << 8 | (word & 16711680) >> 8 | word >>> 24;
  77690. };
  77691. const decrypt3 = function(encrypted, key, initVector) {
  77692. const encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2);
  77693. const decipher = new AES(Array.prototype.slice.call(key));
  77694. const decrypted = new Uint8Array(encrypted.byteLength);
  77695. const decrypted32 = new Int32Array(decrypted.buffer);
  77696. let init0;
  77697. let init1;
  77698. let init2;
  77699. let init3;
  77700. let encrypted0;
  77701. let encrypted1;
  77702. let encrypted2;
  77703. let encrypted3;
  77704. let wordIx;
  77705. init0 = initVector[0];
  77706. init1 = initVector[1];
  77707. init2 = initVector[2];
  77708. init3 = initVector[3];
  77709. for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) {
  77710. encrypted0 = ntoh(encrypted32[wordIx]);
  77711. encrypted1 = ntoh(encrypted32[wordIx + 1]);
  77712. encrypted2 = ntoh(encrypted32[wordIx + 2]);
  77713. encrypted3 = ntoh(encrypted32[wordIx + 3]);
  77714. decipher.decrypt(encrypted0, encrypted1, encrypted2, encrypted3, decrypted32, wordIx);
  77715. decrypted32[wordIx] = ntoh(decrypted32[wordIx] ^ init0);
  77716. decrypted32[wordIx + 1] = ntoh(decrypted32[wordIx + 1] ^ init1);
  77717. decrypted32[wordIx + 2] = ntoh(decrypted32[wordIx + 2] ^ init2);
  77718. decrypted32[wordIx + 3] = ntoh(decrypted32[wordIx + 3] ^ init3);
  77719. init0 = encrypted0;
  77720. init1 = encrypted1;
  77721. init2 = encrypted2;
  77722. init3 = encrypted3;
  77723. }
  77724. return decrypted;
  77725. };
  77726. class Decrypter2 {
  77727. constructor(encrypted, key, initVector, done) {
  77728. const step = Decrypter2.STEP;
  77729. const encrypted32 = new Int32Array(encrypted.buffer);
  77730. const decrypted = new Uint8Array(encrypted.byteLength);
  77731. let i2 = 0;
  77732. this.asyncStream_ = new AsyncStream();
  77733. this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i2, i2 + step), key, initVector, decrypted));
  77734. for (i2 = step; i2 < encrypted32.length; i2 += step) {
  77735. initVector = new Uint32Array([ntoh(encrypted32[i2 - 4]), ntoh(encrypted32[i2 - 3]), ntoh(encrypted32[i2 - 2]), ntoh(encrypted32[i2 - 1])]);
  77736. this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i2, i2 + step), key, initVector, decrypted));
  77737. }
  77738. this.asyncStream_.push(function() {
  77739. done(null, unpad(decrypted));
  77740. });
  77741. }
  77742. static get STEP() {
  77743. return 32e3;
  77744. }
  77745. decryptChunk_(encrypted, key, initVector, decrypted) {
  77746. return function() {
  77747. const bytes = decrypt3(encrypted, key, initVector);
  77748. decrypted.set(bytes, encrypted.byteOffset);
  77749. };
  77750. }
  77751. }
  77752. var commonjsGlobal2 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  77753. var win2;
  77754. if (typeof window !== "undefined") {
  77755. win2 = window;
  77756. } else if (typeof commonjsGlobal2 !== "undefined") {
  77757. win2 = commonjsGlobal2;
  77758. } else if (typeof self !== "undefined") {
  77759. win2 = self;
  77760. } else {
  77761. win2 = {};
  77762. }
  77763. var window_12 = win2;
  77764. var isArrayBufferView4 = function isArrayBufferView5(obj) {
  77765. if (ArrayBuffer.isView === "function") {
  77766. return ArrayBuffer.isView(obj);
  77767. }
  77768. return obj && obj.buffer instanceof ArrayBuffer;
  77769. };
  77770. var BigInt2 = window_12.BigInt || Number;
  77771. [BigInt2("0x1"), BigInt2("0x100"), BigInt2("0x10000"), BigInt2("0x1000000"), BigInt2("0x100000000"), BigInt2("0x10000000000"), BigInt2("0x1000000000000"), BigInt2("0x100000000000000"), BigInt2("0x10000000000000000")];
  77772. (function() {
  77773. var a = new Uint16Array([65484]);
  77774. var b = new Uint8Array(a.buffer, a.byteOffset, a.byteLength);
  77775. if (b[0] === 255) {
  77776. return "big";
  77777. }
  77778. if (b[0] === 204) {
  77779. return "little";
  77780. }
  77781. return "unknown";
  77782. })();
  77783. const createTransferableMessage3 = function(message) {
  77784. const transferable = {};
  77785. Object.keys(message).forEach((key) => {
  77786. const value = message[key];
  77787. if (isArrayBufferView4(value)) {
  77788. transferable[key] = {
  77789. bytes: value.buffer,
  77790. byteOffset: value.byteOffset,
  77791. byteLength: value.byteLength
  77792. };
  77793. } else {
  77794. transferable[key] = value;
  77795. }
  77796. });
  77797. return transferable;
  77798. };
  77799. self.onmessage = function(event2) {
  77800. const data = event2.data;
  77801. const encrypted = new Uint8Array(data.encrypted.bytes, data.encrypted.byteOffset, data.encrypted.byteLength);
  77802. const key = new Uint32Array(data.key.bytes, data.key.byteOffset, data.key.byteLength / 4);
  77803. const iv = new Uint32Array(data.iv.bytes, data.iv.byteOffset, data.iv.byteLength / 4);
  77804. new Decrypter2(encrypted, key, iv, function(err, bytes) {
  77805. self.postMessage(createTransferableMessage3({
  77806. source: data.source,
  77807. decrypted: bytes
  77808. }), [bytes.buffer]);
  77809. });
  77810. };
  77811. }));
  77812. var Decrypter$1 = factory$1(workerCode$2);
  77813. const audioTrackKind_$1 = (properties) => {
  77814. let kind = properties.default ? "main" : "alternative";
  77815. if (properties.characteristics && properties.characteristics.indexOf("public.accessibility.describes-video") >= 0) {
  77816. kind = "main-desc";
  77817. }
  77818. return kind;
  77819. };
  77820. const stopLoaders$1 = (segmentLoader, mediaType) => {
  77821. segmentLoader.abort();
  77822. segmentLoader.pause();
  77823. if (mediaType && mediaType.activePlaylistLoader) {
  77824. mediaType.activePlaylistLoader.pause();
  77825. mediaType.activePlaylistLoader = null;
  77826. }
  77827. };
  77828. const startLoaders$1 = (playlistLoader, mediaType) => {
  77829. mediaType.activePlaylistLoader = playlistLoader;
  77830. playlistLoader.load();
  77831. };
  77832. const onGroupChanged$1 = (type2, settings) => () => {
  77833. const {
  77834. segmentLoaders: {
  77835. [type2]: segmentLoader,
  77836. main: mainSegmentLoader
  77837. },
  77838. mediaTypes: {
  77839. [type2]: mediaType
  77840. }
  77841. } = settings;
  77842. const activeTrack2 = mediaType.activeTrack();
  77843. const activeGroup3 = mediaType.getActiveGroup();
  77844. const previousActiveLoader = mediaType.activePlaylistLoader;
  77845. const lastGroup = mediaType.lastGroup_;
  77846. if (activeGroup3 && lastGroup && activeGroup3.id === lastGroup.id) {
  77847. return;
  77848. }
  77849. mediaType.lastGroup_ = activeGroup3;
  77850. mediaType.lastTrack_ = activeTrack2;
  77851. stopLoaders$1(segmentLoader, mediaType);
  77852. if (!activeGroup3 || activeGroup3.isMainPlaylist) {
  77853. return;
  77854. }
  77855. if (!activeGroup3.playlistLoader) {
  77856. if (previousActiveLoader) {
  77857. mainSegmentLoader.resetEverything();
  77858. }
  77859. return;
  77860. }
  77861. segmentLoader.resyncLoader();
  77862. startLoaders$1(activeGroup3.playlistLoader, mediaType);
  77863. };
  77864. const onGroupChanging$1 = (type2, settings) => () => {
  77865. const {
  77866. segmentLoaders: {
  77867. [type2]: segmentLoader
  77868. },
  77869. mediaTypes: {
  77870. [type2]: mediaType
  77871. }
  77872. } = settings;
  77873. mediaType.lastGroup_ = null;
  77874. segmentLoader.abort();
  77875. segmentLoader.pause();
  77876. };
  77877. const onTrackChanged$1 = (type2, settings) => () => {
  77878. const {
  77879. mainPlaylistLoader,
  77880. segmentLoaders: {
  77881. [type2]: segmentLoader,
  77882. main: mainSegmentLoader
  77883. },
  77884. mediaTypes: {
  77885. [type2]: mediaType
  77886. }
  77887. } = settings;
  77888. const activeTrack2 = mediaType.activeTrack();
  77889. const activeGroup3 = mediaType.getActiveGroup();
  77890. const previousActiveLoader = mediaType.activePlaylistLoader;
  77891. const lastTrack = mediaType.lastTrack_;
  77892. if (lastTrack && activeTrack2 && lastTrack.id === activeTrack2.id) {
  77893. return;
  77894. }
  77895. mediaType.lastGroup_ = activeGroup3;
  77896. mediaType.lastTrack_ = activeTrack2;
  77897. stopLoaders$1(segmentLoader, mediaType);
  77898. if (!activeGroup3) {
  77899. return;
  77900. }
  77901. if (activeGroup3.isMainPlaylist) {
  77902. if (!activeTrack2 || !lastTrack || activeTrack2.id === lastTrack.id) {
  77903. return;
  77904. }
  77905. const pc = settings.vhs.playlistController_;
  77906. const newPlaylist = pc.selectPlaylist();
  77907. if (pc.media() === newPlaylist) {
  77908. return;
  77909. }
  77910. mediaType.logger_(`track change. Switching main audio from ${lastTrack.id} to ${activeTrack2.id}`);
  77911. mainPlaylistLoader.pause();
  77912. mainSegmentLoader.resetEverything();
  77913. pc.fastQualityChange_(newPlaylist);
  77914. return;
  77915. }
  77916. if (type2 === "AUDIO") {
  77917. if (!activeGroup3.playlistLoader) {
  77918. mainSegmentLoader.setAudio(true);
  77919. mainSegmentLoader.resetEverything();
  77920. return;
  77921. }
  77922. segmentLoader.setAudio(true);
  77923. mainSegmentLoader.setAudio(false);
  77924. }
  77925. if (previousActiveLoader === activeGroup3.playlistLoader) {
  77926. startLoaders$1(activeGroup3.playlistLoader, mediaType);
  77927. return;
  77928. }
  77929. if (segmentLoader.track) {
  77930. segmentLoader.track(activeTrack2);
  77931. }
  77932. segmentLoader.resetEverything();
  77933. startLoaders$1(activeGroup3.playlistLoader, mediaType);
  77934. };
  77935. const onError$1 = {
  77936. AUDIO: (type2, settings) => () => {
  77937. const {
  77938. segmentLoaders: {
  77939. [type2]: segmentLoader
  77940. },
  77941. mediaTypes: {
  77942. [type2]: mediaType
  77943. },
  77944. excludePlaylist
  77945. } = settings;
  77946. stopLoaders$1(segmentLoader, mediaType);
  77947. const activeTrack2 = mediaType.activeTrack();
  77948. const activeGroup3 = mediaType.activeGroup();
  77949. const id = (activeGroup3.filter((group) => group.default)[0] || activeGroup3[0]).id;
  77950. const defaultTrack = mediaType.tracks[id];
  77951. if (activeTrack2 === defaultTrack) {
  77952. excludePlaylist({
  77953. error: {
  77954. message: "Problem encountered loading the default audio track."
  77955. }
  77956. });
  77957. return;
  77958. }
  77959. videojs$2.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");
  77960. for (const trackId in mediaType.tracks) {
  77961. mediaType.tracks[trackId].enabled = mediaType.tracks[trackId] === defaultTrack;
  77962. }
  77963. mediaType.onTrackChanged();
  77964. },
  77965. SUBTITLES: (type2, settings) => () => {
  77966. const {
  77967. segmentLoaders: {
  77968. [type2]: segmentLoader
  77969. },
  77970. mediaTypes: {
  77971. [type2]: mediaType
  77972. }
  77973. } = settings;
  77974. videojs$2.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");
  77975. stopLoaders$1(segmentLoader, mediaType);
  77976. const track = mediaType.activeTrack();
  77977. if (track) {
  77978. track.mode = "disabled";
  77979. }
  77980. mediaType.onTrackChanged();
  77981. }
  77982. };
  77983. const setupListeners$1 = {
  77984. AUDIO: (type2, playlistLoader, settings) => {
  77985. if (!playlistLoader) {
  77986. return;
  77987. }
  77988. const {
  77989. tech,
  77990. requestOptions,
  77991. segmentLoaders: {
  77992. [type2]: segmentLoader
  77993. }
  77994. } = settings;
  77995. playlistLoader.on("loadedmetadata", () => {
  77996. const media = playlistLoader.media();
  77997. segmentLoader.playlist(media, requestOptions);
  77998. if (!tech.paused() || media.endList && tech.preload() !== "none") {
  77999. segmentLoader.load();
  78000. }
  78001. });
  78002. playlistLoader.on("loadedplaylist", () => {
  78003. segmentLoader.playlist(playlistLoader.media(), requestOptions);
  78004. if (!tech.paused()) {
  78005. segmentLoader.load();
  78006. }
  78007. });
  78008. playlistLoader.on("error", onError$1[type2](type2, settings));
  78009. },
  78010. SUBTITLES: (type2, playlistLoader, settings) => {
  78011. const {
  78012. tech,
  78013. requestOptions,
  78014. segmentLoaders: {
  78015. [type2]: segmentLoader
  78016. },
  78017. mediaTypes: {
  78018. [type2]: mediaType
  78019. }
  78020. } = settings;
  78021. playlistLoader.on("loadedmetadata", () => {
  78022. const media = playlistLoader.media();
  78023. segmentLoader.playlist(media, requestOptions);
  78024. segmentLoader.track(mediaType.activeTrack());
  78025. if (!tech.paused() || media.endList && tech.preload() !== "none") {
  78026. segmentLoader.load();
  78027. }
  78028. });
  78029. playlistLoader.on("loadedplaylist", () => {
  78030. segmentLoader.playlist(playlistLoader.media(), requestOptions);
  78031. if (!tech.paused()) {
  78032. segmentLoader.load();
  78033. }
  78034. });
  78035. playlistLoader.on("error", onError$1[type2](type2, settings));
  78036. }
  78037. };
  78038. const initialize$1 = {
  78039. "AUDIO": (type2, settings) => {
  78040. const {
  78041. vhs,
  78042. sourceType,
  78043. segmentLoaders: {
  78044. [type2]: segmentLoader
  78045. },
  78046. requestOptions,
  78047. main: {
  78048. mediaGroups
  78049. },
  78050. mediaTypes: {
  78051. [type2]: {
  78052. groups,
  78053. tracks,
  78054. logger_
  78055. }
  78056. },
  78057. mainPlaylistLoader
  78058. } = settings;
  78059. const audioOnlyMain = isAudioOnly$1(mainPlaylistLoader.main);
  78060. if (!mediaGroups[type2] || Object.keys(mediaGroups[type2]).length === 0) {
  78061. mediaGroups[type2] = {
  78062. main: {
  78063. default: {
  78064. default: true
  78065. }
  78066. }
  78067. };
  78068. if (audioOnlyMain) {
  78069. mediaGroups[type2].main.default.playlists = mainPlaylistLoader.main.playlists;
  78070. }
  78071. }
  78072. for (const groupId in mediaGroups[type2]) {
  78073. if (!groups[groupId]) {
  78074. groups[groupId] = [];
  78075. }
  78076. for (const variantLabel in mediaGroups[type2][groupId]) {
  78077. let properties = mediaGroups[type2][groupId][variantLabel];
  78078. let playlistLoader;
  78079. if (audioOnlyMain) {
  78080. logger_(`AUDIO group '${groupId}' label '${variantLabel}' is a main playlist`);
  78081. properties.isMainPlaylist = true;
  78082. playlistLoader = null;
  78083. } else if (sourceType === "vhs-json" && properties.playlists) {
  78084. playlistLoader = new PlaylistLoader$1(properties.playlists[0], vhs, requestOptions);
  78085. } else if (properties.resolvedUri) {
  78086. playlistLoader = new PlaylistLoader$1(properties.resolvedUri, vhs, requestOptions);
  78087. } else if (properties.playlists && sourceType === "dash") {
  78088. playlistLoader = new DashPlaylistLoader$1(properties.playlists[0], vhs, requestOptions, mainPlaylistLoader);
  78089. } else {
  78090. playlistLoader = null;
  78091. }
  78092. properties = merge$2({
  78093. id: variantLabel,
  78094. playlistLoader
  78095. }, properties);
  78096. setupListeners$1[type2](type2, properties.playlistLoader, settings);
  78097. groups[groupId].push(properties);
  78098. if (typeof tracks[variantLabel] === "undefined") {
  78099. const track = new videojs$2.AudioTrack({
  78100. id: variantLabel,
  78101. kind: audioTrackKind_$1(properties),
  78102. enabled: false,
  78103. language: properties.language,
  78104. default: properties.default,
  78105. label: variantLabel
  78106. });
  78107. tracks[variantLabel] = track;
  78108. }
  78109. }
  78110. }
  78111. segmentLoader.on("error", onError$1[type2](type2, settings));
  78112. },
  78113. "SUBTITLES": (type2, settings) => {
  78114. const {
  78115. tech,
  78116. vhs,
  78117. sourceType,
  78118. segmentLoaders: {
  78119. [type2]: segmentLoader
  78120. },
  78121. requestOptions,
  78122. main: {
  78123. mediaGroups
  78124. },
  78125. mediaTypes: {
  78126. [type2]: {
  78127. groups,
  78128. tracks
  78129. }
  78130. },
  78131. mainPlaylistLoader
  78132. } = settings;
  78133. for (const groupId in mediaGroups[type2]) {
  78134. if (!groups[groupId]) {
  78135. groups[groupId] = [];
  78136. }
  78137. for (const variantLabel in mediaGroups[type2][groupId]) {
  78138. if (mediaGroups[type2][groupId][variantLabel].forced) {
  78139. continue;
  78140. }
  78141. let properties = mediaGroups[type2][groupId][variantLabel];
  78142. let playlistLoader;
  78143. if (sourceType === "hls") {
  78144. playlistLoader = new PlaylistLoader$1(properties.resolvedUri, vhs, requestOptions);
  78145. } else if (sourceType === "dash") {
  78146. const playlists = properties.playlists.filter((p) => p.excludeUntil !== Infinity);
  78147. if (!playlists.length) {
  78148. return;
  78149. }
  78150. playlistLoader = new DashPlaylistLoader$1(properties.playlists[0], vhs, requestOptions, mainPlaylistLoader);
  78151. } else if (sourceType === "vhs-json") {
  78152. playlistLoader = new PlaylistLoader$1(
  78153. properties.playlists ? properties.playlists[0] : properties.resolvedUri,
  78154. vhs,
  78155. requestOptions
  78156. );
  78157. }
  78158. properties = merge$2({
  78159. id: variantLabel,
  78160. playlistLoader
  78161. }, properties);
  78162. setupListeners$1[type2](type2, properties.playlistLoader, settings);
  78163. groups[groupId].push(properties);
  78164. if (typeof tracks[variantLabel] === "undefined") {
  78165. const track = tech.addRemoteTextTrack({
  78166. id: variantLabel,
  78167. kind: "subtitles",
  78168. default: properties.default && properties.autoselect,
  78169. language: properties.language,
  78170. label: variantLabel
  78171. }, false).track;
  78172. tracks[variantLabel] = track;
  78173. }
  78174. }
  78175. }
  78176. segmentLoader.on("error", onError$1[type2](type2, settings));
  78177. },
  78178. "CLOSED-CAPTIONS": (type2, settings) => {
  78179. const {
  78180. tech,
  78181. main: {
  78182. mediaGroups
  78183. },
  78184. mediaTypes: {
  78185. [type2]: {
  78186. groups,
  78187. tracks
  78188. }
  78189. }
  78190. } = settings;
  78191. for (const groupId in mediaGroups[type2]) {
  78192. if (!groups[groupId]) {
  78193. groups[groupId] = [];
  78194. }
  78195. for (const variantLabel in mediaGroups[type2][groupId]) {
  78196. const properties = mediaGroups[type2][groupId][variantLabel];
  78197. if (!/^(?:CC|SERVICE)/.test(properties.instreamId)) {
  78198. continue;
  78199. }
  78200. const captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {};
  78201. let newProps = {
  78202. label: variantLabel,
  78203. language: properties.language,
  78204. instreamId: properties.instreamId,
  78205. default: properties.default && properties.autoselect
  78206. };
  78207. if (captionServices[newProps.instreamId]) {
  78208. newProps = merge$2(newProps, captionServices[newProps.instreamId]);
  78209. }
  78210. if (newProps.default === void 0) {
  78211. delete newProps.default;
  78212. }
  78213. groups[groupId].push(merge$2({
  78214. id: variantLabel
  78215. }, properties));
  78216. if (typeof tracks[variantLabel] === "undefined") {
  78217. const track = tech.addRemoteTextTrack({
  78218. id: newProps.instreamId,
  78219. kind: "captions",
  78220. default: newProps.default,
  78221. language: newProps.language,
  78222. label: newProps.label
  78223. }, false).track;
  78224. tracks[variantLabel] = track;
  78225. }
  78226. }
  78227. }
  78228. }
  78229. };
  78230. const groupMatch$1 = (list, media) => {
  78231. for (let i2 = 0; i2 < list.length; i2++) {
  78232. if (playlistMatch$1(media, list[i2])) {
  78233. return true;
  78234. }
  78235. if (list[i2].playlists && groupMatch$1(list[i2].playlists, media)) {
  78236. return true;
  78237. }
  78238. }
  78239. return false;
  78240. };
  78241. const activeGroup$1 = (type2, settings) => (track) => {
  78242. const {
  78243. mainPlaylistLoader,
  78244. mediaTypes: {
  78245. [type2]: {
  78246. groups
  78247. }
  78248. }
  78249. } = settings;
  78250. const media = mainPlaylistLoader.media();
  78251. if (!media) {
  78252. return null;
  78253. }
  78254. let variants = null;
  78255. if (media.attributes[type2]) {
  78256. variants = groups[media.attributes[type2]];
  78257. }
  78258. const groupKeys = Object.keys(groups);
  78259. if (!variants) {
  78260. if (type2 === "AUDIO" && groupKeys.length > 1 && isAudioOnly$1(settings.main)) {
  78261. for (let i2 = 0; i2 < groupKeys.length; i2++) {
  78262. const groupPropertyList = groups[groupKeys[i2]];
  78263. if (groupMatch$1(groupPropertyList, media)) {
  78264. variants = groupPropertyList;
  78265. break;
  78266. }
  78267. }
  78268. } else if (groups.main) {
  78269. variants = groups.main;
  78270. } else if (groupKeys.length === 1) {
  78271. variants = groups[groupKeys[0]];
  78272. }
  78273. }
  78274. if (typeof track === "undefined") {
  78275. return variants;
  78276. }
  78277. if (track === null || !variants) {
  78278. return null;
  78279. }
  78280. return variants.filter((props) => props.id === track.id)[0] || null;
  78281. };
  78282. const activeTrack$1 = {
  78283. AUDIO: (type2, settings) => () => {
  78284. const {
  78285. mediaTypes: {
  78286. [type2]: {
  78287. tracks
  78288. }
  78289. }
  78290. } = settings;
  78291. for (const id in tracks) {
  78292. if (tracks[id].enabled) {
  78293. return tracks[id];
  78294. }
  78295. }
  78296. return null;
  78297. },
  78298. SUBTITLES: (type2, settings) => () => {
  78299. const {
  78300. mediaTypes: {
  78301. [type2]: {
  78302. tracks
  78303. }
  78304. }
  78305. } = settings;
  78306. for (const id in tracks) {
  78307. if (tracks[id].mode === "showing" || tracks[id].mode === "hidden") {
  78308. return tracks[id];
  78309. }
  78310. }
  78311. return null;
  78312. }
  78313. };
  78314. const getActiveGroup$1 = (type2, {
  78315. mediaTypes: mediaTypes2
  78316. }) => () => {
  78317. const activeTrack_ = mediaTypes2[type2].activeTrack();
  78318. if (!activeTrack_) {
  78319. return null;
  78320. }
  78321. return mediaTypes2[type2].activeGroup(activeTrack_);
  78322. };
  78323. const setupMediaGroups$1 = (settings) => {
  78324. ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach((type2) => {
  78325. initialize$1[type2](type2, settings);
  78326. });
  78327. const {
  78328. mediaTypes: mediaTypes2,
  78329. mainPlaylistLoader,
  78330. tech,
  78331. vhs,
  78332. segmentLoaders: {
  78333. ["AUDIO"]: audioSegmentLoader,
  78334. main: mainSegmentLoader
  78335. }
  78336. } = settings;
  78337. ["AUDIO", "SUBTITLES"].forEach((type2) => {
  78338. mediaTypes2[type2].activeGroup = activeGroup$1(type2, settings);
  78339. mediaTypes2[type2].activeTrack = activeTrack$1[type2](type2, settings);
  78340. mediaTypes2[type2].onGroupChanged = onGroupChanged$1(type2, settings);
  78341. mediaTypes2[type2].onGroupChanging = onGroupChanging$1(type2, settings);
  78342. mediaTypes2[type2].onTrackChanged = onTrackChanged$1(type2, settings);
  78343. mediaTypes2[type2].getActiveGroup = getActiveGroup$1(type2, settings);
  78344. });
  78345. const audioGroup = mediaTypes2.AUDIO.activeGroup();
  78346. if (audioGroup) {
  78347. const groupId = (audioGroup.filter((group) => group.default)[0] || audioGroup[0]).id;
  78348. mediaTypes2.AUDIO.tracks[groupId].enabled = true;
  78349. mediaTypes2.AUDIO.onGroupChanged();
  78350. mediaTypes2.AUDIO.onTrackChanged();
  78351. const activeAudioGroup = mediaTypes2.AUDIO.getActiveGroup();
  78352. if (!activeAudioGroup.playlistLoader) {
  78353. mainSegmentLoader.setAudio(true);
  78354. } else {
  78355. mainSegmentLoader.setAudio(false);
  78356. audioSegmentLoader.setAudio(true);
  78357. }
  78358. }
  78359. mainPlaylistLoader.on("mediachange", () => {
  78360. ["AUDIO", "SUBTITLES"].forEach((type2) => mediaTypes2[type2].onGroupChanged());
  78361. });
  78362. mainPlaylistLoader.on("mediachanging", () => {
  78363. ["AUDIO", "SUBTITLES"].forEach((type2) => mediaTypes2[type2].onGroupChanging());
  78364. });
  78365. const onAudioTrackChanged = () => {
  78366. mediaTypes2.AUDIO.onTrackChanged();
  78367. tech.trigger({
  78368. type: "usage",
  78369. name: "vhs-audio-change"
  78370. });
  78371. };
  78372. tech.audioTracks().addEventListener("change", onAudioTrackChanged);
  78373. tech.remoteTextTracks().addEventListener("change", mediaTypes2.SUBTITLES.onTrackChanged);
  78374. vhs.on("dispose", () => {
  78375. tech.audioTracks().removeEventListener("change", onAudioTrackChanged);
  78376. tech.remoteTextTracks().removeEventListener("change", mediaTypes2.SUBTITLES.onTrackChanged);
  78377. });
  78378. tech.clearTracks("audio");
  78379. for (const id in mediaTypes2.AUDIO.tracks) {
  78380. tech.audioTracks().addTrack(mediaTypes2.AUDIO.tracks[id]);
  78381. }
  78382. };
  78383. const createMediaTypes$1 = () => {
  78384. const mediaTypes2 = {};
  78385. ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach((type2) => {
  78386. mediaTypes2[type2] = {
  78387. groups: {},
  78388. tracks: {},
  78389. activePlaylistLoader: null,
  78390. activeGroup: noop$1,
  78391. activeTrack: noop$1,
  78392. getActiveGroup: noop$1,
  78393. onGroupChanged: noop$1,
  78394. onTrackChanged: noop$1,
  78395. lastTrack_: null,
  78396. logger_: logger$1(`MediaGroups[${type2}]`)
  78397. };
  78398. });
  78399. return mediaTypes2;
  78400. };
  78401. const ABORT_EARLY_EXCLUSION_SECONDS = 60 * 2;
  78402. let Vhs$1$1;
  78403. const loaderStats$1 = ["mediaRequests", "mediaRequestsAborted", "mediaRequestsTimedout", "mediaRequestsErrored", "mediaTransferDuration", "mediaBytesTransferred", "mediaAppends"];
  78404. const sumLoaderStat$1 = function(stat) {
  78405. return this.audioSegmentLoader_[stat] + this.mainSegmentLoader_[stat];
  78406. };
  78407. const shouldSwitchToMedia$1 = function({
  78408. currentPlaylist,
  78409. buffered,
  78410. currentTime,
  78411. nextPlaylist,
  78412. bufferLowWaterLine,
  78413. bufferHighWaterLine,
  78414. duration: duration5,
  78415. bufferBasedABR,
  78416. log: log2
  78417. }) {
  78418. if (!nextPlaylist) {
  78419. videojs$2.log.warn("We received no playlist to switch to. Please check your stream.");
  78420. return false;
  78421. }
  78422. const sharedLogLine = `allowing switch ${currentPlaylist && currentPlaylist.id || "null"} -> ${nextPlaylist.id}`;
  78423. if (!currentPlaylist) {
  78424. log2(`${sharedLogLine} as current playlist is not set`);
  78425. return true;
  78426. }
  78427. if (nextPlaylist.id === currentPlaylist.id) {
  78428. return false;
  78429. }
  78430. const isBuffered = Boolean(findRange$1(buffered, currentTime).length);
  78431. if (!currentPlaylist.endList) {
  78432. if (!isBuffered && typeof currentPlaylist.partTargetDuration === "number") {
  78433. log2(`not ${sharedLogLine} as current playlist is live llhls, but currentTime isn't in buffered.`);
  78434. return false;
  78435. }
  78436. log2(`${sharedLogLine} as current playlist is live`);
  78437. return true;
  78438. }
  78439. const forwardBuffer = timeAheadOf$1(buffered, currentTime);
  78440. const maxBufferLowWaterLine = bufferBasedABR ? Config$1.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE : Config$1.MAX_BUFFER_LOW_WATER_LINE;
  78441. if (duration5 < maxBufferLowWaterLine) {
  78442. log2(`${sharedLogLine} as duration < max low water line (${duration5} < ${maxBufferLowWaterLine})`);
  78443. return true;
  78444. }
  78445. const nextBandwidth = nextPlaylist.attributes.BANDWIDTH;
  78446. const currBandwidth = currentPlaylist.attributes.BANDWIDTH;
  78447. if (nextBandwidth < currBandwidth && (!bufferBasedABR || forwardBuffer < bufferHighWaterLine)) {
  78448. let logLine = `${sharedLogLine} as next bandwidth < current bandwidth (${nextBandwidth} < ${currBandwidth})`;
  78449. if (bufferBasedABR) {
  78450. logLine += ` and forwardBuffer < bufferHighWaterLine (${forwardBuffer} < ${bufferHighWaterLine})`;
  78451. }
  78452. log2(logLine);
  78453. return true;
  78454. }
  78455. if ((!bufferBasedABR || nextBandwidth > currBandwidth) && forwardBuffer >= bufferLowWaterLine) {
  78456. let logLine = `${sharedLogLine} as forwardBuffer >= bufferLowWaterLine (${forwardBuffer} >= ${bufferLowWaterLine})`;
  78457. if (bufferBasedABR) {
  78458. logLine += ` and next bandwidth > current bandwidth (${nextBandwidth} > ${currBandwidth})`;
  78459. }
  78460. log2(logLine);
  78461. return true;
  78462. }
  78463. log2(`not ${sharedLogLine} as no switching criteria met`);
  78464. return false;
  78465. };
  78466. class PlaylistController extends videojs$2.EventTarget {
  78467. constructor(options2) {
  78468. super();
  78469. const {
  78470. src,
  78471. withCredentials,
  78472. tech,
  78473. bandwidth: bandwidth2,
  78474. externVhs,
  78475. useCueTags,
  78476. playlistExclusionDuration,
  78477. enableLowInitialPlaylist,
  78478. sourceType,
  78479. cacheEncryptionKeys,
  78480. bufferBasedABR,
  78481. leastPixelDiffSelector,
  78482. captionServices
  78483. } = options2;
  78484. if (!src) {
  78485. throw new Error("A non-empty playlist URL or JSON manifest string is required");
  78486. }
  78487. let {
  78488. maxPlaylistRetries
  78489. } = options2;
  78490. if (maxPlaylistRetries === null || typeof maxPlaylistRetries === "undefined") {
  78491. maxPlaylistRetries = Infinity;
  78492. }
  78493. Vhs$1$1 = externVhs;
  78494. this.bufferBasedABR = Boolean(bufferBasedABR);
  78495. this.leastPixelDiffSelector = Boolean(leastPixelDiffSelector);
  78496. this.withCredentials = withCredentials;
  78497. this.tech_ = tech;
  78498. this.vhs_ = tech.vhs;
  78499. this.sourceType_ = sourceType;
  78500. this.useCueTags_ = useCueTags;
  78501. this.playlistExclusionDuration = playlistExclusionDuration;
  78502. this.maxPlaylistRetries = maxPlaylistRetries;
  78503. this.enableLowInitialPlaylist = enableLowInitialPlaylist;
  78504. if (this.useCueTags_) {
  78505. this.cueTagsTrack_ = this.tech_.addTextTrack("metadata", "ad-cues");
  78506. this.cueTagsTrack_.inBandMetadataTrackDispatchType = "";
  78507. }
  78508. this.requestOptions_ = {
  78509. withCredentials,
  78510. maxPlaylistRetries,
  78511. timeout: null
  78512. };
  78513. this.on("error", this.pauseLoading);
  78514. this.mediaTypes_ = createMediaTypes$1();
  78515. this.mediaSource = new window_1.MediaSource();
  78516. this.handleDurationChange_ = this.handleDurationChange_.bind(this);
  78517. this.handleSourceOpen_ = this.handleSourceOpen_.bind(this);
  78518. this.handleSourceEnded_ = this.handleSourceEnded_.bind(this);
  78519. this.mediaSource.addEventListener("durationchange", this.handleDurationChange_);
  78520. this.mediaSource.addEventListener("sourceopen", this.handleSourceOpen_);
  78521. this.mediaSource.addEventListener("sourceended", this.handleSourceEnded_);
  78522. this.seekable_ = createTimeRanges$2();
  78523. this.hasPlayed_ = false;
  78524. this.syncController_ = new SyncController$1(options2);
  78525. this.segmentMetadataTrack_ = tech.addRemoteTextTrack({
  78526. kind: "metadata",
  78527. label: "segment-metadata"
  78528. }, false).track;
  78529. this.decrypter_ = new Decrypter$1();
  78530. this.sourceUpdater_ = new SourceUpdater$1(this.mediaSource);
  78531. this.inbandTextTracks_ = {};
  78532. this.timelineChangeController_ = new TimelineChangeController$1();
  78533. const segmentLoaderSettings = {
  78534. vhs: this.vhs_,
  78535. parse708captions: options2.parse708captions,
  78536. useDtsForTimestampOffset: options2.useDtsForTimestampOffset,
  78537. captionServices,
  78538. mediaSource: this.mediaSource,
  78539. currentTime: this.tech_.currentTime.bind(this.tech_),
  78540. seekable: () => this.seekable(),
  78541. seeking: () => this.tech_.seeking(),
  78542. duration: () => this.duration(),
  78543. hasPlayed: () => this.hasPlayed_,
  78544. goalBufferLength: () => this.goalBufferLength(),
  78545. bandwidth: bandwidth2,
  78546. syncController: this.syncController_,
  78547. decrypter: this.decrypter_,
  78548. sourceType: this.sourceType_,
  78549. inbandTextTracks: this.inbandTextTracks_,
  78550. cacheEncryptionKeys,
  78551. sourceUpdater: this.sourceUpdater_,
  78552. timelineChangeController: this.timelineChangeController_,
  78553. exactManifestTimings: options2.exactManifestTimings
  78554. };
  78555. this.mainPlaylistLoader_ = this.sourceType_ === "dash" ? new DashPlaylistLoader$1(src, this.vhs_, this.requestOptions_) : new PlaylistLoader$1(src, this.vhs_, this.requestOptions_);
  78556. this.setupMainPlaylistLoaderListeners_();
  78557. this.mainSegmentLoader_ = new SegmentLoader$1(merge$2(segmentLoaderSettings, {
  78558. segmentMetadataTrack: this.segmentMetadataTrack_,
  78559. loaderType: "main"
  78560. }), options2);
  78561. this.audioSegmentLoader_ = new SegmentLoader$1(merge$2(segmentLoaderSettings, {
  78562. loaderType: "audio"
  78563. }), options2);
  78564. this.subtitleSegmentLoader_ = new VTTSegmentLoader$1(merge$2(segmentLoaderSettings, {
  78565. loaderType: "vtt",
  78566. featuresNativeTextTracks: this.tech_.featuresNativeTextTracks,
  78567. loadVttJs: () => new Promise((resolve2, reject2) => {
  78568. function onLoad() {
  78569. tech.off("vttjserror", onError2);
  78570. resolve2();
  78571. }
  78572. function onError2() {
  78573. tech.off("vttjsloaded", onLoad);
  78574. reject2();
  78575. }
  78576. tech.one("vttjsloaded", onLoad);
  78577. tech.one("vttjserror", onError2);
  78578. tech.addWebVttScript_();
  78579. })
  78580. }), options2);
  78581. this.setupSegmentLoaderListeners_();
  78582. if (this.bufferBasedABR) {
  78583. this.mainPlaylistLoader_.one("loadedplaylist", () => this.startABRTimer_());
  78584. this.tech_.on("pause", () => this.stopABRTimer_());
  78585. this.tech_.on("play", () => this.startABRTimer_());
  78586. }
  78587. loaderStats$1.forEach((stat) => {
  78588. this[stat + "_"] = sumLoaderStat$1.bind(this, stat);
  78589. });
  78590. this.logger_ = logger$1("pc");
  78591. this.triggeredFmp4Usage = false;
  78592. if (this.tech_.preload() === "none") {
  78593. this.loadOnPlay_ = () => {
  78594. this.loadOnPlay_ = null;
  78595. this.mainPlaylistLoader_.load();
  78596. };
  78597. this.tech_.one("play", this.loadOnPlay_);
  78598. } else {
  78599. this.mainPlaylistLoader_.load();
  78600. }
  78601. this.timeToLoadedData__ = -1;
  78602. this.mainAppendsToLoadedData__ = -1;
  78603. this.audioAppendsToLoadedData__ = -1;
  78604. const event2 = this.tech_.preload() === "none" ? "play" : "loadstart";
  78605. this.tech_.one(event2, () => {
  78606. const timeToLoadedDataStart = Date.now();
  78607. this.tech_.one("loadeddata", () => {
  78608. this.timeToLoadedData__ = Date.now() - timeToLoadedDataStart;
  78609. this.mainAppendsToLoadedData__ = this.mainSegmentLoader_.mediaAppends;
  78610. this.audioAppendsToLoadedData__ = this.audioSegmentLoader_.mediaAppends;
  78611. });
  78612. });
  78613. }
  78614. mainAppendsToLoadedData_() {
  78615. return this.mainAppendsToLoadedData__;
  78616. }
  78617. audioAppendsToLoadedData_() {
  78618. return this.audioAppendsToLoadedData__;
  78619. }
  78620. appendsToLoadedData_() {
  78621. const main = this.mainAppendsToLoadedData_();
  78622. const audio = this.audioAppendsToLoadedData_();
  78623. if (main === -1 || audio === -1) {
  78624. return -1;
  78625. }
  78626. return main + audio;
  78627. }
  78628. timeToLoadedData_() {
  78629. return this.timeToLoadedData__;
  78630. }
  78631. checkABR_(reason = "abr") {
  78632. const nextPlaylist = this.selectPlaylist();
  78633. if (nextPlaylist && this.shouldSwitchToMedia_(nextPlaylist)) {
  78634. this.switchMedia_(nextPlaylist, reason);
  78635. }
  78636. }
  78637. switchMedia_(playlist, cause, delay) {
  78638. const oldMedia = this.media();
  78639. const oldId = oldMedia && (oldMedia.id || oldMedia.uri);
  78640. const newId = playlist.id || playlist.uri;
  78641. if (oldId && oldId !== newId) {
  78642. this.logger_(`switch media ${oldId} -> ${newId} from ${cause}`);
  78643. this.tech_.trigger({
  78644. type: "usage",
  78645. name: `vhs-rendition-change-${cause}`
  78646. });
  78647. }
  78648. this.mainPlaylistLoader_.media(playlist, delay);
  78649. }
  78650. startABRTimer_() {
  78651. this.stopABRTimer_();
  78652. this.abrTimer_ = window_1.setInterval(() => this.checkABR_(), 250);
  78653. }
  78654. stopABRTimer_() {
  78655. if (this.tech_.scrubbing && this.tech_.scrubbing()) {
  78656. return;
  78657. }
  78658. window_1.clearInterval(this.abrTimer_);
  78659. this.abrTimer_ = null;
  78660. }
  78661. getAudioTrackPlaylists_() {
  78662. const main = this.main();
  78663. const defaultPlaylists = main && main.playlists || [];
  78664. if (!main || !main.mediaGroups || !main.mediaGroups.AUDIO) {
  78665. return defaultPlaylists;
  78666. }
  78667. const AUDIO5 = main.mediaGroups.AUDIO;
  78668. const groupKeys = Object.keys(AUDIO5);
  78669. let track;
  78670. if (Object.keys(this.mediaTypes_.AUDIO.groups).length) {
  78671. track = this.mediaTypes_.AUDIO.activeTrack();
  78672. } else {
  78673. const defaultGroup = AUDIO5.main || groupKeys.length && AUDIO5[groupKeys[0]];
  78674. for (const label2 in defaultGroup) {
  78675. if (defaultGroup[label2].default) {
  78676. track = {
  78677. label: label2
  78678. };
  78679. break;
  78680. }
  78681. }
  78682. }
  78683. if (!track) {
  78684. return defaultPlaylists;
  78685. }
  78686. const playlists = [];
  78687. for (const group in AUDIO5) {
  78688. if (AUDIO5[group][track.label]) {
  78689. const properties = AUDIO5[group][track.label];
  78690. if (properties.playlists && properties.playlists.length) {
  78691. playlists.push.apply(playlists, properties.playlists);
  78692. } else if (properties.uri) {
  78693. playlists.push(properties);
  78694. } else if (main.playlists.length) {
  78695. for (let i2 = 0; i2 < main.playlists.length; i2++) {
  78696. const playlist = main.playlists[i2];
  78697. if (playlist.attributes && playlist.attributes.AUDIO && playlist.attributes.AUDIO === group) {
  78698. playlists.push(playlist);
  78699. }
  78700. }
  78701. }
  78702. }
  78703. }
  78704. if (!playlists.length) {
  78705. return defaultPlaylists;
  78706. }
  78707. return playlists;
  78708. }
  78709. setupMainPlaylistLoaderListeners_() {
  78710. this.mainPlaylistLoader_.on("loadedmetadata", () => {
  78711. const media = this.mainPlaylistLoader_.media();
  78712. const requestTimeout = media.targetDuration * 1.5 * 1e3;
  78713. if (isLowestEnabledRendition$1(this.mainPlaylistLoader_.main, this.mainPlaylistLoader_.media())) {
  78714. this.requestOptions_.timeout = 0;
  78715. } else {
  78716. this.requestOptions_.timeout = requestTimeout;
  78717. }
  78718. if (media.endList && this.tech_.preload() !== "none") {
  78719. this.mainSegmentLoader_.playlist(media, this.requestOptions_);
  78720. this.mainSegmentLoader_.load();
  78721. }
  78722. setupMediaGroups$1({
  78723. sourceType: this.sourceType_,
  78724. segmentLoaders: {
  78725. AUDIO: this.audioSegmentLoader_,
  78726. SUBTITLES: this.subtitleSegmentLoader_,
  78727. main: this.mainSegmentLoader_
  78728. },
  78729. tech: this.tech_,
  78730. requestOptions: this.requestOptions_,
  78731. mainPlaylistLoader: this.mainPlaylistLoader_,
  78732. vhs: this.vhs_,
  78733. main: this.main(),
  78734. mediaTypes: this.mediaTypes_,
  78735. excludePlaylist: this.excludePlaylist.bind(this)
  78736. });
  78737. this.triggerPresenceUsage_(this.main(), media);
  78738. this.setupFirstPlay();
  78739. if (!this.mediaTypes_.AUDIO.activePlaylistLoader || this.mediaTypes_.AUDIO.activePlaylistLoader.media()) {
  78740. this.trigger("selectedinitialmedia");
  78741. } else {
  78742. this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata", () => {
  78743. this.trigger("selectedinitialmedia");
  78744. });
  78745. }
  78746. });
  78747. this.mainPlaylistLoader_.on("loadedplaylist", () => {
  78748. if (this.loadOnPlay_) {
  78749. this.tech_.off("play", this.loadOnPlay_);
  78750. }
  78751. let updatedPlaylist = this.mainPlaylistLoader_.media();
  78752. if (!updatedPlaylist) {
  78753. this.excludeUnsupportedVariants_();
  78754. let selectedMedia;
  78755. if (this.enableLowInitialPlaylist) {
  78756. selectedMedia = this.selectInitialPlaylist();
  78757. }
  78758. if (!selectedMedia) {
  78759. selectedMedia = this.selectPlaylist();
  78760. }
  78761. if (!selectedMedia || !this.shouldSwitchToMedia_(selectedMedia)) {
  78762. return;
  78763. }
  78764. this.initialMedia_ = selectedMedia;
  78765. this.switchMedia_(this.initialMedia_, "initial");
  78766. const haveJsonSource = this.sourceType_ === "vhs-json" && this.initialMedia_.segments;
  78767. if (!haveJsonSource) {
  78768. return;
  78769. }
  78770. updatedPlaylist = this.initialMedia_;
  78771. }
  78772. this.handleUpdatedMediaPlaylist(updatedPlaylist);
  78773. });
  78774. this.mainPlaylistLoader_.on("error", () => {
  78775. const error = this.mainPlaylistLoader_.error;
  78776. this.excludePlaylist({
  78777. playlistToExclude: error.playlist,
  78778. error
  78779. });
  78780. });
  78781. this.mainPlaylistLoader_.on("mediachanging", () => {
  78782. this.mainSegmentLoader_.abort();
  78783. this.mainSegmentLoader_.pause();
  78784. });
  78785. this.mainPlaylistLoader_.on("mediachange", () => {
  78786. const media = this.mainPlaylistLoader_.media();
  78787. const requestTimeout = media.targetDuration * 1.5 * 1e3;
  78788. if (isLowestEnabledRendition$1(this.mainPlaylistLoader_.main, this.mainPlaylistLoader_.media())) {
  78789. this.requestOptions_.timeout = 0;
  78790. } else {
  78791. this.requestOptions_.timeout = requestTimeout;
  78792. }
  78793. this.mainPlaylistLoader_.load();
  78794. this.mainSegmentLoader_.playlist(media, this.requestOptions_);
  78795. this.mainSegmentLoader_.load();
  78796. this.tech_.trigger({
  78797. type: "mediachange",
  78798. bubbles: true
  78799. });
  78800. });
  78801. this.mainPlaylistLoader_.on("playlistunchanged", () => {
  78802. const updatedPlaylist = this.mainPlaylistLoader_.media();
  78803. if (updatedPlaylist.lastExcludeReason_ === "playlist-unchanged") {
  78804. return;
  78805. }
  78806. const playlistOutdated = this.stuckAtPlaylistEnd_(updatedPlaylist);
  78807. if (playlistOutdated) {
  78808. this.excludePlaylist({
  78809. error: {
  78810. message: "Playlist no longer updating.",
  78811. reason: "playlist-unchanged"
  78812. }
  78813. });
  78814. this.tech_.trigger("playliststuck");
  78815. }
  78816. });
  78817. this.mainPlaylistLoader_.on("renditiondisabled", () => {
  78818. this.tech_.trigger({
  78819. type: "usage",
  78820. name: "vhs-rendition-disabled"
  78821. });
  78822. });
  78823. this.mainPlaylistLoader_.on("renditionenabled", () => {
  78824. this.tech_.trigger({
  78825. type: "usage",
  78826. name: "vhs-rendition-enabled"
  78827. });
  78828. });
  78829. }
  78830. handleUpdatedMediaPlaylist(updatedPlaylist) {
  78831. if (this.useCueTags_) {
  78832. this.updateAdCues_(updatedPlaylist);
  78833. }
  78834. this.mainSegmentLoader_.playlist(updatedPlaylist, this.requestOptions_);
  78835. this.updateDuration(!updatedPlaylist.endList);
  78836. if (!this.tech_.paused()) {
  78837. this.mainSegmentLoader_.load();
  78838. if (this.audioSegmentLoader_) {
  78839. this.audioSegmentLoader_.load();
  78840. }
  78841. }
  78842. }
  78843. triggerPresenceUsage_(main, media) {
  78844. const mediaGroups = main.mediaGroups || {};
  78845. let defaultDemuxed = true;
  78846. const audioGroupKeys = Object.keys(mediaGroups.AUDIO);
  78847. for (const mediaGroup in mediaGroups.AUDIO) {
  78848. for (const label2 in mediaGroups.AUDIO[mediaGroup]) {
  78849. const properties = mediaGroups.AUDIO[mediaGroup][label2];
  78850. if (!properties.uri) {
  78851. defaultDemuxed = false;
  78852. }
  78853. }
  78854. }
  78855. if (defaultDemuxed) {
  78856. this.tech_.trigger({
  78857. type: "usage",
  78858. name: "vhs-demuxed"
  78859. });
  78860. }
  78861. if (Object.keys(mediaGroups.SUBTITLES).length) {
  78862. this.tech_.trigger({
  78863. type: "usage",
  78864. name: "vhs-webvtt"
  78865. });
  78866. }
  78867. if (Vhs$1$1.Playlist.isAes(media)) {
  78868. this.tech_.trigger({
  78869. type: "usage",
  78870. name: "vhs-aes"
  78871. });
  78872. }
  78873. if (audioGroupKeys.length && Object.keys(mediaGroups.AUDIO[audioGroupKeys[0]]).length > 1) {
  78874. this.tech_.trigger({
  78875. type: "usage",
  78876. name: "vhs-alternate-audio"
  78877. });
  78878. }
  78879. if (this.useCueTags_) {
  78880. this.tech_.trigger({
  78881. type: "usage",
  78882. name: "vhs-playlist-cue-tags"
  78883. });
  78884. }
  78885. }
  78886. shouldSwitchToMedia_(nextPlaylist) {
  78887. const currentPlaylist = this.mainPlaylistLoader_.media() || this.mainPlaylistLoader_.pendingMedia_;
  78888. const currentTime = this.tech_.currentTime();
  78889. const bufferLowWaterLine = this.bufferLowWaterLine();
  78890. const bufferHighWaterLine = this.bufferHighWaterLine();
  78891. const buffered = this.tech_.buffered();
  78892. return shouldSwitchToMedia$1({
  78893. buffered,
  78894. currentTime,
  78895. currentPlaylist,
  78896. nextPlaylist,
  78897. bufferLowWaterLine,
  78898. bufferHighWaterLine,
  78899. duration: this.duration(),
  78900. bufferBasedABR: this.bufferBasedABR,
  78901. log: this.logger_
  78902. });
  78903. }
  78904. setupSegmentLoaderListeners_() {
  78905. this.mainSegmentLoader_.on("bandwidthupdate", () => {
  78906. this.checkABR_("bandwidthupdate");
  78907. this.tech_.trigger("bandwidthupdate");
  78908. });
  78909. this.mainSegmentLoader_.on("timeout", () => {
  78910. if (this.bufferBasedABR) {
  78911. this.mainSegmentLoader_.load();
  78912. }
  78913. });
  78914. if (!this.bufferBasedABR) {
  78915. this.mainSegmentLoader_.on("progress", () => {
  78916. this.trigger("progress");
  78917. });
  78918. }
  78919. this.mainSegmentLoader_.on("error", () => {
  78920. const error = this.mainSegmentLoader_.error();
  78921. this.excludePlaylist({
  78922. playlistToExclude: error.playlist,
  78923. error
  78924. });
  78925. });
  78926. this.mainSegmentLoader_.on("appenderror", () => {
  78927. this.error = this.mainSegmentLoader_.error_;
  78928. this.trigger("error");
  78929. });
  78930. this.mainSegmentLoader_.on("syncinfoupdate", () => {
  78931. this.onSyncInfoUpdate_();
  78932. });
  78933. this.mainSegmentLoader_.on("timestampoffset", () => {
  78934. this.tech_.trigger({
  78935. type: "usage",
  78936. name: "vhs-timestamp-offset"
  78937. });
  78938. });
  78939. this.audioSegmentLoader_.on("syncinfoupdate", () => {
  78940. this.onSyncInfoUpdate_();
  78941. });
  78942. this.audioSegmentLoader_.on("appenderror", () => {
  78943. this.error = this.audioSegmentLoader_.error_;
  78944. this.trigger("error");
  78945. });
  78946. this.mainSegmentLoader_.on("ended", () => {
  78947. this.logger_("main segment loader ended");
  78948. this.onEndOfStream();
  78949. });
  78950. this.mainSegmentLoader_.on("earlyabort", (event2) => {
  78951. if (this.bufferBasedABR) {
  78952. return;
  78953. }
  78954. this.delegateLoaders_("all", ["abort"]);
  78955. this.excludePlaylist({
  78956. error: {
  78957. message: "Aborted early because there isn't enough bandwidth to complete the request without rebuffering."
  78958. },
  78959. playlistExclusionDuration: ABORT_EARLY_EXCLUSION_SECONDS
  78960. });
  78961. });
  78962. const updateCodecs = () => {
  78963. if (!this.sourceUpdater_.hasCreatedSourceBuffers()) {
  78964. return this.tryToCreateSourceBuffers_();
  78965. }
  78966. const codecs = this.getCodecsOrExclude_();
  78967. if (!codecs) {
  78968. return;
  78969. }
  78970. this.sourceUpdater_.addOrChangeSourceBuffers(codecs);
  78971. };
  78972. this.mainSegmentLoader_.on("trackinfo", updateCodecs);
  78973. this.audioSegmentLoader_.on("trackinfo", updateCodecs);
  78974. this.mainSegmentLoader_.on("fmp4", () => {
  78975. if (!this.triggeredFmp4Usage) {
  78976. this.tech_.trigger({
  78977. type: "usage",
  78978. name: "vhs-fmp4"
  78979. });
  78980. this.triggeredFmp4Usage = true;
  78981. }
  78982. });
  78983. this.audioSegmentLoader_.on("fmp4", () => {
  78984. if (!this.triggeredFmp4Usage) {
  78985. this.tech_.trigger({
  78986. type: "usage",
  78987. name: "vhs-fmp4"
  78988. });
  78989. this.triggeredFmp4Usage = true;
  78990. }
  78991. });
  78992. this.audioSegmentLoader_.on("ended", () => {
  78993. this.logger_("audioSegmentLoader ended");
  78994. this.onEndOfStream();
  78995. });
  78996. }
  78997. mediaSecondsLoaded_() {
  78998. return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded + this.mainSegmentLoader_.mediaSecondsLoaded);
  78999. }
  79000. load() {
  79001. this.mainSegmentLoader_.load();
  79002. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  79003. this.audioSegmentLoader_.load();
  79004. }
  79005. if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {
  79006. this.subtitleSegmentLoader_.load();
  79007. }
  79008. }
  79009. fastQualityChange_(media = this.selectPlaylist()) {
  79010. if (media === this.mainPlaylistLoader_.media()) {
  79011. this.logger_("skipping fastQualityChange because new media is same as old");
  79012. return;
  79013. }
  79014. this.switchMedia_(media, "fast-quality");
  79015. this.mainSegmentLoader_.resetEverything(() => {
  79016. if (videojs$2.browser.IE_VERSION || videojs$2.browser.IS_EDGE) {
  79017. this.tech_.setCurrentTime(this.tech_.currentTime() + 0.04);
  79018. } else {
  79019. this.tech_.setCurrentTime(this.tech_.currentTime());
  79020. }
  79021. });
  79022. }
  79023. play() {
  79024. if (this.setupFirstPlay()) {
  79025. return;
  79026. }
  79027. if (this.tech_.ended()) {
  79028. this.tech_.setCurrentTime(0);
  79029. }
  79030. if (this.hasPlayed_) {
  79031. this.load();
  79032. }
  79033. const seekable3 = this.tech_.seekable();
  79034. if (this.tech_.duration() === Infinity) {
  79035. if (this.tech_.currentTime() < seekable3.start(0)) {
  79036. return this.tech_.setCurrentTime(seekable3.end(seekable3.length - 1));
  79037. }
  79038. }
  79039. }
  79040. setupFirstPlay() {
  79041. const media = this.mainPlaylistLoader_.media();
  79042. if (!media || this.tech_.paused() || this.hasPlayed_) {
  79043. return false;
  79044. }
  79045. if (!media.endList) {
  79046. const seekable3 = this.seekable();
  79047. if (!seekable3.length) {
  79048. return false;
  79049. }
  79050. if (videojs$2.browser.IE_VERSION && this.tech_.readyState() === 0) {
  79051. this.tech_.one("loadedmetadata", () => {
  79052. this.trigger("firstplay");
  79053. this.tech_.setCurrentTime(seekable3.end(0));
  79054. this.hasPlayed_ = true;
  79055. });
  79056. return false;
  79057. }
  79058. this.trigger("firstplay");
  79059. this.tech_.setCurrentTime(seekable3.end(0));
  79060. }
  79061. this.hasPlayed_ = true;
  79062. this.load();
  79063. return true;
  79064. }
  79065. handleSourceOpen_() {
  79066. this.tryToCreateSourceBuffers_();
  79067. if (this.tech_.autoplay()) {
  79068. const playPromise = this.tech_.play();
  79069. if (typeof playPromise !== "undefined" && typeof playPromise.then === "function") {
  79070. playPromise.then(null, (e) => {
  79071. });
  79072. }
  79073. }
  79074. this.trigger("sourceopen");
  79075. }
  79076. handleSourceEnded_() {
  79077. if (!this.inbandTextTracks_.metadataTrack_) {
  79078. return;
  79079. }
  79080. const cues = this.inbandTextTracks_.metadataTrack_.cues;
  79081. if (!cues || !cues.length) {
  79082. return;
  79083. }
  79084. const duration5 = this.duration();
  79085. cues[cues.length - 1].endTime = isNaN(duration5) || Math.abs(duration5) === Infinity ? Number.MAX_VALUE : duration5;
  79086. }
  79087. handleDurationChange_() {
  79088. this.tech_.trigger("durationchange");
  79089. }
  79090. onEndOfStream() {
  79091. let isEndOfStream = this.mainSegmentLoader_.ended_;
  79092. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  79093. const mainMediaInfo = this.mainSegmentLoader_.getCurrentMediaInfo_();
  79094. if (!mainMediaInfo || mainMediaInfo.hasVideo) {
  79095. isEndOfStream = isEndOfStream && this.audioSegmentLoader_.ended_;
  79096. } else {
  79097. isEndOfStream = this.audioSegmentLoader_.ended_;
  79098. }
  79099. }
  79100. if (!isEndOfStream) {
  79101. return;
  79102. }
  79103. this.stopABRTimer_();
  79104. this.sourceUpdater_.endOfStream();
  79105. }
  79106. stuckAtPlaylistEnd_(playlist) {
  79107. const seekable3 = this.seekable();
  79108. if (!seekable3.length) {
  79109. return false;
  79110. }
  79111. const expired = this.syncController_.getExpiredTime(playlist, this.duration());
  79112. if (expired === null) {
  79113. return false;
  79114. }
  79115. const absolutePlaylistEnd = Vhs$1$1.Playlist.playlistEnd(playlist, expired);
  79116. const currentTime = this.tech_.currentTime();
  79117. const buffered = this.tech_.buffered();
  79118. if (!buffered.length) {
  79119. return absolutePlaylistEnd - currentTime <= SAFE_TIME_DELTA$1;
  79120. }
  79121. const bufferedEnd = buffered.end(buffered.length - 1);
  79122. return bufferedEnd - currentTime <= SAFE_TIME_DELTA$1 && absolutePlaylistEnd - bufferedEnd <= SAFE_TIME_DELTA$1;
  79123. }
  79124. excludePlaylist({
  79125. playlistToExclude = this.mainPlaylistLoader_.media(),
  79126. error = {},
  79127. playlistExclusionDuration
  79128. }) {
  79129. playlistToExclude = playlistToExclude || this.mainPlaylistLoader_.media();
  79130. playlistExclusionDuration = playlistExclusionDuration || error.playlistExclusionDuration || this.playlistExclusionDuration;
  79131. if (!playlistToExclude) {
  79132. this.error = error;
  79133. if (this.mediaSource.readyState !== "open") {
  79134. this.trigger("error");
  79135. } else {
  79136. this.sourceUpdater_.endOfStream("network");
  79137. }
  79138. return;
  79139. }
  79140. playlistToExclude.playlistErrors_++;
  79141. const playlists = this.mainPlaylistLoader_.main.playlists;
  79142. const enabledPlaylists = playlists.filter(isEnabled$1);
  79143. const isFinalRendition = enabledPlaylists.length === 1 && enabledPlaylists[0] === playlistToExclude;
  79144. if (playlists.length === 1 && playlistExclusionDuration !== Infinity) {
  79145. videojs$2.log.warn(`Problem encountered with playlist ${playlistToExclude.id}. Trying again since it is the only playlist.`);
  79146. this.tech_.trigger("retryplaylist");
  79147. return this.mainPlaylistLoader_.load(isFinalRendition);
  79148. }
  79149. if (isFinalRendition) {
  79150. let reincluded = false;
  79151. playlists.forEach((playlist) => {
  79152. if (playlist === playlistToExclude) {
  79153. return;
  79154. }
  79155. const excludeUntil2 = playlist.excludeUntil;
  79156. if (typeof excludeUntil2 !== "undefined" && excludeUntil2 !== Infinity) {
  79157. reincluded = true;
  79158. delete playlist.excludeUntil;
  79159. }
  79160. });
  79161. if (reincluded) {
  79162. videojs$2.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded.");
  79163. this.tech_.trigger("retryplaylist");
  79164. }
  79165. }
  79166. let excludeUntil;
  79167. if (playlistToExclude.playlistErrors_ > this.maxPlaylistRetries) {
  79168. excludeUntil = Infinity;
  79169. } else {
  79170. excludeUntil = Date.now() + playlistExclusionDuration * 1e3;
  79171. }
  79172. playlistToExclude.excludeUntil = excludeUntil;
  79173. if (error.reason) {
  79174. playlistToExclude.lastExcludeReason_ = error.reason;
  79175. }
  79176. this.tech_.trigger("excludeplaylist");
  79177. this.tech_.trigger({
  79178. type: "usage",
  79179. name: "vhs-rendition-excluded"
  79180. });
  79181. const nextPlaylist = this.selectPlaylist();
  79182. if (!nextPlaylist) {
  79183. this.error = "Playback cannot continue. No available working or supported playlists.";
  79184. this.trigger("error");
  79185. return;
  79186. }
  79187. const logFn2 = error.internal ? this.logger_ : videojs$2.log.warn;
  79188. const errorMessage = error.message ? " " + error.message : "";
  79189. logFn2(`${error.internal ? "Internal problem" : "Problem"} encountered with playlist ${playlistToExclude.id}.${errorMessage} Switching to playlist ${nextPlaylist.id}.`);
  79190. if (nextPlaylist.attributes.AUDIO !== playlistToExclude.attributes.AUDIO) {
  79191. this.delegateLoaders_("audio", ["abort", "pause"]);
  79192. }
  79193. if (nextPlaylist.attributes.SUBTITLES !== playlistToExclude.attributes.SUBTITLES) {
  79194. this.delegateLoaders_("subtitle", ["abort", "pause"]);
  79195. }
  79196. this.delegateLoaders_("main", ["abort", "pause"]);
  79197. const delayDuration = nextPlaylist.targetDuration / 2 * 1e3 || 5 * 1e3;
  79198. const shouldDelay = typeof nextPlaylist.lastRequest === "number" && Date.now() - nextPlaylist.lastRequest <= delayDuration;
  79199. return this.switchMedia_(nextPlaylist, "exclude", isFinalRendition || shouldDelay);
  79200. }
  79201. pauseLoading() {
  79202. this.delegateLoaders_("all", ["abort", "pause"]);
  79203. this.stopABRTimer_();
  79204. }
  79205. delegateLoaders_(filter, fnNames) {
  79206. const loaders = [];
  79207. const dontFilterPlaylist = filter === "all";
  79208. if (dontFilterPlaylist || filter === "main") {
  79209. loaders.push(this.mainPlaylistLoader_);
  79210. }
  79211. const mediaTypes2 = [];
  79212. if (dontFilterPlaylist || filter === "audio") {
  79213. mediaTypes2.push("AUDIO");
  79214. }
  79215. if (dontFilterPlaylist || filter === "subtitle") {
  79216. mediaTypes2.push("CLOSED-CAPTIONS");
  79217. mediaTypes2.push("SUBTITLES");
  79218. }
  79219. mediaTypes2.forEach((mediaType) => {
  79220. const loader = this.mediaTypes_[mediaType] && this.mediaTypes_[mediaType].activePlaylistLoader;
  79221. if (loader) {
  79222. loaders.push(loader);
  79223. }
  79224. });
  79225. ["main", "audio", "subtitle"].forEach((name) => {
  79226. const loader = this[`${name}SegmentLoader_`];
  79227. if (loader && (filter === name || filter === "all")) {
  79228. loaders.push(loader);
  79229. }
  79230. });
  79231. loaders.forEach((loader) => fnNames.forEach((fnName) => {
  79232. if (typeof loader[fnName] === "function") {
  79233. loader[fnName]();
  79234. }
  79235. }));
  79236. }
  79237. setCurrentTime(currentTime) {
  79238. const buffered = findRange$1(this.tech_.buffered(), currentTime);
  79239. if (!(this.mainPlaylistLoader_ && this.mainPlaylistLoader_.media())) {
  79240. return 0;
  79241. }
  79242. if (!this.mainPlaylistLoader_.media().segments) {
  79243. return 0;
  79244. }
  79245. if (buffered && buffered.length) {
  79246. return currentTime;
  79247. }
  79248. this.mainSegmentLoader_.resetEverything();
  79249. this.mainSegmentLoader_.abort();
  79250. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  79251. this.audioSegmentLoader_.resetEverything();
  79252. this.audioSegmentLoader_.abort();
  79253. }
  79254. if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {
  79255. this.subtitleSegmentLoader_.resetEverything();
  79256. this.subtitleSegmentLoader_.abort();
  79257. }
  79258. this.load();
  79259. }
  79260. duration() {
  79261. if (!this.mainPlaylistLoader_) {
  79262. return 0;
  79263. }
  79264. const media = this.mainPlaylistLoader_.media();
  79265. if (!media) {
  79266. return 0;
  79267. }
  79268. if (!media.endList) {
  79269. return Infinity;
  79270. }
  79271. if (this.mediaSource) {
  79272. return this.mediaSource.duration;
  79273. }
  79274. return Vhs$1$1.Playlist.duration(media);
  79275. }
  79276. seekable() {
  79277. return this.seekable_;
  79278. }
  79279. onSyncInfoUpdate_() {
  79280. let audioSeekable;
  79281. if (!this.mainPlaylistLoader_) {
  79282. return;
  79283. }
  79284. let media = this.mainPlaylistLoader_.media();
  79285. if (!media) {
  79286. return;
  79287. }
  79288. let expired = this.syncController_.getExpiredTime(media, this.duration());
  79289. if (expired === null) {
  79290. return;
  79291. }
  79292. const main = this.mainPlaylistLoader_.main;
  79293. const mainSeekable = Vhs$1$1.Playlist.seekable(media, expired, Vhs$1$1.Playlist.liveEdgeDelay(main, media));
  79294. if (mainSeekable.length === 0) {
  79295. return;
  79296. }
  79297. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  79298. media = this.mediaTypes_.AUDIO.activePlaylistLoader.media();
  79299. expired = this.syncController_.getExpiredTime(media, this.duration());
  79300. if (expired === null) {
  79301. return;
  79302. }
  79303. audioSeekable = Vhs$1$1.Playlist.seekable(media, expired, Vhs$1$1.Playlist.liveEdgeDelay(main, media));
  79304. if (audioSeekable.length === 0) {
  79305. return;
  79306. }
  79307. }
  79308. let oldEnd;
  79309. let oldStart;
  79310. if (this.seekable_ && this.seekable_.length) {
  79311. oldEnd = this.seekable_.end(0);
  79312. oldStart = this.seekable_.start(0);
  79313. }
  79314. if (!audioSeekable) {
  79315. this.seekable_ = mainSeekable;
  79316. } else if (audioSeekable.start(0) > mainSeekable.end(0) || mainSeekable.start(0) > audioSeekable.end(0)) {
  79317. this.seekable_ = mainSeekable;
  79318. } else {
  79319. this.seekable_ = createTimeRanges$2([[audioSeekable.start(0) > mainSeekable.start(0) ? audioSeekable.start(0) : mainSeekable.start(0), audioSeekable.end(0) < mainSeekable.end(0) ? audioSeekable.end(0) : mainSeekable.end(0)]]);
  79320. }
  79321. if (this.seekable_ && this.seekable_.length) {
  79322. if (this.seekable_.end(0) === oldEnd && this.seekable_.start(0) === oldStart) {
  79323. return;
  79324. }
  79325. }
  79326. this.logger_(`seekable updated [${printableRange$1(this.seekable_)}]`);
  79327. this.tech_.trigger("seekablechanged");
  79328. }
  79329. updateDuration(isLive) {
  79330. if (this.updateDuration_) {
  79331. this.mediaSource.removeEventListener("sourceopen", this.updateDuration_);
  79332. this.updateDuration_ = null;
  79333. }
  79334. if (this.mediaSource.readyState !== "open") {
  79335. this.updateDuration_ = this.updateDuration.bind(this, isLive);
  79336. this.mediaSource.addEventListener("sourceopen", this.updateDuration_);
  79337. return;
  79338. }
  79339. if (isLive) {
  79340. const seekable3 = this.seekable();
  79341. if (!seekable3.length) {
  79342. return;
  79343. }
  79344. if (isNaN(this.mediaSource.duration) || this.mediaSource.duration < seekable3.end(seekable3.length - 1)) {
  79345. this.sourceUpdater_.setDuration(seekable3.end(seekable3.length - 1));
  79346. }
  79347. return;
  79348. }
  79349. const buffered = this.tech_.buffered();
  79350. let duration5 = Vhs$1$1.Playlist.duration(this.mainPlaylistLoader_.media());
  79351. if (buffered.length > 0) {
  79352. duration5 = Math.max(duration5, buffered.end(buffered.length - 1));
  79353. }
  79354. if (this.mediaSource.duration !== duration5) {
  79355. this.sourceUpdater_.setDuration(duration5);
  79356. }
  79357. }
  79358. dispose() {
  79359. this.trigger("dispose");
  79360. this.decrypter_.terminate();
  79361. this.mainPlaylistLoader_.dispose();
  79362. this.mainSegmentLoader_.dispose();
  79363. if (this.loadOnPlay_) {
  79364. this.tech_.off("play", this.loadOnPlay_);
  79365. }
  79366. ["AUDIO", "SUBTITLES"].forEach((type2) => {
  79367. const groups = this.mediaTypes_[type2].groups;
  79368. for (const id in groups) {
  79369. groups[id].forEach((group) => {
  79370. if (group.playlistLoader) {
  79371. group.playlistLoader.dispose();
  79372. }
  79373. });
  79374. }
  79375. });
  79376. this.audioSegmentLoader_.dispose();
  79377. this.subtitleSegmentLoader_.dispose();
  79378. this.sourceUpdater_.dispose();
  79379. this.timelineChangeController_.dispose();
  79380. this.stopABRTimer_();
  79381. if (this.updateDuration_) {
  79382. this.mediaSource.removeEventListener("sourceopen", this.updateDuration_);
  79383. }
  79384. this.mediaSource.removeEventListener("durationchange", this.handleDurationChange_);
  79385. this.mediaSource.removeEventListener("sourceopen", this.handleSourceOpen_);
  79386. this.mediaSource.removeEventListener("sourceended", this.handleSourceEnded_);
  79387. this.off();
  79388. }
  79389. main() {
  79390. return this.mainPlaylistLoader_.main;
  79391. }
  79392. media() {
  79393. return this.mainPlaylistLoader_.media() || this.initialMedia_;
  79394. }
  79395. areMediaTypesKnown_() {
  79396. const usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader;
  79397. const hasMainMediaInfo = !!this.mainSegmentLoader_.getCurrentMediaInfo_();
  79398. const hasAudioMediaInfo = !usingAudioLoader ? true : !!this.audioSegmentLoader_.getCurrentMediaInfo_();
  79399. if (!hasMainMediaInfo || !hasAudioMediaInfo) {
  79400. return false;
  79401. }
  79402. return true;
  79403. }
  79404. getCodecsOrExclude_() {
  79405. const media = {
  79406. main: this.mainSegmentLoader_.getCurrentMediaInfo_() || {},
  79407. audio: this.audioSegmentLoader_.getCurrentMediaInfo_() || {}
  79408. };
  79409. const playlist = this.mainSegmentLoader_.getPendingSegmentPlaylist() || this.media();
  79410. media.video = media.main;
  79411. const playlistCodecs = codecsForPlaylist$1(this.main(), playlist);
  79412. const codecs = {};
  79413. const usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader;
  79414. if (media.main.hasVideo) {
  79415. codecs.video = playlistCodecs.video || media.main.videoCodec || DEFAULT_VIDEO_CODEC$1;
  79416. }
  79417. if (media.main.isMuxed) {
  79418. codecs.video += `,${playlistCodecs.audio || media.main.audioCodec || DEFAULT_AUDIO_CODEC$1}`;
  79419. }
  79420. if (media.main.hasAudio && !media.main.isMuxed || media.audio.hasAudio || usingAudioLoader) {
  79421. codecs.audio = playlistCodecs.audio || media.main.audioCodec || media.audio.audioCodec || DEFAULT_AUDIO_CODEC$1;
  79422. media.audio.isFmp4 = media.main.hasAudio && !media.main.isMuxed ? media.main.isFmp4 : media.audio.isFmp4;
  79423. }
  79424. if (!codecs.audio && !codecs.video) {
  79425. this.excludePlaylist({
  79426. playlistToExclude: playlist,
  79427. error: {
  79428. message: "Could not determine codecs for playlist."
  79429. },
  79430. playlistExclusionDuration: Infinity
  79431. });
  79432. return;
  79433. }
  79434. const supportFunction = (isFmp4, codec) => isFmp4 ? browserSupportsCodec$1(codec) : muxerSupportsCodec$1(codec);
  79435. const unsupportedCodecs = {};
  79436. let unsupportedAudio;
  79437. ["video", "audio"].forEach(function(type2) {
  79438. if (codecs.hasOwnProperty(type2) && !supportFunction(media[type2].isFmp4, codecs[type2])) {
  79439. const supporter = media[type2].isFmp4 ? "browser" : "muxer";
  79440. unsupportedCodecs[supporter] = unsupportedCodecs[supporter] || [];
  79441. unsupportedCodecs[supporter].push(codecs[type2]);
  79442. if (type2 === "audio") {
  79443. unsupportedAudio = supporter;
  79444. }
  79445. }
  79446. });
  79447. if (usingAudioLoader && unsupportedAudio && playlist.attributes.AUDIO) {
  79448. const audioGroup = playlist.attributes.AUDIO;
  79449. this.main().playlists.forEach((variant) => {
  79450. const variantAudioGroup = variant.attributes && variant.attributes.AUDIO;
  79451. if (variantAudioGroup === audioGroup && variant !== playlist) {
  79452. variant.excludeUntil = Infinity;
  79453. }
  79454. });
  79455. this.logger_(`excluding audio group ${audioGroup} as ${unsupportedAudio} does not support codec(s): "${codecs.audio}"`);
  79456. }
  79457. if (Object.keys(unsupportedCodecs).length) {
  79458. const message = Object.keys(unsupportedCodecs).reduce((acc, supporter) => {
  79459. if (acc) {
  79460. acc += ", ";
  79461. }
  79462. acc += `${supporter} does not support codec(s): "${unsupportedCodecs[supporter].join(",")}"`;
  79463. return acc;
  79464. }, "") + ".";
  79465. this.excludePlaylist({
  79466. playlistToExclude: playlist,
  79467. error: {
  79468. internal: true,
  79469. message
  79470. },
  79471. playlistExclusionDuration: Infinity
  79472. });
  79473. return;
  79474. }
  79475. if (this.sourceUpdater_.hasCreatedSourceBuffers() && !this.sourceUpdater_.canChangeType()) {
  79476. const switchMessages = [];
  79477. ["video", "audio"].forEach((type2) => {
  79478. const newCodec = (parseCodecs$1(this.sourceUpdater_.codecs[type2] || "")[0] || {}).type;
  79479. const oldCodec = (parseCodecs$1(codecs[type2] || "")[0] || {}).type;
  79480. if (newCodec && oldCodec && newCodec.toLowerCase() !== oldCodec.toLowerCase()) {
  79481. switchMessages.push(`"${this.sourceUpdater_.codecs[type2]}" -> "${codecs[type2]}"`);
  79482. }
  79483. });
  79484. if (switchMessages.length) {
  79485. this.excludePlaylist({
  79486. playlistToExclude: playlist,
  79487. error: {
  79488. message: `Codec switching not supported: ${switchMessages.join(", ")}.`,
  79489. internal: true
  79490. },
  79491. playlistExclusionDuration: Infinity
  79492. });
  79493. return;
  79494. }
  79495. }
  79496. return codecs;
  79497. }
  79498. tryToCreateSourceBuffers_() {
  79499. if (this.mediaSource.readyState !== "open" || this.sourceUpdater_.hasCreatedSourceBuffers()) {
  79500. return;
  79501. }
  79502. if (!this.areMediaTypesKnown_()) {
  79503. return;
  79504. }
  79505. const codecs = this.getCodecsOrExclude_();
  79506. if (!codecs) {
  79507. return;
  79508. }
  79509. this.sourceUpdater_.createSourceBuffers(codecs);
  79510. const codecString = [codecs.video, codecs.audio].filter(Boolean).join(",");
  79511. this.excludeIncompatibleVariants_(codecString);
  79512. }
  79513. excludeUnsupportedVariants_() {
  79514. const playlists = this.main().playlists;
  79515. const ids = [];
  79516. Object.keys(playlists).forEach((key) => {
  79517. const variant = playlists[key];
  79518. if (ids.indexOf(variant.id) !== -1) {
  79519. return;
  79520. }
  79521. ids.push(variant.id);
  79522. const codecs = codecsForPlaylist$1(this.main, variant);
  79523. const unsupported = [];
  79524. if (codecs.audio && !muxerSupportsCodec$1(codecs.audio) && !browserSupportsCodec$1(codecs.audio)) {
  79525. unsupported.push(`audio codec ${codecs.audio}`);
  79526. }
  79527. if (codecs.video && !muxerSupportsCodec$1(codecs.video) && !browserSupportsCodec$1(codecs.video)) {
  79528. unsupported.push(`video codec ${codecs.video}`);
  79529. }
  79530. if (codecs.text && codecs.text === "stpp.ttml.im1t") {
  79531. unsupported.push(`text codec ${codecs.text}`);
  79532. }
  79533. if (unsupported.length) {
  79534. variant.excludeUntil = Infinity;
  79535. this.logger_(`excluding ${variant.id} for unsupported: ${unsupported.join(", ")}`);
  79536. }
  79537. });
  79538. }
  79539. excludeIncompatibleVariants_(codecString) {
  79540. const ids = [];
  79541. const playlists = this.main().playlists;
  79542. const codecs = unwrapCodecList$1(parseCodecs$1(codecString));
  79543. const codecCount_ = codecCount$1(codecs);
  79544. const videoDetails = codecs.video && parseCodecs$1(codecs.video)[0] || null;
  79545. const audioDetails = codecs.audio && parseCodecs$1(codecs.audio)[0] || null;
  79546. Object.keys(playlists).forEach((key) => {
  79547. const variant = playlists[key];
  79548. if (ids.indexOf(variant.id) !== -1 || variant.excludeUntil === Infinity) {
  79549. return;
  79550. }
  79551. ids.push(variant.id);
  79552. const exclusionReasons = [];
  79553. const variantCodecs = codecsForPlaylist$1(this.mainPlaylistLoader_.main, variant);
  79554. const variantCodecCount = codecCount$1(variantCodecs);
  79555. if (!variantCodecs.audio && !variantCodecs.video) {
  79556. return;
  79557. }
  79558. if (variantCodecCount !== codecCount_) {
  79559. exclusionReasons.push(`codec count "${variantCodecCount}" !== "${codecCount_}"`);
  79560. }
  79561. if (!this.sourceUpdater_.canChangeType()) {
  79562. const variantVideoDetails = variantCodecs.video && parseCodecs$1(variantCodecs.video)[0] || null;
  79563. const variantAudioDetails = variantCodecs.audio && parseCodecs$1(variantCodecs.audio)[0] || null;
  79564. if (variantVideoDetails && videoDetails && variantVideoDetails.type.toLowerCase() !== videoDetails.type.toLowerCase()) {
  79565. exclusionReasons.push(`video codec "${variantVideoDetails.type}" !== "${videoDetails.type}"`);
  79566. }
  79567. if (variantAudioDetails && audioDetails && variantAudioDetails.type.toLowerCase() !== audioDetails.type.toLowerCase()) {
  79568. exclusionReasons.push(`audio codec "${variantAudioDetails.type}" !== "${audioDetails.type}"`);
  79569. }
  79570. }
  79571. if (exclusionReasons.length) {
  79572. variant.excludeUntil = Infinity;
  79573. this.logger_(`excluding ${variant.id}: ${exclusionReasons.join(" && ")}`);
  79574. }
  79575. });
  79576. }
  79577. updateAdCues_(media) {
  79578. let offset = 0;
  79579. const seekable3 = this.seekable();
  79580. if (seekable3.length) {
  79581. offset = seekable3.start(0);
  79582. }
  79583. updateAdCues$1(media, this.cueTagsTrack_, offset);
  79584. }
  79585. goalBufferLength() {
  79586. const currentTime = this.tech_.currentTime();
  79587. const initial = Config$1.GOAL_BUFFER_LENGTH;
  79588. const rate = Config$1.GOAL_BUFFER_LENGTH_RATE;
  79589. const max2 = Math.max(initial, Config$1.MAX_GOAL_BUFFER_LENGTH);
  79590. return Math.min(initial + currentTime * rate, max2);
  79591. }
  79592. bufferLowWaterLine() {
  79593. const currentTime = this.tech_.currentTime();
  79594. const initial = Config$1.BUFFER_LOW_WATER_LINE;
  79595. const rate = Config$1.BUFFER_LOW_WATER_LINE_RATE;
  79596. const max2 = Math.max(initial, Config$1.MAX_BUFFER_LOW_WATER_LINE);
  79597. const newMax = Math.max(initial, Config$1.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);
  79598. return Math.min(initial + currentTime * rate, this.bufferBasedABR ? newMax : max2);
  79599. }
  79600. bufferHighWaterLine() {
  79601. return Config$1.BUFFER_HIGH_WATER_LINE;
  79602. }
  79603. }
  79604. const enableFunction$1 = (loader, playlistID, changePlaylistFn) => (enable) => {
  79605. const playlist = loader.main.playlists[playlistID];
  79606. const incompatible = isIncompatible$1(playlist);
  79607. const currentlyEnabled = isEnabled$1(playlist);
  79608. if (typeof enable === "undefined") {
  79609. return currentlyEnabled;
  79610. }
  79611. if (enable) {
  79612. delete playlist.disabled;
  79613. } else {
  79614. playlist.disabled = true;
  79615. }
  79616. if (enable !== currentlyEnabled && !incompatible) {
  79617. changePlaylistFn();
  79618. if (enable) {
  79619. loader.trigger("renditionenabled");
  79620. } else {
  79621. loader.trigger("renditiondisabled");
  79622. }
  79623. }
  79624. return enable;
  79625. };
  79626. class Representation$1 {
  79627. constructor(vhsHandler, playlist, id) {
  79628. const {
  79629. playlistController_: pc
  79630. } = vhsHandler;
  79631. const qualityChangeFunction = pc.fastQualityChange_.bind(pc);
  79632. if (playlist.attributes) {
  79633. const resolution = playlist.attributes.RESOLUTION;
  79634. this.width = resolution && resolution.width;
  79635. this.height = resolution && resolution.height;
  79636. this.bandwidth = playlist.attributes.BANDWIDTH;
  79637. this.frameRate = playlist.attributes["FRAME-RATE"];
  79638. }
  79639. this.codecs = codecsForPlaylist$1(pc.main(), playlist);
  79640. this.playlist = playlist;
  79641. this.id = id;
  79642. this.enabled = enableFunction$1(vhsHandler.playlists, playlist.id, qualityChangeFunction);
  79643. }
  79644. }
  79645. const renditionSelectionMixin$1 = function(vhsHandler) {
  79646. vhsHandler.representations = () => {
  79647. const main = vhsHandler.playlistController_.main();
  79648. const playlists = isAudioOnly$1(main) ? vhsHandler.playlistController_.getAudioTrackPlaylists_() : main.playlists;
  79649. if (!playlists) {
  79650. return [];
  79651. }
  79652. return playlists.filter((media) => !isIncompatible$1(media)).map((e, i2) => new Representation$1(vhsHandler, e, e.id));
  79653. };
  79654. };
  79655. const timerCancelEvents$1 = ["seeking", "seeked", "pause", "playing", "error"];
  79656. class PlaybackWatcher$1 {
  79657. constructor(options2) {
  79658. this.playlistController_ = options2.playlistController;
  79659. this.tech_ = options2.tech;
  79660. this.seekable = options2.seekable;
  79661. this.allowSeeksWithinUnsafeLiveWindow = options2.allowSeeksWithinUnsafeLiveWindow;
  79662. this.liveRangeSafeTimeDelta = options2.liveRangeSafeTimeDelta;
  79663. this.media = options2.media;
  79664. this.consecutiveUpdates = 0;
  79665. this.lastRecordedTime = null;
  79666. this.checkCurrentTimeTimeout_ = null;
  79667. this.logger_ = logger$1("PlaybackWatcher");
  79668. this.logger_("initialize");
  79669. const playHandler = () => this.monitorCurrentTime_();
  79670. const canPlayHandler = () => this.monitorCurrentTime_();
  79671. const waitingHandler = () => this.techWaiting_();
  79672. const cancelTimerHandler = () => this.resetTimeUpdate_();
  79673. const pc = this.playlistController_;
  79674. const loaderTypes = ["main", "subtitle", "audio"];
  79675. const loaderChecks = {};
  79676. loaderTypes.forEach((type2) => {
  79677. loaderChecks[type2] = {
  79678. reset: () => this.resetSegmentDownloads_(type2),
  79679. updateend: () => this.checkSegmentDownloads_(type2)
  79680. };
  79681. pc[`${type2}SegmentLoader_`].on("appendsdone", loaderChecks[type2].updateend);
  79682. pc[`${type2}SegmentLoader_`].on("playlistupdate", loaderChecks[type2].reset);
  79683. this.tech_.on(["seeked", "seeking"], loaderChecks[type2].reset);
  79684. });
  79685. const setSeekingHandlers = (fn2) => {
  79686. ["main", "audio"].forEach((type2) => {
  79687. pc[`${type2}SegmentLoader_`][fn2]("appended", this.seekingAppendCheck_);
  79688. });
  79689. };
  79690. this.seekingAppendCheck_ = () => {
  79691. if (this.fixesBadSeeks_()) {
  79692. this.consecutiveUpdates = 0;
  79693. this.lastRecordedTime = this.tech_.currentTime();
  79694. setSeekingHandlers("off");
  79695. }
  79696. };
  79697. this.clearSeekingAppendCheck_ = () => setSeekingHandlers("off");
  79698. this.watchForBadSeeking_ = () => {
  79699. this.clearSeekingAppendCheck_();
  79700. setSeekingHandlers("on");
  79701. };
  79702. this.tech_.on("seeked", this.clearSeekingAppendCheck_);
  79703. this.tech_.on("seeking", this.watchForBadSeeking_);
  79704. this.tech_.on("waiting", waitingHandler);
  79705. this.tech_.on(timerCancelEvents$1, cancelTimerHandler);
  79706. this.tech_.on("canplay", canPlayHandler);
  79707. this.tech_.one("play", playHandler);
  79708. this.dispose = () => {
  79709. this.clearSeekingAppendCheck_();
  79710. this.logger_("dispose");
  79711. this.tech_.off("waiting", waitingHandler);
  79712. this.tech_.off(timerCancelEvents$1, cancelTimerHandler);
  79713. this.tech_.off("canplay", canPlayHandler);
  79714. this.tech_.off("play", playHandler);
  79715. this.tech_.off("seeking", this.watchForBadSeeking_);
  79716. this.tech_.off("seeked", this.clearSeekingAppendCheck_);
  79717. loaderTypes.forEach((type2) => {
  79718. pc[`${type2}SegmentLoader_`].off("appendsdone", loaderChecks[type2].updateend);
  79719. pc[`${type2}SegmentLoader_`].off("playlistupdate", loaderChecks[type2].reset);
  79720. this.tech_.off(["seeked", "seeking"], loaderChecks[type2].reset);
  79721. });
  79722. if (this.checkCurrentTimeTimeout_) {
  79723. window_1.clearTimeout(this.checkCurrentTimeTimeout_);
  79724. }
  79725. this.resetTimeUpdate_();
  79726. };
  79727. }
  79728. monitorCurrentTime_() {
  79729. this.checkCurrentTime_();
  79730. if (this.checkCurrentTimeTimeout_) {
  79731. window_1.clearTimeout(this.checkCurrentTimeTimeout_);
  79732. }
  79733. this.checkCurrentTimeTimeout_ = window_1.setTimeout(this.monitorCurrentTime_.bind(this), 250);
  79734. }
  79735. resetSegmentDownloads_(type2) {
  79736. const loader = this.playlistController_[`${type2}SegmentLoader_`];
  79737. if (this[`${type2}StalledDownloads_`] > 0) {
  79738. this.logger_(`resetting possible stalled download count for ${type2} loader`);
  79739. }
  79740. this[`${type2}StalledDownloads_`] = 0;
  79741. this[`${type2}Buffered_`] = loader.buffered_();
  79742. }
  79743. checkSegmentDownloads_(type2) {
  79744. const pc = this.playlistController_;
  79745. const loader = pc[`${type2}SegmentLoader_`];
  79746. const buffered = loader.buffered_();
  79747. const isBufferedDifferent = isRangeDifferent$1(this[`${type2}Buffered_`], buffered);
  79748. this[`${type2}Buffered_`] = buffered;
  79749. if (isBufferedDifferent) {
  79750. this.resetSegmentDownloads_(type2);
  79751. return;
  79752. }
  79753. this[`${type2}StalledDownloads_`]++;
  79754. this.logger_(`found #${this[`${type2}StalledDownloads_`]} ${type2} appends that did not increase buffer (possible stalled download)`, {
  79755. playlistId: loader.playlist_ && loader.playlist_.id,
  79756. buffered: timeRangesToArray$1(buffered)
  79757. });
  79758. if (this[`${type2}StalledDownloads_`] < 10) {
  79759. return;
  79760. }
  79761. this.logger_(`${type2} loader stalled download exclusion`);
  79762. this.resetSegmentDownloads_(type2);
  79763. this.tech_.trigger({
  79764. type: "usage",
  79765. name: `vhs-${type2}-download-exclusion`
  79766. });
  79767. if (type2 === "subtitle") {
  79768. return;
  79769. }
  79770. pc.excludePlaylist({
  79771. error: {
  79772. message: `Excessive ${type2} segment downloading detected.`
  79773. },
  79774. playlistExclusionDuration: Infinity
  79775. });
  79776. }
  79777. checkCurrentTime_() {
  79778. if (this.tech_.paused() || this.tech_.seeking()) {
  79779. return;
  79780. }
  79781. const currentTime = this.tech_.currentTime();
  79782. const buffered = this.tech_.buffered();
  79783. if (this.lastRecordedTime === currentTime && (!buffered.length || currentTime + SAFE_TIME_DELTA$1 >= buffered.end(buffered.length - 1))) {
  79784. return this.techWaiting_();
  79785. }
  79786. if (this.consecutiveUpdates >= 5 && currentTime === this.lastRecordedTime) {
  79787. this.consecutiveUpdates++;
  79788. this.waiting_();
  79789. } else if (currentTime === this.lastRecordedTime) {
  79790. this.consecutiveUpdates++;
  79791. } else {
  79792. this.consecutiveUpdates = 0;
  79793. this.lastRecordedTime = currentTime;
  79794. }
  79795. }
  79796. resetTimeUpdate_() {
  79797. this.consecutiveUpdates = 0;
  79798. }
  79799. fixesBadSeeks_() {
  79800. const seeking = this.tech_.seeking();
  79801. if (!seeking) {
  79802. return false;
  79803. }
  79804. const seekable3 = this.seekable();
  79805. const currentTime = this.tech_.currentTime();
  79806. const isAfterSeekableRange = this.afterSeekableWindow_(seekable3, currentTime, this.media(), this.allowSeeksWithinUnsafeLiveWindow);
  79807. let seekTo;
  79808. if (isAfterSeekableRange) {
  79809. const seekableEnd = seekable3.end(seekable3.length - 1);
  79810. seekTo = seekableEnd;
  79811. }
  79812. if (this.beforeSeekableWindow_(seekable3, currentTime)) {
  79813. const seekableStart = seekable3.start(0);
  79814. seekTo = seekableStart + (seekableStart === seekable3.end(0) ? 0 : SAFE_TIME_DELTA$1);
  79815. }
  79816. if (typeof seekTo !== "undefined") {
  79817. this.logger_(`Trying to seek outside of seekable at time ${currentTime} with seekable range ${printableRange$1(seekable3)}. Seeking to ${seekTo}.`);
  79818. this.tech_.setCurrentTime(seekTo);
  79819. return true;
  79820. }
  79821. const sourceUpdater = this.playlistController_.sourceUpdater_;
  79822. const buffered = this.tech_.buffered();
  79823. const audioBuffered = sourceUpdater.audioBuffer ? sourceUpdater.audioBuffered() : null;
  79824. const videoBuffered = sourceUpdater.videoBuffer ? sourceUpdater.videoBuffered() : null;
  79825. const media = this.media();
  79826. const minAppendedDuration = media.partTargetDuration ? media.partTargetDuration : (media.targetDuration - TIME_FUDGE_FACTOR$1) * 2;
  79827. const bufferedToCheck = [audioBuffered, videoBuffered];
  79828. for (let i2 = 0; i2 < bufferedToCheck.length; i2++) {
  79829. if (!bufferedToCheck[i2]) {
  79830. continue;
  79831. }
  79832. const timeAhead = timeAheadOf$1(bufferedToCheck[i2], currentTime);
  79833. if (timeAhead < minAppendedDuration) {
  79834. return false;
  79835. }
  79836. }
  79837. const nextRange = findNextRange$1(buffered, currentTime);
  79838. if (nextRange.length === 0) {
  79839. return false;
  79840. }
  79841. seekTo = nextRange.start(0) + SAFE_TIME_DELTA$1;
  79842. this.logger_(`Buffered region starts (${nextRange.start(0)}) just beyond seek point (${currentTime}). Seeking to ${seekTo}.`);
  79843. this.tech_.setCurrentTime(seekTo);
  79844. return true;
  79845. }
  79846. waiting_() {
  79847. if (this.techWaiting_()) {
  79848. return;
  79849. }
  79850. const currentTime = this.tech_.currentTime();
  79851. const buffered = this.tech_.buffered();
  79852. const currentRange = findRange$1(buffered, currentTime);
  79853. if (currentRange.length && currentTime + 3 <= currentRange.end(0)) {
  79854. this.resetTimeUpdate_();
  79855. this.tech_.setCurrentTime(currentTime);
  79856. this.logger_(`Stopped at ${currentTime} while inside a buffered region [${currentRange.start(0)} -> ${currentRange.end(0)}]. Attempting to resume playback by seeking to the current time.`);
  79857. this.tech_.trigger({
  79858. type: "usage",
  79859. name: "vhs-unknown-waiting"
  79860. });
  79861. return;
  79862. }
  79863. }
  79864. techWaiting_() {
  79865. const seekable3 = this.seekable();
  79866. const currentTime = this.tech_.currentTime();
  79867. if (this.tech_.seeking()) {
  79868. return true;
  79869. }
  79870. if (this.beforeSeekableWindow_(seekable3, currentTime)) {
  79871. const livePoint = seekable3.end(seekable3.length - 1);
  79872. this.logger_(`Fell out of live window at time ${currentTime}. Seeking to live point (seekable end) ${livePoint}`);
  79873. this.resetTimeUpdate_();
  79874. this.tech_.setCurrentTime(livePoint);
  79875. this.tech_.trigger({
  79876. type: "usage",
  79877. name: "vhs-live-resync"
  79878. });
  79879. return true;
  79880. }
  79881. const sourceUpdater = this.tech_.vhs.playlistController_.sourceUpdater_;
  79882. const buffered = this.tech_.buffered();
  79883. const videoUnderflow = this.videoUnderflow_({
  79884. audioBuffered: sourceUpdater.audioBuffered(),
  79885. videoBuffered: sourceUpdater.videoBuffered(),
  79886. currentTime
  79887. });
  79888. if (videoUnderflow) {
  79889. this.resetTimeUpdate_();
  79890. this.tech_.setCurrentTime(currentTime);
  79891. this.tech_.trigger({
  79892. type: "usage",
  79893. name: "vhs-video-underflow"
  79894. });
  79895. return true;
  79896. }
  79897. const nextRange = findNextRange$1(buffered, currentTime);
  79898. if (nextRange.length > 0) {
  79899. this.logger_(`Stopped at ${currentTime} and seeking to ${nextRange.start(0)}`);
  79900. this.resetTimeUpdate_();
  79901. this.skipTheGap_(currentTime);
  79902. return true;
  79903. }
  79904. return false;
  79905. }
  79906. afterSeekableWindow_(seekable3, currentTime, playlist, allowSeeksWithinUnsafeLiveWindow = false) {
  79907. if (!seekable3.length) {
  79908. return false;
  79909. }
  79910. let allowedEnd = seekable3.end(seekable3.length - 1) + SAFE_TIME_DELTA$1;
  79911. const isLive = !playlist.endList;
  79912. if (isLive && allowSeeksWithinUnsafeLiveWindow) {
  79913. allowedEnd = seekable3.end(seekable3.length - 1) + playlist.targetDuration * 3;
  79914. }
  79915. if (currentTime > allowedEnd) {
  79916. return true;
  79917. }
  79918. return false;
  79919. }
  79920. beforeSeekableWindow_(seekable3, currentTime) {
  79921. if (seekable3.length && seekable3.start(0) > 0 && currentTime < seekable3.start(0) - this.liveRangeSafeTimeDelta) {
  79922. return true;
  79923. }
  79924. return false;
  79925. }
  79926. videoUnderflow_({
  79927. videoBuffered,
  79928. audioBuffered,
  79929. currentTime
  79930. }) {
  79931. if (!videoBuffered) {
  79932. return;
  79933. }
  79934. let gap;
  79935. if (videoBuffered.length && audioBuffered.length) {
  79936. const lastVideoRange = findRange$1(videoBuffered, currentTime - 3);
  79937. const videoRange = findRange$1(videoBuffered, currentTime);
  79938. const audioRange = findRange$1(audioBuffered, currentTime);
  79939. if (audioRange.length && !videoRange.length && lastVideoRange.length) {
  79940. gap = {
  79941. start: lastVideoRange.end(0),
  79942. end: audioRange.end(0)
  79943. };
  79944. }
  79945. } else {
  79946. const nextRange = findNextRange$1(videoBuffered, currentTime);
  79947. if (!nextRange.length) {
  79948. gap = this.gapFromVideoUnderflow_(videoBuffered, currentTime);
  79949. }
  79950. }
  79951. if (gap) {
  79952. this.logger_(`Encountered a gap in video from ${gap.start} to ${gap.end}. Seeking to current time ${currentTime}`);
  79953. return true;
  79954. }
  79955. return false;
  79956. }
  79957. skipTheGap_(scheduledCurrentTime) {
  79958. const buffered = this.tech_.buffered();
  79959. const currentTime = this.tech_.currentTime();
  79960. const nextRange = findNextRange$1(buffered, currentTime);
  79961. this.resetTimeUpdate_();
  79962. if (nextRange.length === 0 || currentTime !== scheduledCurrentTime) {
  79963. return;
  79964. }
  79965. this.logger_("skipTheGap_:", "currentTime:", currentTime, "scheduled currentTime:", scheduledCurrentTime, "nextRange start:", nextRange.start(0));
  79966. this.tech_.setCurrentTime(nextRange.start(0) + TIME_FUDGE_FACTOR$1);
  79967. this.tech_.trigger({
  79968. type: "usage",
  79969. name: "vhs-gap-skip"
  79970. });
  79971. }
  79972. gapFromVideoUnderflow_(buffered, currentTime) {
  79973. const gaps = findGaps$1(buffered);
  79974. for (let i2 = 0; i2 < gaps.length; i2++) {
  79975. const start2 = gaps.start(i2);
  79976. const end = gaps.end(i2);
  79977. if (currentTime - start2 < 4 && currentTime - start2 > 2) {
  79978. return {
  79979. start: start2,
  79980. end
  79981. };
  79982. }
  79983. }
  79984. return null;
  79985. }
  79986. }
  79987. const defaultOptions$1 = {
  79988. errorInterval: 30,
  79989. getSource(next) {
  79990. const tech = this.tech({
  79991. IWillNotUseThisInPlugins: true
  79992. });
  79993. const sourceObj = tech.currentSource_ || this.currentSource();
  79994. return next(sourceObj);
  79995. }
  79996. };
  79997. const initPlugin$2 = function(player, options2) {
  79998. let lastCalled = 0;
  79999. let seekTo = 0;
  80000. const localOptions = merge$2(defaultOptions$1, options2);
  80001. player.ready(() => {
  80002. player.trigger({
  80003. type: "usage",
  80004. name: "vhs-error-reload-initialized"
  80005. });
  80006. });
  80007. const loadedMetadataHandler = function() {
  80008. if (seekTo) {
  80009. player.currentTime(seekTo);
  80010. }
  80011. };
  80012. const setSource2 = function(sourceObj) {
  80013. if (sourceObj === null || sourceObj === void 0) {
  80014. return;
  80015. }
  80016. seekTo = player.duration() !== Infinity && player.currentTime() || 0;
  80017. player.one("loadedmetadata", loadedMetadataHandler);
  80018. player.src(sourceObj);
  80019. player.trigger({
  80020. type: "usage",
  80021. name: "vhs-error-reload"
  80022. });
  80023. player.play();
  80024. };
  80025. const errorHandler = function() {
  80026. if (Date.now() - lastCalled < localOptions.errorInterval * 1e3) {
  80027. player.trigger({
  80028. type: "usage",
  80029. name: "vhs-error-reload-canceled"
  80030. });
  80031. return;
  80032. }
  80033. if (!localOptions.getSource || typeof localOptions.getSource !== "function") {
  80034. videojs$2.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");
  80035. return;
  80036. }
  80037. lastCalled = Date.now();
  80038. return localOptions.getSource.call(player, setSource2);
  80039. };
  80040. const cleanupEvents = function() {
  80041. player.off("loadedmetadata", loadedMetadataHandler);
  80042. player.off("error", errorHandler);
  80043. player.off("dispose", cleanupEvents);
  80044. };
  80045. const reinitPlugin = function(newOptions) {
  80046. cleanupEvents();
  80047. initPlugin$2(player, newOptions);
  80048. };
  80049. player.on("error", errorHandler);
  80050. player.on("dispose", cleanupEvents);
  80051. player.reloadSourceOnError = reinitPlugin;
  80052. };
  80053. const reloadSourceOnError$1 = function(options2) {
  80054. initPlugin$2(this, options2);
  80055. };
  80056. var version$4$1 = "3.0.2";
  80057. var version$3$1 = "6.3.0";
  80058. var version$2$1 = "1.0.1";
  80059. var version$1$2 = "6.0.0";
  80060. var version$7 = "4.0.1";
  80061. const Vhs$2 = {
  80062. PlaylistLoader: PlaylistLoader$1,
  80063. Playlist: Playlist$1,
  80064. utils: utils$1,
  80065. STANDARD_PLAYLIST_SELECTOR: lastBandwidthSelector$1,
  80066. INITIAL_PLAYLIST_SELECTOR: lowestBitrateCompatibleVariantSelector$1,
  80067. lastBandwidthSelector: lastBandwidthSelector$1,
  80068. movingAverageBandwidthSelector: movingAverageBandwidthSelector$1,
  80069. comparePlaylistBandwidth: comparePlaylistBandwidth$1,
  80070. comparePlaylistResolution: comparePlaylistResolution$1,
  80071. xhr: xhrFactory$1()
  80072. };
  80073. Object.keys(Config$1).forEach((prop) => {
  80074. Object.defineProperty(Vhs$2, prop, {
  80075. get() {
  80076. videojs$2.log.warn(`using Vhs.${prop} is UNSAFE be sure you know what you are doing`);
  80077. return Config$1[prop];
  80078. },
  80079. set(value) {
  80080. videojs$2.log.warn(`using Vhs.${prop} is UNSAFE be sure you know what you are doing`);
  80081. if (typeof value !== "number" || value < 0) {
  80082. videojs$2.log.warn(`value of Vhs.${prop} must be greater than or equal to 0`);
  80083. return;
  80084. }
  80085. Config$1[prop] = value;
  80086. }
  80087. });
  80088. });
  80089. const LOCAL_STORAGE_KEY$2 = "videojs-vhs";
  80090. const handleVhsMediaChange$1 = function(qualityLevels2, playlistLoader) {
  80091. const newPlaylist = playlistLoader.media();
  80092. let selectedIndex = -1;
  80093. for (let i2 = 0; i2 < qualityLevels2.length; i2++) {
  80094. if (qualityLevels2[i2].id === newPlaylist.id) {
  80095. selectedIndex = i2;
  80096. break;
  80097. }
  80098. }
  80099. qualityLevels2.selectedIndex_ = selectedIndex;
  80100. qualityLevels2.trigger({
  80101. selectedIndex,
  80102. type: "change"
  80103. });
  80104. };
  80105. const handleVhsLoadedMetadata$1 = function(qualityLevels2, vhs) {
  80106. vhs.representations().forEach((rep2) => {
  80107. qualityLevels2.addQualityLevel(rep2);
  80108. });
  80109. handleVhsMediaChange$1(qualityLevels2, vhs.playlists);
  80110. };
  80111. Vhs$2.canPlaySource = function() {
  80112. return videojs$2.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.");
  80113. };
  80114. const emeKeySystems$1 = (keySystemOptions, mainPlaylist, audioPlaylist) => {
  80115. if (!keySystemOptions) {
  80116. return keySystemOptions;
  80117. }
  80118. let codecs = {};
  80119. if (mainPlaylist && mainPlaylist.attributes && mainPlaylist.attributes.CODECS) {
  80120. codecs = unwrapCodecList$1(parseCodecs$1(mainPlaylist.attributes.CODECS));
  80121. }
  80122. if (audioPlaylist && audioPlaylist.attributes && audioPlaylist.attributes.CODECS) {
  80123. codecs.audio = audioPlaylist.attributes.CODECS;
  80124. }
  80125. const videoContentType = getMimeForCodec$1(codecs.video);
  80126. const audioContentType = getMimeForCodec$1(codecs.audio);
  80127. const keySystemContentTypes = {};
  80128. for (const keySystem in keySystemOptions) {
  80129. keySystemContentTypes[keySystem] = {};
  80130. if (audioContentType) {
  80131. keySystemContentTypes[keySystem].audioContentType = audioContentType;
  80132. }
  80133. if (videoContentType) {
  80134. keySystemContentTypes[keySystem].videoContentType = videoContentType;
  80135. }
  80136. if (mainPlaylist.contentProtection && mainPlaylist.contentProtection[keySystem] && mainPlaylist.contentProtection[keySystem].pssh) {
  80137. keySystemContentTypes[keySystem].pssh = mainPlaylist.contentProtection[keySystem].pssh;
  80138. }
  80139. if (typeof keySystemOptions[keySystem] === "string") {
  80140. keySystemContentTypes[keySystem].url = keySystemOptions[keySystem];
  80141. }
  80142. }
  80143. return merge$2(keySystemOptions, keySystemContentTypes);
  80144. };
  80145. const getAllPsshKeySystemsOptions$1 = (playlists, keySystems) => {
  80146. return playlists.reduce((keySystemsArr, playlist) => {
  80147. if (!playlist.contentProtection) {
  80148. return keySystemsArr;
  80149. }
  80150. const keySystemsOptions = keySystems.reduce((keySystemsObj, keySystem) => {
  80151. const keySystemOptions = playlist.contentProtection[keySystem];
  80152. if (keySystemOptions && keySystemOptions.pssh) {
  80153. keySystemsObj[keySystem] = {
  80154. pssh: keySystemOptions.pssh
  80155. };
  80156. }
  80157. return keySystemsObj;
  80158. }, {});
  80159. if (Object.keys(keySystemsOptions).length) {
  80160. keySystemsArr.push(keySystemsOptions);
  80161. }
  80162. return keySystemsArr;
  80163. }, []);
  80164. };
  80165. const waitForKeySessionCreation$1 = ({
  80166. player,
  80167. sourceKeySystems,
  80168. audioMedia,
  80169. mainPlaylists
  80170. }) => {
  80171. if (!player.eme.initializeMediaKeys) {
  80172. return Promise.resolve();
  80173. }
  80174. const playlists = audioMedia ? mainPlaylists.concat([audioMedia]) : mainPlaylists;
  80175. const keySystemsOptionsArr = getAllPsshKeySystemsOptions$1(playlists, Object.keys(sourceKeySystems));
  80176. const initializationFinishedPromises = [];
  80177. const keySessionCreatedPromises = [];
  80178. keySystemsOptionsArr.forEach((keySystemsOptions) => {
  80179. keySessionCreatedPromises.push(new Promise((resolve2, reject2) => {
  80180. player.tech_.one("keysessioncreated", resolve2);
  80181. }));
  80182. initializationFinishedPromises.push(new Promise((resolve2, reject2) => {
  80183. player.eme.initializeMediaKeys({
  80184. keySystems: keySystemsOptions
  80185. }, (err) => {
  80186. if (err) {
  80187. reject2(err);
  80188. return;
  80189. }
  80190. resolve2();
  80191. });
  80192. }));
  80193. });
  80194. return Promise.race([
  80195. Promise.all(initializationFinishedPromises),
  80196. Promise.race(keySessionCreatedPromises)
  80197. ]);
  80198. };
  80199. const setupEmeOptions$1 = ({
  80200. player,
  80201. sourceKeySystems,
  80202. media,
  80203. audioMedia
  80204. }) => {
  80205. const sourceOptions = emeKeySystems$1(sourceKeySystems, media, audioMedia);
  80206. if (!sourceOptions) {
  80207. return false;
  80208. }
  80209. player.currentSource().keySystems = sourceOptions;
  80210. if (sourceOptions && !player.eme) {
  80211. videojs$2.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin");
  80212. return false;
  80213. }
  80214. return true;
  80215. };
  80216. const getVhsLocalStorage$1 = () => {
  80217. if (!window_1.localStorage) {
  80218. return null;
  80219. }
  80220. const storedObject = window_1.localStorage.getItem(LOCAL_STORAGE_KEY$2);
  80221. if (!storedObject) {
  80222. return null;
  80223. }
  80224. try {
  80225. return JSON.parse(storedObject);
  80226. } catch (e) {
  80227. return null;
  80228. }
  80229. };
  80230. const updateVhsLocalStorage$1 = (options2) => {
  80231. if (!window_1.localStorage) {
  80232. return false;
  80233. }
  80234. let objectToStore = getVhsLocalStorage$1();
  80235. objectToStore = objectToStore ? merge$2(objectToStore, options2) : options2;
  80236. try {
  80237. window_1.localStorage.setItem(LOCAL_STORAGE_KEY$2, JSON.stringify(objectToStore));
  80238. } catch (e) {
  80239. return false;
  80240. }
  80241. return objectToStore;
  80242. };
  80243. const expandDataUri$1 = (dataUri) => {
  80244. if (dataUri.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,") === 0) {
  80245. return JSON.parse(dataUri.substring(dataUri.indexOf(",") + 1));
  80246. }
  80247. return dataUri;
  80248. };
  80249. Vhs$2.supportsNativeHls = function() {
  80250. if (!document_1 || !document_1.createElement) {
  80251. return false;
  80252. }
  80253. const video = document_1.createElement("video");
  80254. if (!videojs$2.getTech("Html5").isSupported()) {
  80255. return false;
  80256. }
  80257. const canPlay = [
  80258. "application/vnd.apple.mpegurl",
  80259. "audio/mpegurl",
  80260. "audio/x-mpegurl",
  80261. "application/x-mpegurl",
  80262. "video/x-mpegurl",
  80263. "video/mpegurl",
  80264. "application/mpegurl"
  80265. ];
  80266. return canPlay.some(function(canItPlay) {
  80267. return /maybe|probably/i.test(video.canPlayType(canItPlay));
  80268. });
  80269. }();
  80270. Vhs$2.supportsNativeDash = function() {
  80271. if (!document_1 || !document_1.createElement || !videojs$2.getTech("Html5").isSupported()) {
  80272. return false;
  80273. }
  80274. return /maybe|probably/i.test(document_1.createElement("video").canPlayType("application/dash+xml"));
  80275. }();
  80276. Vhs$2.supportsTypeNatively = (type2) => {
  80277. if (type2 === "hls") {
  80278. return Vhs$2.supportsNativeHls;
  80279. }
  80280. if (type2 === "dash") {
  80281. return Vhs$2.supportsNativeDash;
  80282. }
  80283. return false;
  80284. };
  80285. Vhs$2.isSupported = function() {
  80286. return videojs$2.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.");
  80287. };
  80288. const Component$2 = videojs$2.getComponent("Component");
  80289. class VhsHandler$1 extends Component$2 {
  80290. constructor(source, tech, options2) {
  80291. super(tech, options2.vhs);
  80292. if (typeof options2.initialBandwidth === "number") {
  80293. this.options_.bandwidth = options2.initialBandwidth;
  80294. }
  80295. this.logger_ = logger$1("VhsHandler");
  80296. if (tech.options_ && tech.options_.playerId) {
  80297. const _player = videojs$2.getPlayer(tech.options_.playerId);
  80298. this.player_ = _player;
  80299. }
  80300. this.tech_ = tech;
  80301. this.source_ = source;
  80302. this.stats = {};
  80303. this.ignoreNextSeekingEvent_ = false;
  80304. this.setOptions_();
  80305. if (this.options_.overrideNative && tech.overrideNativeAudioTracks && tech.overrideNativeVideoTracks) {
  80306. tech.overrideNativeAudioTracks(true);
  80307. tech.overrideNativeVideoTracks(true);
  80308. } else if (this.options_.overrideNative && (tech.featuresNativeVideoTracks || tech.featuresNativeAudioTracks)) {
  80309. throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");
  80310. }
  80311. this.on(document_1, ["fullscreenchange", "webkitfullscreenchange", "mozfullscreenchange", "MSFullscreenChange"], (event2) => {
  80312. const fullscreenElement = document_1.fullscreenElement || document_1.webkitFullscreenElement || document_1.mozFullScreenElement || document_1.msFullscreenElement;
  80313. if (fullscreenElement && fullscreenElement.contains(this.tech_.el())) {
  80314. this.playlistController_.fastQualityChange_();
  80315. } else {
  80316. this.playlistController_.checkABR_();
  80317. }
  80318. });
  80319. this.on(this.tech_, "seeking", function() {
  80320. if (this.ignoreNextSeekingEvent_) {
  80321. this.ignoreNextSeekingEvent_ = false;
  80322. return;
  80323. }
  80324. this.setCurrentTime(this.tech_.currentTime());
  80325. });
  80326. this.on(this.tech_, "error", function() {
  80327. if (this.tech_.error() && this.playlistController_) {
  80328. this.playlistController_.pauseLoading();
  80329. }
  80330. });
  80331. this.on(this.tech_, "play", this.play);
  80332. }
  80333. setOptions_() {
  80334. this.options_.withCredentials = this.options_.withCredentials || false;
  80335. this.options_.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions === false ? false : true;
  80336. this.options_.useDevicePixelRatio = this.options_.useDevicePixelRatio || false;
  80337. this.options_.useBandwidthFromLocalStorage = typeof this.source_.useBandwidthFromLocalStorage !== "undefined" ? this.source_.useBandwidthFromLocalStorage : this.options_.useBandwidthFromLocalStorage || false;
  80338. this.options_.useNetworkInformationApi = this.options_.useNetworkInformationApi || false;
  80339. this.options_.useDtsForTimestampOffset = this.options_.useDtsForTimestampOffset || false;
  80340. this.options_.customTagParsers = this.options_.customTagParsers || [];
  80341. this.options_.customTagMappers = this.options_.customTagMappers || [];
  80342. this.options_.cacheEncryptionKeys = this.options_.cacheEncryptionKeys || false;
  80343. this.options_.llhls = this.options_.llhls === false ? false : true;
  80344. this.options_.bufferBasedABR = this.options_.bufferBasedABR || false;
  80345. if (typeof this.options_.playlistExclusionDuration !== "number") {
  80346. this.options_.playlistExclusionDuration = 5 * 60;
  80347. }
  80348. if (typeof this.options_.bandwidth !== "number") {
  80349. if (this.options_.useBandwidthFromLocalStorage) {
  80350. const storedObject = getVhsLocalStorage$1();
  80351. if (storedObject && storedObject.bandwidth) {
  80352. this.options_.bandwidth = storedObject.bandwidth;
  80353. this.tech_.trigger({
  80354. type: "usage",
  80355. name: "vhs-bandwidth-from-local-storage"
  80356. });
  80357. }
  80358. if (storedObject && storedObject.throughput) {
  80359. this.options_.throughput = storedObject.throughput;
  80360. this.tech_.trigger({
  80361. type: "usage",
  80362. name: "vhs-throughput-from-local-storage"
  80363. });
  80364. }
  80365. }
  80366. }
  80367. if (typeof this.options_.bandwidth !== "number") {
  80368. this.options_.bandwidth = Config$1.INITIAL_BANDWIDTH;
  80369. }
  80370. this.options_.enableLowInitialPlaylist = this.options_.enableLowInitialPlaylist && this.options_.bandwidth === Config$1.INITIAL_BANDWIDTH;
  80371. ["withCredentials", "useDevicePixelRatio", "limitRenditionByPlayerDimensions", "bandwidth", "customTagParsers", "customTagMappers", "cacheEncryptionKeys", "playlistSelector", "initialPlaylistSelector", "bufferBasedABR", "liveRangeSafeTimeDelta", "llhls", "useNetworkInformationApi", "useDtsForTimestampOffset", "exactManifestTimings", "leastPixelDiffSelector"].forEach((option) => {
  80372. if (typeof this.source_[option] !== "undefined") {
  80373. this.options_[option] = this.source_[option];
  80374. }
  80375. });
  80376. this.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions;
  80377. this.useDevicePixelRatio = this.options_.useDevicePixelRatio;
  80378. }
  80379. src(src, type2) {
  80380. if (!src) {
  80381. return;
  80382. }
  80383. this.setOptions_();
  80384. this.options_.src = expandDataUri$1(this.source_.src);
  80385. this.options_.tech = this.tech_;
  80386. this.options_.externVhs = Vhs$2;
  80387. this.options_.sourceType = simpleTypeFromSourceType$1(type2);
  80388. this.options_.seekTo = (time) => {
  80389. this.tech_.setCurrentTime(time);
  80390. };
  80391. this.playlistController_ = new PlaylistController(this.options_);
  80392. const playbackWatcherOptions = merge$2({
  80393. liveRangeSafeTimeDelta: SAFE_TIME_DELTA$1
  80394. }, this.options_, {
  80395. seekable: () => this.seekable(),
  80396. media: () => this.playlistController_.media(),
  80397. playlistController: this.playlistController_
  80398. });
  80399. this.playbackWatcher_ = new PlaybackWatcher$1(playbackWatcherOptions);
  80400. this.playlistController_.on("error", () => {
  80401. const player = videojs$2.players[this.tech_.options_.playerId];
  80402. let error = this.playlistController_.error;
  80403. if (typeof error === "object" && !error.code) {
  80404. error.code = 3;
  80405. } else if (typeof error === "string") {
  80406. error = {
  80407. message: error,
  80408. code: 3
  80409. };
  80410. }
  80411. player.error(error);
  80412. });
  80413. const defaultSelector = this.options_.bufferBasedABR ? Vhs$2.movingAverageBandwidthSelector(0.55) : Vhs$2.STANDARD_PLAYLIST_SELECTOR;
  80414. this.playlistController_.selectPlaylist = this.selectPlaylist ? this.selectPlaylist.bind(this) : defaultSelector.bind(this);
  80415. this.playlistController_.selectInitialPlaylist = Vhs$2.INITIAL_PLAYLIST_SELECTOR.bind(this);
  80416. this.playlists = this.playlistController_.mainPlaylistLoader_;
  80417. this.mediaSource = this.playlistController_.mediaSource;
  80418. Object.defineProperties(this, {
  80419. selectPlaylist: {
  80420. get() {
  80421. return this.playlistController_.selectPlaylist;
  80422. },
  80423. set(selectPlaylist) {
  80424. this.playlistController_.selectPlaylist = selectPlaylist.bind(this);
  80425. }
  80426. },
  80427. throughput: {
  80428. get() {
  80429. return this.playlistController_.mainSegmentLoader_.throughput.rate;
  80430. },
  80431. set(throughput) {
  80432. this.playlistController_.mainSegmentLoader_.throughput.rate = throughput;
  80433. this.playlistController_.mainSegmentLoader_.throughput.count = 1;
  80434. }
  80435. },
  80436. bandwidth: {
  80437. get() {
  80438. let playerBandwidthEst = this.playlistController_.mainSegmentLoader_.bandwidth;
  80439. const networkInformation = window_1.navigator.connection || window_1.navigator.mozConnection || window_1.navigator.webkitConnection;
  80440. const tenMbpsAsBitsPerSecond = 1e7;
  80441. if (this.options_.useNetworkInformationApi && networkInformation) {
  80442. const networkInfoBandwidthEstBitsPerSec = networkInformation.downlink * 1e3 * 1e3;
  80443. if (networkInfoBandwidthEstBitsPerSec >= tenMbpsAsBitsPerSecond && playerBandwidthEst >= tenMbpsAsBitsPerSecond) {
  80444. playerBandwidthEst = Math.max(playerBandwidthEst, networkInfoBandwidthEstBitsPerSec);
  80445. } else {
  80446. playerBandwidthEst = networkInfoBandwidthEstBitsPerSec;
  80447. }
  80448. }
  80449. return playerBandwidthEst;
  80450. },
  80451. set(bandwidth2) {
  80452. this.playlistController_.mainSegmentLoader_.bandwidth = bandwidth2;
  80453. this.playlistController_.mainSegmentLoader_.throughput = {
  80454. rate: 0,
  80455. count: 0
  80456. };
  80457. }
  80458. },
  80459. systemBandwidth: {
  80460. get() {
  80461. const invBandwidth = 1 / (this.bandwidth || 1);
  80462. let invThroughput;
  80463. if (this.throughput > 0) {
  80464. invThroughput = 1 / this.throughput;
  80465. } else {
  80466. invThroughput = 0;
  80467. }
  80468. const systemBitrate = Math.floor(1 / (invBandwidth + invThroughput));
  80469. return systemBitrate;
  80470. },
  80471. set() {
  80472. videojs$2.log.error('The "systemBandwidth" property is read-only');
  80473. }
  80474. }
  80475. });
  80476. if (this.options_.bandwidth) {
  80477. this.bandwidth = this.options_.bandwidth;
  80478. }
  80479. if (this.options_.throughput) {
  80480. this.throughput = this.options_.throughput;
  80481. }
  80482. Object.defineProperties(this.stats, {
  80483. bandwidth: {
  80484. get: () => this.bandwidth || 0,
  80485. enumerable: true
  80486. },
  80487. mediaRequests: {
  80488. get: () => this.playlistController_.mediaRequests_() || 0,
  80489. enumerable: true
  80490. },
  80491. mediaRequestsAborted: {
  80492. get: () => this.playlistController_.mediaRequestsAborted_() || 0,
  80493. enumerable: true
  80494. },
  80495. mediaRequestsTimedout: {
  80496. get: () => this.playlistController_.mediaRequestsTimedout_() || 0,
  80497. enumerable: true
  80498. },
  80499. mediaRequestsErrored: {
  80500. get: () => this.playlistController_.mediaRequestsErrored_() || 0,
  80501. enumerable: true
  80502. },
  80503. mediaTransferDuration: {
  80504. get: () => this.playlistController_.mediaTransferDuration_() || 0,
  80505. enumerable: true
  80506. },
  80507. mediaBytesTransferred: {
  80508. get: () => this.playlistController_.mediaBytesTransferred_() || 0,
  80509. enumerable: true
  80510. },
  80511. mediaSecondsLoaded: {
  80512. get: () => this.playlistController_.mediaSecondsLoaded_() || 0,
  80513. enumerable: true
  80514. },
  80515. mediaAppends: {
  80516. get: () => this.playlistController_.mediaAppends_() || 0,
  80517. enumerable: true
  80518. },
  80519. mainAppendsToLoadedData: {
  80520. get: () => this.playlistController_.mainAppendsToLoadedData_() || 0,
  80521. enumerable: true
  80522. },
  80523. audioAppendsToLoadedData: {
  80524. get: () => this.playlistController_.audioAppendsToLoadedData_() || 0,
  80525. enumerable: true
  80526. },
  80527. appendsToLoadedData: {
  80528. get: () => this.playlistController_.appendsToLoadedData_() || 0,
  80529. enumerable: true
  80530. },
  80531. timeToLoadedData: {
  80532. get: () => this.playlistController_.timeToLoadedData_() || 0,
  80533. enumerable: true
  80534. },
  80535. buffered: {
  80536. get: () => timeRangesToArray$1(this.tech_.buffered()),
  80537. enumerable: true
  80538. },
  80539. currentTime: {
  80540. get: () => this.tech_.currentTime(),
  80541. enumerable: true
  80542. },
  80543. currentSource: {
  80544. get: () => this.tech_.currentSource_,
  80545. enumerable: true
  80546. },
  80547. currentTech: {
  80548. get: () => this.tech_.name_,
  80549. enumerable: true
  80550. },
  80551. duration: {
  80552. get: () => this.tech_.duration(),
  80553. enumerable: true
  80554. },
  80555. main: {
  80556. get: () => this.playlists.main,
  80557. enumerable: true
  80558. },
  80559. playerDimensions: {
  80560. get: () => this.tech_.currentDimensions(),
  80561. enumerable: true
  80562. },
  80563. seekable: {
  80564. get: () => timeRangesToArray$1(this.tech_.seekable()),
  80565. enumerable: true
  80566. },
  80567. timestamp: {
  80568. get: () => Date.now(),
  80569. enumerable: true
  80570. },
  80571. videoPlaybackQuality: {
  80572. get: () => this.tech_.getVideoPlaybackQuality(),
  80573. enumerable: true
  80574. }
  80575. });
  80576. this.tech_.one("canplay", this.playlistController_.setupFirstPlay.bind(this.playlistController_));
  80577. this.tech_.on("bandwidthupdate", () => {
  80578. if (this.options_.useBandwidthFromLocalStorage) {
  80579. updateVhsLocalStorage$1({
  80580. bandwidth: this.bandwidth,
  80581. throughput: Math.round(this.throughput)
  80582. });
  80583. }
  80584. });
  80585. this.playlistController_.on("selectedinitialmedia", () => {
  80586. renditionSelectionMixin$1(this);
  80587. });
  80588. this.playlistController_.sourceUpdater_.on("createdsourcebuffers", () => {
  80589. this.setupEme_();
  80590. });
  80591. this.on(this.playlistController_, "progress", function() {
  80592. this.tech_.trigger("progress");
  80593. });
  80594. this.on(this.playlistController_, "firstplay", function() {
  80595. this.ignoreNextSeekingEvent_ = true;
  80596. });
  80597. this.setupQualityLevels_();
  80598. if (!this.tech_.el()) {
  80599. return;
  80600. }
  80601. this.mediaSourceUrl_ = window_1.URL.createObjectURL(this.playlistController_.mediaSource);
  80602. this.tech_.src(this.mediaSourceUrl_);
  80603. }
  80604. createKeySessions_() {
  80605. const audioPlaylistLoader = this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;
  80606. this.logger_("waiting for EME key session creation");
  80607. waitForKeySessionCreation$1({
  80608. player: this.player_,
  80609. sourceKeySystems: this.source_.keySystems,
  80610. audioMedia: audioPlaylistLoader && audioPlaylistLoader.media(),
  80611. mainPlaylists: this.playlists.main.playlists
  80612. }).then(() => {
  80613. this.logger_("created EME key session");
  80614. this.playlistController_.sourceUpdater_.initializedEme();
  80615. }).catch((err) => {
  80616. this.logger_("error while creating EME key session", err);
  80617. this.player_.error({
  80618. message: "Failed to initialize media keys for EME",
  80619. code: 3
  80620. });
  80621. });
  80622. }
  80623. handleWaitingForKey_() {
  80624. this.logger_("waitingforkey fired, attempting to create any new key sessions");
  80625. this.createKeySessions_();
  80626. }
  80627. setupEme_() {
  80628. const audioPlaylistLoader = this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;
  80629. const didSetupEmeOptions = setupEmeOptions$1({
  80630. player: this.player_,
  80631. sourceKeySystems: this.source_.keySystems,
  80632. media: this.playlists.media(),
  80633. audioMedia: audioPlaylistLoader && audioPlaylistLoader.media()
  80634. });
  80635. this.player_.tech_.on("keystatuschange", (e) => {
  80636. if (e.status !== "output-restricted") {
  80637. return;
  80638. }
  80639. const mainPlaylist = this.playlistController_.main();
  80640. if (!mainPlaylist || !mainPlaylist.playlists) {
  80641. return;
  80642. }
  80643. const excludedHDPlaylists = [];
  80644. mainPlaylist.playlists.forEach((playlist) => {
  80645. if (playlist && playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height >= 720) {
  80646. if (!playlist.excludeUntil || playlist.excludeUntil < Infinity) {
  80647. playlist.excludeUntil = Infinity;
  80648. excludedHDPlaylists.push(playlist);
  80649. }
  80650. }
  80651. });
  80652. if (excludedHDPlaylists.length) {
  80653. videojs$2.log.warn('DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.', ...excludedHDPlaylists);
  80654. this.playlistController_.fastQualityChange_();
  80655. }
  80656. });
  80657. this.handleWaitingForKey_ = this.handleWaitingForKey_.bind(this);
  80658. this.player_.tech_.on("waitingforkey", this.handleWaitingForKey_);
  80659. if (videojs$2.browser.IE_VERSION === 11 || !didSetupEmeOptions) {
  80660. this.playlistController_.sourceUpdater_.initializedEme();
  80661. return;
  80662. }
  80663. this.createKeySessions_();
  80664. }
  80665. setupQualityLevels_() {
  80666. const player = videojs$2.players[this.tech_.options_.playerId];
  80667. if (!player || !player.qualityLevels || this.qualityLevels_) {
  80668. return;
  80669. }
  80670. this.qualityLevels_ = player.qualityLevels();
  80671. this.playlistController_.on("selectedinitialmedia", () => {
  80672. handleVhsLoadedMetadata$1(this.qualityLevels_, this);
  80673. });
  80674. this.playlists.on("mediachange", () => {
  80675. handleVhsMediaChange$1(this.qualityLevels_, this.playlists);
  80676. });
  80677. }
  80678. static version() {
  80679. return {
  80680. "@videojs/http-streaming": version$4$1,
  80681. "mux.js": version$3$1,
  80682. "mpd-parser": version$2$1,
  80683. "m3u8-parser": version$1$2,
  80684. "aes-decrypter": version$7
  80685. };
  80686. }
  80687. version() {
  80688. return this.constructor.version();
  80689. }
  80690. canChangeType() {
  80691. return SourceUpdater$1.canChangeType();
  80692. }
  80693. play() {
  80694. this.playlistController_.play();
  80695. }
  80696. setCurrentTime(currentTime) {
  80697. this.playlistController_.setCurrentTime(currentTime);
  80698. }
  80699. duration() {
  80700. return this.playlistController_.duration();
  80701. }
  80702. seekable() {
  80703. return this.playlistController_.seekable();
  80704. }
  80705. dispose() {
  80706. if (this.playbackWatcher_) {
  80707. this.playbackWatcher_.dispose();
  80708. }
  80709. if (this.playlistController_) {
  80710. this.playlistController_.dispose();
  80711. }
  80712. if (this.qualityLevels_) {
  80713. this.qualityLevels_.dispose();
  80714. }
  80715. if (this.tech_ && this.tech_.vhs) {
  80716. delete this.tech_.vhs;
  80717. }
  80718. if (this.mediaSourceUrl_ && window_1.URL.revokeObjectURL) {
  80719. window_1.URL.revokeObjectURL(this.mediaSourceUrl_);
  80720. this.mediaSourceUrl_ = null;
  80721. }
  80722. if (this.tech_) {
  80723. this.tech_.off("waitingforkey", this.handleWaitingForKey_);
  80724. }
  80725. super.dispose();
  80726. }
  80727. convertToProgramTime(time, callback2) {
  80728. return getProgramTime$1({
  80729. playlist: this.playlistController_.media(),
  80730. time,
  80731. callback: callback2
  80732. });
  80733. }
  80734. seekToProgramTime(programTime, callback2, pauseAfterSeek = true, retryCount = 2) {
  80735. return seekToProgramTime$1({
  80736. programTime,
  80737. playlist: this.playlistController_.media(),
  80738. retryCount,
  80739. pauseAfterSeek,
  80740. seekTo: this.options_.seekTo,
  80741. tech: this.options_.tech,
  80742. callback: callback2
  80743. });
  80744. }
  80745. }
  80746. const VhsSourceHandler$1 = {
  80747. name: "videojs-http-streaming",
  80748. VERSION: version$4$1,
  80749. canHandleSource(srcObj, options2 = {}) {
  80750. const localOptions = merge$2(videojs$2.options, options2);
  80751. return VhsSourceHandler$1.canPlayType(srcObj.type, localOptions);
  80752. },
  80753. handleSource(source, tech, options2 = {}) {
  80754. const localOptions = merge$2(videojs$2.options, options2);
  80755. tech.vhs = new VhsHandler$1(source, tech, localOptions);
  80756. tech.vhs.xhr = xhrFactory$1();
  80757. tech.vhs.src(source.src, source.type);
  80758. return tech.vhs;
  80759. },
  80760. canPlayType(type2, options2) {
  80761. const simpleType = simpleTypeFromSourceType$1(type2);
  80762. if (!simpleType) {
  80763. return "";
  80764. }
  80765. const overrideNative = VhsSourceHandler$1.getOverrideNative(options2);
  80766. const supportsTypeNatively = Vhs$2.supportsTypeNatively(simpleType);
  80767. const canUseMsePlayback = !supportsTypeNatively || overrideNative;
  80768. return canUseMsePlayback ? "maybe" : "";
  80769. },
  80770. getOverrideNative(options2 = {}) {
  80771. const {
  80772. vhs = {}
  80773. } = options2;
  80774. const defaultOverrideNative = !(videojs$2.browser.IS_ANY_SAFARI || videojs$2.browser.IS_IOS);
  80775. const {
  80776. overrideNative = defaultOverrideNative
  80777. } = vhs;
  80778. return overrideNative;
  80779. }
  80780. };
  80781. const supportsNativeMediaSources$1 = () => {
  80782. return browserSupportsCodec$1("avc1.4d400d,mp4a.40.2");
  80783. };
  80784. if (supportsNativeMediaSources$1()) {
  80785. videojs$2.getTech("Html5").registerSourceHandler(VhsSourceHandler$1, 0);
  80786. }
  80787. videojs$2.VhsHandler = VhsHandler$1;
  80788. videojs$2.VhsSourceHandler = VhsSourceHandler$1;
  80789. videojs$2.Vhs = Vhs$2;
  80790. if (!videojs$2.use) {
  80791. videojs$2.registerComponent("Vhs", Vhs$2);
  80792. }
  80793. videojs$2.options.vhs = videojs$2.options.vhs || {};
  80794. if (!videojs$2.getPlugin || !videojs$2.getPlugin("reloadSourceOnError")) {
  80795. videojs$2.registerPlugin("reloadSourceOnError", reloadSourceOnError$1);
  80796. }
  80797. var videoJs = "";
  80798. function _assertThisInitialized(self2) {
  80799. if (self2 === void 0) {
  80800. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  80801. }
  80802. return self2;
  80803. }
  80804. function _setPrototypeOf(o, p) {
  80805. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
  80806. o2.__proto__ = p2;
  80807. return o2;
  80808. };
  80809. return _setPrototypeOf(o, p);
  80810. }
  80811. function _inheritsLoose(subClass, superClass) {
  80812. subClass.prototype = Object.create(superClass.prototype);
  80813. subClass.prototype.constructor = subClass;
  80814. _setPrototypeOf(subClass, superClass);
  80815. }
  80816. function _isNativeReflectConstruct() {
  80817. if (typeof Reflect === "undefined" || !Reflect.construct)
  80818. return false;
  80819. if (Reflect.construct.sham)
  80820. return false;
  80821. if (typeof Proxy === "function")
  80822. return true;
  80823. try {
  80824. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  80825. }));
  80826. return true;
  80827. } catch (e) {
  80828. return false;
  80829. }
  80830. }
  80831. function _construct(Parent, args, Class) {
  80832. if (_isNativeReflectConstruct()) {
  80833. _construct = Reflect.construct.bind();
  80834. } else {
  80835. _construct = function _construct2(Parent2, args2, Class2) {
  80836. var a = [null];
  80837. a.push.apply(a, args2);
  80838. var Constructor = Function.bind.apply(Parent2, a);
  80839. var instance = new Constructor();
  80840. if (Class2)
  80841. _setPrototypeOf(instance, Class2.prototype);
  80842. return instance;
  80843. };
  80844. }
  80845. return _construct.apply(null, arguments);
  80846. }
  80847. function _inherits(subClass, superClass) {
  80848. if (typeof superClass !== "function" && superClass !== null) {
  80849. throw new TypeError("Super expression must either be null or a function");
  80850. }
  80851. subClass.prototype = Object.create(superClass && superClass.prototype, {
  80852. constructor: {
  80853. value: subClass,
  80854. writable: true,
  80855. configurable: true
  80856. }
  80857. });
  80858. Object.defineProperty(subClass, "prototype", {
  80859. writable: false
  80860. });
  80861. if (superClass)
  80862. _setPrototypeOf(subClass, superClass);
  80863. }
  80864. var DEFAULT_LOCATION = "http://example.com";
  80865. var resolveUrl$1 = function resolveUrl3(baseUrl, relativeUrl) {
  80866. if (/^[a-z]+:/i.test(relativeUrl)) {
  80867. return relativeUrl;
  80868. }
  80869. if (/^data:/.test(baseUrl)) {
  80870. baseUrl = window_1.location && window_1.location.href || "";
  80871. }
  80872. var nativeURL = typeof window_1.URL === "function";
  80873. var protocolLess = /^\/\//.test(baseUrl);
  80874. var removeLocation = !window_1.location && !/\/\//i.test(baseUrl);
  80875. if (nativeURL) {
  80876. baseUrl = new window_1.URL(baseUrl, window_1.location || DEFAULT_LOCATION);
  80877. } else if (!/\/\//i.test(baseUrl)) {
  80878. baseUrl = URLToolkit.buildAbsoluteURL(window_1.location && window_1.location.href || "", baseUrl);
  80879. }
  80880. if (nativeURL) {
  80881. var newUrl = new URL(relativeUrl, baseUrl);
  80882. if (removeLocation) {
  80883. return newUrl.href.slice(DEFAULT_LOCATION.length);
  80884. } else if (protocolLess) {
  80885. return newUrl.href.slice(newUrl.protocol.length);
  80886. }
  80887. return newUrl.href;
  80888. }
  80889. return URLToolkit.buildAbsoluteURL(baseUrl, relativeUrl);
  80890. };
  80891. var Stream = /* @__PURE__ */ function() {
  80892. function Stream2() {
  80893. this.listeners = {};
  80894. }
  80895. var _proto = Stream2.prototype;
  80896. _proto.on = function on3(type2, listener) {
  80897. if (!this.listeners[type2]) {
  80898. this.listeners[type2] = [];
  80899. }
  80900. this.listeners[type2].push(listener);
  80901. };
  80902. _proto.off = function off2(type2, listener) {
  80903. if (!this.listeners[type2]) {
  80904. return false;
  80905. }
  80906. var index2 = this.listeners[type2].indexOf(listener);
  80907. this.listeners[type2] = this.listeners[type2].slice(0);
  80908. this.listeners[type2].splice(index2, 1);
  80909. return index2 > -1;
  80910. };
  80911. _proto.trigger = function trigger2(type2) {
  80912. var callbacks = this.listeners[type2];
  80913. if (!callbacks) {
  80914. return;
  80915. }
  80916. if (arguments.length === 2) {
  80917. var length = callbacks.length;
  80918. for (var i2 = 0; i2 < length; ++i2) {
  80919. callbacks[i2].call(this, arguments[1]);
  80920. }
  80921. } else {
  80922. var args = Array.prototype.slice.call(arguments, 1);
  80923. var _length = callbacks.length;
  80924. for (var _i = 0; _i < _length; ++_i) {
  80925. callbacks[_i].apply(this, args);
  80926. }
  80927. }
  80928. };
  80929. _proto.dispose = function dispose() {
  80930. this.listeners = {};
  80931. };
  80932. _proto.pipe = function pipe(destination2) {
  80933. this.on("data", function(data) {
  80934. destination2.push(data);
  80935. });
  80936. };
  80937. return Stream2;
  80938. }();
  80939. var atob3 = function atob4(s) {
  80940. return window_1.atob ? window_1.atob(s) : Buffer.from(s, "base64").toString("binary");
  80941. };
  80942. function decodeB64ToUint8Array(b64Text) {
  80943. var decodedString = atob3(b64Text);
  80944. var array = new Uint8Array(decodedString.length);
  80945. for (var i2 = 0; i2 < decodedString.length; i2++) {
  80946. array[i2] = decodedString.charCodeAt(i2);
  80947. }
  80948. return array;
  80949. }
  80950. /*! @name m3u8-parser @version 4.8.0 @license Apache-2.0 */
  80951. var LineStream = /* @__PURE__ */ function(_Stream) {
  80952. _inheritsLoose(LineStream2, _Stream);
  80953. function LineStream2() {
  80954. var _this;
  80955. _this = _Stream.call(this) || this;
  80956. _this.buffer = "";
  80957. return _this;
  80958. }
  80959. var _proto = LineStream2.prototype;
  80960. _proto.push = function push(data) {
  80961. var nextNewline;
  80962. this.buffer += data;
  80963. nextNewline = this.buffer.indexOf("\n");
  80964. for (; nextNewline > -1; nextNewline = this.buffer.indexOf("\n")) {
  80965. this.trigger("data", this.buffer.substring(0, nextNewline));
  80966. this.buffer = this.buffer.substring(nextNewline + 1);
  80967. }
  80968. };
  80969. return LineStream2;
  80970. }(Stream);
  80971. var TAB = String.fromCharCode(9);
  80972. var parseByterange = function parseByterange2(byterangeString) {
  80973. var match = /([0-9.]*)?@?([0-9.]*)?/.exec(byterangeString || "");
  80974. var result = {};
  80975. if (match[1]) {
  80976. result.length = parseInt(match[1], 10);
  80977. }
  80978. if (match[2]) {
  80979. result.offset = parseInt(match[2], 10);
  80980. }
  80981. return result;
  80982. };
  80983. var attributeSeparator = function attributeSeparator2() {
  80984. var key = "[^=]*";
  80985. var value = '"[^"]*"|[^,]*';
  80986. var keyvalue = "(?:" + key + ")=(?:" + value + ")";
  80987. return new RegExp("(?:^|,)(" + keyvalue + ")");
  80988. };
  80989. var parseAttributes$1 = function parseAttributes(attributes) {
  80990. var attrs = attributes.split(attributeSeparator());
  80991. var result = {};
  80992. var i2 = attrs.length;
  80993. var attr;
  80994. while (i2--) {
  80995. if (attrs[i2] === "") {
  80996. continue;
  80997. }
  80998. attr = /([^=]*)=(.*)/.exec(attrs[i2]).slice(1);
  80999. attr[0] = attr[0].replace(/^\s+|\s+$/g, "");
  81000. attr[1] = attr[1].replace(/^\s+|\s+$/g, "");
  81001. attr[1] = attr[1].replace(/^['"](.*)['"]$/g, "$1");
  81002. result[attr[0]] = attr[1];
  81003. }
  81004. return result;
  81005. };
  81006. var ParseStream = /* @__PURE__ */ function(_Stream) {
  81007. _inheritsLoose(ParseStream2, _Stream);
  81008. function ParseStream2() {
  81009. var _this;
  81010. _this = _Stream.call(this) || this;
  81011. _this.customParsers = [];
  81012. _this.tagMappers = [];
  81013. return _this;
  81014. }
  81015. var _proto = ParseStream2.prototype;
  81016. _proto.push = function push(line) {
  81017. var _this2 = this;
  81018. var match;
  81019. var event2;
  81020. line = line.trim();
  81021. if (line.length === 0) {
  81022. return;
  81023. }
  81024. if (line[0] !== "#") {
  81025. this.trigger("data", {
  81026. type: "uri",
  81027. uri: line
  81028. });
  81029. return;
  81030. }
  81031. var newLines = this.tagMappers.reduce(function(acc, mapper) {
  81032. var mappedLine = mapper(line);
  81033. if (mappedLine === line) {
  81034. return acc;
  81035. }
  81036. return acc.concat([mappedLine]);
  81037. }, [line]);
  81038. newLines.forEach(function(newLine) {
  81039. for (var i2 = 0; i2 < _this2.customParsers.length; i2++) {
  81040. if (_this2.customParsers[i2].call(_this2, newLine)) {
  81041. return;
  81042. }
  81043. }
  81044. if (newLine.indexOf("#EXT") !== 0) {
  81045. _this2.trigger("data", {
  81046. type: "comment",
  81047. text: newLine.slice(1)
  81048. });
  81049. return;
  81050. }
  81051. newLine = newLine.replace("\r", "");
  81052. match = /^#EXTM3U/.exec(newLine);
  81053. if (match) {
  81054. _this2.trigger("data", {
  81055. type: "tag",
  81056. tagType: "m3u"
  81057. });
  81058. return;
  81059. }
  81060. match = /^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(newLine);
  81061. if (match) {
  81062. event2 = {
  81063. type: "tag",
  81064. tagType: "inf"
  81065. };
  81066. if (match[1]) {
  81067. event2.duration = parseFloat(match[1]);
  81068. }
  81069. if (match[2]) {
  81070. event2.title = match[2];
  81071. }
  81072. _this2.trigger("data", event2);
  81073. return;
  81074. }
  81075. match = /^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(newLine);
  81076. if (match) {
  81077. event2 = {
  81078. type: "tag",
  81079. tagType: "targetduration"
  81080. };
  81081. if (match[1]) {
  81082. event2.duration = parseInt(match[1], 10);
  81083. }
  81084. _this2.trigger("data", event2);
  81085. return;
  81086. }
  81087. match = /^#EXT-X-VERSION:?([0-9.]*)?/.exec(newLine);
  81088. if (match) {
  81089. event2 = {
  81090. type: "tag",
  81091. tagType: "version"
  81092. };
  81093. if (match[1]) {
  81094. event2.version = parseInt(match[1], 10);
  81095. }
  81096. _this2.trigger("data", event2);
  81097. return;
  81098. }
  81099. match = /^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(newLine);
  81100. if (match) {
  81101. event2 = {
  81102. type: "tag",
  81103. tagType: "media-sequence"
  81104. };
  81105. if (match[1]) {
  81106. event2.number = parseInt(match[1], 10);
  81107. }
  81108. _this2.trigger("data", event2);
  81109. return;
  81110. }
  81111. match = /^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(newLine);
  81112. if (match) {
  81113. event2 = {
  81114. type: "tag",
  81115. tagType: "discontinuity-sequence"
  81116. };
  81117. if (match[1]) {
  81118. event2.number = parseInt(match[1], 10);
  81119. }
  81120. _this2.trigger("data", event2);
  81121. return;
  81122. }
  81123. match = /^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(newLine);
  81124. if (match) {
  81125. event2 = {
  81126. type: "tag",
  81127. tagType: "playlist-type"
  81128. };
  81129. if (match[1]) {
  81130. event2.playlistType = match[1];
  81131. }
  81132. _this2.trigger("data", event2);
  81133. return;
  81134. }
  81135. match = /^#EXT-X-BYTERANGE:?(.*)?$/.exec(newLine);
  81136. if (match) {
  81137. event2 = _extends$2(parseByterange(match[1]), {
  81138. type: "tag",
  81139. tagType: "byterange"
  81140. });
  81141. _this2.trigger("data", event2);
  81142. return;
  81143. }
  81144. match = /^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(newLine);
  81145. if (match) {
  81146. event2 = {
  81147. type: "tag",
  81148. tagType: "allow-cache"
  81149. };
  81150. if (match[1]) {
  81151. event2.allowed = !/NO/.test(match[1]);
  81152. }
  81153. _this2.trigger("data", event2);
  81154. return;
  81155. }
  81156. match = /^#EXT-X-MAP:?(.*)$/.exec(newLine);
  81157. if (match) {
  81158. event2 = {
  81159. type: "tag",
  81160. tagType: "map"
  81161. };
  81162. if (match[1]) {
  81163. var attributes = parseAttributes$1(match[1]);
  81164. if (attributes.URI) {
  81165. event2.uri = attributes.URI;
  81166. }
  81167. if (attributes.BYTERANGE) {
  81168. event2.byterange = parseByterange(attributes.BYTERANGE);
  81169. }
  81170. }
  81171. _this2.trigger("data", event2);
  81172. return;
  81173. }
  81174. match = /^#EXT-X-STREAM-INF:?(.*)$/.exec(newLine);
  81175. if (match) {
  81176. event2 = {
  81177. type: "tag",
  81178. tagType: "stream-inf"
  81179. };
  81180. if (match[1]) {
  81181. event2.attributes = parseAttributes$1(match[1]);
  81182. if (event2.attributes.RESOLUTION) {
  81183. var split2 = event2.attributes.RESOLUTION.split("x");
  81184. var resolution = {};
  81185. if (split2[0]) {
  81186. resolution.width = parseInt(split2[0], 10);
  81187. }
  81188. if (split2[1]) {
  81189. resolution.height = parseInt(split2[1], 10);
  81190. }
  81191. event2.attributes.RESOLUTION = resolution;
  81192. }
  81193. if (event2.attributes.BANDWIDTH) {
  81194. event2.attributes.BANDWIDTH = parseInt(event2.attributes.BANDWIDTH, 10);
  81195. }
  81196. if (event2.attributes["FRAME-RATE"]) {
  81197. event2.attributes["FRAME-RATE"] = parseFloat(event2.attributes["FRAME-RATE"]);
  81198. }
  81199. if (event2.attributes["PROGRAM-ID"]) {
  81200. event2.attributes["PROGRAM-ID"] = parseInt(event2.attributes["PROGRAM-ID"], 10);
  81201. }
  81202. }
  81203. _this2.trigger("data", event2);
  81204. return;
  81205. }
  81206. match = /^#EXT-X-MEDIA:?(.*)$/.exec(newLine);
  81207. if (match) {
  81208. event2 = {
  81209. type: "tag",
  81210. tagType: "media"
  81211. };
  81212. if (match[1]) {
  81213. event2.attributes = parseAttributes$1(match[1]);
  81214. }
  81215. _this2.trigger("data", event2);
  81216. return;
  81217. }
  81218. match = /^#EXT-X-ENDLIST/.exec(newLine);
  81219. if (match) {
  81220. _this2.trigger("data", {
  81221. type: "tag",
  81222. tagType: "endlist"
  81223. });
  81224. return;
  81225. }
  81226. match = /^#EXT-X-DISCONTINUITY/.exec(newLine);
  81227. if (match) {
  81228. _this2.trigger("data", {
  81229. type: "tag",
  81230. tagType: "discontinuity"
  81231. });
  81232. return;
  81233. }
  81234. match = /^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(newLine);
  81235. if (match) {
  81236. event2 = {
  81237. type: "tag",
  81238. tagType: "program-date-time"
  81239. };
  81240. if (match[1]) {
  81241. event2.dateTimeString = match[1];
  81242. event2.dateTimeObject = new Date(match[1]);
  81243. }
  81244. _this2.trigger("data", event2);
  81245. return;
  81246. }
  81247. match = /^#EXT-X-KEY:?(.*)$/.exec(newLine);
  81248. if (match) {
  81249. event2 = {
  81250. type: "tag",
  81251. tagType: "key"
  81252. };
  81253. if (match[1]) {
  81254. event2.attributes = parseAttributes$1(match[1]);
  81255. if (event2.attributes.IV) {
  81256. if (event2.attributes.IV.substring(0, 2).toLowerCase() === "0x") {
  81257. event2.attributes.IV = event2.attributes.IV.substring(2);
  81258. }
  81259. event2.attributes.IV = event2.attributes.IV.match(/.{8}/g);
  81260. event2.attributes.IV[0] = parseInt(event2.attributes.IV[0], 16);
  81261. event2.attributes.IV[1] = parseInt(event2.attributes.IV[1], 16);
  81262. event2.attributes.IV[2] = parseInt(event2.attributes.IV[2], 16);
  81263. event2.attributes.IV[3] = parseInt(event2.attributes.IV[3], 16);
  81264. event2.attributes.IV = new Uint32Array(event2.attributes.IV);
  81265. }
  81266. }
  81267. _this2.trigger("data", event2);
  81268. return;
  81269. }
  81270. match = /^#EXT-X-START:?(.*)$/.exec(newLine);
  81271. if (match) {
  81272. event2 = {
  81273. type: "tag",
  81274. tagType: "start"
  81275. };
  81276. if (match[1]) {
  81277. event2.attributes = parseAttributes$1(match[1]);
  81278. event2.attributes["TIME-OFFSET"] = parseFloat(event2.attributes["TIME-OFFSET"]);
  81279. event2.attributes.PRECISE = /YES/.test(event2.attributes.PRECISE);
  81280. }
  81281. _this2.trigger("data", event2);
  81282. return;
  81283. }
  81284. match = /^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(newLine);
  81285. if (match) {
  81286. event2 = {
  81287. type: "tag",
  81288. tagType: "cue-out-cont"
  81289. };
  81290. if (match[1]) {
  81291. event2.data = match[1];
  81292. } else {
  81293. event2.data = "";
  81294. }
  81295. _this2.trigger("data", event2);
  81296. return;
  81297. }
  81298. match = /^#EXT-X-CUE-OUT:?(.*)?$/.exec(newLine);
  81299. if (match) {
  81300. event2 = {
  81301. type: "tag",
  81302. tagType: "cue-out"
  81303. };
  81304. if (match[1]) {
  81305. event2.data = match[1];
  81306. } else {
  81307. event2.data = "";
  81308. }
  81309. _this2.trigger("data", event2);
  81310. return;
  81311. }
  81312. match = /^#EXT-X-CUE-IN:?(.*)?$/.exec(newLine);
  81313. if (match) {
  81314. event2 = {
  81315. type: "tag",
  81316. tagType: "cue-in"
  81317. };
  81318. if (match[1]) {
  81319. event2.data = match[1];
  81320. } else {
  81321. event2.data = "";
  81322. }
  81323. _this2.trigger("data", event2);
  81324. return;
  81325. }
  81326. match = /^#EXT-X-SKIP:(.*)$/.exec(newLine);
  81327. if (match && match[1]) {
  81328. event2 = {
  81329. type: "tag",
  81330. tagType: "skip"
  81331. };
  81332. event2.attributes = parseAttributes$1(match[1]);
  81333. if (event2.attributes.hasOwnProperty("SKIPPED-SEGMENTS")) {
  81334. event2.attributes["SKIPPED-SEGMENTS"] = parseInt(event2.attributes["SKIPPED-SEGMENTS"], 10);
  81335. }
  81336. if (event2.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")) {
  81337. event2.attributes["RECENTLY-REMOVED-DATERANGES"] = event2.attributes["RECENTLY-REMOVED-DATERANGES"].split(TAB);
  81338. }
  81339. _this2.trigger("data", event2);
  81340. return;
  81341. }
  81342. match = /^#EXT-X-PART:(.*)$/.exec(newLine);
  81343. if (match && match[1]) {
  81344. event2 = {
  81345. type: "tag",
  81346. tagType: "part"
  81347. };
  81348. event2.attributes = parseAttributes$1(match[1]);
  81349. ["DURATION"].forEach(function(key) {
  81350. if (event2.attributes.hasOwnProperty(key)) {
  81351. event2.attributes[key] = parseFloat(event2.attributes[key]);
  81352. }
  81353. });
  81354. ["INDEPENDENT", "GAP"].forEach(function(key) {
  81355. if (event2.attributes.hasOwnProperty(key)) {
  81356. event2.attributes[key] = /YES/.test(event2.attributes[key]);
  81357. }
  81358. });
  81359. if (event2.attributes.hasOwnProperty("BYTERANGE")) {
  81360. event2.attributes.byterange = parseByterange(event2.attributes.BYTERANGE);
  81361. }
  81362. _this2.trigger("data", event2);
  81363. return;
  81364. }
  81365. match = /^#EXT-X-SERVER-CONTROL:(.*)$/.exec(newLine);
  81366. if (match && match[1]) {
  81367. event2 = {
  81368. type: "tag",
  81369. tagType: "server-control"
  81370. };
  81371. event2.attributes = parseAttributes$1(match[1]);
  81372. ["CAN-SKIP-UNTIL", "PART-HOLD-BACK", "HOLD-BACK"].forEach(function(key) {
  81373. if (event2.attributes.hasOwnProperty(key)) {
  81374. event2.attributes[key] = parseFloat(event2.attributes[key]);
  81375. }
  81376. });
  81377. ["CAN-SKIP-DATERANGES", "CAN-BLOCK-RELOAD"].forEach(function(key) {
  81378. if (event2.attributes.hasOwnProperty(key)) {
  81379. event2.attributes[key] = /YES/.test(event2.attributes[key]);
  81380. }
  81381. });
  81382. _this2.trigger("data", event2);
  81383. return;
  81384. }
  81385. match = /^#EXT-X-PART-INF:(.*)$/.exec(newLine);
  81386. if (match && match[1]) {
  81387. event2 = {
  81388. type: "tag",
  81389. tagType: "part-inf"
  81390. };
  81391. event2.attributes = parseAttributes$1(match[1]);
  81392. ["PART-TARGET"].forEach(function(key) {
  81393. if (event2.attributes.hasOwnProperty(key)) {
  81394. event2.attributes[key] = parseFloat(event2.attributes[key]);
  81395. }
  81396. });
  81397. _this2.trigger("data", event2);
  81398. return;
  81399. }
  81400. match = /^#EXT-X-PRELOAD-HINT:(.*)$/.exec(newLine);
  81401. if (match && match[1]) {
  81402. event2 = {
  81403. type: "tag",
  81404. tagType: "preload-hint"
  81405. };
  81406. event2.attributes = parseAttributes$1(match[1]);
  81407. ["BYTERANGE-START", "BYTERANGE-LENGTH"].forEach(function(key) {
  81408. if (event2.attributes.hasOwnProperty(key)) {
  81409. event2.attributes[key] = parseInt(event2.attributes[key], 10);
  81410. var subkey = key === "BYTERANGE-LENGTH" ? "length" : "offset";
  81411. event2.attributes.byterange = event2.attributes.byterange || {};
  81412. event2.attributes.byterange[subkey] = event2.attributes[key];
  81413. delete event2.attributes[key];
  81414. }
  81415. });
  81416. _this2.trigger("data", event2);
  81417. return;
  81418. }
  81419. match = /^#EXT-X-RENDITION-REPORT:(.*)$/.exec(newLine);
  81420. if (match && match[1]) {
  81421. event2 = {
  81422. type: "tag",
  81423. tagType: "rendition-report"
  81424. };
  81425. event2.attributes = parseAttributes$1(match[1]);
  81426. ["LAST-MSN", "LAST-PART"].forEach(function(key) {
  81427. if (event2.attributes.hasOwnProperty(key)) {
  81428. event2.attributes[key] = parseInt(event2.attributes[key], 10);
  81429. }
  81430. });
  81431. _this2.trigger("data", event2);
  81432. return;
  81433. }
  81434. _this2.trigger("data", {
  81435. type: "tag",
  81436. data: newLine.slice(4)
  81437. });
  81438. });
  81439. };
  81440. _proto.addParser = function addParser(_ref) {
  81441. var _this3 = this;
  81442. var expression = _ref.expression, customType = _ref.customType, dataParser = _ref.dataParser, segment = _ref.segment;
  81443. if (typeof dataParser !== "function") {
  81444. dataParser = function dataParser2(line) {
  81445. return line;
  81446. };
  81447. }
  81448. this.customParsers.push(function(line) {
  81449. var match = expression.exec(line);
  81450. if (match) {
  81451. _this3.trigger("data", {
  81452. type: "custom",
  81453. data: dataParser(line),
  81454. customType,
  81455. segment
  81456. });
  81457. return true;
  81458. }
  81459. });
  81460. };
  81461. _proto.addTagMapper = function addTagMapper(_ref2) {
  81462. var expression = _ref2.expression, map = _ref2.map;
  81463. var mapFn = function mapFn2(line) {
  81464. if (expression.test(line)) {
  81465. return map(line);
  81466. }
  81467. return line;
  81468. };
  81469. this.tagMappers.push(mapFn);
  81470. };
  81471. return ParseStream2;
  81472. }(Stream);
  81473. var camelCase = function camelCase2(str) {
  81474. return str.toLowerCase().replace(/-(\w)/g, function(a) {
  81475. return a[1].toUpperCase();
  81476. });
  81477. };
  81478. var camelCaseKeys = function camelCaseKeys2(attributes) {
  81479. var result = {};
  81480. Object.keys(attributes).forEach(function(key) {
  81481. result[camelCase(key)] = attributes[key];
  81482. });
  81483. return result;
  81484. };
  81485. var setHoldBack = function setHoldBack2(manifest) {
  81486. var serverControl = manifest.serverControl, targetDuration = manifest.targetDuration, partTargetDuration = manifest.partTargetDuration;
  81487. if (!serverControl) {
  81488. return;
  81489. }
  81490. var tag = "#EXT-X-SERVER-CONTROL";
  81491. var hb = "holdBack";
  81492. var phb = "partHoldBack";
  81493. var minTargetDuration = targetDuration && targetDuration * 3;
  81494. var minPartDuration = partTargetDuration && partTargetDuration * 2;
  81495. if (targetDuration && !serverControl.hasOwnProperty(hb)) {
  81496. serverControl[hb] = minTargetDuration;
  81497. this.trigger("info", {
  81498. message: tag + " defaulting HOLD-BACK to targetDuration * 3 (" + minTargetDuration + ")."
  81499. });
  81500. }
  81501. if (minTargetDuration && serverControl[hb] < minTargetDuration) {
  81502. this.trigger("warn", {
  81503. message: tag + " clamping HOLD-BACK (" + serverControl[hb] + ") to targetDuration * 3 (" + minTargetDuration + ")"
  81504. });
  81505. serverControl[hb] = minTargetDuration;
  81506. }
  81507. if (partTargetDuration && !serverControl.hasOwnProperty(phb)) {
  81508. serverControl[phb] = partTargetDuration * 3;
  81509. this.trigger("info", {
  81510. message: tag + " defaulting PART-HOLD-BACK to partTargetDuration * 3 (" + serverControl[phb] + ")."
  81511. });
  81512. }
  81513. if (partTargetDuration && serverControl[phb] < minPartDuration) {
  81514. this.trigger("warn", {
  81515. message: tag + " clamping PART-HOLD-BACK (" + serverControl[phb] + ") to partTargetDuration * 2 (" + minPartDuration + ")."
  81516. });
  81517. serverControl[phb] = minPartDuration;
  81518. }
  81519. };
  81520. var Parser = /* @__PURE__ */ function(_Stream) {
  81521. _inheritsLoose(Parser2, _Stream);
  81522. function Parser2() {
  81523. var _this;
  81524. _this = _Stream.call(this) || this;
  81525. _this.lineStream = new LineStream();
  81526. _this.parseStream = new ParseStream();
  81527. _this.lineStream.pipe(_this.parseStream);
  81528. var self2 = _assertThisInitialized(_this);
  81529. var uris = [];
  81530. var currentUri = {};
  81531. var currentMap;
  81532. var _key;
  81533. var hasParts = false;
  81534. var noop2 = function noop3() {
  81535. };
  81536. var defaultMediaGroups = {
  81537. "AUDIO": {},
  81538. "VIDEO": {},
  81539. "CLOSED-CAPTIONS": {},
  81540. "SUBTITLES": {}
  81541. };
  81542. var widevineUuid = "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";
  81543. var currentTimeline = 0;
  81544. _this.manifest = {
  81545. allowCache: true,
  81546. discontinuityStarts: [],
  81547. segments: []
  81548. };
  81549. var lastByterangeEnd = 0;
  81550. var lastPartByterangeEnd = 0;
  81551. _this.on("end", function() {
  81552. if (currentUri.uri || !currentUri.parts && !currentUri.preloadHints) {
  81553. return;
  81554. }
  81555. if (!currentUri.map && currentMap) {
  81556. currentUri.map = currentMap;
  81557. }
  81558. if (!currentUri.key && _key) {
  81559. currentUri.key = _key;
  81560. }
  81561. if (!currentUri.timeline && typeof currentTimeline === "number") {
  81562. currentUri.timeline = currentTimeline;
  81563. }
  81564. _this.manifest.preloadSegment = currentUri;
  81565. });
  81566. _this.parseStream.on("data", function(entry) {
  81567. var mediaGroup;
  81568. var rendition;
  81569. ({
  81570. tag: function tag() {
  81571. ({
  81572. version: function version2() {
  81573. if (entry.version) {
  81574. this.manifest.version = entry.version;
  81575. }
  81576. },
  81577. "allow-cache": function allowCache() {
  81578. this.manifest.allowCache = entry.allowed;
  81579. if (!("allowed" in entry)) {
  81580. this.trigger("info", {
  81581. message: "defaulting allowCache to YES"
  81582. });
  81583. this.manifest.allowCache = true;
  81584. }
  81585. },
  81586. byterange: function byterange() {
  81587. var byterange2 = {};
  81588. if ("length" in entry) {
  81589. currentUri.byterange = byterange2;
  81590. byterange2.length = entry.length;
  81591. if (!("offset" in entry)) {
  81592. entry.offset = lastByterangeEnd;
  81593. }
  81594. }
  81595. if ("offset" in entry) {
  81596. currentUri.byterange = byterange2;
  81597. byterange2.offset = entry.offset;
  81598. }
  81599. lastByterangeEnd = byterange2.offset + byterange2.length;
  81600. },
  81601. endlist: function endlist() {
  81602. this.manifest.endList = true;
  81603. },
  81604. inf: function inf() {
  81605. if (!("mediaSequence" in this.manifest)) {
  81606. this.manifest.mediaSequence = 0;
  81607. this.trigger("info", {
  81608. message: "defaulting media sequence to zero"
  81609. });
  81610. }
  81611. if (!("discontinuitySequence" in this.manifest)) {
  81612. this.manifest.discontinuitySequence = 0;
  81613. this.trigger("info", {
  81614. message: "defaulting discontinuity sequence to zero"
  81615. });
  81616. }
  81617. if (entry.duration > 0) {
  81618. currentUri.duration = entry.duration;
  81619. }
  81620. if (entry.duration === 0) {
  81621. currentUri.duration = 0.01;
  81622. this.trigger("info", {
  81623. message: "updating zero segment duration to a small value"
  81624. });
  81625. }
  81626. this.manifest.segments = uris;
  81627. },
  81628. key: function key() {
  81629. if (!entry.attributes) {
  81630. this.trigger("warn", {
  81631. message: "ignoring key declaration without attribute list"
  81632. });
  81633. return;
  81634. }
  81635. if (entry.attributes.METHOD === "NONE") {
  81636. _key = null;
  81637. return;
  81638. }
  81639. if (!entry.attributes.URI) {
  81640. this.trigger("warn", {
  81641. message: "ignoring key declaration without URI"
  81642. });
  81643. return;
  81644. }
  81645. if (entry.attributes.KEYFORMAT === "com.apple.streamingkeydelivery") {
  81646. this.manifest.contentProtection = this.manifest.contentProtection || {};
  81647. this.manifest.contentProtection["com.apple.fps.1_0"] = {
  81648. attributes: entry.attributes
  81649. };
  81650. return;
  81651. }
  81652. if (entry.attributes.KEYFORMAT === "com.microsoft.playready") {
  81653. this.manifest.contentProtection = this.manifest.contentProtection || {};
  81654. this.manifest.contentProtection["com.microsoft.playready"] = {
  81655. uri: entry.attributes.URI
  81656. };
  81657. return;
  81658. }
  81659. if (entry.attributes.KEYFORMAT === widevineUuid) {
  81660. var VALID_METHODS = ["SAMPLE-AES", "SAMPLE-AES-CTR", "SAMPLE-AES-CENC"];
  81661. if (VALID_METHODS.indexOf(entry.attributes.METHOD) === -1) {
  81662. this.trigger("warn", {
  81663. message: "invalid key method provided for Widevine"
  81664. });
  81665. return;
  81666. }
  81667. if (entry.attributes.METHOD === "SAMPLE-AES-CENC") {
  81668. this.trigger("warn", {
  81669. message: "SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"
  81670. });
  81671. }
  81672. if (entry.attributes.URI.substring(0, 23) !== "data:text/plain;base64,") {
  81673. this.trigger("warn", {
  81674. message: "invalid key URI provided for Widevine"
  81675. });
  81676. return;
  81677. }
  81678. if (!(entry.attributes.KEYID && entry.attributes.KEYID.substring(0, 2) === "0x")) {
  81679. this.trigger("warn", {
  81680. message: "invalid key ID provided for Widevine"
  81681. });
  81682. return;
  81683. }
  81684. this.manifest.contentProtection = this.manifest.contentProtection || {};
  81685. this.manifest.contentProtection["com.widevine.alpha"] = {
  81686. attributes: {
  81687. schemeIdUri: entry.attributes.KEYFORMAT,
  81688. keyId: entry.attributes.KEYID.substring(2)
  81689. },
  81690. pssh: decodeB64ToUint8Array(entry.attributes.URI.split(",")[1])
  81691. };
  81692. return;
  81693. }
  81694. if (!entry.attributes.METHOD) {
  81695. this.trigger("warn", {
  81696. message: "defaulting key method to AES-128"
  81697. });
  81698. }
  81699. _key = {
  81700. method: entry.attributes.METHOD || "AES-128",
  81701. uri: entry.attributes.URI
  81702. };
  81703. if (typeof entry.attributes.IV !== "undefined") {
  81704. _key.iv = entry.attributes.IV;
  81705. }
  81706. },
  81707. "media-sequence": function mediaSequence() {
  81708. if (!isFinite(entry.number)) {
  81709. this.trigger("warn", {
  81710. message: "ignoring invalid media sequence: " + entry.number
  81711. });
  81712. return;
  81713. }
  81714. this.manifest.mediaSequence = entry.number;
  81715. },
  81716. "discontinuity-sequence": function discontinuitySequence() {
  81717. if (!isFinite(entry.number)) {
  81718. this.trigger("warn", {
  81719. message: "ignoring invalid discontinuity sequence: " + entry.number
  81720. });
  81721. return;
  81722. }
  81723. this.manifest.discontinuitySequence = entry.number;
  81724. currentTimeline = entry.number;
  81725. },
  81726. "playlist-type": function playlistType() {
  81727. if (!/VOD|EVENT/.test(entry.playlistType)) {
  81728. this.trigger("warn", {
  81729. message: "ignoring unknown playlist type: " + entry.playlist
  81730. });
  81731. return;
  81732. }
  81733. this.manifest.playlistType = entry.playlistType;
  81734. },
  81735. map: function map() {
  81736. currentMap = {};
  81737. if (entry.uri) {
  81738. currentMap.uri = entry.uri;
  81739. }
  81740. if (entry.byterange) {
  81741. currentMap.byterange = entry.byterange;
  81742. }
  81743. if (_key) {
  81744. currentMap.key = _key;
  81745. }
  81746. },
  81747. "stream-inf": function streamInf() {
  81748. this.manifest.playlists = uris;
  81749. this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups;
  81750. if (!entry.attributes) {
  81751. this.trigger("warn", {
  81752. message: "ignoring empty stream-inf attributes"
  81753. });
  81754. return;
  81755. }
  81756. if (!currentUri.attributes) {
  81757. currentUri.attributes = {};
  81758. }
  81759. _extends$2(currentUri.attributes, entry.attributes);
  81760. },
  81761. media: function media() {
  81762. this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups;
  81763. if (!(entry.attributes && entry.attributes.TYPE && entry.attributes["GROUP-ID"] && entry.attributes.NAME)) {
  81764. this.trigger("warn", {
  81765. message: "ignoring incomplete or missing media group"
  81766. });
  81767. return;
  81768. }
  81769. var mediaGroupType = this.manifest.mediaGroups[entry.attributes.TYPE];
  81770. mediaGroupType[entry.attributes["GROUP-ID"]] = mediaGroupType[entry.attributes["GROUP-ID"]] || {};
  81771. mediaGroup = mediaGroupType[entry.attributes["GROUP-ID"]];
  81772. rendition = {
  81773. default: /yes/i.test(entry.attributes.DEFAULT)
  81774. };
  81775. if (rendition.default) {
  81776. rendition.autoselect = true;
  81777. } else {
  81778. rendition.autoselect = /yes/i.test(entry.attributes.AUTOSELECT);
  81779. }
  81780. if (entry.attributes.LANGUAGE) {
  81781. rendition.language = entry.attributes.LANGUAGE;
  81782. }
  81783. if (entry.attributes.URI) {
  81784. rendition.uri = entry.attributes.URI;
  81785. }
  81786. if (entry.attributes["INSTREAM-ID"]) {
  81787. rendition.instreamId = entry.attributes["INSTREAM-ID"];
  81788. }
  81789. if (entry.attributes.CHARACTERISTICS) {
  81790. rendition.characteristics = entry.attributes.CHARACTERISTICS;
  81791. }
  81792. if (entry.attributes.FORCED) {
  81793. rendition.forced = /yes/i.test(entry.attributes.FORCED);
  81794. }
  81795. mediaGroup[entry.attributes.NAME] = rendition;
  81796. },
  81797. discontinuity: function discontinuity() {
  81798. currentTimeline += 1;
  81799. currentUri.discontinuity = true;
  81800. this.manifest.discontinuityStarts.push(uris.length);
  81801. },
  81802. "program-date-time": function programDateTime() {
  81803. if (typeof this.manifest.dateTimeString === "undefined") {
  81804. this.manifest.dateTimeString = entry.dateTimeString;
  81805. this.manifest.dateTimeObject = entry.dateTimeObject;
  81806. }
  81807. currentUri.dateTimeString = entry.dateTimeString;
  81808. currentUri.dateTimeObject = entry.dateTimeObject;
  81809. },
  81810. targetduration: function targetduration() {
  81811. if (!isFinite(entry.duration) || entry.duration < 0) {
  81812. this.trigger("warn", {
  81813. message: "ignoring invalid target duration: " + entry.duration
  81814. });
  81815. return;
  81816. }
  81817. this.manifest.targetDuration = entry.duration;
  81818. setHoldBack.call(this, this.manifest);
  81819. },
  81820. start: function start2() {
  81821. if (!entry.attributes || isNaN(entry.attributes["TIME-OFFSET"])) {
  81822. this.trigger("warn", {
  81823. message: "ignoring start declaration without appropriate attribute list"
  81824. });
  81825. return;
  81826. }
  81827. this.manifest.start = {
  81828. timeOffset: entry.attributes["TIME-OFFSET"],
  81829. precise: entry.attributes.PRECISE
  81830. };
  81831. },
  81832. "cue-out": function cueOut() {
  81833. currentUri.cueOut = entry.data;
  81834. },
  81835. "cue-out-cont": function cueOutCont() {
  81836. currentUri.cueOutCont = entry.data;
  81837. },
  81838. "cue-in": function cueIn() {
  81839. currentUri.cueIn = entry.data;
  81840. },
  81841. "skip": function skip() {
  81842. this.manifest.skip = camelCaseKeys(entry.attributes);
  81843. this.warnOnMissingAttributes_("#EXT-X-SKIP", entry.attributes, ["SKIPPED-SEGMENTS"]);
  81844. },
  81845. "part": function part() {
  81846. var _this2 = this;
  81847. hasParts = true;
  81848. var segmentIndex = this.manifest.segments.length;
  81849. var part2 = camelCaseKeys(entry.attributes);
  81850. currentUri.parts = currentUri.parts || [];
  81851. currentUri.parts.push(part2);
  81852. if (part2.byterange) {
  81853. if (!part2.byterange.hasOwnProperty("offset")) {
  81854. part2.byterange.offset = lastPartByterangeEnd;
  81855. }
  81856. lastPartByterangeEnd = part2.byterange.offset + part2.byterange.length;
  81857. }
  81858. var partIndex = currentUri.parts.length - 1;
  81859. this.warnOnMissingAttributes_("#EXT-X-PART #" + partIndex + " for segment #" + segmentIndex, entry.attributes, ["URI", "DURATION"]);
  81860. if (this.manifest.renditionReports) {
  81861. this.manifest.renditionReports.forEach(function(r2, i2) {
  81862. if (!r2.hasOwnProperty("lastPart")) {
  81863. _this2.trigger("warn", {
  81864. message: "#EXT-X-RENDITION-REPORT #" + i2 + " lacks required attribute(s): LAST-PART"
  81865. });
  81866. }
  81867. });
  81868. }
  81869. },
  81870. "server-control": function serverControl() {
  81871. var attrs = this.manifest.serverControl = camelCaseKeys(entry.attributes);
  81872. if (!attrs.hasOwnProperty("canBlockReload")) {
  81873. attrs.canBlockReload = false;
  81874. this.trigger("info", {
  81875. message: "#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"
  81876. });
  81877. }
  81878. setHoldBack.call(this, this.manifest);
  81879. if (attrs.canSkipDateranges && !attrs.hasOwnProperty("canSkipUntil")) {
  81880. this.trigger("warn", {
  81881. message: "#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"
  81882. });
  81883. }
  81884. },
  81885. "preload-hint": function preloadHint() {
  81886. var segmentIndex = this.manifest.segments.length;
  81887. var hint = camelCaseKeys(entry.attributes);
  81888. var isPart = hint.type && hint.type === "PART";
  81889. currentUri.preloadHints = currentUri.preloadHints || [];
  81890. currentUri.preloadHints.push(hint);
  81891. if (hint.byterange) {
  81892. if (!hint.byterange.hasOwnProperty("offset")) {
  81893. hint.byterange.offset = isPart ? lastPartByterangeEnd : 0;
  81894. if (isPart) {
  81895. lastPartByterangeEnd = hint.byterange.offset + hint.byterange.length;
  81896. }
  81897. }
  81898. }
  81899. var index2 = currentUri.preloadHints.length - 1;
  81900. this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #" + index2 + " for segment #" + segmentIndex, entry.attributes, ["TYPE", "URI"]);
  81901. if (!hint.type) {
  81902. return;
  81903. }
  81904. for (var i2 = 0; i2 < currentUri.preloadHints.length - 1; i2++) {
  81905. var otherHint = currentUri.preloadHints[i2];
  81906. if (!otherHint.type) {
  81907. continue;
  81908. }
  81909. if (otherHint.type === hint.type) {
  81910. this.trigger("warn", {
  81911. message: "#EXT-X-PRELOAD-HINT #" + index2 + " for segment #" + segmentIndex + " has the same TYPE " + hint.type + " as preload hint #" + i2
  81912. });
  81913. }
  81914. }
  81915. },
  81916. "rendition-report": function renditionReport() {
  81917. var report = camelCaseKeys(entry.attributes);
  81918. this.manifest.renditionReports = this.manifest.renditionReports || [];
  81919. this.manifest.renditionReports.push(report);
  81920. var index2 = this.manifest.renditionReports.length - 1;
  81921. var required = ["LAST-MSN", "URI"];
  81922. if (hasParts) {
  81923. required.push("LAST-PART");
  81924. }
  81925. this.warnOnMissingAttributes_("#EXT-X-RENDITION-REPORT #" + index2, entry.attributes, required);
  81926. },
  81927. "part-inf": function partInf() {
  81928. this.manifest.partInf = camelCaseKeys(entry.attributes);
  81929. this.warnOnMissingAttributes_("#EXT-X-PART-INF", entry.attributes, ["PART-TARGET"]);
  81930. if (this.manifest.partInf.partTarget) {
  81931. this.manifest.partTargetDuration = this.manifest.partInf.partTarget;
  81932. }
  81933. setHoldBack.call(this, this.manifest);
  81934. }
  81935. }[entry.tagType] || noop2).call(self2);
  81936. },
  81937. uri: function uri() {
  81938. currentUri.uri = entry.uri;
  81939. uris.push(currentUri);
  81940. if (this.manifest.targetDuration && !("duration" in currentUri)) {
  81941. this.trigger("warn", {
  81942. message: "defaulting segment duration to the target duration"
  81943. });
  81944. currentUri.duration = this.manifest.targetDuration;
  81945. }
  81946. if (_key) {
  81947. currentUri.key = _key;
  81948. }
  81949. currentUri.timeline = currentTimeline;
  81950. if (currentMap) {
  81951. currentUri.map = currentMap;
  81952. }
  81953. lastPartByterangeEnd = 0;
  81954. currentUri = {};
  81955. },
  81956. comment: function comment() {
  81957. },
  81958. custom: function custom() {
  81959. if (entry.segment) {
  81960. currentUri.custom = currentUri.custom || {};
  81961. currentUri.custom[entry.customType] = entry.data;
  81962. } else {
  81963. this.manifest.custom = this.manifest.custom || {};
  81964. this.manifest.custom[entry.customType] = entry.data;
  81965. }
  81966. }
  81967. })[entry.type].call(self2);
  81968. });
  81969. return _this;
  81970. }
  81971. var _proto = Parser2.prototype;
  81972. _proto.warnOnMissingAttributes_ = function warnOnMissingAttributes_(identifier, attributes, required) {
  81973. var missing = [];
  81974. required.forEach(function(key) {
  81975. if (!attributes.hasOwnProperty(key)) {
  81976. missing.push(key);
  81977. }
  81978. });
  81979. if (missing.length) {
  81980. this.trigger("warn", {
  81981. message: identifier + " lacks required attribute(s): " + missing.join(", ")
  81982. });
  81983. }
  81984. };
  81985. _proto.push = function push(chunk) {
  81986. this.lineStream.push(chunk);
  81987. };
  81988. _proto.end = function end() {
  81989. this.lineStream.push("\n");
  81990. this.trigger("end");
  81991. };
  81992. _proto.addParser = function addParser(options2) {
  81993. this.parseStream.addParser(options2);
  81994. };
  81995. _proto.addTagMapper = function addTagMapper(options2) {
  81996. this.parseStream.addTagMapper(options2);
  81997. };
  81998. return Parser2;
  81999. }(Stream);
  82000. var regexs = {
  82001. mp4: /^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,
  82002. webm: /^(vp0?[89]|av0?1|opus|vorbis)/,
  82003. ogg: /^(vp0?[89]|theora|flac|opus|vorbis)/,
  82004. video: /^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,
  82005. audio: /^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,
  82006. text: /^(stpp.ttml.im1t)/,
  82007. muxerVideo: /^(avc0?1)/,
  82008. muxerAudio: /^(mp4a)/,
  82009. muxerText: /a^/
  82010. };
  82011. var mediaTypes = ["video", "audio", "text"];
  82012. var upperMediaTypes = ["Video", "Audio", "Text"];
  82013. var translateLegacyCodec2 = function translateLegacyCodec3(codec) {
  82014. if (!codec) {
  82015. return codec;
  82016. }
  82017. return codec.replace(/avc1\.(\d+)\.(\d+)/i, function(orig, profile, avcLevel) {
  82018. var profileHex = ("00" + Number(profile).toString(16)).slice(-2);
  82019. var avcLevelHex = ("00" + Number(avcLevel).toString(16)).slice(-2);
  82020. return "avc1." + profileHex + "00" + avcLevelHex;
  82021. });
  82022. };
  82023. var parseCodecs2 = function parseCodecs3(codecString) {
  82024. if (codecString === void 0) {
  82025. codecString = "";
  82026. }
  82027. var codecs = codecString.split(",");
  82028. var result = [];
  82029. codecs.forEach(function(codec) {
  82030. codec = codec.trim();
  82031. var codecType;
  82032. mediaTypes.forEach(function(name) {
  82033. var match = regexs[name].exec(codec.toLowerCase());
  82034. if (!match || match.length <= 1) {
  82035. return;
  82036. }
  82037. codecType = name;
  82038. var type2 = codec.substring(0, match[1].length);
  82039. var details = codec.replace(type2, "");
  82040. result.push({
  82041. type: type2,
  82042. details,
  82043. mediaType: name
  82044. });
  82045. });
  82046. if (!codecType) {
  82047. result.push({
  82048. type: codec,
  82049. details: "",
  82050. mediaType: "unknown"
  82051. });
  82052. }
  82053. });
  82054. return result;
  82055. };
  82056. var codecsFromDefault2 = function codecsFromDefault3(master, audioGroupId) {
  82057. if (!master.mediaGroups.AUDIO || !audioGroupId) {
  82058. return null;
  82059. }
  82060. var audioGroup = master.mediaGroups.AUDIO[audioGroupId];
  82061. if (!audioGroup) {
  82062. return null;
  82063. }
  82064. for (var name in audioGroup) {
  82065. var audioType = audioGroup[name];
  82066. if (audioType.default && audioType.playlists) {
  82067. return parseCodecs2(audioType.playlists[0].attributes.CODECS);
  82068. }
  82069. }
  82070. return null;
  82071. };
  82072. var isAudioCodec2 = function isAudioCodec3(codec) {
  82073. if (codec === void 0) {
  82074. codec = "";
  82075. }
  82076. return regexs.audio.test(codec.trim().toLowerCase());
  82077. };
  82078. var isTextCodec2 = function isTextCodec3(codec) {
  82079. if (codec === void 0) {
  82080. codec = "";
  82081. }
  82082. return regexs.text.test(codec.trim().toLowerCase());
  82083. };
  82084. var getMimeForCodec2 = function getMimeForCodec3(codecString) {
  82085. if (!codecString || typeof codecString !== "string") {
  82086. return;
  82087. }
  82088. var codecs = codecString.toLowerCase().split(",").map(function(c) {
  82089. return translateLegacyCodec2(c.trim());
  82090. });
  82091. var type2 = "video";
  82092. if (codecs.length === 1 && isAudioCodec2(codecs[0])) {
  82093. type2 = "audio";
  82094. } else if (codecs.length === 1 && isTextCodec2(codecs[0])) {
  82095. type2 = "application";
  82096. }
  82097. var container = "mp4";
  82098. if (codecs.every(function(c) {
  82099. return regexs.mp4.test(c);
  82100. })) {
  82101. container = "mp4";
  82102. } else if (codecs.every(function(c) {
  82103. return regexs.webm.test(c);
  82104. })) {
  82105. container = "webm";
  82106. } else if (codecs.every(function(c) {
  82107. return regexs.ogg.test(c);
  82108. })) {
  82109. container = "ogg";
  82110. }
  82111. return type2 + "/" + container + ';codecs="' + codecString + '"';
  82112. };
  82113. var browserSupportsCodec2 = function browserSupportsCodec3(codecString) {
  82114. if (codecString === void 0) {
  82115. codecString = "";
  82116. }
  82117. return window_1.MediaSource && window_1.MediaSource.isTypeSupported && window_1.MediaSource.isTypeSupported(getMimeForCodec2(codecString)) || false;
  82118. };
  82119. var muxerSupportsCodec2 = function muxerSupportsCodec3(codecString) {
  82120. if (codecString === void 0) {
  82121. codecString = "";
  82122. }
  82123. return codecString.toLowerCase().split(",").every(function(codec) {
  82124. codec = codec.trim();
  82125. for (var i2 = 0; i2 < upperMediaTypes.length; i2++) {
  82126. var type2 = upperMediaTypes[i2];
  82127. if (regexs["muxer" + type2].test(codec)) {
  82128. return true;
  82129. }
  82130. }
  82131. return false;
  82132. });
  82133. };
  82134. var DEFAULT_AUDIO_CODEC = "mp4a.40.2";
  82135. var DEFAULT_VIDEO_CODEC = "avc1.4d400d";
  82136. var MPEGURL_REGEX = /^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i;
  82137. var DASH_REGEX = /^application\/dash\+xml/i;
  82138. var simpleTypeFromSourceType2 = function simpleTypeFromSourceType3(type2) {
  82139. if (MPEGURL_REGEX.test(type2)) {
  82140. return "hls";
  82141. }
  82142. if (DASH_REGEX.test(type2)) {
  82143. return "dash";
  82144. }
  82145. if (type2 === "application/vnd.videojs.vhs+json") {
  82146. return "vhs-json";
  82147. }
  82148. return null;
  82149. };
  82150. var countBits2 = function countBits3(x) {
  82151. return x.toString(2).length;
  82152. };
  82153. var countBytes2 = function countBytes3(x) {
  82154. return Math.ceil(countBits2(x) / 8);
  82155. };
  82156. var isArrayBufferView2 = function isArrayBufferView3(obj) {
  82157. if (ArrayBuffer.isView === "function") {
  82158. return ArrayBuffer.isView(obj);
  82159. }
  82160. return obj && obj.buffer instanceof ArrayBuffer;
  82161. };
  82162. var isTypedArray2 = function isTypedArray3(obj) {
  82163. return isArrayBufferView2(obj);
  82164. };
  82165. var toUint82 = function toUint83(bytes) {
  82166. if (bytes instanceof Uint8Array) {
  82167. return bytes;
  82168. }
  82169. if (!Array.isArray(bytes) && !isTypedArray2(bytes) && !(bytes instanceof ArrayBuffer)) {
  82170. if (typeof bytes !== "number" || typeof bytes === "number" && bytes !== bytes) {
  82171. bytes = 0;
  82172. } else {
  82173. bytes = [bytes];
  82174. }
  82175. }
  82176. return new Uint8Array(bytes && bytes.buffer || bytes, bytes && bytes.byteOffset || 0, bytes && bytes.byteLength || 0);
  82177. };
  82178. var BigInt = window_1.BigInt || Number;
  82179. var BYTE_TABLE = [BigInt("0x1"), BigInt("0x100"), BigInt("0x10000"), BigInt("0x1000000"), BigInt("0x100000000"), BigInt("0x10000000000"), BigInt("0x1000000000000"), BigInt("0x100000000000000"), BigInt("0x10000000000000000")];
  82180. (function() {
  82181. var a = new Uint16Array([65484]);
  82182. var b = new Uint8Array(a.buffer, a.byteOffset, a.byteLength);
  82183. if (b[0] === 255) {
  82184. return "big";
  82185. }
  82186. if (b[0] === 204) {
  82187. return "little";
  82188. }
  82189. return "unknown";
  82190. })();
  82191. var bytesToNumber2 = function bytesToNumber3(bytes, _temp) {
  82192. var _ref = _temp === void 0 ? {} : _temp, _ref$signed = _ref.signed, signed = _ref$signed === void 0 ? false : _ref$signed, _ref$le = _ref.le, le = _ref$le === void 0 ? false : _ref$le;
  82193. bytes = toUint82(bytes);
  82194. var fn2 = le ? "reduce" : "reduceRight";
  82195. var obj = bytes[fn2] ? bytes[fn2] : Array.prototype[fn2];
  82196. var number = obj.call(bytes, function(total, byte, i2) {
  82197. var exponent = le ? i2 : Math.abs(i2 + 1 - bytes.length);
  82198. return total + BigInt(byte) * BYTE_TABLE[exponent];
  82199. }, BigInt(0));
  82200. if (signed) {
  82201. var max2 = BYTE_TABLE[bytes.length] / BigInt(2) - BigInt(1);
  82202. number = BigInt(number);
  82203. if (number > max2) {
  82204. number -= max2;
  82205. number -= max2;
  82206. number -= BigInt(2);
  82207. }
  82208. }
  82209. return Number(number);
  82210. };
  82211. var numberToBytes2 = function numberToBytes3(number, _temp2) {
  82212. var _ref2 = _temp2 === void 0 ? {} : _temp2, _ref2$le = _ref2.le, le = _ref2$le === void 0 ? false : _ref2$le;
  82213. if (typeof number !== "bigint" && typeof number !== "number" || typeof number === "number" && number !== number) {
  82214. number = 0;
  82215. }
  82216. number = BigInt(number);
  82217. var byteCount = countBytes2(number);
  82218. var bytes = new Uint8Array(new ArrayBuffer(byteCount));
  82219. for (var i2 = 0; i2 < byteCount; i2++) {
  82220. var byteIndex = le ? i2 : Math.abs(i2 + 1 - bytes.length);
  82221. bytes[byteIndex] = Number(number / BYTE_TABLE[i2] & BigInt(255));
  82222. if (number < 0) {
  82223. bytes[byteIndex] = Math.abs(~bytes[byteIndex]);
  82224. bytes[byteIndex] -= i2 === 0 ? 1 : 2;
  82225. }
  82226. }
  82227. return bytes;
  82228. };
  82229. var stringToBytes2 = function stringToBytes3(string, stringIsBytes) {
  82230. if (typeof string !== "string" && string && typeof string.toString === "function") {
  82231. string = string.toString();
  82232. }
  82233. if (typeof string !== "string") {
  82234. return new Uint8Array();
  82235. }
  82236. if (!stringIsBytes) {
  82237. string = unescape(encodeURIComponent(string));
  82238. }
  82239. var view = new Uint8Array(string.length);
  82240. for (var i2 = 0; i2 < string.length; i2++) {
  82241. view[i2] = string.charCodeAt(i2);
  82242. }
  82243. return view;
  82244. };
  82245. var concatTypedArrays2 = function concatTypedArrays3() {
  82246. for (var _len = arguments.length, buffers = new Array(_len), _key = 0; _key < _len; _key++) {
  82247. buffers[_key] = arguments[_key];
  82248. }
  82249. buffers = buffers.filter(function(b) {
  82250. return b && (b.byteLength || b.length) && typeof b !== "string";
  82251. });
  82252. if (buffers.length <= 1) {
  82253. return toUint82(buffers[0]);
  82254. }
  82255. var totalLen = buffers.reduce(function(total, buf, i2) {
  82256. return total + (buf.byteLength || buf.length);
  82257. }, 0);
  82258. var tempBuffer = new Uint8Array(totalLen);
  82259. var offset = 0;
  82260. buffers.forEach(function(buf) {
  82261. buf = toUint82(buf);
  82262. tempBuffer.set(buf, offset);
  82263. offset += buf.byteLength;
  82264. });
  82265. return tempBuffer;
  82266. };
  82267. var bytesMatch2 = function bytesMatch3(a, b, _temp3) {
  82268. var _ref3 = _temp3 === void 0 ? {} : _temp3, _ref3$offset = _ref3.offset, offset = _ref3$offset === void 0 ? 0 : _ref3$offset, _ref3$mask = _ref3.mask, mask = _ref3$mask === void 0 ? [] : _ref3$mask;
  82269. a = toUint82(a);
  82270. b = toUint82(b);
  82271. var fn2 = b.every ? b.every : Array.prototype.every;
  82272. return b.length && a.length - offset >= b.length && fn2.call(b, function(bByte, i2) {
  82273. var aByte = mask[i2] ? mask[i2] & a[offset + i2] : a[offset + i2];
  82274. return bByte === aByte;
  82275. });
  82276. };
  82277. var forEachMediaGroup$1 = function forEachMediaGroup2(master, groups, callback2) {
  82278. groups.forEach(function(mediaType) {
  82279. for (var groupKey in master.mediaGroups[mediaType]) {
  82280. for (var labelKey in master.mediaGroups[mediaType][groupKey]) {
  82281. var mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey];
  82282. callback2(mediaProperties, mediaType, groupKey, labelKey);
  82283. }
  82284. }
  82285. });
  82286. };
  82287. /*! @name mpd-parser @version 0.22.1 @license Apache-2.0 */
  82288. var isObject$1 = function isObject(obj) {
  82289. return !!obj && typeof obj === "object";
  82290. };
  82291. var merge = function merge2() {
  82292. for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {
  82293. objects[_key] = arguments[_key];
  82294. }
  82295. return objects.reduce(function(result, source) {
  82296. if (typeof source !== "object") {
  82297. return result;
  82298. }
  82299. Object.keys(source).forEach(function(key) {
  82300. if (Array.isArray(result[key]) && Array.isArray(source[key])) {
  82301. result[key] = result[key].concat(source[key]);
  82302. } else if (isObject$1(result[key]) && isObject$1(source[key])) {
  82303. result[key] = merge2(result[key], source[key]);
  82304. } else {
  82305. result[key] = source[key];
  82306. }
  82307. });
  82308. return result;
  82309. }, {});
  82310. };
  82311. var values = function values2(o) {
  82312. return Object.keys(o).map(function(k) {
  82313. return o[k];
  82314. });
  82315. };
  82316. var range = function range2(start2, end) {
  82317. var result = [];
  82318. for (var i2 = start2; i2 < end; i2++) {
  82319. result.push(i2);
  82320. }
  82321. return result;
  82322. };
  82323. var flatten = function flatten2(lists) {
  82324. return lists.reduce(function(x, y) {
  82325. return x.concat(y);
  82326. }, []);
  82327. };
  82328. var from = function from2(list) {
  82329. if (!list.length) {
  82330. return [];
  82331. }
  82332. var result = [];
  82333. for (var i2 = 0; i2 < list.length; i2++) {
  82334. result.push(list[i2]);
  82335. }
  82336. return result;
  82337. };
  82338. var findIndexes = function findIndexes2(l, key) {
  82339. return l.reduce(function(a, e, i2) {
  82340. if (e[key]) {
  82341. a.push(i2);
  82342. }
  82343. return a;
  82344. }, []);
  82345. };
  82346. var findIndex = function findIndex2(list, matchingFunction) {
  82347. for (var i2 = 0; i2 < list.length; i2++) {
  82348. if (matchingFunction(list[i2])) {
  82349. return i2;
  82350. }
  82351. }
  82352. return -1;
  82353. };
  82354. var union = function union2(lists, keyFunction) {
  82355. return values(lists.reduce(function(acc, list) {
  82356. list.forEach(function(el) {
  82357. acc[keyFunction(el)] = el;
  82358. });
  82359. return acc;
  82360. }, {}));
  82361. };
  82362. var errors = {
  82363. INVALID_NUMBER_OF_PERIOD: "INVALID_NUMBER_OF_PERIOD",
  82364. DASH_EMPTY_MANIFEST: "DASH_EMPTY_MANIFEST",
  82365. DASH_INVALID_XML: "DASH_INVALID_XML",
  82366. NO_BASE_URL: "NO_BASE_URL",
  82367. MISSING_SEGMENT_INFORMATION: "MISSING_SEGMENT_INFORMATION",
  82368. SEGMENT_TIME_UNSPECIFIED: "SEGMENT_TIME_UNSPECIFIED",
  82369. UNSUPPORTED_UTC_TIMING_SCHEME: "UNSUPPORTED_UTC_TIMING_SCHEME"
  82370. };
  82371. var urlTypeToSegment = function urlTypeToSegment2(_ref) {
  82372. var _ref$baseUrl = _ref.baseUrl, baseUrl = _ref$baseUrl === void 0 ? "" : _ref$baseUrl, _ref$source = _ref.source, source = _ref$source === void 0 ? "" : _ref$source, _ref$range = _ref.range, range3 = _ref$range === void 0 ? "" : _ref$range, _ref$indexRange = _ref.indexRange, indexRange = _ref$indexRange === void 0 ? "" : _ref$indexRange;
  82373. var segment = {
  82374. uri: source,
  82375. resolvedUri: resolveUrl$1(baseUrl || "", source)
  82376. };
  82377. if (range3 || indexRange) {
  82378. var rangeStr = range3 ? range3 : indexRange;
  82379. var ranges = rangeStr.split("-");
  82380. var startRange = window_1.BigInt ? window_1.BigInt(ranges[0]) : parseInt(ranges[0], 10);
  82381. var endRange = window_1.BigInt ? window_1.BigInt(ranges[1]) : parseInt(ranges[1], 10);
  82382. if (startRange < Number.MAX_SAFE_INTEGER && typeof startRange === "bigint") {
  82383. startRange = Number(startRange);
  82384. }
  82385. if (endRange < Number.MAX_SAFE_INTEGER && typeof endRange === "bigint") {
  82386. endRange = Number(endRange);
  82387. }
  82388. var length;
  82389. if (typeof endRange === "bigint" || typeof startRange === "bigint") {
  82390. length = window_1.BigInt(endRange) - window_1.BigInt(startRange) + window_1.BigInt(1);
  82391. } else {
  82392. length = endRange - startRange + 1;
  82393. }
  82394. if (typeof length === "bigint" && length < Number.MAX_SAFE_INTEGER) {
  82395. length = Number(length);
  82396. }
  82397. segment.byterange = {
  82398. length,
  82399. offset: startRange
  82400. };
  82401. }
  82402. return segment;
  82403. };
  82404. var byteRangeToString = function byteRangeToString2(byterange) {
  82405. var endRange;
  82406. if (typeof byterange.offset === "bigint" || typeof byterange.length === "bigint") {
  82407. endRange = window_1.BigInt(byterange.offset) + window_1.BigInt(byterange.length) - window_1.BigInt(1);
  82408. } else {
  82409. endRange = byterange.offset + byterange.length - 1;
  82410. }
  82411. return byterange.offset + "-" + endRange;
  82412. };
  82413. var parseEndNumber = function parseEndNumber2(endNumber) {
  82414. if (endNumber && typeof endNumber !== "number") {
  82415. endNumber = parseInt(endNumber, 10);
  82416. }
  82417. if (isNaN(endNumber)) {
  82418. return null;
  82419. }
  82420. return endNumber;
  82421. };
  82422. var segmentRange = {
  82423. static: function _static(attributes) {
  82424. var duration5 = attributes.duration, _attributes$timescale = attributes.timescale, timescale2 = _attributes$timescale === void 0 ? 1 : _attributes$timescale, sourceDuration = attributes.sourceDuration, periodDuration = attributes.periodDuration;
  82425. var endNumber = parseEndNumber(attributes.endNumber);
  82426. var segmentDuration = duration5 / timescale2;
  82427. if (typeof endNumber === "number") {
  82428. return {
  82429. start: 0,
  82430. end: endNumber
  82431. };
  82432. }
  82433. if (typeof periodDuration === "number") {
  82434. return {
  82435. start: 0,
  82436. end: periodDuration / segmentDuration
  82437. };
  82438. }
  82439. return {
  82440. start: 0,
  82441. end: sourceDuration / segmentDuration
  82442. };
  82443. },
  82444. dynamic: function dynamic(attributes) {
  82445. var NOW = attributes.NOW, clientOffset = attributes.clientOffset, availabilityStartTime2 = attributes.availabilityStartTime, _attributes$timescale2 = attributes.timescale, timescale2 = _attributes$timescale2 === void 0 ? 1 : _attributes$timescale2, duration5 = attributes.duration, _attributes$periodSta = attributes.periodStart, periodStart = _attributes$periodSta === void 0 ? 0 : _attributes$periodSta, _attributes$minimumUp = attributes.minimumUpdatePeriod, minimumUpdatePeriod2 = _attributes$minimumUp === void 0 ? 0 : _attributes$minimumUp, _attributes$timeShift = attributes.timeShiftBufferDepth, timeShiftBufferDepth2 = _attributes$timeShift === void 0 ? Infinity : _attributes$timeShift;
  82446. var endNumber = parseEndNumber(attributes.endNumber);
  82447. var now2 = (NOW + clientOffset) / 1e3;
  82448. var periodStartWC = availabilityStartTime2 + periodStart;
  82449. var periodEndWC = now2 + minimumUpdatePeriod2;
  82450. var periodDuration = periodEndWC - periodStartWC;
  82451. var segmentCount = Math.ceil(periodDuration * timescale2 / duration5);
  82452. var availableStart = Math.floor((now2 - periodStartWC - timeShiftBufferDepth2) * timescale2 / duration5);
  82453. var availableEnd = Math.floor((now2 - periodStartWC) * timescale2 / duration5);
  82454. return {
  82455. start: Math.max(0, availableStart),
  82456. end: typeof endNumber === "number" ? endNumber : Math.min(segmentCount, availableEnd)
  82457. };
  82458. }
  82459. };
  82460. var toSegments = function toSegments2(attributes) {
  82461. return function(number) {
  82462. var duration5 = attributes.duration, _attributes$timescale3 = attributes.timescale, timescale2 = _attributes$timescale3 === void 0 ? 1 : _attributes$timescale3, periodStart = attributes.periodStart, _attributes$startNumb = attributes.startNumber, startNumber2 = _attributes$startNumb === void 0 ? 1 : _attributes$startNumb;
  82463. return {
  82464. number: startNumber2 + number,
  82465. duration: duration5 / timescale2,
  82466. timeline: periodStart,
  82467. time: number * duration5
  82468. };
  82469. };
  82470. };
  82471. var parseByDuration = function parseByDuration2(attributes) {
  82472. var type2 = attributes.type, duration5 = attributes.duration, _attributes$timescale4 = attributes.timescale, timescale2 = _attributes$timescale4 === void 0 ? 1 : _attributes$timescale4, periodDuration = attributes.periodDuration, sourceDuration = attributes.sourceDuration;
  82473. var _segmentRange$type = segmentRange[type2](attributes), start2 = _segmentRange$type.start, end = _segmentRange$type.end;
  82474. var segments = range(start2, end).map(toSegments(attributes));
  82475. if (type2 === "static") {
  82476. var index2 = segments.length - 1;
  82477. var sectionDuration = typeof periodDuration === "number" ? periodDuration : sourceDuration;
  82478. segments[index2].duration = sectionDuration - duration5 / timescale2 * index2;
  82479. }
  82480. return segments;
  82481. };
  82482. var segmentsFromBase = function segmentsFromBase2(attributes) {
  82483. var baseUrl = attributes.baseUrl, _attributes$initializ = attributes.initialization, initialization = _attributes$initializ === void 0 ? {} : _attributes$initializ, sourceDuration = attributes.sourceDuration, _attributes$indexRang = attributes.indexRange, indexRange = _attributes$indexRang === void 0 ? "" : _attributes$indexRang, periodStart = attributes.periodStart, presentationTime = attributes.presentationTime, _attributes$number = attributes.number, number = _attributes$number === void 0 ? 0 : _attributes$number, duration5 = attributes.duration;
  82484. if (!baseUrl) {
  82485. throw new Error(errors.NO_BASE_URL);
  82486. }
  82487. var initSegment = urlTypeToSegment({
  82488. baseUrl,
  82489. source: initialization.sourceURL,
  82490. range: initialization.range
  82491. });
  82492. var segment = urlTypeToSegment({
  82493. baseUrl,
  82494. source: baseUrl,
  82495. indexRange
  82496. });
  82497. segment.map = initSegment;
  82498. if (duration5) {
  82499. var segmentTimeInfo = parseByDuration(attributes);
  82500. if (segmentTimeInfo.length) {
  82501. segment.duration = segmentTimeInfo[0].duration;
  82502. segment.timeline = segmentTimeInfo[0].timeline;
  82503. }
  82504. } else if (sourceDuration) {
  82505. segment.duration = sourceDuration;
  82506. segment.timeline = periodStart;
  82507. }
  82508. segment.presentationTime = presentationTime || periodStart;
  82509. segment.number = number;
  82510. return [segment];
  82511. };
  82512. var addSidxSegmentsToPlaylist$1 = function addSidxSegmentsToPlaylist(playlist, sidx, baseUrl) {
  82513. var initSegment = playlist.sidx.map ? playlist.sidx.map : null;
  82514. var sourceDuration = playlist.sidx.duration;
  82515. var timeline = playlist.timeline || 0;
  82516. var sidxByteRange = playlist.sidx.byterange;
  82517. var sidxEnd = sidxByteRange.offset + sidxByteRange.length;
  82518. var timescale2 = sidx.timescale;
  82519. var mediaReferences = sidx.references.filter(function(r2) {
  82520. return r2.referenceType !== 1;
  82521. });
  82522. var segments = [];
  82523. var type2 = playlist.endList ? "static" : "dynamic";
  82524. var periodStart = playlist.sidx.timeline;
  82525. var presentationTime = periodStart;
  82526. var number = playlist.mediaSequence || 0;
  82527. var startIndex;
  82528. if (typeof sidx.firstOffset === "bigint") {
  82529. startIndex = window_1.BigInt(sidxEnd) + sidx.firstOffset;
  82530. } else {
  82531. startIndex = sidxEnd + sidx.firstOffset;
  82532. }
  82533. for (var i2 = 0; i2 < mediaReferences.length; i2++) {
  82534. var reference = sidx.references[i2];
  82535. var size = reference.referencedSize;
  82536. var duration5 = reference.subsegmentDuration;
  82537. var endIndex = void 0;
  82538. if (typeof startIndex === "bigint") {
  82539. endIndex = startIndex + window_1.BigInt(size) - window_1.BigInt(1);
  82540. } else {
  82541. endIndex = startIndex + size - 1;
  82542. }
  82543. var indexRange = startIndex + "-" + endIndex;
  82544. var attributes = {
  82545. baseUrl,
  82546. timescale: timescale2,
  82547. timeline,
  82548. periodStart,
  82549. presentationTime,
  82550. number,
  82551. duration: duration5,
  82552. sourceDuration,
  82553. indexRange,
  82554. type: type2
  82555. };
  82556. var segment = segmentsFromBase(attributes)[0];
  82557. if (initSegment) {
  82558. segment.map = initSegment;
  82559. }
  82560. segments.push(segment);
  82561. if (typeof startIndex === "bigint") {
  82562. startIndex += window_1.BigInt(size);
  82563. } else {
  82564. startIndex += size;
  82565. }
  82566. presentationTime += duration5 / timescale2;
  82567. number++;
  82568. }
  82569. playlist.segments = segments;
  82570. return playlist;
  82571. };
  82572. var SUPPORTED_MEDIA_TYPES = ["AUDIO", "SUBTITLES"];
  82573. var TIME_FUDGE = 1 / 60;
  82574. var getUniqueTimelineStarts = function getUniqueTimelineStarts2(timelineStarts) {
  82575. return union(timelineStarts, function(_ref) {
  82576. var timeline = _ref.timeline;
  82577. return timeline;
  82578. }).sort(function(a, b) {
  82579. return a.timeline > b.timeline ? 1 : -1;
  82580. });
  82581. };
  82582. var findPlaylistWithName = function findPlaylistWithName2(playlists, name) {
  82583. for (var i2 = 0; i2 < playlists.length; i2++) {
  82584. if (playlists[i2].attributes.NAME === name) {
  82585. return playlists[i2];
  82586. }
  82587. }
  82588. return null;
  82589. };
  82590. var getMediaGroupPlaylists = function getMediaGroupPlaylists2(manifest) {
  82591. var mediaGroupPlaylists = [];
  82592. forEachMediaGroup$1(manifest, SUPPORTED_MEDIA_TYPES, function(properties, type2, group, label2) {
  82593. mediaGroupPlaylists = mediaGroupPlaylists.concat(properties.playlists || []);
  82594. });
  82595. return mediaGroupPlaylists;
  82596. };
  82597. var updateMediaSequenceForPlaylist = function updateMediaSequenceForPlaylist2(_ref2) {
  82598. var playlist = _ref2.playlist, mediaSequence = _ref2.mediaSequence;
  82599. playlist.mediaSequence = mediaSequence;
  82600. playlist.segments.forEach(function(segment, index2) {
  82601. segment.number = playlist.mediaSequence + index2;
  82602. });
  82603. };
  82604. var updateSequenceNumbers = function updateSequenceNumbers2(_ref3) {
  82605. var oldPlaylists = _ref3.oldPlaylists, newPlaylists = _ref3.newPlaylists, timelineStarts = _ref3.timelineStarts;
  82606. newPlaylists.forEach(function(playlist) {
  82607. playlist.discontinuitySequence = findIndex(timelineStarts, function(_ref4) {
  82608. var timeline = _ref4.timeline;
  82609. return timeline === playlist.timeline;
  82610. });
  82611. var oldPlaylist = findPlaylistWithName(oldPlaylists, playlist.attributes.NAME);
  82612. if (!oldPlaylist) {
  82613. return;
  82614. }
  82615. if (playlist.sidx) {
  82616. return;
  82617. }
  82618. var firstNewSegment = playlist.segments[0];
  82619. var oldMatchingSegmentIndex = findIndex(oldPlaylist.segments, function(oldSegment) {
  82620. return Math.abs(oldSegment.presentationTime - firstNewSegment.presentationTime) < TIME_FUDGE;
  82621. });
  82622. if (oldMatchingSegmentIndex === -1) {
  82623. updateMediaSequenceForPlaylist({
  82624. playlist,
  82625. mediaSequence: oldPlaylist.mediaSequence + oldPlaylist.segments.length
  82626. });
  82627. playlist.segments[0].discontinuity = true;
  82628. playlist.discontinuityStarts.unshift(0);
  82629. if (!oldPlaylist.segments.length && playlist.timeline > oldPlaylist.timeline || oldPlaylist.segments.length && playlist.timeline > oldPlaylist.segments[oldPlaylist.segments.length - 1].timeline) {
  82630. playlist.discontinuitySequence--;
  82631. }
  82632. return;
  82633. }
  82634. var oldMatchingSegment = oldPlaylist.segments[oldMatchingSegmentIndex];
  82635. if (oldMatchingSegment.discontinuity && !firstNewSegment.discontinuity) {
  82636. firstNewSegment.discontinuity = true;
  82637. playlist.discontinuityStarts.unshift(0);
  82638. playlist.discontinuitySequence--;
  82639. }
  82640. updateMediaSequenceForPlaylist({
  82641. playlist,
  82642. mediaSequence: oldPlaylist.segments[oldMatchingSegmentIndex].number
  82643. });
  82644. });
  82645. };
  82646. var positionManifestOnTimeline = function positionManifestOnTimeline2(_ref5) {
  82647. var oldManifest = _ref5.oldManifest, newManifest = _ref5.newManifest;
  82648. var oldPlaylists = oldManifest.playlists.concat(getMediaGroupPlaylists(oldManifest));
  82649. var newPlaylists = newManifest.playlists.concat(getMediaGroupPlaylists(newManifest));
  82650. newManifest.timelineStarts = getUniqueTimelineStarts([oldManifest.timelineStarts, newManifest.timelineStarts]);
  82651. updateSequenceNumbers({
  82652. oldPlaylists,
  82653. newPlaylists,
  82654. timelineStarts: newManifest.timelineStarts
  82655. });
  82656. return newManifest;
  82657. };
  82658. var generateSidxKey = function generateSidxKey2(sidx) {
  82659. return sidx && sidx.uri + "-" + byteRangeToString(sidx.byterange);
  82660. };
  82661. var mergeDiscontiguousPlaylists = function mergeDiscontiguousPlaylists2(playlists) {
  82662. var mergedPlaylists = values(playlists.reduce(function(acc, playlist) {
  82663. var name = playlist.attributes.id + (playlist.attributes.lang || "");
  82664. if (!acc[name]) {
  82665. acc[name] = playlist;
  82666. acc[name].attributes.timelineStarts = [];
  82667. } else {
  82668. if (playlist.segments) {
  82669. var _acc$name$segments;
  82670. if (playlist.segments[0]) {
  82671. playlist.segments[0].discontinuity = true;
  82672. }
  82673. (_acc$name$segments = acc[name].segments).push.apply(_acc$name$segments, playlist.segments);
  82674. }
  82675. if (playlist.attributes.contentProtection) {
  82676. acc[name].attributes.contentProtection = playlist.attributes.contentProtection;
  82677. }
  82678. }
  82679. acc[name].attributes.timelineStarts.push({
  82680. start: playlist.attributes.periodStart,
  82681. timeline: playlist.attributes.periodStart
  82682. });
  82683. return acc;
  82684. }, {}));
  82685. return mergedPlaylists.map(function(playlist) {
  82686. playlist.discontinuityStarts = findIndexes(playlist.segments || [], "discontinuity");
  82687. return playlist;
  82688. });
  82689. };
  82690. var addSidxSegmentsToPlaylist2 = function addSidxSegmentsToPlaylist3(playlist, sidxMapping) {
  82691. var sidxKey = generateSidxKey(playlist.sidx);
  82692. var sidxMatch = sidxKey && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx;
  82693. if (sidxMatch) {
  82694. addSidxSegmentsToPlaylist$1(playlist, sidxMatch, playlist.sidx.resolvedUri);
  82695. }
  82696. return playlist;
  82697. };
  82698. var addSidxSegmentsToPlaylists = function addSidxSegmentsToPlaylists2(playlists, sidxMapping) {
  82699. if (sidxMapping === void 0) {
  82700. sidxMapping = {};
  82701. }
  82702. if (!Object.keys(sidxMapping).length) {
  82703. return playlists;
  82704. }
  82705. for (var i2 in playlists) {
  82706. playlists[i2] = addSidxSegmentsToPlaylist2(playlists[i2], sidxMapping);
  82707. }
  82708. return playlists;
  82709. };
  82710. var formatAudioPlaylist = function formatAudioPlaylist2(_ref, isAudioOnly3) {
  82711. var _attributes;
  82712. var attributes = _ref.attributes, segments = _ref.segments, sidx = _ref.sidx, mediaSequence = _ref.mediaSequence, discontinuitySequence = _ref.discontinuitySequence, discontinuityStarts = _ref.discontinuityStarts;
  82713. var playlist = {
  82714. attributes: (_attributes = {
  82715. NAME: attributes.id,
  82716. BANDWIDTH: attributes.bandwidth,
  82717. CODECS: attributes.codecs
  82718. }, _attributes["PROGRAM-ID"] = 1, _attributes),
  82719. uri: "",
  82720. endList: attributes.type === "static",
  82721. timeline: attributes.periodStart,
  82722. resolvedUri: "",
  82723. targetDuration: attributes.duration,
  82724. discontinuitySequence,
  82725. discontinuityStarts,
  82726. timelineStarts: attributes.timelineStarts,
  82727. mediaSequence,
  82728. segments
  82729. };
  82730. if (attributes.contentProtection) {
  82731. playlist.contentProtection = attributes.contentProtection;
  82732. }
  82733. if (sidx) {
  82734. playlist.sidx = sidx;
  82735. }
  82736. if (isAudioOnly3) {
  82737. playlist.attributes.AUDIO = "audio";
  82738. playlist.attributes.SUBTITLES = "subs";
  82739. }
  82740. return playlist;
  82741. };
  82742. var formatVttPlaylist = function formatVttPlaylist2(_ref2) {
  82743. var _m3u8Attributes;
  82744. var attributes = _ref2.attributes, segments = _ref2.segments, mediaSequence = _ref2.mediaSequence, discontinuityStarts = _ref2.discontinuityStarts, discontinuitySequence = _ref2.discontinuitySequence;
  82745. if (typeof segments === "undefined") {
  82746. segments = [{
  82747. uri: attributes.baseUrl,
  82748. timeline: attributes.periodStart,
  82749. resolvedUri: attributes.baseUrl || "",
  82750. duration: attributes.sourceDuration,
  82751. number: 0
  82752. }];
  82753. attributes.duration = attributes.sourceDuration;
  82754. }
  82755. var m3u8Attributes = (_m3u8Attributes = {
  82756. NAME: attributes.id,
  82757. BANDWIDTH: attributes.bandwidth
  82758. }, _m3u8Attributes["PROGRAM-ID"] = 1, _m3u8Attributes);
  82759. if (attributes.codecs) {
  82760. m3u8Attributes.CODECS = attributes.codecs;
  82761. }
  82762. return {
  82763. attributes: m3u8Attributes,
  82764. uri: "",
  82765. endList: attributes.type === "static",
  82766. timeline: attributes.periodStart,
  82767. resolvedUri: attributes.baseUrl || "",
  82768. targetDuration: attributes.duration,
  82769. timelineStarts: attributes.timelineStarts,
  82770. discontinuityStarts,
  82771. discontinuitySequence,
  82772. mediaSequence,
  82773. segments
  82774. };
  82775. };
  82776. var organizeAudioPlaylists = function organizeAudioPlaylists2(playlists, sidxMapping, isAudioOnly3) {
  82777. if (sidxMapping === void 0) {
  82778. sidxMapping = {};
  82779. }
  82780. if (isAudioOnly3 === void 0) {
  82781. isAudioOnly3 = false;
  82782. }
  82783. var mainPlaylist;
  82784. var formattedPlaylists = playlists.reduce(function(a, playlist) {
  82785. var role = playlist.attributes.role && playlist.attributes.role.value || "";
  82786. var language = playlist.attributes.lang || "";
  82787. var label2 = playlist.attributes.label || "main";
  82788. if (language && !playlist.attributes.label) {
  82789. var roleLabel = role ? " (" + role + ")" : "";
  82790. label2 = "" + playlist.attributes.lang + roleLabel;
  82791. }
  82792. if (!a[label2]) {
  82793. a[label2] = {
  82794. language,
  82795. autoselect: true,
  82796. default: role === "main",
  82797. playlists: [],
  82798. uri: ""
  82799. };
  82800. }
  82801. var formatted = addSidxSegmentsToPlaylist2(formatAudioPlaylist(playlist, isAudioOnly3), sidxMapping);
  82802. a[label2].playlists.push(formatted);
  82803. if (typeof mainPlaylist === "undefined" && role === "main") {
  82804. mainPlaylist = playlist;
  82805. mainPlaylist.default = true;
  82806. }
  82807. return a;
  82808. }, {});
  82809. if (!mainPlaylist) {
  82810. var firstLabel = Object.keys(formattedPlaylists)[0];
  82811. formattedPlaylists[firstLabel].default = true;
  82812. }
  82813. return formattedPlaylists;
  82814. };
  82815. var organizeVttPlaylists = function organizeVttPlaylists2(playlists, sidxMapping) {
  82816. if (sidxMapping === void 0) {
  82817. sidxMapping = {};
  82818. }
  82819. return playlists.reduce(function(a, playlist) {
  82820. var label2 = playlist.attributes.lang || "text";
  82821. if (!a[label2]) {
  82822. a[label2] = {
  82823. language: label2,
  82824. default: false,
  82825. autoselect: false,
  82826. playlists: [],
  82827. uri: ""
  82828. };
  82829. }
  82830. a[label2].playlists.push(addSidxSegmentsToPlaylist2(formatVttPlaylist(playlist), sidxMapping));
  82831. return a;
  82832. }, {});
  82833. };
  82834. var organizeCaptionServices = function organizeCaptionServices2(captionServices) {
  82835. return captionServices.reduce(function(svcObj, svc) {
  82836. if (!svc) {
  82837. return svcObj;
  82838. }
  82839. svc.forEach(function(service) {
  82840. var channel = service.channel, language = service.language;
  82841. svcObj[language] = {
  82842. autoselect: false,
  82843. default: false,
  82844. instreamId: channel,
  82845. language
  82846. };
  82847. if (service.hasOwnProperty("aspectRatio")) {
  82848. svcObj[language].aspectRatio = service.aspectRatio;
  82849. }
  82850. if (service.hasOwnProperty("easyReader")) {
  82851. svcObj[language].easyReader = service.easyReader;
  82852. }
  82853. if (service.hasOwnProperty("3D")) {
  82854. svcObj[language]["3D"] = service["3D"];
  82855. }
  82856. });
  82857. return svcObj;
  82858. }, {});
  82859. };
  82860. var formatVideoPlaylist = function formatVideoPlaylist2(_ref3) {
  82861. var _attributes2;
  82862. var attributes = _ref3.attributes, segments = _ref3.segments, sidx = _ref3.sidx, discontinuityStarts = _ref3.discontinuityStarts;
  82863. var playlist = {
  82864. attributes: (_attributes2 = {
  82865. NAME: attributes.id,
  82866. AUDIO: "audio",
  82867. SUBTITLES: "subs",
  82868. RESOLUTION: {
  82869. width: attributes.width,
  82870. height: attributes.height
  82871. },
  82872. CODECS: attributes.codecs,
  82873. BANDWIDTH: attributes.bandwidth
  82874. }, _attributes2["PROGRAM-ID"] = 1, _attributes2),
  82875. uri: "",
  82876. endList: attributes.type === "static",
  82877. timeline: attributes.periodStart,
  82878. resolvedUri: "",
  82879. targetDuration: attributes.duration,
  82880. discontinuityStarts,
  82881. timelineStarts: attributes.timelineStarts,
  82882. segments
  82883. };
  82884. if (attributes.frameRate) {
  82885. playlist.attributes["FRAME-RATE"] = attributes.frameRate;
  82886. }
  82887. if (attributes.contentProtection) {
  82888. playlist.contentProtection = attributes.contentProtection;
  82889. }
  82890. if (sidx) {
  82891. playlist.sidx = sidx;
  82892. }
  82893. return playlist;
  82894. };
  82895. var videoOnly = function videoOnly2(_ref4) {
  82896. var attributes = _ref4.attributes;
  82897. return attributes.mimeType === "video/mp4" || attributes.mimeType === "video/webm" || attributes.contentType === "video";
  82898. };
  82899. var audioOnly = function audioOnly2(_ref5) {
  82900. var attributes = _ref5.attributes;
  82901. return attributes.mimeType === "audio/mp4" || attributes.mimeType === "audio/webm" || attributes.contentType === "audio";
  82902. };
  82903. var vttOnly = function vttOnly2(_ref6) {
  82904. var attributes = _ref6.attributes;
  82905. return attributes.mimeType === "text/vtt" || attributes.contentType === "text";
  82906. };
  82907. var addMediaSequenceValues = function addMediaSequenceValues2(playlists, timelineStarts) {
  82908. playlists.forEach(function(playlist) {
  82909. playlist.mediaSequence = 0;
  82910. playlist.discontinuitySequence = findIndex(timelineStarts, function(_ref7) {
  82911. var timeline = _ref7.timeline;
  82912. return timeline === playlist.timeline;
  82913. });
  82914. if (!playlist.segments) {
  82915. return;
  82916. }
  82917. playlist.segments.forEach(function(segment, index2) {
  82918. segment.number = index2;
  82919. });
  82920. });
  82921. };
  82922. var flattenMediaGroupPlaylists = function flattenMediaGroupPlaylists2(mediaGroupObject) {
  82923. if (!mediaGroupObject) {
  82924. return [];
  82925. }
  82926. return Object.keys(mediaGroupObject).reduce(function(acc, label2) {
  82927. var labelContents = mediaGroupObject[label2];
  82928. return acc.concat(labelContents.playlists);
  82929. }, []);
  82930. };
  82931. var toM3u8 = function toM3u82(_ref8) {
  82932. var _mediaGroups;
  82933. var dashPlaylists = _ref8.dashPlaylists, locations = _ref8.locations, _ref8$sidxMapping = _ref8.sidxMapping, sidxMapping = _ref8$sidxMapping === void 0 ? {} : _ref8$sidxMapping, previousManifest = _ref8.previousManifest;
  82934. if (!dashPlaylists.length) {
  82935. return {};
  82936. }
  82937. var _dashPlaylists$0$attr = dashPlaylists[0].attributes, duration5 = _dashPlaylists$0$attr.sourceDuration, type2 = _dashPlaylists$0$attr.type, suggestedPresentationDelay2 = _dashPlaylists$0$attr.suggestedPresentationDelay, minimumUpdatePeriod2 = _dashPlaylists$0$attr.minimumUpdatePeriod;
  82938. var videoPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(videoOnly)).map(formatVideoPlaylist);
  82939. var audioPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(audioOnly));
  82940. var vttPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(vttOnly));
  82941. var captions = dashPlaylists.map(function(playlist) {
  82942. return playlist.attributes.captionServices;
  82943. }).filter(Boolean);
  82944. var manifest = {
  82945. allowCache: true,
  82946. discontinuityStarts: [],
  82947. segments: [],
  82948. endList: true,
  82949. mediaGroups: (_mediaGroups = {
  82950. AUDIO: {},
  82951. VIDEO: {}
  82952. }, _mediaGroups["CLOSED-CAPTIONS"] = {}, _mediaGroups.SUBTITLES = {}, _mediaGroups),
  82953. uri: "",
  82954. duration: duration5,
  82955. playlists: addSidxSegmentsToPlaylists(videoPlaylists, sidxMapping)
  82956. };
  82957. if (minimumUpdatePeriod2 >= 0) {
  82958. manifest.minimumUpdatePeriod = minimumUpdatePeriod2 * 1e3;
  82959. }
  82960. if (locations) {
  82961. manifest.locations = locations;
  82962. }
  82963. if (type2 === "dynamic") {
  82964. manifest.suggestedPresentationDelay = suggestedPresentationDelay2;
  82965. }
  82966. var isAudioOnly3 = manifest.playlists.length === 0;
  82967. var organizedAudioGroup = audioPlaylists.length ? organizeAudioPlaylists(audioPlaylists, sidxMapping, isAudioOnly3) : null;
  82968. var organizedVttGroup = vttPlaylists.length ? organizeVttPlaylists(vttPlaylists, sidxMapping) : null;
  82969. var formattedPlaylists = videoPlaylists.concat(flattenMediaGroupPlaylists(organizedAudioGroup), flattenMediaGroupPlaylists(organizedVttGroup));
  82970. var playlistTimelineStarts = formattedPlaylists.map(function(_ref9) {
  82971. var timelineStarts = _ref9.timelineStarts;
  82972. return timelineStarts;
  82973. });
  82974. manifest.timelineStarts = getUniqueTimelineStarts(playlistTimelineStarts);
  82975. addMediaSequenceValues(formattedPlaylists, manifest.timelineStarts);
  82976. if (organizedAudioGroup) {
  82977. manifest.mediaGroups.AUDIO.audio = organizedAudioGroup;
  82978. }
  82979. if (organizedVttGroup) {
  82980. manifest.mediaGroups.SUBTITLES.subs = organizedVttGroup;
  82981. }
  82982. if (captions.length) {
  82983. manifest.mediaGroups["CLOSED-CAPTIONS"].cc = organizeCaptionServices(captions);
  82984. }
  82985. if (previousManifest) {
  82986. return positionManifestOnTimeline({
  82987. oldManifest: previousManifest,
  82988. newManifest: manifest
  82989. });
  82990. }
  82991. return manifest;
  82992. };
  82993. var getLiveRValue = function getLiveRValue2(attributes, time, duration5) {
  82994. var NOW = attributes.NOW, clientOffset = attributes.clientOffset, availabilityStartTime2 = attributes.availabilityStartTime, _attributes$timescale = attributes.timescale, timescale2 = _attributes$timescale === void 0 ? 1 : _attributes$timescale, _attributes$periodSta = attributes.periodStart, periodStart = _attributes$periodSta === void 0 ? 0 : _attributes$periodSta, _attributes$minimumUp = attributes.minimumUpdatePeriod, minimumUpdatePeriod2 = _attributes$minimumUp === void 0 ? 0 : _attributes$minimumUp;
  82995. var now2 = (NOW + clientOffset) / 1e3;
  82996. var periodStartWC = availabilityStartTime2 + periodStart;
  82997. var periodEndWC = now2 + minimumUpdatePeriod2;
  82998. var periodDuration = periodEndWC - periodStartWC;
  82999. return Math.ceil((periodDuration * timescale2 - time) / duration5);
  83000. };
  83001. var parseByTimeline = function parseByTimeline2(attributes, segmentTimeline) {
  83002. var type2 = attributes.type, _attributes$minimumUp2 = attributes.minimumUpdatePeriod, minimumUpdatePeriod2 = _attributes$minimumUp2 === void 0 ? 0 : _attributes$minimumUp2, _attributes$media = attributes.media, media = _attributes$media === void 0 ? "" : _attributes$media, sourceDuration = attributes.sourceDuration, _attributes$timescale2 = attributes.timescale, timescale2 = _attributes$timescale2 === void 0 ? 1 : _attributes$timescale2, _attributes$startNumb = attributes.startNumber, startNumber2 = _attributes$startNumb === void 0 ? 1 : _attributes$startNumb, timeline = attributes.periodStart;
  83003. var segments = [];
  83004. var time = -1;
  83005. for (var sIndex = 0; sIndex < segmentTimeline.length; sIndex++) {
  83006. var S = segmentTimeline[sIndex];
  83007. var duration5 = S.d;
  83008. var repeat = S.r || 0;
  83009. var segmentTime = S.t || 0;
  83010. if (time < 0) {
  83011. time = segmentTime;
  83012. }
  83013. if (segmentTime && segmentTime > time) {
  83014. time = segmentTime;
  83015. }
  83016. var count = void 0;
  83017. if (repeat < 0) {
  83018. var nextS = sIndex + 1;
  83019. if (nextS === segmentTimeline.length) {
  83020. if (type2 === "dynamic" && minimumUpdatePeriod2 > 0 && media.indexOf("$Number$") > 0) {
  83021. count = getLiveRValue(attributes, time, duration5);
  83022. } else {
  83023. count = (sourceDuration * timescale2 - time) / duration5;
  83024. }
  83025. } else {
  83026. count = (segmentTimeline[nextS].t - time) / duration5;
  83027. }
  83028. } else {
  83029. count = repeat + 1;
  83030. }
  83031. var end = startNumber2 + segments.length + count;
  83032. var number = startNumber2 + segments.length;
  83033. while (number < end) {
  83034. segments.push({
  83035. number,
  83036. duration: duration5 / timescale2,
  83037. time,
  83038. timeline
  83039. });
  83040. time += duration5;
  83041. number++;
  83042. }
  83043. }
  83044. return segments;
  83045. };
  83046. var identifierPattern = /\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g;
  83047. var identifierReplacement = function identifierReplacement2(values3) {
  83048. return function(match, identifier, format, width2) {
  83049. if (match === "$$") {
  83050. return "$";
  83051. }
  83052. if (typeof values3[identifier] === "undefined") {
  83053. return match;
  83054. }
  83055. var value = "" + values3[identifier];
  83056. if (identifier === "RepresentationID") {
  83057. return value;
  83058. }
  83059. if (!format) {
  83060. width2 = 1;
  83061. } else {
  83062. width2 = parseInt(width2, 10);
  83063. }
  83064. if (value.length >= width2) {
  83065. return value;
  83066. }
  83067. return "" + new Array(width2 - value.length + 1).join("0") + value;
  83068. };
  83069. };
  83070. var constructTemplateUrl = function constructTemplateUrl2(url, values3) {
  83071. return url.replace(identifierPattern, identifierReplacement(values3));
  83072. };
  83073. var parseTemplateInfo = function parseTemplateInfo2(attributes, segmentTimeline) {
  83074. if (!attributes.duration && !segmentTimeline) {
  83075. return [{
  83076. number: attributes.startNumber || 1,
  83077. duration: attributes.sourceDuration,
  83078. time: 0,
  83079. timeline: attributes.periodStart
  83080. }];
  83081. }
  83082. if (attributes.duration) {
  83083. return parseByDuration(attributes);
  83084. }
  83085. return parseByTimeline(attributes, segmentTimeline);
  83086. };
  83087. var segmentsFromTemplate = function segmentsFromTemplate2(attributes, segmentTimeline) {
  83088. var templateValues = {
  83089. RepresentationID: attributes.id,
  83090. Bandwidth: attributes.bandwidth || 0
  83091. };
  83092. var _attributes$initializ = attributes.initialization, initialization = _attributes$initializ === void 0 ? {
  83093. sourceURL: "",
  83094. range: ""
  83095. } : _attributes$initializ;
  83096. var mapSegment = urlTypeToSegment({
  83097. baseUrl: attributes.baseUrl,
  83098. source: constructTemplateUrl(initialization.sourceURL, templateValues),
  83099. range: initialization.range
  83100. });
  83101. var segments = parseTemplateInfo(attributes, segmentTimeline);
  83102. return segments.map(function(segment) {
  83103. templateValues.Number = segment.number;
  83104. templateValues.Time = segment.time;
  83105. var uri = constructTemplateUrl(attributes.media || "", templateValues);
  83106. var timescale2 = attributes.timescale || 1;
  83107. var presentationTimeOffset2 = attributes.presentationTimeOffset || 0;
  83108. var presentationTime = attributes.periodStart + (segment.time - presentationTimeOffset2) / timescale2;
  83109. var map = {
  83110. uri,
  83111. timeline: segment.timeline,
  83112. duration: segment.duration,
  83113. resolvedUri: resolveUrl$1(attributes.baseUrl || "", uri),
  83114. map: mapSegment,
  83115. number: segment.number,
  83116. presentationTime
  83117. };
  83118. return map;
  83119. });
  83120. };
  83121. var SegmentURLToSegmentObject = function SegmentURLToSegmentObject2(attributes, segmentUrl) {
  83122. var baseUrl = attributes.baseUrl, _attributes$initializ = attributes.initialization, initialization = _attributes$initializ === void 0 ? {} : _attributes$initializ;
  83123. var initSegment = urlTypeToSegment({
  83124. baseUrl,
  83125. source: initialization.sourceURL,
  83126. range: initialization.range
  83127. });
  83128. var segment = urlTypeToSegment({
  83129. baseUrl,
  83130. source: segmentUrl.media,
  83131. range: segmentUrl.mediaRange
  83132. });
  83133. segment.map = initSegment;
  83134. return segment;
  83135. };
  83136. var segmentsFromList = function segmentsFromList2(attributes, segmentTimeline) {
  83137. var duration5 = attributes.duration, _attributes$segmentUr = attributes.segmentUrls, segmentUrls = _attributes$segmentUr === void 0 ? [] : _attributes$segmentUr, periodStart = attributes.periodStart;
  83138. if (!duration5 && !segmentTimeline || duration5 && segmentTimeline) {
  83139. throw new Error(errors.SEGMENT_TIME_UNSPECIFIED);
  83140. }
  83141. var segmentUrlMap = segmentUrls.map(function(segmentUrlObject) {
  83142. return SegmentURLToSegmentObject(attributes, segmentUrlObject);
  83143. });
  83144. var segmentTimeInfo;
  83145. if (duration5) {
  83146. segmentTimeInfo = parseByDuration(attributes);
  83147. }
  83148. if (segmentTimeline) {
  83149. segmentTimeInfo = parseByTimeline(attributes, segmentTimeline);
  83150. }
  83151. var segments = segmentTimeInfo.map(function(segmentTime, index2) {
  83152. if (segmentUrlMap[index2]) {
  83153. var segment = segmentUrlMap[index2];
  83154. var timescale2 = attributes.timescale || 1;
  83155. var presentationTimeOffset2 = attributes.presentationTimeOffset || 0;
  83156. segment.timeline = segmentTime.timeline;
  83157. segment.duration = segmentTime.duration;
  83158. segment.number = segmentTime.number;
  83159. segment.presentationTime = periodStart + (segmentTime.time - presentationTimeOffset2) / timescale2;
  83160. return segment;
  83161. }
  83162. }).filter(function(segment) {
  83163. return segment;
  83164. });
  83165. return segments;
  83166. };
  83167. var generateSegments = function generateSegments2(_ref) {
  83168. var attributes = _ref.attributes, segmentInfo = _ref.segmentInfo;
  83169. var segmentAttributes;
  83170. var segmentsFn;
  83171. if (segmentInfo.template) {
  83172. segmentsFn = segmentsFromTemplate;
  83173. segmentAttributes = merge(attributes, segmentInfo.template);
  83174. } else if (segmentInfo.base) {
  83175. segmentsFn = segmentsFromBase;
  83176. segmentAttributes = merge(attributes, segmentInfo.base);
  83177. } else if (segmentInfo.list) {
  83178. segmentsFn = segmentsFromList;
  83179. segmentAttributes = merge(attributes, segmentInfo.list);
  83180. }
  83181. var segmentsInfo = {
  83182. attributes
  83183. };
  83184. if (!segmentsFn) {
  83185. return segmentsInfo;
  83186. }
  83187. var segments = segmentsFn(segmentAttributes, segmentInfo.segmentTimeline);
  83188. if (segmentAttributes.duration) {
  83189. var _segmentAttributes = segmentAttributes, duration5 = _segmentAttributes.duration, _segmentAttributes$ti = _segmentAttributes.timescale, timescale2 = _segmentAttributes$ti === void 0 ? 1 : _segmentAttributes$ti;
  83190. segmentAttributes.duration = duration5 / timescale2;
  83191. } else if (segments.length) {
  83192. segmentAttributes.duration = segments.reduce(function(max2, segment) {
  83193. return Math.max(max2, Math.ceil(segment.duration));
  83194. }, 0);
  83195. } else {
  83196. segmentAttributes.duration = 0;
  83197. }
  83198. segmentsInfo.attributes = segmentAttributes;
  83199. segmentsInfo.segments = segments;
  83200. if (segmentInfo.base && segmentAttributes.indexRange) {
  83201. segmentsInfo.sidx = segments[0];
  83202. segmentsInfo.segments = [];
  83203. }
  83204. return segmentsInfo;
  83205. };
  83206. var toPlaylists = function toPlaylists2(representations) {
  83207. return representations.map(generateSegments);
  83208. };
  83209. var findChildren = function findChildren2(element, name) {
  83210. return from(element.childNodes).filter(function(_ref) {
  83211. var tagName = _ref.tagName;
  83212. return tagName === name;
  83213. });
  83214. };
  83215. var getContent = function getContent2(element) {
  83216. return element.textContent.trim();
  83217. };
  83218. var parseDivisionValue = function parseDivisionValue2(value) {
  83219. return parseFloat(value.split("/").reduce(function(prev, current) {
  83220. return prev / current;
  83221. }));
  83222. };
  83223. var parseDuration = function parseDuration2(str) {
  83224. var SECONDS_IN_YEAR = 365 * 24 * 60 * 60;
  83225. var SECONDS_IN_MONTH = 30 * 24 * 60 * 60;
  83226. var SECONDS_IN_DAY = 24 * 60 * 60;
  83227. var SECONDS_IN_HOUR = 60 * 60;
  83228. var SECONDS_IN_MIN = 60;
  83229. var durationRegex = /P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/;
  83230. var match = durationRegex.exec(str);
  83231. if (!match) {
  83232. return 0;
  83233. }
  83234. var _match$slice = match.slice(1), year = _match$slice[0], month = _match$slice[1], day = _match$slice[2], hour = _match$slice[3], minute = _match$slice[4], second = _match$slice[5];
  83235. return parseFloat(year || 0) * SECONDS_IN_YEAR + parseFloat(month || 0) * SECONDS_IN_MONTH + parseFloat(day || 0) * SECONDS_IN_DAY + parseFloat(hour || 0) * SECONDS_IN_HOUR + parseFloat(minute || 0) * SECONDS_IN_MIN + parseFloat(second || 0);
  83236. };
  83237. var parseDate = function parseDate2(str) {
  83238. var dateRegex = /^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/;
  83239. if (dateRegex.test(str)) {
  83240. str += "Z";
  83241. }
  83242. return Date.parse(str);
  83243. };
  83244. var parsers = {
  83245. mediaPresentationDuration: function mediaPresentationDuration(value) {
  83246. return parseDuration(value);
  83247. },
  83248. availabilityStartTime: function availabilityStartTime(value) {
  83249. return parseDate(value) / 1e3;
  83250. },
  83251. minimumUpdatePeriod: function minimumUpdatePeriod(value) {
  83252. return parseDuration(value);
  83253. },
  83254. suggestedPresentationDelay: function suggestedPresentationDelay(value) {
  83255. return parseDuration(value);
  83256. },
  83257. type: function type(value) {
  83258. return value;
  83259. },
  83260. timeShiftBufferDepth: function timeShiftBufferDepth(value) {
  83261. return parseDuration(value);
  83262. },
  83263. start: function start(value) {
  83264. return parseDuration(value);
  83265. },
  83266. width: function width(value) {
  83267. return parseInt(value, 10);
  83268. },
  83269. height: function height(value) {
  83270. return parseInt(value, 10);
  83271. },
  83272. bandwidth: function bandwidth(value) {
  83273. return parseInt(value, 10);
  83274. },
  83275. frameRate: function frameRate(value) {
  83276. return parseDivisionValue(value);
  83277. },
  83278. startNumber: function startNumber(value) {
  83279. return parseInt(value, 10);
  83280. },
  83281. timescale: function timescale(value) {
  83282. return parseInt(value, 10);
  83283. },
  83284. presentationTimeOffset: function presentationTimeOffset(value) {
  83285. return parseInt(value, 10);
  83286. },
  83287. duration: function duration(value) {
  83288. var parsedValue = parseInt(value, 10);
  83289. if (isNaN(parsedValue)) {
  83290. return parseDuration(value);
  83291. }
  83292. return parsedValue;
  83293. },
  83294. d: function d(value) {
  83295. return parseInt(value, 10);
  83296. },
  83297. t: function t(value) {
  83298. return parseInt(value, 10);
  83299. },
  83300. r: function r(value) {
  83301. return parseInt(value, 10);
  83302. },
  83303. DEFAULT: function DEFAULT(value) {
  83304. return value;
  83305. }
  83306. };
  83307. var parseAttributes2 = function parseAttributes3(el) {
  83308. if (!(el && el.attributes)) {
  83309. return {};
  83310. }
  83311. return from(el.attributes).reduce(function(a, e) {
  83312. var parseFn = parsers[e.name] || parsers.DEFAULT;
  83313. a[e.name] = parseFn(e.value);
  83314. return a;
  83315. }, {});
  83316. };
  83317. var keySystemsMap = {
  83318. "urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b": "org.w3.clearkey",
  83319. "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed": "com.widevine.alpha",
  83320. "urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95": "com.microsoft.playready",
  83321. "urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb": "com.adobe.primetime"
  83322. };
  83323. var buildBaseUrls = function buildBaseUrls2(referenceUrls, baseUrlElements) {
  83324. if (!baseUrlElements.length) {
  83325. return referenceUrls;
  83326. }
  83327. return flatten(referenceUrls.map(function(reference) {
  83328. return baseUrlElements.map(function(baseUrlElement) {
  83329. return resolveUrl$1(reference, getContent(baseUrlElement));
  83330. });
  83331. }));
  83332. };
  83333. var getSegmentInformation = function getSegmentInformation2(adaptationSet) {
  83334. var segmentTemplate = findChildren(adaptationSet, "SegmentTemplate")[0];
  83335. var segmentList = findChildren(adaptationSet, "SegmentList")[0];
  83336. var segmentUrls = segmentList && findChildren(segmentList, "SegmentURL").map(function(s) {
  83337. return merge({
  83338. tag: "SegmentURL"
  83339. }, parseAttributes2(s));
  83340. });
  83341. var segmentBase = findChildren(adaptationSet, "SegmentBase")[0];
  83342. var segmentTimelineParentNode = segmentList || segmentTemplate;
  83343. var segmentTimeline = segmentTimelineParentNode && findChildren(segmentTimelineParentNode, "SegmentTimeline")[0];
  83344. var segmentInitializationParentNode = segmentList || segmentBase || segmentTemplate;
  83345. var segmentInitialization = segmentInitializationParentNode && findChildren(segmentInitializationParentNode, "Initialization")[0];
  83346. var template = segmentTemplate && parseAttributes2(segmentTemplate);
  83347. if (template && segmentInitialization) {
  83348. template.initialization = segmentInitialization && parseAttributes2(segmentInitialization);
  83349. } else if (template && template.initialization) {
  83350. template.initialization = {
  83351. sourceURL: template.initialization
  83352. };
  83353. }
  83354. var segmentInfo = {
  83355. template,
  83356. segmentTimeline: segmentTimeline && findChildren(segmentTimeline, "S").map(function(s) {
  83357. return parseAttributes2(s);
  83358. }),
  83359. list: segmentList && merge(parseAttributes2(segmentList), {
  83360. segmentUrls,
  83361. initialization: parseAttributes2(segmentInitialization)
  83362. }),
  83363. base: segmentBase && merge(parseAttributes2(segmentBase), {
  83364. initialization: parseAttributes2(segmentInitialization)
  83365. })
  83366. };
  83367. Object.keys(segmentInfo).forEach(function(key) {
  83368. if (!segmentInfo[key]) {
  83369. delete segmentInfo[key];
  83370. }
  83371. });
  83372. return segmentInfo;
  83373. };
  83374. var inheritBaseUrls = function inheritBaseUrls2(adaptationSetAttributes, adaptationSetBaseUrls, adaptationSetSegmentInfo) {
  83375. return function(representation) {
  83376. var repBaseUrlElements = findChildren(representation, "BaseURL");
  83377. var repBaseUrls = buildBaseUrls(adaptationSetBaseUrls, repBaseUrlElements);
  83378. var attributes = merge(adaptationSetAttributes, parseAttributes2(representation));
  83379. var representationSegmentInfo = getSegmentInformation(representation);
  83380. return repBaseUrls.map(function(baseUrl) {
  83381. return {
  83382. segmentInfo: merge(adaptationSetSegmentInfo, representationSegmentInfo),
  83383. attributes: merge(attributes, {
  83384. baseUrl
  83385. })
  83386. };
  83387. });
  83388. };
  83389. };
  83390. var generateKeySystemInformation = function generateKeySystemInformation2(contentProtectionNodes) {
  83391. return contentProtectionNodes.reduce(function(acc, node) {
  83392. var attributes = parseAttributes2(node);
  83393. if (attributes.schemeIdUri) {
  83394. attributes.schemeIdUri = attributes.schemeIdUri.toLowerCase();
  83395. }
  83396. var keySystem = keySystemsMap[attributes.schemeIdUri];
  83397. if (keySystem) {
  83398. acc[keySystem] = {
  83399. attributes
  83400. };
  83401. var psshNode = findChildren(node, "cenc:pssh")[0];
  83402. if (psshNode) {
  83403. var pssh = getContent(psshNode);
  83404. acc[keySystem].pssh = pssh && decodeB64ToUint8Array(pssh);
  83405. }
  83406. }
  83407. return acc;
  83408. }, {});
  83409. };
  83410. var parseCaptionServiceMetadata = function parseCaptionServiceMetadata2(service) {
  83411. if (service.schemeIdUri === "urn:scte:dash:cc:cea-608:2015") {
  83412. var values3 = typeof service.value !== "string" ? [] : service.value.split(";");
  83413. return values3.map(function(value) {
  83414. var channel;
  83415. var language;
  83416. language = value;
  83417. if (/^CC\d=/.test(value)) {
  83418. var _value$split = value.split("=");
  83419. channel = _value$split[0];
  83420. language = _value$split[1];
  83421. } else if (/^CC\d$/.test(value)) {
  83422. channel = value;
  83423. }
  83424. return {
  83425. channel,
  83426. language
  83427. };
  83428. });
  83429. } else if (service.schemeIdUri === "urn:scte:dash:cc:cea-708:2015") {
  83430. var _values = typeof service.value !== "string" ? [] : service.value.split(";");
  83431. return _values.map(function(value) {
  83432. var flags = {
  83433. "channel": void 0,
  83434. "language": void 0,
  83435. "aspectRatio": 1,
  83436. "easyReader": 0,
  83437. "3D": 0
  83438. };
  83439. if (/=/.test(value)) {
  83440. var _value$split2 = value.split("="), channel = _value$split2[0], _value$split2$ = _value$split2[1], opts = _value$split2$ === void 0 ? "" : _value$split2$;
  83441. flags.channel = channel;
  83442. flags.language = value;
  83443. opts.split(",").forEach(function(opt) {
  83444. var _opt$split = opt.split(":"), name = _opt$split[0], val = _opt$split[1];
  83445. if (name === "lang") {
  83446. flags.language = val;
  83447. } else if (name === "er") {
  83448. flags.easyReader = Number(val);
  83449. } else if (name === "war") {
  83450. flags.aspectRatio = Number(val);
  83451. } else if (name === "3D") {
  83452. flags["3D"] = Number(val);
  83453. }
  83454. });
  83455. } else {
  83456. flags.language = value;
  83457. }
  83458. if (flags.channel) {
  83459. flags.channel = "SERVICE" + flags.channel;
  83460. }
  83461. return flags;
  83462. });
  83463. }
  83464. };
  83465. var toRepresentations = function toRepresentations2(periodAttributes, periodBaseUrls, periodSegmentInfo) {
  83466. return function(adaptationSet) {
  83467. var adaptationSetAttributes = parseAttributes2(adaptationSet);
  83468. var adaptationSetBaseUrls = buildBaseUrls(periodBaseUrls, findChildren(adaptationSet, "BaseURL"));
  83469. var role = findChildren(adaptationSet, "Role")[0];
  83470. var roleAttributes = {
  83471. role: parseAttributes2(role)
  83472. };
  83473. var attrs = merge(periodAttributes, adaptationSetAttributes, roleAttributes);
  83474. var accessibility = findChildren(adaptationSet, "Accessibility")[0];
  83475. var captionServices = parseCaptionServiceMetadata(parseAttributes2(accessibility));
  83476. if (captionServices) {
  83477. attrs = merge(attrs, {
  83478. captionServices
  83479. });
  83480. }
  83481. var label2 = findChildren(adaptationSet, "Label")[0];
  83482. if (label2 && label2.childNodes.length) {
  83483. var labelVal = label2.childNodes[0].nodeValue.trim();
  83484. attrs = merge(attrs, {
  83485. label: labelVal
  83486. });
  83487. }
  83488. var contentProtection = generateKeySystemInformation(findChildren(adaptationSet, "ContentProtection"));
  83489. if (Object.keys(contentProtection).length) {
  83490. attrs = merge(attrs, {
  83491. contentProtection
  83492. });
  83493. }
  83494. var segmentInfo = getSegmentInformation(adaptationSet);
  83495. var representations = findChildren(adaptationSet, "Representation");
  83496. var adaptationSetSegmentInfo = merge(periodSegmentInfo, segmentInfo);
  83497. return flatten(representations.map(inheritBaseUrls(attrs, adaptationSetBaseUrls, adaptationSetSegmentInfo)));
  83498. };
  83499. };
  83500. var toAdaptationSets = function toAdaptationSets2(mpdAttributes, mpdBaseUrls) {
  83501. return function(period, index2) {
  83502. var periodBaseUrls = buildBaseUrls(mpdBaseUrls, findChildren(period.node, "BaseURL"));
  83503. var periodAttributes = merge(mpdAttributes, {
  83504. periodStart: period.attributes.start
  83505. });
  83506. if (typeof period.attributes.duration === "number") {
  83507. periodAttributes.periodDuration = period.attributes.duration;
  83508. }
  83509. var adaptationSets = findChildren(period.node, "AdaptationSet");
  83510. var periodSegmentInfo = getSegmentInformation(period.node);
  83511. return flatten(adaptationSets.map(toRepresentations(periodAttributes, periodBaseUrls, periodSegmentInfo)));
  83512. };
  83513. };
  83514. var getPeriodStart = function getPeriodStart2(_ref) {
  83515. var attributes = _ref.attributes, priorPeriodAttributes = _ref.priorPeriodAttributes, mpdType = _ref.mpdType;
  83516. if (typeof attributes.start === "number") {
  83517. return attributes.start;
  83518. }
  83519. if (priorPeriodAttributes && typeof priorPeriodAttributes.start === "number" && typeof priorPeriodAttributes.duration === "number") {
  83520. return priorPeriodAttributes.start + priorPeriodAttributes.duration;
  83521. }
  83522. if (!priorPeriodAttributes && mpdType === "static") {
  83523. return 0;
  83524. }
  83525. return null;
  83526. };
  83527. var inheritAttributes = function inheritAttributes2(mpd, options2) {
  83528. if (options2 === void 0) {
  83529. options2 = {};
  83530. }
  83531. var _options = options2, _options$manifestUri = _options.manifestUri, manifestUri = _options$manifestUri === void 0 ? "" : _options$manifestUri, _options$NOW = _options.NOW, NOW = _options$NOW === void 0 ? Date.now() : _options$NOW, _options$clientOffset = _options.clientOffset, clientOffset = _options$clientOffset === void 0 ? 0 : _options$clientOffset;
  83532. var periodNodes = findChildren(mpd, "Period");
  83533. if (!periodNodes.length) {
  83534. throw new Error(errors.INVALID_NUMBER_OF_PERIOD);
  83535. }
  83536. var locations = findChildren(mpd, "Location");
  83537. var mpdAttributes = parseAttributes2(mpd);
  83538. var mpdBaseUrls = buildBaseUrls([manifestUri], findChildren(mpd, "BaseURL"));
  83539. mpdAttributes.type = mpdAttributes.type || "static";
  83540. mpdAttributes.sourceDuration = mpdAttributes.mediaPresentationDuration || 0;
  83541. mpdAttributes.NOW = NOW;
  83542. mpdAttributes.clientOffset = clientOffset;
  83543. if (locations.length) {
  83544. mpdAttributes.locations = locations.map(getContent);
  83545. }
  83546. var periods = [];
  83547. periodNodes.forEach(function(node, index2) {
  83548. var attributes = parseAttributes2(node);
  83549. var priorPeriod = periods[index2 - 1];
  83550. attributes.start = getPeriodStart({
  83551. attributes,
  83552. priorPeriodAttributes: priorPeriod ? priorPeriod.attributes : null,
  83553. mpdType: mpdAttributes.type
  83554. });
  83555. periods.push({
  83556. node,
  83557. attributes
  83558. });
  83559. });
  83560. return {
  83561. locations: mpdAttributes.locations,
  83562. representationInfo: flatten(periods.map(toAdaptationSets(mpdAttributes, mpdBaseUrls)))
  83563. };
  83564. };
  83565. var stringToMpdXml = function stringToMpdXml2(manifestString) {
  83566. if (manifestString === "") {
  83567. throw new Error(errors.DASH_EMPTY_MANIFEST);
  83568. }
  83569. var parser2 = new DOMParser();
  83570. var xml;
  83571. var mpd;
  83572. try {
  83573. xml = parser2.parseFromString(manifestString, "application/xml");
  83574. mpd = xml && xml.documentElement.tagName === "MPD" ? xml.documentElement : null;
  83575. } catch (e) {
  83576. }
  83577. if (!mpd || mpd && mpd.getElementsByTagName("parsererror").length > 0) {
  83578. throw new Error(errors.DASH_INVALID_XML);
  83579. }
  83580. return mpd;
  83581. };
  83582. var parseUTCTimingScheme = function parseUTCTimingScheme2(mpd) {
  83583. var UTCTimingNode = findChildren(mpd, "UTCTiming")[0];
  83584. if (!UTCTimingNode) {
  83585. return null;
  83586. }
  83587. var attributes = parseAttributes2(UTCTimingNode);
  83588. switch (attributes.schemeIdUri) {
  83589. case "urn:mpeg:dash:utc:http-head:2014":
  83590. case "urn:mpeg:dash:utc:http-head:2012":
  83591. attributes.method = "HEAD";
  83592. break;
  83593. case "urn:mpeg:dash:utc:http-xsdate:2014":
  83594. case "urn:mpeg:dash:utc:http-iso:2014":
  83595. case "urn:mpeg:dash:utc:http-xsdate:2012":
  83596. case "urn:mpeg:dash:utc:http-iso:2012":
  83597. attributes.method = "GET";
  83598. break;
  83599. case "urn:mpeg:dash:utc:direct:2014":
  83600. case "urn:mpeg:dash:utc:direct:2012":
  83601. attributes.method = "DIRECT";
  83602. attributes.value = Date.parse(attributes.value);
  83603. break;
  83604. case "urn:mpeg:dash:utc:http-ntp:2014":
  83605. case "urn:mpeg:dash:utc:ntp:2014":
  83606. case "urn:mpeg:dash:utc:sntp:2014":
  83607. default:
  83608. throw new Error(errors.UNSUPPORTED_UTC_TIMING_SCHEME);
  83609. }
  83610. return attributes;
  83611. };
  83612. var parse = function parse2(manifestString, options2) {
  83613. if (options2 === void 0) {
  83614. options2 = {};
  83615. }
  83616. var parsedManifestInfo = inheritAttributes(stringToMpdXml(manifestString), options2);
  83617. var playlists = toPlaylists(parsedManifestInfo.representationInfo);
  83618. return toM3u8({
  83619. dashPlaylists: playlists,
  83620. locations: parsedManifestInfo.locations,
  83621. sidxMapping: options2.sidxMapping,
  83622. previousManifest: options2.previousManifest
  83623. });
  83624. };
  83625. var parseUTCTiming = function parseUTCTiming2(manifestString) {
  83626. return parseUTCTimingScheme(stringToMpdXml(manifestString));
  83627. };
  83628. var MAX_UINT32 = Math.pow(2, 32);
  83629. var getUint64$1 = function(uint8) {
  83630. var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength);
  83631. var value;
  83632. if (dv.getBigUint64) {
  83633. value = dv.getBigUint64(0);
  83634. if (value < Number.MAX_SAFE_INTEGER) {
  83635. return Number(value);
  83636. }
  83637. return value;
  83638. }
  83639. return dv.getUint32(0) * MAX_UINT32 + dv.getUint32(4);
  83640. };
  83641. var numbers = {
  83642. getUint64: getUint64$1,
  83643. MAX_UINT32
  83644. };
  83645. var getUint64 = numbers.getUint64;
  83646. var parseSidx = function(data) {
  83647. var view = new DataView(data.buffer, data.byteOffset, data.byteLength), result = {
  83648. version: data[0],
  83649. flags: new Uint8Array(data.subarray(1, 4)),
  83650. references: [],
  83651. referenceId: view.getUint32(4),
  83652. timescale: view.getUint32(8)
  83653. }, i2 = 12;
  83654. if (result.version === 0) {
  83655. result.earliestPresentationTime = view.getUint32(i2);
  83656. result.firstOffset = view.getUint32(i2 + 4);
  83657. i2 += 8;
  83658. } else {
  83659. result.earliestPresentationTime = getUint64(data.subarray(i2));
  83660. result.firstOffset = getUint64(data.subarray(i2 + 8));
  83661. i2 += 16;
  83662. }
  83663. i2 += 2;
  83664. var referenceCount = view.getUint16(i2);
  83665. i2 += 2;
  83666. for (; referenceCount > 0; i2 += 12, referenceCount--) {
  83667. result.references.push({
  83668. referenceType: (data[i2] & 128) >>> 7,
  83669. referencedSize: view.getUint32(i2) & 2147483647,
  83670. subsegmentDuration: view.getUint32(i2 + 4),
  83671. startsWithSap: !!(data[i2 + 8] & 128),
  83672. sapType: (data[i2 + 8] & 112) >>> 4,
  83673. sapDeltaTime: view.getUint32(i2 + 8) & 268435455
  83674. });
  83675. }
  83676. return result;
  83677. };
  83678. var parseSidx_1 = parseSidx;
  83679. var ID3 = toUint82([73, 68, 51]);
  83680. var getId3Size2 = function getId3Size3(bytes, offset) {
  83681. if (offset === void 0) {
  83682. offset = 0;
  83683. }
  83684. bytes = toUint82(bytes);
  83685. var flags = bytes[offset + 5];
  83686. var returnSize = bytes[offset + 6] << 21 | bytes[offset + 7] << 14 | bytes[offset + 8] << 7 | bytes[offset + 9];
  83687. var footerPresent = (flags & 16) >> 4;
  83688. if (footerPresent) {
  83689. return returnSize + 20;
  83690. }
  83691. return returnSize + 10;
  83692. };
  83693. var getId3Offset2 = function getId3Offset3(bytes, offset) {
  83694. if (offset === void 0) {
  83695. offset = 0;
  83696. }
  83697. bytes = toUint82(bytes);
  83698. if (bytes.length - offset < 10 || !bytesMatch2(bytes, ID3, {
  83699. offset
  83700. })) {
  83701. return offset;
  83702. }
  83703. offset += getId3Size2(bytes, offset);
  83704. return getId3Offset3(bytes, offset);
  83705. };
  83706. var normalizePath$1 = function normalizePath3(path) {
  83707. if (typeof path === "string") {
  83708. return stringToBytes2(path);
  83709. }
  83710. if (typeof path === "number") {
  83711. return path;
  83712. }
  83713. return path;
  83714. };
  83715. var normalizePaths$1 = function normalizePaths3(paths) {
  83716. if (!Array.isArray(paths)) {
  83717. return [normalizePath$1(paths)];
  83718. }
  83719. return paths.map(function(p) {
  83720. return normalizePath$1(p);
  83721. });
  83722. };
  83723. var findBox2 = function findBox3(bytes, paths, complete) {
  83724. if (complete === void 0) {
  83725. complete = false;
  83726. }
  83727. paths = normalizePaths$1(paths);
  83728. bytes = toUint82(bytes);
  83729. var results = [];
  83730. if (!paths.length) {
  83731. return results;
  83732. }
  83733. var i2 = 0;
  83734. while (i2 < bytes.length) {
  83735. var size = (bytes[i2] << 24 | bytes[i2 + 1] << 16 | bytes[i2 + 2] << 8 | bytes[i2 + 3]) >>> 0;
  83736. var type2 = bytes.subarray(i2 + 4, i2 + 8);
  83737. if (size === 0) {
  83738. break;
  83739. }
  83740. var end = i2 + size;
  83741. if (end > bytes.length) {
  83742. if (complete) {
  83743. break;
  83744. }
  83745. end = bytes.length;
  83746. }
  83747. var data = bytes.subarray(i2 + 8, end);
  83748. if (bytesMatch2(type2, paths[0])) {
  83749. if (paths.length === 1) {
  83750. results.push(data);
  83751. } else {
  83752. results.push.apply(results, findBox3(data, paths.slice(1), complete));
  83753. }
  83754. }
  83755. i2 = end;
  83756. }
  83757. return results;
  83758. };
  83759. var EBML_TAGS = {
  83760. EBML: toUint82([26, 69, 223, 163]),
  83761. DocType: toUint82([66, 130]),
  83762. Segment: toUint82([24, 83, 128, 103]),
  83763. SegmentInfo: toUint82([21, 73, 169, 102]),
  83764. Tracks: toUint82([22, 84, 174, 107]),
  83765. Track: toUint82([174]),
  83766. TrackNumber: toUint82([215]),
  83767. DefaultDuration: toUint82([35, 227, 131]),
  83768. TrackEntry: toUint82([174]),
  83769. TrackType: toUint82([131]),
  83770. FlagDefault: toUint82([136]),
  83771. CodecID: toUint82([134]),
  83772. CodecPrivate: toUint82([99, 162]),
  83773. VideoTrack: toUint82([224]),
  83774. AudioTrack: toUint82([225]),
  83775. Cluster: toUint82([31, 67, 182, 117]),
  83776. Timestamp: toUint82([231]),
  83777. TimestampScale: toUint82([42, 215, 177]),
  83778. BlockGroup: toUint82([160]),
  83779. BlockDuration: toUint82([155]),
  83780. Block: toUint82([161]),
  83781. SimpleBlock: toUint82([163])
  83782. };
  83783. var LENGTH_TABLE = [128, 64, 32, 16, 8, 4, 2, 1];
  83784. var getLength2 = function getLength3(byte) {
  83785. var len = 1;
  83786. for (var i2 = 0; i2 < LENGTH_TABLE.length; i2++) {
  83787. if (byte & LENGTH_TABLE[i2]) {
  83788. break;
  83789. }
  83790. len++;
  83791. }
  83792. return len;
  83793. };
  83794. var getvint2 = function getvint3(bytes, offset, removeLength, signed) {
  83795. if (removeLength === void 0) {
  83796. removeLength = true;
  83797. }
  83798. if (signed === void 0) {
  83799. signed = false;
  83800. }
  83801. var length = getLength2(bytes[offset]);
  83802. var valueBytes = bytes.subarray(offset, offset + length);
  83803. if (removeLength) {
  83804. valueBytes = Array.prototype.slice.call(bytes, offset, offset + length);
  83805. valueBytes[0] ^= LENGTH_TABLE[length - 1];
  83806. }
  83807. return {
  83808. length,
  83809. value: bytesToNumber2(valueBytes, {
  83810. signed
  83811. }),
  83812. bytes: valueBytes
  83813. };
  83814. };
  83815. var normalizePath4 = function normalizePath5(path) {
  83816. if (typeof path === "string") {
  83817. return path.match(/.{1,2}/g).map(function(p) {
  83818. return normalizePath5(p);
  83819. });
  83820. }
  83821. if (typeof path === "number") {
  83822. return numberToBytes2(path);
  83823. }
  83824. return path;
  83825. };
  83826. var normalizePaths4 = function normalizePaths5(paths) {
  83827. if (!Array.isArray(paths)) {
  83828. return [normalizePath4(paths)];
  83829. }
  83830. return paths.map(function(p) {
  83831. return normalizePath4(p);
  83832. });
  83833. };
  83834. var getInfinityDataSize2 = function getInfinityDataSize3(id, bytes, offset) {
  83835. if (offset >= bytes.length) {
  83836. return bytes.length;
  83837. }
  83838. var innerid = getvint2(bytes, offset, false);
  83839. if (bytesMatch2(id.bytes, innerid.bytes)) {
  83840. return offset;
  83841. }
  83842. var dataHeader = getvint2(bytes, offset + innerid.length);
  83843. return getInfinityDataSize3(id, bytes, offset + dataHeader.length + dataHeader.value + innerid.length);
  83844. };
  83845. var findEbml2 = function findEbml3(bytes, paths) {
  83846. paths = normalizePaths4(paths);
  83847. bytes = toUint82(bytes);
  83848. var results = [];
  83849. if (!paths.length) {
  83850. return results;
  83851. }
  83852. var i2 = 0;
  83853. while (i2 < bytes.length) {
  83854. var id = getvint2(bytes, i2, false);
  83855. var dataHeader = getvint2(bytes, i2 + id.length);
  83856. var dataStart = i2 + id.length + dataHeader.length;
  83857. if (dataHeader.value === 127) {
  83858. dataHeader.value = getInfinityDataSize2(id, bytes, dataStart);
  83859. if (dataHeader.value !== bytes.length) {
  83860. dataHeader.value -= dataStart;
  83861. }
  83862. }
  83863. var dataEnd = dataStart + dataHeader.value > bytes.length ? bytes.length : dataStart + dataHeader.value;
  83864. var data = bytes.subarray(dataStart, dataEnd);
  83865. if (bytesMatch2(paths[0], id.bytes)) {
  83866. if (paths.length === 1) {
  83867. results.push(data);
  83868. } else {
  83869. results = results.concat(findEbml3(data, paths.slice(1)));
  83870. }
  83871. }
  83872. var totalLength = id.length + dataHeader.length + data.length;
  83873. i2 += totalLength;
  83874. }
  83875. return results;
  83876. };
  83877. var NAL_TYPE_ONE = toUint82([0, 0, 0, 1]);
  83878. var NAL_TYPE_TWO = toUint82([0, 0, 1]);
  83879. var EMULATION_PREVENTION = toUint82([0, 0, 3]);
  83880. var discardEmulationPreventionBytes2 = function discardEmulationPreventionBytes3(bytes) {
  83881. var positions = [];
  83882. var i2 = 1;
  83883. while (i2 < bytes.length - 2) {
  83884. if (bytesMatch2(bytes.subarray(i2, i2 + 3), EMULATION_PREVENTION)) {
  83885. positions.push(i2 + 2);
  83886. i2++;
  83887. }
  83888. i2++;
  83889. }
  83890. if (positions.length === 0) {
  83891. return bytes;
  83892. }
  83893. var newLength = bytes.length - positions.length;
  83894. var newData = new Uint8Array(newLength);
  83895. var sourceIndex = 0;
  83896. for (i2 = 0; i2 < newLength; sourceIndex++, i2++) {
  83897. if (sourceIndex === positions[0]) {
  83898. sourceIndex++;
  83899. positions.shift();
  83900. }
  83901. newData[i2] = bytes[sourceIndex];
  83902. }
  83903. return newData;
  83904. };
  83905. var findNal2 = function findNal3(bytes, dataType, types, nalLimit) {
  83906. if (nalLimit === void 0) {
  83907. nalLimit = Infinity;
  83908. }
  83909. bytes = toUint82(bytes);
  83910. types = [].concat(types);
  83911. var i2 = 0;
  83912. var nalStart;
  83913. var nalsFound = 0;
  83914. while (i2 < bytes.length && (nalsFound < nalLimit || nalStart)) {
  83915. var nalOffset = void 0;
  83916. if (bytesMatch2(bytes.subarray(i2), NAL_TYPE_ONE)) {
  83917. nalOffset = 4;
  83918. } else if (bytesMatch2(bytes.subarray(i2), NAL_TYPE_TWO)) {
  83919. nalOffset = 3;
  83920. }
  83921. if (!nalOffset) {
  83922. i2++;
  83923. continue;
  83924. }
  83925. nalsFound++;
  83926. if (nalStart) {
  83927. return discardEmulationPreventionBytes2(bytes.subarray(nalStart, i2));
  83928. }
  83929. var nalType = void 0;
  83930. if (dataType === "h264") {
  83931. nalType = bytes[i2 + nalOffset] & 31;
  83932. } else if (dataType === "h265") {
  83933. nalType = bytes[i2 + nalOffset] >> 1 & 63;
  83934. }
  83935. if (types.indexOf(nalType) !== -1) {
  83936. nalStart = i2 + nalOffset;
  83937. }
  83938. i2 += nalOffset + (dataType === "h264" ? 1 : 2);
  83939. }
  83940. return bytes.subarray(0, 0);
  83941. };
  83942. var findH264Nal2 = function findH264Nal3(bytes, type2, nalLimit) {
  83943. return findNal2(bytes, "h264", type2, nalLimit);
  83944. };
  83945. var findH265Nal2 = function findH265Nal3(bytes, type2, nalLimit) {
  83946. return findNal2(bytes, "h265", type2, nalLimit);
  83947. };
  83948. var CONSTANTS = {
  83949. "webm": toUint82([119, 101, 98, 109]),
  83950. "matroska": toUint82([109, 97, 116, 114, 111, 115, 107, 97]),
  83951. "flac": toUint82([102, 76, 97, 67]),
  83952. "ogg": toUint82([79, 103, 103, 83]),
  83953. "ac3": toUint82([11, 119]),
  83954. "riff": toUint82([82, 73, 70, 70]),
  83955. "avi": toUint82([65, 86, 73]),
  83956. "wav": toUint82([87, 65, 86, 69]),
  83957. "3gp": toUint82([102, 116, 121, 112, 51, 103]),
  83958. "mp4": toUint82([102, 116, 121, 112]),
  83959. "fmp4": toUint82([115, 116, 121, 112]),
  83960. "mov": toUint82([102, 116, 121, 112, 113, 116]),
  83961. "moov": toUint82([109, 111, 111, 118]),
  83962. "moof": toUint82([109, 111, 111, 102])
  83963. };
  83964. var _isLikely = {
  83965. aac: function aac2(bytes) {
  83966. var offset = getId3Offset2(bytes);
  83967. return bytesMatch2(bytes, [255, 16], {
  83968. offset,
  83969. mask: [255, 22]
  83970. });
  83971. },
  83972. mp3: function mp32(bytes) {
  83973. var offset = getId3Offset2(bytes);
  83974. return bytesMatch2(bytes, [255, 2], {
  83975. offset,
  83976. mask: [255, 6]
  83977. });
  83978. },
  83979. webm: function webm2(bytes) {
  83980. var docType = findEbml2(bytes, [EBML_TAGS.EBML, EBML_TAGS.DocType])[0];
  83981. return bytesMatch2(docType, CONSTANTS.webm);
  83982. },
  83983. mkv: function mkv2(bytes) {
  83984. var docType = findEbml2(bytes, [EBML_TAGS.EBML, EBML_TAGS.DocType])[0];
  83985. return bytesMatch2(docType, CONSTANTS.matroska);
  83986. },
  83987. mp4: function mp42(bytes) {
  83988. if (_isLikely["3gp"](bytes) || _isLikely.mov(bytes)) {
  83989. return false;
  83990. }
  83991. if (bytesMatch2(bytes, CONSTANTS.mp4, {
  83992. offset: 4
  83993. }) || bytesMatch2(bytes, CONSTANTS.fmp4, {
  83994. offset: 4
  83995. })) {
  83996. return true;
  83997. }
  83998. if (bytesMatch2(bytes, CONSTANTS.moof, {
  83999. offset: 4
  84000. }) || bytesMatch2(bytes, CONSTANTS.moov, {
  84001. offset: 4
  84002. })) {
  84003. return true;
  84004. }
  84005. },
  84006. mov: function mov2(bytes) {
  84007. return bytesMatch2(bytes, CONSTANTS.mov, {
  84008. offset: 4
  84009. });
  84010. },
  84011. "3gp": function gp2(bytes) {
  84012. return bytesMatch2(bytes, CONSTANTS["3gp"], {
  84013. offset: 4
  84014. });
  84015. },
  84016. ac3: function ac32(bytes) {
  84017. var offset = getId3Offset2(bytes);
  84018. return bytesMatch2(bytes, CONSTANTS.ac3, {
  84019. offset
  84020. });
  84021. },
  84022. ts: function ts2(bytes) {
  84023. if (bytes.length < 189 && bytes.length >= 1) {
  84024. return bytes[0] === 71;
  84025. }
  84026. var i2 = 0;
  84027. while (i2 + 188 < bytes.length && i2 < 188) {
  84028. if (bytes[i2] === 71 && bytes[i2 + 188] === 71) {
  84029. return true;
  84030. }
  84031. i2 += 1;
  84032. }
  84033. return false;
  84034. },
  84035. flac: function flac2(bytes) {
  84036. var offset = getId3Offset2(bytes);
  84037. return bytesMatch2(bytes, CONSTANTS.flac, {
  84038. offset
  84039. });
  84040. },
  84041. ogg: function ogg2(bytes) {
  84042. return bytesMatch2(bytes, CONSTANTS.ogg);
  84043. },
  84044. avi: function avi2(bytes) {
  84045. return bytesMatch2(bytes, CONSTANTS.riff) && bytesMatch2(bytes, CONSTANTS.avi, {
  84046. offset: 8
  84047. });
  84048. },
  84049. wav: function wav2(bytes) {
  84050. return bytesMatch2(bytes, CONSTANTS.riff) && bytesMatch2(bytes, CONSTANTS.wav, {
  84051. offset: 8
  84052. });
  84053. },
  84054. "h264": function h2642(bytes) {
  84055. return findH264Nal2(bytes, 7, 3).length;
  84056. },
  84057. "h265": function h2652(bytes) {
  84058. return findH265Nal2(bytes, [32, 33], 3).length;
  84059. }
  84060. };
  84061. var isLikelyTypes = Object.keys(_isLikely).filter(function(t2) {
  84062. return t2 !== "ts" && t2 !== "h264" && t2 !== "h265";
  84063. }).concat(["ts", "h264", "h265"]);
  84064. isLikelyTypes.forEach(function(type2) {
  84065. var isLikelyFn = _isLikely[type2];
  84066. _isLikely[type2] = function(bytes) {
  84067. return isLikelyFn(toUint82(bytes));
  84068. };
  84069. });
  84070. var isLikely = _isLikely;
  84071. var detectContainerForBytes2 = function detectContainerForBytes3(bytes) {
  84072. bytes = toUint82(bytes);
  84073. for (var i2 = 0; i2 < isLikelyTypes.length; i2++) {
  84074. var type2 = isLikelyTypes[i2];
  84075. if (isLikely[type2](bytes)) {
  84076. return type2;
  84077. }
  84078. }
  84079. return "";
  84080. };
  84081. var isLikelyFmp4MediaSegment2 = function isLikelyFmp4MediaSegment3(bytes) {
  84082. return findBox2(bytes, ["moof"]).length > 0;
  84083. };
  84084. var ONE_SECOND_IN_TS = 9e4, secondsToVideoTs, secondsToAudioTs, videoTsToSeconds, audioTsToSeconds, audioTsToVideoTs, videoTsToAudioTs, metadataTsToSeconds;
  84085. secondsToVideoTs = function(seconds) {
  84086. return seconds * ONE_SECOND_IN_TS;
  84087. };
  84088. secondsToAudioTs = function(seconds, sampleRate) {
  84089. return seconds * sampleRate;
  84090. };
  84091. videoTsToSeconds = function(timestamp) {
  84092. return timestamp / ONE_SECOND_IN_TS;
  84093. };
  84094. audioTsToSeconds = function(timestamp, sampleRate) {
  84095. return timestamp / sampleRate;
  84096. };
  84097. audioTsToVideoTs = function(timestamp, sampleRate) {
  84098. return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate));
  84099. };
  84100. videoTsToAudioTs = function(timestamp, sampleRate) {
  84101. return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate);
  84102. };
  84103. metadataTsToSeconds = function(timestamp, timelineStartPts, keepOriginalTimestamps) {
  84104. return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts);
  84105. };
  84106. var clock = {
  84107. ONE_SECOND_IN_TS,
  84108. secondsToVideoTs,
  84109. secondsToAudioTs,
  84110. videoTsToSeconds,
  84111. audioTsToSeconds,
  84112. audioTsToVideoTs,
  84113. videoTsToAudioTs,
  84114. metadataTsToSeconds
  84115. };
  84116. function _getPrototypeOf(o) {
  84117. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
  84118. return o2.__proto__ || Object.getPrototypeOf(o2);
  84119. };
  84120. return _getPrototypeOf(o);
  84121. }
  84122. function _isNativeFunction(fn2) {
  84123. return Function.toString.call(fn2).indexOf("[native code]") !== -1;
  84124. }
  84125. function _wrapNativeSuper(Class) {
  84126. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  84127. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  84128. if (Class2 === null || !_isNativeFunction(Class2))
  84129. return Class2;
  84130. if (typeof Class2 !== "function") {
  84131. throw new TypeError("Super expression must either be null or a function");
  84132. }
  84133. if (typeof _cache !== "undefined") {
  84134. if (_cache.has(Class2))
  84135. return _cache.get(Class2);
  84136. _cache.set(Class2, Wrapper);
  84137. }
  84138. function Wrapper() {
  84139. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  84140. }
  84141. Wrapper.prototype = Object.create(Class2.prototype, {
  84142. constructor: {
  84143. value: Wrapper,
  84144. enumerable: false,
  84145. writable: true,
  84146. configurable: true
  84147. }
  84148. });
  84149. return _setPrototypeOf(Wrapper, Class2);
  84150. };
  84151. return _wrapNativeSuper(Class);
  84152. }
  84153. /**
  84154. * @license
  84155. * Video.js 7.21.4 <http://videojs.com/>
  84156. * Copyright Brightcove, Inc. <https://www.brightcove.com/>
  84157. * Available under Apache License Version 2.0
  84158. * <https://github.com/videojs/video.js/blob/main/LICENSE>
  84159. *
  84160. * Includes vtt.js <https://github.com/mozilla/vtt.js>
  84161. * Available under Apache License Version 2.0
  84162. * <https://github.com/mozilla/vtt.js/blob/main/LICENSE>
  84163. */
  84164. var version$5 = "7.21.4";
  84165. var hooks_ = {};
  84166. var hooks = function hooks2(type2, fn2) {
  84167. hooks_[type2] = hooks_[type2] || [];
  84168. if (fn2) {
  84169. hooks_[type2] = hooks_[type2].concat(fn2);
  84170. }
  84171. return hooks_[type2];
  84172. };
  84173. var hook = function hook2(type2, fn2) {
  84174. hooks(type2, fn2);
  84175. };
  84176. var removeHook = function removeHook2(type2, fn2) {
  84177. var index2 = hooks(type2).indexOf(fn2);
  84178. if (index2 <= -1) {
  84179. return false;
  84180. }
  84181. hooks_[type2] = hooks_[type2].slice();
  84182. hooks_[type2].splice(index2, 1);
  84183. return true;
  84184. };
  84185. var hookOnce = function hookOnce2(type2, fn2) {
  84186. hooks(type2, [].concat(fn2).map(function(original) {
  84187. var wrapper = function wrapper2() {
  84188. removeHook(type2, wrapper2);
  84189. return original.apply(void 0, arguments);
  84190. };
  84191. return wrapper;
  84192. }));
  84193. };
  84194. var FullscreenApi = {
  84195. prefixed: true
  84196. };
  84197. var apiMap = [
  84198. ["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror", "fullscreen"],
  84199. ["webkitRequestFullscreen", "webkitExitFullscreen", "webkitFullscreenElement", "webkitFullscreenEnabled", "webkitfullscreenchange", "webkitfullscreenerror", "-webkit-full-screen"],
  84200. ["mozRequestFullScreen", "mozCancelFullScreen", "mozFullScreenElement", "mozFullScreenEnabled", "mozfullscreenchange", "mozfullscreenerror", "-moz-full-screen"],
  84201. ["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError", "-ms-fullscreen"]
  84202. ];
  84203. var specApi = apiMap[0];
  84204. var browserApi;
  84205. for (var i$2 = 0; i$2 < apiMap.length; i$2++) {
  84206. if (apiMap[i$2][1] in document_1) {
  84207. browserApi = apiMap[i$2];
  84208. break;
  84209. }
  84210. }
  84211. if (browserApi) {
  84212. for (var _i$1 = 0; _i$1 < browserApi.length; _i$1++) {
  84213. FullscreenApi[specApi[_i$1]] = browserApi[_i$1];
  84214. }
  84215. FullscreenApi.prefixed = browserApi[0] !== specApi[0];
  84216. }
  84217. var history = [];
  84218. var LogByTypeFactory = function LogByTypeFactory2(name, log2) {
  84219. return function(type2, level, args) {
  84220. var lvl = log2.levels[level];
  84221. var lvlRegExp = new RegExp("^(" + lvl + ")$");
  84222. if (type2 !== "log") {
  84223. args.unshift(type2.toUpperCase() + ":");
  84224. }
  84225. args.unshift(name + ":");
  84226. if (history) {
  84227. history.push([].concat(args));
  84228. var splice2 = history.length - 1e3;
  84229. history.splice(0, splice2 > 0 ? splice2 : 0);
  84230. }
  84231. if (!window_1.console) {
  84232. return;
  84233. }
  84234. var fn2 = window_1.console[type2];
  84235. if (!fn2 && type2 === "debug") {
  84236. fn2 = window_1.console.info || window_1.console.log;
  84237. }
  84238. if (!fn2 || !lvl || !lvlRegExp.test(type2)) {
  84239. return;
  84240. }
  84241. fn2[Array.isArray(args) ? "apply" : "call"](window_1.console, args);
  84242. };
  84243. };
  84244. function createLogger$1(name) {
  84245. var level = "info";
  84246. var logByType;
  84247. var log2 = function log3() {
  84248. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  84249. args[_key] = arguments[_key];
  84250. }
  84251. logByType("log", level, args);
  84252. };
  84253. logByType = LogByTypeFactory(name, log2);
  84254. log2.createLogger = function(subname) {
  84255. return createLogger$1(name + ": " + subname);
  84256. };
  84257. log2.levels = {
  84258. all: "debug|log|warn|error",
  84259. off: "",
  84260. debug: "debug|log|warn|error",
  84261. info: "log|warn|error",
  84262. warn: "warn|error",
  84263. error: "error",
  84264. DEFAULT: level
  84265. };
  84266. log2.level = function(lvl) {
  84267. if (typeof lvl === "string") {
  84268. if (!log2.levels.hasOwnProperty(lvl)) {
  84269. throw new Error('"' + lvl + '" in not a valid log level');
  84270. }
  84271. level = lvl;
  84272. }
  84273. return level;
  84274. };
  84275. log2.history = function() {
  84276. return history ? [].concat(history) : [];
  84277. };
  84278. log2.history.filter = function(fname) {
  84279. return (history || []).filter(function(historyItem) {
  84280. return new RegExp(".*" + fname + ".*").test(historyItem[0]);
  84281. });
  84282. };
  84283. log2.history.clear = function() {
  84284. if (history) {
  84285. history.length = 0;
  84286. }
  84287. };
  84288. log2.history.disable = function() {
  84289. if (history !== null) {
  84290. history.length = 0;
  84291. history = null;
  84292. }
  84293. };
  84294. log2.history.enable = function() {
  84295. if (history === null) {
  84296. history = [];
  84297. }
  84298. };
  84299. log2.error = function() {
  84300. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  84301. args[_key2] = arguments[_key2];
  84302. }
  84303. return logByType("error", level, args);
  84304. };
  84305. log2.warn = function() {
  84306. for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  84307. args[_key3] = arguments[_key3];
  84308. }
  84309. return logByType("warn", level, args);
  84310. };
  84311. log2.debug = function() {
  84312. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  84313. args[_key4] = arguments[_key4];
  84314. }
  84315. return logByType("debug", level, args);
  84316. };
  84317. return log2;
  84318. }
  84319. var log$1 = createLogger$1("VIDEOJS");
  84320. var createLogger = log$1.createLogger;
  84321. var toString = Object.prototype.toString;
  84322. var keys = function keys2(object) {
  84323. return isObject2(object) ? Object.keys(object) : [];
  84324. };
  84325. function each(object, fn2) {
  84326. keys(object).forEach(function(key) {
  84327. return fn2(object[key], key);
  84328. });
  84329. }
  84330. function reduce(object, fn2, initial) {
  84331. if (initial === void 0) {
  84332. initial = 0;
  84333. }
  84334. return keys(object).reduce(function(accum, key) {
  84335. return fn2(accum, object[key], key);
  84336. }, initial);
  84337. }
  84338. function assign(target) {
  84339. for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  84340. sources[_key - 1] = arguments[_key];
  84341. }
  84342. if (Object.assign) {
  84343. return _extends$2.apply(void 0, [target].concat(sources));
  84344. }
  84345. sources.forEach(function(source) {
  84346. if (!source) {
  84347. return;
  84348. }
  84349. each(source, function(value, key) {
  84350. target[key] = value;
  84351. });
  84352. });
  84353. return target;
  84354. }
  84355. function isObject2(value) {
  84356. return !!value && typeof value === "object";
  84357. }
  84358. function isPlain(value) {
  84359. return isObject2(value) && toString.call(value) === "[object Object]" && value.constructor === Object;
  84360. }
  84361. function computedStyle(el, prop) {
  84362. if (!el || !prop) {
  84363. return "";
  84364. }
  84365. if (typeof window_1.getComputedStyle === "function") {
  84366. var computedStyleValue;
  84367. try {
  84368. computedStyleValue = window_1.getComputedStyle(el);
  84369. } catch (e) {
  84370. return "";
  84371. }
  84372. return computedStyleValue ? computedStyleValue.getPropertyValue(prop) || computedStyleValue[prop] : "";
  84373. }
  84374. return "";
  84375. }
  84376. var USER_AGENT = window_1.navigator && window_1.navigator.userAgent || "";
  84377. var webkitVersionMap = /AppleWebKit\/([\d.]+)/i.exec(USER_AGENT);
  84378. var appleWebkitVersion = webkitVersionMap ? parseFloat(webkitVersionMap.pop()) : null;
  84379. var IS_IPOD = /iPod/i.test(USER_AGENT);
  84380. var IOS_VERSION = function() {
  84381. var match = USER_AGENT.match(/OS (\d+)_/i);
  84382. if (match && match[1]) {
  84383. return match[1];
  84384. }
  84385. return null;
  84386. }();
  84387. var IS_ANDROID = /Android/i.test(USER_AGENT);
  84388. var ANDROID_VERSION = function() {
  84389. var match = USER_AGENT.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);
  84390. if (!match) {
  84391. return null;
  84392. }
  84393. var major = match[1] && parseFloat(match[1]);
  84394. var minor = match[2] && parseFloat(match[2]);
  84395. if (major && minor) {
  84396. return parseFloat(match[1] + "." + match[2]);
  84397. } else if (major) {
  84398. return major;
  84399. }
  84400. return null;
  84401. }();
  84402. var IS_NATIVE_ANDROID = IS_ANDROID && ANDROID_VERSION < 5 && appleWebkitVersion < 537;
  84403. var IS_FIREFOX = /Firefox/i.test(USER_AGENT);
  84404. var IS_EDGE = /Edg/i.test(USER_AGENT);
  84405. var IS_CHROME = !IS_EDGE && (/Chrome/i.test(USER_AGENT) || /CriOS/i.test(USER_AGENT));
  84406. var CHROME_VERSION = function() {
  84407. var match = USER_AGENT.match(/(Chrome|CriOS)\/(\d+)/);
  84408. if (match && match[2]) {
  84409. return parseFloat(match[2]);
  84410. }
  84411. return null;
  84412. }();
  84413. var IE_VERSION = function() {
  84414. var result = /MSIE\s(\d+)\.\d/.exec(USER_AGENT);
  84415. var version2 = result && parseFloat(result[1]);
  84416. if (!version2 && /Trident\/7.0/i.test(USER_AGENT) && /rv:11.0/.test(USER_AGENT)) {
  84417. version2 = 11;
  84418. }
  84419. return version2;
  84420. }();
  84421. var IS_SAFARI = /Safari/i.test(USER_AGENT) && !IS_CHROME && !IS_ANDROID && !IS_EDGE;
  84422. var IS_WINDOWS = /Windows/i.test(USER_AGENT);
  84423. var TOUCH_ENABLED = Boolean(isReal() && ("ontouchstart" in window_1 || window_1.navigator.maxTouchPoints || window_1.DocumentTouch && window_1.document instanceof window_1.DocumentTouch));
  84424. var IS_IPAD = /iPad/i.test(USER_AGENT) || IS_SAFARI && TOUCH_ENABLED && !/iPhone/i.test(USER_AGENT);
  84425. var IS_IPHONE = /iPhone/i.test(USER_AGENT) && !IS_IPAD;
  84426. var IS_IOS = IS_IPHONE || IS_IPAD || IS_IPOD;
  84427. var IS_ANY_SAFARI = (IS_SAFARI || IS_IOS) && !IS_CHROME;
  84428. var browser = /* @__PURE__ */ Object.freeze({
  84429. __proto__: null,
  84430. IS_IPOD,
  84431. IOS_VERSION,
  84432. IS_ANDROID,
  84433. ANDROID_VERSION,
  84434. IS_NATIVE_ANDROID,
  84435. IS_FIREFOX,
  84436. IS_EDGE,
  84437. IS_CHROME,
  84438. CHROME_VERSION,
  84439. IE_VERSION,
  84440. IS_SAFARI,
  84441. IS_WINDOWS,
  84442. TOUCH_ENABLED,
  84443. IS_IPAD,
  84444. IS_IPHONE,
  84445. IS_IOS,
  84446. IS_ANY_SAFARI
  84447. });
  84448. function isNonBlankString(str) {
  84449. return typeof str === "string" && Boolean(str.trim());
  84450. }
  84451. function throwIfWhitespace(str) {
  84452. if (str.indexOf(" ") >= 0) {
  84453. throw new Error("class has illegal whitespace characters");
  84454. }
  84455. }
  84456. function classRegExp(className) {
  84457. return new RegExp("(^|\\s)" + className + "($|\\s)");
  84458. }
  84459. function isReal() {
  84460. return document_1 === window_1.document;
  84461. }
  84462. function isEl(value) {
  84463. return isObject2(value) && value.nodeType === 1;
  84464. }
  84465. function isInFrame() {
  84466. try {
  84467. return window_1.parent !== window_1.self;
  84468. } catch (x) {
  84469. return true;
  84470. }
  84471. }
  84472. function createQuerier(method) {
  84473. return function(selector, context) {
  84474. if (!isNonBlankString(selector)) {
  84475. return document_1[method](null);
  84476. }
  84477. if (isNonBlankString(context)) {
  84478. context = document_1.querySelector(context);
  84479. }
  84480. var ctx = isEl(context) ? context : document_1;
  84481. return ctx[method] && ctx[method](selector);
  84482. };
  84483. }
  84484. function createEl(tagName, properties, attributes, content) {
  84485. if (tagName === void 0) {
  84486. tagName = "div";
  84487. }
  84488. if (properties === void 0) {
  84489. properties = {};
  84490. }
  84491. if (attributes === void 0) {
  84492. attributes = {};
  84493. }
  84494. var el = document_1.createElement(tagName);
  84495. Object.getOwnPropertyNames(properties).forEach(function(propName) {
  84496. var val = properties[propName];
  84497. if (propName.indexOf("aria-") !== -1 || propName === "role" || propName === "type") {
  84498. log$1.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\n" + ("createEl(type, properties, attributes). Attempting to set " + propName + " to " + val + "."));
  84499. el.setAttribute(propName, val);
  84500. } else if (propName === "textContent") {
  84501. textContent(el, val);
  84502. } else if (el[propName] !== val || propName === "tabIndex") {
  84503. el[propName] = val;
  84504. }
  84505. });
  84506. Object.getOwnPropertyNames(attributes).forEach(function(attrName) {
  84507. el.setAttribute(attrName, attributes[attrName]);
  84508. });
  84509. if (content) {
  84510. appendContent(el, content);
  84511. }
  84512. return el;
  84513. }
  84514. function textContent(el, text) {
  84515. if (typeof el.textContent === "undefined") {
  84516. el.innerText = text;
  84517. } else {
  84518. el.textContent = text;
  84519. }
  84520. return el;
  84521. }
  84522. function prependTo(child, parent) {
  84523. if (parent.firstChild) {
  84524. parent.insertBefore(child, parent.firstChild);
  84525. } else {
  84526. parent.appendChild(child);
  84527. }
  84528. }
  84529. function hasClass(element, classToCheck) {
  84530. throwIfWhitespace(classToCheck);
  84531. if (element.classList) {
  84532. return element.classList.contains(classToCheck);
  84533. }
  84534. return classRegExp(classToCheck).test(element.className);
  84535. }
  84536. function addClass(element, classToAdd) {
  84537. if (element.classList) {
  84538. element.classList.add(classToAdd);
  84539. } else if (!hasClass(element, classToAdd)) {
  84540. element.className = (element.className + " " + classToAdd).trim();
  84541. }
  84542. return element;
  84543. }
  84544. function removeClass(element, classToRemove) {
  84545. if (!element) {
  84546. log$1.warn("removeClass was called with an element that doesn't exist");
  84547. return null;
  84548. }
  84549. if (element.classList) {
  84550. element.classList.remove(classToRemove);
  84551. } else {
  84552. throwIfWhitespace(classToRemove);
  84553. element.className = element.className.split(/\s+/).filter(function(c) {
  84554. return c !== classToRemove;
  84555. }).join(" ");
  84556. }
  84557. return element;
  84558. }
  84559. function toggleClass(element, classToToggle, predicate) {
  84560. var has = hasClass(element, classToToggle);
  84561. if (typeof predicate === "function") {
  84562. predicate = predicate(element, classToToggle);
  84563. }
  84564. if (typeof predicate !== "boolean") {
  84565. predicate = !has;
  84566. }
  84567. if (predicate === has) {
  84568. return;
  84569. }
  84570. if (predicate) {
  84571. addClass(element, classToToggle);
  84572. } else {
  84573. removeClass(element, classToToggle);
  84574. }
  84575. return element;
  84576. }
  84577. function setAttributes(el, attributes) {
  84578. Object.getOwnPropertyNames(attributes).forEach(function(attrName) {
  84579. var attrValue = attributes[attrName];
  84580. if (attrValue === null || typeof attrValue === "undefined" || attrValue === false) {
  84581. el.removeAttribute(attrName);
  84582. } else {
  84583. el.setAttribute(attrName, attrValue === true ? "" : attrValue);
  84584. }
  84585. });
  84586. }
  84587. function getAttributes(tag) {
  84588. var obj = {};
  84589. var knownBooleans = ",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";
  84590. if (tag && tag.attributes && tag.attributes.length > 0) {
  84591. var attrs = tag.attributes;
  84592. for (var i2 = attrs.length - 1; i2 >= 0; i2--) {
  84593. var attrName = attrs[i2].name;
  84594. var attrVal = attrs[i2].value;
  84595. if (typeof tag[attrName] === "boolean" || knownBooleans.indexOf("," + attrName + ",") !== -1) {
  84596. attrVal = attrVal !== null ? true : false;
  84597. }
  84598. obj[attrName] = attrVal;
  84599. }
  84600. }
  84601. return obj;
  84602. }
  84603. function getAttribute(el, attribute) {
  84604. return el.getAttribute(attribute);
  84605. }
  84606. function setAttribute(el, attribute, value) {
  84607. el.setAttribute(attribute, value);
  84608. }
  84609. function removeAttribute(el, attribute) {
  84610. el.removeAttribute(attribute);
  84611. }
  84612. function blockTextSelection() {
  84613. document_1.body.focus();
  84614. document_1.onselectstart = function() {
  84615. return false;
  84616. };
  84617. }
  84618. function unblockTextSelection() {
  84619. document_1.onselectstart = function() {
  84620. return true;
  84621. };
  84622. }
  84623. function getBoundingClientRect(el) {
  84624. if (el && el.getBoundingClientRect && el.parentNode) {
  84625. var rect = el.getBoundingClientRect();
  84626. var result = {};
  84627. ["bottom", "height", "left", "right", "top", "width"].forEach(function(k) {
  84628. if (rect[k] !== void 0) {
  84629. result[k] = rect[k];
  84630. }
  84631. });
  84632. if (!result.height) {
  84633. result.height = parseFloat(computedStyle(el, "height"));
  84634. }
  84635. if (!result.width) {
  84636. result.width = parseFloat(computedStyle(el, "width"));
  84637. }
  84638. return result;
  84639. }
  84640. }
  84641. function findPosition(el) {
  84642. if (!el || el && !el.offsetParent) {
  84643. return {
  84644. left: 0,
  84645. top: 0,
  84646. width: 0,
  84647. height: 0
  84648. };
  84649. }
  84650. var width2 = el.offsetWidth;
  84651. var height2 = el.offsetHeight;
  84652. var left = 0;
  84653. var top = 0;
  84654. while (el.offsetParent && el !== document_1[FullscreenApi.fullscreenElement]) {
  84655. left += el.offsetLeft;
  84656. top += el.offsetTop;
  84657. el = el.offsetParent;
  84658. }
  84659. return {
  84660. left,
  84661. top,
  84662. width: width2,
  84663. height: height2
  84664. };
  84665. }
  84666. function getPointerPosition(el, event2) {
  84667. var translated = {
  84668. x: 0,
  84669. y: 0
  84670. };
  84671. if (IS_IOS) {
  84672. var item = el;
  84673. while (item && item.nodeName.toLowerCase() !== "html") {
  84674. var transform3 = computedStyle(item, "transform");
  84675. if (/^matrix/.test(transform3)) {
  84676. var values3 = transform3.slice(7, -1).split(/,\s/).map(Number);
  84677. translated.x += values3[4];
  84678. translated.y += values3[5];
  84679. } else if (/^matrix3d/.test(transform3)) {
  84680. var _values = transform3.slice(9, -1).split(/,\s/).map(Number);
  84681. translated.x += _values[12];
  84682. translated.y += _values[13];
  84683. }
  84684. item = item.parentNode;
  84685. }
  84686. }
  84687. var position2 = {};
  84688. var boxTarget = findPosition(event2.target);
  84689. var box = findPosition(el);
  84690. var boxW = box.width;
  84691. var boxH = box.height;
  84692. var offsetY = event2.offsetY - (box.top - boxTarget.top);
  84693. var offsetX = event2.offsetX - (box.left - boxTarget.left);
  84694. if (event2.changedTouches) {
  84695. offsetX = event2.changedTouches[0].pageX - box.left;
  84696. offsetY = event2.changedTouches[0].pageY + box.top;
  84697. if (IS_IOS) {
  84698. offsetX -= translated.x;
  84699. offsetY -= translated.y;
  84700. }
  84701. }
  84702. position2.y = 1 - Math.max(0, Math.min(1, offsetY / boxH));
  84703. position2.x = Math.max(0, Math.min(1, offsetX / boxW));
  84704. return position2;
  84705. }
  84706. function isTextNode(value) {
  84707. return isObject2(value) && value.nodeType === 3;
  84708. }
  84709. function emptyEl(el) {
  84710. while (el.firstChild) {
  84711. el.removeChild(el.firstChild);
  84712. }
  84713. return el;
  84714. }
  84715. function normalizeContent(content) {
  84716. if (typeof content === "function") {
  84717. content = content();
  84718. }
  84719. return (Array.isArray(content) ? content : [content]).map(function(value) {
  84720. if (typeof value === "function") {
  84721. value = value();
  84722. }
  84723. if (isEl(value) || isTextNode(value)) {
  84724. return value;
  84725. }
  84726. if (typeof value === "string" && /\S/.test(value)) {
  84727. return document_1.createTextNode(value);
  84728. }
  84729. }).filter(function(value) {
  84730. return value;
  84731. });
  84732. }
  84733. function appendContent(el, content) {
  84734. normalizeContent(content).forEach(function(node) {
  84735. return el.appendChild(node);
  84736. });
  84737. return el;
  84738. }
  84739. function insertContent(el, content) {
  84740. return appendContent(emptyEl(el), content);
  84741. }
  84742. function isSingleLeftClick(event2) {
  84743. if (event2.button === void 0 && event2.buttons === void 0) {
  84744. return true;
  84745. }
  84746. if (event2.button === 0 && event2.buttons === void 0) {
  84747. return true;
  84748. }
  84749. if (event2.type === "mouseup" && event2.button === 0 && event2.buttons === 0) {
  84750. return true;
  84751. }
  84752. if (event2.button !== 0 || event2.buttons !== 1) {
  84753. return false;
  84754. }
  84755. return true;
  84756. }
  84757. var $ = createQuerier("querySelector");
  84758. var $$ = createQuerier("querySelectorAll");
  84759. var Dom$1 = /* @__PURE__ */ Object.freeze({
  84760. __proto__: null,
  84761. isReal,
  84762. isEl,
  84763. isInFrame,
  84764. createEl,
  84765. textContent,
  84766. prependTo,
  84767. hasClass,
  84768. addClass,
  84769. removeClass,
  84770. toggleClass,
  84771. setAttributes,
  84772. getAttributes,
  84773. getAttribute,
  84774. setAttribute,
  84775. removeAttribute,
  84776. blockTextSelection,
  84777. unblockTextSelection,
  84778. getBoundingClientRect,
  84779. findPosition,
  84780. getPointerPosition,
  84781. isTextNode,
  84782. emptyEl,
  84783. normalizeContent,
  84784. appendContent,
  84785. insertContent,
  84786. isSingleLeftClick,
  84787. $,
  84788. $$
  84789. });
  84790. var _windowLoaded = false;
  84791. var videojs$1;
  84792. var autoSetup = function autoSetup2() {
  84793. if (videojs$1.options.autoSetup === false) {
  84794. return;
  84795. }
  84796. var vids = Array.prototype.slice.call(document_1.getElementsByTagName("video"));
  84797. var audios = Array.prototype.slice.call(document_1.getElementsByTagName("audio"));
  84798. var divs = Array.prototype.slice.call(document_1.getElementsByTagName("video-js"));
  84799. var mediaEls = vids.concat(audios, divs);
  84800. if (mediaEls && mediaEls.length > 0) {
  84801. for (var i2 = 0, e = mediaEls.length; i2 < e; i2++) {
  84802. var mediaEl = mediaEls[i2];
  84803. if (mediaEl && mediaEl.getAttribute) {
  84804. if (mediaEl.player === void 0) {
  84805. var options2 = mediaEl.getAttribute("data-setup");
  84806. if (options2 !== null) {
  84807. videojs$1(mediaEl);
  84808. }
  84809. }
  84810. } else {
  84811. autoSetupTimeout(1);
  84812. break;
  84813. }
  84814. }
  84815. } else if (!_windowLoaded) {
  84816. autoSetupTimeout(1);
  84817. }
  84818. };
  84819. function autoSetupTimeout(wait, vjs) {
  84820. if (!isReal()) {
  84821. return;
  84822. }
  84823. if (vjs) {
  84824. videojs$1 = vjs;
  84825. }
  84826. window_1.setTimeout(autoSetup, wait);
  84827. }
  84828. function setWindowLoaded() {
  84829. _windowLoaded = true;
  84830. window_1.removeEventListener("load", setWindowLoaded);
  84831. }
  84832. if (isReal()) {
  84833. if (document_1.readyState === "complete") {
  84834. setWindowLoaded();
  84835. } else {
  84836. window_1.addEventListener("load", setWindowLoaded);
  84837. }
  84838. }
  84839. var createStyleElement = function createStyleElement2(className) {
  84840. var style = document_1.createElement("style");
  84841. style.className = className;
  84842. return style;
  84843. };
  84844. var setTextContent = function setTextContent2(el, content) {
  84845. if (el.styleSheet) {
  84846. el.styleSheet.cssText = content;
  84847. } else {
  84848. el.textContent = content;
  84849. }
  84850. };
  84851. var _initialGuid = 3;
  84852. var _guid = _initialGuid;
  84853. function newGUID() {
  84854. return _guid++;
  84855. }
  84856. var FakeWeakMap;
  84857. if (!window_1.WeakMap) {
  84858. FakeWeakMap = /* @__PURE__ */ function() {
  84859. function FakeWeakMap2() {
  84860. this.vdata = "vdata" + Math.floor(window_1.performance && window_1.performance.now() || Date.now());
  84861. this.data = {};
  84862. }
  84863. var _proto = FakeWeakMap2.prototype;
  84864. _proto.set = function set4(key, value) {
  84865. var access = key[this.vdata] || newGUID();
  84866. if (!key[this.vdata]) {
  84867. key[this.vdata] = access;
  84868. }
  84869. this.data[access] = value;
  84870. return this;
  84871. };
  84872. _proto.get = function get7(key) {
  84873. var access = key[this.vdata];
  84874. if (access) {
  84875. return this.data[access];
  84876. }
  84877. log$1("We have no data for this element", key);
  84878. return void 0;
  84879. };
  84880. _proto.has = function has(key) {
  84881. var access = key[this.vdata];
  84882. return access in this.data;
  84883. };
  84884. _proto["delete"] = function _delete(key) {
  84885. var access = key[this.vdata];
  84886. if (access) {
  84887. delete this.data[access];
  84888. delete key[this.vdata];
  84889. }
  84890. };
  84891. return FakeWeakMap2;
  84892. }();
  84893. }
  84894. var DomData = window_1.WeakMap ? /* @__PURE__ */ new WeakMap() : new FakeWeakMap();
  84895. function _cleanUpEvents(elem, type2) {
  84896. if (!DomData.has(elem)) {
  84897. return;
  84898. }
  84899. var data = DomData.get(elem);
  84900. if (data.handlers[type2].length === 0) {
  84901. delete data.handlers[type2];
  84902. if (elem.removeEventListener) {
  84903. elem.removeEventListener(type2, data.dispatcher, false);
  84904. } else if (elem.detachEvent) {
  84905. elem.detachEvent("on" + type2, data.dispatcher);
  84906. }
  84907. }
  84908. if (Object.getOwnPropertyNames(data.handlers).length <= 0) {
  84909. delete data.handlers;
  84910. delete data.dispatcher;
  84911. delete data.disabled;
  84912. }
  84913. if (Object.getOwnPropertyNames(data).length === 0) {
  84914. DomData["delete"](elem);
  84915. }
  84916. }
  84917. function _handleMultipleEvents(fn2, elem, types, callback2) {
  84918. types.forEach(function(type2) {
  84919. fn2(elem, type2, callback2);
  84920. });
  84921. }
  84922. function fixEvent(event2) {
  84923. if (event2.fixed_) {
  84924. return event2;
  84925. }
  84926. function returnTrue() {
  84927. return true;
  84928. }
  84929. function returnFalse() {
  84930. return false;
  84931. }
  84932. if (!event2 || !event2.isPropagationStopped || !event2.isImmediatePropagationStopped) {
  84933. var old = event2 || window_1.event;
  84934. event2 = {};
  84935. for (var key in old) {
  84936. if (key !== "layerX" && key !== "layerY" && key !== "keyLocation" && key !== "webkitMovementX" && key !== "webkitMovementY" && key !== "path") {
  84937. if (!(key === "returnValue" && old.preventDefault)) {
  84938. event2[key] = old[key];
  84939. }
  84940. }
  84941. }
  84942. if (!event2.target) {
  84943. event2.target = event2.srcElement || document_1;
  84944. }
  84945. if (!event2.relatedTarget) {
  84946. event2.relatedTarget = event2.fromElement === event2.target ? event2.toElement : event2.fromElement;
  84947. }
  84948. event2.preventDefault = function() {
  84949. if (old.preventDefault) {
  84950. old.preventDefault();
  84951. }
  84952. event2.returnValue = false;
  84953. old.returnValue = false;
  84954. event2.defaultPrevented = true;
  84955. };
  84956. event2.defaultPrevented = false;
  84957. event2.stopPropagation = function() {
  84958. if (old.stopPropagation) {
  84959. old.stopPropagation();
  84960. }
  84961. event2.cancelBubble = true;
  84962. old.cancelBubble = true;
  84963. event2.isPropagationStopped = returnTrue;
  84964. };
  84965. event2.isPropagationStopped = returnFalse;
  84966. event2.stopImmediatePropagation = function() {
  84967. if (old.stopImmediatePropagation) {
  84968. old.stopImmediatePropagation();
  84969. }
  84970. event2.isImmediatePropagationStopped = returnTrue;
  84971. event2.stopPropagation();
  84972. };
  84973. event2.isImmediatePropagationStopped = returnFalse;
  84974. if (event2.clientX !== null && event2.clientX !== void 0) {
  84975. var doc = document_1.documentElement;
  84976. var body = document_1.body;
  84977. event2.pageX = event2.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
  84978. event2.pageY = event2.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
  84979. }
  84980. event2.which = event2.charCode || event2.keyCode;
  84981. if (event2.button !== null && event2.button !== void 0) {
  84982. event2.button = event2.button & 1 ? 0 : event2.button & 4 ? 1 : event2.button & 2 ? 2 : 0;
  84983. }
  84984. }
  84985. event2.fixed_ = true;
  84986. return event2;
  84987. }
  84988. var _supportsPassive;
  84989. var supportsPassive = function supportsPassive2() {
  84990. if (typeof _supportsPassive !== "boolean") {
  84991. _supportsPassive = false;
  84992. try {
  84993. var opts = Object.defineProperty({}, "passive", {
  84994. get: function get7() {
  84995. _supportsPassive = true;
  84996. }
  84997. });
  84998. window_1.addEventListener("test", null, opts);
  84999. window_1.removeEventListener("test", null, opts);
  85000. } catch (e) {
  85001. }
  85002. }
  85003. return _supportsPassive;
  85004. };
  85005. var passiveEvents = ["touchstart", "touchmove"];
  85006. function on(elem, type2, fn2) {
  85007. if (Array.isArray(type2)) {
  85008. return _handleMultipleEvents(on, elem, type2, fn2);
  85009. }
  85010. if (!DomData.has(elem)) {
  85011. DomData.set(elem, {});
  85012. }
  85013. var data = DomData.get(elem);
  85014. if (!data.handlers) {
  85015. data.handlers = {};
  85016. }
  85017. if (!data.handlers[type2]) {
  85018. data.handlers[type2] = [];
  85019. }
  85020. if (!fn2.guid) {
  85021. fn2.guid = newGUID();
  85022. }
  85023. data.handlers[type2].push(fn2);
  85024. if (!data.dispatcher) {
  85025. data.disabled = false;
  85026. data.dispatcher = function(event2, hash) {
  85027. if (data.disabled) {
  85028. return;
  85029. }
  85030. event2 = fixEvent(event2);
  85031. var handlers = data.handlers[event2.type];
  85032. if (handlers) {
  85033. var handlersCopy = handlers.slice(0);
  85034. for (var m = 0, n = handlersCopy.length; m < n; m++) {
  85035. if (event2.isImmediatePropagationStopped()) {
  85036. break;
  85037. } else {
  85038. try {
  85039. handlersCopy[m].call(elem, event2, hash);
  85040. } catch (e) {
  85041. log$1.error(e);
  85042. }
  85043. }
  85044. }
  85045. }
  85046. };
  85047. }
  85048. if (data.handlers[type2].length === 1) {
  85049. if (elem.addEventListener) {
  85050. var options2 = false;
  85051. if (supportsPassive() && passiveEvents.indexOf(type2) > -1) {
  85052. options2 = {
  85053. passive: true
  85054. };
  85055. }
  85056. elem.addEventListener(type2, data.dispatcher, options2);
  85057. } else if (elem.attachEvent) {
  85058. elem.attachEvent("on" + type2, data.dispatcher);
  85059. }
  85060. }
  85061. }
  85062. function off(elem, type2, fn2) {
  85063. if (!DomData.has(elem)) {
  85064. return;
  85065. }
  85066. var data = DomData.get(elem);
  85067. if (!data.handlers) {
  85068. return;
  85069. }
  85070. if (Array.isArray(type2)) {
  85071. return _handleMultipleEvents(off, elem, type2, fn2);
  85072. }
  85073. var removeType = function removeType2(el, t3) {
  85074. data.handlers[t3] = [];
  85075. _cleanUpEvents(el, t3);
  85076. };
  85077. if (type2 === void 0) {
  85078. for (var t2 in data.handlers) {
  85079. if (Object.prototype.hasOwnProperty.call(data.handlers || {}, t2)) {
  85080. removeType(elem, t2);
  85081. }
  85082. }
  85083. return;
  85084. }
  85085. var handlers = data.handlers[type2];
  85086. if (!handlers) {
  85087. return;
  85088. }
  85089. if (!fn2) {
  85090. removeType(elem, type2);
  85091. return;
  85092. }
  85093. if (fn2.guid) {
  85094. for (var n = 0; n < handlers.length; n++) {
  85095. if (handlers[n].guid === fn2.guid) {
  85096. handlers.splice(n--, 1);
  85097. }
  85098. }
  85099. }
  85100. _cleanUpEvents(elem, type2);
  85101. }
  85102. function trigger(elem, event2, hash) {
  85103. var elemData = DomData.has(elem) ? DomData.get(elem) : {};
  85104. var parent = elem.parentNode || elem.ownerDocument;
  85105. if (typeof event2 === "string") {
  85106. event2 = {
  85107. type: event2,
  85108. target: elem
  85109. };
  85110. } else if (!event2.target) {
  85111. event2.target = elem;
  85112. }
  85113. event2 = fixEvent(event2);
  85114. if (elemData.dispatcher) {
  85115. elemData.dispatcher.call(elem, event2, hash);
  85116. }
  85117. if (parent && !event2.isPropagationStopped() && event2.bubbles === true) {
  85118. trigger.call(null, parent, event2, hash);
  85119. } else if (!parent && !event2.defaultPrevented && event2.target && event2.target[event2.type]) {
  85120. if (!DomData.has(event2.target)) {
  85121. DomData.set(event2.target, {});
  85122. }
  85123. var targetData = DomData.get(event2.target);
  85124. if (event2.target[event2.type]) {
  85125. targetData.disabled = true;
  85126. if (typeof event2.target[event2.type] === "function") {
  85127. event2.target[event2.type]();
  85128. }
  85129. targetData.disabled = false;
  85130. }
  85131. }
  85132. return !event2.defaultPrevented;
  85133. }
  85134. function one(elem, type2, fn2) {
  85135. if (Array.isArray(type2)) {
  85136. return _handleMultipleEvents(one, elem, type2, fn2);
  85137. }
  85138. var func = function func2() {
  85139. off(elem, type2, func2);
  85140. fn2.apply(this, arguments);
  85141. };
  85142. func.guid = fn2.guid = fn2.guid || newGUID();
  85143. on(elem, type2, func);
  85144. }
  85145. function any(elem, type2, fn2) {
  85146. var func = function func2() {
  85147. off(elem, type2, func2);
  85148. fn2.apply(this, arguments);
  85149. };
  85150. func.guid = fn2.guid = fn2.guid || newGUID();
  85151. on(elem, type2, func);
  85152. }
  85153. var Events = /* @__PURE__ */ Object.freeze({
  85154. __proto__: null,
  85155. fixEvent,
  85156. on,
  85157. off,
  85158. trigger,
  85159. one,
  85160. any
  85161. });
  85162. var UPDATE_REFRESH_INTERVAL = 30;
  85163. var bind = function bind2(context, fn2, uid) {
  85164. if (!fn2.guid) {
  85165. fn2.guid = newGUID();
  85166. }
  85167. var bound = fn2.bind(context);
  85168. bound.guid = uid ? uid + "_" + fn2.guid : fn2.guid;
  85169. return bound;
  85170. };
  85171. var throttle = function throttle2(fn2, wait) {
  85172. var last = window_1.performance.now();
  85173. var throttled = function throttled2() {
  85174. var now2 = window_1.performance.now();
  85175. if (now2 - last >= wait) {
  85176. fn2.apply(void 0, arguments);
  85177. last = now2;
  85178. }
  85179. };
  85180. return throttled;
  85181. };
  85182. var debounce = function debounce2(func, wait, immediate, context) {
  85183. if (context === void 0) {
  85184. context = window_1;
  85185. }
  85186. var timeout;
  85187. var cancel = function cancel2() {
  85188. context.clearTimeout(timeout);
  85189. timeout = null;
  85190. };
  85191. var debounced = function debounced2() {
  85192. var self2 = this;
  85193. var args = arguments;
  85194. var _later = function later() {
  85195. timeout = null;
  85196. _later = null;
  85197. if (!immediate) {
  85198. func.apply(self2, args);
  85199. }
  85200. };
  85201. if (!timeout && immediate) {
  85202. func.apply(self2, args);
  85203. }
  85204. context.clearTimeout(timeout);
  85205. timeout = context.setTimeout(_later, wait);
  85206. };
  85207. debounced.cancel = cancel;
  85208. return debounced;
  85209. };
  85210. var EventTarget$2 = function EventTarget() {
  85211. };
  85212. EventTarget$2.prototype.allowedEvents_ = {};
  85213. EventTarget$2.prototype.on = function(type2, fn2) {
  85214. var ael = this.addEventListener;
  85215. this.addEventListener = function() {
  85216. };
  85217. on(this, type2, fn2);
  85218. this.addEventListener = ael;
  85219. };
  85220. EventTarget$2.prototype.addEventListener = EventTarget$2.prototype.on;
  85221. EventTarget$2.prototype.off = function(type2, fn2) {
  85222. off(this, type2, fn2);
  85223. };
  85224. EventTarget$2.prototype.removeEventListener = EventTarget$2.prototype.off;
  85225. EventTarget$2.prototype.one = function(type2, fn2) {
  85226. var ael = this.addEventListener;
  85227. this.addEventListener = function() {
  85228. };
  85229. one(this, type2, fn2);
  85230. this.addEventListener = ael;
  85231. };
  85232. EventTarget$2.prototype.any = function(type2, fn2) {
  85233. var ael = this.addEventListener;
  85234. this.addEventListener = function() {
  85235. };
  85236. any(this, type2, fn2);
  85237. this.addEventListener = ael;
  85238. };
  85239. EventTarget$2.prototype.trigger = function(event2) {
  85240. var type2 = event2.type || event2;
  85241. if (typeof event2 === "string") {
  85242. event2 = {
  85243. type: type2
  85244. };
  85245. }
  85246. event2 = fixEvent(event2);
  85247. if (this.allowedEvents_[type2] && this["on" + type2]) {
  85248. this["on" + type2](event2);
  85249. }
  85250. trigger(this, event2);
  85251. };
  85252. EventTarget$2.prototype.dispatchEvent = EventTarget$2.prototype.trigger;
  85253. var EVENT_MAP;
  85254. EventTarget$2.prototype.queueTrigger = function(event2) {
  85255. var _this = this;
  85256. if (!EVENT_MAP) {
  85257. EVENT_MAP = /* @__PURE__ */ new Map();
  85258. }
  85259. var type2 = event2.type || event2;
  85260. var map = EVENT_MAP.get(this);
  85261. if (!map) {
  85262. map = /* @__PURE__ */ new Map();
  85263. EVENT_MAP.set(this, map);
  85264. }
  85265. var oldTimeout = map.get(type2);
  85266. map["delete"](type2);
  85267. window_1.clearTimeout(oldTimeout);
  85268. var timeout = window_1.setTimeout(function() {
  85269. map["delete"](type2);
  85270. if (map.size === 0) {
  85271. map = null;
  85272. EVENT_MAP["delete"](_this);
  85273. }
  85274. _this.trigger(event2);
  85275. }, 0);
  85276. map.set(type2, timeout);
  85277. };
  85278. var objName = function objName2(obj) {
  85279. if (typeof obj.name === "function") {
  85280. return obj.name();
  85281. }
  85282. if (typeof obj.name === "string") {
  85283. return obj.name;
  85284. }
  85285. if (obj.name_) {
  85286. return obj.name_;
  85287. }
  85288. if (obj.constructor && obj.constructor.name) {
  85289. return obj.constructor.name;
  85290. }
  85291. return typeof obj;
  85292. };
  85293. var isEvented = function isEvented2(object) {
  85294. return object instanceof EventTarget$2 || !!object.eventBusEl_ && ["on", "one", "off", "trigger"].every(function(k) {
  85295. return typeof object[k] === "function";
  85296. });
  85297. };
  85298. var addEventedCallback = function addEventedCallback2(target, callback2) {
  85299. if (isEvented(target)) {
  85300. callback2();
  85301. } else {
  85302. if (!target.eventedCallbacks) {
  85303. target.eventedCallbacks = [];
  85304. }
  85305. target.eventedCallbacks.push(callback2);
  85306. }
  85307. };
  85308. var isValidEventType = function isValidEventType2(type2) {
  85309. return typeof type2 === "string" && /\S/.test(type2) || Array.isArray(type2) && !!type2.length;
  85310. };
  85311. var validateTarget = function validateTarget2(target, obj, fnName) {
  85312. if (!target || !target.nodeName && !isEvented(target)) {
  85313. throw new Error("Invalid target for " + objName(obj) + "#" + fnName + "; must be a DOM node or evented object.");
  85314. }
  85315. };
  85316. var validateEventType = function validateEventType2(type2, obj, fnName) {
  85317. if (!isValidEventType(type2)) {
  85318. throw new Error("Invalid event type for " + objName(obj) + "#" + fnName + "; must be a non-empty string or array.");
  85319. }
  85320. };
  85321. var validateListener = function validateListener2(listener, obj, fnName) {
  85322. if (typeof listener !== "function") {
  85323. throw new Error("Invalid listener for " + objName(obj) + "#" + fnName + "; must be a function.");
  85324. }
  85325. };
  85326. var normalizeListenArgs = function normalizeListenArgs2(self2, args, fnName) {
  85327. var isTargetingSelf = args.length < 3 || args[0] === self2 || args[0] === self2.eventBusEl_;
  85328. var target;
  85329. var type2;
  85330. var listener;
  85331. if (isTargetingSelf) {
  85332. target = self2.eventBusEl_;
  85333. if (args.length >= 3) {
  85334. args.shift();
  85335. }
  85336. type2 = args[0];
  85337. listener = args[1];
  85338. } else {
  85339. target = args[0];
  85340. type2 = args[1];
  85341. listener = args[2];
  85342. }
  85343. validateTarget(target, self2, fnName);
  85344. validateEventType(type2, self2, fnName);
  85345. validateListener(listener, self2, fnName);
  85346. listener = bind(self2, listener);
  85347. return {
  85348. isTargetingSelf,
  85349. target,
  85350. type: type2,
  85351. listener
  85352. };
  85353. };
  85354. var listen = function listen2(target, method, type2, listener) {
  85355. validateTarget(target, target, method);
  85356. if (target.nodeName) {
  85357. Events[method](target, type2, listener);
  85358. } else {
  85359. target[method](type2, listener);
  85360. }
  85361. };
  85362. var EventedMixin = {
  85363. on: function on2() {
  85364. var _this = this;
  85365. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  85366. args[_key] = arguments[_key];
  85367. }
  85368. var _normalizeListenArgs = normalizeListenArgs(this, args, "on"), isTargetingSelf = _normalizeListenArgs.isTargetingSelf, target = _normalizeListenArgs.target, type2 = _normalizeListenArgs.type, listener = _normalizeListenArgs.listener;
  85369. listen(target, "on", type2, listener);
  85370. if (!isTargetingSelf) {
  85371. var removeListenerOnDispose = function removeListenerOnDispose2() {
  85372. return _this.off(target, type2, listener);
  85373. };
  85374. removeListenerOnDispose.guid = listener.guid;
  85375. var removeRemoverOnTargetDispose = function removeRemoverOnTargetDispose2() {
  85376. return _this.off("dispose", removeListenerOnDispose);
  85377. };
  85378. removeRemoverOnTargetDispose.guid = listener.guid;
  85379. listen(this, "on", "dispose", removeListenerOnDispose);
  85380. listen(target, "on", "dispose", removeRemoverOnTargetDispose);
  85381. }
  85382. },
  85383. one: function one2() {
  85384. var _this2 = this;
  85385. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  85386. args[_key2] = arguments[_key2];
  85387. }
  85388. var _normalizeListenArgs2 = normalizeListenArgs(this, args, "one"), isTargetingSelf = _normalizeListenArgs2.isTargetingSelf, target = _normalizeListenArgs2.target, type2 = _normalizeListenArgs2.type, listener = _normalizeListenArgs2.listener;
  85389. if (isTargetingSelf) {
  85390. listen(target, "one", type2, listener);
  85391. } else {
  85392. var wrapper = function wrapper2() {
  85393. _this2.off(target, type2, wrapper2);
  85394. for (var _len3 = arguments.length, largs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  85395. largs[_key3] = arguments[_key3];
  85396. }
  85397. listener.apply(null, largs);
  85398. };
  85399. wrapper.guid = listener.guid;
  85400. listen(target, "one", type2, wrapper);
  85401. }
  85402. },
  85403. any: function any2() {
  85404. var _this3 = this;
  85405. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  85406. args[_key4] = arguments[_key4];
  85407. }
  85408. var _normalizeListenArgs3 = normalizeListenArgs(this, args, "any"), isTargetingSelf = _normalizeListenArgs3.isTargetingSelf, target = _normalizeListenArgs3.target, type2 = _normalizeListenArgs3.type, listener = _normalizeListenArgs3.listener;
  85409. if (isTargetingSelf) {
  85410. listen(target, "any", type2, listener);
  85411. } else {
  85412. var wrapper = function wrapper2() {
  85413. _this3.off(target, type2, wrapper2);
  85414. for (var _len5 = arguments.length, largs = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
  85415. largs[_key5] = arguments[_key5];
  85416. }
  85417. listener.apply(null, largs);
  85418. };
  85419. wrapper.guid = listener.guid;
  85420. listen(target, "any", type2, wrapper);
  85421. }
  85422. },
  85423. off: function off$12(targetOrType, typeOrListener, listener) {
  85424. if (!targetOrType || isValidEventType(targetOrType)) {
  85425. off(this.eventBusEl_, targetOrType, typeOrListener);
  85426. } else {
  85427. var target = targetOrType;
  85428. var type2 = typeOrListener;
  85429. validateTarget(target, this, "off");
  85430. validateEventType(type2, this, "off");
  85431. validateListener(listener, this, "off");
  85432. listener = bind(this, listener);
  85433. this.off("dispose", listener);
  85434. if (target.nodeName) {
  85435. off(target, type2, listener);
  85436. off(target, "dispose", listener);
  85437. } else if (isEvented(target)) {
  85438. target.off(type2, listener);
  85439. target.off("dispose", listener);
  85440. }
  85441. }
  85442. },
  85443. trigger: function trigger$12(event2, hash) {
  85444. validateTarget(this.eventBusEl_, this, "trigger");
  85445. var type2 = event2 && typeof event2 !== "string" ? event2.type : event2;
  85446. if (!isValidEventType(type2)) {
  85447. var error = "Invalid event type for " + objName(this) + "#trigger; must be a non-empty string or object with a type key that has a non-empty value.";
  85448. if (event2) {
  85449. (this.log || log$1).error(error);
  85450. } else {
  85451. throw new Error(error);
  85452. }
  85453. }
  85454. return trigger(this.eventBusEl_, event2, hash);
  85455. }
  85456. };
  85457. function evented(target, options2) {
  85458. if (options2 === void 0) {
  85459. options2 = {};
  85460. }
  85461. var _options = options2, eventBusKey = _options.eventBusKey;
  85462. if (eventBusKey) {
  85463. if (!target[eventBusKey].nodeName) {
  85464. throw new Error('The eventBusKey "' + eventBusKey + '" does not refer to an element.');
  85465. }
  85466. target.eventBusEl_ = target[eventBusKey];
  85467. } else {
  85468. target.eventBusEl_ = createEl("span", {
  85469. className: "vjs-event-bus"
  85470. });
  85471. }
  85472. assign(target, EventedMixin);
  85473. if (target.eventedCallbacks) {
  85474. target.eventedCallbacks.forEach(function(callback2) {
  85475. callback2();
  85476. });
  85477. }
  85478. target.on("dispose", function() {
  85479. target.off();
  85480. [target, target.el_, target.eventBusEl_].forEach(function(val) {
  85481. if (val && DomData.has(val)) {
  85482. DomData["delete"](val);
  85483. }
  85484. });
  85485. window_1.setTimeout(function() {
  85486. target.eventBusEl_ = null;
  85487. }, 0);
  85488. });
  85489. return target;
  85490. }
  85491. var StatefulMixin = {
  85492. state: {},
  85493. setState: function setState(stateUpdates) {
  85494. var _this = this;
  85495. if (typeof stateUpdates === "function") {
  85496. stateUpdates = stateUpdates();
  85497. }
  85498. var changes;
  85499. each(stateUpdates, function(value, key) {
  85500. if (_this.state[key] !== value) {
  85501. changes = changes || {};
  85502. changes[key] = {
  85503. from: _this.state[key],
  85504. to: value
  85505. };
  85506. }
  85507. _this.state[key] = value;
  85508. });
  85509. if (changes && isEvented(this)) {
  85510. this.trigger({
  85511. changes,
  85512. type: "statechanged"
  85513. });
  85514. }
  85515. return changes;
  85516. }
  85517. };
  85518. function stateful(target, defaultState) {
  85519. assign(target, StatefulMixin);
  85520. target.state = assign({}, target.state, defaultState);
  85521. if (typeof target.handleStateChanged === "function" && isEvented(target)) {
  85522. target.on("statechanged", target.handleStateChanged);
  85523. }
  85524. return target;
  85525. }
  85526. var toLowerCase = function toLowerCase2(string) {
  85527. if (typeof string !== "string") {
  85528. return string;
  85529. }
  85530. return string.replace(/./, function(w) {
  85531. return w.toLowerCase();
  85532. });
  85533. };
  85534. var toTitleCase$1 = function toTitleCase(string) {
  85535. if (typeof string !== "string") {
  85536. return string;
  85537. }
  85538. return string.replace(/./, function(w) {
  85539. return w.toUpperCase();
  85540. });
  85541. };
  85542. var titleCaseEquals = function titleCaseEquals2(str1, str2) {
  85543. return toTitleCase$1(str1) === toTitleCase$1(str2);
  85544. };
  85545. function mergeOptions$3() {
  85546. var result = {};
  85547. for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) {
  85548. sources[_key] = arguments[_key];
  85549. }
  85550. sources.forEach(function(source) {
  85551. if (!source) {
  85552. return;
  85553. }
  85554. each(source, function(value, key) {
  85555. if (!isPlain(value)) {
  85556. result[key] = value;
  85557. return;
  85558. }
  85559. if (!isPlain(result[key])) {
  85560. result[key] = {};
  85561. }
  85562. result[key] = mergeOptions$3(result[key], value);
  85563. });
  85564. });
  85565. return result;
  85566. }
  85567. var MapSham = /* @__PURE__ */ function() {
  85568. function MapSham2() {
  85569. this.map_ = {};
  85570. }
  85571. var _proto = MapSham2.prototype;
  85572. _proto.has = function has(key) {
  85573. return key in this.map_;
  85574. };
  85575. _proto["delete"] = function _delete(key) {
  85576. var has = this.has(key);
  85577. delete this.map_[key];
  85578. return has;
  85579. };
  85580. _proto.set = function set4(key, value) {
  85581. this.map_[key] = value;
  85582. return this;
  85583. };
  85584. _proto.forEach = function forEach(callback2, thisArg) {
  85585. for (var key in this.map_) {
  85586. callback2.call(thisArg, this.map_[key], key, this);
  85587. }
  85588. };
  85589. return MapSham2;
  85590. }();
  85591. var Map$1 = window_1.Map ? window_1.Map : MapSham;
  85592. var SetSham = /* @__PURE__ */ function() {
  85593. function SetSham2() {
  85594. this.set_ = {};
  85595. }
  85596. var _proto = SetSham2.prototype;
  85597. _proto.has = function has(key) {
  85598. return key in this.set_;
  85599. };
  85600. _proto["delete"] = function _delete(key) {
  85601. var has = this.has(key);
  85602. delete this.set_[key];
  85603. return has;
  85604. };
  85605. _proto.add = function add(key) {
  85606. this.set_[key] = 1;
  85607. return this;
  85608. };
  85609. _proto.forEach = function forEach(callback2, thisArg) {
  85610. for (var key in this.set_) {
  85611. callback2.call(thisArg, key, key, this);
  85612. }
  85613. };
  85614. return SetSham2;
  85615. }();
  85616. var Set$1 = window_1.Set ? window_1.Set : SetSham;
  85617. var Component$1 = /* @__PURE__ */ function() {
  85618. function Component2(player, options2, ready) {
  85619. var _this = this;
  85620. if (!player && this.play) {
  85621. this.player_ = player = this;
  85622. } else {
  85623. this.player_ = player;
  85624. }
  85625. this.isDisposed_ = false;
  85626. this.parentComponent_ = null;
  85627. this.options_ = mergeOptions$3({}, this.options_);
  85628. options2 = this.options_ = mergeOptions$3(this.options_, options2);
  85629. this.id_ = options2.id || options2.el && options2.el.id;
  85630. if (!this.id_) {
  85631. var id = player && player.id && player.id() || "no_player";
  85632. this.id_ = id + "_component_" + newGUID();
  85633. }
  85634. this.name_ = options2.name || null;
  85635. if (options2.el) {
  85636. this.el_ = options2.el;
  85637. } else if (options2.createEl !== false) {
  85638. this.el_ = this.createEl();
  85639. }
  85640. if (options2.className && this.el_) {
  85641. options2.className.split(" ").forEach(function(c) {
  85642. return _this.addClass(c);
  85643. });
  85644. }
  85645. if (options2.evented !== false) {
  85646. evented(this, {
  85647. eventBusKey: this.el_ ? "el_" : null
  85648. });
  85649. this.handleLanguagechange = this.handleLanguagechange.bind(this);
  85650. this.on(this.player_, "languagechange", this.handleLanguagechange);
  85651. }
  85652. stateful(this, this.constructor.defaultState);
  85653. this.children_ = [];
  85654. this.childIndex_ = {};
  85655. this.childNameIndex_ = {};
  85656. this.setTimeoutIds_ = new Set$1();
  85657. this.setIntervalIds_ = new Set$1();
  85658. this.rafIds_ = new Set$1();
  85659. this.namedRafs_ = new Map$1();
  85660. this.clearingTimersOnDispose_ = false;
  85661. if (options2.initChildren !== false) {
  85662. this.initChildren();
  85663. }
  85664. this.ready(ready);
  85665. if (options2.reportTouchActivity !== false) {
  85666. this.enableTouchActivity();
  85667. }
  85668. }
  85669. var _proto = Component2.prototype;
  85670. _proto.dispose = function dispose(options2) {
  85671. if (options2 === void 0) {
  85672. options2 = {};
  85673. }
  85674. if (this.isDisposed_) {
  85675. return;
  85676. }
  85677. if (this.readyQueue_) {
  85678. this.readyQueue_.length = 0;
  85679. }
  85680. this.trigger({
  85681. type: "dispose",
  85682. bubbles: false
  85683. });
  85684. this.isDisposed_ = true;
  85685. if (this.children_) {
  85686. for (var i2 = this.children_.length - 1; i2 >= 0; i2--) {
  85687. if (this.children_[i2].dispose) {
  85688. this.children_[i2].dispose();
  85689. }
  85690. }
  85691. }
  85692. this.children_ = null;
  85693. this.childIndex_ = null;
  85694. this.childNameIndex_ = null;
  85695. this.parentComponent_ = null;
  85696. if (this.el_) {
  85697. if (this.el_.parentNode) {
  85698. if (options2.restoreEl) {
  85699. this.el_.parentNode.replaceChild(options2.restoreEl, this.el_);
  85700. } else {
  85701. this.el_.parentNode.removeChild(this.el_);
  85702. }
  85703. }
  85704. this.el_ = null;
  85705. }
  85706. this.player_ = null;
  85707. };
  85708. _proto.isDisposed = function isDisposed() {
  85709. return Boolean(this.isDisposed_);
  85710. };
  85711. _proto.player = function player() {
  85712. return this.player_;
  85713. };
  85714. _proto.options = function options2(obj) {
  85715. if (!obj) {
  85716. return this.options_;
  85717. }
  85718. this.options_ = mergeOptions$3(this.options_, obj);
  85719. return this.options_;
  85720. };
  85721. _proto.el = function el() {
  85722. return this.el_;
  85723. };
  85724. _proto.createEl = function createEl$12(tagName, properties, attributes) {
  85725. return createEl(tagName, properties, attributes);
  85726. };
  85727. _proto.localize = function localize(string, tokens, defaultValue2) {
  85728. if (defaultValue2 === void 0) {
  85729. defaultValue2 = string;
  85730. }
  85731. var code = this.player_.language && this.player_.language();
  85732. var languages = this.player_.languages && this.player_.languages();
  85733. var language = languages && languages[code];
  85734. var primaryCode = code && code.split("-")[0];
  85735. var primaryLang = languages && languages[primaryCode];
  85736. var localizedString = defaultValue2;
  85737. if (language && language[string]) {
  85738. localizedString = language[string];
  85739. } else if (primaryLang && primaryLang[string]) {
  85740. localizedString = primaryLang[string];
  85741. }
  85742. if (tokens) {
  85743. localizedString = localizedString.replace(/\{(\d+)\}/g, function(match, index2) {
  85744. var value = tokens[index2 - 1];
  85745. var ret = value;
  85746. if (typeof value === "undefined") {
  85747. ret = match;
  85748. }
  85749. return ret;
  85750. });
  85751. }
  85752. return localizedString;
  85753. };
  85754. _proto.handleLanguagechange = function handleLanguagechange() {
  85755. };
  85756. _proto.contentEl = function contentEl() {
  85757. return this.contentEl_ || this.el_;
  85758. };
  85759. _proto.id = function id() {
  85760. return this.id_;
  85761. };
  85762. _proto.name = function name() {
  85763. return this.name_;
  85764. };
  85765. _proto.children = function children() {
  85766. return this.children_;
  85767. };
  85768. _proto.getChildById = function getChildById(id) {
  85769. return this.childIndex_[id];
  85770. };
  85771. _proto.getChild = function getChild(name) {
  85772. if (!name) {
  85773. return;
  85774. }
  85775. return this.childNameIndex_[name];
  85776. };
  85777. _proto.getDescendant = function getDescendant() {
  85778. for (var _len = arguments.length, names2 = new Array(_len), _key = 0; _key < _len; _key++) {
  85779. names2[_key] = arguments[_key];
  85780. }
  85781. names2 = names2.reduce(function(acc, n) {
  85782. return acc.concat(n);
  85783. }, []);
  85784. var currentChild = this;
  85785. for (var i2 = 0; i2 < names2.length; i2++) {
  85786. currentChild = currentChild.getChild(names2[i2]);
  85787. if (!currentChild || !currentChild.getChild) {
  85788. return;
  85789. }
  85790. }
  85791. return currentChild;
  85792. };
  85793. _proto.addChild = function addChild(child, options2, index2) {
  85794. if (options2 === void 0) {
  85795. options2 = {};
  85796. }
  85797. if (index2 === void 0) {
  85798. index2 = this.children_.length;
  85799. }
  85800. var component;
  85801. var componentName;
  85802. if (typeof child === "string") {
  85803. componentName = toTitleCase$1(child);
  85804. var componentClassName = options2.componentClass || componentName;
  85805. options2.name = componentName;
  85806. var ComponentClass = Component2.getComponent(componentClassName);
  85807. if (!ComponentClass) {
  85808. throw new Error("Component " + componentClassName + " does not exist");
  85809. }
  85810. if (typeof ComponentClass !== "function") {
  85811. return null;
  85812. }
  85813. component = new ComponentClass(this.player_ || this, options2);
  85814. } else {
  85815. component = child;
  85816. }
  85817. if (component.parentComponent_) {
  85818. component.parentComponent_.removeChild(component);
  85819. }
  85820. this.children_.splice(index2, 0, component);
  85821. component.parentComponent_ = this;
  85822. if (typeof component.id === "function") {
  85823. this.childIndex_[component.id()] = component;
  85824. }
  85825. componentName = componentName || component.name && toTitleCase$1(component.name());
  85826. if (componentName) {
  85827. this.childNameIndex_[componentName] = component;
  85828. this.childNameIndex_[toLowerCase(componentName)] = component;
  85829. }
  85830. if (typeof component.el === "function" && component.el()) {
  85831. var refNode = null;
  85832. if (this.children_[index2 + 1]) {
  85833. if (this.children_[index2 + 1].el_) {
  85834. refNode = this.children_[index2 + 1].el_;
  85835. } else if (isEl(this.children_[index2 + 1])) {
  85836. refNode = this.children_[index2 + 1];
  85837. }
  85838. }
  85839. this.contentEl().insertBefore(component.el(), refNode);
  85840. }
  85841. return component;
  85842. };
  85843. _proto.removeChild = function removeChild(component) {
  85844. if (typeof component === "string") {
  85845. component = this.getChild(component);
  85846. }
  85847. if (!component || !this.children_) {
  85848. return;
  85849. }
  85850. var childFound = false;
  85851. for (var i2 = this.children_.length - 1; i2 >= 0; i2--) {
  85852. if (this.children_[i2] === component) {
  85853. childFound = true;
  85854. this.children_.splice(i2, 1);
  85855. break;
  85856. }
  85857. }
  85858. if (!childFound) {
  85859. return;
  85860. }
  85861. component.parentComponent_ = null;
  85862. this.childIndex_[component.id()] = null;
  85863. this.childNameIndex_[toTitleCase$1(component.name())] = null;
  85864. this.childNameIndex_[toLowerCase(component.name())] = null;
  85865. var compEl = component.el();
  85866. if (compEl && compEl.parentNode === this.contentEl()) {
  85867. this.contentEl().removeChild(component.el());
  85868. }
  85869. };
  85870. _proto.initChildren = function initChildren() {
  85871. var _this2 = this;
  85872. var children = this.options_.children;
  85873. if (children) {
  85874. var parentOptions = this.options_;
  85875. var handleAdd = function handleAdd2(child) {
  85876. var name = child.name;
  85877. var opts = child.opts;
  85878. if (parentOptions[name] !== void 0) {
  85879. opts = parentOptions[name];
  85880. }
  85881. if (opts === false) {
  85882. return;
  85883. }
  85884. if (opts === true) {
  85885. opts = {};
  85886. }
  85887. opts.playerOptions = _this2.options_.playerOptions;
  85888. var newChild = _this2.addChild(name, opts);
  85889. if (newChild) {
  85890. _this2[name] = newChild;
  85891. }
  85892. };
  85893. var workingChildren;
  85894. var Tech2 = Component2.getComponent("Tech");
  85895. if (Array.isArray(children)) {
  85896. workingChildren = children;
  85897. } else {
  85898. workingChildren = Object.keys(children);
  85899. }
  85900. workingChildren.concat(Object.keys(this.options_).filter(function(child) {
  85901. return !workingChildren.some(function(wchild) {
  85902. if (typeof wchild === "string") {
  85903. return child === wchild;
  85904. }
  85905. return child === wchild.name;
  85906. });
  85907. })).map(function(child) {
  85908. var name;
  85909. var opts;
  85910. if (typeof child === "string") {
  85911. name = child;
  85912. opts = children[name] || _this2.options_[name] || {};
  85913. } else {
  85914. name = child.name;
  85915. opts = child;
  85916. }
  85917. return {
  85918. name,
  85919. opts
  85920. };
  85921. }).filter(function(child) {
  85922. var c = Component2.getComponent(child.opts.componentClass || toTitleCase$1(child.name));
  85923. return c && !Tech2.isTech(c);
  85924. }).forEach(handleAdd);
  85925. }
  85926. };
  85927. _proto.buildCSSClass = function buildCSSClass() {
  85928. return "";
  85929. };
  85930. _proto.ready = function ready(fn2, sync) {
  85931. if (sync === void 0) {
  85932. sync = false;
  85933. }
  85934. if (!fn2) {
  85935. return;
  85936. }
  85937. if (!this.isReady_) {
  85938. this.readyQueue_ = this.readyQueue_ || [];
  85939. this.readyQueue_.push(fn2);
  85940. return;
  85941. }
  85942. if (sync) {
  85943. fn2.call(this);
  85944. } else {
  85945. this.setTimeout(fn2, 1);
  85946. }
  85947. };
  85948. _proto.triggerReady = function triggerReady() {
  85949. this.isReady_ = true;
  85950. this.setTimeout(function() {
  85951. var readyQueue = this.readyQueue_;
  85952. this.readyQueue_ = [];
  85953. if (readyQueue && readyQueue.length > 0) {
  85954. readyQueue.forEach(function(fn2) {
  85955. fn2.call(this);
  85956. }, this);
  85957. }
  85958. this.trigger("ready");
  85959. }, 1);
  85960. };
  85961. _proto.$ = function $$12(selector, context) {
  85962. return $(selector, context || this.contentEl());
  85963. };
  85964. _proto.$$ = function $$$12(selector, context) {
  85965. return $$(selector, context || this.contentEl());
  85966. };
  85967. _proto.hasClass = function hasClass$12(classToCheck) {
  85968. return hasClass(this.el_, classToCheck);
  85969. };
  85970. _proto.addClass = function addClass$12(classToAdd) {
  85971. addClass(this.el_, classToAdd);
  85972. };
  85973. _proto.removeClass = function removeClass$12(classToRemove) {
  85974. removeClass(this.el_, classToRemove);
  85975. };
  85976. _proto.toggleClass = function toggleClass$12(classToToggle, predicate) {
  85977. toggleClass(this.el_, classToToggle, predicate);
  85978. };
  85979. _proto.show = function show() {
  85980. this.removeClass("vjs-hidden");
  85981. };
  85982. _proto.hide = function hide() {
  85983. this.addClass("vjs-hidden");
  85984. };
  85985. _proto.lockShowing = function lockShowing() {
  85986. this.addClass("vjs-lock-showing");
  85987. };
  85988. _proto.unlockShowing = function unlockShowing() {
  85989. this.removeClass("vjs-lock-showing");
  85990. };
  85991. _proto.getAttribute = function getAttribute$12(attribute) {
  85992. return getAttribute(this.el_, attribute);
  85993. };
  85994. _proto.setAttribute = function setAttribute$12(attribute, value) {
  85995. setAttribute(this.el_, attribute, value);
  85996. };
  85997. _proto.removeAttribute = function removeAttribute$12(attribute) {
  85998. removeAttribute(this.el_, attribute);
  85999. };
  86000. _proto.width = function width2(num, skipListeners) {
  86001. return this.dimension("width", num, skipListeners);
  86002. };
  86003. _proto.height = function height2(num, skipListeners) {
  86004. return this.dimension("height", num, skipListeners);
  86005. };
  86006. _proto.dimensions = function dimensions(width2, height2) {
  86007. this.width(width2, true);
  86008. this.height(height2);
  86009. };
  86010. _proto.dimension = function dimension(widthOrHeight, num, skipListeners) {
  86011. if (num !== void 0) {
  86012. if (num === null || num !== num) {
  86013. num = 0;
  86014. }
  86015. if (("" + num).indexOf("%") !== -1 || ("" + num).indexOf("px") !== -1) {
  86016. this.el_.style[widthOrHeight] = num;
  86017. } else if (num === "auto") {
  86018. this.el_.style[widthOrHeight] = "";
  86019. } else {
  86020. this.el_.style[widthOrHeight] = num + "px";
  86021. }
  86022. if (!skipListeners) {
  86023. this.trigger("componentresize");
  86024. }
  86025. return;
  86026. }
  86027. if (!this.el_) {
  86028. return 0;
  86029. }
  86030. var val = this.el_.style[widthOrHeight];
  86031. var pxIndex = val.indexOf("px");
  86032. if (pxIndex !== -1) {
  86033. return parseInt(val.slice(0, pxIndex), 10);
  86034. }
  86035. return parseInt(this.el_["offset" + toTitleCase$1(widthOrHeight)], 10);
  86036. };
  86037. _proto.currentDimension = function currentDimension(widthOrHeight) {
  86038. var computedWidthOrHeight = 0;
  86039. if (widthOrHeight !== "width" && widthOrHeight !== "height") {
  86040. throw new Error("currentDimension only accepts width or height value");
  86041. }
  86042. computedWidthOrHeight = computedStyle(this.el_, widthOrHeight);
  86043. computedWidthOrHeight = parseFloat(computedWidthOrHeight);
  86044. if (computedWidthOrHeight === 0 || isNaN(computedWidthOrHeight)) {
  86045. var rule = "offset" + toTitleCase$1(widthOrHeight);
  86046. computedWidthOrHeight = this.el_[rule];
  86047. }
  86048. return computedWidthOrHeight;
  86049. };
  86050. _proto.currentDimensions = function currentDimensions() {
  86051. return {
  86052. width: this.currentDimension("width"),
  86053. height: this.currentDimension("height")
  86054. };
  86055. };
  86056. _proto.currentWidth = function currentWidth() {
  86057. return this.currentDimension("width");
  86058. };
  86059. _proto.currentHeight = function currentHeight() {
  86060. return this.currentDimension("height");
  86061. };
  86062. _proto.focus = function focus() {
  86063. this.el_.focus();
  86064. };
  86065. _proto.blur = function blur() {
  86066. this.el_.blur();
  86067. };
  86068. _proto.handleKeyDown = function handleKeyDown(event2) {
  86069. if (this.player_) {
  86070. if (!keycode.isEventKey(event2, "Tab")) {
  86071. event2.stopPropagation();
  86072. }
  86073. this.player_.handleKeyDown(event2);
  86074. }
  86075. };
  86076. _proto.handleKeyPress = function handleKeyPress(event2) {
  86077. this.handleKeyDown(event2);
  86078. };
  86079. _proto.emitTapEvents = function emitTapEvents() {
  86080. var touchStart = 0;
  86081. var firstTouch = null;
  86082. var tapMovementThreshold = 10;
  86083. var touchTimeThreshold = 200;
  86084. var couldBeTap;
  86085. this.on("touchstart", function(event2) {
  86086. if (event2.touches.length === 1) {
  86087. firstTouch = {
  86088. pageX: event2.touches[0].pageX,
  86089. pageY: event2.touches[0].pageY
  86090. };
  86091. touchStart = window_1.performance.now();
  86092. couldBeTap = true;
  86093. }
  86094. });
  86095. this.on("touchmove", function(event2) {
  86096. if (event2.touches.length > 1) {
  86097. couldBeTap = false;
  86098. } else if (firstTouch) {
  86099. var xdiff = event2.touches[0].pageX - firstTouch.pageX;
  86100. var ydiff = event2.touches[0].pageY - firstTouch.pageY;
  86101. var touchDistance = Math.sqrt(xdiff * xdiff + ydiff * ydiff);
  86102. if (touchDistance > tapMovementThreshold) {
  86103. couldBeTap = false;
  86104. }
  86105. }
  86106. });
  86107. var noTap = function noTap2() {
  86108. couldBeTap = false;
  86109. };
  86110. this.on("touchleave", noTap);
  86111. this.on("touchcancel", noTap);
  86112. this.on("touchend", function(event2) {
  86113. firstTouch = null;
  86114. if (couldBeTap === true) {
  86115. var touchTime = window_1.performance.now() - touchStart;
  86116. if (touchTime < touchTimeThreshold) {
  86117. event2.preventDefault();
  86118. this.trigger("tap");
  86119. }
  86120. }
  86121. });
  86122. };
  86123. _proto.enableTouchActivity = function enableTouchActivity() {
  86124. if (!this.player() || !this.player().reportUserActivity) {
  86125. return;
  86126. }
  86127. var report = bind(this.player(), this.player().reportUserActivity);
  86128. var touchHolding;
  86129. this.on("touchstart", function() {
  86130. report();
  86131. this.clearInterval(touchHolding);
  86132. touchHolding = this.setInterval(report, 250);
  86133. });
  86134. var touchEnd = function touchEnd2(event2) {
  86135. report();
  86136. this.clearInterval(touchHolding);
  86137. };
  86138. this.on("touchmove", report);
  86139. this.on("touchend", touchEnd);
  86140. this.on("touchcancel", touchEnd);
  86141. };
  86142. _proto.setTimeout = function setTimeout2(fn2, timeout) {
  86143. var _this3 = this;
  86144. var timeoutId;
  86145. fn2 = bind(this, fn2);
  86146. this.clearTimersOnDispose_();
  86147. timeoutId = window_1.setTimeout(function() {
  86148. if (_this3.setTimeoutIds_.has(timeoutId)) {
  86149. _this3.setTimeoutIds_["delete"](timeoutId);
  86150. }
  86151. fn2();
  86152. }, timeout);
  86153. this.setTimeoutIds_.add(timeoutId);
  86154. return timeoutId;
  86155. };
  86156. _proto.clearTimeout = function clearTimeout2(timeoutId) {
  86157. if (this.setTimeoutIds_.has(timeoutId)) {
  86158. this.setTimeoutIds_["delete"](timeoutId);
  86159. window_1.clearTimeout(timeoutId);
  86160. }
  86161. return timeoutId;
  86162. };
  86163. _proto.setInterval = function setInterval2(fn2, interval) {
  86164. fn2 = bind(this, fn2);
  86165. this.clearTimersOnDispose_();
  86166. var intervalId = window_1.setInterval(fn2, interval);
  86167. this.setIntervalIds_.add(intervalId);
  86168. return intervalId;
  86169. };
  86170. _proto.clearInterval = function clearInterval2(intervalId) {
  86171. if (this.setIntervalIds_.has(intervalId)) {
  86172. this.setIntervalIds_["delete"](intervalId);
  86173. window_1.clearInterval(intervalId);
  86174. }
  86175. return intervalId;
  86176. };
  86177. _proto.requestAnimationFrame = function requestAnimationFrame(fn2) {
  86178. var _this4 = this;
  86179. if (!this.supportsRaf_) {
  86180. return this.setTimeout(fn2, 1e3 / 60);
  86181. }
  86182. this.clearTimersOnDispose_();
  86183. var id;
  86184. fn2 = bind(this, fn2);
  86185. id = window_1.requestAnimationFrame(function() {
  86186. if (_this4.rafIds_.has(id)) {
  86187. _this4.rafIds_["delete"](id);
  86188. }
  86189. fn2();
  86190. });
  86191. this.rafIds_.add(id);
  86192. return id;
  86193. };
  86194. _proto.requestNamedAnimationFrame = function requestNamedAnimationFrame(name, fn2) {
  86195. var _this5 = this;
  86196. if (this.namedRafs_.has(name)) {
  86197. return;
  86198. }
  86199. this.clearTimersOnDispose_();
  86200. fn2 = bind(this, fn2);
  86201. var id = this.requestAnimationFrame(function() {
  86202. fn2();
  86203. if (_this5.namedRafs_.has(name)) {
  86204. _this5.namedRafs_["delete"](name);
  86205. }
  86206. });
  86207. this.namedRafs_.set(name, id);
  86208. return name;
  86209. };
  86210. _proto.cancelNamedAnimationFrame = function cancelNamedAnimationFrame(name) {
  86211. if (!this.namedRafs_.has(name)) {
  86212. return;
  86213. }
  86214. this.cancelAnimationFrame(this.namedRafs_.get(name));
  86215. this.namedRafs_["delete"](name);
  86216. };
  86217. _proto.cancelAnimationFrame = function cancelAnimationFrame(id) {
  86218. if (!this.supportsRaf_) {
  86219. return this.clearTimeout(id);
  86220. }
  86221. if (this.rafIds_.has(id)) {
  86222. this.rafIds_["delete"](id);
  86223. window_1.cancelAnimationFrame(id);
  86224. }
  86225. return id;
  86226. };
  86227. _proto.clearTimersOnDispose_ = function clearTimersOnDispose_() {
  86228. var _this6 = this;
  86229. if (this.clearingTimersOnDispose_) {
  86230. return;
  86231. }
  86232. this.clearingTimersOnDispose_ = true;
  86233. this.one("dispose", function() {
  86234. [["namedRafs_", "cancelNamedAnimationFrame"], ["rafIds_", "cancelAnimationFrame"], ["setTimeoutIds_", "clearTimeout"], ["setIntervalIds_", "clearInterval"]].forEach(function(_ref) {
  86235. var idName = _ref[0], cancelName = _ref[1];
  86236. _this6[idName].forEach(function(val, key) {
  86237. return _this6[cancelName](key);
  86238. });
  86239. });
  86240. _this6.clearingTimersOnDispose_ = false;
  86241. });
  86242. };
  86243. Component2.registerComponent = function registerComponent(name, ComponentToRegister) {
  86244. if (typeof name !== "string" || !name) {
  86245. throw new Error('Illegal component name, "' + name + '"; must be a non-empty string.');
  86246. }
  86247. var Tech2 = Component2.getComponent("Tech");
  86248. var isTech = Tech2 && Tech2.isTech(ComponentToRegister);
  86249. var isComp = Component2 === ComponentToRegister || Component2.prototype.isPrototypeOf(ComponentToRegister.prototype);
  86250. if (isTech || !isComp) {
  86251. var reason;
  86252. if (isTech) {
  86253. reason = "techs must be registered using Tech.registerTech()";
  86254. } else {
  86255. reason = "must be a Component subclass";
  86256. }
  86257. throw new Error('Illegal component, "' + name + '"; ' + reason + ".");
  86258. }
  86259. name = toTitleCase$1(name);
  86260. if (!Component2.components_) {
  86261. Component2.components_ = {};
  86262. }
  86263. var Player2 = Component2.getComponent("Player");
  86264. if (name === "Player" && Player2 && Player2.players) {
  86265. var players = Player2.players;
  86266. var playerNames = Object.keys(players);
  86267. if (players && playerNames.length > 0 && playerNames.map(function(pname) {
  86268. return players[pname];
  86269. }).every(Boolean)) {
  86270. throw new Error("Can not register Player component after player has been created.");
  86271. }
  86272. }
  86273. Component2.components_[name] = ComponentToRegister;
  86274. Component2.components_[toLowerCase(name)] = ComponentToRegister;
  86275. return ComponentToRegister;
  86276. };
  86277. Component2.getComponent = function getComponent(name) {
  86278. if (!name || !Component2.components_) {
  86279. return;
  86280. }
  86281. return Component2.components_[name];
  86282. };
  86283. return Component2;
  86284. }();
  86285. Component$1.prototype.supportsRaf_ = typeof window_1.requestAnimationFrame === "function" && typeof window_1.cancelAnimationFrame === "function";
  86286. Component$1.registerComponent("Component", Component$1);
  86287. function rangeCheck(fnName, index2, maxIndex) {
  86288. if (typeof index2 !== "number" || index2 < 0 || index2 > maxIndex) {
  86289. throw new Error("Failed to execute '" + fnName + "' on 'TimeRanges': The index provided (" + index2 + ") is non-numeric or out of bounds (0-" + maxIndex + ").");
  86290. }
  86291. }
  86292. function getRange(fnName, valueIndex, ranges, rangeIndex) {
  86293. rangeCheck(fnName, rangeIndex, ranges.length - 1);
  86294. return ranges[rangeIndex][valueIndex];
  86295. }
  86296. function createTimeRangesObj(ranges) {
  86297. var timeRangesObj;
  86298. if (ranges === void 0 || ranges.length === 0) {
  86299. timeRangesObj = {
  86300. length: 0,
  86301. start: function start2() {
  86302. throw new Error("This TimeRanges object is empty");
  86303. },
  86304. end: function end() {
  86305. throw new Error("This TimeRanges object is empty");
  86306. }
  86307. };
  86308. } else {
  86309. timeRangesObj = {
  86310. length: ranges.length,
  86311. start: getRange.bind(null, "start", 0, ranges),
  86312. end: getRange.bind(null, "end", 1, ranges)
  86313. };
  86314. }
  86315. if (window_1.Symbol && window_1.Symbol.iterator) {
  86316. timeRangesObj[window_1.Symbol.iterator] = function() {
  86317. return (ranges || []).values();
  86318. };
  86319. }
  86320. return timeRangesObj;
  86321. }
  86322. function createTimeRanges(start2, end) {
  86323. if (Array.isArray(start2)) {
  86324. return createTimeRangesObj(start2);
  86325. } else if (start2 === void 0 || end === void 0) {
  86326. return createTimeRangesObj();
  86327. }
  86328. return createTimeRangesObj([[start2, end]]);
  86329. }
  86330. function bufferedPercent(buffered, duration5) {
  86331. var bufferedDuration = 0;
  86332. var start2;
  86333. var end;
  86334. if (!duration5) {
  86335. return 0;
  86336. }
  86337. if (!buffered || !buffered.length) {
  86338. buffered = createTimeRanges(0, 0);
  86339. }
  86340. for (var i2 = 0; i2 < buffered.length; i2++) {
  86341. start2 = buffered.start(i2);
  86342. end = buffered.end(i2);
  86343. if (end > duration5) {
  86344. end = duration5;
  86345. }
  86346. bufferedDuration += end - start2;
  86347. }
  86348. return bufferedDuration / duration5;
  86349. }
  86350. function MediaError(value) {
  86351. if (value instanceof MediaError) {
  86352. return value;
  86353. }
  86354. if (typeof value === "number") {
  86355. this.code = value;
  86356. } else if (typeof value === "string") {
  86357. this.message = value;
  86358. } else if (isObject2(value)) {
  86359. if (typeof value.code === "number") {
  86360. this.code = value.code;
  86361. }
  86362. assign(this, value);
  86363. }
  86364. if (!this.message) {
  86365. this.message = MediaError.defaultMessages[this.code] || "";
  86366. }
  86367. }
  86368. MediaError.prototype.code = 0;
  86369. MediaError.prototype.message = "";
  86370. MediaError.prototype.status = null;
  86371. MediaError.errorTypes = ["MEDIA_ERR_CUSTOM", "MEDIA_ERR_ABORTED", "MEDIA_ERR_NETWORK", "MEDIA_ERR_DECODE", "MEDIA_ERR_SRC_NOT_SUPPORTED", "MEDIA_ERR_ENCRYPTED"];
  86372. MediaError.defaultMessages = {
  86373. 1: "You aborted the media playback",
  86374. 2: "A network error caused the media download to fail part-way.",
  86375. 3: "The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",
  86376. 4: "The media could not be loaded, either because the server or network failed or because the format is not supported.",
  86377. 5: "The media is encrypted and we do not have the keys to decrypt it."
  86378. };
  86379. for (var errNum = 0; errNum < MediaError.errorTypes.length; errNum++) {
  86380. MediaError[MediaError.errorTypes[errNum]] = errNum;
  86381. MediaError.prototype[MediaError.errorTypes[errNum]] = errNum;
  86382. }
  86383. function isPromise(value) {
  86384. return value !== void 0 && value !== null && typeof value.then === "function";
  86385. }
  86386. function silencePromise(value) {
  86387. if (isPromise(value)) {
  86388. value.then(null, function(e) {
  86389. });
  86390. }
  86391. }
  86392. var trackToJson_ = function trackToJson_2(track) {
  86393. var ret = ["kind", "label", "language", "id", "inBandMetadataTrackDispatchType", "mode", "src"].reduce(function(acc, prop, i2) {
  86394. if (track[prop]) {
  86395. acc[prop] = track[prop];
  86396. }
  86397. return acc;
  86398. }, {
  86399. cues: track.cues && Array.prototype.map.call(track.cues, function(cue) {
  86400. return {
  86401. startTime: cue.startTime,
  86402. endTime: cue.endTime,
  86403. text: cue.text,
  86404. id: cue.id
  86405. };
  86406. })
  86407. });
  86408. return ret;
  86409. };
  86410. var textTracksToJson = function textTracksToJson2(tech) {
  86411. var trackEls = tech.$$("track");
  86412. var trackObjs = Array.prototype.map.call(trackEls, function(t2) {
  86413. return t2.track;
  86414. });
  86415. var tracks = Array.prototype.map.call(trackEls, function(trackEl) {
  86416. var json = trackToJson_(trackEl.track);
  86417. if (trackEl.src) {
  86418. json.src = trackEl.src;
  86419. }
  86420. return json;
  86421. });
  86422. return tracks.concat(Array.prototype.filter.call(tech.textTracks(), function(track) {
  86423. return trackObjs.indexOf(track) === -1;
  86424. }).map(trackToJson_));
  86425. };
  86426. var jsonToTextTracks = function jsonToTextTracks2(json, tech) {
  86427. json.forEach(function(track) {
  86428. var addedTrack = tech.addRemoteTextTrack(track).track;
  86429. if (!track.src && track.cues) {
  86430. track.cues.forEach(function(cue) {
  86431. return addedTrack.addCue(cue);
  86432. });
  86433. }
  86434. });
  86435. return tech.textTracks();
  86436. };
  86437. var textTrackConverter = {
  86438. textTracksToJson,
  86439. jsonToTextTracks,
  86440. trackToJson_
  86441. };
  86442. var MODAL_CLASS_NAME = "vjs-modal-dialog";
  86443. var ModalDialog = /* @__PURE__ */ function(_Component) {
  86444. _inheritsLoose(ModalDialog2, _Component);
  86445. function ModalDialog2(player, options2) {
  86446. var _this;
  86447. _this = _Component.call(this, player, options2) || this;
  86448. _this.handleKeyDown_ = function(e) {
  86449. return _this.handleKeyDown(e);
  86450. };
  86451. _this.close_ = function(e) {
  86452. return _this.close(e);
  86453. };
  86454. _this.opened_ = _this.hasBeenOpened_ = _this.hasBeenFilled_ = false;
  86455. _this.closeable(!_this.options_.uncloseable);
  86456. _this.content(_this.options_.content);
  86457. _this.contentEl_ = createEl("div", {
  86458. className: MODAL_CLASS_NAME + "-content"
  86459. }, {
  86460. role: "document"
  86461. });
  86462. _this.descEl_ = createEl("p", {
  86463. className: MODAL_CLASS_NAME + "-description vjs-control-text",
  86464. id: _this.el().getAttribute("aria-describedby")
  86465. });
  86466. textContent(_this.descEl_, _this.description());
  86467. _this.el_.appendChild(_this.descEl_);
  86468. _this.el_.appendChild(_this.contentEl_);
  86469. return _this;
  86470. }
  86471. var _proto = ModalDialog2.prototype;
  86472. _proto.createEl = function createEl2() {
  86473. return _Component.prototype.createEl.call(this, "div", {
  86474. className: this.buildCSSClass(),
  86475. tabIndex: -1
  86476. }, {
  86477. "aria-describedby": this.id() + "_description",
  86478. "aria-hidden": "true",
  86479. "aria-label": this.label(),
  86480. "role": "dialog"
  86481. });
  86482. };
  86483. _proto.dispose = function dispose() {
  86484. this.contentEl_ = null;
  86485. this.descEl_ = null;
  86486. this.previouslyActiveEl_ = null;
  86487. _Component.prototype.dispose.call(this);
  86488. };
  86489. _proto.buildCSSClass = function buildCSSClass() {
  86490. return MODAL_CLASS_NAME + " vjs-hidden " + _Component.prototype.buildCSSClass.call(this);
  86491. };
  86492. _proto.label = function label2() {
  86493. return this.localize(this.options_.label || "Modal Window");
  86494. };
  86495. _proto.description = function description() {
  86496. var desc = this.options_.description || this.localize("This is a modal window.");
  86497. if (this.closeable()) {
  86498. desc += " " + this.localize("This modal can be closed by pressing the Escape key or activating the close button.");
  86499. }
  86500. return desc;
  86501. };
  86502. _proto.open = function open() {
  86503. if (!this.opened_) {
  86504. var player = this.player();
  86505. this.trigger("beforemodalopen");
  86506. this.opened_ = true;
  86507. if (this.options_.fillAlways || !this.hasBeenOpened_ && !this.hasBeenFilled_) {
  86508. this.fill();
  86509. }
  86510. this.wasPlaying_ = !player.paused();
  86511. if (this.options_.pauseOnOpen && this.wasPlaying_) {
  86512. player.pause();
  86513. }
  86514. this.on("keydown", this.handleKeyDown_);
  86515. this.hadControls_ = player.controls();
  86516. player.controls(false);
  86517. this.show();
  86518. this.conditionalFocus_();
  86519. this.el().setAttribute("aria-hidden", "false");
  86520. this.trigger("modalopen");
  86521. this.hasBeenOpened_ = true;
  86522. }
  86523. };
  86524. _proto.opened = function opened(value) {
  86525. if (typeof value === "boolean") {
  86526. this[value ? "open" : "close"]();
  86527. }
  86528. return this.opened_;
  86529. };
  86530. _proto.close = function close() {
  86531. if (!this.opened_) {
  86532. return;
  86533. }
  86534. var player = this.player();
  86535. this.trigger("beforemodalclose");
  86536. this.opened_ = false;
  86537. if (this.wasPlaying_ && this.options_.pauseOnOpen) {
  86538. player.play();
  86539. }
  86540. this.off("keydown", this.handleKeyDown_);
  86541. if (this.hadControls_) {
  86542. player.controls(true);
  86543. }
  86544. this.hide();
  86545. this.el().setAttribute("aria-hidden", "true");
  86546. this.trigger("modalclose");
  86547. this.conditionalBlur_();
  86548. if (this.options_.temporary) {
  86549. this.dispose();
  86550. }
  86551. };
  86552. _proto.closeable = function closeable(value) {
  86553. if (typeof value === "boolean") {
  86554. var closeable2 = this.closeable_ = !!value;
  86555. var close = this.getChild("closeButton");
  86556. if (closeable2 && !close) {
  86557. var temp = this.contentEl_;
  86558. this.contentEl_ = this.el_;
  86559. close = this.addChild("closeButton", {
  86560. controlText: "Close Modal Dialog"
  86561. });
  86562. this.contentEl_ = temp;
  86563. this.on(close, "close", this.close_);
  86564. }
  86565. if (!closeable2 && close) {
  86566. this.off(close, "close", this.close_);
  86567. this.removeChild(close);
  86568. close.dispose();
  86569. }
  86570. }
  86571. return this.closeable_;
  86572. };
  86573. _proto.fill = function fill() {
  86574. this.fillWith(this.content());
  86575. };
  86576. _proto.fillWith = function fillWith(content) {
  86577. var contentEl = this.contentEl();
  86578. var parentEl = contentEl.parentNode;
  86579. var nextSiblingEl = contentEl.nextSibling;
  86580. this.trigger("beforemodalfill");
  86581. this.hasBeenFilled_ = true;
  86582. parentEl.removeChild(contentEl);
  86583. this.empty();
  86584. insertContent(contentEl, content);
  86585. this.trigger("modalfill");
  86586. if (nextSiblingEl) {
  86587. parentEl.insertBefore(contentEl, nextSiblingEl);
  86588. } else {
  86589. parentEl.appendChild(contentEl);
  86590. }
  86591. var closeButton = this.getChild("closeButton");
  86592. if (closeButton) {
  86593. parentEl.appendChild(closeButton.el_);
  86594. }
  86595. };
  86596. _proto.empty = function empty() {
  86597. this.trigger("beforemodalempty");
  86598. emptyEl(this.contentEl());
  86599. this.trigger("modalempty");
  86600. };
  86601. _proto.content = function content(value) {
  86602. if (typeof value !== "undefined") {
  86603. this.content_ = value;
  86604. }
  86605. return this.content_;
  86606. };
  86607. _proto.conditionalFocus_ = function conditionalFocus_() {
  86608. var activeEl = document_1.activeElement;
  86609. var playerEl = this.player_.el_;
  86610. this.previouslyActiveEl_ = null;
  86611. if (playerEl.contains(activeEl) || playerEl === activeEl) {
  86612. this.previouslyActiveEl_ = activeEl;
  86613. this.focus();
  86614. }
  86615. };
  86616. _proto.conditionalBlur_ = function conditionalBlur_() {
  86617. if (this.previouslyActiveEl_) {
  86618. this.previouslyActiveEl_.focus();
  86619. this.previouslyActiveEl_ = null;
  86620. }
  86621. };
  86622. _proto.handleKeyDown = function handleKeyDown(event2) {
  86623. event2.stopPropagation();
  86624. if (keycode.isEventKey(event2, "Escape") && this.closeable()) {
  86625. event2.preventDefault();
  86626. this.close();
  86627. return;
  86628. }
  86629. if (!keycode.isEventKey(event2, "Tab")) {
  86630. return;
  86631. }
  86632. var focusableEls = this.focusableEls_();
  86633. var activeEl = this.el_.querySelector(":focus");
  86634. var focusIndex;
  86635. for (var i2 = 0; i2 < focusableEls.length; i2++) {
  86636. if (activeEl === focusableEls[i2]) {
  86637. focusIndex = i2;
  86638. break;
  86639. }
  86640. }
  86641. if (document_1.activeElement === this.el_) {
  86642. focusIndex = 0;
  86643. }
  86644. if (event2.shiftKey && focusIndex === 0) {
  86645. focusableEls[focusableEls.length - 1].focus();
  86646. event2.preventDefault();
  86647. } else if (!event2.shiftKey && focusIndex === focusableEls.length - 1) {
  86648. focusableEls[0].focus();
  86649. event2.preventDefault();
  86650. }
  86651. };
  86652. _proto.focusableEls_ = function focusableEls_() {
  86653. var allChildren = this.el_.querySelectorAll("*");
  86654. return Array.prototype.filter.call(allChildren, function(child) {
  86655. return (child instanceof window_1.HTMLAnchorElement || child instanceof window_1.HTMLAreaElement) && child.hasAttribute("href") || (child instanceof window_1.HTMLInputElement || child instanceof window_1.HTMLSelectElement || child instanceof window_1.HTMLTextAreaElement || child instanceof window_1.HTMLButtonElement) && !child.hasAttribute("disabled") || child instanceof window_1.HTMLIFrameElement || child instanceof window_1.HTMLObjectElement || child instanceof window_1.HTMLEmbedElement || child.hasAttribute("tabindex") && child.getAttribute("tabindex") !== -1 || child.hasAttribute("contenteditable");
  86656. });
  86657. };
  86658. return ModalDialog2;
  86659. }(Component$1);
  86660. ModalDialog.prototype.options_ = {
  86661. pauseOnOpen: true,
  86662. temporary: true
  86663. };
  86664. Component$1.registerComponent("ModalDialog", ModalDialog);
  86665. var TrackList = /* @__PURE__ */ function(_EventTarget) {
  86666. _inheritsLoose(TrackList2, _EventTarget);
  86667. function TrackList2(tracks) {
  86668. var _this;
  86669. if (tracks === void 0) {
  86670. tracks = [];
  86671. }
  86672. _this = _EventTarget.call(this) || this;
  86673. _this.tracks_ = [];
  86674. Object.defineProperty(_assertThisInitialized(_this), "length", {
  86675. get: function get7() {
  86676. return this.tracks_.length;
  86677. }
  86678. });
  86679. for (var i2 = 0; i2 < tracks.length; i2++) {
  86680. _this.addTrack(tracks[i2]);
  86681. }
  86682. return _this;
  86683. }
  86684. var _proto = TrackList2.prototype;
  86685. _proto.addTrack = function addTrack(track) {
  86686. var _this2 = this;
  86687. var index2 = this.tracks_.length;
  86688. if (!("" + index2 in this)) {
  86689. Object.defineProperty(this, index2, {
  86690. get: function get7() {
  86691. return this.tracks_[index2];
  86692. }
  86693. });
  86694. }
  86695. if (this.tracks_.indexOf(track) === -1) {
  86696. this.tracks_.push(track);
  86697. this.trigger({
  86698. track,
  86699. type: "addtrack",
  86700. target: this
  86701. });
  86702. }
  86703. track.labelchange_ = function() {
  86704. _this2.trigger({
  86705. track,
  86706. type: "labelchange",
  86707. target: _this2
  86708. });
  86709. };
  86710. if (isEvented(track)) {
  86711. track.addEventListener("labelchange", track.labelchange_);
  86712. }
  86713. };
  86714. _proto.removeTrack = function removeTrack(rtrack) {
  86715. var track;
  86716. for (var i2 = 0, l = this.length; i2 < l; i2++) {
  86717. if (this[i2] === rtrack) {
  86718. track = this[i2];
  86719. if (track.off) {
  86720. track.off();
  86721. }
  86722. this.tracks_.splice(i2, 1);
  86723. break;
  86724. }
  86725. }
  86726. if (!track) {
  86727. return;
  86728. }
  86729. this.trigger({
  86730. track,
  86731. type: "removetrack",
  86732. target: this
  86733. });
  86734. };
  86735. _proto.getTrackById = function getTrackById(id) {
  86736. var result = null;
  86737. for (var i2 = 0, l = this.length; i2 < l; i2++) {
  86738. var track = this[i2];
  86739. if (track.id === id) {
  86740. result = track;
  86741. break;
  86742. }
  86743. }
  86744. return result;
  86745. };
  86746. return TrackList2;
  86747. }(EventTarget$2);
  86748. TrackList.prototype.allowedEvents_ = {
  86749. change: "change",
  86750. addtrack: "addtrack",
  86751. removetrack: "removetrack",
  86752. labelchange: "labelchange"
  86753. };
  86754. for (var event$1 in TrackList.prototype.allowedEvents_) {
  86755. TrackList.prototype["on" + event$1] = null;
  86756. }
  86757. var disableOthers$1 = function disableOthers(list, track) {
  86758. for (var i2 = 0; i2 < list.length; i2++) {
  86759. if (!Object.keys(list[i2]).length || track.id === list[i2].id) {
  86760. continue;
  86761. }
  86762. list[i2].enabled = false;
  86763. }
  86764. };
  86765. var AudioTrackList = /* @__PURE__ */ function(_TrackList) {
  86766. _inheritsLoose(AudioTrackList2, _TrackList);
  86767. function AudioTrackList2(tracks) {
  86768. var _this;
  86769. if (tracks === void 0) {
  86770. tracks = [];
  86771. }
  86772. for (var i2 = tracks.length - 1; i2 >= 0; i2--) {
  86773. if (tracks[i2].enabled) {
  86774. disableOthers$1(tracks, tracks[i2]);
  86775. break;
  86776. }
  86777. }
  86778. _this = _TrackList.call(this, tracks) || this;
  86779. _this.changing_ = false;
  86780. return _this;
  86781. }
  86782. var _proto = AudioTrackList2.prototype;
  86783. _proto.addTrack = function addTrack(track) {
  86784. var _this2 = this;
  86785. if (track.enabled) {
  86786. disableOthers$1(this, track);
  86787. }
  86788. _TrackList.prototype.addTrack.call(this, track);
  86789. if (!track.addEventListener) {
  86790. return;
  86791. }
  86792. track.enabledChange_ = function() {
  86793. if (_this2.changing_) {
  86794. return;
  86795. }
  86796. _this2.changing_ = true;
  86797. disableOthers$1(_this2, track);
  86798. _this2.changing_ = false;
  86799. _this2.trigger("change");
  86800. };
  86801. track.addEventListener("enabledchange", track.enabledChange_);
  86802. };
  86803. _proto.removeTrack = function removeTrack(rtrack) {
  86804. _TrackList.prototype.removeTrack.call(this, rtrack);
  86805. if (rtrack.removeEventListener && rtrack.enabledChange_) {
  86806. rtrack.removeEventListener("enabledchange", rtrack.enabledChange_);
  86807. rtrack.enabledChange_ = null;
  86808. }
  86809. };
  86810. return AudioTrackList2;
  86811. }(TrackList);
  86812. var disableOthers2 = function disableOthers3(list, track) {
  86813. for (var i2 = 0; i2 < list.length; i2++) {
  86814. if (!Object.keys(list[i2]).length || track.id === list[i2].id) {
  86815. continue;
  86816. }
  86817. list[i2].selected = false;
  86818. }
  86819. };
  86820. var VideoTrackList = /* @__PURE__ */ function(_TrackList) {
  86821. _inheritsLoose(VideoTrackList2, _TrackList);
  86822. function VideoTrackList2(tracks) {
  86823. var _this;
  86824. if (tracks === void 0) {
  86825. tracks = [];
  86826. }
  86827. for (var i2 = tracks.length - 1; i2 >= 0; i2--) {
  86828. if (tracks[i2].selected) {
  86829. disableOthers2(tracks, tracks[i2]);
  86830. break;
  86831. }
  86832. }
  86833. _this = _TrackList.call(this, tracks) || this;
  86834. _this.changing_ = false;
  86835. Object.defineProperty(_assertThisInitialized(_this), "selectedIndex", {
  86836. get: function get7() {
  86837. for (var _i = 0; _i < this.length; _i++) {
  86838. if (this[_i].selected) {
  86839. return _i;
  86840. }
  86841. }
  86842. return -1;
  86843. },
  86844. set: function set4() {
  86845. }
  86846. });
  86847. return _this;
  86848. }
  86849. var _proto = VideoTrackList2.prototype;
  86850. _proto.addTrack = function addTrack(track) {
  86851. var _this2 = this;
  86852. if (track.selected) {
  86853. disableOthers2(this, track);
  86854. }
  86855. _TrackList.prototype.addTrack.call(this, track);
  86856. if (!track.addEventListener) {
  86857. return;
  86858. }
  86859. track.selectedChange_ = function() {
  86860. if (_this2.changing_) {
  86861. return;
  86862. }
  86863. _this2.changing_ = true;
  86864. disableOthers2(_this2, track);
  86865. _this2.changing_ = false;
  86866. _this2.trigger("change");
  86867. };
  86868. track.addEventListener("selectedchange", track.selectedChange_);
  86869. };
  86870. _proto.removeTrack = function removeTrack(rtrack) {
  86871. _TrackList.prototype.removeTrack.call(this, rtrack);
  86872. if (rtrack.removeEventListener && rtrack.selectedChange_) {
  86873. rtrack.removeEventListener("selectedchange", rtrack.selectedChange_);
  86874. rtrack.selectedChange_ = null;
  86875. }
  86876. };
  86877. return VideoTrackList2;
  86878. }(TrackList);
  86879. var TextTrackList = /* @__PURE__ */ function(_TrackList) {
  86880. _inheritsLoose(TextTrackList2, _TrackList);
  86881. function TextTrackList2() {
  86882. return _TrackList.apply(this, arguments) || this;
  86883. }
  86884. var _proto = TextTrackList2.prototype;
  86885. _proto.addTrack = function addTrack(track) {
  86886. var _this = this;
  86887. _TrackList.prototype.addTrack.call(this, track);
  86888. if (!this.queueChange_) {
  86889. this.queueChange_ = function() {
  86890. return _this.queueTrigger("change");
  86891. };
  86892. }
  86893. if (!this.triggerSelectedlanguagechange) {
  86894. this.triggerSelectedlanguagechange_ = function() {
  86895. return _this.trigger("selectedlanguagechange");
  86896. };
  86897. }
  86898. track.addEventListener("modechange", this.queueChange_);
  86899. var nonLanguageTextTrackKind = ["metadata", "chapters"];
  86900. if (nonLanguageTextTrackKind.indexOf(track.kind) === -1) {
  86901. track.addEventListener("modechange", this.triggerSelectedlanguagechange_);
  86902. }
  86903. };
  86904. _proto.removeTrack = function removeTrack(rtrack) {
  86905. _TrackList.prototype.removeTrack.call(this, rtrack);
  86906. if (rtrack.removeEventListener) {
  86907. if (this.queueChange_) {
  86908. rtrack.removeEventListener("modechange", this.queueChange_);
  86909. }
  86910. if (this.selectedlanguagechange_) {
  86911. rtrack.removeEventListener("modechange", this.triggerSelectedlanguagechange_);
  86912. }
  86913. }
  86914. };
  86915. return TextTrackList2;
  86916. }(TrackList);
  86917. var HtmlTrackElementList = /* @__PURE__ */ function() {
  86918. function HtmlTrackElementList2(trackElements) {
  86919. if (trackElements === void 0) {
  86920. trackElements = [];
  86921. }
  86922. this.trackElements_ = [];
  86923. Object.defineProperty(this, "length", {
  86924. get: function get7() {
  86925. return this.trackElements_.length;
  86926. }
  86927. });
  86928. for (var i2 = 0, length = trackElements.length; i2 < length; i2++) {
  86929. this.addTrackElement_(trackElements[i2]);
  86930. }
  86931. }
  86932. var _proto = HtmlTrackElementList2.prototype;
  86933. _proto.addTrackElement_ = function addTrackElement_(trackElement) {
  86934. var index2 = this.trackElements_.length;
  86935. if (!("" + index2 in this)) {
  86936. Object.defineProperty(this, index2, {
  86937. get: function get7() {
  86938. return this.trackElements_[index2];
  86939. }
  86940. });
  86941. }
  86942. if (this.trackElements_.indexOf(trackElement) === -1) {
  86943. this.trackElements_.push(trackElement);
  86944. }
  86945. };
  86946. _proto.getTrackElementByTrack_ = function getTrackElementByTrack_(track) {
  86947. var trackElement_;
  86948. for (var i2 = 0, length = this.trackElements_.length; i2 < length; i2++) {
  86949. if (track === this.trackElements_[i2].track) {
  86950. trackElement_ = this.trackElements_[i2];
  86951. break;
  86952. }
  86953. }
  86954. return trackElement_;
  86955. };
  86956. _proto.removeTrackElement_ = function removeTrackElement_(trackElement) {
  86957. for (var i2 = 0, length = this.trackElements_.length; i2 < length; i2++) {
  86958. if (trackElement === this.trackElements_[i2]) {
  86959. if (this.trackElements_[i2].track && typeof this.trackElements_[i2].track.off === "function") {
  86960. this.trackElements_[i2].track.off();
  86961. }
  86962. if (typeof this.trackElements_[i2].off === "function") {
  86963. this.trackElements_[i2].off();
  86964. }
  86965. this.trackElements_.splice(i2, 1);
  86966. break;
  86967. }
  86968. }
  86969. };
  86970. return HtmlTrackElementList2;
  86971. }();
  86972. var TextTrackCueList = /* @__PURE__ */ function() {
  86973. function TextTrackCueList2(cues) {
  86974. TextTrackCueList2.prototype.setCues_.call(this, cues);
  86975. Object.defineProperty(this, "length", {
  86976. get: function get7() {
  86977. return this.length_;
  86978. }
  86979. });
  86980. }
  86981. var _proto = TextTrackCueList2.prototype;
  86982. _proto.setCues_ = function setCues_(cues) {
  86983. var oldLength = this.length || 0;
  86984. var i2 = 0;
  86985. var l = cues.length;
  86986. this.cues_ = cues;
  86987. this.length_ = cues.length;
  86988. var defineProp = function defineProp2(index2) {
  86989. if (!("" + index2 in this)) {
  86990. Object.defineProperty(this, "" + index2, {
  86991. get: function get7() {
  86992. return this.cues_[index2];
  86993. }
  86994. });
  86995. }
  86996. };
  86997. if (oldLength < l) {
  86998. i2 = oldLength;
  86999. for (; i2 < l; i2++) {
  87000. defineProp.call(this, i2);
  87001. }
  87002. }
  87003. };
  87004. _proto.getCueById = function getCueById(id) {
  87005. var result = null;
  87006. for (var i2 = 0, l = this.length; i2 < l; i2++) {
  87007. var cue = this[i2];
  87008. if (cue.id === id) {
  87009. result = cue;
  87010. break;
  87011. }
  87012. }
  87013. return result;
  87014. };
  87015. return TextTrackCueList2;
  87016. }();
  87017. var VideoTrackKind = {
  87018. alternative: "alternative",
  87019. captions: "captions",
  87020. main: "main",
  87021. sign: "sign",
  87022. subtitles: "subtitles",
  87023. commentary: "commentary"
  87024. };
  87025. var AudioTrackKind = {
  87026. "alternative": "alternative",
  87027. "descriptions": "descriptions",
  87028. "main": "main",
  87029. "main-desc": "main-desc",
  87030. "translation": "translation",
  87031. "commentary": "commentary"
  87032. };
  87033. var TextTrackKind = {
  87034. subtitles: "subtitles",
  87035. captions: "captions",
  87036. descriptions: "descriptions",
  87037. chapters: "chapters",
  87038. metadata: "metadata"
  87039. };
  87040. var TextTrackMode = {
  87041. disabled: "disabled",
  87042. hidden: "hidden",
  87043. showing: "showing"
  87044. };
  87045. var Track = /* @__PURE__ */ function(_EventTarget) {
  87046. _inheritsLoose(Track2, _EventTarget);
  87047. function Track2(options2) {
  87048. var _this;
  87049. if (options2 === void 0) {
  87050. options2 = {};
  87051. }
  87052. _this = _EventTarget.call(this) || this;
  87053. var trackProps = {
  87054. id: options2.id || "vjs_track_" + newGUID(),
  87055. kind: options2.kind || "",
  87056. language: options2.language || ""
  87057. };
  87058. var label2 = options2.label || "";
  87059. var _loop = function _loop2(key2) {
  87060. Object.defineProperty(_assertThisInitialized(_this), key2, {
  87061. get: function get7() {
  87062. return trackProps[key2];
  87063. },
  87064. set: function set4() {
  87065. }
  87066. });
  87067. };
  87068. for (var key in trackProps) {
  87069. _loop(key);
  87070. }
  87071. Object.defineProperty(_assertThisInitialized(_this), "label", {
  87072. get: function get7() {
  87073. return label2;
  87074. },
  87075. set: function set4(newLabel) {
  87076. if (newLabel !== label2) {
  87077. label2 = newLabel;
  87078. this.trigger("labelchange");
  87079. }
  87080. }
  87081. });
  87082. return _this;
  87083. }
  87084. return Track2;
  87085. }(EventTarget$2);
  87086. var parseUrl = function parseUrl2(url) {
  87087. var props = ["protocol", "hostname", "port", "pathname", "search", "hash", "host"];
  87088. var a = document_1.createElement("a");
  87089. a.href = url;
  87090. var details = {};
  87091. for (var i2 = 0; i2 < props.length; i2++) {
  87092. details[props[i2]] = a[props[i2]];
  87093. }
  87094. if (details.protocol === "http:") {
  87095. details.host = details.host.replace(/:80$/, "");
  87096. }
  87097. if (details.protocol === "https:") {
  87098. details.host = details.host.replace(/:443$/, "");
  87099. }
  87100. if (!details.protocol) {
  87101. details.protocol = window_1.location.protocol;
  87102. }
  87103. if (!details.host) {
  87104. details.host = window_1.location.host;
  87105. }
  87106. return details;
  87107. };
  87108. var getAbsoluteURL = function getAbsoluteURL2(url) {
  87109. if (!url.match(/^https?:\/\//)) {
  87110. var a = document_1.createElement("a");
  87111. a.href = url;
  87112. url = a.href;
  87113. }
  87114. return url;
  87115. };
  87116. var getFileExtension = function getFileExtension2(path) {
  87117. if (typeof path === "string") {
  87118. var splitPathRe = /^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/;
  87119. var pathParts = splitPathRe.exec(path);
  87120. if (pathParts) {
  87121. return pathParts.pop().toLowerCase();
  87122. }
  87123. }
  87124. return "";
  87125. };
  87126. var isCrossOrigin = function isCrossOrigin2(url, winLoc) {
  87127. if (winLoc === void 0) {
  87128. winLoc = window_1.location;
  87129. }
  87130. var urlInfo = parseUrl(url);
  87131. var srcProtocol = urlInfo.protocol === ":" ? winLoc.protocol : urlInfo.protocol;
  87132. var crossOrigin = srcProtocol + urlInfo.host !== winLoc.protocol + winLoc.host;
  87133. return crossOrigin;
  87134. };
  87135. var Url$1 = /* @__PURE__ */ Object.freeze({
  87136. __proto__: null,
  87137. parseUrl,
  87138. getAbsoluteURL,
  87139. getFileExtension,
  87140. isCrossOrigin
  87141. });
  87142. var parseCues = function parseCues2(srcContent, track) {
  87143. var parser2 = new window_1.WebVTT.Parser(window_1, window_1.vttjs, window_1.WebVTT.StringDecoder());
  87144. var errors2 = [];
  87145. parser2.oncue = function(cue) {
  87146. track.addCue(cue);
  87147. };
  87148. parser2.onparsingerror = function(error) {
  87149. errors2.push(error);
  87150. };
  87151. parser2.onflush = function() {
  87152. track.trigger({
  87153. type: "loadeddata",
  87154. target: track
  87155. });
  87156. };
  87157. parser2.parse(srcContent);
  87158. if (errors2.length > 0) {
  87159. if (window_1.console && window_1.console.groupCollapsed) {
  87160. window_1.console.groupCollapsed("Text Track parsing errors for " + track.src);
  87161. }
  87162. errors2.forEach(function(error) {
  87163. return log$1.error(error);
  87164. });
  87165. if (window_1.console && window_1.console.groupEnd) {
  87166. window_1.console.groupEnd();
  87167. }
  87168. }
  87169. parser2.flush();
  87170. };
  87171. var loadTrack = function loadTrack2(src, track) {
  87172. var opts = {
  87173. uri: src
  87174. };
  87175. var crossOrigin = isCrossOrigin(src);
  87176. if (crossOrigin) {
  87177. opts.cors = crossOrigin;
  87178. }
  87179. var withCredentials = track.tech_.crossOrigin() === "use-credentials";
  87180. if (withCredentials) {
  87181. opts.withCredentials = withCredentials;
  87182. }
  87183. XHR(opts, bind(this, function(err, response, responseBody) {
  87184. if (err) {
  87185. return log$1.error(err, response);
  87186. }
  87187. track.loaded_ = true;
  87188. if (typeof window_1.WebVTT !== "function") {
  87189. if (track.tech_) {
  87190. track.tech_.any(["vttjsloaded", "vttjserror"], function(event2) {
  87191. if (event2.type === "vttjserror") {
  87192. log$1.error("vttjs failed to load, stopping trying to process " + track.src);
  87193. return;
  87194. }
  87195. return parseCues(responseBody, track);
  87196. });
  87197. }
  87198. } else {
  87199. parseCues(responseBody, track);
  87200. }
  87201. }));
  87202. };
  87203. var TextTrack = /* @__PURE__ */ function(_Track) {
  87204. _inheritsLoose(TextTrack2, _Track);
  87205. function TextTrack2(options2) {
  87206. var _this;
  87207. if (options2 === void 0) {
  87208. options2 = {};
  87209. }
  87210. if (!options2.tech) {
  87211. throw new Error("A tech was not provided.");
  87212. }
  87213. var settings = mergeOptions$3(options2, {
  87214. kind: TextTrackKind[options2.kind] || "subtitles",
  87215. language: options2.language || options2.srclang || ""
  87216. });
  87217. var mode = TextTrackMode[settings.mode] || "disabled";
  87218. var default_ = settings["default"];
  87219. if (settings.kind === "metadata" || settings.kind === "chapters") {
  87220. mode = "hidden";
  87221. }
  87222. _this = _Track.call(this, settings) || this;
  87223. _this.tech_ = settings.tech;
  87224. _this.cues_ = [];
  87225. _this.activeCues_ = [];
  87226. _this.preload_ = _this.tech_.preloadTextTracks !== false;
  87227. var cues = new TextTrackCueList(_this.cues_);
  87228. var activeCues = new TextTrackCueList(_this.activeCues_);
  87229. var changed = false;
  87230. _this.timeupdateHandler = bind(_assertThisInitialized(_this), function(event2) {
  87231. if (event2 === void 0) {
  87232. event2 = {};
  87233. }
  87234. if (this.tech_.isDisposed()) {
  87235. return;
  87236. }
  87237. if (!this.tech_.isReady_) {
  87238. if (event2.type !== "timeupdate") {
  87239. this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);
  87240. }
  87241. return;
  87242. }
  87243. this.activeCues = this.activeCues;
  87244. if (changed) {
  87245. this.trigger("cuechange");
  87246. changed = false;
  87247. }
  87248. if (event2.type !== "timeupdate") {
  87249. this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);
  87250. }
  87251. });
  87252. var disposeHandler = function disposeHandler2() {
  87253. _this.stopTracking();
  87254. };
  87255. _this.tech_.one("dispose", disposeHandler);
  87256. if (mode !== "disabled") {
  87257. _this.startTracking();
  87258. }
  87259. Object.defineProperties(_assertThisInitialized(_this), {
  87260. "default": {
  87261. get: function get7() {
  87262. return default_;
  87263. },
  87264. set: function set4() {
  87265. }
  87266. },
  87267. mode: {
  87268. get: function get7() {
  87269. return mode;
  87270. },
  87271. set: function set4(newMode) {
  87272. if (!TextTrackMode[newMode]) {
  87273. return;
  87274. }
  87275. if (mode === newMode) {
  87276. return;
  87277. }
  87278. mode = newMode;
  87279. if (!this.preload_ && mode !== "disabled" && this.cues.length === 0) {
  87280. loadTrack(this.src, this);
  87281. }
  87282. this.stopTracking();
  87283. if (mode !== "disabled") {
  87284. this.startTracking();
  87285. }
  87286. this.trigger("modechange");
  87287. }
  87288. },
  87289. cues: {
  87290. get: function get7() {
  87291. if (!this.loaded_) {
  87292. return null;
  87293. }
  87294. return cues;
  87295. },
  87296. set: function set4() {
  87297. }
  87298. },
  87299. activeCues: {
  87300. get: function get7() {
  87301. if (!this.loaded_) {
  87302. return null;
  87303. }
  87304. if (this.cues.length === 0) {
  87305. return activeCues;
  87306. }
  87307. var ct2 = this.tech_.currentTime();
  87308. var active = [];
  87309. for (var i2 = 0, l = this.cues.length; i2 < l; i2++) {
  87310. var cue = this.cues[i2];
  87311. if (cue.startTime <= ct2 && cue.endTime >= ct2) {
  87312. active.push(cue);
  87313. } else if (cue.startTime === cue.endTime && cue.startTime <= ct2 && cue.startTime + 0.5 >= ct2) {
  87314. active.push(cue);
  87315. }
  87316. }
  87317. changed = false;
  87318. if (active.length !== this.activeCues_.length) {
  87319. changed = true;
  87320. } else {
  87321. for (var _i = 0; _i < active.length; _i++) {
  87322. if (this.activeCues_.indexOf(active[_i]) === -1) {
  87323. changed = true;
  87324. }
  87325. }
  87326. }
  87327. this.activeCues_ = active;
  87328. activeCues.setCues_(this.activeCues_);
  87329. return activeCues;
  87330. },
  87331. set: function set4() {
  87332. }
  87333. }
  87334. });
  87335. if (settings.src) {
  87336. _this.src = settings.src;
  87337. if (!_this.preload_) {
  87338. _this.loaded_ = true;
  87339. }
  87340. if (_this.preload_ || settings.kind !== "subtitles" && settings.kind !== "captions") {
  87341. loadTrack(_this.src, _assertThisInitialized(_this));
  87342. }
  87343. } else {
  87344. _this.loaded_ = true;
  87345. }
  87346. return _this;
  87347. }
  87348. var _proto = TextTrack2.prototype;
  87349. _proto.startTracking = function startTracking() {
  87350. this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);
  87351. this.tech_.on("timeupdate", this.timeupdateHandler);
  87352. };
  87353. _proto.stopTracking = function stopTracking() {
  87354. if (this.rvf_) {
  87355. this.tech_.cancelVideoFrameCallback(this.rvf_);
  87356. this.rvf_ = void 0;
  87357. }
  87358. this.tech_.off("timeupdate", this.timeupdateHandler);
  87359. };
  87360. _proto.addCue = function addCue(originalCue) {
  87361. var cue = originalCue;
  87362. if (window_1.vttjs && !(originalCue instanceof window_1.vttjs.VTTCue)) {
  87363. cue = new window_1.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text);
  87364. for (var prop in originalCue) {
  87365. if (!(prop in cue)) {
  87366. cue[prop] = originalCue[prop];
  87367. }
  87368. }
  87369. cue.id = originalCue.id;
  87370. cue.originalCue_ = originalCue;
  87371. }
  87372. var tracks = this.tech_.textTracks();
  87373. for (var i2 = 0; i2 < tracks.length; i2++) {
  87374. if (tracks[i2] !== this) {
  87375. tracks[i2].removeCue(cue);
  87376. }
  87377. }
  87378. this.cues_.push(cue);
  87379. this.cues.setCues_(this.cues_);
  87380. };
  87381. _proto.removeCue = function removeCue(_removeCue) {
  87382. var i2 = this.cues_.length;
  87383. while (i2--) {
  87384. var cue = this.cues_[i2];
  87385. if (cue === _removeCue || cue.originalCue_ && cue.originalCue_ === _removeCue) {
  87386. this.cues_.splice(i2, 1);
  87387. this.cues.setCues_(this.cues_);
  87388. break;
  87389. }
  87390. }
  87391. };
  87392. return TextTrack2;
  87393. }(Track);
  87394. TextTrack.prototype.allowedEvents_ = {
  87395. cuechange: "cuechange"
  87396. };
  87397. var AudioTrack = /* @__PURE__ */ function(_Track) {
  87398. _inheritsLoose(AudioTrack2, _Track);
  87399. function AudioTrack2(options2) {
  87400. var _this;
  87401. if (options2 === void 0) {
  87402. options2 = {};
  87403. }
  87404. var settings = mergeOptions$3(options2, {
  87405. kind: AudioTrackKind[options2.kind] || ""
  87406. });
  87407. _this = _Track.call(this, settings) || this;
  87408. var enabled = false;
  87409. Object.defineProperty(_assertThisInitialized(_this), "enabled", {
  87410. get: function get7() {
  87411. return enabled;
  87412. },
  87413. set: function set4(newEnabled) {
  87414. if (typeof newEnabled !== "boolean" || newEnabled === enabled) {
  87415. return;
  87416. }
  87417. enabled = newEnabled;
  87418. this.trigger("enabledchange");
  87419. }
  87420. });
  87421. if (settings.enabled) {
  87422. _this.enabled = settings.enabled;
  87423. }
  87424. _this.loaded_ = true;
  87425. return _this;
  87426. }
  87427. return AudioTrack2;
  87428. }(Track);
  87429. var VideoTrack = /* @__PURE__ */ function(_Track) {
  87430. _inheritsLoose(VideoTrack2, _Track);
  87431. function VideoTrack2(options2) {
  87432. var _this;
  87433. if (options2 === void 0) {
  87434. options2 = {};
  87435. }
  87436. var settings = mergeOptions$3(options2, {
  87437. kind: VideoTrackKind[options2.kind] || ""
  87438. });
  87439. _this = _Track.call(this, settings) || this;
  87440. var selected = false;
  87441. Object.defineProperty(_assertThisInitialized(_this), "selected", {
  87442. get: function get7() {
  87443. return selected;
  87444. },
  87445. set: function set4(newSelected) {
  87446. if (typeof newSelected !== "boolean" || newSelected === selected) {
  87447. return;
  87448. }
  87449. selected = newSelected;
  87450. this.trigger("selectedchange");
  87451. }
  87452. });
  87453. if (settings.selected) {
  87454. _this.selected = settings.selected;
  87455. }
  87456. return _this;
  87457. }
  87458. return VideoTrack2;
  87459. }(Track);
  87460. var NONE = 0;
  87461. var LOADING = 1;
  87462. var LOADED = 2;
  87463. var ERROR = 3;
  87464. var HTMLTrackElement = /* @__PURE__ */ function(_EventTarget) {
  87465. _inheritsLoose(HTMLTrackElement2, _EventTarget);
  87466. function HTMLTrackElement2(options2) {
  87467. var _this;
  87468. if (options2 === void 0) {
  87469. options2 = {};
  87470. }
  87471. _this = _EventTarget.call(this) || this;
  87472. var readyState;
  87473. var track = new TextTrack(options2);
  87474. _this.kind = track.kind;
  87475. _this.src = track.src;
  87476. _this.srclang = track.language;
  87477. _this.label = track.label;
  87478. _this["default"] = track["default"];
  87479. Object.defineProperties(_assertThisInitialized(_this), {
  87480. readyState: {
  87481. get: function get7() {
  87482. return readyState;
  87483. }
  87484. },
  87485. track: {
  87486. get: function get7() {
  87487. return track;
  87488. }
  87489. }
  87490. });
  87491. readyState = NONE;
  87492. track.addEventListener("loadeddata", function() {
  87493. readyState = LOADED;
  87494. _this.trigger({
  87495. type: "load",
  87496. target: _assertThisInitialized(_this)
  87497. });
  87498. });
  87499. return _this;
  87500. }
  87501. return HTMLTrackElement2;
  87502. }(EventTarget$2);
  87503. HTMLTrackElement.prototype.allowedEvents_ = {
  87504. load: "load"
  87505. };
  87506. HTMLTrackElement.NONE = NONE;
  87507. HTMLTrackElement.LOADING = LOADING;
  87508. HTMLTrackElement.LOADED = LOADED;
  87509. HTMLTrackElement.ERROR = ERROR;
  87510. var NORMAL = {
  87511. audio: {
  87512. ListClass: AudioTrackList,
  87513. TrackClass: AudioTrack,
  87514. capitalName: "Audio"
  87515. },
  87516. video: {
  87517. ListClass: VideoTrackList,
  87518. TrackClass: VideoTrack,
  87519. capitalName: "Video"
  87520. },
  87521. text: {
  87522. ListClass: TextTrackList,
  87523. TrackClass: TextTrack,
  87524. capitalName: "Text"
  87525. }
  87526. };
  87527. Object.keys(NORMAL).forEach(function(type2) {
  87528. NORMAL[type2].getterName = type2 + "Tracks";
  87529. NORMAL[type2].privateName = type2 + "Tracks_";
  87530. });
  87531. var REMOTE = {
  87532. remoteText: {
  87533. ListClass: TextTrackList,
  87534. TrackClass: TextTrack,
  87535. capitalName: "RemoteText",
  87536. getterName: "remoteTextTracks",
  87537. privateName: "remoteTextTracks_"
  87538. },
  87539. remoteTextEl: {
  87540. ListClass: HtmlTrackElementList,
  87541. TrackClass: HTMLTrackElement,
  87542. capitalName: "RemoteTextTrackEls",
  87543. getterName: "remoteTextTrackEls",
  87544. privateName: "remoteTextTrackEls_"
  87545. }
  87546. };
  87547. var ALL = _extends$2({}, NORMAL, REMOTE);
  87548. REMOTE.names = Object.keys(REMOTE);
  87549. NORMAL.names = Object.keys(NORMAL);
  87550. ALL.names = [].concat(REMOTE.names).concat(NORMAL.names);
  87551. function createTrackHelper(self2, kind, label2, language, options2) {
  87552. if (options2 === void 0) {
  87553. options2 = {};
  87554. }
  87555. var tracks = self2.textTracks();
  87556. options2.kind = kind;
  87557. if (label2) {
  87558. options2.label = label2;
  87559. }
  87560. if (language) {
  87561. options2.language = language;
  87562. }
  87563. options2.tech = self2;
  87564. var track = new ALL.text.TrackClass(options2);
  87565. tracks.addTrack(track);
  87566. return track;
  87567. }
  87568. var Tech$1 = /* @__PURE__ */ function(_Component) {
  87569. _inheritsLoose(Tech2, _Component);
  87570. function Tech2(options2, ready) {
  87571. var _this;
  87572. if (options2 === void 0) {
  87573. options2 = {};
  87574. }
  87575. if (ready === void 0) {
  87576. ready = function ready2() {
  87577. };
  87578. }
  87579. options2.reportTouchActivity = false;
  87580. _this = _Component.call(this, null, options2, ready) || this;
  87581. _this.onDurationChange_ = function(e) {
  87582. return _this.onDurationChange(e);
  87583. };
  87584. _this.trackProgress_ = function(e) {
  87585. return _this.trackProgress(e);
  87586. };
  87587. _this.trackCurrentTime_ = function(e) {
  87588. return _this.trackCurrentTime(e);
  87589. };
  87590. _this.stopTrackingCurrentTime_ = function(e) {
  87591. return _this.stopTrackingCurrentTime(e);
  87592. };
  87593. _this.disposeSourceHandler_ = function(e) {
  87594. return _this.disposeSourceHandler(e);
  87595. };
  87596. _this.queuedHanders_ = /* @__PURE__ */ new Set();
  87597. _this.hasStarted_ = false;
  87598. _this.on("playing", function() {
  87599. this.hasStarted_ = true;
  87600. });
  87601. _this.on("loadstart", function() {
  87602. this.hasStarted_ = false;
  87603. });
  87604. ALL.names.forEach(function(name) {
  87605. var props = ALL[name];
  87606. if (options2 && options2[props.getterName]) {
  87607. _this[props.privateName] = options2[props.getterName];
  87608. }
  87609. });
  87610. if (!_this.featuresProgressEvents) {
  87611. _this.manualProgressOn();
  87612. }
  87613. if (!_this.featuresTimeupdateEvents) {
  87614. _this.manualTimeUpdatesOn();
  87615. }
  87616. ["Text", "Audio", "Video"].forEach(function(track) {
  87617. if (options2["native" + track + "Tracks"] === false) {
  87618. _this["featuresNative" + track + "Tracks"] = false;
  87619. }
  87620. });
  87621. if (options2.nativeCaptions === false || options2.nativeTextTracks === false) {
  87622. _this.featuresNativeTextTracks = false;
  87623. } else if (options2.nativeCaptions === true || options2.nativeTextTracks === true) {
  87624. _this.featuresNativeTextTracks = true;
  87625. }
  87626. if (!_this.featuresNativeTextTracks) {
  87627. _this.emulateTextTracks();
  87628. }
  87629. _this.preloadTextTracks = options2.preloadTextTracks !== false;
  87630. _this.autoRemoteTextTracks_ = new ALL.text.ListClass();
  87631. _this.initTrackListeners();
  87632. if (!options2.nativeControlsForTouch) {
  87633. _this.emitTapEvents();
  87634. }
  87635. if (_this.constructor) {
  87636. _this.name_ = _this.constructor.name || "Unknown Tech";
  87637. }
  87638. return _this;
  87639. }
  87640. var _proto = Tech2.prototype;
  87641. _proto.triggerSourceset = function triggerSourceset(src) {
  87642. var _this2 = this;
  87643. if (!this.isReady_) {
  87644. this.one("ready", function() {
  87645. return _this2.setTimeout(function() {
  87646. return _this2.triggerSourceset(src);
  87647. }, 1);
  87648. });
  87649. }
  87650. this.trigger({
  87651. src,
  87652. type: "sourceset"
  87653. });
  87654. };
  87655. _proto.manualProgressOn = function manualProgressOn() {
  87656. this.on("durationchange", this.onDurationChange_);
  87657. this.manualProgress = true;
  87658. this.one("ready", this.trackProgress_);
  87659. };
  87660. _proto.manualProgressOff = function manualProgressOff() {
  87661. this.manualProgress = false;
  87662. this.stopTrackingProgress();
  87663. this.off("durationchange", this.onDurationChange_);
  87664. };
  87665. _proto.trackProgress = function trackProgress(event2) {
  87666. this.stopTrackingProgress();
  87667. this.progressInterval = this.setInterval(bind(this, function() {
  87668. var numBufferedPercent = this.bufferedPercent();
  87669. if (this.bufferedPercent_ !== numBufferedPercent) {
  87670. this.trigger("progress");
  87671. }
  87672. this.bufferedPercent_ = numBufferedPercent;
  87673. if (numBufferedPercent === 1) {
  87674. this.stopTrackingProgress();
  87675. }
  87676. }), 500);
  87677. };
  87678. _proto.onDurationChange = function onDurationChange(event2) {
  87679. this.duration_ = this.duration();
  87680. };
  87681. _proto.buffered = function buffered() {
  87682. return createTimeRanges(0, 0);
  87683. };
  87684. _proto.bufferedPercent = function bufferedPercent$12() {
  87685. return bufferedPercent(this.buffered(), this.duration_);
  87686. };
  87687. _proto.stopTrackingProgress = function stopTrackingProgress() {
  87688. this.clearInterval(this.progressInterval);
  87689. };
  87690. _proto.manualTimeUpdatesOn = function manualTimeUpdatesOn() {
  87691. this.manualTimeUpdates = true;
  87692. this.on("play", this.trackCurrentTime_);
  87693. this.on("pause", this.stopTrackingCurrentTime_);
  87694. };
  87695. _proto.manualTimeUpdatesOff = function manualTimeUpdatesOff() {
  87696. this.manualTimeUpdates = false;
  87697. this.stopTrackingCurrentTime();
  87698. this.off("play", this.trackCurrentTime_);
  87699. this.off("pause", this.stopTrackingCurrentTime_);
  87700. };
  87701. _proto.trackCurrentTime = function trackCurrentTime() {
  87702. if (this.currentTimeInterval) {
  87703. this.stopTrackingCurrentTime();
  87704. }
  87705. this.currentTimeInterval = this.setInterval(function() {
  87706. this.trigger({
  87707. type: "timeupdate",
  87708. target: this,
  87709. manuallyTriggered: true
  87710. });
  87711. }, 250);
  87712. };
  87713. _proto.stopTrackingCurrentTime = function stopTrackingCurrentTime() {
  87714. this.clearInterval(this.currentTimeInterval);
  87715. this.trigger({
  87716. type: "timeupdate",
  87717. target: this,
  87718. manuallyTriggered: true
  87719. });
  87720. };
  87721. _proto.dispose = function dispose() {
  87722. this.clearTracks(NORMAL.names);
  87723. if (this.manualProgress) {
  87724. this.manualProgressOff();
  87725. }
  87726. if (this.manualTimeUpdates) {
  87727. this.manualTimeUpdatesOff();
  87728. }
  87729. _Component.prototype.dispose.call(this);
  87730. };
  87731. _proto.clearTracks = function clearTracks(types) {
  87732. var _this3 = this;
  87733. types = [].concat(types);
  87734. types.forEach(function(type2) {
  87735. var list = _this3[type2 + "Tracks"]() || [];
  87736. var i2 = list.length;
  87737. while (i2--) {
  87738. var track = list[i2];
  87739. if (type2 === "text") {
  87740. _this3.removeRemoteTextTrack(track);
  87741. }
  87742. list.removeTrack(track);
  87743. }
  87744. });
  87745. };
  87746. _proto.cleanupAutoTextTracks = function cleanupAutoTextTracks() {
  87747. var list = this.autoRemoteTextTracks_ || [];
  87748. var i2 = list.length;
  87749. while (i2--) {
  87750. var track = list[i2];
  87751. this.removeRemoteTextTrack(track);
  87752. }
  87753. };
  87754. _proto.reset = function reset3() {
  87755. };
  87756. _proto.crossOrigin = function crossOrigin() {
  87757. };
  87758. _proto.setCrossOrigin = function setCrossOrigin() {
  87759. };
  87760. _proto.error = function error(err) {
  87761. if (err !== void 0) {
  87762. this.error_ = new MediaError(err);
  87763. this.trigger("error");
  87764. }
  87765. return this.error_;
  87766. };
  87767. _proto.played = function played() {
  87768. if (this.hasStarted_) {
  87769. return createTimeRanges(0, 0);
  87770. }
  87771. return createTimeRanges();
  87772. };
  87773. _proto.play = function play() {
  87774. };
  87775. _proto.setScrubbing = function setScrubbing() {
  87776. };
  87777. _proto.scrubbing = function scrubbing() {
  87778. };
  87779. _proto.setCurrentTime = function setCurrentTime() {
  87780. if (this.manualTimeUpdates) {
  87781. this.trigger({
  87782. type: "timeupdate",
  87783. target: this,
  87784. manuallyTriggered: true
  87785. });
  87786. }
  87787. };
  87788. _proto.initTrackListeners = function initTrackListeners() {
  87789. var _this4 = this;
  87790. NORMAL.names.forEach(function(name) {
  87791. var props = NORMAL[name];
  87792. var trackListChanges = function trackListChanges2() {
  87793. _this4.trigger(name + "trackchange");
  87794. };
  87795. var tracks = _this4[props.getterName]();
  87796. tracks.addEventListener("removetrack", trackListChanges);
  87797. tracks.addEventListener("addtrack", trackListChanges);
  87798. _this4.on("dispose", function() {
  87799. tracks.removeEventListener("removetrack", trackListChanges);
  87800. tracks.removeEventListener("addtrack", trackListChanges);
  87801. });
  87802. });
  87803. };
  87804. _proto.addWebVttScript_ = function addWebVttScript_() {
  87805. var _this5 = this;
  87806. if (window_1.WebVTT) {
  87807. return;
  87808. }
  87809. if (document_1.body.contains(this.el())) {
  87810. if (!this.options_["vtt.js"] && isPlain(vtt) && Object.keys(vtt).length > 0) {
  87811. this.trigger("vttjsloaded");
  87812. return;
  87813. }
  87814. var script = document_1.createElement("script");
  87815. script.src = this.options_["vtt.js"] || "https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js";
  87816. script.onload = function() {
  87817. _this5.trigger("vttjsloaded");
  87818. };
  87819. script.onerror = function() {
  87820. _this5.trigger("vttjserror");
  87821. };
  87822. this.on("dispose", function() {
  87823. script.onload = null;
  87824. script.onerror = null;
  87825. });
  87826. window_1.WebVTT = true;
  87827. this.el().parentNode.appendChild(script);
  87828. } else {
  87829. this.ready(this.addWebVttScript_);
  87830. }
  87831. };
  87832. _proto.emulateTextTracks = function emulateTextTracks() {
  87833. var _this6 = this;
  87834. var tracks = this.textTracks();
  87835. var remoteTracks = this.remoteTextTracks();
  87836. var handleAddTrack = function handleAddTrack2(e) {
  87837. return tracks.addTrack(e.track);
  87838. };
  87839. var handleRemoveTrack = function handleRemoveTrack2(e) {
  87840. return tracks.removeTrack(e.track);
  87841. };
  87842. remoteTracks.on("addtrack", handleAddTrack);
  87843. remoteTracks.on("removetrack", handleRemoveTrack);
  87844. this.addWebVttScript_();
  87845. var updateDisplay = function updateDisplay2() {
  87846. return _this6.trigger("texttrackchange");
  87847. };
  87848. var textTracksChanges = function textTracksChanges2() {
  87849. updateDisplay();
  87850. for (var i2 = 0; i2 < tracks.length; i2++) {
  87851. var track = tracks[i2];
  87852. track.removeEventListener("cuechange", updateDisplay);
  87853. if (track.mode === "showing") {
  87854. track.addEventListener("cuechange", updateDisplay);
  87855. }
  87856. }
  87857. };
  87858. textTracksChanges();
  87859. tracks.addEventListener("change", textTracksChanges);
  87860. tracks.addEventListener("addtrack", textTracksChanges);
  87861. tracks.addEventListener("removetrack", textTracksChanges);
  87862. this.on("dispose", function() {
  87863. remoteTracks.off("addtrack", handleAddTrack);
  87864. remoteTracks.off("removetrack", handleRemoveTrack);
  87865. tracks.removeEventListener("change", textTracksChanges);
  87866. tracks.removeEventListener("addtrack", textTracksChanges);
  87867. tracks.removeEventListener("removetrack", textTracksChanges);
  87868. for (var i2 = 0; i2 < tracks.length; i2++) {
  87869. var track = tracks[i2];
  87870. track.removeEventListener("cuechange", updateDisplay);
  87871. }
  87872. });
  87873. };
  87874. _proto.addTextTrack = function addTextTrack(kind, label2, language) {
  87875. if (!kind) {
  87876. throw new Error("TextTrack kind is required but was not provided");
  87877. }
  87878. return createTrackHelper(this, kind, label2, language);
  87879. };
  87880. _proto.createRemoteTextTrack = function createRemoteTextTrack(options2) {
  87881. var track = mergeOptions$3(options2, {
  87882. tech: this
  87883. });
  87884. return new REMOTE.remoteTextEl.TrackClass(track);
  87885. };
  87886. _proto.addRemoteTextTrack = function addRemoteTextTrack(options2, manualCleanup) {
  87887. var _this7 = this;
  87888. if (options2 === void 0) {
  87889. options2 = {};
  87890. }
  87891. var htmlTrackElement = this.createRemoteTextTrack(options2);
  87892. if (manualCleanup !== true && manualCleanup !== false) {
  87893. log$1.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js');
  87894. manualCleanup = true;
  87895. }
  87896. this.remoteTextTrackEls().addTrackElement_(htmlTrackElement);
  87897. this.remoteTextTracks().addTrack(htmlTrackElement.track);
  87898. if (manualCleanup !== true) {
  87899. this.ready(function() {
  87900. return _this7.autoRemoteTextTracks_.addTrack(htmlTrackElement.track);
  87901. });
  87902. }
  87903. return htmlTrackElement;
  87904. };
  87905. _proto.removeRemoteTextTrack = function removeRemoteTextTrack(track) {
  87906. var trackElement = this.remoteTextTrackEls().getTrackElementByTrack_(track);
  87907. this.remoteTextTrackEls().removeTrackElement_(trackElement);
  87908. this.remoteTextTracks().removeTrack(track);
  87909. this.autoRemoteTextTracks_.removeTrack(track);
  87910. };
  87911. _proto.getVideoPlaybackQuality = function getVideoPlaybackQuality() {
  87912. return {};
  87913. };
  87914. _proto.requestPictureInPicture = function requestPictureInPicture() {
  87915. var PromiseClass = this.options_.Promise || window_1.Promise;
  87916. if (PromiseClass) {
  87917. return PromiseClass.reject();
  87918. }
  87919. };
  87920. _proto.disablePictureInPicture = function disablePictureInPicture() {
  87921. return true;
  87922. };
  87923. _proto.setDisablePictureInPicture = function setDisablePictureInPicture() {
  87924. };
  87925. _proto.requestVideoFrameCallback = function requestVideoFrameCallback(cb) {
  87926. var _this8 = this;
  87927. var id = newGUID();
  87928. if (!this.isReady_ || this.paused()) {
  87929. this.queuedHanders_.add(id);
  87930. this.one("playing", function() {
  87931. if (_this8.queuedHanders_.has(id)) {
  87932. _this8.queuedHanders_["delete"](id);
  87933. cb();
  87934. }
  87935. });
  87936. } else {
  87937. this.requestNamedAnimationFrame(id, cb);
  87938. }
  87939. return id;
  87940. };
  87941. _proto.cancelVideoFrameCallback = function cancelVideoFrameCallback(id) {
  87942. if (this.queuedHanders_.has(id)) {
  87943. this.queuedHanders_["delete"](id);
  87944. } else {
  87945. this.cancelNamedAnimationFrame(id);
  87946. }
  87947. };
  87948. _proto.setPoster = function setPoster() {
  87949. };
  87950. _proto.playsinline = function playsinline() {
  87951. };
  87952. _proto.setPlaysinline = function setPlaysinline() {
  87953. };
  87954. _proto.overrideNativeAudioTracks = function overrideNativeAudioTracks() {
  87955. };
  87956. _proto.overrideNativeVideoTracks = function overrideNativeVideoTracks() {
  87957. };
  87958. _proto.canPlayType = function canPlayType3() {
  87959. return "";
  87960. };
  87961. Tech2.canPlayType = function canPlayType3() {
  87962. return "";
  87963. };
  87964. Tech2.canPlaySource = function canPlaySource(srcObj, options2) {
  87965. return Tech2.canPlayType(srcObj.type);
  87966. };
  87967. Tech2.isTech = function isTech(component) {
  87968. return component.prototype instanceof Tech2 || component instanceof Tech2 || component === Tech2;
  87969. };
  87970. Tech2.registerTech = function registerTech(name, tech) {
  87971. if (!Tech2.techs_) {
  87972. Tech2.techs_ = {};
  87973. }
  87974. if (!Tech2.isTech(tech)) {
  87975. throw new Error("Tech " + name + " must be a Tech");
  87976. }
  87977. if (!Tech2.canPlayType) {
  87978. throw new Error("Techs must have a static canPlayType method on them");
  87979. }
  87980. if (!Tech2.canPlaySource) {
  87981. throw new Error("Techs must have a static canPlaySource method on them");
  87982. }
  87983. name = toTitleCase$1(name);
  87984. Tech2.techs_[name] = tech;
  87985. Tech2.techs_[toLowerCase(name)] = tech;
  87986. if (name !== "Tech") {
  87987. Tech2.defaultTechOrder_.push(name);
  87988. }
  87989. return tech;
  87990. };
  87991. Tech2.getTech = function getTech(name) {
  87992. if (!name) {
  87993. return;
  87994. }
  87995. if (Tech2.techs_ && Tech2.techs_[name]) {
  87996. return Tech2.techs_[name];
  87997. }
  87998. name = toTitleCase$1(name);
  87999. if (window_1 && window_1.videojs && window_1.videojs[name]) {
  88000. log$1.warn("The " + name + " tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)");
  88001. return window_1.videojs[name];
  88002. }
  88003. };
  88004. return Tech2;
  88005. }(Component$1);
  88006. ALL.names.forEach(function(name) {
  88007. var props = ALL[name];
  88008. Tech$1.prototype[props.getterName] = function() {
  88009. this[props.privateName] = this[props.privateName] || new props.ListClass();
  88010. return this[props.privateName];
  88011. };
  88012. });
  88013. Tech$1.prototype.featuresVolumeControl = true;
  88014. Tech$1.prototype.featuresMuteControl = true;
  88015. Tech$1.prototype.featuresFullscreenResize = false;
  88016. Tech$1.prototype.featuresPlaybackRate = false;
  88017. Tech$1.prototype.featuresProgressEvents = false;
  88018. Tech$1.prototype.featuresSourceset = false;
  88019. Tech$1.prototype.featuresTimeupdateEvents = false;
  88020. Tech$1.prototype.featuresNativeTextTracks = false;
  88021. Tech$1.prototype.featuresVideoFrameCallback = false;
  88022. Tech$1.withSourceHandlers = function(_Tech) {
  88023. _Tech.registerSourceHandler = function(handler, index2) {
  88024. var handlers = _Tech.sourceHandlers;
  88025. if (!handlers) {
  88026. handlers = _Tech.sourceHandlers = [];
  88027. }
  88028. if (index2 === void 0) {
  88029. index2 = handlers.length;
  88030. }
  88031. handlers.splice(index2, 0, handler);
  88032. };
  88033. _Tech.canPlayType = function(type2) {
  88034. var handlers = _Tech.sourceHandlers || [];
  88035. var can;
  88036. for (var i2 = 0; i2 < handlers.length; i2++) {
  88037. can = handlers[i2].canPlayType(type2);
  88038. if (can) {
  88039. return can;
  88040. }
  88041. }
  88042. return "";
  88043. };
  88044. _Tech.selectSourceHandler = function(source, options2) {
  88045. var handlers = _Tech.sourceHandlers || [];
  88046. var can;
  88047. for (var i2 = 0; i2 < handlers.length; i2++) {
  88048. can = handlers[i2].canHandleSource(source, options2);
  88049. if (can) {
  88050. return handlers[i2];
  88051. }
  88052. }
  88053. return null;
  88054. };
  88055. _Tech.canPlaySource = function(srcObj, options2) {
  88056. var sh = _Tech.selectSourceHandler(srcObj, options2);
  88057. if (sh) {
  88058. return sh.canHandleSource(srcObj, options2);
  88059. }
  88060. return "";
  88061. };
  88062. var deferrable = ["seekable", "seeking", "duration"];
  88063. deferrable.forEach(function(fnName) {
  88064. var originalFn = this[fnName];
  88065. if (typeof originalFn !== "function") {
  88066. return;
  88067. }
  88068. this[fnName] = function() {
  88069. if (this.sourceHandler_ && this.sourceHandler_[fnName]) {
  88070. return this.sourceHandler_[fnName].apply(this.sourceHandler_, arguments);
  88071. }
  88072. return originalFn.apply(this, arguments);
  88073. };
  88074. }, _Tech.prototype);
  88075. _Tech.prototype.setSource = function(source) {
  88076. var sh = _Tech.selectSourceHandler(source, this.options_);
  88077. if (!sh) {
  88078. if (_Tech.nativeSourceHandler) {
  88079. sh = _Tech.nativeSourceHandler;
  88080. } else {
  88081. log$1.error("No source handler found for the current source.");
  88082. }
  88083. }
  88084. this.disposeSourceHandler();
  88085. this.off("dispose", this.disposeSourceHandler_);
  88086. if (sh !== _Tech.nativeSourceHandler) {
  88087. this.currentSource_ = source;
  88088. }
  88089. this.sourceHandler_ = sh.handleSource(source, this, this.options_);
  88090. this.one("dispose", this.disposeSourceHandler_);
  88091. };
  88092. _Tech.prototype.disposeSourceHandler = function() {
  88093. if (this.currentSource_) {
  88094. this.clearTracks(["audio", "video"]);
  88095. this.currentSource_ = null;
  88096. }
  88097. this.cleanupAutoTextTracks();
  88098. if (this.sourceHandler_) {
  88099. if (this.sourceHandler_.dispose) {
  88100. this.sourceHandler_.dispose();
  88101. }
  88102. this.sourceHandler_ = null;
  88103. }
  88104. };
  88105. };
  88106. Component$1.registerComponent("Tech", Tech$1);
  88107. Tech$1.registerTech("Tech", Tech$1);
  88108. Tech$1.defaultTechOrder_ = [];
  88109. var middlewares = {};
  88110. var middlewareInstances = {};
  88111. var TERMINATOR = {};
  88112. function use(type2, middleware) {
  88113. middlewares[type2] = middlewares[type2] || [];
  88114. middlewares[type2].push(middleware);
  88115. }
  88116. function setSource(player, src, next) {
  88117. player.setTimeout(function() {
  88118. return setSourceHelper(src, middlewares[src.type], next, player);
  88119. }, 1);
  88120. }
  88121. function setTech(middleware, tech) {
  88122. middleware.forEach(function(mw) {
  88123. return mw.setTech && mw.setTech(tech);
  88124. });
  88125. }
  88126. function get(middleware, tech, method) {
  88127. return middleware.reduceRight(middlewareIterator(method), tech[method]());
  88128. }
  88129. function set(middleware, tech, method, arg) {
  88130. return tech[method](middleware.reduce(middlewareIterator(method), arg));
  88131. }
  88132. function mediate(middleware, tech, method, arg) {
  88133. if (arg === void 0) {
  88134. arg = null;
  88135. }
  88136. var callMethod = "call" + toTitleCase$1(method);
  88137. var middlewareValue = middleware.reduce(middlewareIterator(callMethod), arg);
  88138. var terminated = middlewareValue === TERMINATOR;
  88139. var returnValue = terminated ? null : tech[method](middlewareValue);
  88140. executeRight(middleware, method, returnValue, terminated);
  88141. return returnValue;
  88142. }
  88143. var allowedGetters = {
  88144. buffered: 1,
  88145. currentTime: 1,
  88146. duration: 1,
  88147. muted: 1,
  88148. played: 1,
  88149. paused: 1,
  88150. seekable: 1,
  88151. volume: 1,
  88152. ended: 1
  88153. };
  88154. var allowedSetters = {
  88155. setCurrentTime: 1,
  88156. setMuted: 1,
  88157. setVolume: 1
  88158. };
  88159. var allowedMediators = {
  88160. play: 1,
  88161. pause: 1
  88162. };
  88163. function middlewareIterator(method) {
  88164. return function(value, mw) {
  88165. if (value === TERMINATOR) {
  88166. return TERMINATOR;
  88167. }
  88168. if (mw[method]) {
  88169. return mw[method](value);
  88170. }
  88171. return value;
  88172. };
  88173. }
  88174. function executeRight(mws, method, value, terminated) {
  88175. for (var i2 = mws.length - 1; i2 >= 0; i2--) {
  88176. var mw = mws[i2];
  88177. if (mw[method]) {
  88178. mw[method](terminated, value);
  88179. }
  88180. }
  88181. }
  88182. function clearCacheForPlayer(player) {
  88183. middlewareInstances[player.id()] = null;
  88184. }
  88185. function getOrCreateFactory(player, mwFactory) {
  88186. var mws = middlewareInstances[player.id()];
  88187. var mw = null;
  88188. if (mws === void 0 || mws === null) {
  88189. mw = mwFactory(player);
  88190. middlewareInstances[player.id()] = [[mwFactory, mw]];
  88191. return mw;
  88192. }
  88193. for (var i2 = 0; i2 < mws.length; i2++) {
  88194. var _mws$i = mws[i2], mwf = _mws$i[0], mwi = _mws$i[1];
  88195. if (mwf !== mwFactory) {
  88196. continue;
  88197. }
  88198. mw = mwi;
  88199. }
  88200. if (mw === null) {
  88201. mw = mwFactory(player);
  88202. mws.push([mwFactory, mw]);
  88203. }
  88204. return mw;
  88205. }
  88206. function setSourceHelper(src, middleware, next, player, acc, lastRun) {
  88207. if (src === void 0) {
  88208. src = {};
  88209. }
  88210. if (middleware === void 0) {
  88211. middleware = [];
  88212. }
  88213. if (acc === void 0) {
  88214. acc = [];
  88215. }
  88216. if (lastRun === void 0) {
  88217. lastRun = false;
  88218. }
  88219. var _middleware = middleware, mwFactory = _middleware[0], mwrest = _middleware.slice(1);
  88220. if (typeof mwFactory === "string") {
  88221. setSourceHelper(src, middlewares[mwFactory], next, player, acc, lastRun);
  88222. } else if (mwFactory) {
  88223. var mw = getOrCreateFactory(player, mwFactory);
  88224. if (!mw.setSource) {
  88225. acc.push(mw);
  88226. return setSourceHelper(src, mwrest, next, player, acc, lastRun);
  88227. }
  88228. mw.setSource(assign({}, src), function(err, _src) {
  88229. if (err) {
  88230. return setSourceHelper(src, mwrest, next, player, acc, lastRun);
  88231. }
  88232. acc.push(mw);
  88233. setSourceHelper(_src, src.type === _src.type ? mwrest : middlewares[_src.type], next, player, acc, lastRun);
  88234. });
  88235. } else if (mwrest.length) {
  88236. setSourceHelper(src, mwrest, next, player, acc, lastRun);
  88237. } else if (lastRun) {
  88238. next(src, acc);
  88239. } else {
  88240. setSourceHelper(src, middlewares["*"], next, player, acc, true);
  88241. }
  88242. }
  88243. var MimetypesKind = {
  88244. opus: "video/ogg",
  88245. ogv: "video/ogg",
  88246. mp4: "video/mp4",
  88247. mov: "video/mp4",
  88248. m4v: "video/mp4",
  88249. mkv: "video/x-matroska",
  88250. m4a: "audio/mp4",
  88251. mp3: "audio/mpeg",
  88252. aac: "audio/aac",
  88253. caf: "audio/x-caf",
  88254. flac: "audio/flac",
  88255. oga: "audio/ogg",
  88256. wav: "audio/wav",
  88257. m3u8: "application/x-mpegURL",
  88258. mpd: "application/dash+xml",
  88259. jpg: "image/jpeg",
  88260. jpeg: "image/jpeg",
  88261. gif: "image/gif",
  88262. png: "image/png",
  88263. svg: "image/svg+xml",
  88264. webp: "image/webp"
  88265. };
  88266. var getMimetype = function getMimetype2(src) {
  88267. if (src === void 0) {
  88268. src = "";
  88269. }
  88270. var ext = getFileExtension(src);
  88271. var mimetype = MimetypesKind[ext.toLowerCase()];
  88272. return mimetype || "";
  88273. };
  88274. var findMimetype = function findMimetype2(player, src) {
  88275. if (!src) {
  88276. return "";
  88277. }
  88278. if (player.cache_.source.src === src && player.cache_.source.type) {
  88279. return player.cache_.source.type;
  88280. }
  88281. var matchingSources = player.cache_.sources.filter(function(s2) {
  88282. return s2.src === src;
  88283. });
  88284. if (matchingSources.length) {
  88285. return matchingSources[0].type;
  88286. }
  88287. var sources = player.$$("source");
  88288. for (var i2 = 0; i2 < sources.length; i2++) {
  88289. var s = sources[i2];
  88290. if (s.type && s.src && s.src === src) {
  88291. return s.type;
  88292. }
  88293. }
  88294. return getMimetype(src);
  88295. };
  88296. var filterSource = function filterSource2(src) {
  88297. if (Array.isArray(src)) {
  88298. var newsrc = [];
  88299. src.forEach(function(srcobj) {
  88300. srcobj = filterSource2(srcobj);
  88301. if (Array.isArray(srcobj)) {
  88302. newsrc = newsrc.concat(srcobj);
  88303. } else if (isObject2(srcobj)) {
  88304. newsrc.push(srcobj);
  88305. }
  88306. });
  88307. src = newsrc;
  88308. } else if (typeof src === "string" && src.trim()) {
  88309. src = [fixSource({
  88310. src
  88311. })];
  88312. } else if (isObject2(src) && typeof src.src === "string" && src.src && src.src.trim()) {
  88313. src = [fixSource(src)];
  88314. } else {
  88315. src = [];
  88316. }
  88317. return src;
  88318. };
  88319. function fixSource(src) {
  88320. if (!src.type) {
  88321. var mimetype = getMimetype(src.src);
  88322. if (mimetype) {
  88323. src.type = mimetype;
  88324. }
  88325. }
  88326. return src;
  88327. }
  88328. var MediaLoader = /* @__PURE__ */ function(_Component) {
  88329. _inheritsLoose(MediaLoader2, _Component);
  88330. function MediaLoader2(player, options2, ready) {
  88331. var _this;
  88332. var options_ = mergeOptions$3({
  88333. createEl: false
  88334. }, options2);
  88335. _this = _Component.call(this, player, options_, ready) || this;
  88336. if (!options2.playerOptions.sources || options2.playerOptions.sources.length === 0) {
  88337. for (var i2 = 0, j = options2.playerOptions.techOrder; i2 < j.length; i2++) {
  88338. var techName = toTitleCase$1(j[i2]);
  88339. var tech = Tech$1.getTech(techName);
  88340. if (!techName) {
  88341. tech = Component$1.getComponent(techName);
  88342. }
  88343. if (tech && tech.isSupported()) {
  88344. player.loadTech_(techName);
  88345. break;
  88346. }
  88347. }
  88348. } else {
  88349. player.src(options2.playerOptions.sources);
  88350. }
  88351. return _this;
  88352. }
  88353. return MediaLoader2;
  88354. }(Component$1);
  88355. Component$1.registerComponent("MediaLoader", MediaLoader);
  88356. var ClickableComponent = /* @__PURE__ */ function(_Component) {
  88357. _inheritsLoose(ClickableComponent2, _Component);
  88358. function ClickableComponent2(player, options2) {
  88359. var _this;
  88360. _this = _Component.call(this, player, options2) || this;
  88361. if (_this.options_.controlText) {
  88362. _this.controlText(_this.options_.controlText);
  88363. }
  88364. _this.handleMouseOver_ = function(e) {
  88365. return _this.handleMouseOver(e);
  88366. };
  88367. _this.handleMouseOut_ = function(e) {
  88368. return _this.handleMouseOut(e);
  88369. };
  88370. _this.handleClick_ = function(e) {
  88371. return _this.handleClick(e);
  88372. };
  88373. _this.handleKeyDown_ = function(e) {
  88374. return _this.handleKeyDown(e);
  88375. };
  88376. _this.emitTapEvents();
  88377. _this.enable();
  88378. return _this;
  88379. }
  88380. var _proto = ClickableComponent2.prototype;
  88381. _proto.createEl = function createEl$12(tag, props, attributes) {
  88382. if (tag === void 0) {
  88383. tag = "div";
  88384. }
  88385. if (props === void 0) {
  88386. props = {};
  88387. }
  88388. if (attributes === void 0) {
  88389. attributes = {};
  88390. }
  88391. props = assign({
  88392. className: this.buildCSSClass(),
  88393. tabIndex: 0
  88394. }, props);
  88395. if (tag === "button") {
  88396. log$1.error("Creating a ClickableComponent with an HTML element of " + tag + " is not supported; use a Button instead.");
  88397. }
  88398. attributes = assign({
  88399. role: "button"
  88400. }, attributes);
  88401. this.tabIndex_ = props.tabIndex;
  88402. var el = createEl(tag, props, attributes);
  88403. el.appendChild(createEl("span", {
  88404. className: "vjs-icon-placeholder"
  88405. }, {
  88406. "aria-hidden": true
  88407. }));
  88408. this.createControlTextEl(el);
  88409. return el;
  88410. };
  88411. _proto.dispose = function dispose() {
  88412. this.controlTextEl_ = null;
  88413. _Component.prototype.dispose.call(this);
  88414. };
  88415. _proto.createControlTextEl = function createControlTextEl(el) {
  88416. this.controlTextEl_ = createEl("span", {
  88417. className: "vjs-control-text"
  88418. }, {
  88419. "aria-live": "polite"
  88420. });
  88421. if (el) {
  88422. el.appendChild(this.controlTextEl_);
  88423. }
  88424. this.controlText(this.controlText_, el);
  88425. return this.controlTextEl_;
  88426. };
  88427. _proto.controlText = function controlText(text, el) {
  88428. if (el === void 0) {
  88429. el = this.el();
  88430. }
  88431. if (text === void 0) {
  88432. return this.controlText_ || "Need Text";
  88433. }
  88434. var localizedText = this.localize(text);
  88435. this.controlText_ = text;
  88436. textContent(this.controlTextEl_, localizedText);
  88437. if (!this.nonIconControl && !this.player_.options_.noUITitleAttributes) {
  88438. el.setAttribute("title", localizedText);
  88439. }
  88440. };
  88441. _proto.buildCSSClass = function buildCSSClass() {
  88442. return "vjs-control vjs-button " + _Component.prototype.buildCSSClass.call(this);
  88443. };
  88444. _proto.enable = function enable() {
  88445. if (!this.enabled_) {
  88446. this.enabled_ = true;
  88447. this.removeClass("vjs-disabled");
  88448. this.el_.setAttribute("aria-disabled", "false");
  88449. if (typeof this.tabIndex_ !== "undefined") {
  88450. this.el_.setAttribute("tabIndex", this.tabIndex_);
  88451. }
  88452. this.on(["tap", "click"], this.handleClick_);
  88453. this.on("keydown", this.handleKeyDown_);
  88454. }
  88455. };
  88456. _proto.disable = function disable() {
  88457. this.enabled_ = false;
  88458. this.addClass("vjs-disabled");
  88459. this.el_.setAttribute("aria-disabled", "true");
  88460. if (typeof this.tabIndex_ !== "undefined") {
  88461. this.el_.removeAttribute("tabIndex");
  88462. }
  88463. this.off("mouseover", this.handleMouseOver_);
  88464. this.off("mouseout", this.handleMouseOut_);
  88465. this.off(["tap", "click"], this.handleClick_);
  88466. this.off("keydown", this.handleKeyDown_);
  88467. };
  88468. _proto.handleLanguagechange = function handleLanguagechange() {
  88469. this.controlText(this.controlText_);
  88470. };
  88471. _proto.handleClick = function handleClick(event2) {
  88472. if (this.options_.clickHandler) {
  88473. this.options_.clickHandler.call(this, arguments);
  88474. }
  88475. };
  88476. _proto.handleKeyDown = function handleKeyDown(event2) {
  88477. if (keycode.isEventKey(event2, "Space") || keycode.isEventKey(event2, "Enter")) {
  88478. event2.preventDefault();
  88479. event2.stopPropagation();
  88480. this.trigger("click");
  88481. } else {
  88482. _Component.prototype.handleKeyDown.call(this, event2);
  88483. }
  88484. };
  88485. return ClickableComponent2;
  88486. }(Component$1);
  88487. Component$1.registerComponent("ClickableComponent", ClickableComponent);
  88488. var PosterImage = /* @__PURE__ */ function(_ClickableComponent) {
  88489. _inheritsLoose(PosterImage2, _ClickableComponent);
  88490. function PosterImage2(player, options2) {
  88491. var _this;
  88492. _this = _ClickableComponent.call(this, player, options2) || this;
  88493. _this.update();
  88494. _this.update_ = function(e) {
  88495. return _this.update(e);
  88496. };
  88497. player.on("posterchange", _this.update_);
  88498. return _this;
  88499. }
  88500. var _proto = PosterImage2.prototype;
  88501. _proto.dispose = function dispose() {
  88502. this.player().off("posterchange", this.update_);
  88503. _ClickableComponent.prototype.dispose.call(this);
  88504. };
  88505. _proto.createEl = function createEl$12() {
  88506. var el = createEl("div", {
  88507. className: "vjs-poster",
  88508. tabIndex: -1
  88509. });
  88510. return el;
  88511. };
  88512. _proto.update = function update(event2) {
  88513. var url = this.player().poster();
  88514. this.setSrc(url);
  88515. if (url) {
  88516. this.show();
  88517. } else {
  88518. this.hide();
  88519. }
  88520. };
  88521. _proto.setSrc = function setSrc(url) {
  88522. var backgroundImage = "";
  88523. if (url) {
  88524. backgroundImage = 'url("' + url + '")';
  88525. }
  88526. this.el_.style.backgroundImage = backgroundImage;
  88527. };
  88528. _proto.handleClick = function handleClick(event2) {
  88529. if (!this.player_.controls()) {
  88530. return;
  88531. }
  88532. var sourceIsEncrypted = this.player_.usingPlugin("eme") && this.player_.eme.sessions && this.player_.eme.sessions.length > 0;
  88533. if (this.player_.tech(true) && !((IE_VERSION || IS_EDGE) && sourceIsEncrypted)) {
  88534. this.player_.tech(true).focus();
  88535. }
  88536. if (this.player_.paused()) {
  88537. silencePromise(this.player_.play());
  88538. } else {
  88539. this.player_.pause();
  88540. }
  88541. };
  88542. return PosterImage2;
  88543. }(ClickableComponent);
  88544. Component$1.registerComponent("PosterImage", PosterImage);
  88545. var darkGray = "#222";
  88546. var lightGray = "#ccc";
  88547. var fontMap = {
  88548. monospace: "monospace",
  88549. sansSerif: "sans-serif",
  88550. serif: "serif",
  88551. monospaceSansSerif: '"Andale Mono", "Lucida Console", monospace',
  88552. monospaceSerif: '"Courier New", monospace',
  88553. proportionalSansSerif: "sans-serif",
  88554. proportionalSerif: "serif",
  88555. casual: '"Comic Sans MS", Impact, fantasy',
  88556. script: '"Monotype Corsiva", cursive',
  88557. smallcaps: '"Andale Mono", "Lucida Console", monospace, sans-serif'
  88558. };
  88559. function constructColor(color2, opacity) {
  88560. var hex;
  88561. if (color2.length === 4) {
  88562. hex = color2[1] + color2[1] + color2[2] + color2[2] + color2[3] + color2[3];
  88563. } else if (color2.length === 7) {
  88564. hex = color2.slice(1);
  88565. } else {
  88566. throw new Error("Invalid color code provided, " + color2 + "; must be formatted as e.g. #f0e or #f604e2.");
  88567. }
  88568. return "rgba(" + parseInt(hex.slice(0, 2), 16) + "," + parseInt(hex.slice(2, 4), 16) + "," + parseInt(hex.slice(4, 6), 16) + "," + opacity + ")";
  88569. }
  88570. function tryUpdateStyle(el, style, rule) {
  88571. try {
  88572. el.style[style] = rule;
  88573. } catch (e) {
  88574. return;
  88575. }
  88576. }
  88577. var TextTrackDisplay = /* @__PURE__ */ function(_Component) {
  88578. _inheritsLoose(TextTrackDisplay2, _Component);
  88579. function TextTrackDisplay2(player, options2, ready) {
  88580. var _this;
  88581. _this = _Component.call(this, player, options2, ready) || this;
  88582. var updateDisplayHandler = function updateDisplayHandler2(e) {
  88583. return _this.updateDisplay(e);
  88584. };
  88585. player.on("loadstart", function(e) {
  88586. return _this.toggleDisplay(e);
  88587. });
  88588. player.on("texttrackchange", updateDisplayHandler);
  88589. player.on("loadedmetadata", function(e) {
  88590. return _this.preselectTrack(e);
  88591. });
  88592. player.ready(bind(_assertThisInitialized(_this), function() {
  88593. if (player.tech_ && player.tech_.featuresNativeTextTracks) {
  88594. this.hide();
  88595. return;
  88596. }
  88597. player.on("fullscreenchange", updateDisplayHandler);
  88598. player.on("playerresize", updateDisplayHandler);
  88599. window_1.addEventListener("orientationchange", updateDisplayHandler);
  88600. player.on("dispose", function() {
  88601. return window_1.removeEventListener("orientationchange", updateDisplayHandler);
  88602. });
  88603. var tracks = this.options_.playerOptions.tracks || [];
  88604. for (var i2 = 0; i2 < tracks.length; i2++) {
  88605. this.player_.addRemoteTextTrack(tracks[i2], true);
  88606. }
  88607. this.preselectTrack();
  88608. }));
  88609. return _this;
  88610. }
  88611. var _proto = TextTrackDisplay2.prototype;
  88612. _proto.preselectTrack = function preselectTrack() {
  88613. var modes = {
  88614. captions: 1,
  88615. subtitles: 1
  88616. };
  88617. var trackList = this.player_.textTracks();
  88618. var userPref = this.player_.cache_.selectedLanguage;
  88619. var firstDesc;
  88620. var firstCaptions;
  88621. var preferredTrack;
  88622. for (var i2 = 0; i2 < trackList.length; i2++) {
  88623. var track = trackList[i2];
  88624. if (userPref && userPref.enabled && userPref.language && userPref.language === track.language && track.kind in modes) {
  88625. if (track.kind === userPref.kind) {
  88626. preferredTrack = track;
  88627. } else if (!preferredTrack) {
  88628. preferredTrack = track;
  88629. }
  88630. } else if (userPref && !userPref.enabled) {
  88631. preferredTrack = null;
  88632. firstDesc = null;
  88633. firstCaptions = null;
  88634. } else if (track["default"]) {
  88635. if (track.kind === "descriptions" && !firstDesc) {
  88636. firstDesc = track;
  88637. } else if (track.kind in modes && !firstCaptions) {
  88638. firstCaptions = track;
  88639. }
  88640. }
  88641. }
  88642. if (preferredTrack) {
  88643. preferredTrack.mode = "showing";
  88644. } else if (firstCaptions) {
  88645. firstCaptions.mode = "showing";
  88646. } else if (firstDesc) {
  88647. firstDesc.mode = "showing";
  88648. }
  88649. };
  88650. _proto.toggleDisplay = function toggleDisplay() {
  88651. if (this.player_.tech_ && this.player_.tech_.featuresNativeTextTracks) {
  88652. this.hide();
  88653. } else {
  88654. this.show();
  88655. }
  88656. };
  88657. _proto.createEl = function createEl2() {
  88658. return _Component.prototype.createEl.call(this, "div", {
  88659. className: "vjs-text-track-display"
  88660. }, {
  88661. "translate": "yes",
  88662. "aria-live": "off",
  88663. "aria-atomic": "true"
  88664. });
  88665. };
  88666. _proto.clearDisplay = function clearDisplay() {
  88667. if (typeof window_1.WebVTT === "function") {
  88668. window_1.WebVTT.processCues(window_1, [], this.el_);
  88669. }
  88670. };
  88671. _proto.updateDisplay = function updateDisplay() {
  88672. var tracks = this.player_.textTracks();
  88673. var allowMultipleShowingTracks = this.options_.allowMultipleShowingTracks;
  88674. this.clearDisplay();
  88675. if (allowMultipleShowingTracks) {
  88676. var showingTracks = [];
  88677. for (var _i = 0; _i < tracks.length; ++_i) {
  88678. var track = tracks[_i];
  88679. if (track.mode !== "showing") {
  88680. continue;
  88681. }
  88682. showingTracks.push(track);
  88683. }
  88684. this.updateForTrack(showingTracks);
  88685. return;
  88686. }
  88687. var descriptionsTrack = null;
  88688. var captionsSubtitlesTrack = null;
  88689. var i2 = tracks.length;
  88690. while (i2--) {
  88691. var _track = tracks[i2];
  88692. if (_track.mode === "showing") {
  88693. if (_track.kind === "descriptions") {
  88694. descriptionsTrack = _track;
  88695. } else {
  88696. captionsSubtitlesTrack = _track;
  88697. }
  88698. }
  88699. }
  88700. if (captionsSubtitlesTrack) {
  88701. if (this.getAttribute("aria-live") !== "off") {
  88702. this.setAttribute("aria-live", "off");
  88703. }
  88704. this.updateForTrack(captionsSubtitlesTrack);
  88705. } else if (descriptionsTrack) {
  88706. if (this.getAttribute("aria-live") !== "assertive") {
  88707. this.setAttribute("aria-live", "assertive");
  88708. }
  88709. this.updateForTrack(descriptionsTrack);
  88710. }
  88711. };
  88712. _proto.updateDisplayState = function updateDisplayState(track) {
  88713. var overrides = this.player_.textTrackSettings.getValues();
  88714. var cues = track.activeCues;
  88715. var i2 = cues.length;
  88716. while (i2--) {
  88717. var cue = cues[i2];
  88718. if (!cue) {
  88719. continue;
  88720. }
  88721. var cueDiv = cue.displayState;
  88722. if (overrides.color) {
  88723. cueDiv.firstChild.style.color = overrides.color;
  88724. }
  88725. if (overrides.textOpacity) {
  88726. tryUpdateStyle(cueDiv.firstChild, "color", constructColor(overrides.color || "#fff", overrides.textOpacity));
  88727. }
  88728. if (overrides.backgroundColor) {
  88729. cueDiv.firstChild.style.backgroundColor = overrides.backgroundColor;
  88730. }
  88731. if (overrides.backgroundOpacity) {
  88732. tryUpdateStyle(cueDiv.firstChild, "backgroundColor", constructColor(overrides.backgroundColor || "#000", overrides.backgroundOpacity));
  88733. }
  88734. if (overrides.windowColor) {
  88735. if (overrides.windowOpacity) {
  88736. tryUpdateStyle(cueDiv, "backgroundColor", constructColor(overrides.windowColor, overrides.windowOpacity));
  88737. } else {
  88738. cueDiv.style.backgroundColor = overrides.windowColor;
  88739. }
  88740. }
  88741. if (overrides.edgeStyle) {
  88742. if (overrides.edgeStyle === "dropshadow") {
  88743. cueDiv.firstChild.style.textShadow = "2px 2px 3px " + darkGray + ", 2px 2px 4px " + darkGray + ", 2px 2px 5px " + darkGray;
  88744. } else if (overrides.edgeStyle === "raised") {
  88745. cueDiv.firstChild.style.textShadow = "1px 1px " + darkGray + ", 2px 2px " + darkGray + ", 3px 3px " + darkGray;
  88746. } else if (overrides.edgeStyle === "depressed") {
  88747. cueDiv.firstChild.style.textShadow = "1px 1px " + lightGray + ", 0 1px " + lightGray + ", -1px -1px " + darkGray + ", 0 -1px " + darkGray;
  88748. } else if (overrides.edgeStyle === "uniform") {
  88749. cueDiv.firstChild.style.textShadow = "0 0 4px " + darkGray + ", 0 0 4px " + darkGray + ", 0 0 4px " + darkGray + ", 0 0 4px " + darkGray;
  88750. }
  88751. }
  88752. if (overrides.fontPercent && overrides.fontPercent !== 1) {
  88753. var fontSize = window_1.parseFloat(cueDiv.style.fontSize);
  88754. cueDiv.style.fontSize = fontSize * overrides.fontPercent + "px";
  88755. cueDiv.style.height = "auto";
  88756. cueDiv.style.top = "auto";
  88757. }
  88758. if (overrides.fontFamily && overrides.fontFamily !== "default") {
  88759. if (overrides.fontFamily === "small-caps") {
  88760. cueDiv.firstChild.style.fontVariant = "small-caps";
  88761. } else {
  88762. cueDiv.firstChild.style.fontFamily = fontMap[overrides.fontFamily];
  88763. }
  88764. }
  88765. }
  88766. };
  88767. _proto.updateForTrack = function updateForTrack(tracks) {
  88768. if (!Array.isArray(tracks)) {
  88769. tracks = [tracks];
  88770. }
  88771. if (typeof window_1.WebVTT !== "function" || tracks.every(function(track2) {
  88772. return !track2.activeCues;
  88773. })) {
  88774. return;
  88775. }
  88776. var cues = [];
  88777. for (var i2 = 0; i2 < tracks.length; ++i2) {
  88778. var track = tracks[i2];
  88779. for (var j = 0; j < track.activeCues.length; ++j) {
  88780. cues.push(track.activeCues[j]);
  88781. }
  88782. }
  88783. window_1.WebVTT.processCues(window_1, cues, this.el_);
  88784. for (var _i2 = 0; _i2 < tracks.length; ++_i2) {
  88785. var _track2 = tracks[_i2];
  88786. for (var _j = 0; _j < _track2.activeCues.length; ++_j) {
  88787. var cueEl = _track2.activeCues[_j].displayState;
  88788. addClass(cueEl, "vjs-text-track-cue");
  88789. addClass(cueEl, "vjs-text-track-cue-" + (_track2.language ? _track2.language : _i2));
  88790. if (_track2.language) {
  88791. setAttribute(cueEl, "lang", _track2.language);
  88792. }
  88793. }
  88794. if (this.player_.textTrackSettings) {
  88795. this.updateDisplayState(_track2);
  88796. }
  88797. }
  88798. };
  88799. return TextTrackDisplay2;
  88800. }(Component$1);
  88801. Component$1.registerComponent("TextTrackDisplay", TextTrackDisplay);
  88802. var LoadingSpinner = /* @__PURE__ */ function(_Component) {
  88803. _inheritsLoose(LoadingSpinner2, _Component);
  88804. function LoadingSpinner2() {
  88805. return _Component.apply(this, arguments) || this;
  88806. }
  88807. var _proto = LoadingSpinner2.prototype;
  88808. _proto.createEl = function createEl$12() {
  88809. var isAudio = this.player_.isAudio();
  88810. var playerType = this.localize(isAudio ? "Audio Player" : "Video Player");
  88811. var controlText = createEl("span", {
  88812. className: "vjs-control-text",
  88813. textContent: this.localize("{1} is loading.", [playerType])
  88814. });
  88815. var el = _Component.prototype.createEl.call(this, "div", {
  88816. className: "vjs-loading-spinner",
  88817. dir: "ltr"
  88818. });
  88819. el.appendChild(controlText);
  88820. return el;
  88821. };
  88822. return LoadingSpinner2;
  88823. }(Component$1);
  88824. Component$1.registerComponent("LoadingSpinner", LoadingSpinner);
  88825. var Button = /* @__PURE__ */ function(_ClickableComponent) {
  88826. _inheritsLoose(Button2, _ClickableComponent);
  88827. function Button2() {
  88828. return _ClickableComponent.apply(this, arguments) || this;
  88829. }
  88830. var _proto = Button2.prototype;
  88831. _proto.createEl = function createEl$12(tag, props, attributes) {
  88832. if (props === void 0) {
  88833. props = {};
  88834. }
  88835. if (attributes === void 0) {
  88836. attributes = {};
  88837. }
  88838. tag = "button";
  88839. props = assign({
  88840. className: this.buildCSSClass()
  88841. }, props);
  88842. attributes = assign({
  88843. type: "button"
  88844. }, attributes);
  88845. var el = createEl(tag, props, attributes);
  88846. el.appendChild(createEl("span", {
  88847. className: "vjs-icon-placeholder"
  88848. }, {
  88849. "aria-hidden": true
  88850. }));
  88851. this.createControlTextEl(el);
  88852. return el;
  88853. };
  88854. _proto.addChild = function addChild(child, options2) {
  88855. if (options2 === void 0) {
  88856. options2 = {};
  88857. }
  88858. var className = this.constructor.name;
  88859. log$1.warn("Adding an actionable (user controllable) child to a Button (" + className + ") is not supported; use a ClickableComponent instead.");
  88860. return Component$1.prototype.addChild.call(this, child, options2);
  88861. };
  88862. _proto.enable = function enable() {
  88863. _ClickableComponent.prototype.enable.call(this);
  88864. this.el_.removeAttribute("disabled");
  88865. };
  88866. _proto.disable = function disable() {
  88867. _ClickableComponent.prototype.disable.call(this);
  88868. this.el_.setAttribute("disabled", "disabled");
  88869. };
  88870. _proto.handleKeyDown = function handleKeyDown(event2) {
  88871. if (keycode.isEventKey(event2, "Space") || keycode.isEventKey(event2, "Enter")) {
  88872. event2.stopPropagation();
  88873. return;
  88874. }
  88875. _ClickableComponent.prototype.handleKeyDown.call(this, event2);
  88876. };
  88877. return Button2;
  88878. }(ClickableComponent);
  88879. Component$1.registerComponent("Button", Button);
  88880. var BigPlayButton = /* @__PURE__ */ function(_Button) {
  88881. _inheritsLoose(BigPlayButton2, _Button);
  88882. function BigPlayButton2(player, options2) {
  88883. var _this;
  88884. _this = _Button.call(this, player, options2) || this;
  88885. _this.mouseused_ = false;
  88886. _this.on("mousedown", function(e) {
  88887. return _this.handleMouseDown(e);
  88888. });
  88889. return _this;
  88890. }
  88891. var _proto = BigPlayButton2.prototype;
  88892. _proto.buildCSSClass = function buildCSSClass() {
  88893. return "vjs-big-play-button";
  88894. };
  88895. _proto.handleClick = function handleClick(event2) {
  88896. var playPromise = this.player_.play();
  88897. if (this.mouseused_ && event2.clientX && event2.clientY) {
  88898. var sourceIsEncrypted = this.player_.usingPlugin("eme") && this.player_.eme.sessions && this.player_.eme.sessions.length > 0;
  88899. silencePromise(playPromise);
  88900. if (this.player_.tech(true) && !((IE_VERSION || IS_EDGE) && sourceIsEncrypted)) {
  88901. this.player_.tech(true).focus();
  88902. }
  88903. return;
  88904. }
  88905. var cb = this.player_.getChild("controlBar");
  88906. var playToggle = cb && cb.getChild("playToggle");
  88907. if (!playToggle) {
  88908. this.player_.tech(true).focus();
  88909. return;
  88910. }
  88911. var playFocus = function playFocus2() {
  88912. return playToggle.focus();
  88913. };
  88914. if (isPromise(playPromise)) {
  88915. playPromise.then(playFocus, function() {
  88916. });
  88917. } else {
  88918. this.setTimeout(playFocus, 1);
  88919. }
  88920. };
  88921. _proto.handleKeyDown = function handleKeyDown(event2) {
  88922. this.mouseused_ = false;
  88923. _Button.prototype.handleKeyDown.call(this, event2);
  88924. };
  88925. _proto.handleMouseDown = function handleMouseDown(event2) {
  88926. this.mouseused_ = true;
  88927. };
  88928. return BigPlayButton2;
  88929. }(Button);
  88930. BigPlayButton.prototype.controlText_ = "Play Video";
  88931. Component$1.registerComponent("BigPlayButton", BigPlayButton);
  88932. var CloseButton = /* @__PURE__ */ function(_Button) {
  88933. _inheritsLoose(CloseButton2, _Button);
  88934. function CloseButton2(player, options2) {
  88935. var _this;
  88936. _this = _Button.call(this, player, options2) || this;
  88937. _this.controlText(options2 && options2.controlText || _this.localize("Close"));
  88938. return _this;
  88939. }
  88940. var _proto = CloseButton2.prototype;
  88941. _proto.buildCSSClass = function buildCSSClass() {
  88942. return "vjs-close-button " + _Button.prototype.buildCSSClass.call(this);
  88943. };
  88944. _proto.handleClick = function handleClick(event2) {
  88945. this.trigger({
  88946. type: "close",
  88947. bubbles: false
  88948. });
  88949. };
  88950. _proto.handleKeyDown = function handleKeyDown(event2) {
  88951. if (keycode.isEventKey(event2, "Esc")) {
  88952. event2.preventDefault();
  88953. event2.stopPropagation();
  88954. this.trigger("click");
  88955. } else {
  88956. _Button.prototype.handleKeyDown.call(this, event2);
  88957. }
  88958. };
  88959. return CloseButton2;
  88960. }(Button);
  88961. Component$1.registerComponent("CloseButton", CloseButton);
  88962. var PlayToggle = /* @__PURE__ */ function(_Button) {
  88963. _inheritsLoose(PlayToggle2, _Button);
  88964. function PlayToggle2(player, options2) {
  88965. var _this;
  88966. if (options2 === void 0) {
  88967. options2 = {};
  88968. }
  88969. _this = _Button.call(this, player, options2) || this;
  88970. options2.replay = options2.replay === void 0 || options2.replay;
  88971. _this.on(player, "play", function(e) {
  88972. return _this.handlePlay(e);
  88973. });
  88974. _this.on(player, "pause", function(e) {
  88975. return _this.handlePause(e);
  88976. });
  88977. if (options2.replay) {
  88978. _this.on(player, "ended", function(e) {
  88979. return _this.handleEnded(e);
  88980. });
  88981. }
  88982. return _this;
  88983. }
  88984. var _proto = PlayToggle2.prototype;
  88985. _proto.buildCSSClass = function buildCSSClass() {
  88986. return "vjs-play-control " + _Button.prototype.buildCSSClass.call(this);
  88987. };
  88988. _proto.handleClick = function handleClick(event2) {
  88989. if (this.player_.paused()) {
  88990. silencePromise(this.player_.play());
  88991. } else {
  88992. this.player_.pause();
  88993. }
  88994. };
  88995. _proto.handleSeeked = function handleSeeked(event2) {
  88996. this.removeClass("vjs-ended");
  88997. if (this.player_.paused()) {
  88998. this.handlePause(event2);
  88999. } else {
  89000. this.handlePlay(event2);
  89001. }
  89002. };
  89003. _proto.handlePlay = function handlePlay(event2) {
  89004. this.removeClass("vjs-ended");
  89005. this.removeClass("vjs-paused");
  89006. this.addClass("vjs-playing");
  89007. this.controlText("Pause");
  89008. };
  89009. _proto.handlePause = function handlePause(event2) {
  89010. this.removeClass("vjs-playing");
  89011. this.addClass("vjs-paused");
  89012. this.controlText("Play");
  89013. };
  89014. _proto.handleEnded = function handleEnded(event2) {
  89015. var _this2 = this;
  89016. this.removeClass("vjs-playing");
  89017. this.addClass("vjs-ended");
  89018. this.controlText("Replay");
  89019. this.one(this.player_, "seeked", function(e) {
  89020. return _this2.handleSeeked(e);
  89021. });
  89022. };
  89023. return PlayToggle2;
  89024. }(Button);
  89025. PlayToggle.prototype.controlText_ = "Play";
  89026. Component$1.registerComponent("PlayToggle", PlayToggle);
  89027. var defaultImplementation = function defaultImplementation2(seconds, guide) {
  89028. seconds = seconds < 0 ? 0 : seconds;
  89029. var s = Math.floor(seconds % 60);
  89030. var m = Math.floor(seconds / 60 % 60);
  89031. var h2 = Math.floor(seconds / 3600);
  89032. var gm = Math.floor(guide / 60 % 60);
  89033. var gh = Math.floor(guide / 3600);
  89034. if (isNaN(seconds) || seconds === Infinity) {
  89035. h2 = m = s = "-";
  89036. }
  89037. h2 = h2 > 0 || gh > 0 ? h2 + ":" : "";
  89038. m = ((h2 || gm >= 10) && m < 10 ? "0" + m : m) + ":";
  89039. s = s < 10 ? "0" + s : s;
  89040. return h2 + m + s;
  89041. };
  89042. var implementation = defaultImplementation;
  89043. function setFormatTime(customImplementation) {
  89044. implementation = customImplementation;
  89045. }
  89046. function resetFormatTime() {
  89047. implementation = defaultImplementation;
  89048. }
  89049. function formatTime(seconds, guide) {
  89050. if (guide === void 0) {
  89051. guide = seconds;
  89052. }
  89053. return implementation(seconds, guide);
  89054. }
  89055. var TimeDisplay = /* @__PURE__ */ function(_Component) {
  89056. _inheritsLoose(TimeDisplay2, _Component);
  89057. function TimeDisplay2(player, options2) {
  89058. var _this;
  89059. _this = _Component.call(this, player, options2) || this;
  89060. _this.on(player, ["timeupdate", "ended"], function(e) {
  89061. return _this.updateContent(e);
  89062. });
  89063. _this.updateTextNode_();
  89064. return _this;
  89065. }
  89066. var _proto = TimeDisplay2.prototype;
  89067. _proto.createEl = function createEl$12() {
  89068. var className = this.buildCSSClass();
  89069. var el = _Component.prototype.createEl.call(this, "div", {
  89070. className: className + " vjs-time-control vjs-control"
  89071. });
  89072. var span = createEl("span", {
  89073. className: "vjs-control-text",
  89074. textContent: this.localize(this.labelText_) + "\xA0"
  89075. }, {
  89076. role: "presentation"
  89077. });
  89078. el.appendChild(span);
  89079. this.contentEl_ = createEl("span", {
  89080. className: className + "-display"
  89081. }, {
  89082. "aria-live": "off",
  89083. "role": "presentation"
  89084. });
  89085. el.appendChild(this.contentEl_);
  89086. return el;
  89087. };
  89088. _proto.dispose = function dispose() {
  89089. this.contentEl_ = null;
  89090. this.textNode_ = null;
  89091. _Component.prototype.dispose.call(this);
  89092. };
  89093. _proto.updateTextNode_ = function updateTextNode_(time) {
  89094. var _this2 = this;
  89095. if (time === void 0) {
  89096. time = 0;
  89097. }
  89098. time = formatTime(time);
  89099. if (this.formattedTime_ === time) {
  89100. return;
  89101. }
  89102. this.formattedTime_ = time;
  89103. this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_", function() {
  89104. if (!_this2.contentEl_) {
  89105. return;
  89106. }
  89107. var oldNode = _this2.textNode_;
  89108. if (oldNode && _this2.contentEl_.firstChild !== oldNode) {
  89109. oldNode = null;
  89110. log$1.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.");
  89111. }
  89112. _this2.textNode_ = document_1.createTextNode(_this2.formattedTime_);
  89113. if (!_this2.textNode_) {
  89114. return;
  89115. }
  89116. if (oldNode) {
  89117. _this2.contentEl_.replaceChild(_this2.textNode_, oldNode);
  89118. } else {
  89119. _this2.contentEl_.appendChild(_this2.textNode_);
  89120. }
  89121. });
  89122. };
  89123. _proto.updateContent = function updateContent(event2) {
  89124. };
  89125. return TimeDisplay2;
  89126. }(Component$1);
  89127. TimeDisplay.prototype.labelText_ = "Time";
  89128. TimeDisplay.prototype.controlText_ = "Time";
  89129. Component$1.registerComponent("TimeDisplay", TimeDisplay);
  89130. var CurrentTimeDisplay = /* @__PURE__ */ function(_TimeDisplay) {
  89131. _inheritsLoose(CurrentTimeDisplay2, _TimeDisplay);
  89132. function CurrentTimeDisplay2() {
  89133. return _TimeDisplay.apply(this, arguments) || this;
  89134. }
  89135. var _proto = CurrentTimeDisplay2.prototype;
  89136. _proto.buildCSSClass = function buildCSSClass() {
  89137. return "vjs-current-time";
  89138. };
  89139. _proto.updateContent = function updateContent(event2) {
  89140. var time;
  89141. if (this.player_.ended()) {
  89142. time = this.player_.duration();
  89143. } else {
  89144. time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
  89145. }
  89146. this.updateTextNode_(time);
  89147. };
  89148. return CurrentTimeDisplay2;
  89149. }(TimeDisplay);
  89150. CurrentTimeDisplay.prototype.labelText_ = "Current Time";
  89151. CurrentTimeDisplay.prototype.controlText_ = "Current Time";
  89152. Component$1.registerComponent("CurrentTimeDisplay", CurrentTimeDisplay);
  89153. var DurationDisplay = /* @__PURE__ */ function(_TimeDisplay) {
  89154. _inheritsLoose(DurationDisplay2, _TimeDisplay);
  89155. function DurationDisplay2(player, options2) {
  89156. var _this;
  89157. _this = _TimeDisplay.call(this, player, options2) || this;
  89158. var updateContent = function updateContent2(e) {
  89159. return _this.updateContent(e);
  89160. };
  89161. _this.on(player, "durationchange", updateContent);
  89162. _this.on(player, "loadstart", updateContent);
  89163. _this.on(player, "loadedmetadata", updateContent);
  89164. return _this;
  89165. }
  89166. var _proto = DurationDisplay2.prototype;
  89167. _proto.buildCSSClass = function buildCSSClass() {
  89168. return "vjs-duration";
  89169. };
  89170. _proto.updateContent = function updateContent(event2) {
  89171. var duration5 = this.player_.duration();
  89172. this.updateTextNode_(duration5);
  89173. };
  89174. return DurationDisplay2;
  89175. }(TimeDisplay);
  89176. DurationDisplay.prototype.labelText_ = "Duration";
  89177. DurationDisplay.prototype.controlText_ = "Duration";
  89178. Component$1.registerComponent("DurationDisplay", DurationDisplay);
  89179. var TimeDivider = /* @__PURE__ */ function(_Component) {
  89180. _inheritsLoose(TimeDivider2, _Component);
  89181. function TimeDivider2() {
  89182. return _Component.apply(this, arguments) || this;
  89183. }
  89184. var _proto = TimeDivider2.prototype;
  89185. _proto.createEl = function createEl2() {
  89186. var el = _Component.prototype.createEl.call(this, "div", {
  89187. className: "vjs-time-control vjs-time-divider"
  89188. }, {
  89189. "aria-hidden": true
  89190. });
  89191. var div = _Component.prototype.createEl.call(this, "div");
  89192. var span = _Component.prototype.createEl.call(this, "span", {
  89193. textContent: "/"
  89194. });
  89195. div.appendChild(span);
  89196. el.appendChild(div);
  89197. return el;
  89198. };
  89199. return TimeDivider2;
  89200. }(Component$1);
  89201. Component$1.registerComponent("TimeDivider", TimeDivider);
  89202. var RemainingTimeDisplay = /* @__PURE__ */ function(_TimeDisplay) {
  89203. _inheritsLoose(RemainingTimeDisplay2, _TimeDisplay);
  89204. function RemainingTimeDisplay2(player, options2) {
  89205. var _this;
  89206. _this = _TimeDisplay.call(this, player, options2) || this;
  89207. _this.on(player, "durationchange", function(e) {
  89208. return _this.updateContent(e);
  89209. });
  89210. return _this;
  89211. }
  89212. var _proto = RemainingTimeDisplay2.prototype;
  89213. _proto.buildCSSClass = function buildCSSClass() {
  89214. return "vjs-remaining-time";
  89215. };
  89216. _proto.createEl = function createEl$12() {
  89217. var el = _TimeDisplay.prototype.createEl.call(this);
  89218. if (this.options_.displayNegative !== false) {
  89219. el.insertBefore(createEl("span", {}, {
  89220. "aria-hidden": true
  89221. }, "-"), this.contentEl_);
  89222. }
  89223. return el;
  89224. };
  89225. _proto.updateContent = function updateContent(event2) {
  89226. if (typeof this.player_.duration() !== "number") {
  89227. return;
  89228. }
  89229. var time;
  89230. if (this.player_.ended()) {
  89231. time = 0;
  89232. } else if (this.player_.remainingTimeDisplay) {
  89233. time = this.player_.remainingTimeDisplay();
  89234. } else {
  89235. time = this.player_.remainingTime();
  89236. }
  89237. this.updateTextNode_(time);
  89238. };
  89239. return RemainingTimeDisplay2;
  89240. }(TimeDisplay);
  89241. RemainingTimeDisplay.prototype.labelText_ = "Remaining Time";
  89242. RemainingTimeDisplay.prototype.controlText_ = "Remaining Time";
  89243. Component$1.registerComponent("RemainingTimeDisplay", RemainingTimeDisplay);
  89244. var LiveDisplay = /* @__PURE__ */ function(_Component) {
  89245. _inheritsLoose(LiveDisplay2, _Component);
  89246. function LiveDisplay2(player, options2) {
  89247. var _this;
  89248. _this = _Component.call(this, player, options2) || this;
  89249. _this.updateShowing();
  89250. _this.on(_this.player(), "durationchange", function(e) {
  89251. return _this.updateShowing(e);
  89252. });
  89253. return _this;
  89254. }
  89255. var _proto = LiveDisplay2.prototype;
  89256. _proto.createEl = function createEl$12() {
  89257. var el = _Component.prototype.createEl.call(this, "div", {
  89258. className: "vjs-live-control vjs-control"
  89259. });
  89260. this.contentEl_ = createEl("div", {
  89261. className: "vjs-live-display"
  89262. }, {
  89263. "aria-live": "off"
  89264. });
  89265. this.contentEl_.appendChild(createEl("span", {
  89266. className: "vjs-control-text",
  89267. textContent: this.localize("Stream Type") + "\xA0"
  89268. }));
  89269. this.contentEl_.appendChild(document_1.createTextNode(this.localize("LIVE")));
  89270. el.appendChild(this.contentEl_);
  89271. return el;
  89272. };
  89273. _proto.dispose = function dispose() {
  89274. this.contentEl_ = null;
  89275. _Component.prototype.dispose.call(this);
  89276. };
  89277. _proto.updateShowing = function updateShowing(event2) {
  89278. if (this.player().duration() === Infinity) {
  89279. this.show();
  89280. } else {
  89281. this.hide();
  89282. }
  89283. };
  89284. return LiveDisplay2;
  89285. }(Component$1);
  89286. Component$1.registerComponent("LiveDisplay", LiveDisplay);
  89287. var SeekToLive = /* @__PURE__ */ function(_Button) {
  89288. _inheritsLoose(SeekToLive2, _Button);
  89289. function SeekToLive2(player, options2) {
  89290. var _this;
  89291. _this = _Button.call(this, player, options2) || this;
  89292. _this.updateLiveEdgeStatus();
  89293. if (_this.player_.liveTracker) {
  89294. _this.updateLiveEdgeStatusHandler_ = function(e) {
  89295. return _this.updateLiveEdgeStatus(e);
  89296. };
  89297. _this.on(_this.player_.liveTracker, "liveedgechange", _this.updateLiveEdgeStatusHandler_);
  89298. }
  89299. return _this;
  89300. }
  89301. var _proto = SeekToLive2.prototype;
  89302. _proto.createEl = function createEl$12() {
  89303. var el = _Button.prototype.createEl.call(this, "button", {
  89304. className: "vjs-seek-to-live-control vjs-control"
  89305. });
  89306. this.textEl_ = createEl("span", {
  89307. className: "vjs-seek-to-live-text",
  89308. textContent: this.localize("LIVE")
  89309. }, {
  89310. "aria-hidden": "true"
  89311. });
  89312. el.appendChild(this.textEl_);
  89313. return el;
  89314. };
  89315. _proto.updateLiveEdgeStatus = function updateLiveEdgeStatus() {
  89316. if (!this.player_.liveTracker || this.player_.liveTracker.atLiveEdge()) {
  89317. this.setAttribute("aria-disabled", true);
  89318. this.addClass("vjs-at-live-edge");
  89319. this.controlText("Seek to live, currently playing live");
  89320. } else {
  89321. this.setAttribute("aria-disabled", false);
  89322. this.removeClass("vjs-at-live-edge");
  89323. this.controlText("Seek to live, currently behind live");
  89324. }
  89325. };
  89326. _proto.handleClick = function handleClick() {
  89327. this.player_.liveTracker.seekToLiveEdge();
  89328. };
  89329. _proto.dispose = function dispose() {
  89330. if (this.player_.liveTracker) {
  89331. this.off(this.player_.liveTracker, "liveedgechange", this.updateLiveEdgeStatusHandler_);
  89332. }
  89333. this.textEl_ = null;
  89334. _Button.prototype.dispose.call(this);
  89335. };
  89336. return SeekToLive2;
  89337. }(Button);
  89338. SeekToLive.prototype.controlText_ = "Seek to live, currently playing live";
  89339. Component$1.registerComponent("SeekToLive", SeekToLive);
  89340. var clamp = function clamp2(number, min2, max2) {
  89341. number = Number(number);
  89342. return Math.min(max2, Math.max(min2, isNaN(number) ? min2 : number));
  89343. };
  89344. var Slider = /* @__PURE__ */ function(_Component) {
  89345. _inheritsLoose(Slider2, _Component);
  89346. function Slider2(player, options2) {
  89347. var _this;
  89348. _this = _Component.call(this, player, options2) || this;
  89349. _this.handleMouseDown_ = function(e) {
  89350. return _this.handleMouseDown(e);
  89351. };
  89352. _this.handleMouseUp_ = function(e) {
  89353. return _this.handleMouseUp(e);
  89354. };
  89355. _this.handleKeyDown_ = function(e) {
  89356. return _this.handleKeyDown(e);
  89357. };
  89358. _this.handleClick_ = function(e) {
  89359. return _this.handleClick(e);
  89360. };
  89361. _this.handleMouseMove_ = function(e) {
  89362. return _this.handleMouseMove(e);
  89363. };
  89364. _this.update_ = function(e) {
  89365. return _this.update(e);
  89366. };
  89367. _this.bar = _this.getChild(_this.options_.barName);
  89368. _this.vertical(!!_this.options_.vertical);
  89369. _this.enable();
  89370. return _this;
  89371. }
  89372. var _proto = Slider2.prototype;
  89373. _proto.enabled = function enabled() {
  89374. return this.enabled_;
  89375. };
  89376. _proto.enable = function enable() {
  89377. if (this.enabled()) {
  89378. return;
  89379. }
  89380. this.on("mousedown", this.handleMouseDown_);
  89381. this.on("touchstart", this.handleMouseDown_);
  89382. this.on("keydown", this.handleKeyDown_);
  89383. this.on("click", this.handleClick_);
  89384. this.on(this.player_, "controlsvisible", this.update);
  89385. if (this.playerEvent) {
  89386. this.on(this.player_, this.playerEvent, this.update);
  89387. }
  89388. this.removeClass("disabled");
  89389. this.setAttribute("tabindex", 0);
  89390. this.enabled_ = true;
  89391. };
  89392. _proto.disable = function disable() {
  89393. if (!this.enabled()) {
  89394. return;
  89395. }
  89396. var doc = this.bar.el_.ownerDocument;
  89397. this.off("mousedown", this.handleMouseDown_);
  89398. this.off("touchstart", this.handleMouseDown_);
  89399. this.off("keydown", this.handleKeyDown_);
  89400. this.off("click", this.handleClick_);
  89401. this.off(this.player_, "controlsvisible", this.update_);
  89402. this.off(doc, "mousemove", this.handleMouseMove_);
  89403. this.off(doc, "mouseup", this.handleMouseUp_);
  89404. this.off(doc, "touchmove", this.handleMouseMove_);
  89405. this.off(doc, "touchend", this.handleMouseUp_);
  89406. this.removeAttribute("tabindex");
  89407. this.addClass("disabled");
  89408. if (this.playerEvent) {
  89409. this.off(this.player_, this.playerEvent, this.update);
  89410. }
  89411. this.enabled_ = false;
  89412. };
  89413. _proto.createEl = function createEl2(type2, props, attributes) {
  89414. if (props === void 0) {
  89415. props = {};
  89416. }
  89417. if (attributes === void 0) {
  89418. attributes = {};
  89419. }
  89420. props.className = props.className + " vjs-slider";
  89421. props = assign({
  89422. tabIndex: 0
  89423. }, props);
  89424. attributes = assign({
  89425. "role": "slider",
  89426. "aria-valuenow": 0,
  89427. "aria-valuemin": 0,
  89428. "aria-valuemax": 100,
  89429. "tabIndex": 0
  89430. }, attributes);
  89431. return _Component.prototype.createEl.call(this, type2, props, attributes);
  89432. };
  89433. _proto.handleMouseDown = function handleMouseDown(event2) {
  89434. var doc = this.bar.el_.ownerDocument;
  89435. if (event2.type === "mousedown") {
  89436. event2.preventDefault();
  89437. }
  89438. if (event2.type === "touchstart" && !IS_CHROME) {
  89439. event2.preventDefault();
  89440. }
  89441. blockTextSelection();
  89442. this.addClass("vjs-sliding");
  89443. this.trigger("slideractive");
  89444. this.on(doc, "mousemove", this.handleMouseMove_);
  89445. this.on(doc, "mouseup", this.handleMouseUp_);
  89446. this.on(doc, "touchmove", this.handleMouseMove_);
  89447. this.on(doc, "touchend", this.handleMouseUp_);
  89448. this.handleMouseMove(event2, true);
  89449. };
  89450. _proto.handleMouseMove = function handleMouseMove(event2) {
  89451. };
  89452. _proto.handleMouseUp = function handleMouseUp() {
  89453. var doc = this.bar.el_.ownerDocument;
  89454. unblockTextSelection();
  89455. this.removeClass("vjs-sliding");
  89456. this.trigger("sliderinactive");
  89457. this.off(doc, "mousemove", this.handleMouseMove_);
  89458. this.off(doc, "mouseup", this.handleMouseUp_);
  89459. this.off(doc, "touchmove", this.handleMouseMove_);
  89460. this.off(doc, "touchend", this.handleMouseUp_);
  89461. this.update();
  89462. };
  89463. _proto.update = function update() {
  89464. var _this2 = this;
  89465. if (!this.el_ || !this.bar) {
  89466. return;
  89467. }
  89468. var progress = this.getProgress();
  89469. if (progress === this.progress_) {
  89470. return progress;
  89471. }
  89472. this.progress_ = progress;
  89473. this.requestNamedAnimationFrame("Slider#update", function() {
  89474. var sizeKey = _this2.vertical() ? "height" : "width";
  89475. _this2.bar.el().style[sizeKey] = (progress * 100).toFixed(2) + "%";
  89476. });
  89477. return progress;
  89478. };
  89479. _proto.getProgress = function getProgress() {
  89480. return Number(clamp(this.getPercent(), 0, 1).toFixed(4));
  89481. };
  89482. _proto.calculateDistance = function calculateDistance(event2) {
  89483. var position2 = getPointerPosition(this.el_, event2);
  89484. if (this.vertical()) {
  89485. return position2.y;
  89486. }
  89487. return position2.x;
  89488. };
  89489. _proto.handleKeyDown = function handleKeyDown(event2) {
  89490. if (keycode.isEventKey(event2, "Left") || keycode.isEventKey(event2, "Down")) {
  89491. event2.preventDefault();
  89492. event2.stopPropagation();
  89493. this.stepBack();
  89494. } else if (keycode.isEventKey(event2, "Right") || keycode.isEventKey(event2, "Up")) {
  89495. event2.preventDefault();
  89496. event2.stopPropagation();
  89497. this.stepForward();
  89498. } else {
  89499. _Component.prototype.handleKeyDown.call(this, event2);
  89500. }
  89501. };
  89502. _proto.handleClick = function handleClick(event2) {
  89503. event2.stopPropagation();
  89504. event2.preventDefault();
  89505. };
  89506. _proto.vertical = function vertical(bool) {
  89507. if (bool === void 0) {
  89508. return this.vertical_ || false;
  89509. }
  89510. this.vertical_ = !!bool;
  89511. if (this.vertical_) {
  89512. this.addClass("vjs-slider-vertical");
  89513. } else {
  89514. this.addClass("vjs-slider-horizontal");
  89515. }
  89516. };
  89517. return Slider2;
  89518. }(Component$1);
  89519. Component$1.registerComponent("Slider", Slider);
  89520. var percentify = function percentify2(time, end) {
  89521. return clamp(time / end * 100, 0, 100).toFixed(2) + "%";
  89522. };
  89523. var LoadProgressBar = /* @__PURE__ */ function(_Component) {
  89524. _inheritsLoose(LoadProgressBar2, _Component);
  89525. function LoadProgressBar2(player, options2) {
  89526. var _this;
  89527. _this = _Component.call(this, player, options2) || this;
  89528. _this.partEls_ = [];
  89529. _this.on(player, "progress", function(e) {
  89530. return _this.update(e);
  89531. });
  89532. return _this;
  89533. }
  89534. var _proto = LoadProgressBar2.prototype;
  89535. _proto.createEl = function createEl$12() {
  89536. var el = _Component.prototype.createEl.call(this, "div", {
  89537. className: "vjs-load-progress"
  89538. });
  89539. var wrapper = createEl("span", {
  89540. className: "vjs-control-text"
  89541. });
  89542. var loadedText = createEl("span", {
  89543. textContent: this.localize("Loaded")
  89544. });
  89545. var separator = document_1.createTextNode(": ");
  89546. this.percentageEl_ = createEl("span", {
  89547. className: "vjs-control-text-loaded-percentage",
  89548. textContent: "0%"
  89549. });
  89550. el.appendChild(wrapper);
  89551. wrapper.appendChild(loadedText);
  89552. wrapper.appendChild(separator);
  89553. wrapper.appendChild(this.percentageEl_);
  89554. return el;
  89555. };
  89556. _proto.dispose = function dispose() {
  89557. this.partEls_ = null;
  89558. this.percentageEl_ = null;
  89559. _Component.prototype.dispose.call(this);
  89560. };
  89561. _proto.update = function update(event2) {
  89562. var _this2 = this;
  89563. this.requestNamedAnimationFrame("LoadProgressBar#update", function() {
  89564. var liveTracker = _this2.player_.liveTracker;
  89565. var buffered = _this2.player_.buffered();
  89566. var duration5 = liveTracker && liveTracker.isLive() ? liveTracker.seekableEnd() : _this2.player_.duration();
  89567. var bufferedEnd = _this2.player_.bufferedEnd();
  89568. var children = _this2.partEls_;
  89569. var percent = percentify(bufferedEnd, duration5);
  89570. if (_this2.percent_ !== percent) {
  89571. _this2.el_.style.width = percent;
  89572. textContent(_this2.percentageEl_, percent);
  89573. _this2.percent_ = percent;
  89574. }
  89575. for (var i2 = 0; i2 < buffered.length; i2++) {
  89576. var start2 = buffered.start(i2);
  89577. var end = buffered.end(i2);
  89578. var part = children[i2];
  89579. if (!part) {
  89580. part = _this2.el_.appendChild(createEl());
  89581. children[i2] = part;
  89582. }
  89583. if (part.dataset.start === start2 && part.dataset.end === end) {
  89584. continue;
  89585. }
  89586. part.dataset.start = start2;
  89587. part.dataset.end = end;
  89588. part.style.left = percentify(start2, bufferedEnd);
  89589. part.style.width = percentify(end - start2, bufferedEnd);
  89590. }
  89591. for (var _i = children.length; _i > buffered.length; _i--) {
  89592. _this2.el_.removeChild(children[_i - 1]);
  89593. }
  89594. children.length = buffered.length;
  89595. });
  89596. };
  89597. return LoadProgressBar2;
  89598. }(Component$1);
  89599. Component$1.registerComponent("LoadProgressBar", LoadProgressBar);
  89600. var TimeTooltip = /* @__PURE__ */ function(_Component) {
  89601. _inheritsLoose(TimeTooltip2, _Component);
  89602. function TimeTooltip2(player, options2) {
  89603. var _this;
  89604. _this = _Component.call(this, player, options2) || this;
  89605. _this.update = throttle(bind(_assertThisInitialized(_this), _this.update), UPDATE_REFRESH_INTERVAL);
  89606. return _this;
  89607. }
  89608. var _proto = TimeTooltip2.prototype;
  89609. _proto.createEl = function createEl2() {
  89610. return _Component.prototype.createEl.call(this, "div", {
  89611. className: "vjs-time-tooltip"
  89612. }, {
  89613. "aria-hidden": "true"
  89614. });
  89615. };
  89616. _proto.update = function update(seekBarRect, seekBarPoint, content) {
  89617. var tooltipRect = findPosition(this.el_);
  89618. var playerRect = getBoundingClientRect(this.player_.el());
  89619. var seekBarPointPx = seekBarRect.width * seekBarPoint;
  89620. if (!playerRect || !tooltipRect) {
  89621. return;
  89622. }
  89623. var spaceLeftOfPoint = seekBarRect.left - playerRect.left + seekBarPointPx;
  89624. var spaceRightOfPoint = seekBarRect.width - seekBarPointPx + (playerRect.right - seekBarRect.right);
  89625. var pullTooltipBy = tooltipRect.width / 2;
  89626. if (spaceLeftOfPoint < pullTooltipBy) {
  89627. pullTooltipBy += pullTooltipBy - spaceLeftOfPoint;
  89628. } else if (spaceRightOfPoint < pullTooltipBy) {
  89629. pullTooltipBy = spaceRightOfPoint;
  89630. }
  89631. if (pullTooltipBy < 0) {
  89632. pullTooltipBy = 0;
  89633. } else if (pullTooltipBy > tooltipRect.width) {
  89634. pullTooltipBy = tooltipRect.width;
  89635. }
  89636. pullTooltipBy = Math.round(pullTooltipBy);
  89637. this.el_.style.right = "-" + pullTooltipBy + "px";
  89638. this.write(content);
  89639. };
  89640. _proto.write = function write(content) {
  89641. textContent(this.el_, content);
  89642. };
  89643. _proto.updateTime = function updateTime(seekBarRect, seekBarPoint, time, cb) {
  89644. var _this2 = this;
  89645. this.requestNamedAnimationFrame("TimeTooltip#updateTime", function() {
  89646. var content;
  89647. var duration5 = _this2.player_.duration();
  89648. if (_this2.player_.liveTracker && _this2.player_.liveTracker.isLive()) {
  89649. var liveWindow = _this2.player_.liveTracker.liveWindow();
  89650. var secondsBehind = liveWindow - seekBarPoint * liveWindow;
  89651. content = (secondsBehind < 1 ? "" : "-") + formatTime(secondsBehind, liveWindow);
  89652. } else {
  89653. content = formatTime(time, duration5);
  89654. }
  89655. _this2.update(seekBarRect, seekBarPoint, content);
  89656. if (cb) {
  89657. cb();
  89658. }
  89659. });
  89660. };
  89661. return TimeTooltip2;
  89662. }(Component$1);
  89663. Component$1.registerComponent("TimeTooltip", TimeTooltip);
  89664. var PlayProgressBar = /* @__PURE__ */ function(_Component) {
  89665. _inheritsLoose(PlayProgressBar2, _Component);
  89666. function PlayProgressBar2(player, options2) {
  89667. var _this;
  89668. _this = _Component.call(this, player, options2) || this;
  89669. _this.update = throttle(bind(_assertThisInitialized(_this), _this.update), UPDATE_REFRESH_INTERVAL);
  89670. return _this;
  89671. }
  89672. var _proto = PlayProgressBar2.prototype;
  89673. _proto.createEl = function createEl2() {
  89674. return _Component.prototype.createEl.call(this, "div", {
  89675. className: "vjs-play-progress vjs-slider-bar"
  89676. }, {
  89677. "aria-hidden": "true"
  89678. });
  89679. };
  89680. _proto.update = function update(seekBarRect, seekBarPoint) {
  89681. var timeTooltip = this.getChild("timeTooltip");
  89682. if (!timeTooltip) {
  89683. return;
  89684. }
  89685. var time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
  89686. timeTooltip.updateTime(seekBarRect, seekBarPoint, time);
  89687. };
  89688. return PlayProgressBar2;
  89689. }(Component$1);
  89690. PlayProgressBar.prototype.options_ = {
  89691. children: []
  89692. };
  89693. if (!IS_IOS && !IS_ANDROID) {
  89694. PlayProgressBar.prototype.options_.children.push("timeTooltip");
  89695. }
  89696. Component$1.registerComponent("PlayProgressBar", PlayProgressBar);
  89697. var MouseTimeDisplay = /* @__PURE__ */ function(_Component) {
  89698. _inheritsLoose(MouseTimeDisplay2, _Component);
  89699. function MouseTimeDisplay2(player, options2) {
  89700. var _this;
  89701. _this = _Component.call(this, player, options2) || this;
  89702. _this.update = throttle(bind(_assertThisInitialized(_this), _this.update), UPDATE_REFRESH_INTERVAL);
  89703. return _this;
  89704. }
  89705. var _proto = MouseTimeDisplay2.prototype;
  89706. _proto.createEl = function createEl2() {
  89707. return _Component.prototype.createEl.call(this, "div", {
  89708. className: "vjs-mouse-display"
  89709. });
  89710. };
  89711. _proto.update = function update(seekBarRect, seekBarPoint) {
  89712. var _this2 = this;
  89713. var time = seekBarPoint * this.player_.duration();
  89714. this.getChild("timeTooltip").updateTime(seekBarRect, seekBarPoint, time, function() {
  89715. _this2.el_.style.left = seekBarRect.width * seekBarPoint + "px";
  89716. });
  89717. };
  89718. return MouseTimeDisplay2;
  89719. }(Component$1);
  89720. MouseTimeDisplay.prototype.options_ = {
  89721. children: ["timeTooltip"]
  89722. };
  89723. Component$1.registerComponent("MouseTimeDisplay", MouseTimeDisplay);
  89724. var STEP_SECONDS = 5;
  89725. var PAGE_KEY_MULTIPLIER = 12;
  89726. var SeekBar = /* @__PURE__ */ function(_Slider) {
  89727. _inheritsLoose(SeekBar2, _Slider);
  89728. function SeekBar2(player, options2) {
  89729. var _this;
  89730. _this = _Slider.call(this, player, options2) || this;
  89731. _this.setEventHandlers_();
  89732. return _this;
  89733. }
  89734. var _proto = SeekBar2.prototype;
  89735. _proto.setEventHandlers_ = function setEventHandlers_() {
  89736. var _this2 = this;
  89737. this.update_ = bind(this, this.update);
  89738. this.update = throttle(this.update_, UPDATE_REFRESH_INTERVAL);
  89739. this.on(this.player_, ["ended", "durationchange", "timeupdate"], this.update);
  89740. if (this.player_.liveTracker) {
  89741. this.on(this.player_.liveTracker, "liveedgechange", this.update);
  89742. }
  89743. this.updateInterval = null;
  89744. this.enableIntervalHandler_ = function(e) {
  89745. return _this2.enableInterval_(e);
  89746. };
  89747. this.disableIntervalHandler_ = function(e) {
  89748. return _this2.disableInterval_(e);
  89749. };
  89750. this.on(this.player_, ["playing"], this.enableIntervalHandler_);
  89751. this.on(this.player_, ["ended", "pause", "waiting"], this.disableIntervalHandler_);
  89752. if ("hidden" in document_1 && "visibilityState" in document_1) {
  89753. this.on(document_1, "visibilitychange", this.toggleVisibility_);
  89754. }
  89755. };
  89756. _proto.toggleVisibility_ = function toggleVisibility_(e) {
  89757. if (document_1.visibilityState === "hidden") {
  89758. this.cancelNamedAnimationFrame("SeekBar#update");
  89759. this.cancelNamedAnimationFrame("Slider#update");
  89760. this.disableInterval_(e);
  89761. } else {
  89762. if (!this.player_.ended() && !this.player_.paused()) {
  89763. this.enableInterval_();
  89764. }
  89765. this.update();
  89766. }
  89767. };
  89768. _proto.enableInterval_ = function enableInterval_() {
  89769. if (this.updateInterval) {
  89770. return;
  89771. }
  89772. this.updateInterval = this.setInterval(this.update, UPDATE_REFRESH_INTERVAL);
  89773. };
  89774. _proto.disableInterval_ = function disableInterval_(e) {
  89775. if (this.player_.liveTracker && this.player_.liveTracker.isLive() && e && e.type !== "ended") {
  89776. return;
  89777. }
  89778. if (!this.updateInterval) {
  89779. return;
  89780. }
  89781. this.clearInterval(this.updateInterval);
  89782. this.updateInterval = null;
  89783. };
  89784. _proto.createEl = function createEl2() {
  89785. return _Slider.prototype.createEl.call(this, "div", {
  89786. className: "vjs-progress-holder"
  89787. }, {
  89788. "aria-label": this.localize("Progress Bar")
  89789. });
  89790. };
  89791. _proto.update = function update(event2) {
  89792. var _this3 = this;
  89793. if (document_1.visibilityState === "hidden") {
  89794. return;
  89795. }
  89796. var percent = _Slider.prototype.update.call(this);
  89797. this.requestNamedAnimationFrame("SeekBar#update", function() {
  89798. var currentTime = _this3.player_.ended() ? _this3.player_.duration() : _this3.getCurrentTime_();
  89799. var liveTracker = _this3.player_.liveTracker;
  89800. var duration5 = _this3.player_.duration();
  89801. if (liveTracker && liveTracker.isLive()) {
  89802. duration5 = _this3.player_.liveTracker.liveCurrentTime();
  89803. }
  89804. if (_this3.percent_ !== percent) {
  89805. _this3.el_.setAttribute("aria-valuenow", (percent * 100).toFixed(2));
  89806. _this3.percent_ = percent;
  89807. }
  89808. if (_this3.currentTime_ !== currentTime || _this3.duration_ !== duration5) {
  89809. _this3.el_.setAttribute("aria-valuetext", _this3.localize("progress bar timing: currentTime={1} duration={2}", [formatTime(currentTime, duration5), formatTime(duration5, duration5)], "{1} of {2}"));
  89810. _this3.currentTime_ = currentTime;
  89811. _this3.duration_ = duration5;
  89812. }
  89813. if (_this3.bar) {
  89814. _this3.bar.update(getBoundingClientRect(_this3.el()), _this3.getProgress());
  89815. }
  89816. });
  89817. return percent;
  89818. };
  89819. _proto.userSeek_ = function userSeek_(ct2) {
  89820. if (this.player_.liveTracker && this.player_.liveTracker.isLive()) {
  89821. this.player_.liveTracker.nextSeekedFromUser();
  89822. }
  89823. this.player_.currentTime(ct2);
  89824. };
  89825. _proto.getCurrentTime_ = function getCurrentTime_() {
  89826. return this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
  89827. };
  89828. _proto.getPercent = function getPercent() {
  89829. var currentTime = this.getCurrentTime_();
  89830. var percent;
  89831. var liveTracker = this.player_.liveTracker;
  89832. if (liveTracker && liveTracker.isLive()) {
  89833. percent = (currentTime - liveTracker.seekableStart()) / liveTracker.liveWindow();
  89834. if (liveTracker.atLiveEdge()) {
  89835. percent = 1;
  89836. }
  89837. } else {
  89838. percent = currentTime / this.player_.duration();
  89839. }
  89840. return percent;
  89841. };
  89842. _proto.handleMouseDown = function handleMouseDown(event2) {
  89843. if (!isSingleLeftClick(event2)) {
  89844. return;
  89845. }
  89846. event2.stopPropagation();
  89847. this.videoWasPlaying = !this.player_.paused();
  89848. this.player_.pause();
  89849. _Slider.prototype.handleMouseDown.call(this, event2);
  89850. };
  89851. _proto.handleMouseMove = function handleMouseMove(event2, mouseDown) {
  89852. if (mouseDown === void 0) {
  89853. mouseDown = false;
  89854. }
  89855. if (!isSingleLeftClick(event2)) {
  89856. return;
  89857. }
  89858. if (!mouseDown && !this.player_.scrubbing()) {
  89859. this.player_.scrubbing(true);
  89860. }
  89861. var newTime;
  89862. var distance2 = this.calculateDistance(event2);
  89863. var liveTracker = this.player_.liveTracker;
  89864. if (!liveTracker || !liveTracker.isLive()) {
  89865. newTime = distance2 * this.player_.duration();
  89866. if (newTime === this.player_.duration()) {
  89867. newTime = newTime - 0.1;
  89868. }
  89869. } else {
  89870. if (distance2 >= 0.99) {
  89871. liveTracker.seekToLiveEdge();
  89872. return;
  89873. }
  89874. var seekableStart = liveTracker.seekableStart();
  89875. var seekableEnd = liveTracker.liveCurrentTime();
  89876. newTime = seekableStart + distance2 * liveTracker.liveWindow();
  89877. if (newTime >= seekableEnd) {
  89878. newTime = seekableEnd;
  89879. }
  89880. if (newTime <= seekableStart) {
  89881. newTime = seekableStart + 0.1;
  89882. }
  89883. if (newTime === Infinity) {
  89884. return;
  89885. }
  89886. }
  89887. this.userSeek_(newTime);
  89888. };
  89889. _proto.enable = function enable() {
  89890. _Slider.prototype.enable.call(this);
  89891. var mouseTimeDisplay = this.getChild("mouseTimeDisplay");
  89892. if (!mouseTimeDisplay) {
  89893. return;
  89894. }
  89895. mouseTimeDisplay.show();
  89896. };
  89897. _proto.disable = function disable() {
  89898. _Slider.prototype.disable.call(this);
  89899. var mouseTimeDisplay = this.getChild("mouseTimeDisplay");
  89900. if (!mouseTimeDisplay) {
  89901. return;
  89902. }
  89903. mouseTimeDisplay.hide();
  89904. };
  89905. _proto.handleMouseUp = function handleMouseUp(event2) {
  89906. _Slider.prototype.handleMouseUp.call(this, event2);
  89907. if (event2) {
  89908. event2.stopPropagation();
  89909. }
  89910. this.player_.scrubbing(false);
  89911. this.player_.trigger({
  89912. type: "timeupdate",
  89913. target: this,
  89914. manuallyTriggered: true
  89915. });
  89916. if (this.videoWasPlaying) {
  89917. silencePromise(this.player_.play());
  89918. } else {
  89919. this.update_();
  89920. }
  89921. };
  89922. _proto.stepForward = function stepForward() {
  89923. this.userSeek_(this.player_.currentTime() + STEP_SECONDS);
  89924. };
  89925. _proto.stepBack = function stepBack() {
  89926. this.userSeek_(this.player_.currentTime() - STEP_SECONDS);
  89927. };
  89928. _proto.handleAction = function handleAction(event2) {
  89929. if (this.player_.paused()) {
  89930. this.player_.play();
  89931. } else {
  89932. this.player_.pause();
  89933. }
  89934. };
  89935. _proto.handleKeyDown = function handleKeyDown(event2) {
  89936. var liveTracker = this.player_.liveTracker;
  89937. if (keycode.isEventKey(event2, "Space") || keycode.isEventKey(event2, "Enter")) {
  89938. event2.preventDefault();
  89939. event2.stopPropagation();
  89940. this.handleAction(event2);
  89941. } else if (keycode.isEventKey(event2, "Home")) {
  89942. event2.preventDefault();
  89943. event2.stopPropagation();
  89944. this.userSeek_(0);
  89945. } else if (keycode.isEventKey(event2, "End")) {
  89946. event2.preventDefault();
  89947. event2.stopPropagation();
  89948. if (liveTracker && liveTracker.isLive()) {
  89949. this.userSeek_(liveTracker.liveCurrentTime());
  89950. } else {
  89951. this.userSeek_(this.player_.duration());
  89952. }
  89953. } else if (/^[0-9]$/.test(keycode(event2))) {
  89954. event2.preventDefault();
  89955. event2.stopPropagation();
  89956. var gotoFraction = (keycode.codes[keycode(event2)] - keycode.codes["0"]) * 10 / 100;
  89957. if (liveTracker && liveTracker.isLive()) {
  89958. this.userSeek_(liveTracker.seekableStart() + liveTracker.liveWindow() * gotoFraction);
  89959. } else {
  89960. this.userSeek_(this.player_.duration() * gotoFraction);
  89961. }
  89962. } else if (keycode.isEventKey(event2, "PgDn")) {
  89963. event2.preventDefault();
  89964. event2.stopPropagation();
  89965. this.userSeek_(this.player_.currentTime() - STEP_SECONDS * PAGE_KEY_MULTIPLIER);
  89966. } else if (keycode.isEventKey(event2, "PgUp")) {
  89967. event2.preventDefault();
  89968. event2.stopPropagation();
  89969. this.userSeek_(this.player_.currentTime() + STEP_SECONDS * PAGE_KEY_MULTIPLIER);
  89970. } else {
  89971. _Slider.prototype.handleKeyDown.call(this, event2);
  89972. }
  89973. };
  89974. _proto.dispose = function dispose() {
  89975. this.disableInterval_();
  89976. this.off(this.player_, ["ended", "durationchange", "timeupdate"], this.update);
  89977. if (this.player_.liveTracker) {
  89978. this.off(this.player_.liveTracker, "liveedgechange", this.update);
  89979. }
  89980. this.off(this.player_, ["playing"], this.enableIntervalHandler_);
  89981. this.off(this.player_, ["ended", "pause", "waiting"], this.disableIntervalHandler_);
  89982. if ("hidden" in document_1 && "visibilityState" in document_1) {
  89983. this.off(document_1, "visibilitychange", this.toggleVisibility_);
  89984. }
  89985. _Slider.prototype.dispose.call(this);
  89986. };
  89987. return SeekBar2;
  89988. }(Slider);
  89989. SeekBar.prototype.options_ = {
  89990. children: ["loadProgressBar", "playProgressBar"],
  89991. barName: "playProgressBar"
  89992. };
  89993. if (!IS_IOS && !IS_ANDROID) {
  89994. SeekBar.prototype.options_.children.splice(1, 0, "mouseTimeDisplay");
  89995. }
  89996. Component$1.registerComponent("SeekBar", SeekBar);
  89997. var ProgressControl = /* @__PURE__ */ function(_Component) {
  89998. _inheritsLoose(ProgressControl2, _Component);
  89999. function ProgressControl2(player, options2) {
  90000. var _this;
  90001. _this = _Component.call(this, player, options2) || this;
  90002. _this.handleMouseMove = throttle(bind(_assertThisInitialized(_this), _this.handleMouseMove), UPDATE_REFRESH_INTERVAL);
  90003. _this.throttledHandleMouseSeek = throttle(bind(_assertThisInitialized(_this), _this.handleMouseSeek), UPDATE_REFRESH_INTERVAL);
  90004. _this.handleMouseUpHandler_ = function(e) {
  90005. return _this.handleMouseUp(e);
  90006. };
  90007. _this.handleMouseDownHandler_ = function(e) {
  90008. return _this.handleMouseDown(e);
  90009. };
  90010. _this.enable();
  90011. return _this;
  90012. }
  90013. var _proto = ProgressControl2.prototype;
  90014. _proto.createEl = function createEl2() {
  90015. return _Component.prototype.createEl.call(this, "div", {
  90016. className: "vjs-progress-control vjs-control"
  90017. });
  90018. };
  90019. _proto.handleMouseMove = function handleMouseMove(event2) {
  90020. var seekBar = this.getChild("seekBar");
  90021. if (!seekBar) {
  90022. return;
  90023. }
  90024. var playProgressBar = seekBar.getChild("playProgressBar");
  90025. var mouseTimeDisplay = seekBar.getChild("mouseTimeDisplay");
  90026. if (!playProgressBar && !mouseTimeDisplay) {
  90027. return;
  90028. }
  90029. var seekBarEl = seekBar.el();
  90030. var seekBarRect = findPosition(seekBarEl);
  90031. var seekBarPoint = getPointerPosition(seekBarEl, event2).x;
  90032. seekBarPoint = clamp(seekBarPoint, 0, 1);
  90033. if (mouseTimeDisplay) {
  90034. mouseTimeDisplay.update(seekBarRect, seekBarPoint);
  90035. }
  90036. if (playProgressBar) {
  90037. playProgressBar.update(seekBarRect, seekBar.getProgress());
  90038. }
  90039. };
  90040. _proto.handleMouseSeek = function handleMouseSeek(event2) {
  90041. var seekBar = this.getChild("seekBar");
  90042. if (seekBar) {
  90043. seekBar.handleMouseMove(event2);
  90044. }
  90045. };
  90046. _proto.enabled = function enabled() {
  90047. return this.enabled_;
  90048. };
  90049. _proto.disable = function disable() {
  90050. this.children().forEach(function(child) {
  90051. return child.disable && child.disable();
  90052. });
  90053. if (!this.enabled()) {
  90054. return;
  90055. }
  90056. this.off(["mousedown", "touchstart"], this.handleMouseDownHandler_);
  90057. this.off(this.el_, "mousemove", this.handleMouseMove);
  90058. this.removeListenersAddedOnMousedownAndTouchstart();
  90059. this.addClass("disabled");
  90060. this.enabled_ = false;
  90061. if (this.player_.scrubbing()) {
  90062. var seekBar = this.getChild("seekBar");
  90063. this.player_.scrubbing(false);
  90064. if (seekBar.videoWasPlaying) {
  90065. silencePromise(this.player_.play());
  90066. }
  90067. }
  90068. };
  90069. _proto.enable = function enable() {
  90070. this.children().forEach(function(child) {
  90071. return child.enable && child.enable();
  90072. });
  90073. if (this.enabled()) {
  90074. return;
  90075. }
  90076. this.on(["mousedown", "touchstart"], this.handleMouseDownHandler_);
  90077. this.on(this.el_, "mousemove", this.handleMouseMove);
  90078. this.removeClass("disabled");
  90079. this.enabled_ = true;
  90080. };
  90081. _proto.removeListenersAddedOnMousedownAndTouchstart = function removeListenersAddedOnMousedownAndTouchstart() {
  90082. var doc = this.el_.ownerDocument;
  90083. this.off(doc, "mousemove", this.throttledHandleMouseSeek);
  90084. this.off(doc, "touchmove", this.throttledHandleMouseSeek);
  90085. this.off(doc, "mouseup", this.handleMouseUpHandler_);
  90086. this.off(doc, "touchend", this.handleMouseUpHandler_);
  90087. };
  90088. _proto.handleMouseDown = function handleMouseDown(event2) {
  90089. var doc = this.el_.ownerDocument;
  90090. var seekBar = this.getChild("seekBar");
  90091. if (seekBar) {
  90092. seekBar.handleMouseDown(event2);
  90093. }
  90094. this.on(doc, "mousemove", this.throttledHandleMouseSeek);
  90095. this.on(doc, "touchmove", this.throttledHandleMouseSeek);
  90096. this.on(doc, "mouseup", this.handleMouseUpHandler_);
  90097. this.on(doc, "touchend", this.handleMouseUpHandler_);
  90098. };
  90099. _proto.handleMouseUp = function handleMouseUp(event2) {
  90100. var seekBar = this.getChild("seekBar");
  90101. if (seekBar) {
  90102. seekBar.handleMouseUp(event2);
  90103. }
  90104. this.removeListenersAddedOnMousedownAndTouchstart();
  90105. };
  90106. return ProgressControl2;
  90107. }(Component$1);
  90108. ProgressControl.prototype.options_ = {
  90109. children: ["seekBar"]
  90110. };
  90111. Component$1.registerComponent("ProgressControl", ProgressControl);
  90112. var PictureInPictureToggle = /* @__PURE__ */ function(_Button) {
  90113. _inheritsLoose(PictureInPictureToggle2, _Button);
  90114. function PictureInPictureToggle2(player, options2) {
  90115. var _this;
  90116. _this = _Button.call(this, player, options2) || this;
  90117. _this.on(player, ["enterpictureinpicture", "leavepictureinpicture"], function(e) {
  90118. return _this.handlePictureInPictureChange(e);
  90119. });
  90120. _this.on(player, ["disablepictureinpicturechanged", "loadedmetadata"], function(e) {
  90121. return _this.handlePictureInPictureEnabledChange(e);
  90122. });
  90123. _this.on(player, ["loadedmetadata", "audioonlymodechange", "audiopostermodechange"], function() {
  90124. var isSourceAudio = player.currentType().substring(0, 5) === "audio";
  90125. if (isSourceAudio || player.audioPosterMode() || player.audioOnlyMode()) {
  90126. if (player.isInPictureInPicture()) {
  90127. player.exitPictureInPicture();
  90128. }
  90129. _this.hide();
  90130. } else {
  90131. _this.show();
  90132. }
  90133. });
  90134. _this.disable();
  90135. return _this;
  90136. }
  90137. var _proto = PictureInPictureToggle2.prototype;
  90138. _proto.buildCSSClass = function buildCSSClass() {
  90139. return "vjs-picture-in-picture-control " + _Button.prototype.buildCSSClass.call(this);
  90140. };
  90141. _proto.handlePictureInPictureEnabledChange = function handlePictureInPictureEnabledChange() {
  90142. if (document_1.pictureInPictureEnabled && this.player_.disablePictureInPicture() === false) {
  90143. this.enable();
  90144. } else {
  90145. this.disable();
  90146. }
  90147. };
  90148. _proto.handlePictureInPictureChange = function handlePictureInPictureChange(event2) {
  90149. if (this.player_.isInPictureInPicture()) {
  90150. this.controlText("Exit Picture-in-Picture");
  90151. } else {
  90152. this.controlText("Picture-in-Picture");
  90153. }
  90154. this.handlePictureInPictureEnabledChange();
  90155. };
  90156. _proto.handleClick = function handleClick(event2) {
  90157. if (!this.player_.isInPictureInPicture()) {
  90158. this.player_.requestPictureInPicture();
  90159. } else {
  90160. this.player_.exitPictureInPicture();
  90161. }
  90162. };
  90163. return PictureInPictureToggle2;
  90164. }(Button);
  90165. PictureInPictureToggle.prototype.controlText_ = "Picture-in-Picture";
  90166. Component$1.registerComponent("PictureInPictureToggle", PictureInPictureToggle);
  90167. var FullscreenToggle = /* @__PURE__ */ function(_Button) {
  90168. _inheritsLoose(FullscreenToggle2, _Button);
  90169. function FullscreenToggle2(player, options2) {
  90170. var _this;
  90171. _this = _Button.call(this, player, options2) || this;
  90172. _this.on(player, "fullscreenchange", function(e) {
  90173. return _this.handleFullscreenChange(e);
  90174. });
  90175. if (document_1[player.fsApi_.fullscreenEnabled] === false) {
  90176. _this.disable();
  90177. }
  90178. return _this;
  90179. }
  90180. var _proto = FullscreenToggle2.prototype;
  90181. _proto.buildCSSClass = function buildCSSClass() {
  90182. return "vjs-fullscreen-control " + _Button.prototype.buildCSSClass.call(this);
  90183. };
  90184. _proto.handleFullscreenChange = function handleFullscreenChange(event2) {
  90185. if (this.player_.isFullscreen()) {
  90186. this.controlText("Non-Fullscreen");
  90187. } else {
  90188. this.controlText("Fullscreen");
  90189. }
  90190. };
  90191. _proto.handleClick = function handleClick(event2) {
  90192. if (!this.player_.isFullscreen()) {
  90193. this.player_.requestFullscreen();
  90194. } else {
  90195. this.player_.exitFullscreen();
  90196. }
  90197. };
  90198. return FullscreenToggle2;
  90199. }(Button);
  90200. FullscreenToggle.prototype.controlText_ = "Fullscreen";
  90201. Component$1.registerComponent("FullscreenToggle", FullscreenToggle);
  90202. var checkVolumeSupport = function checkVolumeSupport2(self2, player) {
  90203. if (player.tech_ && !player.tech_.featuresVolumeControl) {
  90204. self2.addClass("vjs-hidden");
  90205. }
  90206. self2.on(player, "loadstart", function() {
  90207. if (!player.tech_.featuresVolumeControl) {
  90208. self2.addClass("vjs-hidden");
  90209. } else {
  90210. self2.removeClass("vjs-hidden");
  90211. }
  90212. });
  90213. };
  90214. var VolumeLevel = /* @__PURE__ */ function(_Component) {
  90215. _inheritsLoose(VolumeLevel2, _Component);
  90216. function VolumeLevel2() {
  90217. return _Component.apply(this, arguments) || this;
  90218. }
  90219. var _proto = VolumeLevel2.prototype;
  90220. _proto.createEl = function createEl2() {
  90221. var el = _Component.prototype.createEl.call(this, "div", {
  90222. className: "vjs-volume-level"
  90223. });
  90224. el.appendChild(_Component.prototype.createEl.call(this, "span", {
  90225. className: "vjs-control-text"
  90226. }));
  90227. return el;
  90228. };
  90229. return VolumeLevel2;
  90230. }(Component$1);
  90231. Component$1.registerComponent("VolumeLevel", VolumeLevel);
  90232. var VolumeLevelTooltip = /* @__PURE__ */ function(_Component) {
  90233. _inheritsLoose(VolumeLevelTooltip2, _Component);
  90234. function VolumeLevelTooltip2(player, options2) {
  90235. var _this;
  90236. _this = _Component.call(this, player, options2) || this;
  90237. _this.update = throttle(bind(_assertThisInitialized(_this), _this.update), UPDATE_REFRESH_INTERVAL);
  90238. return _this;
  90239. }
  90240. var _proto = VolumeLevelTooltip2.prototype;
  90241. _proto.createEl = function createEl2() {
  90242. return _Component.prototype.createEl.call(this, "div", {
  90243. className: "vjs-volume-tooltip"
  90244. }, {
  90245. "aria-hidden": "true"
  90246. });
  90247. };
  90248. _proto.update = function update(rangeBarRect, rangeBarPoint, vertical, content) {
  90249. if (!vertical) {
  90250. var tooltipRect = getBoundingClientRect(this.el_);
  90251. var playerRect = getBoundingClientRect(this.player_.el());
  90252. var volumeBarPointPx = rangeBarRect.width * rangeBarPoint;
  90253. if (!playerRect || !tooltipRect) {
  90254. return;
  90255. }
  90256. var spaceLeftOfPoint = rangeBarRect.left - playerRect.left + volumeBarPointPx;
  90257. var spaceRightOfPoint = rangeBarRect.width - volumeBarPointPx + (playerRect.right - rangeBarRect.right);
  90258. var pullTooltipBy = tooltipRect.width / 2;
  90259. if (spaceLeftOfPoint < pullTooltipBy) {
  90260. pullTooltipBy += pullTooltipBy - spaceLeftOfPoint;
  90261. } else if (spaceRightOfPoint < pullTooltipBy) {
  90262. pullTooltipBy = spaceRightOfPoint;
  90263. }
  90264. if (pullTooltipBy < 0) {
  90265. pullTooltipBy = 0;
  90266. } else if (pullTooltipBy > tooltipRect.width) {
  90267. pullTooltipBy = tooltipRect.width;
  90268. }
  90269. this.el_.style.right = "-" + pullTooltipBy + "px";
  90270. }
  90271. this.write(content + "%");
  90272. };
  90273. _proto.write = function write(content) {
  90274. textContent(this.el_, content);
  90275. };
  90276. _proto.updateVolume = function updateVolume(rangeBarRect, rangeBarPoint, vertical, volume, cb) {
  90277. var _this2 = this;
  90278. this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume", function() {
  90279. _this2.update(rangeBarRect, rangeBarPoint, vertical, volume.toFixed(0));
  90280. if (cb) {
  90281. cb();
  90282. }
  90283. });
  90284. };
  90285. return VolumeLevelTooltip2;
  90286. }(Component$1);
  90287. Component$1.registerComponent("VolumeLevelTooltip", VolumeLevelTooltip);
  90288. var MouseVolumeLevelDisplay = /* @__PURE__ */ function(_Component) {
  90289. _inheritsLoose(MouseVolumeLevelDisplay2, _Component);
  90290. function MouseVolumeLevelDisplay2(player, options2) {
  90291. var _this;
  90292. _this = _Component.call(this, player, options2) || this;
  90293. _this.update = throttle(bind(_assertThisInitialized(_this), _this.update), UPDATE_REFRESH_INTERVAL);
  90294. return _this;
  90295. }
  90296. var _proto = MouseVolumeLevelDisplay2.prototype;
  90297. _proto.createEl = function createEl2() {
  90298. return _Component.prototype.createEl.call(this, "div", {
  90299. className: "vjs-mouse-display"
  90300. });
  90301. };
  90302. _proto.update = function update(rangeBarRect, rangeBarPoint, vertical) {
  90303. var _this2 = this;
  90304. var volume = 100 * rangeBarPoint;
  90305. this.getChild("volumeLevelTooltip").updateVolume(rangeBarRect, rangeBarPoint, vertical, volume, function() {
  90306. if (vertical) {
  90307. _this2.el_.style.bottom = rangeBarRect.height * rangeBarPoint + "px";
  90308. } else {
  90309. _this2.el_.style.left = rangeBarRect.width * rangeBarPoint + "px";
  90310. }
  90311. });
  90312. };
  90313. return MouseVolumeLevelDisplay2;
  90314. }(Component$1);
  90315. MouseVolumeLevelDisplay.prototype.options_ = {
  90316. children: ["volumeLevelTooltip"]
  90317. };
  90318. Component$1.registerComponent("MouseVolumeLevelDisplay", MouseVolumeLevelDisplay);
  90319. var VolumeBar = /* @__PURE__ */ function(_Slider) {
  90320. _inheritsLoose(VolumeBar2, _Slider);
  90321. function VolumeBar2(player, options2) {
  90322. var _this;
  90323. _this = _Slider.call(this, player, options2) || this;
  90324. _this.on("slideractive", function(e) {
  90325. return _this.updateLastVolume_(e);
  90326. });
  90327. _this.on(player, "volumechange", function(e) {
  90328. return _this.updateARIAAttributes(e);
  90329. });
  90330. player.ready(function() {
  90331. return _this.updateARIAAttributes();
  90332. });
  90333. return _this;
  90334. }
  90335. var _proto = VolumeBar2.prototype;
  90336. _proto.createEl = function createEl2() {
  90337. return _Slider.prototype.createEl.call(this, "div", {
  90338. className: "vjs-volume-bar vjs-slider-bar"
  90339. }, {
  90340. "aria-label": this.localize("Volume Level"),
  90341. "aria-live": "polite"
  90342. });
  90343. };
  90344. _proto.handleMouseDown = function handleMouseDown(event2) {
  90345. if (!isSingleLeftClick(event2)) {
  90346. return;
  90347. }
  90348. _Slider.prototype.handleMouseDown.call(this, event2);
  90349. };
  90350. _proto.handleMouseMove = function handleMouseMove(event2) {
  90351. var mouseVolumeLevelDisplay = this.getChild("mouseVolumeLevelDisplay");
  90352. if (mouseVolumeLevelDisplay) {
  90353. var volumeBarEl = this.el();
  90354. var volumeBarRect = getBoundingClientRect(volumeBarEl);
  90355. var vertical = this.vertical();
  90356. var volumeBarPoint = getPointerPosition(volumeBarEl, event2);
  90357. volumeBarPoint = vertical ? volumeBarPoint.y : volumeBarPoint.x;
  90358. volumeBarPoint = clamp(volumeBarPoint, 0, 1);
  90359. mouseVolumeLevelDisplay.update(volumeBarRect, volumeBarPoint, vertical);
  90360. }
  90361. if (!isSingleLeftClick(event2)) {
  90362. return;
  90363. }
  90364. this.checkMuted();
  90365. this.player_.volume(this.calculateDistance(event2));
  90366. };
  90367. _proto.checkMuted = function checkMuted() {
  90368. if (this.player_.muted()) {
  90369. this.player_.muted(false);
  90370. }
  90371. };
  90372. _proto.getPercent = function getPercent() {
  90373. if (this.player_.muted()) {
  90374. return 0;
  90375. }
  90376. return this.player_.volume();
  90377. };
  90378. _proto.stepForward = function stepForward() {
  90379. this.checkMuted();
  90380. this.player_.volume(this.player_.volume() + 0.1);
  90381. };
  90382. _proto.stepBack = function stepBack() {
  90383. this.checkMuted();
  90384. this.player_.volume(this.player_.volume() - 0.1);
  90385. };
  90386. _proto.updateARIAAttributes = function updateARIAAttributes(event2) {
  90387. var ariaValue = this.player_.muted() ? 0 : this.volumeAsPercentage_();
  90388. this.el_.setAttribute("aria-valuenow", ariaValue);
  90389. this.el_.setAttribute("aria-valuetext", ariaValue + "%");
  90390. };
  90391. _proto.volumeAsPercentage_ = function volumeAsPercentage_() {
  90392. return Math.round(this.player_.volume() * 100);
  90393. };
  90394. _proto.updateLastVolume_ = function updateLastVolume_() {
  90395. var _this2 = this;
  90396. var volumeBeforeDrag = this.player_.volume();
  90397. this.one("sliderinactive", function() {
  90398. if (_this2.player_.volume() === 0) {
  90399. _this2.player_.lastVolume_(volumeBeforeDrag);
  90400. }
  90401. });
  90402. };
  90403. return VolumeBar2;
  90404. }(Slider);
  90405. VolumeBar.prototype.options_ = {
  90406. children: ["volumeLevel"],
  90407. barName: "volumeLevel"
  90408. };
  90409. if (!IS_IOS && !IS_ANDROID) {
  90410. VolumeBar.prototype.options_.children.splice(0, 0, "mouseVolumeLevelDisplay");
  90411. }
  90412. VolumeBar.prototype.playerEvent = "volumechange";
  90413. Component$1.registerComponent("VolumeBar", VolumeBar);
  90414. var VolumeControl = /* @__PURE__ */ function(_Component) {
  90415. _inheritsLoose(VolumeControl2, _Component);
  90416. function VolumeControl2(player, options2) {
  90417. var _this;
  90418. if (options2 === void 0) {
  90419. options2 = {};
  90420. }
  90421. options2.vertical = options2.vertical || false;
  90422. if (typeof options2.volumeBar === "undefined" || isPlain(options2.volumeBar)) {
  90423. options2.volumeBar = options2.volumeBar || {};
  90424. options2.volumeBar.vertical = options2.vertical;
  90425. }
  90426. _this = _Component.call(this, player, options2) || this;
  90427. checkVolumeSupport(_assertThisInitialized(_this), player);
  90428. _this.throttledHandleMouseMove = throttle(bind(_assertThisInitialized(_this), _this.handleMouseMove), UPDATE_REFRESH_INTERVAL);
  90429. _this.handleMouseUpHandler_ = function(e) {
  90430. return _this.handleMouseUp(e);
  90431. };
  90432. _this.on("mousedown", function(e) {
  90433. return _this.handleMouseDown(e);
  90434. });
  90435. _this.on("touchstart", function(e) {
  90436. return _this.handleMouseDown(e);
  90437. });
  90438. _this.on("mousemove", function(e) {
  90439. return _this.handleMouseMove(e);
  90440. });
  90441. _this.on(_this.volumeBar, ["focus", "slideractive"], function() {
  90442. _this.volumeBar.addClass("vjs-slider-active");
  90443. _this.addClass("vjs-slider-active");
  90444. _this.trigger("slideractive");
  90445. });
  90446. _this.on(_this.volumeBar, ["blur", "sliderinactive"], function() {
  90447. _this.volumeBar.removeClass("vjs-slider-active");
  90448. _this.removeClass("vjs-slider-active");
  90449. _this.trigger("sliderinactive");
  90450. });
  90451. return _this;
  90452. }
  90453. var _proto = VolumeControl2.prototype;
  90454. _proto.createEl = function createEl2() {
  90455. var orientationClass = "vjs-volume-horizontal";
  90456. if (this.options_.vertical) {
  90457. orientationClass = "vjs-volume-vertical";
  90458. }
  90459. return _Component.prototype.createEl.call(this, "div", {
  90460. className: "vjs-volume-control vjs-control " + orientationClass
  90461. });
  90462. };
  90463. _proto.handleMouseDown = function handleMouseDown(event2) {
  90464. var doc = this.el_.ownerDocument;
  90465. this.on(doc, "mousemove", this.throttledHandleMouseMove);
  90466. this.on(doc, "touchmove", this.throttledHandleMouseMove);
  90467. this.on(doc, "mouseup", this.handleMouseUpHandler_);
  90468. this.on(doc, "touchend", this.handleMouseUpHandler_);
  90469. };
  90470. _proto.handleMouseUp = function handleMouseUp(event2) {
  90471. var doc = this.el_.ownerDocument;
  90472. this.off(doc, "mousemove", this.throttledHandleMouseMove);
  90473. this.off(doc, "touchmove", this.throttledHandleMouseMove);
  90474. this.off(doc, "mouseup", this.handleMouseUpHandler_);
  90475. this.off(doc, "touchend", this.handleMouseUpHandler_);
  90476. };
  90477. _proto.handleMouseMove = function handleMouseMove(event2) {
  90478. this.volumeBar.handleMouseMove(event2);
  90479. };
  90480. return VolumeControl2;
  90481. }(Component$1);
  90482. VolumeControl.prototype.options_ = {
  90483. children: ["volumeBar"]
  90484. };
  90485. Component$1.registerComponent("VolumeControl", VolumeControl);
  90486. var checkMuteSupport = function checkMuteSupport2(self2, player) {
  90487. if (player.tech_ && !player.tech_.featuresMuteControl) {
  90488. self2.addClass("vjs-hidden");
  90489. }
  90490. self2.on(player, "loadstart", function() {
  90491. if (!player.tech_.featuresMuteControl) {
  90492. self2.addClass("vjs-hidden");
  90493. } else {
  90494. self2.removeClass("vjs-hidden");
  90495. }
  90496. });
  90497. };
  90498. var MuteToggle = /* @__PURE__ */ function(_Button) {
  90499. _inheritsLoose(MuteToggle2, _Button);
  90500. function MuteToggle2(player, options2) {
  90501. var _this;
  90502. _this = _Button.call(this, player, options2) || this;
  90503. checkMuteSupport(_assertThisInitialized(_this), player);
  90504. _this.on(player, ["loadstart", "volumechange"], function(e) {
  90505. return _this.update(e);
  90506. });
  90507. return _this;
  90508. }
  90509. var _proto = MuteToggle2.prototype;
  90510. _proto.buildCSSClass = function buildCSSClass() {
  90511. return "vjs-mute-control " + _Button.prototype.buildCSSClass.call(this);
  90512. };
  90513. _proto.handleClick = function handleClick(event2) {
  90514. var vol = this.player_.volume();
  90515. var lastVolume = this.player_.lastVolume_();
  90516. if (vol === 0) {
  90517. var volumeToSet = lastVolume < 0.1 ? 0.1 : lastVolume;
  90518. this.player_.volume(volumeToSet);
  90519. this.player_.muted(false);
  90520. } else {
  90521. this.player_.muted(this.player_.muted() ? false : true);
  90522. }
  90523. };
  90524. _proto.update = function update(event2) {
  90525. this.updateIcon_();
  90526. this.updateControlText_();
  90527. };
  90528. _proto.updateIcon_ = function updateIcon_() {
  90529. var vol = this.player_.volume();
  90530. var level = 3;
  90531. if (IS_IOS && this.player_.tech_ && this.player_.tech_.el_) {
  90532. this.player_.muted(this.player_.tech_.el_.muted);
  90533. }
  90534. if (vol === 0 || this.player_.muted()) {
  90535. level = 0;
  90536. } else if (vol < 0.33) {
  90537. level = 1;
  90538. } else if (vol < 0.67) {
  90539. level = 2;
  90540. }
  90541. for (var i2 = 0; i2 < 4; i2++) {
  90542. removeClass(this.el_, "vjs-vol-" + i2);
  90543. }
  90544. addClass(this.el_, "vjs-vol-" + level);
  90545. };
  90546. _proto.updateControlText_ = function updateControlText_() {
  90547. var soundOff = this.player_.muted() || this.player_.volume() === 0;
  90548. var text = soundOff ? "Unmute" : "Mute";
  90549. if (this.controlText() !== text) {
  90550. this.controlText(text);
  90551. }
  90552. };
  90553. return MuteToggle2;
  90554. }(Button);
  90555. MuteToggle.prototype.controlText_ = "Mute";
  90556. Component$1.registerComponent("MuteToggle", MuteToggle);
  90557. var VolumePanel = /* @__PURE__ */ function(_Component) {
  90558. _inheritsLoose(VolumePanel2, _Component);
  90559. function VolumePanel2(player, options2) {
  90560. var _this;
  90561. if (options2 === void 0) {
  90562. options2 = {};
  90563. }
  90564. if (typeof options2.inline !== "undefined") {
  90565. options2.inline = options2.inline;
  90566. } else {
  90567. options2.inline = true;
  90568. }
  90569. if (typeof options2.volumeControl === "undefined" || isPlain(options2.volumeControl)) {
  90570. options2.volumeControl = options2.volumeControl || {};
  90571. options2.volumeControl.vertical = !options2.inline;
  90572. }
  90573. _this = _Component.call(this, player, options2) || this;
  90574. _this.handleKeyPressHandler_ = function(e) {
  90575. return _this.handleKeyPress(e);
  90576. };
  90577. _this.on(player, ["loadstart"], function(e) {
  90578. return _this.volumePanelState_(e);
  90579. });
  90580. _this.on(_this.muteToggle, "keyup", function(e) {
  90581. return _this.handleKeyPress(e);
  90582. });
  90583. _this.on(_this.volumeControl, "keyup", function(e) {
  90584. return _this.handleVolumeControlKeyUp(e);
  90585. });
  90586. _this.on("keydown", function(e) {
  90587. return _this.handleKeyPress(e);
  90588. });
  90589. _this.on("mouseover", function(e) {
  90590. return _this.handleMouseOver(e);
  90591. });
  90592. _this.on("mouseout", function(e) {
  90593. return _this.handleMouseOut(e);
  90594. });
  90595. _this.on(_this.volumeControl, ["slideractive"], _this.sliderActive_);
  90596. _this.on(_this.volumeControl, ["sliderinactive"], _this.sliderInactive_);
  90597. return _this;
  90598. }
  90599. var _proto = VolumePanel2.prototype;
  90600. _proto.sliderActive_ = function sliderActive_() {
  90601. this.addClass("vjs-slider-active");
  90602. };
  90603. _proto.sliderInactive_ = function sliderInactive_() {
  90604. this.removeClass("vjs-slider-active");
  90605. };
  90606. _proto.volumePanelState_ = function volumePanelState_() {
  90607. if (this.volumeControl.hasClass("vjs-hidden") && this.muteToggle.hasClass("vjs-hidden")) {
  90608. this.addClass("vjs-hidden");
  90609. }
  90610. if (this.volumeControl.hasClass("vjs-hidden") && !this.muteToggle.hasClass("vjs-hidden")) {
  90611. this.addClass("vjs-mute-toggle-only");
  90612. }
  90613. };
  90614. _proto.createEl = function createEl2() {
  90615. var orientationClass = "vjs-volume-panel-horizontal";
  90616. if (!this.options_.inline) {
  90617. orientationClass = "vjs-volume-panel-vertical";
  90618. }
  90619. return _Component.prototype.createEl.call(this, "div", {
  90620. className: "vjs-volume-panel vjs-control " + orientationClass
  90621. });
  90622. };
  90623. _proto.dispose = function dispose() {
  90624. this.handleMouseOut();
  90625. _Component.prototype.dispose.call(this);
  90626. };
  90627. _proto.handleVolumeControlKeyUp = function handleVolumeControlKeyUp(event2) {
  90628. if (keycode.isEventKey(event2, "Esc")) {
  90629. this.muteToggle.focus();
  90630. }
  90631. };
  90632. _proto.handleMouseOver = function handleMouseOver(event2) {
  90633. this.addClass("vjs-hover");
  90634. on(document_1, "keyup", this.handleKeyPressHandler_);
  90635. };
  90636. _proto.handleMouseOut = function handleMouseOut(event2) {
  90637. this.removeClass("vjs-hover");
  90638. off(document_1, "keyup", this.handleKeyPressHandler_);
  90639. };
  90640. _proto.handleKeyPress = function handleKeyPress(event2) {
  90641. if (keycode.isEventKey(event2, "Esc")) {
  90642. this.handleMouseOut();
  90643. }
  90644. };
  90645. return VolumePanel2;
  90646. }(Component$1);
  90647. VolumePanel.prototype.options_ = {
  90648. children: ["muteToggle", "volumeControl"]
  90649. };
  90650. Component$1.registerComponent("VolumePanel", VolumePanel);
  90651. var Menu = /* @__PURE__ */ function(_Component) {
  90652. _inheritsLoose(Menu2, _Component);
  90653. function Menu2(player, options2) {
  90654. var _this;
  90655. _this = _Component.call(this, player, options2) || this;
  90656. if (options2) {
  90657. _this.menuButton_ = options2.menuButton;
  90658. }
  90659. _this.focusedChild_ = -1;
  90660. _this.on("keydown", function(e) {
  90661. return _this.handleKeyDown(e);
  90662. });
  90663. _this.boundHandleBlur_ = function(e) {
  90664. return _this.handleBlur(e);
  90665. };
  90666. _this.boundHandleTapClick_ = function(e) {
  90667. return _this.handleTapClick(e);
  90668. };
  90669. return _this;
  90670. }
  90671. var _proto = Menu2.prototype;
  90672. _proto.addEventListenerForItem = function addEventListenerForItem(component) {
  90673. if (!(component instanceof Component$1)) {
  90674. return;
  90675. }
  90676. this.on(component, "blur", this.boundHandleBlur_);
  90677. this.on(component, ["tap", "click"], this.boundHandleTapClick_);
  90678. };
  90679. _proto.removeEventListenerForItem = function removeEventListenerForItem(component) {
  90680. if (!(component instanceof Component$1)) {
  90681. return;
  90682. }
  90683. this.off(component, "blur", this.boundHandleBlur_);
  90684. this.off(component, ["tap", "click"], this.boundHandleTapClick_);
  90685. };
  90686. _proto.removeChild = function removeChild(component) {
  90687. if (typeof component === "string") {
  90688. component = this.getChild(component);
  90689. }
  90690. this.removeEventListenerForItem(component);
  90691. _Component.prototype.removeChild.call(this, component);
  90692. };
  90693. _proto.addItem = function addItem(component) {
  90694. var childComponent = this.addChild(component);
  90695. if (childComponent) {
  90696. this.addEventListenerForItem(childComponent);
  90697. }
  90698. };
  90699. _proto.createEl = function createEl$12() {
  90700. var contentElType = this.options_.contentElType || "ul";
  90701. this.contentEl_ = createEl(contentElType, {
  90702. className: "vjs-menu-content"
  90703. });
  90704. this.contentEl_.setAttribute("role", "menu");
  90705. var el = _Component.prototype.createEl.call(this, "div", {
  90706. append: this.contentEl_,
  90707. className: "vjs-menu"
  90708. });
  90709. el.appendChild(this.contentEl_);
  90710. on(el, "click", function(event2) {
  90711. event2.preventDefault();
  90712. event2.stopImmediatePropagation();
  90713. });
  90714. return el;
  90715. };
  90716. _proto.dispose = function dispose() {
  90717. this.contentEl_ = null;
  90718. this.boundHandleBlur_ = null;
  90719. this.boundHandleTapClick_ = null;
  90720. _Component.prototype.dispose.call(this);
  90721. };
  90722. _proto.handleBlur = function handleBlur(event2) {
  90723. var relatedTarget = event2.relatedTarget || document_1.activeElement;
  90724. if (!this.children().some(function(element) {
  90725. return element.el() === relatedTarget;
  90726. })) {
  90727. var btn = this.menuButton_;
  90728. if (btn && btn.buttonPressed_ && relatedTarget !== btn.el().firstChild) {
  90729. btn.unpressButton();
  90730. }
  90731. }
  90732. };
  90733. _proto.handleTapClick = function handleTapClick(event2) {
  90734. if (this.menuButton_) {
  90735. this.menuButton_.unpressButton();
  90736. var childComponents = this.children();
  90737. if (!Array.isArray(childComponents)) {
  90738. return;
  90739. }
  90740. var foundComponent = childComponents.filter(function(component) {
  90741. return component.el() === event2.target;
  90742. })[0];
  90743. if (!foundComponent) {
  90744. return;
  90745. }
  90746. if (foundComponent.name() !== "CaptionSettingsMenuItem") {
  90747. this.menuButton_.focus();
  90748. }
  90749. }
  90750. };
  90751. _proto.handleKeyDown = function handleKeyDown(event2) {
  90752. if (keycode.isEventKey(event2, "Left") || keycode.isEventKey(event2, "Down")) {
  90753. event2.preventDefault();
  90754. event2.stopPropagation();
  90755. this.stepForward();
  90756. } else if (keycode.isEventKey(event2, "Right") || keycode.isEventKey(event2, "Up")) {
  90757. event2.preventDefault();
  90758. event2.stopPropagation();
  90759. this.stepBack();
  90760. }
  90761. };
  90762. _proto.stepForward = function stepForward() {
  90763. var stepChild = 0;
  90764. if (this.focusedChild_ !== void 0) {
  90765. stepChild = this.focusedChild_ + 1;
  90766. }
  90767. this.focus(stepChild);
  90768. };
  90769. _proto.stepBack = function stepBack() {
  90770. var stepChild = 0;
  90771. if (this.focusedChild_ !== void 0) {
  90772. stepChild = this.focusedChild_ - 1;
  90773. }
  90774. this.focus(stepChild);
  90775. };
  90776. _proto.focus = function focus(item) {
  90777. if (item === void 0) {
  90778. item = 0;
  90779. }
  90780. var children = this.children().slice();
  90781. var haveTitle = children.length && children[0].hasClass("vjs-menu-title");
  90782. if (haveTitle) {
  90783. children.shift();
  90784. }
  90785. if (children.length > 0) {
  90786. if (item < 0) {
  90787. item = 0;
  90788. } else if (item >= children.length) {
  90789. item = children.length - 1;
  90790. }
  90791. this.focusedChild_ = item;
  90792. children[item].el_.focus();
  90793. }
  90794. };
  90795. return Menu2;
  90796. }(Component$1);
  90797. Component$1.registerComponent("Menu", Menu);
  90798. var MenuButton = /* @__PURE__ */ function(_Component) {
  90799. _inheritsLoose(MenuButton2, _Component);
  90800. function MenuButton2(player, options2) {
  90801. var _this;
  90802. if (options2 === void 0) {
  90803. options2 = {};
  90804. }
  90805. _this = _Component.call(this, player, options2) || this;
  90806. _this.menuButton_ = new Button(player, options2);
  90807. _this.menuButton_.controlText(_this.controlText_);
  90808. _this.menuButton_.el_.setAttribute("aria-haspopup", "true");
  90809. var buttonClass = Button.prototype.buildCSSClass();
  90810. _this.menuButton_.el_.className = _this.buildCSSClass() + " " + buttonClass;
  90811. _this.menuButton_.removeClass("vjs-control");
  90812. _this.addChild(_this.menuButton_);
  90813. _this.update();
  90814. _this.enabled_ = true;
  90815. var handleClick = function handleClick2(e) {
  90816. return _this.handleClick(e);
  90817. };
  90818. _this.handleMenuKeyUp_ = function(e) {
  90819. return _this.handleMenuKeyUp(e);
  90820. };
  90821. _this.on(_this.menuButton_, "tap", handleClick);
  90822. _this.on(_this.menuButton_, "click", handleClick);
  90823. _this.on(_this.menuButton_, "keydown", function(e) {
  90824. return _this.handleKeyDown(e);
  90825. });
  90826. _this.on(_this.menuButton_, "mouseenter", function() {
  90827. _this.addClass("vjs-hover");
  90828. _this.menu.show();
  90829. on(document_1, "keyup", _this.handleMenuKeyUp_);
  90830. });
  90831. _this.on("mouseleave", function(e) {
  90832. return _this.handleMouseLeave(e);
  90833. });
  90834. _this.on("keydown", function(e) {
  90835. return _this.handleSubmenuKeyDown(e);
  90836. });
  90837. return _this;
  90838. }
  90839. var _proto = MenuButton2.prototype;
  90840. _proto.update = function update() {
  90841. var menu = this.createMenu();
  90842. if (this.menu) {
  90843. this.menu.dispose();
  90844. this.removeChild(this.menu);
  90845. }
  90846. this.menu = menu;
  90847. this.addChild(menu);
  90848. this.buttonPressed_ = false;
  90849. this.menuButton_.el_.setAttribute("aria-expanded", "false");
  90850. if (this.items && this.items.length <= this.hideThreshold_) {
  90851. this.hide();
  90852. this.menu.contentEl_.removeAttribute("role");
  90853. } else {
  90854. this.show();
  90855. this.menu.contentEl_.setAttribute("role", "menu");
  90856. }
  90857. };
  90858. _proto.createMenu = function createMenu() {
  90859. var menu = new Menu(this.player_, {
  90860. menuButton: this
  90861. });
  90862. this.hideThreshold_ = 0;
  90863. if (this.options_.title) {
  90864. var titleEl = createEl("li", {
  90865. className: "vjs-menu-title",
  90866. textContent: toTitleCase$1(this.options_.title),
  90867. tabIndex: -1
  90868. });
  90869. var titleComponent = new Component$1(this.player_, {
  90870. el: titleEl
  90871. });
  90872. menu.addItem(titleComponent);
  90873. }
  90874. this.items = this.createItems();
  90875. if (this.items) {
  90876. for (var i2 = 0; i2 < this.items.length; i2++) {
  90877. menu.addItem(this.items[i2]);
  90878. }
  90879. }
  90880. return menu;
  90881. };
  90882. _proto.createItems = function createItems() {
  90883. };
  90884. _proto.createEl = function createEl2() {
  90885. return _Component.prototype.createEl.call(this, "div", {
  90886. className: this.buildWrapperCSSClass()
  90887. }, {});
  90888. };
  90889. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  90890. var menuButtonClass = "vjs-menu-button";
  90891. if (this.options_.inline === true) {
  90892. menuButtonClass += "-inline";
  90893. } else {
  90894. menuButtonClass += "-popup";
  90895. }
  90896. var buttonClass = Button.prototype.buildCSSClass();
  90897. return "vjs-menu-button " + menuButtonClass + " " + buttonClass + " " + _Component.prototype.buildCSSClass.call(this);
  90898. };
  90899. _proto.buildCSSClass = function buildCSSClass() {
  90900. var menuButtonClass = "vjs-menu-button";
  90901. if (this.options_.inline === true) {
  90902. menuButtonClass += "-inline";
  90903. } else {
  90904. menuButtonClass += "-popup";
  90905. }
  90906. return "vjs-menu-button " + menuButtonClass + " " + _Component.prototype.buildCSSClass.call(this);
  90907. };
  90908. _proto.controlText = function controlText(text, el) {
  90909. if (el === void 0) {
  90910. el = this.menuButton_.el();
  90911. }
  90912. return this.menuButton_.controlText(text, el);
  90913. };
  90914. _proto.dispose = function dispose() {
  90915. this.handleMouseLeave();
  90916. _Component.prototype.dispose.call(this);
  90917. };
  90918. _proto.handleClick = function handleClick(event2) {
  90919. if (this.buttonPressed_) {
  90920. this.unpressButton();
  90921. } else {
  90922. this.pressButton();
  90923. }
  90924. };
  90925. _proto.handleMouseLeave = function handleMouseLeave(event2) {
  90926. this.removeClass("vjs-hover");
  90927. off(document_1, "keyup", this.handleMenuKeyUp_);
  90928. };
  90929. _proto.focus = function focus() {
  90930. this.menuButton_.focus();
  90931. };
  90932. _proto.blur = function blur() {
  90933. this.menuButton_.blur();
  90934. };
  90935. _proto.handleKeyDown = function handleKeyDown(event2) {
  90936. if (keycode.isEventKey(event2, "Esc") || keycode.isEventKey(event2, "Tab")) {
  90937. if (this.buttonPressed_) {
  90938. this.unpressButton();
  90939. }
  90940. if (!keycode.isEventKey(event2, "Tab")) {
  90941. event2.preventDefault();
  90942. this.menuButton_.focus();
  90943. }
  90944. } else if (keycode.isEventKey(event2, "Up") || keycode.isEventKey(event2, "Down")) {
  90945. if (!this.buttonPressed_) {
  90946. event2.preventDefault();
  90947. this.pressButton();
  90948. }
  90949. }
  90950. };
  90951. _proto.handleMenuKeyUp = function handleMenuKeyUp(event2) {
  90952. if (keycode.isEventKey(event2, "Esc") || keycode.isEventKey(event2, "Tab")) {
  90953. this.removeClass("vjs-hover");
  90954. }
  90955. };
  90956. _proto.handleSubmenuKeyPress = function handleSubmenuKeyPress(event2) {
  90957. this.handleSubmenuKeyDown(event2);
  90958. };
  90959. _proto.handleSubmenuKeyDown = function handleSubmenuKeyDown(event2) {
  90960. if (keycode.isEventKey(event2, "Esc") || keycode.isEventKey(event2, "Tab")) {
  90961. if (this.buttonPressed_) {
  90962. this.unpressButton();
  90963. }
  90964. if (!keycode.isEventKey(event2, "Tab")) {
  90965. event2.preventDefault();
  90966. this.menuButton_.focus();
  90967. }
  90968. }
  90969. };
  90970. _proto.pressButton = function pressButton() {
  90971. if (this.enabled_) {
  90972. this.buttonPressed_ = true;
  90973. this.menu.show();
  90974. this.menu.lockShowing();
  90975. this.menuButton_.el_.setAttribute("aria-expanded", "true");
  90976. if (IS_IOS && isInFrame()) {
  90977. return;
  90978. }
  90979. this.menu.focus();
  90980. }
  90981. };
  90982. _proto.unpressButton = function unpressButton() {
  90983. if (this.enabled_) {
  90984. this.buttonPressed_ = false;
  90985. this.menu.unlockShowing();
  90986. this.menu.hide();
  90987. this.menuButton_.el_.setAttribute("aria-expanded", "false");
  90988. }
  90989. };
  90990. _proto.disable = function disable() {
  90991. this.unpressButton();
  90992. this.enabled_ = false;
  90993. this.addClass("vjs-disabled");
  90994. this.menuButton_.disable();
  90995. };
  90996. _proto.enable = function enable() {
  90997. this.enabled_ = true;
  90998. this.removeClass("vjs-disabled");
  90999. this.menuButton_.enable();
  91000. };
  91001. return MenuButton2;
  91002. }(Component$1);
  91003. Component$1.registerComponent("MenuButton", MenuButton);
  91004. var TrackButton = /* @__PURE__ */ function(_MenuButton) {
  91005. _inheritsLoose(TrackButton2, _MenuButton);
  91006. function TrackButton2(player, options2) {
  91007. var _this;
  91008. var tracks = options2.tracks;
  91009. _this = _MenuButton.call(this, player, options2) || this;
  91010. if (_this.items.length <= 1) {
  91011. _this.hide();
  91012. }
  91013. if (!tracks) {
  91014. return _assertThisInitialized(_this);
  91015. }
  91016. var updateHandler = bind(_assertThisInitialized(_this), _this.update);
  91017. tracks.addEventListener("removetrack", updateHandler);
  91018. tracks.addEventListener("addtrack", updateHandler);
  91019. tracks.addEventListener("labelchange", updateHandler);
  91020. _this.player_.on("ready", updateHandler);
  91021. _this.player_.on("dispose", function() {
  91022. tracks.removeEventListener("removetrack", updateHandler);
  91023. tracks.removeEventListener("addtrack", updateHandler);
  91024. tracks.removeEventListener("labelchange", updateHandler);
  91025. });
  91026. return _this;
  91027. }
  91028. return TrackButton2;
  91029. }(MenuButton);
  91030. Component$1.registerComponent("TrackButton", TrackButton);
  91031. var MenuKeys = ["Tab", "Esc", "Up", "Down", "Right", "Left"];
  91032. var MenuItem = /* @__PURE__ */ function(_ClickableComponent) {
  91033. _inheritsLoose(MenuItem2, _ClickableComponent);
  91034. function MenuItem2(player, options2) {
  91035. var _this;
  91036. _this = _ClickableComponent.call(this, player, options2) || this;
  91037. _this.selectable = options2.selectable;
  91038. _this.isSelected_ = options2.selected || false;
  91039. _this.multiSelectable = options2.multiSelectable;
  91040. _this.selected(_this.isSelected_);
  91041. if (_this.selectable) {
  91042. if (_this.multiSelectable) {
  91043. _this.el_.setAttribute("role", "menuitemcheckbox");
  91044. } else {
  91045. _this.el_.setAttribute("role", "menuitemradio");
  91046. }
  91047. } else {
  91048. _this.el_.setAttribute("role", "menuitem");
  91049. }
  91050. return _this;
  91051. }
  91052. var _proto = MenuItem2.prototype;
  91053. _proto.createEl = function createEl$12(type2, props, attrs) {
  91054. this.nonIconControl = true;
  91055. var el = _ClickableComponent.prototype.createEl.call(this, "li", assign({
  91056. className: "vjs-menu-item",
  91057. tabIndex: -1
  91058. }, props), attrs);
  91059. el.replaceChild(createEl("span", {
  91060. className: "vjs-menu-item-text",
  91061. textContent: this.localize(this.options_.label)
  91062. }), el.querySelector(".vjs-icon-placeholder"));
  91063. return el;
  91064. };
  91065. _proto.handleKeyDown = function handleKeyDown(event2) {
  91066. if (!MenuKeys.some(function(key) {
  91067. return keycode.isEventKey(event2, key);
  91068. })) {
  91069. _ClickableComponent.prototype.handleKeyDown.call(this, event2);
  91070. }
  91071. };
  91072. _proto.handleClick = function handleClick(event2) {
  91073. this.selected(true);
  91074. };
  91075. _proto.selected = function selected(_selected) {
  91076. if (this.selectable) {
  91077. if (_selected) {
  91078. this.addClass("vjs-selected");
  91079. this.el_.setAttribute("aria-checked", "true");
  91080. this.controlText(", selected");
  91081. this.isSelected_ = true;
  91082. } else {
  91083. this.removeClass("vjs-selected");
  91084. this.el_.setAttribute("aria-checked", "false");
  91085. this.controlText("");
  91086. this.isSelected_ = false;
  91087. }
  91088. }
  91089. };
  91090. return MenuItem2;
  91091. }(ClickableComponent);
  91092. Component$1.registerComponent("MenuItem", MenuItem);
  91093. var TextTrackMenuItem = /* @__PURE__ */ function(_MenuItem) {
  91094. _inheritsLoose(TextTrackMenuItem2, _MenuItem);
  91095. function TextTrackMenuItem2(player, options2) {
  91096. var _this;
  91097. var track = options2.track;
  91098. var tracks = player.textTracks();
  91099. options2.label = track.label || track.language || "Unknown";
  91100. options2.selected = track.mode === "showing";
  91101. _this = _MenuItem.call(this, player, options2) || this;
  91102. _this.track = track;
  91103. _this.kinds = (options2.kinds || [options2.kind || _this.track.kind]).filter(Boolean);
  91104. var changeHandler = function changeHandler2() {
  91105. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  91106. args[_key] = arguments[_key];
  91107. }
  91108. _this.handleTracksChange.apply(_assertThisInitialized(_this), args);
  91109. };
  91110. var selectedLanguageChangeHandler = function selectedLanguageChangeHandler2() {
  91111. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  91112. args[_key2] = arguments[_key2];
  91113. }
  91114. _this.handleSelectedLanguageChange.apply(_assertThisInitialized(_this), args);
  91115. };
  91116. player.on(["loadstart", "texttrackchange"], changeHandler);
  91117. tracks.addEventListener("change", changeHandler);
  91118. tracks.addEventListener("selectedlanguagechange", selectedLanguageChangeHandler);
  91119. _this.on("dispose", function() {
  91120. player.off(["loadstart", "texttrackchange"], changeHandler);
  91121. tracks.removeEventListener("change", changeHandler);
  91122. tracks.removeEventListener("selectedlanguagechange", selectedLanguageChangeHandler);
  91123. });
  91124. if (tracks.onchange === void 0) {
  91125. var event2;
  91126. _this.on(["tap", "click"], function() {
  91127. if (typeof window_1.Event !== "object") {
  91128. try {
  91129. event2 = new window_1.Event("change");
  91130. } catch (err) {
  91131. }
  91132. }
  91133. if (!event2) {
  91134. event2 = document_1.createEvent("Event");
  91135. event2.initEvent("change", true, true);
  91136. }
  91137. tracks.dispatchEvent(event2);
  91138. });
  91139. }
  91140. _this.handleTracksChange();
  91141. return _this;
  91142. }
  91143. var _proto = TextTrackMenuItem2.prototype;
  91144. _proto.handleClick = function handleClick(event2) {
  91145. var referenceTrack = this.track;
  91146. var tracks = this.player_.textTracks();
  91147. _MenuItem.prototype.handleClick.call(this, event2);
  91148. if (!tracks) {
  91149. return;
  91150. }
  91151. for (var i2 = 0; i2 < tracks.length; i2++) {
  91152. var track = tracks[i2];
  91153. if (this.kinds.indexOf(track.kind) === -1) {
  91154. continue;
  91155. }
  91156. if (track === referenceTrack) {
  91157. if (track.mode !== "showing") {
  91158. track.mode = "showing";
  91159. }
  91160. } else if (track.mode !== "disabled") {
  91161. track.mode = "disabled";
  91162. }
  91163. }
  91164. };
  91165. _proto.handleTracksChange = function handleTracksChange(event2) {
  91166. var shouldBeSelected = this.track.mode === "showing";
  91167. if (shouldBeSelected !== this.isSelected_) {
  91168. this.selected(shouldBeSelected);
  91169. }
  91170. };
  91171. _proto.handleSelectedLanguageChange = function handleSelectedLanguageChange(event2) {
  91172. if (this.track.mode === "showing") {
  91173. var selectedLanguage = this.player_.cache_.selectedLanguage;
  91174. if (selectedLanguage && selectedLanguage.enabled && selectedLanguage.language === this.track.language && selectedLanguage.kind !== this.track.kind) {
  91175. return;
  91176. }
  91177. this.player_.cache_.selectedLanguage = {
  91178. enabled: true,
  91179. language: this.track.language,
  91180. kind: this.track.kind
  91181. };
  91182. }
  91183. };
  91184. _proto.dispose = function dispose() {
  91185. this.track = null;
  91186. _MenuItem.prototype.dispose.call(this);
  91187. };
  91188. return TextTrackMenuItem2;
  91189. }(MenuItem);
  91190. Component$1.registerComponent("TextTrackMenuItem", TextTrackMenuItem);
  91191. var OffTextTrackMenuItem = /* @__PURE__ */ function(_TextTrackMenuItem) {
  91192. _inheritsLoose(OffTextTrackMenuItem2, _TextTrackMenuItem);
  91193. function OffTextTrackMenuItem2(player, options2) {
  91194. options2.track = {
  91195. player,
  91196. kind: options2.kind,
  91197. kinds: options2.kinds,
  91198. "default": false,
  91199. mode: "disabled"
  91200. };
  91201. if (!options2.kinds) {
  91202. options2.kinds = [options2.kind];
  91203. }
  91204. if (options2.label) {
  91205. options2.track.label = options2.label;
  91206. } else {
  91207. options2.track.label = options2.kinds.join(" and ") + " off";
  91208. }
  91209. options2.selectable = true;
  91210. options2.multiSelectable = false;
  91211. return _TextTrackMenuItem.call(this, player, options2) || this;
  91212. }
  91213. var _proto = OffTextTrackMenuItem2.prototype;
  91214. _proto.handleTracksChange = function handleTracksChange(event2) {
  91215. var tracks = this.player().textTracks();
  91216. var shouldBeSelected = true;
  91217. for (var i2 = 0, l = tracks.length; i2 < l; i2++) {
  91218. var track = tracks[i2];
  91219. if (this.options_.kinds.indexOf(track.kind) > -1 && track.mode === "showing") {
  91220. shouldBeSelected = false;
  91221. break;
  91222. }
  91223. }
  91224. if (shouldBeSelected !== this.isSelected_) {
  91225. this.selected(shouldBeSelected);
  91226. }
  91227. };
  91228. _proto.handleSelectedLanguageChange = function handleSelectedLanguageChange(event2) {
  91229. var tracks = this.player().textTracks();
  91230. var allHidden = true;
  91231. for (var i2 = 0, l = tracks.length; i2 < l; i2++) {
  91232. var track = tracks[i2];
  91233. if (["captions", "descriptions", "subtitles"].indexOf(track.kind) > -1 && track.mode === "showing") {
  91234. allHidden = false;
  91235. break;
  91236. }
  91237. }
  91238. if (allHidden) {
  91239. this.player_.cache_.selectedLanguage = {
  91240. enabled: false
  91241. };
  91242. }
  91243. };
  91244. return OffTextTrackMenuItem2;
  91245. }(TextTrackMenuItem);
  91246. Component$1.registerComponent("OffTextTrackMenuItem", OffTextTrackMenuItem);
  91247. var TextTrackButton = /* @__PURE__ */ function(_TrackButton) {
  91248. _inheritsLoose(TextTrackButton2, _TrackButton);
  91249. function TextTrackButton2(player, options2) {
  91250. if (options2 === void 0) {
  91251. options2 = {};
  91252. }
  91253. options2.tracks = player.textTracks();
  91254. return _TrackButton.call(this, player, options2) || this;
  91255. }
  91256. var _proto = TextTrackButton2.prototype;
  91257. _proto.createItems = function createItems(items, TrackMenuItem) {
  91258. if (items === void 0) {
  91259. items = [];
  91260. }
  91261. if (TrackMenuItem === void 0) {
  91262. TrackMenuItem = TextTrackMenuItem;
  91263. }
  91264. var label2;
  91265. if (this.label_) {
  91266. label2 = this.label_ + " off";
  91267. }
  91268. items.push(new OffTextTrackMenuItem(this.player_, {
  91269. kinds: this.kinds_,
  91270. kind: this.kind_,
  91271. label: label2
  91272. }));
  91273. this.hideThreshold_ += 1;
  91274. var tracks = this.player_.textTracks();
  91275. if (!Array.isArray(this.kinds_)) {
  91276. this.kinds_ = [this.kind_];
  91277. }
  91278. for (var i2 = 0; i2 < tracks.length; i2++) {
  91279. var track = tracks[i2];
  91280. if (this.kinds_.indexOf(track.kind) > -1) {
  91281. var item = new TrackMenuItem(this.player_, {
  91282. track,
  91283. kinds: this.kinds_,
  91284. kind: this.kind_,
  91285. selectable: true,
  91286. multiSelectable: false
  91287. });
  91288. item.addClass("vjs-" + track.kind + "-menu-item");
  91289. items.push(item);
  91290. }
  91291. }
  91292. return items;
  91293. };
  91294. return TextTrackButton2;
  91295. }(TrackButton);
  91296. Component$1.registerComponent("TextTrackButton", TextTrackButton);
  91297. var ChaptersTrackMenuItem = /* @__PURE__ */ function(_MenuItem) {
  91298. _inheritsLoose(ChaptersTrackMenuItem2, _MenuItem);
  91299. function ChaptersTrackMenuItem2(player, options2) {
  91300. var _this;
  91301. var track = options2.track;
  91302. var cue = options2.cue;
  91303. var currentTime = player.currentTime();
  91304. options2.selectable = true;
  91305. options2.multiSelectable = false;
  91306. options2.label = cue.text;
  91307. options2.selected = cue.startTime <= currentTime && currentTime < cue.endTime;
  91308. _this = _MenuItem.call(this, player, options2) || this;
  91309. _this.track = track;
  91310. _this.cue = cue;
  91311. return _this;
  91312. }
  91313. var _proto = ChaptersTrackMenuItem2.prototype;
  91314. _proto.handleClick = function handleClick(event2) {
  91315. _MenuItem.prototype.handleClick.call(this);
  91316. this.player_.currentTime(this.cue.startTime);
  91317. };
  91318. return ChaptersTrackMenuItem2;
  91319. }(MenuItem);
  91320. Component$1.registerComponent("ChaptersTrackMenuItem", ChaptersTrackMenuItem);
  91321. var ChaptersButton = /* @__PURE__ */ function(_TextTrackButton) {
  91322. _inheritsLoose(ChaptersButton2, _TextTrackButton);
  91323. function ChaptersButton2(player, options2, ready) {
  91324. var _this;
  91325. _this = _TextTrackButton.call(this, player, options2, ready) || this;
  91326. _this.selectCurrentItem_ = function() {
  91327. _this.items.forEach(function(item) {
  91328. item.selected(_this.track_.activeCues[0] === item.cue);
  91329. });
  91330. };
  91331. return _this;
  91332. }
  91333. var _proto = ChaptersButton2.prototype;
  91334. _proto.buildCSSClass = function buildCSSClass() {
  91335. return "vjs-chapters-button " + _TextTrackButton.prototype.buildCSSClass.call(this);
  91336. };
  91337. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91338. return "vjs-chapters-button " + _TextTrackButton.prototype.buildWrapperCSSClass.call(this);
  91339. };
  91340. _proto.update = function update(event2) {
  91341. if (event2 && event2.track && event2.track.kind !== "chapters") {
  91342. return;
  91343. }
  91344. var track = this.findChaptersTrack();
  91345. if (track !== this.track_) {
  91346. this.setTrack(track);
  91347. _TextTrackButton.prototype.update.call(this);
  91348. } else if (!this.items || track && track.cues && track.cues.length !== this.items.length) {
  91349. _TextTrackButton.prototype.update.call(this);
  91350. }
  91351. };
  91352. _proto.setTrack = function setTrack(track) {
  91353. if (this.track_ === track) {
  91354. return;
  91355. }
  91356. if (!this.updateHandler_) {
  91357. this.updateHandler_ = this.update.bind(this);
  91358. }
  91359. if (this.track_) {
  91360. var remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);
  91361. if (remoteTextTrackEl) {
  91362. remoteTextTrackEl.removeEventListener("load", this.updateHandler_);
  91363. }
  91364. this.track_.removeEventListener("cuechange", this.selectCurrentItem_);
  91365. this.track_ = null;
  91366. }
  91367. this.track_ = track;
  91368. if (this.track_) {
  91369. this.track_.mode = "hidden";
  91370. var _remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);
  91371. if (_remoteTextTrackEl) {
  91372. _remoteTextTrackEl.addEventListener("load", this.updateHandler_);
  91373. }
  91374. this.track_.addEventListener("cuechange", this.selectCurrentItem_);
  91375. }
  91376. };
  91377. _proto.findChaptersTrack = function findChaptersTrack() {
  91378. var tracks = this.player_.textTracks() || [];
  91379. for (var i2 = tracks.length - 1; i2 >= 0; i2--) {
  91380. var track = tracks[i2];
  91381. if (track.kind === this.kind_) {
  91382. return track;
  91383. }
  91384. }
  91385. };
  91386. _proto.getMenuCaption = function getMenuCaption() {
  91387. if (this.track_ && this.track_.label) {
  91388. return this.track_.label;
  91389. }
  91390. return this.localize(toTitleCase$1(this.kind_));
  91391. };
  91392. _proto.createMenu = function createMenu() {
  91393. this.options_.title = this.getMenuCaption();
  91394. return _TextTrackButton.prototype.createMenu.call(this);
  91395. };
  91396. _proto.createItems = function createItems() {
  91397. var items = [];
  91398. if (!this.track_) {
  91399. return items;
  91400. }
  91401. var cues = this.track_.cues;
  91402. if (!cues) {
  91403. return items;
  91404. }
  91405. for (var i2 = 0, l = cues.length; i2 < l; i2++) {
  91406. var cue = cues[i2];
  91407. var mi = new ChaptersTrackMenuItem(this.player_, {
  91408. track: this.track_,
  91409. cue
  91410. });
  91411. items.push(mi);
  91412. }
  91413. return items;
  91414. };
  91415. return ChaptersButton2;
  91416. }(TextTrackButton);
  91417. ChaptersButton.prototype.kind_ = "chapters";
  91418. ChaptersButton.prototype.controlText_ = "Chapters";
  91419. Component$1.registerComponent("ChaptersButton", ChaptersButton);
  91420. var DescriptionsButton = /* @__PURE__ */ function(_TextTrackButton) {
  91421. _inheritsLoose(DescriptionsButton2, _TextTrackButton);
  91422. function DescriptionsButton2(player, options2, ready) {
  91423. var _this;
  91424. _this = _TextTrackButton.call(this, player, options2, ready) || this;
  91425. var tracks = player.textTracks();
  91426. var changeHandler = bind(_assertThisInitialized(_this), _this.handleTracksChange);
  91427. tracks.addEventListener("change", changeHandler);
  91428. _this.on("dispose", function() {
  91429. tracks.removeEventListener("change", changeHandler);
  91430. });
  91431. return _this;
  91432. }
  91433. var _proto = DescriptionsButton2.prototype;
  91434. _proto.handleTracksChange = function handleTracksChange(event2) {
  91435. var tracks = this.player().textTracks();
  91436. var disabled = false;
  91437. for (var i2 = 0, l = tracks.length; i2 < l; i2++) {
  91438. var track = tracks[i2];
  91439. if (track.kind !== this.kind_ && track.mode === "showing") {
  91440. disabled = true;
  91441. break;
  91442. }
  91443. }
  91444. if (disabled) {
  91445. this.disable();
  91446. } else {
  91447. this.enable();
  91448. }
  91449. };
  91450. _proto.buildCSSClass = function buildCSSClass() {
  91451. return "vjs-descriptions-button " + _TextTrackButton.prototype.buildCSSClass.call(this);
  91452. };
  91453. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91454. return "vjs-descriptions-button " + _TextTrackButton.prototype.buildWrapperCSSClass.call(this);
  91455. };
  91456. return DescriptionsButton2;
  91457. }(TextTrackButton);
  91458. DescriptionsButton.prototype.kind_ = "descriptions";
  91459. DescriptionsButton.prototype.controlText_ = "Descriptions";
  91460. Component$1.registerComponent("DescriptionsButton", DescriptionsButton);
  91461. var SubtitlesButton = /* @__PURE__ */ function(_TextTrackButton) {
  91462. _inheritsLoose(SubtitlesButton2, _TextTrackButton);
  91463. function SubtitlesButton2(player, options2, ready) {
  91464. return _TextTrackButton.call(this, player, options2, ready) || this;
  91465. }
  91466. var _proto = SubtitlesButton2.prototype;
  91467. _proto.buildCSSClass = function buildCSSClass() {
  91468. return "vjs-subtitles-button " + _TextTrackButton.prototype.buildCSSClass.call(this);
  91469. };
  91470. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91471. return "vjs-subtitles-button " + _TextTrackButton.prototype.buildWrapperCSSClass.call(this);
  91472. };
  91473. return SubtitlesButton2;
  91474. }(TextTrackButton);
  91475. SubtitlesButton.prototype.kind_ = "subtitles";
  91476. SubtitlesButton.prototype.controlText_ = "Subtitles";
  91477. Component$1.registerComponent("SubtitlesButton", SubtitlesButton);
  91478. var CaptionSettingsMenuItem = /* @__PURE__ */ function(_TextTrackMenuItem) {
  91479. _inheritsLoose(CaptionSettingsMenuItem2, _TextTrackMenuItem);
  91480. function CaptionSettingsMenuItem2(player, options2) {
  91481. var _this;
  91482. options2.track = {
  91483. player,
  91484. kind: options2.kind,
  91485. label: options2.kind + " settings",
  91486. selectable: false,
  91487. "default": false,
  91488. mode: "disabled"
  91489. };
  91490. options2.selectable = false;
  91491. options2.name = "CaptionSettingsMenuItem";
  91492. _this = _TextTrackMenuItem.call(this, player, options2) || this;
  91493. _this.addClass("vjs-texttrack-settings");
  91494. _this.controlText(", opens " + options2.kind + " settings dialog");
  91495. return _this;
  91496. }
  91497. var _proto = CaptionSettingsMenuItem2.prototype;
  91498. _proto.handleClick = function handleClick(event2) {
  91499. this.player().getChild("textTrackSettings").open();
  91500. };
  91501. return CaptionSettingsMenuItem2;
  91502. }(TextTrackMenuItem);
  91503. Component$1.registerComponent("CaptionSettingsMenuItem", CaptionSettingsMenuItem);
  91504. var CaptionsButton = /* @__PURE__ */ function(_TextTrackButton) {
  91505. _inheritsLoose(CaptionsButton2, _TextTrackButton);
  91506. function CaptionsButton2(player, options2, ready) {
  91507. return _TextTrackButton.call(this, player, options2, ready) || this;
  91508. }
  91509. var _proto = CaptionsButton2.prototype;
  91510. _proto.buildCSSClass = function buildCSSClass() {
  91511. return "vjs-captions-button " + _TextTrackButton.prototype.buildCSSClass.call(this);
  91512. };
  91513. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91514. return "vjs-captions-button " + _TextTrackButton.prototype.buildWrapperCSSClass.call(this);
  91515. };
  91516. _proto.createItems = function createItems() {
  91517. var items = [];
  91518. if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks) && this.player().getChild("textTrackSettings")) {
  91519. items.push(new CaptionSettingsMenuItem(this.player_, {
  91520. kind: this.kind_
  91521. }));
  91522. this.hideThreshold_ += 1;
  91523. }
  91524. return _TextTrackButton.prototype.createItems.call(this, items);
  91525. };
  91526. return CaptionsButton2;
  91527. }(TextTrackButton);
  91528. CaptionsButton.prototype.kind_ = "captions";
  91529. CaptionsButton.prototype.controlText_ = "Captions";
  91530. Component$1.registerComponent("CaptionsButton", CaptionsButton);
  91531. var SubsCapsMenuItem = /* @__PURE__ */ function(_TextTrackMenuItem) {
  91532. _inheritsLoose(SubsCapsMenuItem2, _TextTrackMenuItem);
  91533. function SubsCapsMenuItem2() {
  91534. return _TextTrackMenuItem.apply(this, arguments) || this;
  91535. }
  91536. var _proto = SubsCapsMenuItem2.prototype;
  91537. _proto.createEl = function createEl$12(type2, props, attrs) {
  91538. var el = _TextTrackMenuItem.prototype.createEl.call(this, type2, props, attrs);
  91539. var parentSpan = el.querySelector(".vjs-menu-item-text");
  91540. if (this.options_.track.kind === "captions") {
  91541. parentSpan.appendChild(createEl("span", {
  91542. className: "vjs-icon-placeholder"
  91543. }, {
  91544. "aria-hidden": true
  91545. }));
  91546. parentSpan.appendChild(createEl("span", {
  91547. className: "vjs-control-text",
  91548. textContent: " " + this.localize("Captions")
  91549. }));
  91550. }
  91551. return el;
  91552. };
  91553. return SubsCapsMenuItem2;
  91554. }(TextTrackMenuItem);
  91555. Component$1.registerComponent("SubsCapsMenuItem", SubsCapsMenuItem);
  91556. var SubsCapsButton = /* @__PURE__ */ function(_TextTrackButton) {
  91557. _inheritsLoose(SubsCapsButton2, _TextTrackButton);
  91558. function SubsCapsButton2(player, options2) {
  91559. var _this;
  91560. if (options2 === void 0) {
  91561. options2 = {};
  91562. }
  91563. _this = _TextTrackButton.call(this, player, options2) || this;
  91564. _this.label_ = "subtitles";
  91565. if (["en", "en-us", "en-ca", "fr-ca"].indexOf(_this.player_.language_) > -1) {
  91566. _this.label_ = "captions";
  91567. }
  91568. _this.menuButton_.controlText(toTitleCase$1(_this.label_));
  91569. return _this;
  91570. }
  91571. var _proto = SubsCapsButton2.prototype;
  91572. _proto.buildCSSClass = function buildCSSClass() {
  91573. return "vjs-subs-caps-button " + _TextTrackButton.prototype.buildCSSClass.call(this);
  91574. };
  91575. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91576. return "vjs-subs-caps-button " + _TextTrackButton.prototype.buildWrapperCSSClass.call(this);
  91577. };
  91578. _proto.createItems = function createItems() {
  91579. var items = [];
  91580. if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks) && this.player().getChild("textTrackSettings")) {
  91581. items.push(new CaptionSettingsMenuItem(this.player_, {
  91582. kind: this.label_
  91583. }));
  91584. this.hideThreshold_ += 1;
  91585. }
  91586. items = _TextTrackButton.prototype.createItems.call(this, items, SubsCapsMenuItem);
  91587. return items;
  91588. };
  91589. return SubsCapsButton2;
  91590. }(TextTrackButton);
  91591. SubsCapsButton.prototype.kinds_ = ["captions", "subtitles"];
  91592. SubsCapsButton.prototype.controlText_ = "Subtitles";
  91593. Component$1.registerComponent("SubsCapsButton", SubsCapsButton);
  91594. var AudioTrackMenuItem = /* @__PURE__ */ function(_MenuItem) {
  91595. _inheritsLoose(AudioTrackMenuItem2, _MenuItem);
  91596. function AudioTrackMenuItem2(player, options2) {
  91597. var _this;
  91598. var track = options2.track;
  91599. var tracks = player.audioTracks();
  91600. options2.label = track.label || track.language || "Unknown";
  91601. options2.selected = track.enabled;
  91602. _this = _MenuItem.call(this, player, options2) || this;
  91603. _this.track = track;
  91604. _this.addClass("vjs-" + track.kind + "-menu-item");
  91605. var changeHandler = function changeHandler2() {
  91606. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  91607. args[_key] = arguments[_key];
  91608. }
  91609. _this.handleTracksChange.apply(_assertThisInitialized(_this), args);
  91610. };
  91611. tracks.addEventListener("change", changeHandler);
  91612. _this.on("dispose", function() {
  91613. tracks.removeEventListener("change", changeHandler);
  91614. });
  91615. return _this;
  91616. }
  91617. var _proto = AudioTrackMenuItem2.prototype;
  91618. _proto.createEl = function createEl$12(type2, props, attrs) {
  91619. var el = _MenuItem.prototype.createEl.call(this, type2, props, attrs);
  91620. var parentSpan = el.querySelector(".vjs-menu-item-text");
  91621. if (this.options_.track.kind === "main-desc") {
  91622. parentSpan.appendChild(createEl("span", {
  91623. className: "vjs-icon-placeholder"
  91624. }, {
  91625. "aria-hidden": true
  91626. }));
  91627. parentSpan.appendChild(createEl("span", {
  91628. className: "vjs-control-text",
  91629. textContent: " " + this.localize("Descriptions")
  91630. }));
  91631. }
  91632. return el;
  91633. };
  91634. _proto.handleClick = function handleClick(event2) {
  91635. _MenuItem.prototype.handleClick.call(this, event2);
  91636. this.track.enabled = true;
  91637. if (this.player_.tech_.featuresNativeAudioTracks) {
  91638. var tracks = this.player_.audioTracks();
  91639. for (var i2 = 0; i2 < tracks.length; i2++) {
  91640. var track = tracks[i2];
  91641. if (track === this.track) {
  91642. continue;
  91643. }
  91644. track.enabled = track === this.track;
  91645. }
  91646. }
  91647. };
  91648. _proto.handleTracksChange = function handleTracksChange(event2) {
  91649. this.selected(this.track.enabled);
  91650. };
  91651. return AudioTrackMenuItem2;
  91652. }(MenuItem);
  91653. Component$1.registerComponent("AudioTrackMenuItem", AudioTrackMenuItem);
  91654. var AudioTrackButton = /* @__PURE__ */ function(_TrackButton) {
  91655. _inheritsLoose(AudioTrackButton2, _TrackButton);
  91656. function AudioTrackButton2(player, options2) {
  91657. if (options2 === void 0) {
  91658. options2 = {};
  91659. }
  91660. options2.tracks = player.audioTracks();
  91661. return _TrackButton.call(this, player, options2) || this;
  91662. }
  91663. var _proto = AudioTrackButton2.prototype;
  91664. _proto.buildCSSClass = function buildCSSClass() {
  91665. return "vjs-audio-button " + _TrackButton.prototype.buildCSSClass.call(this);
  91666. };
  91667. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91668. return "vjs-audio-button " + _TrackButton.prototype.buildWrapperCSSClass.call(this);
  91669. };
  91670. _proto.createItems = function createItems(items) {
  91671. if (items === void 0) {
  91672. items = [];
  91673. }
  91674. this.hideThreshold_ = 1;
  91675. var tracks = this.player_.audioTracks();
  91676. for (var i2 = 0; i2 < tracks.length; i2++) {
  91677. var track = tracks[i2];
  91678. items.push(new AudioTrackMenuItem(this.player_, {
  91679. track,
  91680. selectable: true,
  91681. multiSelectable: false
  91682. }));
  91683. }
  91684. return items;
  91685. };
  91686. return AudioTrackButton2;
  91687. }(TrackButton);
  91688. AudioTrackButton.prototype.controlText_ = "Audio Track";
  91689. Component$1.registerComponent("AudioTrackButton", AudioTrackButton);
  91690. var PlaybackRateMenuItem = /* @__PURE__ */ function(_MenuItem) {
  91691. _inheritsLoose(PlaybackRateMenuItem2, _MenuItem);
  91692. function PlaybackRateMenuItem2(player, options2) {
  91693. var _this;
  91694. var label2 = options2.rate;
  91695. var rate = parseFloat(label2, 10);
  91696. options2.label = label2;
  91697. options2.selected = rate === player.playbackRate();
  91698. options2.selectable = true;
  91699. options2.multiSelectable = false;
  91700. _this = _MenuItem.call(this, player, options2) || this;
  91701. _this.label = label2;
  91702. _this.rate = rate;
  91703. _this.on(player, "ratechange", function(e) {
  91704. return _this.update(e);
  91705. });
  91706. return _this;
  91707. }
  91708. var _proto = PlaybackRateMenuItem2.prototype;
  91709. _proto.handleClick = function handleClick(event2) {
  91710. _MenuItem.prototype.handleClick.call(this);
  91711. this.player().playbackRate(this.rate);
  91712. };
  91713. _proto.update = function update(event2) {
  91714. this.selected(this.player().playbackRate() === this.rate);
  91715. };
  91716. return PlaybackRateMenuItem2;
  91717. }(MenuItem);
  91718. PlaybackRateMenuItem.prototype.contentElType = "button";
  91719. Component$1.registerComponent("PlaybackRateMenuItem", PlaybackRateMenuItem);
  91720. var PlaybackRateMenuButton = /* @__PURE__ */ function(_MenuButton) {
  91721. _inheritsLoose(PlaybackRateMenuButton2, _MenuButton);
  91722. function PlaybackRateMenuButton2(player, options2) {
  91723. var _this;
  91724. _this = _MenuButton.call(this, player, options2) || this;
  91725. _this.menuButton_.el_.setAttribute("aria-describedby", _this.labelElId_);
  91726. _this.updateVisibility();
  91727. _this.updateLabel();
  91728. _this.on(player, "loadstart", function(e) {
  91729. return _this.updateVisibility(e);
  91730. });
  91731. _this.on(player, "ratechange", function(e) {
  91732. return _this.updateLabel(e);
  91733. });
  91734. _this.on(player, "playbackrateschange", function(e) {
  91735. return _this.handlePlaybackRateschange(e);
  91736. });
  91737. return _this;
  91738. }
  91739. var _proto = PlaybackRateMenuButton2.prototype;
  91740. _proto.createEl = function createEl$12() {
  91741. var el = _MenuButton.prototype.createEl.call(this);
  91742. this.labelElId_ = "vjs-playback-rate-value-label-" + this.id_;
  91743. this.labelEl_ = createEl("div", {
  91744. className: "vjs-playback-rate-value",
  91745. id: this.labelElId_,
  91746. textContent: "1x"
  91747. });
  91748. el.appendChild(this.labelEl_);
  91749. return el;
  91750. };
  91751. _proto.dispose = function dispose() {
  91752. this.labelEl_ = null;
  91753. _MenuButton.prototype.dispose.call(this);
  91754. };
  91755. _proto.buildCSSClass = function buildCSSClass() {
  91756. return "vjs-playback-rate " + _MenuButton.prototype.buildCSSClass.call(this);
  91757. };
  91758. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91759. return "vjs-playback-rate " + _MenuButton.prototype.buildWrapperCSSClass.call(this);
  91760. };
  91761. _proto.createItems = function createItems() {
  91762. var rates = this.playbackRates();
  91763. var items = [];
  91764. for (var i2 = rates.length - 1; i2 >= 0; i2--) {
  91765. items.push(new PlaybackRateMenuItem(this.player(), {
  91766. rate: rates[i2] + "x"
  91767. }));
  91768. }
  91769. return items;
  91770. };
  91771. _proto.updateARIAAttributes = function updateARIAAttributes() {
  91772. this.el().setAttribute("aria-valuenow", this.player().playbackRate());
  91773. };
  91774. _proto.handleClick = function handleClick(event2) {
  91775. var currentRate = this.player().playbackRate();
  91776. var rates = this.playbackRates();
  91777. var currentIndex = rates.indexOf(currentRate);
  91778. var newIndex = (currentIndex + 1) % rates.length;
  91779. this.player().playbackRate(rates[newIndex]);
  91780. };
  91781. _proto.handlePlaybackRateschange = function handlePlaybackRateschange(event2) {
  91782. this.update();
  91783. };
  91784. _proto.playbackRates = function playbackRates() {
  91785. var player = this.player();
  91786. return player.playbackRates && player.playbackRates() || [];
  91787. };
  91788. _proto.playbackRateSupported = function playbackRateSupported() {
  91789. return this.player().tech_ && this.player().tech_.featuresPlaybackRate && this.playbackRates() && this.playbackRates().length > 0;
  91790. };
  91791. _proto.updateVisibility = function updateVisibility(event2) {
  91792. if (this.playbackRateSupported()) {
  91793. this.removeClass("vjs-hidden");
  91794. } else {
  91795. this.addClass("vjs-hidden");
  91796. }
  91797. };
  91798. _proto.updateLabel = function updateLabel(event2) {
  91799. if (this.playbackRateSupported()) {
  91800. this.labelEl_.textContent = this.player().playbackRate() + "x";
  91801. }
  91802. };
  91803. return PlaybackRateMenuButton2;
  91804. }(MenuButton);
  91805. PlaybackRateMenuButton.prototype.controlText_ = "Playback Rate";
  91806. Component$1.registerComponent("PlaybackRateMenuButton", PlaybackRateMenuButton);
  91807. var Spacer = /* @__PURE__ */ function(_Component) {
  91808. _inheritsLoose(Spacer2, _Component);
  91809. function Spacer2() {
  91810. return _Component.apply(this, arguments) || this;
  91811. }
  91812. var _proto = Spacer2.prototype;
  91813. _proto.buildCSSClass = function buildCSSClass() {
  91814. return "vjs-spacer " + _Component.prototype.buildCSSClass.call(this);
  91815. };
  91816. _proto.createEl = function createEl2(tag, props, attributes) {
  91817. if (tag === void 0) {
  91818. tag = "div";
  91819. }
  91820. if (props === void 0) {
  91821. props = {};
  91822. }
  91823. if (attributes === void 0) {
  91824. attributes = {};
  91825. }
  91826. if (!props.className) {
  91827. props.className = this.buildCSSClass();
  91828. }
  91829. return _Component.prototype.createEl.call(this, tag, props, attributes);
  91830. };
  91831. return Spacer2;
  91832. }(Component$1);
  91833. Component$1.registerComponent("Spacer", Spacer);
  91834. var CustomControlSpacer = /* @__PURE__ */ function(_Spacer) {
  91835. _inheritsLoose(CustomControlSpacer2, _Spacer);
  91836. function CustomControlSpacer2() {
  91837. return _Spacer.apply(this, arguments) || this;
  91838. }
  91839. var _proto = CustomControlSpacer2.prototype;
  91840. _proto.buildCSSClass = function buildCSSClass() {
  91841. return "vjs-custom-control-spacer " + _Spacer.prototype.buildCSSClass.call(this);
  91842. };
  91843. _proto.createEl = function createEl2() {
  91844. return _Spacer.prototype.createEl.call(this, "div", {
  91845. className: this.buildCSSClass(),
  91846. textContent: "\xA0"
  91847. });
  91848. };
  91849. return CustomControlSpacer2;
  91850. }(Spacer);
  91851. Component$1.registerComponent("CustomControlSpacer", CustomControlSpacer);
  91852. var ControlBar = /* @__PURE__ */ function(_Component) {
  91853. _inheritsLoose(ControlBar2, _Component);
  91854. function ControlBar2() {
  91855. return _Component.apply(this, arguments) || this;
  91856. }
  91857. var _proto = ControlBar2.prototype;
  91858. _proto.createEl = function createEl2() {
  91859. return _Component.prototype.createEl.call(this, "div", {
  91860. className: "vjs-control-bar",
  91861. dir: "ltr"
  91862. });
  91863. };
  91864. return ControlBar2;
  91865. }(Component$1);
  91866. ControlBar.prototype.options_ = {
  91867. children: ["playToggle", "volumePanel", "currentTimeDisplay", "timeDivider", "durationDisplay", "progressControl", "liveDisplay", "seekToLive", "remainingTimeDisplay", "customControlSpacer", "playbackRateMenuButton", "chaptersButton", "descriptionsButton", "subsCapsButton", "audioTrackButton", "fullscreenToggle"]
  91868. };
  91869. if ("exitPictureInPicture" in document_1) {
  91870. ControlBar.prototype.options_.children.splice(ControlBar.prototype.options_.children.length - 1, 0, "pictureInPictureToggle");
  91871. }
  91872. Component$1.registerComponent("ControlBar", ControlBar);
  91873. var ErrorDisplay = /* @__PURE__ */ function(_ModalDialog) {
  91874. _inheritsLoose(ErrorDisplay2, _ModalDialog);
  91875. function ErrorDisplay2(player, options2) {
  91876. var _this;
  91877. _this = _ModalDialog.call(this, player, options2) || this;
  91878. _this.on(player, "error", function(e) {
  91879. return _this.open(e);
  91880. });
  91881. return _this;
  91882. }
  91883. var _proto = ErrorDisplay2.prototype;
  91884. _proto.buildCSSClass = function buildCSSClass() {
  91885. return "vjs-error-display " + _ModalDialog.prototype.buildCSSClass.call(this);
  91886. };
  91887. _proto.content = function content() {
  91888. var error = this.player().error();
  91889. return error ? this.localize(error.message) : "";
  91890. };
  91891. return ErrorDisplay2;
  91892. }(ModalDialog);
  91893. ErrorDisplay.prototype.options_ = _extends$2({}, ModalDialog.prototype.options_, {
  91894. pauseOnOpen: false,
  91895. fillAlways: true,
  91896. temporary: false,
  91897. uncloseable: true
  91898. });
  91899. Component$1.registerComponent("ErrorDisplay", ErrorDisplay);
  91900. var LOCAL_STORAGE_KEY$1 = "vjs-text-track-settings";
  91901. var COLOR_BLACK = ["#000", "Black"];
  91902. var COLOR_BLUE = ["#00F", "Blue"];
  91903. var COLOR_CYAN = ["#0FF", "Cyan"];
  91904. var COLOR_GREEN = ["#0F0", "Green"];
  91905. var COLOR_MAGENTA = ["#F0F", "Magenta"];
  91906. var COLOR_RED = ["#F00", "Red"];
  91907. var COLOR_WHITE = ["#FFF", "White"];
  91908. var COLOR_YELLOW = ["#FF0", "Yellow"];
  91909. var OPACITY_OPAQUE = ["1", "Opaque"];
  91910. var OPACITY_SEMI = ["0.5", "Semi-Transparent"];
  91911. var OPACITY_TRANS = ["0", "Transparent"];
  91912. var selectConfigs = {
  91913. backgroundColor: {
  91914. selector: ".vjs-bg-color > select",
  91915. id: "captions-background-color-%s",
  91916. label: "Color",
  91917. options: [COLOR_BLACK, COLOR_WHITE, COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_YELLOW, COLOR_MAGENTA, COLOR_CYAN]
  91918. },
  91919. backgroundOpacity: {
  91920. selector: ".vjs-bg-opacity > select",
  91921. id: "captions-background-opacity-%s",
  91922. label: "Transparency",
  91923. options: [OPACITY_OPAQUE, OPACITY_SEMI, OPACITY_TRANS]
  91924. },
  91925. color: {
  91926. selector: ".vjs-fg-color > select",
  91927. id: "captions-foreground-color-%s",
  91928. label: "Color",
  91929. options: [COLOR_WHITE, COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_YELLOW, COLOR_MAGENTA, COLOR_CYAN]
  91930. },
  91931. edgeStyle: {
  91932. selector: ".vjs-edge-style > select",
  91933. id: "%s",
  91934. label: "Text Edge Style",
  91935. options: [["none", "None"], ["raised", "Raised"], ["depressed", "Depressed"], ["uniform", "Uniform"], ["dropshadow", "Dropshadow"]]
  91936. },
  91937. fontFamily: {
  91938. selector: ".vjs-font-family > select",
  91939. id: "captions-font-family-%s",
  91940. label: "Font Family",
  91941. options: [["proportionalSansSerif", "Proportional Sans-Serif"], ["monospaceSansSerif", "Monospace Sans-Serif"], ["proportionalSerif", "Proportional Serif"], ["monospaceSerif", "Monospace Serif"], ["casual", "Casual"], ["script", "Script"], ["small-caps", "Small Caps"]]
  91942. },
  91943. fontPercent: {
  91944. selector: ".vjs-font-percent > select",
  91945. id: "captions-font-size-%s",
  91946. label: "Font Size",
  91947. options: [["0.50", "50%"], ["0.75", "75%"], ["1.00", "100%"], ["1.25", "125%"], ["1.50", "150%"], ["1.75", "175%"], ["2.00", "200%"], ["3.00", "300%"], ["4.00", "400%"]],
  91948. "default": 2,
  91949. parser: function parser(v) {
  91950. return v === "1.00" ? null : Number(v);
  91951. }
  91952. },
  91953. textOpacity: {
  91954. selector: ".vjs-text-opacity > select",
  91955. id: "captions-foreground-opacity-%s",
  91956. label: "Transparency",
  91957. options: [OPACITY_OPAQUE, OPACITY_SEMI]
  91958. },
  91959. windowColor: {
  91960. selector: ".vjs-window-color > select",
  91961. id: "captions-window-color-%s",
  91962. label: "Color"
  91963. },
  91964. windowOpacity: {
  91965. selector: ".vjs-window-opacity > select",
  91966. id: "captions-window-opacity-%s",
  91967. label: "Transparency",
  91968. options: [OPACITY_TRANS, OPACITY_SEMI, OPACITY_OPAQUE]
  91969. }
  91970. };
  91971. selectConfigs.windowColor.options = selectConfigs.backgroundColor.options;
  91972. function parseOptionValue(value, parser2) {
  91973. if (parser2) {
  91974. value = parser2(value);
  91975. }
  91976. if (value && value !== "none") {
  91977. return value;
  91978. }
  91979. }
  91980. function getSelectedOptionValue(el, parser2) {
  91981. var value = el.options[el.options.selectedIndex].value;
  91982. return parseOptionValue(value, parser2);
  91983. }
  91984. function setSelectedOption(el, value, parser2) {
  91985. if (!value) {
  91986. return;
  91987. }
  91988. for (var i2 = 0; i2 < el.options.length; i2++) {
  91989. if (parseOptionValue(el.options[i2].value, parser2) === value) {
  91990. el.selectedIndex = i2;
  91991. break;
  91992. }
  91993. }
  91994. }
  91995. var TextTrackSettings = /* @__PURE__ */ function(_ModalDialog) {
  91996. _inheritsLoose(TextTrackSettings2, _ModalDialog);
  91997. function TextTrackSettings2(player, options2) {
  91998. var _this;
  91999. options2.temporary = false;
  92000. _this = _ModalDialog.call(this, player, options2) || this;
  92001. _this.updateDisplay = _this.updateDisplay.bind(_assertThisInitialized(_this));
  92002. _this.fill();
  92003. _this.hasBeenOpened_ = _this.hasBeenFilled_ = true;
  92004. _this.endDialog = createEl("p", {
  92005. className: "vjs-control-text",
  92006. textContent: _this.localize("End of dialog window.")
  92007. });
  92008. _this.el().appendChild(_this.endDialog);
  92009. _this.setDefaults();
  92010. if (options2.persistTextTrackSettings === void 0) {
  92011. _this.options_.persistTextTrackSettings = _this.options_.playerOptions.persistTextTrackSettings;
  92012. }
  92013. _this.on(_this.$(".vjs-done-button"), "click", function() {
  92014. _this.saveSettings();
  92015. _this.close();
  92016. });
  92017. _this.on(_this.$(".vjs-default-button"), "click", function() {
  92018. _this.setDefaults();
  92019. _this.updateDisplay();
  92020. });
  92021. each(selectConfigs, function(config) {
  92022. _this.on(_this.$(config.selector), "change", _this.updateDisplay);
  92023. });
  92024. if (_this.options_.persistTextTrackSettings) {
  92025. _this.restoreSettings();
  92026. }
  92027. return _this;
  92028. }
  92029. var _proto = TextTrackSettings2.prototype;
  92030. _proto.dispose = function dispose() {
  92031. this.endDialog = null;
  92032. _ModalDialog.prototype.dispose.call(this);
  92033. };
  92034. _proto.createElSelect_ = function createElSelect_(key, legendId, type2) {
  92035. var _this2 = this;
  92036. if (legendId === void 0) {
  92037. legendId = "";
  92038. }
  92039. if (type2 === void 0) {
  92040. type2 = "label";
  92041. }
  92042. var config = selectConfigs[key];
  92043. var id = config.id.replace("%s", this.id_);
  92044. var selectLabelledbyIds = [legendId, id].join(" ").trim();
  92045. return ["<" + type2 + ' id="' + id + '" class="' + (type2 === "label" ? "vjs-label" : "") + '">', this.localize(config.label), "</" + type2 + ">", '<select aria-labelledby="' + selectLabelledbyIds + '">'].concat(config.options.map(function(o) {
  92046. var optionId = id + "-" + o[1].replace(/\W+/g, "");
  92047. return ['<option id="' + optionId + '" value="' + o[0] + '" ', 'aria-labelledby="' + selectLabelledbyIds + " " + optionId + '">', _this2.localize(o[1]), "</option>"].join("");
  92048. })).concat("</select>").join("");
  92049. };
  92050. _proto.createElFgColor_ = function createElFgColor_() {
  92051. var legendId = "captions-text-legend-" + this.id_;
  92052. return ['<fieldset class="vjs-fg-color vjs-track-setting">', '<legend id="' + legendId + '">', this.localize("Text"), "</legend>", this.createElSelect_("color", legendId), '<span class="vjs-text-opacity vjs-opacity">', this.createElSelect_("textOpacity", legendId), "</span>", "</fieldset>"].join("");
  92053. };
  92054. _proto.createElBgColor_ = function createElBgColor_() {
  92055. var legendId = "captions-background-" + this.id_;
  92056. return ['<fieldset class="vjs-bg-color vjs-track-setting">', '<legend id="' + legendId + '">', this.localize("Background"), "</legend>", this.createElSelect_("backgroundColor", legendId), '<span class="vjs-bg-opacity vjs-opacity">', this.createElSelect_("backgroundOpacity", legendId), "</span>", "</fieldset>"].join("");
  92057. };
  92058. _proto.createElWinColor_ = function createElWinColor_() {
  92059. var legendId = "captions-window-" + this.id_;
  92060. return ['<fieldset class="vjs-window-color vjs-track-setting">', '<legend id="' + legendId + '">', this.localize("Window"), "</legend>", this.createElSelect_("windowColor", legendId), '<span class="vjs-window-opacity vjs-opacity">', this.createElSelect_("windowOpacity", legendId), "</span>", "</fieldset>"].join("");
  92061. };
  92062. _proto.createElColors_ = function createElColors_() {
  92063. return createEl("div", {
  92064. className: "vjs-track-settings-colors",
  92065. innerHTML: [this.createElFgColor_(), this.createElBgColor_(), this.createElWinColor_()].join("")
  92066. });
  92067. };
  92068. _proto.createElFont_ = function createElFont_() {
  92069. return createEl("div", {
  92070. className: "vjs-track-settings-font",
  92071. innerHTML: ['<fieldset class="vjs-font-percent vjs-track-setting">', this.createElSelect_("fontPercent", "", "legend"), "</fieldset>", '<fieldset class="vjs-edge-style vjs-track-setting">', this.createElSelect_("edgeStyle", "", "legend"), "</fieldset>", '<fieldset class="vjs-font-family vjs-track-setting">', this.createElSelect_("fontFamily", "", "legend"), "</fieldset>"].join("")
  92072. });
  92073. };
  92074. _proto.createElControls_ = function createElControls_() {
  92075. var defaultsDescription = this.localize("restore all settings to the default values");
  92076. return createEl("div", {
  92077. className: "vjs-track-settings-controls",
  92078. innerHTML: ['<button type="button" class="vjs-default-button" title="' + defaultsDescription + '">', this.localize("Reset"), '<span class="vjs-control-text"> ' + defaultsDescription + "</span>", "</button>", '<button type="button" class="vjs-done-button">' + this.localize("Done") + "</button>"].join("")
  92079. });
  92080. };
  92081. _proto.content = function content() {
  92082. return [this.createElColors_(), this.createElFont_(), this.createElControls_()];
  92083. };
  92084. _proto.label = function label2() {
  92085. return this.localize("Caption Settings Dialog");
  92086. };
  92087. _proto.description = function description() {
  92088. return this.localize("Beginning of dialog window. Escape will cancel and close the window.");
  92089. };
  92090. _proto.buildCSSClass = function buildCSSClass() {
  92091. return _ModalDialog.prototype.buildCSSClass.call(this) + " vjs-text-track-settings";
  92092. };
  92093. _proto.getValues = function getValues() {
  92094. var _this3 = this;
  92095. return reduce(selectConfigs, function(accum, config, key) {
  92096. var value = getSelectedOptionValue(_this3.$(config.selector), config.parser);
  92097. if (value !== void 0) {
  92098. accum[key] = value;
  92099. }
  92100. return accum;
  92101. }, {});
  92102. };
  92103. _proto.setValues = function setValues(values3) {
  92104. var _this4 = this;
  92105. each(selectConfigs, function(config, key) {
  92106. setSelectedOption(_this4.$(config.selector), values3[key], config.parser);
  92107. });
  92108. };
  92109. _proto.setDefaults = function setDefaults() {
  92110. var _this5 = this;
  92111. each(selectConfigs, function(config) {
  92112. var index2 = config.hasOwnProperty("default") ? config["default"] : 0;
  92113. _this5.$(config.selector).selectedIndex = index2;
  92114. });
  92115. };
  92116. _proto.restoreSettings = function restoreSettings() {
  92117. var values3;
  92118. try {
  92119. values3 = JSON.parse(window_1.localStorage.getItem(LOCAL_STORAGE_KEY$1));
  92120. } catch (err) {
  92121. log$1.warn(err);
  92122. }
  92123. if (values3) {
  92124. this.setValues(values3);
  92125. }
  92126. };
  92127. _proto.saveSettings = function saveSettings() {
  92128. if (!this.options_.persistTextTrackSettings) {
  92129. return;
  92130. }
  92131. var values3 = this.getValues();
  92132. try {
  92133. if (Object.keys(values3).length) {
  92134. window_1.localStorage.setItem(LOCAL_STORAGE_KEY$1, JSON.stringify(values3));
  92135. } else {
  92136. window_1.localStorage.removeItem(LOCAL_STORAGE_KEY$1);
  92137. }
  92138. } catch (err) {
  92139. log$1.warn(err);
  92140. }
  92141. };
  92142. _proto.updateDisplay = function updateDisplay() {
  92143. var ttDisplay = this.player_.getChild("textTrackDisplay");
  92144. if (ttDisplay) {
  92145. ttDisplay.updateDisplay();
  92146. }
  92147. };
  92148. _proto.conditionalBlur_ = function conditionalBlur_() {
  92149. this.previouslyActiveEl_ = null;
  92150. var cb = this.player_.controlBar;
  92151. var subsCapsBtn = cb && cb.subsCapsButton;
  92152. var ccBtn = cb && cb.captionsButton;
  92153. if (subsCapsBtn) {
  92154. subsCapsBtn.focus();
  92155. } else if (ccBtn) {
  92156. ccBtn.focus();
  92157. }
  92158. };
  92159. return TextTrackSettings2;
  92160. }(ModalDialog);
  92161. Component$1.registerComponent("TextTrackSettings", TextTrackSettings);
  92162. var ResizeManager = /* @__PURE__ */ function(_Component) {
  92163. _inheritsLoose(ResizeManager2, _Component);
  92164. function ResizeManager2(player, options2) {
  92165. var _this;
  92166. var RESIZE_OBSERVER_AVAILABLE = options2.ResizeObserver || window_1.ResizeObserver;
  92167. if (options2.ResizeObserver === null) {
  92168. RESIZE_OBSERVER_AVAILABLE = false;
  92169. }
  92170. var options_ = mergeOptions$3({
  92171. createEl: !RESIZE_OBSERVER_AVAILABLE,
  92172. reportTouchActivity: false
  92173. }, options2);
  92174. _this = _Component.call(this, player, options_) || this;
  92175. _this.ResizeObserver = options2.ResizeObserver || window_1.ResizeObserver;
  92176. _this.loadListener_ = null;
  92177. _this.resizeObserver_ = null;
  92178. _this.debouncedHandler_ = debounce(function() {
  92179. _this.resizeHandler();
  92180. }, 100, false, _assertThisInitialized(_this));
  92181. if (RESIZE_OBSERVER_AVAILABLE) {
  92182. _this.resizeObserver_ = new _this.ResizeObserver(_this.debouncedHandler_);
  92183. _this.resizeObserver_.observe(player.el());
  92184. } else {
  92185. _this.loadListener_ = function() {
  92186. if (!_this.el_ || !_this.el_.contentWindow) {
  92187. return;
  92188. }
  92189. var debouncedHandler_ = _this.debouncedHandler_;
  92190. var unloadListener_ = _this.unloadListener_ = function() {
  92191. off(this, "resize", debouncedHandler_);
  92192. off(this, "unload", unloadListener_);
  92193. unloadListener_ = null;
  92194. };
  92195. on(_this.el_.contentWindow, "unload", unloadListener_);
  92196. on(_this.el_.contentWindow, "resize", debouncedHandler_);
  92197. };
  92198. _this.one("load", _this.loadListener_);
  92199. }
  92200. return _this;
  92201. }
  92202. var _proto = ResizeManager2.prototype;
  92203. _proto.createEl = function createEl2() {
  92204. return _Component.prototype.createEl.call(this, "iframe", {
  92205. className: "vjs-resize-manager",
  92206. tabIndex: -1,
  92207. title: this.localize("No content")
  92208. }, {
  92209. "aria-hidden": "true"
  92210. });
  92211. };
  92212. _proto.resizeHandler = function resizeHandler() {
  92213. if (!this.player_ || !this.player_.trigger) {
  92214. return;
  92215. }
  92216. this.player_.trigger("playerresize");
  92217. };
  92218. _proto.dispose = function dispose() {
  92219. if (this.debouncedHandler_) {
  92220. this.debouncedHandler_.cancel();
  92221. }
  92222. if (this.resizeObserver_) {
  92223. if (this.player_.el()) {
  92224. this.resizeObserver_.unobserve(this.player_.el());
  92225. }
  92226. this.resizeObserver_.disconnect();
  92227. }
  92228. if (this.loadListener_) {
  92229. this.off("load", this.loadListener_);
  92230. }
  92231. if (this.el_ && this.el_.contentWindow && this.unloadListener_) {
  92232. this.unloadListener_.call(this.el_.contentWindow);
  92233. }
  92234. this.ResizeObserver = null;
  92235. this.resizeObserver = null;
  92236. this.debouncedHandler_ = null;
  92237. this.loadListener_ = null;
  92238. _Component.prototype.dispose.call(this);
  92239. };
  92240. return ResizeManager2;
  92241. }(Component$1);
  92242. Component$1.registerComponent("ResizeManager", ResizeManager);
  92243. var defaults$1 = {
  92244. trackingThreshold: 20,
  92245. liveTolerance: 15
  92246. };
  92247. var LiveTracker = /* @__PURE__ */ function(_Component) {
  92248. _inheritsLoose(LiveTracker2, _Component);
  92249. function LiveTracker2(player, options2) {
  92250. var _this;
  92251. var options_ = mergeOptions$3(defaults$1, options2, {
  92252. createEl: false
  92253. });
  92254. _this = _Component.call(this, player, options_) || this;
  92255. _this.handleVisibilityChange_ = function(e) {
  92256. return _this.handleVisibilityChange(e);
  92257. };
  92258. _this.trackLiveHandler_ = function() {
  92259. return _this.trackLive_();
  92260. };
  92261. _this.handlePlay_ = function(e) {
  92262. return _this.handlePlay(e);
  92263. };
  92264. _this.handleFirstTimeupdate_ = function(e) {
  92265. return _this.handleFirstTimeupdate(e);
  92266. };
  92267. _this.handleSeeked_ = function(e) {
  92268. return _this.handleSeeked(e);
  92269. };
  92270. _this.seekToLiveEdge_ = function(e) {
  92271. return _this.seekToLiveEdge(e);
  92272. };
  92273. _this.reset_();
  92274. _this.on(_this.player_, "durationchange", function(e) {
  92275. return _this.handleDurationchange(e);
  92276. });
  92277. _this.on(_this.player_, "canplay", function() {
  92278. return _this.toggleTracking();
  92279. });
  92280. if (IE_VERSION && "hidden" in document_1 && "visibilityState" in document_1) {
  92281. _this.on(document_1, "visibilitychange", _this.handleVisibilityChange_);
  92282. }
  92283. return _this;
  92284. }
  92285. var _proto = LiveTracker2.prototype;
  92286. _proto.handleVisibilityChange = function handleVisibilityChange() {
  92287. if (this.player_.duration() !== Infinity) {
  92288. return;
  92289. }
  92290. if (document_1.hidden) {
  92291. this.stopTracking();
  92292. } else {
  92293. this.startTracking();
  92294. }
  92295. };
  92296. _proto.trackLive_ = function trackLive_() {
  92297. var seekable3 = this.player_.seekable();
  92298. if (!seekable3 || !seekable3.length) {
  92299. return;
  92300. }
  92301. var newTime = Number(window_1.performance.now().toFixed(4));
  92302. var deltaTime = this.lastTime_ === -1 ? 0 : (newTime - this.lastTime_) / 1e3;
  92303. this.lastTime_ = newTime;
  92304. this.pastSeekEnd_ = this.pastSeekEnd() + deltaTime;
  92305. var liveCurrentTime = this.liveCurrentTime();
  92306. var currentTime = this.player_.currentTime();
  92307. var isBehind = this.player_.paused() || this.seekedBehindLive_ || Math.abs(liveCurrentTime - currentTime) > this.options_.liveTolerance;
  92308. if (!this.timeupdateSeen_ || liveCurrentTime === Infinity) {
  92309. isBehind = false;
  92310. }
  92311. if (isBehind !== this.behindLiveEdge_) {
  92312. this.behindLiveEdge_ = isBehind;
  92313. this.trigger("liveedgechange");
  92314. }
  92315. };
  92316. _proto.handleDurationchange = function handleDurationchange() {
  92317. this.toggleTracking();
  92318. };
  92319. _proto.toggleTracking = function toggleTracking() {
  92320. if (this.player_.duration() === Infinity && this.liveWindow() >= this.options_.trackingThreshold) {
  92321. if (this.player_.options_.liveui) {
  92322. this.player_.addClass("vjs-liveui");
  92323. }
  92324. this.startTracking();
  92325. } else {
  92326. this.player_.removeClass("vjs-liveui");
  92327. this.stopTracking();
  92328. }
  92329. };
  92330. _proto.startTracking = function startTracking() {
  92331. if (this.isTracking()) {
  92332. return;
  92333. }
  92334. if (!this.timeupdateSeen_) {
  92335. this.timeupdateSeen_ = this.player_.hasStarted();
  92336. }
  92337. this.trackingInterval_ = this.setInterval(this.trackLiveHandler_, UPDATE_REFRESH_INTERVAL);
  92338. this.trackLive_();
  92339. this.on(this.player_, ["play", "pause"], this.trackLiveHandler_);
  92340. if (!this.timeupdateSeen_) {
  92341. this.one(this.player_, "play", this.handlePlay_);
  92342. this.one(this.player_, "timeupdate", this.handleFirstTimeupdate_);
  92343. } else {
  92344. this.on(this.player_, "seeked", this.handleSeeked_);
  92345. }
  92346. };
  92347. _proto.handleFirstTimeupdate = function handleFirstTimeupdate() {
  92348. this.timeupdateSeen_ = true;
  92349. this.on(this.player_, "seeked", this.handleSeeked_);
  92350. };
  92351. _proto.handleSeeked = function handleSeeked() {
  92352. var timeDiff = Math.abs(this.liveCurrentTime() - this.player_.currentTime());
  92353. this.seekedBehindLive_ = this.nextSeekedFromUser_ && timeDiff > 2;
  92354. this.nextSeekedFromUser_ = false;
  92355. this.trackLive_();
  92356. };
  92357. _proto.handlePlay = function handlePlay() {
  92358. this.one(this.player_, "timeupdate", this.seekToLiveEdge_);
  92359. };
  92360. _proto.reset_ = function reset_() {
  92361. this.lastTime_ = -1;
  92362. this.pastSeekEnd_ = 0;
  92363. this.lastSeekEnd_ = -1;
  92364. this.behindLiveEdge_ = true;
  92365. this.timeupdateSeen_ = false;
  92366. this.seekedBehindLive_ = false;
  92367. this.nextSeekedFromUser_ = false;
  92368. this.clearInterval(this.trackingInterval_);
  92369. this.trackingInterval_ = null;
  92370. this.off(this.player_, ["play", "pause"], this.trackLiveHandler_);
  92371. this.off(this.player_, "seeked", this.handleSeeked_);
  92372. this.off(this.player_, "play", this.handlePlay_);
  92373. this.off(this.player_, "timeupdate", this.handleFirstTimeupdate_);
  92374. this.off(this.player_, "timeupdate", this.seekToLiveEdge_);
  92375. };
  92376. _proto.nextSeekedFromUser = function nextSeekedFromUser() {
  92377. this.nextSeekedFromUser_ = true;
  92378. };
  92379. _proto.stopTracking = function stopTracking() {
  92380. if (!this.isTracking()) {
  92381. return;
  92382. }
  92383. this.reset_();
  92384. this.trigger("liveedgechange");
  92385. };
  92386. _proto.seekableEnd = function seekableEnd() {
  92387. var seekable3 = this.player_.seekable();
  92388. var seekableEnds = [];
  92389. var i2 = seekable3 ? seekable3.length : 0;
  92390. while (i2--) {
  92391. seekableEnds.push(seekable3.end(i2));
  92392. }
  92393. return seekableEnds.length ? seekableEnds.sort()[seekableEnds.length - 1] : Infinity;
  92394. };
  92395. _proto.seekableStart = function seekableStart() {
  92396. var seekable3 = this.player_.seekable();
  92397. var seekableStarts = [];
  92398. var i2 = seekable3 ? seekable3.length : 0;
  92399. while (i2--) {
  92400. seekableStarts.push(seekable3.start(i2));
  92401. }
  92402. return seekableStarts.length ? seekableStarts.sort()[0] : 0;
  92403. };
  92404. _proto.liveWindow = function liveWindow() {
  92405. var liveCurrentTime = this.liveCurrentTime();
  92406. if (liveCurrentTime === Infinity) {
  92407. return 0;
  92408. }
  92409. return liveCurrentTime - this.seekableStart();
  92410. };
  92411. _proto.isLive = function isLive() {
  92412. return this.isTracking();
  92413. };
  92414. _proto.atLiveEdge = function atLiveEdge() {
  92415. return !this.behindLiveEdge();
  92416. };
  92417. _proto.liveCurrentTime = function liveCurrentTime() {
  92418. return this.pastSeekEnd() + this.seekableEnd();
  92419. };
  92420. _proto.pastSeekEnd = function pastSeekEnd() {
  92421. var seekableEnd = this.seekableEnd();
  92422. if (this.lastSeekEnd_ !== -1 && seekableEnd !== this.lastSeekEnd_) {
  92423. this.pastSeekEnd_ = 0;
  92424. }
  92425. this.lastSeekEnd_ = seekableEnd;
  92426. return this.pastSeekEnd_;
  92427. };
  92428. _proto.behindLiveEdge = function behindLiveEdge() {
  92429. return this.behindLiveEdge_;
  92430. };
  92431. _proto.isTracking = function isTracking() {
  92432. return typeof this.trackingInterval_ === "number";
  92433. };
  92434. _proto.seekToLiveEdge = function seekToLiveEdge() {
  92435. this.seekedBehindLive_ = false;
  92436. if (this.atLiveEdge()) {
  92437. return;
  92438. }
  92439. this.nextSeekedFromUser_ = false;
  92440. this.player_.currentTime(this.liveCurrentTime());
  92441. };
  92442. _proto.dispose = function dispose() {
  92443. this.off(document_1, "visibilitychange", this.handleVisibilityChange_);
  92444. this.stopTracking();
  92445. _Component.prototype.dispose.call(this);
  92446. };
  92447. return LiveTracker2;
  92448. }(Component$1);
  92449. Component$1.registerComponent("LiveTracker", LiveTracker);
  92450. var sourcesetLoad = function sourcesetLoad2(tech) {
  92451. var el = tech.el();
  92452. if (el.hasAttribute("src")) {
  92453. tech.triggerSourceset(el.src);
  92454. return true;
  92455. }
  92456. var sources = tech.$$("source");
  92457. var srcUrls = [];
  92458. var src = "";
  92459. if (!sources.length) {
  92460. return false;
  92461. }
  92462. for (var i2 = 0; i2 < sources.length; i2++) {
  92463. var url = sources[i2].src;
  92464. if (url && srcUrls.indexOf(url) === -1) {
  92465. srcUrls.push(url);
  92466. }
  92467. }
  92468. if (!srcUrls.length) {
  92469. return false;
  92470. }
  92471. if (srcUrls.length === 1) {
  92472. src = srcUrls[0];
  92473. }
  92474. tech.triggerSourceset(src);
  92475. return true;
  92476. };
  92477. var innerHTMLDescriptorPolyfill = Object.defineProperty({}, "innerHTML", {
  92478. get: function get2() {
  92479. return this.cloneNode(true).innerHTML;
  92480. },
  92481. set: function set2(v) {
  92482. var dummy = document_1.createElement(this.nodeName.toLowerCase());
  92483. dummy.innerHTML = v;
  92484. var docFrag = document_1.createDocumentFragment();
  92485. while (dummy.childNodes.length) {
  92486. docFrag.appendChild(dummy.childNodes[0]);
  92487. }
  92488. this.innerText = "";
  92489. window_1.Element.prototype.appendChild.call(this, docFrag);
  92490. return this.innerHTML;
  92491. }
  92492. });
  92493. var getDescriptor = function getDescriptor2(priority, prop) {
  92494. var descriptor = {};
  92495. for (var i2 = 0; i2 < priority.length; i2++) {
  92496. descriptor = Object.getOwnPropertyDescriptor(priority[i2], prop);
  92497. if (descriptor && descriptor.set && descriptor.get) {
  92498. break;
  92499. }
  92500. }
  92501. descriptor.enumerable = true;
  92502. descriptor.configurable = true;
  92503. return descriptor;
  92504. };
  92505. var getInnerHTMLDescriptor = function getInnerHTMLDescriptor2(tech) {
  92506. return getDescriptor([tech.el(), window_1.HTMLMediaElement.prototype, window_1.Element.prototype, innerHTMLDescriptorPolyfill], "innerHTML");
  92507. };
  92508. var firstSourceWatch = function firstSourceWatch2(tech) {
  92509. var el = tech.el();
  92510. if (el.resetSourceWatch_) {
  92511. return;
  92512. }
  92513. var old = {};
  92514. var innerDescriptor = getInnerHTMLDescriptor(tech);
  92515. var appendWrapper = function appendWrapper2(appendFn) {
  92516. return function() {
  92517. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  92518. args[_key] = arguments[_key];
  92519. }
  92520. var retval = appendFn.apply(el, args);
  92521. sourcesetLoad(tech);
  92522. return retval;
  92523. };
  92524. };
  92525. ["append", "appendChild", "insertAdjacentHTML"].forEach(function(k) {
  92526. if (!el[k]) {
  92527. return;
  92528. }
  92529. old[k] = el[k];
  92530. el[k] = appendWrapper(old[k]);
  92531. });
  92532. Object.defineProperty(el, "innerHTML", mergeOptions$3(innerDescriptor, {
  92533. set: appendWrapper(innerDescriptor.set)
  92534. }));
  92535. el.resetSourceWatch_ = function() {
  92536. el.resetSourceWatch_ = null;
  92537. Object.keys(old).forEach(function(k) {
  92538. el[k] = old[k];
  92539. });
  92540. Object.defineProperty(el, "innerHTML", innerDescriptor);
  92541. };
  92542. tech.one("sourceset", el.resetSourceWatch_);
  92543. };
  92544. var srcDescriptorPolyfill = Object.defineProperty({}, "src", {
  92545. get: function get3() {
  92546. if (this.hasAttribute("src")) {
  92547. return getAbsoluteURL(window_1.Element.prototype.getAttribute.call(this, "src"));
  92548. }
  92549. return "";
  92550. },
  92551. set: function set3(v) {
  92552. window_1.Element.prototype.setAttribute.call(this, "src", v);
  92553. return v;
  92554. }
  92555. });
  92556. var getSrcDescriptor = function getSrcDescriptor2(tech) {
  92557. return getDescriptor([tech.el(), window_1.HTMLMediaElement.prototype, srcDescriptorPolyfill], "src");
  92558. };
  92559. var setupSourceset = function setupSourceset2(tech) {
  92560. if (!tech.featuresSourceset) {
  92561. return;
  92562. }
  92563. var el = tech.el();
  92564. if (el.resetSourceset_) {
  92565. return;
  92566. }
  92567. var srcDescriptor = getSrcDescriptor(tech);
  92568. var oldSetAttribute = el.setAttribute;
  92569. var oldLoad = el.load;
  92570. Object.defineProperty(el, "src", mergeOptions$3(srcDescriptor, {
  92571. set: function set4(v) {
  92572. var retval = srcDescriptor.set.call(el, v);
  92573. tech.triggerSourceset(el.src);
  92574. return retval;
  92575. }
  92576. }));
  92577. el.setAttribute = function(n, v) {
  92578. var retval = oldSetAttribute.call(el, n, v);
  92579. if (/src/i.test(n)) {
  92580. tech.triggerSourceset(el.src);
  92581. }
  92582. return retval;
  92583. };
  92584. el.load = function() {
  92585. var retval = oldLoad.call(el);
  92586. if (!sourcesetLoad(tech)) {
  92587. tech.triggerSourceset("");
  92588. firstSourceWatch(tech);
  92589. }
  92590. return retval;
  92591. };
  92592. if (el.currentSrc) {
  92593. tech.triggerSourceset(el.currentSrc);
  92594. } else if (!sourcesetLoad(tech)) {
  92595. firstSourceWatch(tech);
  92596. }
  92597. el.resetSourceset_ = function() {
  92598. el.resetSourceset_ = null;
  92599. el.load = oldLoad;
  92600. el.setAttribute = oldSetAttribute;
  92601. Object.defineProperty(el, "src", srcDescriptor);
  92602. if (el.resetSourceWatch_) {
  92603. el.resetSourceWatch_();
  92604. }
  92605. };
  92606. };
  92607. var defineLazyProperty = function defineLazyProperty2(obj, key, getValue2, setter) {
  92608. if (setter === void 0) {
  92609. setter = true;
  92610. }
  92611. var set4 = function set5(value) {
  92612. return Object.defineProperty(obj, key, {
  92613. value,
  92614. enumerable: true,
  92615. writable: true
  92616. });
  92617. };
  92618. var options2 = {
  92619. configurable: true,
  92620. enumerable: true,
  92621. get: function get7() {
  92622. var value = getValue2();
  92623. set4(value);
  92624. return value;
  92625. }
  92626. };
  92627. if (setter) {
  92628. options2.set = set4;
  92629. }
  92630. return Object.defineProperty(obj, key, options2);
  92631. };
  92632. var Html5$1 = /* @__PURE__ */ function(_Tech) {
  92633. _inheritsLoose(Html52, _Tech);
  92634. function Html52(options2, ready) {
  92635. var _this;
  92636. _this = _Tech.call(this, options2, ready) || this;
  92637. var source = options2.source;
  92638. var crossoriginTracks = false;
  92639. _this.featuresVideoFrameCallback = _this.featuresVideoFrameCallback && _this.el_.tagName === "VIDEO";
  92640. if (source && (_this.el_.currentSrc !== source.src || options2.tag && options2.tag.initNetworkState_ === 3)) {
  92641. _this.setSource(source);
  92642. } else {
  92643. _this.handleLateInit_(_this.el_);
  92644. }
  92645. if (options2.enableSourceset) {
  92646. _this.setupSourcesetHandling_();
  92647. }
  92648. _this.isScrubbing_ = false;
  92649. if (_this.el_.hasChildNodes()) {
  92650. var nodes = _this.el_.childNodes;
  92651. var nodesLength = nodes.length;
  92652. var removeNodes = [];
  92653. while (nodesLength--) {
  92654. var node = nodes[nodesLength];
  92655. var nodeName = node.nodeName.toLowerCase();
  92656. if (nodeName === "track") {
  92657. if (!_this.featuresNativeTextTracks) {
  92658. removeNodes.push(node);
  92659. } else {
  92660. _this.remoteTextTrackEls().addTrackElement_(node);
  92661. _this.remoteTextTracks().addTrack(node.track);
  92662. _this.textTracks().addTrack(node.track);
  92663. if (!crossoriginTracks && !_this.el_.hasAttribute("crossorigin") && isCrossOrigin(node.src)) {
  92664. crossoriginTracks = true;
  92665. }
  92666. }
  92667. }
  92668. }
  92669. for (var i2 = 0; i2 < removeNodes.length; i2++) {
  92670. _this.el_.removeChild(removeNodes[i2]);
  92671. }
  92672. }
  92673. _this.proxyNativeTracks_();
  92674. if (_this.featuresNativeTextTracks && crossoriginTracks) {
  92675. log$1.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading.");
  92676. }
  92677. _this.restoreMetadataTracksInIOSNativePlayer_();
  92678. if ((TOUCH_ENABLED || IS_IPHONE || IS_NATIVE_ANDROID) && options2.nativeControlsForTouch === true) {
  92679. _this.setControls(true);
  92680. }
  92681. _this.proxyWebkitFullscreen_();
  92682. _this.triggerReady();
  92683. return _this;
  92684. }
  92685. var _proto = Html52.prototype;
  92686. _proto.dispose = function dispose() {
  92687. if (this.el_ && this.el_.resetSourceset_) {
  92688. this.el_.resetSourceset_();
  92689. }
  92690. Html52.disposeMediaElement(this.el_);
  92691. this.options_ = null;
  92692. _Tech.prototype.dispose.call(this);
  92693. };
  92694. _proto.setupSourcesetHandling_ = function setupSourcesetHandling_() {
  92695. setupSourceset(this);
  92696. };
  92697. _proto.restoreMetadataTracksInIOSNativePlayer_ = function restoreMetadataTracksInIOSNativePlayer_() {
  92698. var textTracks = this.textTracks();
  92699. var metadataTracksPreFullscreenState;
  92700. var takeMetadataTrackSnapshot = function takeMetadataTrackSnapshot2() {
  92701. metadataTracksPreFullscreenState = [];
  92702. for (var i2 = 0; i2 < textTracks.length; i2++) {
  92703. var track = textTracks[i2];
  92704. if (track.kind === "metadata") {
  92705. metadataTracksPreFullscreenState.push({
  92706. track,
  92707. storedMode: track.mode
  92708. });
  92709. }
  92710. }
  92711. };
  92712. takeMetadataTrackSnapshot();
  92713. textTracks.addEventListener("change", takeMetadataTrackSnapshot);
  92714. this.on("dispose", function() {
  92715. return textTracks.removeEventListener("change", takeMetadataTrackSnapshot);
  92716. });
  92717. var restoreTrackMode = function restoreTrackMode2() {
  92718. for (var i2 = 0; i2 < metadataTracksPreFullscreenState.length; i2++) {
  92719. var storedTrack = metadataTracksPreFullscreenState[i2];
  92720. if (storedTrack.track.mode === "disabled" && storedTrack.track.mode !== storedTrack.storedMode) {
  92721. storedTrack.track.mode = storedTrack.storedMode;
  92722. }
  92723. }
  92724. textTracks.removeEventListener("change", restoreTrackMode2);
  92725. };
  92726. this.on("webkitbeginfullscreen", function() {
  92727. textTracks.removeEventListener("change", takeMetadataTrackSnapshot);
  92728. textTracks.removeEventListener("change", restoreTrackMode);
  92729. textTracks.addEventListener("change", restoreTrackMode);
  92730. });
  92731. this.on("webkitendfullscreen", function() {
  92732. textTracks.removeEventListener("change", takeMetadataTrackSnapshot);
  92733. textTracks.addEventListener("change", takeMetadataTrackSnapshot);
  92734. textTracks.removeEventListener("change", restoreTrackMode);
  92735. });
  92736. };
  92737. _proto.overrideNative_ = function overrideNative_(type2, override) {
  92738. var _this2 = this;
  92739. if (override !== this["featuresNative" + type2 + "Tracks"]) {
  92740. return;
  92741. }
  92742. var lowerCaseType = type2.toLowerCase();
  92743. if (this[lowerCaseType + "TracksListeners_"]) {
  92744. Object.keys(this[lowerCaseType + "TracksListeners_"]).forEach(function(eventName) {
  92745. var elTracks = _this2.el()[lowerCaseType + "Tracks"];
  92746. elTracks.removeEventListener(eventName, _this2[lowerCaseType + "TracksListeners_"][eventName]);
  92747. });
  92748. }
  92749. this["featuresNative" + type2 + "Tracks"] = !override;
  92750. this[lowerCaseType + "TracksListeners_"] = null;
  92751. this.proxyNativeTracksForType_(lowerCaseType);
  92752. };
  92753. _proto.overrideNativeAudioTracks = function overrideNativeAudioTracks(override) {
  92754. this.overrideNative_("Audio", override);
  92755. };
  92756. _proto.overrideNativeVideoTracks = function overrideNativeVideoTracks(override) {
  92757. this.overrideNative_("Video", override);
  92758. };
  92759. _proto.proxyNativeTracksForType_ = function proxyNativeTracksForType_(name) {
  92760. var _this3 = this;
  92761. var props = NORMAL[name];
  92762. var elTracks = this.el()[props.getterName];
  92763. var techTracks = this[props.getterName]();
  92764. if (!this["featuresNative" + props.capitalName + "Tracks"] || !elTracks || !elTracks.addEventListener) {
  92765. return;
  92766. }
  92767. var listeners = {
  92768. change: function change(e) {
  92769. var event2 = {
  92770. type: "change",
  92771. target: techTracks,
  92772. currentTarget: techTracks,
  92773. srcElement: techTracks
  92774. };
  92775. techTracks.trigger(event2);
  92776. if (name === "text") {
  92777. _this3[REMOTE.remoteText.getterName]().trigger(event2);
  92778. }
  92779. },
  92780. addtrack: function addtrack(e) {
  92781. techTracks.addTrack(e.track);
  92782. },
  92783. removetrack: function removetrack(e) {
  92784. techTracks.removeTrack(e.track);
  92785. }
  92786. };
  92787. var removeOldTracks = function removeOldTracks2() {
  92788. var removeTracks = [];
  92789. for (var i2 = 0; i2 < techTracks.length; i2++) {
  92790. var found = false;
  92791. for (var j = 0; j < elTracks.length; j++) {
  92792. if (elTracks[j] === techTracks[i2]) {
  92793. found = true;
  92794. break;
  92795. }
  92796. }
  92797. if (!found) {
  92798. removeTracks.push(techTracks[i2]);
  92799. }
  92800. }
  92801. while (removeTracks.length) {
  92802. techTracks.removeTrack(removeTracks.shift());
  92803. }
  92804. };
  92805. this[props.getterName + "Listeners_"] = listeners;
  92806. Object.keys(listeners).forEach(function(eventName) {
  92807. var listener = listeners[eventName];
  92808. elTracks.addEventListener(eventName, listener);
  92809. _this3.on("dispose", function(e) {
  92810. return elTracks.removeEventListener(eventName, listener);
  92811. });
  92812. });
  92813. this.on("loadstart", removeOldTracks);
  92814. this.on("dispose", function(e) {
  92815. return _this3.off("loadstart", removeOldTracks);
  92816. });
  92817. };
  92818. _proto.proxyNativeTracks_ = function proxyNativeTracks_() {
  92819. var _this4 = this;
  92820. NORMAL.names.forEach(function(name) {
  92821. _this4.proxyNativeTracksForType_(name);
  92822. });
  92823. };
  92824. _proto.createEl = function createEl2() {
  92825. var el = this.options_.tag;
  92826. if (!el || !(this.options_.playerElIngest || this.movingMediaElementInDOM)) {
  92827. if (el) {
  92828. var clone = el.cloneNode(true);
  92829. if (el.parentNode) {
  92830. el.parentNode.insertBefore(clone, el);
  92831. }
  92832. Html52.disposeMediaElement(el);
  92833. el = clone;
  92834. } else {
  92835. el = document_1.createElement("video");
  92836. var tagAttributes = this.options_.tag && getAttributes(this.options_.tag);
  92837. var attributes = mergeOptions$3({}, tagAttributes);
  92838. if (!TOUCH_ENABLED || this.options_.nativeControlsForTouch !== true) {
  92839. delete attributes.controls;
  92840. }
  92841. setAttributes(el, assign(attributes, {
  92842. id: this.options_.techId,
  92843. "class": "vjs-tech"
  92844. }));
  92845. }
  92846. el.playerId = this.options_.playerId;
  92847. }
  92848. if (typeof this.options_.preload !== "undefined") {
  92849. setAttribute(el, "preload", this.options_.preload);
  92850. }
  92851. if (this.options_.disablePictureInPicture !== void 0) {
  92852. el.disablePictureInPicture = this.options_.disablePictureInPicture;
  92853. }
  92854. var settingsAttrs = ["loop", "muted", "playsinline", "autoplay"];
  92855. for (var i2 = 0; i2 < settingsAttrs.length; i2++) {
  92856. var attr = settingsAttrs[i2];
  92857. var value = this.options_[attr];
  92858. if (typeof value !== "undefined") {
  92859. if (value) {
  92860. setAttribute(el, attr, attr);
  92861. } else {
  92862. removeAttribute(el, attr);
  92863. }
  92864. el[attr] = value;
  92865. }
  92866. }
  92867. return el;
  92868. };
  92869. _proto.handleLateInit_ = function handleLateInit_(el) {
  92870. if (el.networkState === 0 || el.networkState === 3) {
  92871. return;
  92872. }
  92873. if (el.readyState === 0) {
  92874. var loadstartFired = false;
  92875. var setLoadstartFired = function setLoadstartFired2() {
  92876. loadstartFired = true;
  92877. };
  92878. this.on("loadstart", setLoadstartFired);
  92879. var triggerLoadstart = function triggerLoadstart2() {
  92880. if (!loadstartFired) {
  92881. this.trigger("loadstart");
  92882. }
  92883. };
  92884. this.on("loadedmetadata", triggerLoadstart);
  92885. this.ready(function() {
  92886. this.off("loadstart", setLoadstartFired);
  92887. this.off("loadedmetadata", triggerLoadstart);
  92888. if (!loadstartFired) {
  92889. this.trigger("loadstart");
  92890. }
  92891. });
  92892. return;
  92893. }
  92894. var eventsToTrigger = ["loadstart"];
  92895. eventsToTrigger.push("loadedmetadata");
  92896. if (el.readyState >= 2) {
  92897. eventsToTrigger.push("loadeddata");
  92898. }
  92899. if (el.readyState >= 3) {
  92900. eventsToTrigger.push("canplay");
  92901. }
  92902. if (el.readyState >= 4) {
  92903. eventsToTrigger.push("canplaythrough");
  92904. }
  92905. this.ready(function() {
  92906. eventsToTrigger.forEach(function(type2) {
  92907. this.trigger(type2);
  92908. }, this);
  92909. });
  92910. };
  92911. _proto.setScrubbing = function setScrubbing(isScrubbing) {
  92912. this.isScrubbing_ = isScrubbing;
  92913. };
  92914. _proto.scrubbing = function scrubbing() {
  92915. return this.isScrubbing_;
  92916. };
  92917. _proto.setCurrentTime = function setCurrentTime(seconds) {
  92918. try {
  92919. if (this.isScrubbing_ && this.el_.fastSeek && IS_ANY_SAFARI) {
  92920. this.el_.fastSeek(seconds);
  92921. } else {
  92922. this.el_.currentTime = seconds;
  92923. }
  92924. } catch (e) {
  92925. log$1(e, "Video is not ready. (Video.js)");
  92926. }
  92927. };
  92928. _proto.duration = function duration5() {
  92929. var _this5 = this;
  92930. if (this.el_.duration === Infinity && IS_ANDROID && IS_CHROME && this.el_.currentTime === 0) {
  92931. var checkProgress = function checkProgress2() {
  92932. if (_this5.el_.currentTime > 0) {
  92933. if (_this5.el_.duration === Infinity) {
  92934. _this5.trigger("durationchange");
  92935. }
  92936. _this5.off("timeupdate", checkProgress2);
  92937. }
  92938. };
  92939. this.on("timeupdate", checkProgress);
  92940. return NaN;
  92941. }
  92942. return this.el_.duration || NaN;
  92943. };
  92944. _proto.width = function width2() {
  92945. return this.el_.offsetWidth;
  92946. };
  92947. _proto.height = function height2() {
  92948. return this.el_.offsetHeight;
  92949. };
  92950. _proto.proxyWebkitFullscreen_ = function proxyWebkitFullscreen_() {
  92951. var _this6 = this;
  92952. if (!("webkitDisplayingFullscreen" in this.el_)) {
  92953. return;
  92954. }
  92955. var endFn = function endFn2() {
  92956. this.trigger("fullscreenchange", {
  92957. isFullscreen: false
  92958. });
  92959. if (this.el_.controls && !this.options_.nativeControlsForTouch && this.controls()) {
  92960. this.el_.controls = false;
  92961. }
  92962. };
  92963. var beginFn = function beginFn2() {
  92964. if ("webkitPresentationMode" in this.el_ && this.el_.webkitPresentationMode !== "picture-in-picture") {
  92965. this.one("webkitendfullscreen", endFn);
  92966. this.trigger("fullscreenchange", {
  92967. isFullscreen: true,
  92968. nativeIOSFullscreen: true
  92969. });
  92970. }
  92971. };
  92972. this.on("webkitbeginfullscreen", beginFn);
  92973. this.on("dispose", function() {
  92974. _this6.off("webkitbeginfullscreen", beginFn);
  92975. _this6.off("webkitendfullscreen", endFn);
  92976. });
  92977. };
  92978. _proto.supportsFullScreen = function supportsFullScreen() {
  92979. if (typeof this.el_.webkitEnterFullScreen === "function") {
  92980. var userAgent = window_1.navigator && window_1.navigator.userAgent || "";
  92981. if (/Android/.test(userAgent) || !/Chrome|Mac OS X 10.5/.test(userAgent)) {
  92982. return true;
  92983. }
  92984. }
  92985. return false;
  92986. };
  92987. _proto.enterFullScreen = function enterFullScreen() {
  92988. var video = this.el_;
  92989. if (video.paused && video.networkState <= video.HAVE_METADATA) {
  92990. silencePromise(this.el_.play());
  92991. this.setTimeout(function() {
  92992. video.pause();
  92993. try {
  92994. video.webkitEnterFullScreen();
  92995. } catch (e) {
  92996. this.trigger("fullscreenerror", e);
  92997. }
  92998. }, 0);
  92999. } else {
  93000. try {
  93001. video.webkitEnterFullScreen();
  93002. } catch (e) {
  93003. this.trigger("fullscreenerror", e);
  93004. }
  93005. }
  93006. };
  93007. _proto.exitFullScreen = function exitFullScreen() {
  93008. if (!this.el_.webkitDisplayingFullscreen) {
  93009. this.trigger("fullscreenerror", new Error("The video is not fullscreen"));
  93010. return;
  93011. }
  93012. this.el_.webkitExitFullScreen();
  93013. };
  93014. _proto.requestPictureInPicture = function requestPictureInPicture() {
  93015. return this.el_.requestPictureInPicture();
  93016. };
  93017. _proto.requestVideoFrameCallback = function requestVideoFrameCallback(cb) {
  93018. if (this.featuresVideoFrameCallback && !this.el_.webkitKeys) {
  93019. return this.el_.requestVideoFrameCallback(cb);
  93020. }
  93021. return _Tech.prototype.requestVideoFrameCallback.call(this, cb);
  93022. };
  93023. _proto.cancelVideoFrameCallback = function cancelVideoFrameCallback(id) {
  93024. if (this.featuresVideoFrameCallback && !this.el_.webkitKeys) {
  93025. this.el_.cancelVideoFrameCallback(id);
  93026. } else {
  93027. _Tech.prototype.cancelVideoFrameCallback.call(this, id);
  93028. }
  93029. };
  93030. _proto.src = function src(_src) {
  93031. if (_src === void 0) {
  93032. return this.el_.src;
  93033. }
  93034. this.setSrc(_src);
  93035. };
  93036. _proto.reset = function reset3() {
  93037. Html52.resetMediaElement(this.el_);
  93038. };
  93039. _proto.currentSrc = function currentSrc() {
  93040. if (this.currentSource_) {
  93041. return this.currentSource_.src;
  93042. }
  93043. return this.el_.currentSrc;
  93044. };
  93045. _proto.setControls = function setControls(val) {
  93046. this.el_.controls = !!val;
  93047. };
  93048. _proto.addTextTrack = function addTextTrack(kind, label2, language) {
  93049. if (!this.featuresNativeTextTracks) {
  93050. return _Tech.prototype.addTextTrack.call(this, kind, label2, language);
  93051. }
  93052. return this.el_.addTextTrack(kind, label2, language);
  93053. };
  93054. _proto.createRemoteTextTrack = function createRemoteTextTrack(options2) {
  93055. if (!this.featuresNativeTextTracks) {
  93056. return _Tech.prototype.createRemoteTextTrack.call(this, options2);
  93057. }
  93058. var htmlTrackElement = document_1.createElement("track");
  93059. if (options2.kind) {
  93060. htmlTrackElement.kind = options2.kind;
  93061. }
  93062. if (options2.label) {
  93063. htmlTrackElement.label = options2.label;
  93064. }
  93065. if (options2.language || options2.srclang) {
  93066. htmlTrackElement.srclang = options2.language || options2.srclang;
  93067. }
  93068. if (options2["default"]) {
  93069. htmlTrackElement["default"] = options2["default"];
  93070. }
  93071. if (options2.id) {
  93072. htmlTrackElement.id = options2.id;
  93073. }
  93074. if (options2.src) {
  93075. htmlTrackElement.src = options2.src;
  93076. }
  93077. return htmlTrackElement;
  93078. };
  93079. _proto.addRemoteTextTrack = function addRemoteTextTrack(options2, manualCleanup) {
  93080. var htmlTrackElement = _Tech.prototype.addRemoteTextTrack.call(this, options2, manualCleanup);
  93081. if (this.featuresNativeTextTracks) {
  93082. this.el().appendChild(htmlTrackElement);
  93083. }
  93084. return htmlTrackElement;
  93085. };
  93086. _proto.removeRemoteTextTrack = function removeRemoteTextTrack(track) {
  93087. _Tech.prototype.removeRemoteTextTrack.call(this, track);
  93088. if (this.featuresNativeTextTracks) {
  93089. var tracks = this.$$("track");
  93090. var i2 = tracks.length;
  93091. while (i2--) {
  93092. if (track === tracks[i2] || track === tracks[i2].track) {
  93093. this.el().removeChild(tracks[i2]);
  93094. }
  93095. }
  93096. }
  93097. };
  93098. _proto.getVideoPlaybackQuality = function getVideoPlaybackQuality() {
  93099. if (typeof this.el().getVideoPlaybackQuality === "function") {
  93100. return this.el().getVideoPlaybackQuality();
  93101. }
  93102. var videoPlaybackQuality = {};
  93103. if (typeof this.el().webkitDroppedFrameCount !== "undefined" && typeof this.el().webkitDecodedFrameCount !== "undefined") {
  93104. videoPlaybackQuality.droppedVideoFrames = this.el().webkitDroppedFrameCount;
  93105. videoPlaybackQuality.totalVideoFrames = this.el().webkitDecodedFrameCount;
  93106. }
  93107. if (window_1.performance && typeof window_1.performance.now === "function") {
  93108. videoPlaybackQuality.creationTime = window_1.performance.now();
  93109. } else if (window_1.performance && window_1.performance.timing && typeof window_1.performance.timing.navigationStart === "number") {
  93110. videoPlaybackQuality.creationTime = window_1.Date.now() - window_1.performance.timing.navigationStart;
  93111. }
  93112. return videoPlaybackQuality;
  93113. };
  93114. return Html52;
  93115. }(Tech$1);
  93116. defineLazyProperty(Html5$1, "TEST_VID", function() {
  93117. if (!isReal()) {
  93118. return;
  93119. }
  93120. var video = document_1.createElement("video");
  93121. var track = document_1.createElement("track");
  93122. track.kind = "captions";
  93123. track.srclang = "en";
  93124. track.label = "English";
  93125. video.appendChild(track);
  93126. return video;
  93127. });
  93128. Html5$1.isSupported = function() {
  93129. try {
  93130. Html5$1.TEST_VID.volume = 0.5;
  93131. } catch (e) {
  93132. return false;
  93133. }
  93134. return !!(Html5$1.TEST_VID && Html5$1.TEST_VID.canPlayType);
  93135. };
  93136. Html5$1.canPlayType = function(type2) {
  93137. return Html5$1.TEST_VID.canPlayType(type2);
  93138. };
  93139. Html5$1.canPlaySource = function(srcObj, options2) {
  93140. return Html5$1.canPlayType(srcObj.type);
  93141. };
  93142. Html5$1.canControlVolume = function() {
  93143. try {
  93144. var volume = Html5$1.TEST_VID.volume;
  93145. Html5$1.TEST_VID.volume = volume / 2 + 0.1;
  93146. var canControl = volume !== Html5$1.TEST_VID.volume;
  93147. if (canControl && IS_IOS) {
  93148. window_1.setTimeout(function() {
  93149. if (Html5$1 && Html5$1.prototype) {
  93150. Html5$1.prototype.featuresVolumeControl = volume !== Html5$1.TEST_VID.volume;
  93151. }
  93152. });
  93153. return false;
  93154. }
  93155. return canControl;
  93156. } catch (e) {
  93157. return false;
  93158. }
  93159. };
  93160. Html5$1.canMuteVolume = function() {
  93161. try {
  93162. var muted = Html5$1.TEST_VID.muted;
  93163. Html5$1.TEST_VID.muted = !muted;
  93164. if (Html5$1.TEST_VID.muted) {
  93165. setAttribute(Html5$1.TEST_VID, "muted", "muted");
  93166. } else {
  93167. removeAttribute(Html5$1.TEST_VID, "muted", "muted");
  93168. }
  93169. return muted !== Html5$1.TEST_VID.muted;
  93170. } catch (e) {
  93171. return false;
  93172. }
  93173. };
  93174. Html5$1.canControlPlaybackRate = function() {
  93175. if (IS_ANDROID && IS_CHROME && CHROME_VERSION < 58) {
  93176. return false;
  93177. }
  93178. try {
  93179. var playbackRate = Html5$1.TEST_VID.playbackRate;
  93180. Html5$1.TEST_VID.playbackRate = playbackRate / 2 + 0.1;
  93181. return playbackRate !== Html5$1.TEST_VID.playbackRate;
  93182. } catch (e) {
  93183. return false;
  93184. }
  93185. };
  93186. Html5$1.canOverrideAttributes = function() {
  93187. try {
  93188. var noop2 = function noop3() {
  93189. };
  93190. Object.defineProperty(document_1.createElement("video"), "src", {
  93191. get: noop2,
  93192. set: noop2
  93193. });
  93194. Object.defineProperty(document_1.createElement("audio"), "src", {
  93195. get: noop2,
  93196. set: noop2
  93197. });
  93198. Object.defineProperty(document_1.createElement("video"), "innerHTML", {
  93199. get: noop2,
  93200. set: noop2
  93201. });
  93202. Object.defineProperty(document_1.createElement("audio"), "innerHTML", {
  93203. get: noop2,
  93204. set: noop2
  93205. });
  93206. } catch (e) {
  93207. return false;
  93208. }
  93209. return true;
  93210. };
  93211. Html5$1.supportsNativeTextTracks = function() {
  93212. return IS_ANY_SAFARI || IS_IOS && IS_CHROME;
  93213. };
  93214. Html5$1.supportsNativeVideoTracks = function() {
  93215. return !!(Html5$1.TEST_VID && Html5$1.TEST_VID.videoTracks);
  93216. };
  93217. Html5$1.supportsNativeAudioTracks = function() {
  93218. return !!(Html5$1.TEST_VID && Html5$1.TEST_VID.audioTracks);
  93219. };
  93220. Html5$1.Events = ["loadstart", "suspend", "abort", "error", "emptied", "stalled", "loadedmetadata", "loadeddata", "canplay", "canplaythrough", "playing", "waiting", "seeking", "seeked", "ended", "durationchange", "timeupdate", "progress", "play", "pause", "ratechange", "resize", "volumechange"];
  93221. [["featuresMuteControl", "canMuteVolume"], ["featuresPlaybackRate", "canControlPlaybackRate"], ["featuresSourceset", "canOverrideAttributes"], ["featuresNativeTextTracks", "supportsNativeTextTracks"], ["featuresNativeVideoTracks", "supportsNativeVideoTracks"], ["featuresNativeAudioTracks", "supportsNativeAudioTracks"]].forEach(function(_ref) {
  93222. var key = _ref[0], fn2 = _ref[1];
  93223. defineLazyProperty(Html5$1.prototype, key, function() {
  93224. return Html5$1[fn2]();
  93225. }, true);
  93226. });
  93227. Html5$1.prototype.featuresVolumeControl = Html5$1.canControlVolume();
  93228. Html5$1.prototype.movingMediaElementInDOM = !IS_IOS;
  93229. Html5$1.prototype.featuresFullscreenResize = true;
  93230. Html5$1.prototype.featuresProgressEvents = true;
  93231. Html5$1.prototype.featuresTimeupdateEvents = true;
  93232. Html5$1.prototype.featuresVideoFrameCallback = !!(Html5$1.TEST_VID && Html5$1.TEST_VID.requestVideoFrameCallback);
  93233. var canPlayType;
  93234. Html5$1.patchCanPlayType = function() {
  93235. if (ANDROID_VERSION >= 4 && !IS_FIREFOX && !IS_CHROME) {
  93236. canPlayType = Html5$1.TEST_VID && Html5$1.TEST_VID.constructor.prototype.canPlayType;
  93237. Html5$1.TEST_VID.constructor.prototype.canPlayType = function(type2) {
  93238. var mpegurlRE = /^application\/(?:x-|vnd\.apple\.)mpegurl/i;
  93239. if (type2 && mpegurlRE.test(type2)) {
  93240. return "maybe";
  93241. }
  93242. return canPlayType.call(this, type2);
  93243. };
  93244. }
  93245. };
  93246. Html5$1.unpatchCanPlayType = function() {
  93247. var r2 = Html5$1.TEST_VID.constructor.prototype.canPlayType;
  93248. if (canPlayType) {
  93249. Html5$1.TEST_VID.constructor.prototype.canPlayType = canPlayType;
  93250. }
  93251. return r2;
  93252. };
  93253. Html5$1.patchCanPlayType();
  93254. Html5$1.disposeMediaElement = function(el) {
  93255. if (!el) {
  93256. return;
  93257. }
  93258. if (el.parentNode) {
  93259. el.parentNode.removeChild(el);
  93260. }
  93261. while (el.hasChildNodes()) {
  93262. el.removeChild(el.firstChild);
  93263. }
  93264. el.removeAttribute("src");
  93265. if (typeof el.load === "function") {
  93266. (function() {
  93267. try {
  93268. el.load();
  93269. } catch (e) {
  93270. }
  93271. })();
  93272. }
  93273. };
  93274. Html5$1.resetMediaElement = function(el) {
  93275. if (!el) {
  93276. return;
  93277. }
  93278. var sources = el.querySelectorAll("source");
  93279. var i2 = sources.length;
  93280. while (i2--) {
  93281. el.removeChild(sources[i2]);
  93282. }
  93283. el.removeAttribute("src");
  93284. if (typeof el.load === "function") {
  93285. (function() {
  93286. try {
  93287. el.load();
  93288. } catch (e) {
  93289. }
  93290. })();
  93291. }
  93292. };
  93293. [
  93294. "muted",
  93295. "defaultMuted",
  93296. "autoplay",
  93297. "controls",
  93298. "loop",
  93299. "playsinline"
  93300. ].forEach(function(prop) {
  93301. Html5$1.prototype[prop] = function() {
  93302. return this.el_[prop] || this.el_.hasAttribute(prop);
  93303. };
  93304. });
  93305. [
  93306. "muted",
  93307. "defaultMuted",
  93308. "autoplay",
  93309. "loop",
  93310. "playsinline"
  93311. ].forEach(function(prop) {
  93312. Html5$1.prototype["set" + toTitleCase$1(prop)] = function(v) {
  93313. this.el_[prop] = v;
  93314. if (v) {
  93315. this.el_.setAttribute(prop, prop);
  93316. } else {
  93317. this.el_.removeAttribute(prop);
  93318. }
  93319. };
  93320. });
  93321. [
  93322. "paused",
  93323. "currentTime",
  93324. "buffered",
  93325. "volume",
  93326. "poster",
  93327. "preload",
  93328. "error",
  93329. "seeking",
  93330. "seekable",
  93331. "ended",
  93332. "playbackRate",
  93333. "defaultPlaybackRate",
  93334. "disablePictureInPicture",
  93335. "played",
  93336. "networkState",
  93337. "readyState",
  93338. "videoWidth",
  93339. "videoHeight",
  93340. "crossOrigin"
  93341. ].forEach(function(prop) {
  93342. Html5$1.prototype[prop] = function() {
  93343. return this.el_[prop];
  93344. };
  93345. });
  93346. [
  93347. "volume",
  93348. "src",
  93349. "poster",
  93350. "preload",
  93351. "playbackRate",
  93352. "defaultPlaybackRate",
  93353. "disablePictureInPicture",
  93354. "crossOrigin"
  93355. ].forEach(function(prop) {
  93356. Html5$1.prototype["set" + toTitleCase$1(prop)] = function(v) {
  93357. this.el_[prop] = v;
  93358. };
  93359. });
  93360. [
  93361. "pause",
  93362. "load",
  93363. "play"
  93364. ].forEach(function(prop) {
  93365. Html5$1.prototype[prop] = function() {
  93366. return this.el_[prop]();
  93367. };
  93368. });
  93369. Tech$1.withSourceHandlers(Html5$1);
  93370. Html5$1.nativeSourceHandler = {};
  93371. Html5$1.nativeSourceHandler.canPlayType = function(type2) {
  93372. try {
  93373. return Html5$1.TEST_VID.canPlayType(type2);
  93374. } catch (e) {
  93375. return "";
  93376. }
  93377. };
  93378. Html5$1.nativeSourceHandler.canHandleSource = function(source, options2) {
  93379. if (source.type) {
  93380. return Html5$1.nativeSourceHandler.canPlayType(source.type);
  93381. } else if (source.src) {
  93382. var ext = getFileExtension(source.src);
  93383. return Html5$1.nativeSourceHandler.canPlayType("video/" + ext);
  93384. }
  93385. return "";
  93386. };
  93387. Html5$1.nativeSourceHandler.handleSource = function(source, tech, options2) {
  93388. tech.setSrc(source.src);
  93389. };
  93390. Html5$1.nativeSourceHandler.dispose = function() {
  93391. };
  93392. Html5$1.registerSourceHandler(Html5$1.nativeSourceHandler);
  93393. Tech$1.registerTech("Html5", Html5$1);
  93394. var TECH_EVENTS_RETRIGGER = [
  93395. "progress",
  93396. "abort",
  93397. "suspend",
  93398. "emptied",
  93399. "stalled",
  93400. "loadedmetadata",
  93401. "loadeddata",
  93402. "timeupdate",
  93403. "resize",
  93404. "volumechange",
  93405. "texttrackchange"
  93406. ];
  93407. var TECH_EVENTS_QUEUE = {
  93408. canplay: "CanPlay",
  93409. canplaythrough: "CanPlayThrough",
  93410. playing: "Playing",
  93411. seeked: "Seeked"
  93412. };
  93413. var BREAKPOINT_ORDER = ["tiny", "xsmall", "small", "medium", "large", "xlarge", "huge"];
  93414. var BREAKPOINT_CLASSES = {};
  93415. BREAKPOINT_ORDER.forEach(function(k) {
  93416. var v = k.charAt(0) === "x" ? "x-" + k.substring(1) : k;
  93417. BREAKPOINT_CLASSES[k] = "vjs-layout-" + v;
  93418. });
  93419. var DEFAULT_BREAKPOINTS = {
  93420. tiny: 210,
  93421. xsmall: 320,
  93422. small: 425,
  93423. medium: 768,
  93424. large: 1440,
  93425. xlarge: 2560,
  93426. huge: Infinity
  93427. };
  93428. var Player = /* @__PURE__ */ function(_Component) {
  93429. _inheritsLoose(Player2, _Component);
  93430. function Player2(tag, options2, ready) {
  93431. var _this;
  93432. tag.id = tag.id || options2.id || "vjs_video_" + newGUID();
  93433. options2 = assign(Player2.getTagSettings(tag), options2);
  93434. options2.initChildren = false;
  93435. options2.createEl = false;
  93436. options2.evented = false;
  93437. options2.reportTouchActivity = false;
  93438. if (!options2.language) {
  93439. if (typeof tag.closest === "function") {
  93440. var closest = tag.closest("[lang]");
  93441. if (closest && closest.getAttribute) {
  93442. options2.language = closest.getAttribute("lang");
  93443. }
  93444. } else {
  93445. var element = tag;
  93446. while (element && element.nodeType === 1) {
  93447. if (getAttributes(element).hasOwnProperty("lang")) {
  93448. options2.language = element.getAttribute("lang");
  93449. break;
  93450. }
  93451. element = element.parentNode;
  93452. }
  93453. }
  93454. }
  93455. _this = _Component.call(this, null, options2, ready) || this;
  93456. _this.boundDocumentFullscreenChange_ = function(e) {
  93457. return _this.documentFullscreenChange_(e);
  93458. };
  93459. _this.boundFullWindowOnEscKey_ = function(e) {
  93460. return _this.fullWindowOnEscKey(e);
  93461. };
  93462. _this.boundUpdateStyleEl_ = function(e) {
  93463. return _this.updateStyleEl_(e);
  93464. };
  93465. _this.boundApplyInitTime_ = function(e) {
  93466. return _this.applyInitTime_(e);
  93467. };
  93468. _this.boundUpdateCurrentBreakpoint_ = function(e) {
  93469. return _this.updateCurrentBreakpoint_(e);
  93470. };
  93471. _this.boundHandleTechClick_ = function(e) {
  93472. return _this.handleTechClick_(e);
  93473. };
  93474. _this.boundHandleTechDoubleClick_ = function(e) {
  93475. return _this.handleTechDoubleClick_(e);
  93476. };
  93477. _this.boundHandleTechTouchStart_ = function(e) {
  93478. return _this.handleTechTouchStart_(e);
  93479. };
  93480. _this.boundHandleTechTouchMove_ = function(e) {
  93481. return _this.handleTechTouchMove_(e);
  93482. };
  93483. _this.boundHandleTechTouchEnd_ = function(e) {
  93484. return _this.handleTechTouchEnd_(e);
  93485. };
  93486. _this.boundHandleTechTap_ = function(e) {
  93487. return _this.handleTechTap_(e);
  93488. };
  93489. _this.isFullscreen_ = false;
  93490. _this.log = createLogger(_this.id_);
  93491. _this.fsApi_ = FullscreenApi;
  93492. _this.isPosterFromTech_ = false;
  93493. _this.queuedCallbacks_ = [];
  93494. _this.isReady_ = false;
  93495. _this.hasStarted_ = false;
  93496. _this.userActive_ = false;
  93497. _this.debugEnabled_ = false;
  93498. _this.audioOnlyMode_ = false;
  93499. _this.audioPosterMode_ = false;
  93500. _this.audioOnlyCache_ = {
  93501. playerHeight: null,
  93502. hiddenChildren: []
  93503. };
  93504. if (!_this.options_ || !_this.options_.techOrder || !_this.options_.techOrder.length) {
  93505. throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");
  93506. }
  93507. _this.tag = tag;
  93508. _this.tagAttributes = tag && getAttributes(tag);
  93509. _this.language(_this.options_.language);
  93510. if (options2.languages) {
  93511. var languagesToLower = {};
  93512. Object.getOwnPropertyNames(options2.languages).forEach(function(name) {
  93513. languagesToLower[name.toLowerCase()] = options2.languages[name];
  93514. });
  93515. _this.languages_ = languagesToLower;
  93516. } else {
  93517. _this.languages_ = Player2.prototype.options_.languages;
  93518. }
  93519. _this.resetCache_();
  93520. _this.poster_ = options2.poster || "";
  93521. _this.controls_ = !!options2.controls;
  93522. tag.controls = false;
  93523. tag.removeAttribute("controls");
  93524. _this.changingSrc_ = false;
  93525. _this.playCallbacks_ = [];
  93526. _this.playTerminatedQueue_ = [];
  93527. if (tag.hasAttribute("autoplay")) {
  93528. _this.autoplay(true);
  93529. } else {
  93530. _this.autoplay(_this.options_.autoplay);
  93531. }
  93532. if (options2.plugins) {
  93533. Object.keys(options2.plugins).forEach(function(name) {
  93534. if (typeof _this[name] !== "function") {
  93535. throw new Error('plugin "' + name + '" does not exist');
  93536. }
  93537. });
  93538. }
  93539. _this.scrubbing_ = false;
  93540. _this.el_ = _this.createEl();
  93541. evented(_assertThisInitialized(_this), {
  93542. eventBusKey: "el_"
  93543. });
  93544. if (_this.fsApi_.requestFullscreen) {
  93545. on(document_1, _this.fsApi_.fullscreenchange, _this.boundDocumentFullscreenChange_);
  93546. _this.on(_this.fsApi_.fullscreenchange, _this.boundDocumentFullscreenChange_);
  93547. }
  93548. if (_this.fluid_) {
  93549. _this.on(["playerreset", "resize"], _this.boundUpdateStyleEl_);
  93550. }
  93551. var playerOptionsCopy = mergeOptions$3(_this.options_);
  93552. if (options2.plugins) {
  93553. Object.keys(options2.plugins).forEach(function(name) {
  93554. _this[name](options2.plugins[name]);
  93555. });
  93556. }
  93557. if (options2.debug) {
  93558. _this.debug(true);
  93559. }
  93560. _this.options_.playerOptions = playerOptionsCopy;
  93561. _this.middleware_ = [];
  93562. _this.playbackRates(options2.playbackRates);
  93563. _this.initChildren();
  93564. _this.isAudio(tag.nodeName.toLowerCase() === "audio");
  93565. if (_this.controls()) {
  93566. _this.addClass("vjs-controls-enabled");
  93567. } else {
  93568. _this.addClass("vjs-controls-disabled");
  93569. }
  93570. _this.el_.setAttribute("role", "region");
  93571. if (_this.isAudio()) {
  93572. _this.el_.setAttribute("aria-label", _this.localize("Audio Player"));
  93573. } else {
  93574. _this.el_.setAttribute("aria-label", _this.localize("Video Player"));
  93575. }
  93576. if (_this.isAudio()) {
  93577. _this.addClass("vjs-audio");
  93578. }
  93579. if (_this.flexNotSupported_()) {
  93580. _this.addClass("vjs-no-flex");
  93581. }
  93582. if (TOUCH_ENABLED) {
  93583. _this.addClass("vjs-touch-enabled");
  93584. }
  93585. if (!IS_IOS) {
  93586. _this.addClass("vjs-workinghover");
  93587. }
  93588. Player2.players[_this.id_] = _assertThisInitialized(_this);
  93589. var majorVersion = version$5.split(".")[0];
  93590. _this.addClass("vjs-v" + majorVersion);
  93591. _this.userActive(true);
  93592. _this.reportUserActivity();
  93593. _this.one("play", function(e) {
  93594. return _this.listenForUserActivity_(e);
  93595. });
  93596. _this.on("stageclick", function(e) {
  93597. return _this.handleStageClick_(e);
  93598. });
  93599. _this.on("keydown", function(e) {
  93600. return _this.handleKeyDown(e);
  93601. });
  93602. _this.on("languagechange", function(e) {
  93603. return _this.handleLanguagechange(e);
  93604. });
  93605. _this.breakpoints(_this.options_.breakpoints);
  93606. _this.responsive(_this.options_.responsive);
  93607. _this.on("ready", function() {
  93608. _this.audioPosterMode(_this.options_.audioPosterMode);
  93609. _this.audioOnlyMode(_this.options_.audioOnlyMode);
  93610. });
  93611. return _this;
  93612. }
  93613. var _proto = Player2.prototype;
  93614. _proto.dispose = function dispose() {
  93615. var _this2 = this;
  93616. this.trigger("dispose");
  93617. this.off("dispose");
  93618. off(document_1, this.fsApi_.fullscreenchange, this.boundDocumentFullscreenChange_);
  93619. off(document_1, "keydown", this.boundFullWindowOnEscKey_);
  93620. if (this.styleEl_ && this.styleEl_.parentNode) {
  93621. this.styleEl_.parentNode.removeChild(this.styleEl_);
  93622. this.styleEl_ = null;
  93623. }
  93624. Player2.players[this.id_] = null;
  93625. if (this.tag && this.tag.player) {
  93626. this.tag.player = null;
  93627. }
  93628. if (this.el_ && this.el_.player) {
  93629. this.el_.player = null;
  93630. }
  93631. if (this.tech_) {
  93632. this.tech_.dispose();
  93633. this.isPosterFromTech_ = false;
  93634. this.poster_ = "";
  93635. }
  93636. if (this.playerElIngest_) {
  93637. this.playerElIngest_ = null;
  93638. }
  93639. if (this.tag) {
  93640. this.tag = null;
  93641. }
  93642. clearCacheForPlayer(this);
  93643. ALL.names.forEach(function(name) {
  93644. var props = ALL[name];
  93645. var list = _this2[props.getterName]();
  93646. if (list && list.off) {
  93647. list.off();
  93648. }
  93649. });
  93650. _Component.prototype.dispose.call(this, {
  93651. restoreEl: this.options_.restoreEl
  93652. });
  93653. };
  93654. _proto.createEl = function createEl2() {
  93655. var tag = this.tag;
  93656. var el;
  93657. var playerElIngest = this.playerElIngest_ = tag.parentNode && tag.parentNode.hasAttribute && tag.parentNode.hasAttribute("data-vjs-player");
  93658. var divEmbed = this.tag.tagName.toLowerCase() === "video-js";
  93659. if (playerElIngest) {
  93660. el = this.el_ = tag.parentNode;
  93661. } else if (!divEmbed) {
  93662. el = this.el_ = _Component.prototype.createEl.call(this, "div");
  93663. }
  93664. var attrs = getAttributes(tag);
  93665. if (divEmbed) {
  93666. el = this.el_ = tag;
  93667. tag = this.tag = document_1.createElement("video");
  93668. while (el.children.length) {
  93669. tag.appendChild(el.firstChild);
  93670. }
  93671. if (!hasClass(el, "video-js")) {
  93672. addClass(el, "video-js");
  93673. }
  93674. el.appendChild(tag);
  93675. playerElIngest = this.playerElIngest_ = el;
  93676. Object.keys(el).forEach(function(k) {
  93677. try {
  93678. tag[k] = el[k];
  93679. } catch (e) {
  93680. }
  93681. });
  93682. }
  93683. tag.setAttribute("tabindex", "-1");
  93684. attrs.tabindex = "-1";
  93685. if (IE_VERSION || IS_CHROME && IS_WINDOWS) {
  93686. tag.setAttribute("role", "application");
  93687. attrs.role = "application";
  93688. }
  93689. tag.removeAttribute("width");
  93690. tag.removeAttribute("height");
  93691. if ("width" in attrs) {
  93692. delete attrs.width;
  93693. }
  93694. if ("height" in attrs) {
  93695. delete attrs.height;
  93696. }
  93697. Object.getOwnPropertyNames(attrs).forEach(function(attr) {
  93698. if (!(divEmbed && attr === "class")) {
  93699. el.setAttribute(attr, attrs[attr]);
  93700. }
  93701. if (divEmbed) {
  93702. tag.setAttribute(attr, attrs[attr]);
  93703. }
  93704. });
  93705. tag.playerId = tag.id;
  93706. tag.id += "_html5_api";
  93707. tag.className = "vjs-tech";
  93708. tag.player = el.player = this;
  93709. this.addClass("vjs-paused");
  93710. if (window_1.VIDEOJS_NO_DYNAMIC_STYLE !== true) {
  93711. this.styleEl_ = createStyleElement("vjs-styles-dimensions");
  93712. var defaultsStyleEl = $(".vjs-styles-defaults");
  93713. var head = $("head");
  93714. head.insertBefore(this.styleEl_, defaultsStyleEl ? defaultsStyleEl.nextSibling : head.firstChild);
  93715. }
  93716. this.fill_ = false;
  93717. this.fluid_ = false;
  93718. this.width(this.options_.width);
  93719. this.height(this.options_.height);
  93720. this.fill(this.options_.fill);
  93721. this.fluid(this.options_.fluid);
  93722. this.aspectRatio(this.options_.aspectRatio);
  93723. this.crossOrigin(this.options_.crossOrigin || this.options_.crossorigin);
  93724. var links = tag.getElementsByTagName("a");
  93725. for (var i2 = 0; i2 < links.length; i2++) {
  93726. var linkEl = links.item(i2);
  93727. addClass(linkEl, "vjs-hidden");
  93728. linkEl.setAttribute("hidden", "hidden");
  93729. }
  93730. tag.initNetworkState_ = tag.networkState;
  93731. if (tag.parentNode && !playerElIngest) {
  93732. tag.parentNode.insertBefore(el, tag);
  93733. }
  93734. prependTo(tag, el);
  93735. this.children_.unshift(tag);
  93736. this.el_.setAttribute("lang", this.language_);
  93737. this.el_.setAttribute("translate", "no");
  93738. this.el_ = el;
  93739. return el;
  93740. };
  93741. _proto.crossOrigin = function crossOrigin(value) {
  93742. if (!value) {
  93743. return this.techGet_("crossOrigin");
  93744. }
  93745. if (value !== "anonymous" && value !== "use-credentials") {
  93746. log$1.warn('crossOrigin must be "anonymous" or "use-credentials", given "' + value + '"');
  93747. return;
  93748. }
  93749. this.techCall_("setCrossOrigin", value);
  93750. return;
  93751. };
  93752. _proto.width = function width2(value) {
  93753. return this.dimension("width", value);
  93754. };
  93755. _proto.height = function height2(value) {
  93756. return this.dimension("height", value);
  93757. };
  93758. _proto.dimension = function dimension(_dimension, value) {
  93759. var privDimension = _dimension + "_";
  93760. if (value === void 0) {
  93761. return this[privDimension] || 0;
  93762. }
  93763. if (value === "" || value === "auto") {
  93764. this[privDimension] = void 0;
  93765. this.updateStyleEl_();
  93766. return;
  93767. }
  93768. var parsedVal = parseFloat(value);
  93769. if (isNaN(parsedVal)) {
  93770. log$1.error('Improper value "' + value + '" supplied for for ' + _dimension);
  93771. return;
  93772. }
  93773. this[privDimension] = parsedVal;
  93774. this.updateStyleEl_();
  93775. };
  93776. _proto.fluid = function fluid(bool) {
  93777. var _this3 = this;
  93778. if (bool === void 0) {
  93779. return !!this.fluid_;
  93780. }
  93781. this.fluid_ = !!bool;
  93782. if (isEvented(this)) {
  93783. this.off(["playerreset", "resize"], this.boundUpdateStyleEl_);
  93784. }
  93785. if (bool) {
  93786. this.addClass("vjs-fluid");
  93787. this.fill(false);
  93788. addEventedCallback(this, function() {
  93789. _this3.on(["playerreset", "resize"], _this3.boundUpdateStyleEl_);
  93790. });
  93791. } else {
  93792. this.removeClass("vjs-fluid");
  93793. }
  93794. this.updateStyleEl_();
  93795. };
  93796. _proto.fill = function fill(bool) {
  93797. if (bool === void 0) {
  93798. return !!this.fill_;
  93799. }
  93800. this.fill_ = !!bool;
  93801. if (bool) {
  93802. this.addClass("vjs-fill");
  93803. this.fluid(false);
  93804. } else {
  93805. this.removeClass("vjs-fill");
  93806. }
  93807. };
  93808. _proto.aspectRatio = function aspectRatio(ratio) {
  93809. if (ratio === void 0) {
  93810. return this.aspectRatio_;
  93811. }
  93812. if (!/^\d+\:\d+$/.test(ratio)) {
  93813. throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");
  93814. }
  93815. this.aspectRatio_ = ratio;
  93816. this.fluid(true);
  93817. this.updateStyleEl_();
  93818. };
  93819. _proto.updateStyleEl_ = function updateStyleEl_() {
  93820. if (window_1.VIDEOJS_NO_DYNAMIC_STYLE === true) {
  93821. var _width = typeof this.width_ === "number" ? this.width_ : this.options_.width;
  93822. var _height = typeof this.height_ === "number" ? this.height_ : this.options_.height;
  93823. var techEl = this.tech_ && this.tech_.el();
  93824. if (techEl) {
  93825. if (_width >= 0) {
  93826. techEl.width = _width;
  93827. }
  93828. if (_height >= 0) {
  93829. techEl.height = _height;
  93830. }
  93831. }
  93832. return;
  93833. }
  93834. var width2;
  93835. var height2;
  93836. var aspectRatio;
  93837. var idClass;
  93838. if (this.aspectRatio_ !== void 0 && this.aspectRatio_ !== "auto") {
  93839. aspectRatio = this.aspectRatio_;
  93840. } else if (this.videoWidth() > 0) {
  93841. aspectRatio = this.videoWidth() + ":" + this.videoHeight();
  93842. } else {
  93843. aspectRatio = "16:9";
  93844. }
  93845. var ratioParts = aspectRatio.split(":");
  93846. var ratioMultiplier = ratioParts[1] / ratioParts[0];
  93847. if (this.width_ !== void 0) {
  93848. width2 = this.width_;
  93849. } else if (this.height_ !== void 0) {
  93850. width2 = this.height_ / ratioMultiplier;
  93851. } else {
  93852. width2 = this.videoWidth() || 300;
  93853. }
  93854. if (this.height_ !== void 0) {
  93855. height2 = this.height_;
  93856. } else {
  93857. height2 = width2 * ratioMultiplier;
  93858. }
  93859. if (/^[^a-zA-Z]/.test(this.id())) {
  93860. idClass = "dimensions-" + this.id();
  93861. } else {
  93862. idClass = this.id() + "-dimensions";
  93863. }
  93864. this.addClass(idClass);
  93865. setTextContent(this.styleEl_, "\n ." + idClass + " {\n width: " + width2 + "px;\n height: " + height2 + "px;\n }\n\n ." + idClass + ".vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: " + ratioMultiplier * 100 + "%;\n }\n ");
  93866. };
  93867. _proto.loadTech_ = function loadTech_(techName, source) {
  93868. var _this4 = this;
  93869. if (this.tech_) {
  93870. this.unloadTech_();
  93871. }
  93872. var titleTechName = toTitleCase$1(techName);
  93873. var camelTechName = techName.charAt(0).toLowerCase() + techName.slice(1);
  93874. if (titleTechName !== "Html5" && this.tag) {
  93875. Tech$1.getTech("Html5").disposeMediaElement(this.tag);
  93876. this.tag.player = null;
  93877. this.tag = null;
  93878. }
  93879. this.techName_ = titleTechName;
  93880. this.isReady_ = false;
  93881. var autoplay = this.autoplay();
  93882. if (typeof this.autoplay() === "string" || this.autoplay() === true && this.options_.normalizeAutoplay) {
  93883. autoplay = false;
  93884. }
  93885. var techOptions = {
  93886. source,
  93887. autoplay,
  93888. "nativeControlsForTouch": this.options_.nativeControlsForTouch,
  93889. "playerId": this.id(),
  93890. "techId": this.id() + "_" + camelTechName + "_api",
  93891. "playsinline": this.options_.playsinline,
  93892. "preload": this.options_.preload,
  93893. "loop": this.options_.loop,
  93894. "disablePictureInPicture": this.options_.disablePictureInPicture,
  93895. "muted": this.options_.muted,
  93896. "poster": this.poster(),
  93897. "language": this.language(),
  93898. "playerElIngest": this.playerElIngest_ || false,
  93899. "vtt.js": this.options_["vtt.js"],
  93900. "canOverridePoster": !!this.options_.techCanOverridePoster,
  93901. "enableSourceset": this.options_.enableSourceset,
  93902. "Promise": this.options_.Promise
  93903. };
  93904. ALL.names.forEach(function(name) {
  93905. var props = ALL[name];
  93906. techOptions[props.getterName] = _this4[props.privateName];
  93907. });
  93908. assign(techOptions, this.options_[titleTechName]);
  93909. assign(techOptions, this.options_[camelTechName]);
  93910. assign(techOptions, this.options_[techName.toLowerCase()]);
  93911. if (this.tag) {
  93912. techOptions.tag = this.tag;
  93913. }
  93914. if (source && source.src === this.cache_.src && this.cache_.currentTime > 0) {
  93915. techOptions.startTime = this.cache_.currentTime;
  93916. }
  93917. var TechClass = Tech$1.getTech(techName);
  93918. if (!TechClass) {
  93919. throw new Error("No Tech named '" + titleTechName + "' exists! '" + titleTechName + "' should be registered using videojs.registerTech()'");
  93920. }
  93921. this.tech_ = new TechClass(techOptions);
  93922. this.tech_.ready(bind(this, this.handleTechReady_), true);
  93923. textTrackConverter.jsonToTextTracks(this.textTracksJson_ || [], this.tech_);
  93924. TECH_EVENTS_RETRIGGER.forEach(function(event2) {
  93925. _this4.on(_this4.tech_, event2, function(e) {
  93926. return _this4["handleTech" + toTitleCase$1(event2) + "_"](e);
  93927. });
  93928. });
  93929. Object.keys(TECH_EVENTS_QUEUE).forEach(function(event2) {
  93930. _this4.on(_this4.tech_, event2, function(eventObj) {
  93931. if (_this4.tech_.playbackRate() === 0 && _this4.tech_.seeking()) {
  93932. _this4.queuedCallbacks_.push({
  93933. callback: _this4["handleTech" + TECH_EVENTS_QUEUE[event2] + "_"].bind(_this4),
  93934. event: eventObj
  93935. });
  93936. return;
  93937. }
  93938. _this4["handleTech" + TECH_EVENTS_QUEUE[event2] + "_"](eventObj);
  93939. });
  93940. });
  93941. this.on(this.tech_, "loadstart", function(e) {
  93942. return _this4.handleTechLoadStart_(e);
  93943. });
  93944. this.on(this.tech_, "sourceset", function(e) {
  93945. return _this4.handleTechSourceset_(e);
  93946. });
  93947. this.on(this.tech_, "waiting", function(e) {
  93948. return _this4.handleTechWaiting_(e);
  93949. });
  93950. this.on(this.tech_, "ended", function(e) {
  93951. return _this4.handleTechEnded_(e);
  93952. });
  93953. this.on(this.tech_, "seeking", function(e) {
  93954. return _this4.handleTechSeeking_(e);
  93955. });
  93956. this.on(this.tech_, "play", function(e) {
  93957. return _this4.handleTechPlay_(e);
  93958. });
  93959. this.on(this.tech_, "firstplay", function(e) {
  93960. return _this4.handleTechFirstPlay_(e);
  93961. });
  93962. this.on(this.tech_, "pause", function(e) {
  93963. return _this4.handleTechPause_(e);
  93964. });
  93965. this.on(this.tech_, "durationchange", function(e) {
  93966. return _this4.handleTechDurationChange_(e);
  93967. });
  93968. this.on(this.tech_, "fullscreenchange", function(e, data) {
  93969. return _this4.handleTechFullscreenChange_(e, data);
  93970. });
  93971. this.on(this.tech_, "fullscreenerror", function(e, err) {
  93972. return _this4.handleTechFullscreenError_(e, err);
  93973. });
  93974. this.on(this.tech_, "enterpictureinpicture", function(e) {
  93975. return _this4.handleTechEnterPictureInPicture_(e);
  93976. });
  93977. this.on(this.tech_, "leavepictureinpicture", function(e) {
  93978. return _this4.handleTechLeavePictureInPicture_(e);
  93979. });
  93980. this.on(this.tech_, "error", function(e) {
  93981. return _this4.handleTechError_(e);
  93982. });
  93983. this.on(this.tech_, "posterchange", function(e) {
  93984. return _this4.handleTechPosterChange_(e);
  93985. });
  93986. this.on(this.tech_, "textdata", function(e) {
  93987. return _this4.handleTechTextData_(e);
  93988. });
  93989. this.on(this.tech_, "ratechange", function(e) {
  93990. return _this4.handleTechRateChange_(e);
  93991. });
  93992. this.on(this.tech_, "loadedmetadata", this.boundUpdateStyleEl_);
  93993. this.usingNativeControls(this.techGet_("controls"));
  93994. if (this.controls() && !this.usingNativeControls()) {
  93995. this.addTechControlsListeners_();
  93996. }
  93997. if (this.tech_.el().parentNode !== this.el() && (titleTechName !== "Html5" || !this.tag)) {
  93998. prependTo(this.tech_.el(), this.el());
  93999. }
  94000. if (this.tag) {
  94001. this.tag.player = null;
  94002. this.tag = null;
  94003. }
  94004. };
  94005. _proto.unloadTech_ = function unloadTech_() {
  94006. var _this5 = this;
  94007. ALL.names.forEach(function(name) {
  94008. var props = ALL[name];
  94009. _this5[props.privateName] = _this5[props.getterName]();
  94010. });
  94011. this.textTracksJson_ = textTrackConverter.textTracksToJson(this.tech_);
  94012. this.isReady_ = false;
  94013. this.tech_.dispose();
  94014. this.tech_ = false;
  94015. if (this.isPosterFromTech_) {
  94016. this.poster_ = "";
  94017. this.trigger("posterchange");
  94018. }
  94019. this.isPosterFromTech_ = false;
  94020. };
  94021. _proto.tech = function tech(safety) {
  94022. if (safety === void 0) {
  94023. log$1.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n");
  94024. }
  94025. return this.tech_;
  94026. };
  94027. _proto.addTechControlsListeners_ = function addTechControlsListeners_() {
  94028. this.removeTechControlsListeners_();
  94029. this.on(this.tech_, "click", this.boundHandleTechClick_);
  94030. this.on(this.tech_, "dblclick", this.boundHandleTechDoubleClick_);
  94031. this.on(this.tech_, "touchstart", this.boundHandleTechTouchStart_);
  94032. this.on(this.tech_, "touchmove", this.boundHandleTechTouchMove_);
  94033. this.on(this.tech_, "touchend", this.boundHandleTechTouchEnd_);
  94034. this.on(this.tech_, "tap", this.boundHandleTechTap_);
  94035. };
  94036. _proto.removeTechControlsListeners_ = function removeTechControlsListeners_() {
  94037. this.off(this.tech_, "tap", this.boundHandleTechTap_);
  94038. this.off(this.tech_, "touchstart", this.boundHandleTechTouchStart_);
  94039. this.off(this.tech_, "touchmove", this.boundHandleTechTouchMove_);
  94040. this.off(this.tech_, "touchend", this.boundHandleTechTouchEnd_);
  94041. this.off(this.tech_, "click", this.boundHandleTechClick_);
  94042. this.off(this.tech_, "dblclick", this.boundHandleTechDoubleClick_);
  94043. };
  94044. _proto.handleTechReady_ = function handleTechReady_() {
  94045. this.triggerReady();
  94046. if (this.cache_.volume) {
  94047. this.techCall_("setVolume", this.cache_.volume);
  94048. }
  94049. this.handleTechPosterChange_();
  94050. this.handleTechDurationChange_();
  94051. };
  94052. _proto.handleTechLoadStart_ = function handleTechLoadStart_() {
  94053. this.removeClass("vjs-ended");
  94054. this.removeClass("vjs-seeking");
  94055. this.error(null);
  94056. this.handleTechDurationChange_();
  94057. if (!this.paused()) {
  94058. this.trigger("loadstart");
  94059. this.trigger("firstplay");
  94060. } else {
  94061. this.hasStarted(false);
  94062. this.trigger("loadstart");
  94063. }
  94064. this.manualAutoplay_(this.autoplay() === true && this.options_.normalizeAutoplay ? "play" : this.autoplay());
  94065. };
  94066. _proto.manualAutoplay_ = function manualAutoplay_(type2) {
  94067. var _this6 = this;
  94068. if (!this.tech_ || typeof type2 !== "string") {
  94069. return;
  94070. }
  94071. var resolveMuted = function resolveMuted2() {
  94072. var previouslyMuted = _this6.muted();
  94073. _this6.muted(true);
  94074. var restoreMuted = function restoreMuted2() {
  94075. _this6.muted(previouslyMuted);
  94076. };
  94077. _this6.playTerminatedQueue_.push(restoreMuted);
  94078. var mutedPromise = _this6.play();
  94079. if (!isPromise(mutedPromise)) {
  94080. return;
  94081. }
  94082. return mutedPromise["catch"](function(err) {
  94083. restoreMuted();
  94084. throw new Error("Rejection at manualAutoplay. Restoring muted value. " + (err ? err : ""));
  94085. });
  94086. };
  94087. var promise;
  94088. if (type2 === "any" && !this.muted()) {
  94089. promise = this.play();
  94090. if (isPromise(promise)) {
  94091. promise = promise["catch"](resolveMuted);
  94092. }
  94093. } else if (type2 === "muted" && !this.muted()) {
  94094. promise = resolveMuted();
  94095. } else {
  94096. promise = this.play();
  94097. }
  94098. if (!isPromise(promise)) {
  94099. return;
  94100. }
  94101. return promise.then(function() {
  94102. _this6.trigger({
  94103. type: "autoplay-success",
  94104. autoplay: type2
  94105. });
  94106. })["catch"](function() {
  94107. _this6.trigger({
  94108. type: "autoplay-failure",
  94109. autoplay: type2
  94110. });
  94111. });
  94112. };
  94113. _proto.updateSourceCaches_ = function updateSourceCaches_(srcObj) {
  94114. if (srcObj === void 0) {
  94115. srcObj = "";
  94116. }
  94117. var src = srcObj;
  94118. var type2 = "";
  94119. if (typeof src !== "string") {
  94120. src = srcObj.src;
  94121. type2 = srcObj.type;
  94122. }
  94123. this.cache_.source = this.cache_.source || {};
  94124. this.cache_.sources = this.cache_.sources || [];
  94125. if (src && !type2) {
  94126. type2 = findMimetype(this, src);
  94127. }
  94128. this.cache_.source = mergeOptions$3({}, srcObj, {
  94129. src,
  94130. type: type2
  94131. });
  94132. var matchingSources = this.cache_.sources.filter(function(s) {
  94133. return s.src && s.src === src;
  94134. });
  94135. var sourceElSources = [];
  94136. var sourceEls = this.$$("source");
  94137. var matchingSourceEls = [];
  94138. for (var i2 = 0; i2 < sourceEls.length; i2++) {
  94139. var sourceObj = getAttributes(sourceEls[i2]);
  94140. sourceElSources.push(sourceObj);
  94141. if (sourceObj.src && sourceObj.src === src) {
  94142. matchingSourceEls.push(sourceObj.src);
  94143. }
  94144. }
  94145. if (matchingSourceEls.length && !matchingSources.length) {
  94146. this.cache_.sources = sourceElSources;
  94147. } else if (!matchingSources.length) {
  94148. this.cache_.sources = [this.cache_.source];
  94149. }
  94150. this.cache_.src = src;
  94151. };
  94152. _proto.handleTechSourceset_ = function handleTechSourceset_(event2) {
  94153. var _this7 = this;
  94154. if (!this.changingSrc_) {
  94155. var updateSourceCaches = function updateSourceCaches2(src) {
  94156. return _this7.updateSourceCaches_(src);
  94157. };
  94158. var playerSrc = this.currentSource().src;
  94159. var eventSrc = event2.src;
  94160. if (playerSrc && !/^blob:/.test(playerSrc) && /^blob:/.test(eventSrc)) {
  94161. if (!this.lastSource_ || this.lastSource_.tech !== eventSrc && this.lastSource_.player !== playerSrc) {
  94162. updateSourceCaches = function updateSourceCaches2() {
  94163. };
  94164. }
  94165. }
  94166. updateSourceCaches(eventSrc);
  94167. if (!event2.src) {
  94168. this.tech_.any(["sourceset", "loadstart"], function(e) {
  94169. if (e.type === "sourceset") {
  94170. return;
  94171. }
  94172. var techSrc = _this7.techGet("currentSrc");
  94173. _this7.lastSource_.tech = techSrc;
  94174. _this7.updateSourceCaches_(techSrc);
  94175. });
  94176. }
  94177. }
  94178. this.lastSource_ = {
  94179. player: this.currentSource().src,
  94180. tech: event2.src
  94181. };
  94182. this.trigger({
  94183. src: event2.src,
  94184. type: "sourceset"
  94185. });
  94186. };
  94187. _proto.hasStarted = function hasStarted(request) {
  94188. if (request === void 0) {
  94189. return this.hasStarted_;
  94190. }
  94191. if (request === this.hasStarted_) {
  94192. return;
  94193. }
  94194. this.hasStarted_ = request;
  94195. if (this.hasStarted_) {
  94196. this.addClass("vjs-has-started");
  94197. this.trigger("firstplay");
  94198. } else {
  94199. this.removeClass("vjs-has-started");
  94200. }
  94201. };
  94202. _proto.handleTechPlay_ = function handleTechPlay_() {
  94203. this.removeClass("vjs-ended");
  94204. this.removeClass("vjs-paused");
  94205. this.addClass("vjs-playing");
  94206. this.hasStarted(true);
  94207. this.trigger("play");
  94208. };
  94209. _proto.handleTechRateChange_ = function handleTechRateChange_() {
  94210. if (this.tech_.playbackRate() > 0 && this.cache_.lastPlaybackRate === 0) {
  94211. this.queuedCallbacks_.forEach(function(queued) {
  94212. return queued.callback(queued.event);
  94213. });
  94214. this.queuedCallbacks_ = [];
  94215. }
  94216. this.cache_.lastPlaybackRate = this.tech_.playbackRate();
  94217. this.trigger("ratechange");
  94218. };
  94219. _proto.handleTechWaiting_ = function handleTechWaiting_() {
  94220. var _this8 = this;
  94221. this.addClass("vjs-waiting");
  94222. this.trigger("waiting");
  94223. var timeWhenWaiting = this.currentTime();
  94224. var timeUpdateListener = function timeUpdateListener2() {
  94225. if (timeWhenWaiting !== _this8.currentTime()) {
  94226. _this8.removeClass("vjs-waiting");
  94227. _this8.off("timeupdate", timeUpdateListener2);
  94228. }
  94229. };
  94230. this.on("timeupdate", timeUpdateListener);
  94231. };
  94232. _proto.handleTechCanPlay_ = function handleTechCanPlay_() {
  94233. this.removeClass("vjs-waiting");
  94234. this.trigger("canplay");
  94235. };
  94236. _proto.handleTechCanPlayThrough_ = function handleTechCanPlayThrough_() {
  94237. this.removeClass("vjs-waiting");
  94238. this.trigger("canplaythrough");
  94239. };
  94240. _proto.handleTechPlaying_ = function handleTechPlaying_() {
  94241. this.removeClass("vjs-waiting");
  94242. this.trigger("playing");
  94243. };
  94244. _proto.handleTechSeeking_ = function handleTechSeeking_() {
  94245. this.addClass("vjs-seeking");
  94246. this.trigger("seeking");
  94247. };
  94248. _proto.handleTechSeeked_ = function handleTechSeeked_() {
  94249. this.removeClass("vjs-seeking");
  94250. this.removeClass("vjs-ended");
  94251. this.trigger("seeked");
  94252. };
  94253. _proto.handleTechFirstPlay_ = function handleTechFirstPlay_() {
  94254. if (this.options_.starttime) {
  94255. log$1.warn("Passing the `starttime` option to the player will be deprecated in 6.0");
  94256. this.currentTime(this.options_.starttime);
  94257. }
  94258. this.addClass("vjs-has-started");
  94259. this.trigger("firstplay");
  94260. };
  94261. _proto.handleTechPause_ = function handleTechPause_() {
  94262. this.removeClass("vjs-playing");
  94263. this.addClass("vjs-paused");
  94264. this.trigger("pause");
  94265. };
  94266. _proto.handleTechEnded_ = function handleTechEnded_() {
  94267. this.addClass("vjs-ended");
  94268. this.removeClass("vjs-waiting");
  94269. if (this.options_.loop) {
  94270. this.currentTime(0);
  94271. this.play();
  94272. } else if (!this.paused()) {
  94273. this.pause();
  94274. }
  94275. this.trigger("ended");
  94276. };
  94277. _proto.handleTechDurationChange_ = function handleTechDurationChange_() {
  94278. this.duration(this.techGet_("duration"));
  94279. };
  94280. _proto.handleTechClick_ = function handleTechClick_(event2) {
  94281. if (!this.controls_) {
  94282. return;
  94283. }
  94284. if (this.options_ === void 0 || this.options_.userActions === void 0 || this.options_.userActions.click === void 0 || this.options_.userActions.click !== false) {
  94285. if (this.options_ !== void 0 && this.options_.userActions !== void 0 && typeof this.options_.userActions.click === "function") {
  94286. this.options_.userActions.click.call(this, event2);
  94287. } else if (this.paused()) {
  94288. silencePromise(this.play());
  94289. } else {
  94290. this.pause();
  94291. }
  94292. }
  94293. };
  94294. _proto.handleTechDoubleClick_ = function handleTechDoubleClick_(event2) {
  94295. if (!this.controls_) {
  94296. return;
  94297. }
  94298. var inAllowedEls = Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"), function(el) {
  94299. return el.contains(event2.target);
  94300. });
  94301. if (!inAllowedEls) {
  94302. if (this.options_ === void 0 || this.options_.userActions === void 0 || this.options_.userActions.doubleClick === void 0 || this.options_.userActions.doubleClick !== false) {
  94303. if (this.options_ !== void 0 && this.options_.userActions !== void 0 && typeof this.options_.userActions.doubleClick === "function") {
  94304. this.options_.userActions.doubleClick.call(this, event2);
  94305. } else if (this.isFullscreen()) {
  94306. this.exitFullscreen();
  94307. } else {
  94308. this.requestFullscreen();
  94309. }
  94310. }
  94311. }
  94312. };
  94313. _proto.handleTechTap_ = function handleTechTap_() {
  94314. this.userActive(!this.userActive());
  94315. };
  94316. _proto.handleTechTouchStart_ = function handleTechTouchStart_() {
  94317. this.userWasActive = this.userActive();
  94318. };
  94319. _proto.handleTechTouchMove_ = function handleTechTouchMove_() {
  94320. if (this.userWasActive) {
  94321. this.reportUserActivity();
  94322. }
  94323. };
  94324. _proto.handleTechTouchEnd_ = function handleTechTouchEnd_(event2) {
  94325. if (event2.cancelable) {
  94326. event2.preventDefault();
  94327. }
  94328. };
  94329. _proto.handleStageClick_ = function handleStageClick_() {
  94330. this.reportUserActivity();
  94331. };
  94332. _proto.toggleFullscreenClass_ = function toggleFullscreenClass_() {
  94333. if (this.isFullscreen()) {
  94334. this.addClass("vjs-fullscreen");
  94335. } else {
  94336. this.removeClass("vjs-fullscreen");
  94337. }
  94338. };
  94339. _proto.documentFullscreenChange_ = function documentFullscreenChange_(e) {
  94340. var targetPlayer = e.target.player;
  94341. if (targetPlayer && targetPlayer !== this) {
  94342. return;
  94343. }
  94344. var el = this.el();
  94345. var isFs = document_1[this.fsApi_.fullscreenElement] === el;
  94346. if (!isFs && el.matches) {
  94347. isFs = el.matches(":" + this.fsApi_.fullscreen);
  94348. } else if (!isFs && el.msMatchesSelector) {
  94349. isFs = el.msMatchesSelector(":" + this.fsApi_.fullscreen);
  94350. }
  94351. this.isFullscreen(isFs);
  94352. };
  94353. _proto.handleTechFullscreenChange_ = function handleTechFullscreenChange_(event2, data) {
  94354. var _this9 = this;
  94355. if (data) {
  94356. if (data.nativeIOSFullscreen) {
  94357. this.addClass("vjs-ios-native-fs");
  94358. this.tech_.one("webkitendfullscreen", function() {
  94359. _this9.removeClass("vjs-ios-native-fs");
  94360. });
  94361. }
  94362. this.isFullscreen(data.isFullscreen);
  94363. }
  94364. };
  94365. _proto.handleTechFullscreenError_ = function handleTechFullscreenError_(event2, err) {
  94366. this.trigger("fullscreenerror", err);
  94367. };
  94368. _proto.togglePictureInPictureClass_ = function togglePictureInPictureClass_() {
  94369. if (this.isInPictureInPicture()) {
  94370. this.addClass("vjs-picture-in-picture");
  94371. } else {
  94372. this.removeClass("vjs-picture-in-picture");
  94373. }
  94374. };
  94375. _proto.handleTechEnterPictureInPicture_ = function handleTechEnterPictureInPicture_(event2) {
  94376. this.isInPictureInPicture(true);
  94377. };
  94378. _proto.handleTechLeavePictureInPicture_ = function handleTechLeavePictureInPicture_(event2) {
  94379. this.isInPictureInPicture(false);
  94380. };
  94381. _proto.handleTechError_ = function handleTechError_() {
  94382. var error = this.tech_.error();
  94383. this.error(error);
  94384. };
  94385. _proto.handleTechTextData_ = function handleTechTextData_() {
  94386. var data = null;
  94387. if (arguments.length > 1) {
  94388. data = arguments[1];
  94389. }
  94390. this.trigger("textdata", data);
  94391. };
  94392. _proto.getCache = function getCache() {
  94393. return this.cache_;
  94394. };
  94395. _proto.resetCache_ = function resetCache_() {
  94396. this.cache_ = {
  94397. currentTime: 0,
  94398. initTime: 0,
  94399. inactivityTimeout: this.options_.inactivityTimeout,
  94400. duration: NaN,
  94401. lastVolume: 1,
  94402. lastPlaybackRate: this.defaultPlaybackRate(),
  94403. media: null,
  94404. src: "",
  94405. source: {},
  94406. sources: [],
  94407. playbackRates: [],
  94408. volume: 1
  94409. };
  94410. };
  94411. _proto.techCall_ = function techCall_(method, arg) {
  94412. this.ready(function() {
  94413. if (method in allowedSetters) {
  94414. return set(this.middleware_, this.tech_, method, arg);
  94415. } else if (method in allowedMediators) {
  94416. return mediate(this.middleware_, this.tech_, method, arg);
  94417. }
  94418. try {
  94419. if (this.tech_) {
  94420. this.tech_[method](arg);
  94421. }
  94422. } catch (e) {
  94423. log$1(e);
  94424. throw e;
  94425. }
  94426. }, true);
  94427. };
  94428. _proto.techGet_ = function techGet_(method) {
  94429. if (!this.tech_ || !this.tech_.isReady_) {
  94430. return;
  94431. }
  94432. if (method in allowedGetters) {
  94433. return get(this.middleware_, this.tech_, method);
  94434. } else if (method in allowedMediators) {
  94435. return mediate(this.middleware_, this.tech_, method);
  94436. }
  94437. try {
  94438. return this.tech_[method]();
  94439. } catch (e) {
  94440. if (this.tech_[method] === void 0) {
  94441. log$1("Video.js: " + method + " method not defined for " + this.techName_ + " playback technology.", e);
  94442. throw e;
  94443. }
  94444. if (e.name === "TypeError") {
  94445. log$1("Video.js: " + method + " unavailable on " + this.techName_ + " playback technology element.", e);
  94446. this.tech_.isReady_ = false;
  94447. throw e;
  94448. }
  94449. log$1(e);
  94450. throw e;
  94451. }
  94452. };
  94453. _proto.play = function play() {
  94454. var _this10 = this;
  94455. var PromiseClass = this.options_.Promise || window_1.Promise;
  94456. if (PromiseClass) {
  94457. return new PromiseClass(function(resolve2) {
  94458. _this10.play_(resolve2);
  94459. });
  94460. }
  94461. return this.play_();
  94462. };
  94463. _proto.play_ = function play_(callback2) {
  94464. var _this11 = this;
  94465. if (callback2 === void 0) {
  94466. callback2 = silencePromise;
  94467. }
  94468. this.playCallbacks_.push(callback2);
  94469. var isSrcReady = Boolean(!this.changingSrc_ && (this.src() || this.currentSrc()));
  94470. var isSafariOrIOS = Boolean(IS_ANY_SAFARI || IS_IOS);
  94471. if (this.waitToPlay_) {
  94472. this.off(["ready", "loadstart"], this.waitToPlay_);
  94473. this.waitToPlay_ = null;
  94474. }
  94475. if (!this.isReady_ || !isSrcReady) {
  94476. this.waitToPlay_ = function(e) {
  94477. _this11.play_();
  94478. };
  94479. this.one(["ready", "loadstart"], this.waitToPlay_);
  94480. if (!isSrcReady && isSafariOrIOS) {
  94481. this.load();
  94482. }
  94483. return;
  94484. }
  94485. var val = this.techGet_("play");
  94486. var isNativeReplay = isSafariOrIOS && this.hasClass("vjs-ended");
  94487. if (isNativeReplay) {
  94488. this.resetProgressBar_();
  94489. }
  94490. if (val === null) {
  94491. this.runPlayTerminatedQueue_();
  94492. } else {
  94493. this.runPlayCallbacks_(val);
  94494. }
  94495. };
  94496. _proto.runPlayTerminatedQueue_ = function runPlayTerminatedQueue_() {
  94497. var queue = this.playTerminatedQueue_.slice(0);
  94498. this.playTerminatedQueue_ = [];
  94499. queue.forEach(function(q2) {
  94500. q2();
  94501. });
  94502. };
  94503. _proto.runPlayCallbacks_ = function runPlayCallbacks_(val) {
  94504. var callbacks = this.playCallbacks_.slice(0);
  94505. this.playCallbacks_ = [];
  94506. this.playTerminatedQueue_ = [];
  94507. callbacks.forEach(function(cb) {
  94508. cb(val);
  94509. });
  94510. };
  94511. _proto.pause = function pause() {
  94512. this.techCall_("pause");
  94513. };
  94514. _proto.paused = function paused() {
  94515. return this.techGet_("paused") === false ? false : true;
  94516. };
  94517. _proto.played = function played() {
  94518. return this.techGet_("played") || createTimeRanges(0, 0);
  94519. };
  94520. _proto.scrubbing = function scrubbing(isScrubbing) {
  94521. if (typeof isScrubbing === "undefined") {
  94522. return this.scrubbing_;
  94523. }
  94524. this.scrubbing_ = !!isScrubbing;
  94525. this.techCall_("setScrubbing", this.scrubbing_);
  94526. if (isScrubbing) {
  94527. this.addClass("vjs-scrubbing");
  94528. } else {
  94529. this.removeClass("vjs-scrubbing");
  94530. }
  94531. };
  94532. _proto.currentTime = function currentTime(seconds) {
  94533. if (typeof seconds !== "undefined") {
  94534. if (seconds < 0) {
  94535. seconds = 0;
  94536. }
  94537. if (!this.isReady_ || this.changingSrc_ || !this.tech_ || !this.tech_.isReady_) {
  94538. this.cache_.initTime = seconds;
  94539. this.off("canplay", this.boundApplyInitTime_);
  94540. this.one("canplay", this.boundApplyInitTime_);
  94541. return;
  94542. }
  94543. this.techCall_("setCurrentTime", seconds);
  94544. this.cache_.initTime = 0;
  94545. return;
  94546. }
  94547. this.cache_.currentTime = this.techGet_("currentTime") || 0;
  94548. return this.cache_.currentTime;
  94549. };
  94550. _proto.applyInitTime_ = function applyInitTime_() {
  94551. this.currentTime(this.cache_.initTime);
  94552. };
  94553. _proto.duration = function duration5(seconds) {
  94554. if (seconds === void 0) {
  94555. return this.cache_.duration !== void 0 ? this.cache_.duration : NaN;
  94556. }
  94557. seconds = parseFloat(seconds);
  94558. if (seconds < 0) {
  94559. seconds = Infinity;
  94560. }
  94561. if (seconds !== this.cache_.duration) {
  94562. this.cache_.duration = seconds;
  94563. if (seconds === Infinity) {
  94564. this.addClass("vjs-live");
  94565. } else {
  94566. this.removeClass("vjs-live");
  94567. }
  94568. if (!isNaN(seconds)) {
  94569. this.trigger("durationchange");
  94570. }
  94571. }
  94572. };
  94573. _proto.remainingTime = function remainingTime() {
  94574. return this.duration() - this.currentTime();
  94575. };
  94576. _proto.remainingTimeDisplay = function remainingTimeDisplay() {
  94577. return Math.floor(this.duration()) - Math.floor(this.currentTime());
  94578. };
  94579. _proto.buffered = function buffered() {
  94580. var buffered2 = this.techGet_("buffered");
  94581. if (!buffered2 || !buffered2.length) {
  94582. buffered2 = createTimeRanges(0, 0);
  94583. }
  94584. return buffered2;
  94585. };
  94586. _proto.bufferedPercent = function bufferedPercent$12() {
  94587. return bufferedPercent(this.buffered(), this.duration());
  94588. };
  94589. _proto.bufferedEnd = function bufferedEnd() {
  94590. var buffered = this.buffered();
  94591. var duration5 = this.duration();
  94592. var end = buffered.end(buffered.length - 1);
  94593. if (end > duration5) {
  94594. end = duration5;
  94595. }
  94596. return end;
  94597. };
  94598. _proto.volume = function volume(percentAsDecimal) {
  94599. var vol;
  94600. if (percentAsDecimal !== void 0) {
  94601. vol = Math.max(0, Math.min(1, parseFloat(percentAsDecimal)));
  94602. this.cache_.volume = vol;
  94603. this.techCall_("setVolume", vol);
  94604. if (vol > 0) {
  94605. this.lastVolume_(vol);
  94606. }
  94607. return;
  94608. }
  94609. vol = parseFloat(this.techGet_("volume"));
  94610. return isNaN(vol) ? 1 : vol;
  94611. };
  94612. _proto.muted = function muted(_muted) {
  94613. if (_muted !== void 0) {
  94614. this.techCall_("setMuted", _muted);
  94615. return;
  94616. }
  94617. return this.techGet_("muted") || false;
  94618. };
  94619. _proto.defaultMuted = function defaultMuted(_defaultMuted) {
  94620. if (_defaultMuted !== void 0) {
  94621. return this.techCall_("setDefaultMuted", _defaultMuted);
  94622. }
  94623. return this.techGet_("defaultMuted") || false;
  94624. };
  94625. _proto.lastVolume_ = function lastVolume_(percentAsDecimal) {
  94626. if (percentAsDecimal !== void 0 && percentAsDecimal !== 0) {
  94627. this.cache_.lastVolume = percentAsDecimal;
  94628. return;
  94629. }
  94630. return this.cache_.lastVolume;
  94631. };
  94632. _proto.supportsFullScreen = function supportsFullScreen() {
  94633. return this.techGet_("supportsFullScreen") || false;
  94634. };
  94635. _proto.isFullscreen = function isFullscreen(isFS) {
  94636. if (isFS !== void 0) {
  94637. var oldValue = this.isFullscreen_;
  94638. this.isFullscreen_ = Boolean(isFS);
  94639. if (this.isFullscreen_ !== oldValue && this.fsApi_.prefixed) {
  94640. this.trigger("fullscreenchange");
  94641. }
  94642. this.toggleFullscreenClass_();
  94643. return;
  94644. }
  94645. return this.isFullscreen_;
  94646. };
  94647. _proto.requestFullscreen = function requestFullscreen(fullscreenOptions) {
  94648. var PromiseClass = this.options_.Promise || window_1.Promise;
  94649. if (PromiseClass) {
  94650. var self2 = this;
  94651. return new PromiseClass(function(resolve2, reject2) {
  94652. function offHandler() {
  94653. self2.off("fullscreenerror", errorHandler);
  94654. self2.off("fullscreenchange", changeHandler);
  94655. }
  94656. function changeHandler() {
  94657. offHandler();
  94658. resolve2();
  94659. }
  94660. function errorHandler(e, err) {
  94661. offHandler();
  94662. reject2(err);
  94663. }
  94664. self2.one("fullscreenchange", changeHandler);
  94665. self2.one("fullscreenerror", errorHandler);
  94666. var promise = self2.requestFullscreenHelper_(fullscreenOptions);
  94667. if (promise) {
  94668. promise.then(offHandler, offHandler);
  94669. promise.then(resolve2, reject2);
  94670. }
  94671. });
  94672. }
  94673. return this.requestFullscreenHelper_();
  94674. };
  94675. _proto.requestFullscreenHelper_ = function requestFullscreenHelper_(fullscreenOptions) {
  94676. var _this12 = this;
  94677. var fsOptions;
  94678. if (!this.fsApi_.prefixed) {
  94679. fsOptions = this.options_.fullscreen && this.options_.fullscreen.options || {};
  94680. if (fullscreenOptions !== void 0) {
  94681. fsOptions = fullscreenOptions;
  94682. }
  94683. }
  94684. if (this.fsApi_.requestFullscreen) {
  94685. var promise = this.el_[this.fsApi_.requestFullscreen](fsOptions);
  94686. if (promise) {
  94687. promise.then(function() {
  94688. return _this12.isFullscreen(true);
  94689. }, function() {
  94690. return _this12.isFullscreen(false);
  94691. });
  94692. }
  94693. return promise;
  94694. } else if (this.tech_.supportsFullScreen() && !this.options_.preferFullWindow === true) {
  94695. this.techCall_("enterFullScreen");
  94696. } else {
  94697. this.enterFullWindow();
  94698. }
  94699. };
  94700. _proto.exitFullscreen = function exitFullscreen() {
  94701. var PromiseClass = this.options_.Promise || window_1.Promise;
  94702. if (PromiseClass) {
  94703. var self2 = this;
  94704. return new PromiseClass(function(resolve2, reject2) {
  94705. function offHandler() {
  94706. self2.off("fullscreenerror", errorHandler);
  94707. self2.off("fullscreenchange", changeHandler);
  94708. }
  94709. function changeHandler() {
  94710. offHandler();
  94711. resolve2();
  94712. }
  94713. function errorHandler(e, err) {
  94714. offHandler();
  94715. reject2(err);
  94716. }
  94717. self2.one("fullscreenchange", changeHandler);
  94718. self2.one("fullscreenerror", errorHandler);
  94719. var promise = self2.exitFullscreenHelper_();
  94720. if (promise) {
  94721. promise.then(offHandler, offHandler);
  94722. promise.then(resolve2, reject2);
  94723. }
  94724. });
  94725. }
  94726. return this.exitFullscreenHelper_();
  94727. };
  94728. _proto.exitFullscreenHelper_ = function exitFullscreenHelper_() {
  94729. var _this13 = this;
  94730. if (this.fsApi_.requestFullscreen) {
  94731. var promise = document_1[this.fsApi_.exitFullscreen]();
  94732. if (promise) {
  94733. silencePromise(promise.then(function() {
  94734. return _this13.isFullscreen(false);
  94735. }));
  94736. }
  94737. return promise;
  94738. } else if (this.tech_.supportsFullScreen() && !this.options_.preferFullWindow === true) {
  94739. this.techCall_("exitFullScreen");
  94740. } else {
  94741. this.exitFullWindow();
  94742. }
  94743. };
  94744. _proto.enterFullWindow = function enterFullWindow() {
  94745. this.isFullscreen(true);
  94746. this.isFullWindow = true;
  94747. this.docOrigOverflow = document_1.documentElement.style.overflow;
  94748. on(document_1, "keydown", this.boundFullWindowOnEscKey_);
  94749. document_1.documentElement.style.overflow = "hidden";
  94750. addClass(document_1.body, "vjs-full-window");
  94751. this.trigger("enterFullWindow");
  94752. };
  94753. _proto.fullWindowOnEscKey = function fullWindowOnEscKey(event2) {
  94754. if (keycode.isEventKey(event2, "Esc")) {
  94755. if (this.isFullscreen() === true) {
  94756. if (!this.isFullWindow) {
  94757. this.exitFullscreen();
  94758. } else {
  94759. this.exitFullWindow();
  94760. }
  94761. }
  94762. }
  94763. };
  94764. _proto.exitFullWindow = function exitFullWindow() {
  94765. this.isFullscreen(false);
  94766. this.isFullWindow = false;
  94767. off(document_1, "keydown", this.boundFullWindowOnEscKey_);
  94768. document_1.documentElement.style.overflow = this.docOrigOverflow;
  94769. removeClass(document_1.body, "vjs-full-window");
  94770. this.trigger("exitFullWindow");
  94771. };
  94772. _proto.disablePictureInPicture = function disablePictureInPicture(value) {
  94773. if (value === void 0) {
  94774. return this.techGet_("disablePictureInPicture");
  94775. }
  94776. this.techCall_("setDisablePictureInPicture", value);
  94777. this.options_.disablePictureInPicture = value;
  94778. this.trigger("disablepictureinpicturechanged");
  94779. };
  94780. _proto.isInPictureInPicture = function isInPictureInPicture(isPiP) {
  94781. if (isPiP !== void 0) {
  94782. this.isInPictureInPicture_ = !!isPiP;
  94783. this.togglePictureInPictureClass_();
  94784. return;
  94785. }
  94786. return !!this.isInPictureInPicture_;
  94787. };
  94788. _proto.requestPictureInPicture = function requestPictureInPicture() {
  94789. if ("pictureInPictureEnabled" in document_1 && this.disablePictureInPicture() === false) {
  94790. return this.techGet_("requestPictureInPicture");
  94791. }
  94792. };
  94793. _proto.exitPictureInPicture = function exitPictureInPicture() {
  94794. if ("pictureInPictureEnabled" in document_1) {
  94795. return document_1.exitPictureInPicture();
  94796. }
  94797. };
  94798. _proto.handleKeyDown = function handleKeyDown(event2) {
  94799. var userActions = this.options_.userActions;
  94800. if (!userActions || !userActions.hotkeys) {
  94801. return;
  94802. }
  94803. var excludeElement = function excludeElement2(el) {
  94804. var tagName = el.tagName.toLowerCase();
  94805. if (el.isContentEditable) {
  94806. return true;
  94807. }
  94808. var allowedInputTypes = ["button", "checkbox", "hidden", "radio", "reset", "submit"];
  94809. if (tagName === "input") {
  94810. return allowedInputTypes.indexOf(el.type) === -1;
  94811. }
  94812. var excludedTags = ["textarea"];
  94813. return excludedTags.indexOf(tagName) !== -1;
  94814. };
  94815. if (excludeElement(this.el_.ownerDocument.activeElement)) {
  94816. return;
  94817. }
  94818. if (typeof userActions.hotkeys === "function") {
  94819. userActions.hotkeys.call(this, event2);
  94820. } else {
  94821. this.handleHotkeys(event2);
  94822. }
  94823. };
  94824. _proto.handleHotkeys = function handleHotkeys(event2) {
  94825. var hotkeys = this.options_.userActions ? this.options_.userActions.hotkeys : {};
  94826. var _hotkeys$fullscreenKe = hotkeys.fullscreenKey, fullscreenKey = _hotkeys$fullscreenKe === void 0 ? function(keydownEvent) {
  94827. return keycode.isEventKey(keydownEvent, "f");
  94828. } : _hotkeys$fullscreenKe, _hotkeys$muteKey = hotkeys.muteKey, muteKey = _hotkeys$muteKey === void 0 ? function(keydownEvent) {
  94829. return keycode.isEventKey(keydownEvent, "m");
  94830. } : _hotkeys$muteKey, _hotkeys$playPauseKey = hotkeys.playPauseKey, playPauseKey = _hotkeys$playPauseKey === void 0 ? function(keydownEvent) {
  94831. return keycode.isEventKey(keydownEvent, "k") || keycode.isEventKey(keydownEvent, "Space");
  94832. } : _hotkeys$playPauseKey;
  94833. if (fullscreenKey.call(this, event2)) {
  94834. event2.preventDefault();
  94835. event2.stopPropagation();
  94836. var FSToggle = Component$1.getComponent("FullscreenToggle");
  94837. if (document_1[this.fsApi_.fullscreenEnabled] !== false) {
  94838. FSToggle.prototype.handleClick.call(this, event2);
  94839. }
  94840. } else if (muteKey.call(this, event2)) {
  94841. event2.preventDefault();
  94842. event2.stopPropagation();
  94843. var MuteToggle2 = Component$1.getComponent("MuteToggle");
  94844. MuteToggle2.prototype.handleClick.call(this, event2);
  94845. } else if (playPauseKey.call(this, event2)) {
  94846. event2.preventDefault();
  94847. event2.stopPropagation();
  94848. var PlayToggle2 = Component$1.getComponent("PlayToggle");
  94849. PlayToggle2.prototype.handleClick.call(this, event2);
  94850. }
  94851. };
  94852. _proto.canPlayType = function canPlayType3(type2) {
  94853. var can;
  94854. for (var i2 = 0, j = this.options_.techOrder; i2 < j.length; i2++) {
  94855. var techName = j[i2];
  94856. var tech = Tech$1.getTech(techName);
  94857. if (!tech) {
  94858. tech = Component$1.getComponent(techName);
  94859. }
  94860. if (!tech) {
  94861. log$1.error('The "' + techName + '" tech is undefined. Skipped browser support check for that tech.');
  94862. continue;
  94863. }
  94864. if (tech.isSupported()) {
  94865. can = tech.canPlayType(type2);
  94866. if (can) {
  94867. return can;
  94868. }
  94869. }
  94870. }
  94871. return "";
  94872. };
  94873. _proto.selectSource = function selectSource(sources) {
  94874. var _this14 = this;
  94875. var techs = this.options_.techOrder.map(function(techName) {
  94876. return [techName, Tech$1.getTech(techName)];
  94877. }).filter(function(_ref) {
  94878. var techName = _ref[0], tech = _ref[1];
  94879. if (tech) {
  94880. return tech.isSupported();
  94881. }
  94882. log$1.error('The "' + techName + '" tech is undefined. Skipped browser support check for that tech.');
  94883. return false;
  94884. });
  94885. var findFirstPassingTechSourcePair = function findFirstPassingTechSourcePair2(outerArray, innerArray, tester) {
  94886. var found;
  94887. outerArray.some(function(outerChoice) {
  94888. return innerArray.some(function(innerChoice) {
  94889. found = tester(outerChoice, innerChoice);
  94890. if (found) {
  94891. return true;
  94892. }
  94893. });
  94894. });
  94895. return found;
  94896. };
  94897. var foundSourceAndTech;
  94898. var flip = function flip2(fn2) {
  94899. return function(a, b) {
  94900. return fn2(b, a);
  94901. };
  94902. };
  94903. var finder = function finder2(_ref2, source) {
  94904. var techName = _ref2[0], tech = _ref2[1];
  94905. if (tech.canPlaySource(source, _this14.options_[techName.toLowerCase()])) {
  94906. return {
  94907. source,
  94908. tech: techName
  94909. };
  94910. }
  94911. };
  94912. if (this.options_.sourceOrder) {
  94913. foundSourceAndTech = findFirstPassingTechSourcePair(sources, techs, flip(finder));
  94914. } else {
  94915. foundSourceAndTech = findFirstPassingTechSourcePair(techs, sources, finder);
  94916. }
  94917. return foundSourceAndTech || false;
  94918. };
  94919. _proto.handleSrc_ = function handleSrc_(source, isRetry) {
  94920. var _this15 = this;
  94921. if (typeof source === "undefined") {
  94922. return this.cache_.src || "";
  94923. }
  94924. if (this.resetRetryOnError_) {
  94925. this.resetRetryOnError_();
  94926. }
  94927. var sources = filterSource(source);
  94928. if (!sources.length) {
  94929. this.setTimeout(function() {
  94930. this.error({
  94931. code: 4,
  94932. message: this.options_.notSupportedMessage
  94933. });
  94934. }, 0);
  94935. return;
  94936. }
  94937. this.changingSrc_ = true;
  94938. if (!isRetry) {
  94939. this.cache_.sources = sources;
  94940. }
  94941. this.updateSourceCaches_(sources[0]);
  94942. setSource(this, sources[0], function(middlewareSource, mws) {
  94943. _this15.middleware_ = mws;
  94944. if (!isRetry) {
  94945. _this15.cache_.sources = sources;
  94946. }
  94947. _this15.updateSourceCaches_(middlewareSource);
  94948. var err = _this15.src_(middlewareSource);
  94949. if (err) {
  94950. if (sources.length > 1) {
  94951. return _this15.handleSrc_(sources.slice(1));
  94952. }
  94953. _this15.changingSrc_ = false;
  94954. _this15.setTimeout(function() {
  94955. this.error({
  94956. code: 4,
  94957. message: this.options_.notSupportedMessage
  94958. });
  94959. }, 0);
  94960. _this15.triggerReady();
  94961. return;
  94962. }
  94963. setTech(mws, _this15.tech_);
  94964. });
  94965. if (this.options_.retryOnError && sources.length > 1) {
  94966. var retry = function retry2() {
  94967. _this15.error(null);
  94968. _this15.handleSrc_(sources.slice(1), true);
  94969. };
  94970. var stopListeningForErrors = function stopListeningForErrors2() {
  94971. _this15.off("error", retry);
  94972. };
  94973. this.one("error", retry);
  94974. this.one("playing", stopListeningForErrors);
  94975. this.resetRetryOnError_ = function() {
  94976. _this15.off("error", retry);
  94977. _this15.off("playing", stopListeningForErrors);
  94978. };
  94979. }
  94980. };
  94981. _proto.src = function src(source) {
  94982. return this.handleSrc_(source, false);
  94983. };
  94984. _proto.src_ = function src_(source) {
  94985. var _this16 = this;
  94986. var sourceTech = this.selectSource([source]);
  94987. if (!sourceTech) {
  94988. return true;
  94989. }
  94990. if (!titleCaseEquals(sourceTech.tech, this.techName_)) {
  94991. this.changingSrc_ = true;
  94992. this.loadTech_(sourceTech.tech, sourceTech.source);
  94993. this.tech_.ready(function() {
  94994. _this16.changingSrc_ = false;
  94995. });
  94996. return false;
  94997. }
  94998. this.ready(function() {
  94999. if (this.tech_.constructor.prototype.hasOwnProperty("setSource")) {
  95000. this.techCall_("setSource", source);
  95001. } else {
  95002. this.techCall_("src", source.src);
  95003. }
  95004. this.changingSrc_ = false;
  95005. }, true);
  95006. return false;
  95007. };
  95008. _proto.load = function load() {
  95009. this.techCall_("load");
  95010. };
  95011. _proto.reset = function reset3() {
  95012. var _this17 = this;
  95013. var PromiseClass = this.options_.Promise || window_1.Promise;
  95014. if (this.paused() || !PromiseClass) {
  95015. this.doReset_();
  95016. } else {
  95017. var playPromise = this.play();
  95018. silencePromise(playPromise.then(function() {
  95019. return _this17.doReset_();
  95020. }));
  95021. }
  95022. };
  95023. _proto.doReset_ = function doReset_() {
  95024. if (this.tech_) {
  95025. this.tech_.clearTracks("text");
  95026. }
  95027. this.resetCache_();
  95028. this.poster("");
  95029. this.loadTech_(this.options_.techOrder[0], null);
  95030. this.techCall_("reset");
  95031. this.resetControlBarUI_();
  95032. if (isEvented(this)) {
  95033. this.trigger("playerreset");
  95034. }
  95035. };
  95036. _proto.resetControlBarUI_ = function resetControlBarUI_() {
  95037. this.resetProgressBar_();
  95038. this.resetPlaybackRate_();
  95039. this.resetVolumeBar_();
  95040. };
  95041. _proto.resetProgressBar_ = function resetProgressBar_() {
  95042. this.currentTime(0);
  95043. var _ref3 = this.controlBar || {}, durationDisplay = _ref3.durationDisplay, remainingTimeDisplay = _ref3.remainingTimeDisplay;
  95044. if (durationDisplay) {
  95045. durationDisplay.updateContent();
  95046. }
  95047. if (remainingTimeDisplay) {
  95048. remainingTimeDisplay.updateContent();
  95049. }
  95050. };
  95051. _proto.resetPlaybackRate_ = function resetPlaybackRate_() {
  95052. this.playbackRate(this.defaultPlaybackRate());
  95053. this.handleTechRateChange_();
  95054. };
  95055. _proto.resetVolumeBar_ = function resetVolumeBar_() {
  95056. this.volume(1);
  95057. this.trigger("volumechange");
  95058. };
  95059. _proto.currentSources = function currentSources() {
  95060. var source = this.currentSource();
  95061. var sources = [];
  95062. if (Object.keys(source).length !== 0) {
  95063. sources.push(source);
  95064. }
  95065. return this.cache_.sources || sources;
  95066. };
  95067. _proto.currentSource = function currentSource() {
  95068. return this.cache_.source || {};
  95069. };
  95070. _proto.currentSrc = function currentSrc() {
  95071. return this.currentSource() && this.currentSource().src || "";
  95072. };
  95073. _proto.currentType = function currentType() {
  95074. return this.currentSource() && this.currentSource().type || "";
  95075. };
  95076. _proto.preload = function preload(value) {
  95077. if (value !== void 0) {
  95078. this.techCall_("setPreload", value);
  95079. this.options_.preload = value;
  95080. return;
  95081. }
  95082. return this.techGet_("preload");
  95083. };
  95084. _proto.autoplay = function autoplay(value) {
  95085. if (value === void 0) {
  95086. return this.options_.autoplay || false;
  95087. }
  95088. var techAutoplay;
  95089. if (typeof value === "string" && /(any|play|muted)/.test(value) || value === true && this.options_.normalizeAutoplay) {
  95090. this.options_.autoplay = value;
  95091. this.manualAutoplay_(typeof value === "string" ? value : "play");
  95092. techAutoplay = false;
  95093. } else if (!value) {
  95094. this.options_.autoplay = false;
  95095. } else {
  95096. this.options_.autoplay = true;
  95097. }
  95098. techAutoplay = typeof techAutoplay === "undefined" ? this.options_.autoplay : techAutoplay;
  95099. if (this.tech_) {
  95100. this.techCall_("setAutoplay", techAutoplay);
  95101. }
  95102. };
  95103. _proto.playsinline = function playsinline(value) {
  95104. if (value !== void 0) {
  95105. this.techCall_("setPlaysinline", value);
  95106. this.options_.playsinline = value;
  95107. return this;
  95108. }
  95109. return this.techGet_("playsinline");
  95110. };
  95111. _proto.loop = function loop(value) {
  95112. if (value !== void 0) {
  95113. this.techCall_("setLoop", value);
  95114. this.options_.loop = value;
  95115. return;
  95116. }
  95117. return this.techGet_("loop");
  95118. };
  95119. _proto.poster = function poster(src) {
  95120. if (src === void 0) {
  95121. return this.poster_;
  95122. }
  95123. if (!src) {
  95124. src = "";
  95125. }
  95126. if (src === this.poster_) {
  95127. return;
  95128. }
  95129. this.poster_ = src;
  95130. this.techCall_("setPoster", src);
  95131. this.isPosterFromTech_ = false;
  95132. this.trigger("posterchange");
  95133. };
  95134. _proto.handleTechPosterChange_ = function handleTechPosterChange_() {
  95135. if ((!this.poster_ || this.options_.techCanOverridePoster) && this.tech_ && this.tech_.poster) {
  95136. var newPoster = this.tech_.poster() || "";
  95137. if (newPoster !== this.poster_) {
  95138. this.poster_ = newPoster;
  95139. this.isPosterFromTech_ = true;
  95140. this.trigger("posterchange");
  95141. }
  95142. }
  95143. };
  95144. _proto.controls = function controls(bool) {
  95145. if (bool === void 0) {
  95146. return !!this.controls_;
  95147. }
  95148. bool = !!bool;
  95149. if (this.controls_ === bool) {
  95150. return;
  95151. }
  95152. this.controls_ = bool;
  95153. if (this.usingNativeControls()) {
  95154. this.techCall_("setControls", bool);
  95155. }
  95156. if (this.controls_) {
  95157. this.removeClass("vjs-controls-disabled");
  95158. this.addClass("vjs-controls-enabled");
  95159. this.trigger("controlsenabled");
  95160. if (!this.usingNativeControls()) {
  95161. this.addTechControlsListeners_();
  95162. }
  95163. } else {
  95164. this.removeClass("vjs-controls-enabled");
  95165. this.addClass("vjs-controls-disabled");
  95166. this.trigger("controlsdisabled");
  95167. if (!this.usingNativeControls()) {
  95168. this.removeTechControlsListeners_();
  95169. }
  95170. }
  95171. };
  95172. _proto.usingNativeControls = function usingNativeControls(bool) {
  95173. if (bool === void 0) {
  95174. return !!this.usingNativeControls_;
  95175. }
  95176. bool = !!bool;
  95177. if (this.usingNativeControls_ === bool) {
  95178. return;
  95179. }
  95180. this.usingNativeControls_ = bool;
  95181. if (this.usingNativeControls_) {
  95182. this.addClass("vjs-using-native-controls");
  95183. this.trigger("usingnativecontrols");
  95184. } else {
  95185. this.removeClass("vjs-using-native-controls");
  95186. this.trigger("usingcustomcontrols");
  95187. }
  95188. };
  95189. _proto.error = function error(err) {
  95190. var _this18 = this;
  95191. if (err === void 0) {
  95192. return this.error_ || null;
  95193. }
  95194. hooks("beforeerror").forEach(function(hookFunction) {
  95195. var newErr = hookFunction(_this18, err);
  95196. if (!(isObject2(newErr) && !Array.isArray(newErr) || typeof newErr === "string" || typeof newErr === "number" || newErr === null)) {
  95197. _this18.log.error("please return a value that MediaError expects in beforeerror hooks");
  95198. return;
  95199. }
  95200. err = newErr;
  95201. });
  95202. if (this.options_.suppressNotSupportedError && err && err.code === 4) {
  95203. var triggerSuppressedError = function triggerSuppressedError2() {
  95204. this.error(err);
  95205. };
  95206. this.options_.suppressNotSupportedError = false;
  95207. this.any(["click", "touchstart"], triggerSuppressedError);
  95208. this.one("loadstart", function() {
  95209. this.off(["click", "touchstart"], triggerSuppressedError);
  95210. });
  95211. return;
  95212. }
  95213. if (err === null) {
  95214. this.error_ = err;
  95215. this.removeClass("vjs-error");
  95216. if (this.errorDisplay) {
  95217. this.errorDisplay.close();
  95218. }
  95219. return;
  95220. }
  95221. this.error_ = new MediaError(err);
  95222. this.addClass("vjs-error");
  95223. log$1.error("(CODE:" + this.error_.code + " " + MediaError.errorTypes[this.error_.code] + ")", this.error_.message, this.error_);
  95224. this.trigger("error");
  95225. hooks("error").forEach(function(hookFunction) {
  95226. return hookFunction(_this18, _this18.error_);
  95227. });
  95228. return;
  95229. };
  95230. _proto.reportUserActivity = function reportUserActivity(event2) {
  95231. this.userActivity_ = true;
  95232. };
  95233. _proto.userActive = function userActive(bool) {
  95234. if (bool === void 0) {
  95235. return this.userActive_;
  95236. }
  95237. bool = !!bool;
  95238. if (bool === this.userActive_) {
  95239. return;
  95240. }
  95241. this.userActive_ = bool;
  95242. if (this.userActive_) {
  95243. this.userActivity_ = true;
  95244. this.removeClass("vjs-user-inactive");
  95245. this.addClass("vjs-user-active");
  95246. this.trigger("useractive");
  95247. return;
  95248. }
  95249. if (this.tech_) {
  95250. this.tech_.one("mousemove", function(e) {
  95251. e.stopPropagation();
  95252. e.preventDefault();
  95253. });
  95254. }
  95255. this.userActivity_ = false;
  95256. this.removeClass("vjs-user-active");
  95257. this.addClass("vjs-user-inactive");
  95258. this.trigger("userinactive");
  95259. };
  95260. _proto.listenForUserActivity_ = function listenForUserActivity_() {
  95261. var mouseInProgress;
  95262. var lastMoveX;
  95263. var lastMoveY;
  95264. var handleActivity = bind(this, this.reportUserActivity);
  95265. var handleMouseMove = function handleMouseMove2(e) {
  95266. if (e.screenX !== lastMoveX || e.screenY !== lastMoveY) {
  95267. lastMoveX = e.screenX;
  95268. lastMoveY = e.screenY;
  95269. handleActivity();
  95270. }
  95271. };
  95272. var handleMouseDown = function handleMouseDown2() {
  95273. handleActivity();
  95274. this.clearInterval(mouseInProgress);
  95275. mouseInProgress = this.setInterval(handleActivity, 250);
  95276. };
  95277. var handleMouseUpAndMouseLeave = function handleMouseUpAndMouseLeave2(event2) {
  95278. handleActivity();
  95279. this.clearInterval(mouseInProgress);
  95280. };
  95281. this.on("mousedown", handleMouseDown);
  95282. this.on("mousemove", handleMouseMove);
  95283. this.on("mouseup", handleMouseUpAndMouseLeave);
  95284. this.on("mouseleave", handleMouseUpAndMouseLeave);
  95285. var controlBar = this.getChild("controlBar");
  95286. if (controlBar && !IS_IOS && !IS_ANDROID) {
  95287. controlBar.on("mouseenter", function(event2) {
  95288. if (this.player().options_.inactivityTimeout !== 0) {
  95289. this.player().cache_.inactivityTimeout = this.player().options_.inactivityTimeout;
  95290. }
  95291. this.player().options_.inactivityTimeout = 0;
  95292. });
  95293. controlBar.on("mouseleave", function(event2) {
  95294. this.player().options_.inactivityTimeout = this.player().cache_.inactivityTimeout;
  95295. });
  95296. }
  95297. this.on("keydown", handleActivity);
  95298. this.on("keyup", handleActivity);
  95299. var inactivityTimeout;
  95300. this.setInterval(function() {
  95301. if (!this.userActivity_) {
  95302. return;
  95303. }
  95304. this.userActivity_ = false;
  95305. this.userActive(true);
  95306. this.clearTimeout(inactivityTimeout);
  95307. var timeout = this.options_.inactivityTimeout;
  95308. if (timeout <= 0) {
  95309. return;
  95310. }
  95311. inactivityTimeout = this.setTimeout(function() {
  95312. if (!this.userActivity_) {
  95313. this.userActive(false);
  95314. }
  95315. }, timeout);
  95316. }, 250);
  95317. };
  95318. _proto.playbackRate = function playbackRate(rate) {
  95319. if (rate !== void 0) {
  95320. this.techCall_("setPlaybackRate", rate);
  95321. return;
  95322. }
  95323. if (this.tech_ && this.tech_.featuresPlaybackRate) {
  95324. return this.cache_.lastPlaybackRate || this.techGet_("playbackRate");
  95325. }
  95326. return 1;
  95327. };
  95328. _proto.defaultPlaybackRate = function defaultPlaybackRate(rate) {
  95329. if (rate !== void 0) {
  95330. return this.techCall_("setDefaultPlaybackRate", rate);
  95331. }
  95332. if (this.tech_ && this.tech_.featuresPlaybackRate) {
  95333. return this.techGet_("defaultPlaybackRate");
  95334. }
  95335. return 1;
  95336. };
  95337. _proto.isAudio = function isAudio(bool) {
  95338. if (bool !== void 0) {
  95339. this.isAudio_ = !!bool;
  95340. return;
  95341. }
  95342. return !!this.isAudio_;
  95343. };
  95344. _proto.enableAudioOnlyUI_ = function enableAudioOnlyUI_() {
  95345. var _this19 = this;
  95346. this.addClass("vjs-audio-only-mode");
  95347. var playerChildren = this.children();
  95348. var controlBar = this.getChild("ControlBar");
  95349. var controlBarHeight = controlBar && controlBar.currentHeight();
  95350. playerChildren.forEach(function(child) {
  95351. if (child === controlBar) {
  95352. return;
  95353. }
  95354. if (child.el_ && !child.hasClass("vjs-hidden")) {
  95355. child.hide();
  95356. _this19.audioOnlyCache_.hiddenChildren.push(child);
  95357. }
  95358. });
  95359. this.audioOnlyCache_.playerHeight = this.currentHeight();
  95360. this.height(controlBarHeight);
  95361. this.trigger("audioonlymodechange");
  95362. };
  95363. _proto.disableAudioOnlyUI_ = function disableAudioOnlyUI_() {
  95364. this.removeClass("vjs-audio-only-mode");
  95365. this.audioOnlyCache_.hiddenChildren.forEach(function(child) {
  95366. return child.show();
  95367. });
  95368. this.height(this.audioOnlyCache_.playerHeight);
  95369. this.trigger("audioonlymodechange");
  95370. };
  95371. _proto.audioOnlyMode = function audioOnlyMode(value) {
  95372. var _this20 = this;
  95373. if (typeof value !== "boolean" || value === this.audioOnlyMode_) {
  95374. return this.audioOnlyMode_;
  95375. }
  95376. this.audioOnlyMode_ = value;
  95377. var PromiseClass = this.options_.Promise || window_1.Promise;
  95378. if (PromiseClass) {
  95379. if (value) {
  95380. var exitPromises = [];
  95381. if (this.isInPictureInPicture()) {
  95382. exitPromises.push(this.exitPictureInPicture());
  95383. }
  95384. if (this.isFullscreen()) {
  95385. exitPromises.push(this.exitFullscreen());
  95386. }
  95387. if (this.audioPosterMode()) {
  95388. exitPromises.push(this.audioPosterMode(false));
  95389. }
  95390. return PromiseClass.all(exitPromises).then(function() {
  95391. return _this20.enableAudioOnlyUI_();
  95392. });
  95393. }
  95394. return PromiseClass.resolve().then(function() {
  95395. return _this20.disableAudioOnlyUI_();
  95396. });
  95397. }
  95398. if (value) {
  95399. if (this.isInPictureInPicture()) {
  95400. this.exitPictureInPicture();
  95401. }
  95402. if (this.isFullscreen()) {
  95403. this.exitFullscreen();
  95404. }
  95405. this.enableAudioOnlyUI_();
  95406. } else {
  95407. this.disableAudioOnlyUI_();
  95408. }
  95409. };
  95410. _proto.enablePosterModeUI_ = function enablePosterModeUI_() {
  95411. var tech = this.tech_ && this.tech_;
  95412. tech.hide();
  95413. this.addClass("vjs-audio-poster-mode");
  95414. this.trigger("audiopostermodechange");
  95415. };
  95416. _proto.disablePosterModeUI_ = function disablePosterModeUI_() {
  95417. var tech = this.tech_ && this.tech_;
  95418. tech.show();
  95419. this.removeClass("vjs-audio-poster-mode");
  95420. this.trigger("audiopostermodechange");
  95421. };
  95422. _proto.audioPosterMode = function audioPosterMode(value) {
  95423. var _this21 = this;
  95424. if (typeof value !== "boolean" || value === this.audioPosterMode_) {
  95425. return this.audioPosterMode_;
  95426. }
  95427. this.audioPosterMode_ = value;
  95428. var PromiseClass = this.options_.Promise || window_1.Promise;
  95429. if (PromiseClass) {
  95430. if (value) {
  95431. if (this.audioOnlyMode()) {
  95432. var audioOnlyModePromise = this.audioOnlyMode(false);
  95433. return audioOnlyModePromise.then(function() {
  95434. _this21.enablePosterModeUI_();
  95435. });
  95436. }
  95437. return PromiseClass.resolve().then(function() {
  95438. _this21.enablePosterModeUI_();
  95439. });
  95440. }
  95441. return PromiseClass.resolve().then(function() {
  95442. _this21.disablePosterModeUI_();
  95443. });
  95444. }
  95445. if (value) {
  95446. if (this.audioOnlyMode()) {
  95447. this.audioOnlyMode(false);
  95448. }
  95449. this.enablePosterModeUI_();
  95450. return;
  95451. }
  95452. this.disablePosterModeUI_();
  95453. };
  95454. _proto.addTextTrack = function addTextTrack(kind, label2, language) {
  95455. if (this.tech_) {
  95456. return this.tech_.addTextTrack(kind, label2, language);
  95457. }
  95458. };
  95459. _proto.addRemoteTextTrack = function addRemoteTextTrack(options2, manualCleanup) {
  95460. if (this.tech_) {
  95461. return this.tech_.addRemoteTextTrack(options2, manualCleanup);
  95462. }
  95463. };
  95464. _proto.removeRemoteTextTrack = function removeRemoteTextTrack(obj) {
  95465. if (obj === void 0) {
  95466. obj = {};
  95467. }
  95468. var _obj = obj, track = _obj.track;
  95469. if (!track) {
  95470. track = obj;
  95471. }
  95472. if (this.tech_) {
  95473. return this.tech_.removeRemoteTextTrack(track);
  95474. }
  95475. };
  95476. _proto.getVideoPlaybackQuality = function getVideoPlaybackQuality() {
  95477. return this.techGet_("getVideoPlaybackQuality");
  95478. };
  95479. _proto.videoWidth = function videoWidth() {
  95480. return this.tech_ && this.tech_.videoWidth && this.tech_.videoWidth() || 0;
  95481. };
  95482. _proto.videoHeight = function videoHeight() {
  95483. return this.tech_ && this.tech_.videoHeight && this.tech_.videoHeight() || 0;
  95484. };
  95485. _proto.language = function language(code) {
  95486. if (code === void 0) {
  95487. return this.language_;
  95488. }
  95489. if (this.language_ !== String(code).toLowerCase()) {
  95490. this.language_ = String(code).toLowerCase();
  95491. if (isEvented(this)) {
  95492. this.trigger("languagechange");
  95493. }
  95494. }
  95495. };
  95496. _proto.languages = function languages() {
  95497. return mergeOptions$3(Player2.prototype.options_.languages, this.languages_);
  95498. };
  95499. _proto.toJSON = function toJSON() {
  95500. var options2 = mergeOptions$3(this.options_);
  95501. var tracks = options2.tracks;
  95502. options2.tracks = [];
  95503. for (var i2 = 0; i2 < tracks.length; i2++) {
  95504. var track = tracks[i2];
  95505. track = mergeOptions$3(track);
  95506. track.player = void 0;
  95507. options2.tracks[i2] = track;
  95508. }
  95509. return options2;
  95510. };
  95511. _proto.createModal = function createModal(content, options2) {
  95512. var _this22 = this;
  95513. options2 = options2 || {};
  95514. options2.content = content || "";
  95515. var modal = new ModalDialog(this, options2);
  95516. this.addChild(modal);
  95517. modal.on("dispose", function() {
  95518. _this22.removeChild(modal);
  95519. });
  95520. modal.open();
  95521. return modal;
  95522. };
  95523. _proto.updateCurrentBreakpoint_ = function updateCurrentBreakpoint_() {
  95524. if (!this.responsive()) {
  95525. return;
  95526. }
  95527. var currentBreakpoint = this.currentBreakpoint();
  95528. var currentWidth = this.currentWidth();
  95529. for (var i2 = 0; i2 < BREAKPOINT_ORDER.length; i2++) {
  95530. var candidateBreakpoint = BREAKPOINT_ORDER[i2];
  95531. var maxWidth = this.breakpoints_[candidateBreakpoint];
  95532. if (currentWidth <= maxWidth) {
  95533. if (currentBreakpoint === candidateBreakpoint) {
  95534. return;
  95535. }
  95536. if (currentBreakpoint) {
  95537. this.removeClass(BREAKPOINT_CLASSES[currentBreakpoint]);
  95538. }
  95539. this.addClass(BREAKPOINT_CLASSES[candidateBreakpoint]);
  95540. this.breakpoint_ = candidateBreakpoint;
  95541. break;
  95542. }
  95543. }
  95544. };
  95545. _proto.removeCurrentBreakpoint_ = function removeCurrentBreakpoint_() {
  95546. var className = this.currentBreakpointClass();
  95547. this.breakpoint_ = "";
  95548. if (className) {
  95549. this.removeClass(className);
  95550. }
  95551. };
  95552. _proto.breakpoints = function breakpoints(_breakpoints) {
  95553. if (_breakpoints === void 0) {
  95554. return assign(this.breakpoints_);
  95555. }
  95556. this.breakpoint_ = "";
  95557. this.breakpoints_ = assign({}, DEFAULT_BREAKPOINTS, _breakpoints);
  95558. this.updateCurrentBreakpoint_();
  95559. return assign(this.breakpoints_);
  95560. };
  95561. _proto.responsive = function responsive(value) {
  95562. if (value === void 0) {
  95563. return this.responsive_;
  95564. }
  95565. value = Boolean(value);
  95566. var current = this.responsive_;
  95567. if (value === current) {
  95568. return;
  95569. }
  95570. this.responsive_ = value;
  95571. if (value) {
  95572. this.on("playerresize", this.boundUpdateCurrentBreakpoint_);
  95573. this.updateCurrentBreakpoint_();
  95574. } else {
  95575. this.off("playerresize", this.boundUpdateCurrentBreakpoint_);
  95576. this.removeCurrentBreakpoint_();
  95577. }
  95578. return value;
  95579. };
  95580. _proto.currentBreakpoint = function currentBreakpoint() {
  95581. return this.breakpoint_;
  95582. };
  95583. _proto.currentBreakpointClass = function currentBreakpointClass() {
  95584. return BREAKPOINT_CLASSES[this.breakpoint_] || "";
  95585. };
  95586. _proto.loadMedia = function loadMedia(media, ready) {
  95587. var _this23 = this;
  95588. if (!media || typeof media !== "object") {
  95589. return;
  95590. }
  95591. this.reset();
  95592. this.cache_.media = mergeOptions$3(media);
  95593. var _this$cache_$media = this.cache_.media, artwork = _this$cache_$media.artwork, poster = _this$cache_$media.poster, src = _this$cache_$media.src, textTracks = _this$cache_$media.textTracks;
  95594. if (!artwork && poster) {
  95595. this.cache_.media.artwork = [{
  95596. src: poster,
  95597. type: getMimetype(poster)
  95598. }];
  95599. }
  95600. if (src) {
  95601. this.src(src);
  95602. }
  95603. if (poster) {
  95604. this.poster(poster);
  95605. }
  95606. if (Array.isArray(textTracks)) {
  95607. textTracks.forEach(function(tt2) {
  95608. return _this23.addRemoteTextTrack(tt2, false);
  95609. });
  95610. }
  95611. this.ready(ready);
  95612. };
  95613. _proto.getMedia = function getMedia() {
  95614. if (!this.cache_.media) {
  95615. var poster = this.poster();
  95616. var src = this.currentSources();
  95617. var textTracks = Array.prototype.map.call(this.remoteTextTracks(), function(tt2) {
  95618. return {
  95619. kind: tt2.kind,
  95620. label: tt2.label,
  95621. language: tt2.language,
  95622. src: tt2.src
  95623. };
  95624. });
  95625. var media = {
  95626. src,
  95627. textTracks
  95628. };
  95629. if (poster) {
  95630. media.poster = poster;
  95631. media.artwork = [{
  95632. src: media.poster,
  95633. type: getMimetype(media.poster)
  95634. }];
  95635. }
  95636. return media;
  95637. }
  95638. return mergeOptions$3(this.cache_.media);
  95639. };
  95640. Player2.getTagSettings = function getTagSettings(tag) {
  95641. var baseOptions = {
  95642. sources: [],
  95643. tracks: []
  95644. };
  95645. var tagOptions = getAttributes(tag);
  95646. var dataSetup = tagOptions["data-setup"];
  95647. if (hasClass(tag, "vjs-fill")) {
  95648. tagOptions.fill = true;
  95649. }
  95650. if (hasClass(tag, "vjs-fluid")) {
  95651. tagOptions.fluid = true;
  95652. }
  95653. if (dataSetup !== null) {
  95654. var _safeParseTuple = tuple(dataSetup || "{}"), err = _safeParseTuple[0], data = _safeParseTuple[1];
  95655. if (err) {
  95656. log$1.error(err);
  95657. }
  95658. assign(tagOptions, data);
  95659. }
  95660. assign(baseOptions, tagOptions);
  95661. if (tag.hasChildNodes()) {
  95662. var children = tag.childNodes;
  95663. for (var i2 = 0, j = children.length; i2 < j; i2++) {
  95664. var child = children[i2];
  95665. var childName = child.nodeName.toLowerCase();
  95666. if (childName === "source") {
  95667. baseOptions.sources.push(getAttributes(child));
  95668. } else if (childName === "track") {
  95669. baseOptions.tracks.push(getAttributes(child));
  95670. }
  95671. }
  95672. }
  95673. return baseOptions;
  95674. };
  95675. _proto.flexNotSupported_ = function flexNotSupported_() {
  95676. var elem = document_1.createElement("i");
  95677. return !("flexBasis" in elem.style || "webkitFlexBasis" in elem.style || "mozFlexBasis" in elem.style || "msFlexBasis" in elem.style || "msFlexOrder" in elem.style);
  95678. };
  95679. _proto.debug = function debug(enabled) {
  95680. if (enabled === void 0) {
  95681. return this.debugEnabled_;
  95682. }
  95683. if (enabled) {
  95684. this.trigger("debugon");
  95685. this.previousLogLevel_ = this.log.level;
  95686. this.log.level("debug");
  95687. this.debugEnabled_ = true;
  95688. } else {
  95689. this.trigger("debugoff");
  95690. this.log.level(this.previousLogLevel_);
  95691. this.previousLogLevel_ = void 0;
  95692. this.debugEnabled_ = false;
  95693. }
  95694. };
  95695. _proto.playbackRates = function playbackRates(newRates) {
  95696. if (newRates === void 0) {
  95697. return this.cache_.playbackRates;
  95698. }
  95699. if (!Array.isArray(newRates)) {
  95700. return;
  95701. }
  95702. if (!newRates.every(function(rate) {
  95703. return typeof rate === "number";
  95704. })) {
  95705. return;
  95706. }
  95707. this.cache_.playbackRates = newRates;
  95708. this.trigger("playbackrateschange");
  95709. };
  95710. return Player2;
  95711. }(Component$1);
  95712. ALL.names.forEach(function(name) {
  95713. var props = ALL[name];
  95714. Player.prototype[props.getterName] = function() {
  95715. if (this.tech_) {
  95716. return this.tech_[props.getterName]();
  95717. }
  95718. this[props.privateName] = this[props.privateName] || new props.ListClass();
  95719. return this[props.privateName];
  95720. };
  95721. });
  95722. Player.prototype.crossorigin = Player.prototype.crossOrigin;
  95723. Player.players = {};
  95724. var navigator$2 = window_1.navigator;
  95725. Player.prototype.options_ = {
  95726. techOrder: Tech$1.defaultTechOrder_,
  95727. html5: {},
  95728. inactivityTimeout: 2e3,
  95729. playbackRates: [],
  95730. liveui: false,
  95731. children: ["mediaLoader", "posterImage", "textTrackDisplay", "loadingSpinner", "bigPlayButton", "liveTracker", "controlBar", "errorDisplay", "textTrackSettings", "resizeManager"],
  95732. language: navigator$2 && (navigator$2.languages && navigator$2.languages[0] || navigator$2.userLanguage || navigator$2.language) || "en",
  95733. languages: {},
  95734. notSupportedMessage: "No compatible source was found for this media.",
  95735. normalizeAutoplay: false,
  95736. fullscreen: {
  95737. options: {
  95738. navigationUI: "hide"
  95739. }
  95740. },
  95741. breakpoints: {},
  95742. responsive: false,
  95743. audioOnlyMode: false,
  95744. audioPosterMode: false
  95745. };
  95746. [
  95747. "ended",
  95748. "seeking",
  95749. "seekable",
  95750. "networkState",
  95751. "readyState"
  95752. ].forEach(function(fn2) {
  95753. Player.prototype[fn2] = function() {
  95754. return this.techGet_(fn2);
  95755. };
  95756. });
  95757. TECH_EVENTS_RETRIGGER.forEach(function(event2) {
  95758. Player.prototype["handleTech" + toTitleCase$1(event2) + "_"] = function() {
  95759. return this.trigger(event2);
  95760. };
  95761. });
  95762. Component$1.registerComponent("Player", Player);
  95763. var BASE_PLUGIN_NAME = "plugin";
  95764. var PLUGIN_CACHE_KEY = "activePlugins_";
  95765. var pluginStorage = {};
  95766. var pluginExists = function pluginExists2(name) {
  95767. return pluginStorage.hasOwnProperty(name);
  95768. };
  95769. var getPlugin = function getPlugin2(name) {
  95770. return pluginExists(name) ? pluginStorage[name] : void 0;
  95771. };
  95772. var markPluginAsActive = function markPluginAsActive2(player, name) {
  95773. player[PLUGIN_CACHE_KEY] = player[PLUGIN_CACHE_KEY] || {};
  95774. player[PLUGIN_CACHE_KEY][name] = true;
  95775. };
  95776. var triggerSetupEvent = function triggerSetupEvent2(player, hash, before) {
  95777. var eventName = (before ? "before" : "") + "pluginsetup";
  95778. player.trigger(eventName, hash);
  95779. player.trigger(eventName + ":" + hash.name, hash);
  95780. };
  95781. var createBasicPlugin = function createBasicPlugin2(name, plugin) {
  95782. var basicPluginWrapper = function basicPluginWrapper2() {
  95783. triggerSetupEvent(this, {
  95784. name,
  95785. plugin,
  95786. instance: null
  95787. }, true);
  95788. var instance = plugin.apply(this, arguments);
  95789. markPluginAsActive(this, name);
  95790. triggerSetupEvent(this, {
  95791. name,
  95792. plugin,
  95793. instance
  95794. });
  95795. return instance;
  95796. };
  95797. Object.keys(plugin).forEach(function(prop) {
  95798. basicPluginWrapper[prop] = plugin[prop];
  95799. });
  95800. return basicPluginWrapper;
  95801. };
  95802. var createPluginFactory = function createPluginFactory2(name, PluginSubClass) {
  95803. PluginSubClass.prototype.name = name;
  95804. return function() {
  95805. triggerSetupEvent(this, {
  95806. name,
  95807. plugin: PluginSubClass,
  95808. instance: null
  95809. }, true);
  95810. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  95811. args[_key] = arguments[_key];
  95812. }
  95813. var instance = _construct(PluginSubClass, [this].concat(args));
  95814. this[name] = function() {
  95815. return instance;
  95816. };
  95817. triggerSetupEvent(this, instance.getEventHash());
  95818. return instance;
  95819. };
  95820. };
  95821. var Plugin = /* @__PURE__ */ function() {
  95822. function Plugin2(player) {
  95823. if (this.constructor === Plugin2) {
  95824. throw new Error("Plugin must be sub-classed; not directly instantiated.");
  95825. }
  95826. this.player = player;
  95827. if (!this.log) {
  95828. this.log = this.player.log.createLogger(this.name);
  95829. }
  95830. evented(this);
  95831. delete this.trigger;
  95832. stateful(this, this.constructor.defaultState);
  95833. markPluginAsActive(player, this.name);
  95834. this.dispose = this.dispose.bind(this);
  95835. player.on("dispose", this.dispose);
  95836. }
  95837. var _proto = Plugin2.prototype;
  95838. _proto.version = function version2() {
  95839. return this.constructor.VERSION;
  95840. };
  95841. _proto.getEventHash = function getEventHash(hash) {
  95842. if (hash === void 0) {
  95843. hash = {};
  95844. }
  95845. hash.name = this.name;
  95846. hash.plugin = this.constructor;
  95847. hash.instance = this;
  95848. return hash;
  95849. };
  95850. _proto.trigger = function trigger$13(event2, hash) {
  95851. if (hash === void 0) {
  95852. hash = {};
  95853. }
  95854. return trigger(this.eventBusEl_, event2, this.getEventHash(hash));
  95855. };
  95856. _proto.handleStateChanged = function handleStateChanged(e) {
  95857. };
  95858. _proto.dispose = function dispose() {
  95859. var name = this.name, player = this.player;
  95860. this.trigger("dispose");
  95861. this.off();
  95862. player.off("dispose", this.dispose);
  95863. player[PLUGIN_CACHE_KEY][name] = false;
  95864. this.player = this.state = null;
  95865. player[name] = createPluginFactory(name, pluginStorage[name]);
  95866. };
  95867. Plugin2.isBasic = function isBasic(plugin) {
  95868. var p = typeof plugin === "string" ? getPlugin(plugin) : plugin;
  95869. return typeof p === "function" && !Plugin2.prototype.isPrototypeOf(p.prototype);
  95870. };
  95871. Plugin2.registerPlugin = function registerPlugin(name, plugin) {
  95872. if (typeof name !== "string") {
  95873. throw new Error('Illegal plugin name, "' + name + '", must be a string, was ' + typeof name + ".");
  95874. }
  95875. if (pluginExists(name)) {
  95876. log$1.warn('A plugin named "' + name + '" already exists. You may want to avoid re-registering plugins!');
  95877. } else if (Player.prototype.hasOwnProperty(name)) {
  95878. throw new Error('Illegal plugin name, "' + name + '", cannot share a name with an existing player method!');
  95879. }
  95880. if (typeof plugin !== "function") {
  95881. throw new Error('Illegal plugin for "' + name + '", must be a function, was ' + typeof plugin + ".");
  95882. }
  95883. pluginStorage[name] = plugin;
  95884. if (name !== BASE_PLUGIN_NAME) {
  95885. if (Plugin2.isBasic(plugin)) {
  95886. Player.prototype[name] = createBasicPlugin(name, plugin);
  95887. } else {
  95888. Player.prototype[name] = createPluginFactory(name, plugin);
  95889. }
  95890. }
  95891. return plugin;
  95892. };
  95893. Plugin2.deregisterPlugin = function deregisterPlugin(name) {
  95894. if (name === BASE_PLUGIN_NAME) {
  95895. throw new Error("Cannot de-register base plugin.");
  95896. }
  95897. if (pluginExists(name)) {
  95898. delete pluginStorage[name];
  95899. delete Player.prototype[name];
  95900. }
  95901. };
  95902. Plugin2.getPlugins = function getPlugins(names2) {
  95903. if (names2 === void 0) {
  95904. names2 = Object.keys(pluginStorage);
  95905. }
  95906. var result;
  95907. names2.forEach(function(name) {
  95908. var plugin = getPlugin(name);
  95909. if (plugin) {
  95910. result = result || {};
  95911. result[name] = plugin;
  95912. }
  95913. });
  95914. return result;
  95915. };
  95916. Plugin2.getPluginVersion = function getPluginVersion(name) {
  95917. var plugin = getPlugin(name);
  95918. return plugin && plugin.VERSION || "";
  95919. };
  95920. return Plugin2;
  95921. }();
  95922. Plugin.getPlugin = getPlugin;
  95923. Plugin.BASE_PLUGIN_NAME = BASE_PLUGIN_NAME;
  95924. Plugin.registerPlugin(BASE_PLUGIN_NAME, Plugin);
  95925. Player.prototype.usingPlugin = function(name) {
  95926. return !!this[PLUGIN_CACHE_KEY] && this[PLUGIN_CACHE_KEY][name] === true;
  95927. };
  95928. Player.prototype.hasPlugin = function(name) {
  95929. return !!pluginExists(name);
  95930. };
  95931. var hasLogged = false;
  95932. var extend = function extend2(superClass, subClassMethods) {
  95933. if (subClassMethods === void 0) {
  95934. subClassMethods = {};
  95935. }
  95936. if (!hasLogged) {
  95937. log$1.warn("videojs.extend is deprecated as of Video.js 7.22.0 and will be removed in Video.js 8.0.0");
  95938. hasLogged = true;
  95939. }
  95940. var subClass = function subClass2() {
  95941. superClass.apply(this, arguments);
  95942. };
  95943. var methods = {};
  95944. if (typeof subClassMethods === "object") {
  95945. if (subClassMethods.constructor !== Object.prototype.constructor) {
  95946. subClass = subClassMethods.constructor;
  95947. }
  95948. methods = subClassMethods;
  95949. } else if (typeof subClassMethods === "function") {
  95950. subClass = subClassMethods;
  95951. }
  95952. _inherits(subClass, superClass);
  95953. if (superClass) {
  95954. subClass.super_ = superClass;
  95955. }
  95956. for (var name in methods) {
  95957. if (methods.hasOwnProperty(name)) {
  95958. subClass.prototype[name] = methods[name];
  95959. }
  95960. }
  95961. return subClass;
  95962. };
  95963. var normalizeId = function normalizeId2(id) {
  95964. return id.indexOf("#") === 0 ? id.slice(1) : id;
  95965. };
  95966. function videojs(id, options2, ready) {
  95967. var player = videojs.getPlayer(id);
  95968. if (player) {
  95969. if (options2) {
  95970. log$1.warn('Player "' + id + '" is already initialised. Options will not be applied.');
  95971. }
  95972. if (ready) {
  95973. player.ready(ready);
  95974. }
  95975. return player;
  95976. }
  95977. var el = typeof id === "string" ? $("#" + normalizeId(id)) : id;
  95978. if (!isEl(el)) {
  95979. throw new TypeError("The element or ID supplied is not valid. (videojs)");
  95980. }
  95981. if (!el.ownerDocument.defaultView || !el.ownerDocument.body.contains(el)) {
  95982. log$1.warn("The element supplied is not included in the DOM");
  95983. }
  95984. options2 = options2 || {};
  95985. if (options2.restoreEl === true) {
  95986. options2.restoreEl = (el.parentNode && el.parentNode.hasAttribute("data-vjs-player") ? el.parentNode : el).cloneNode(true);
  95987. }
  95988. hooks("beforesetup").forEach(function(hookFunction) {
  95989. var opts = hookFunction(el, mergeOptions$3(options2));
  95990. if (!isObject2(opts) || Array.isArray(opts)) {
  95991. log$1.error("please return an object in beforesetup hooks");
  95992. return;
  95993. }
  95994. options2 = mergeOptions$3(options2, opts);
  95995. });
  95996. var PlayerComponent = Component$1.getComponent("Player");
  95997. player = new PlayerComponent(el, options2, ready);
  95998. hooks("setup").forEach(function(hookFunction) {
  95999. return hookFunction(player);
  96000. });
  96001. return player;
  96002. }
  96003. videojs.hooks_ = hooks_;
  96004. videojs.hooks = hooks;
  96005. videojs.hook = hook;
  96006. videojs.hookOnce = hookOnce;
  96007. videojs.removeHook = removeHook;
  96008. if (window_1.VIDEOJS_NO_DYNAMIC_STYLE !== true && isReal()) {
  96009. var style = $(".vjs-styles-defaults");
  96010. if (!style) {
  96011. style = createStyleElement("vjs-styles-defaults");
  96012. var head = $("head");
  96013. if (head) {
  96014. head.insertBefore(style, head.firstChild);
  96015. }
  96016. setTextContent(style, "\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: 56.25%\n }\n ");
  96017. }
  96018. }
  96019. autoSetupTimeout(1, videojs);
  96020. videojs.VERSION = version$5;
  96021. videojs.options = Player.prototype.options_;
  96022. videojs.getPlayers = function() {
  96023. return Player.players;
  96024. };
  96025. videojs.getPlayer = function(id) {
  96026. var players = Player.players;
  96027. var tag;
  96028. if (typeof id === "string") {
  96029. var nId = normalizeId(id);
  96030. var player = players[nId];
  96031. if (player) {
  96032. return player;
  96033. }
  96034. tag = $("#" + nId);
  96035. } else {
  96036. tag = id;
  96037. }
  96038. if (isEl(tag)) {
  96039. var _tag = tag, _player = _tag.player, playerId = _tag.playerId;
  96040. if (_player || players[playerId]) {
  96041. return _player || players[playerId];
  96042. }
  96043. }
  96044. };
  96045. videojs.getAllPlayers = function() {
  96046. return Object.keys(Player.players).map(function(k) {
  96047. return Player.players[k];
  96048. }).filter(Boolean);
  96049. };
  96050. videojs.players = Player.players;
  96051. videojs.getComponent = Component$1.getComponent;
  96052. videojs.registerComponent = function(name, comp) {
  96053. if (Tech$1.isTech(comp)) {
  96054. log$1.warn("The " + name + " tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)");
  96055. }
  96056. Component$1.registerComponent.call(Component$1, name, comp);
  96057. };
  96058. videojs.getTech = Tech$1.getTech;
  96059. videojs.registerTech = Tech$1.registerTech;
  96060. videojs.use = use;
  96061. Object.defineProperty(videojs, "middleware", {
  96062. value: {},
  96063. writeable: false,
  96064. enumerable: true
  96065. });
  96066. Object.defineProperty(videojs.middleware, "TERMINATOR", {
  96067. value: TERMINATOR,
  96068. writeable: false,
  96069. enumerable: true
  96070. });
  96071. videojs.browser = browser;
  96072. videojs.TOUCH_ENABLED = TOUCH_ENABLED;
  96073. videojs.extend = extend;
  96074. videojs.mergeOptions = mergeOptions$3;
  96075. videojs.bind = bind;
  96076. videojs.registerPlugin = Plugin.registerPlugin;
  96077. videojs.deregisterPlugin = Plugin.deregisterPlugin;
  96078. videojs.plugin = function(name, plugin) {
  96079. log$1.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead");
  96080. return Plugin.registerPlugin(name, plugin);
  96081. };
  96082. videojs.getPlugins = Plugin.getPlugins;
  96083. videojs.getPlugin = Plugin.getPlugin;
  96084. videojs.getPluginVersion = Plugin.getPluginVersion;
  96085. videojs.addLanguage = function(code, data) {
  96086. var _mergeOptions;
  96087. code = ("" + code).toLowerCase();
  96088. videojs.options.languages = mergeOptions$3(videojs.options.languages, (_mergeOptions = {}, _mergeOptions[code] = data, _mergeOptions));
  96089. return videojs.options.languages[code];
  96090. };
  96091. videojs.log = log$1;
  96092. videojs.createLogger = createLogger;
  96093. videojs.createTimeRange = videojs.createTimeRanges = createTimeRanges;
  96094. videojs.formatTime = formatTime;
  96095. videojs.setFormatTime = setFormatTime;
  96096. videojs.resetFormatTime = resetFormatTime;
  96097. videojs.parseUrl = parseUrl;
  96098. videojs.isCrossOrigin = isCrossOrigin;
  96099. videojs.EventTarget = EventTarget$2;
  96100. videojs.on = on;
  96101. videojs.one = one;
  96102. videojs.off = off;
  96103. videojs.trigger = trigger;
  96104. videojs.xhr = XHR;
  96105. videojs.TextTrack = TextTrack;
  96106. videojs.AudioTrack = AudioTrack;
  96107. videojs.VideoTrack = VideoTrack;
  96108. ["isEl", "isTextNode", "createEl", "hasClass", "addClass", "removeClass", "toggleClass", "setAttributes", "getAttributes", "emptyEl", "appendContent", "insertContent"].forEach(function(k) {
  96109. videojs[k] = function() {
  96110. log$1.warn("videojs." + k + "() is deprecated; use videojs.dom." + k + "() instead");
  96111. return Dom$1[k].apply(null, arguments);
  96112. };
  96113. });
  96114. videojs.computedStyle = computedStyle;
  96115. videojs.dom = Dom$1;
  96116. videojs.url = Url$1;
  96117. videojs.defineLazyProperty = defineLazyProperty;
  96118. videojs.addLanguage("en", {
  96119. "Non-Fullscreen": "Exit Fullscreen"
  96120. });
  96121. /*! @name @videojs/http-streaming @version 2.16.2 @license Apache-2.0 */
  96122. var resolveUrl4 = resolveUrl$1;
  96123. var resolveManifestRedirect = function resolveManifestRedirect2(handleManifestRedirect, url, req) {
  96124. if (handleManifestRedirect && req && req.responseURL && url !== req.responseURL) {
  96125. return req.responseURL;
  96126. }
  96127. return url;
  96128. };
  96129. var logger = function logger2(source) {
  96130. if (videojs.log.debug) {
  96131. return videojs.log.debug.bind(videojs, "VHS:", source + " >");
  96132. }
  96133. return function() {
  96134. };
  96135. };
  96136. var TIME_FUDGE_FACTOR = 1 / 30;
  96137. var SAFE_TIME_DELTA = TIME_FUDGE_FACTOR * 3;
  96138. var filterRanges = function filterRanges2(timeRanges, predicate) {
  96139. var results = [];
  96140. var i2;
  96141. if (timeRanges && timeRanges.length) {
  96142. for (i2 = 0; i2 < timeRanges.length; i2++) {
  96143. if (predicate(timeRanges.start(i2), timeRanges.end(i2))) {
  96144. results.push([timeRanges.start(i2), timeRanges.end(i2)]);
  96145. }
  96146. }
  96147. }
  96148. return videojs.createTimeRanges(results);
  96149. };
  96150. var findRange = function findRange2(buffered, time) {
  96151. return filterRanges(buffered, function(start2, end) {
  96152. return start2 - SAFE_TIME_DELTA <= time && end + SAFE_TIME_DELTA >= time;
  96153. });
  96154. };
  96155. var findNextRange = function findNextRange2(timeRanges, time) {
  96156. return filterRanges(timeRanges, function(start2) {
  96157. return start2 - TIME_FUDGE_FACTOR >= time;
  96158. });
  96159. };
  96160. var findGaps = function findGaps2(buffered) {
  96161. if (buffered.length < 2) {
  96162. return videojs.createTimeRanges();
  96163. }
  96164. var ranges = [];
  96165. for (var i2 = 1; i2 < buffered.length; i2++) {
  96166. var start2 = buffered.end(i2 - 1);
  96167. var end = buffered.start(i2);
  96168. ranges.push([start2, end]);
  96169. }
  96170. return videojs.createTimeRanges(ranges);
  96171. };
  96172. var bufferIntersection = function bufferIntersection2(bufferA, bufferB) {
  96173. var start2 = null;
  96174. var end = null;
  96175. var arity = 0;
  96176. var extents = [];
  96177. var ranges = [];
  96178. if (!bufferA || !bufferA.length || !bufferB || !bufferB.length) {
  96179. return videojs.createTimeRange();
  96180. }
  96181. var count = bufferA.length;
  96182. while (count--) {
  96183. extents.push({
  96184. time: bufferA.start(count),
  96185. type: "start"
  96186. });
  96187. extents.push({
  96188. time: bufferA.end(count),
  96189. type: "end"
  96190. });
  96191. }
  96192. count = bufferB.length;
  96193. while (count--) {
  96194. extents.push({
  96195. time: bufferB.start(count),
  96196. type: "start"
  96197. });
  96198. extents.push({
  96199. time: bufferB.end(count),
  96200. type: "end"
  96201. });
  96202. }
  96203. extents.sort(function(a, b) {
  96204. return a.time - b.time;
  96205. });
  96206. for (count = 0; count < extents.length; count++) {
  96207. if (extents[count].type === "start") {
  96208. arity++;
  96209. if (arity === 2) {
  96210. start2 = extents[count].time;
  96211. }
  96212. } else if (extents[count].type === "end") {
  96213. arity--;
  96214. if (arity === 1) {
  96215. end = extents[count].time;
  96216. }
  96217. }
  96218. if (start2 !== null && end !== null) {
  96219. ranges.push([start2, end]);
  96220. start2 = null;
  96221. end = null;
  96222. }
  96223. }
  96224. return videojs.createTimeRanges(ranges);
  96225. };
  96226. var printableRange = function printableRange2(range3) {
  96227. var strArr = [];
  96228. if (!range3 || !range3.length) {
  96229. return "";
  96230. }
  96231. for (var i2 = 0; i2 < range3.length; i2++) {
  96232. strArr.push(range3.start(i2) + " => " + range3.end(i2));
  96233. }
  96234. return strArr.join(", ");
  96235. };
  96236. var timeUntilRebuffer = function timeUntilRebuffer2(buffered, currentTime, playbackRate) {
  96237. if (playbackRate === void 0) {
  96238. playbackRate = 1;
  96239. }
  96240. var bufferedEnd = buffered.length ? buffered.end(buffered.length - 1) : 0;
  96241. return (bufferedEnd - currentTime) / playbackRate;
  96242. };
  96243. var timeRangesToArray = function timeRangesToArray2(timeRanges) {
  96244. var timeRangesList = [];
  96245. for (var i2 = 0; i2 < timeRanges.length; i2++) {
  96246. timeRangesList.push({
  96247. start: timeRanges.start(i2),
  96248. end: timeRanges.end(i2)
  96249. });
  96250. }
  96251. return timeRangesList;
  96252. };
  96253. var isRangeDifferent = function isRangeDifferent2(a, b) {
  96254. if (a === b) {
  96255. return false;
  96256. }
  96257. if (!a && b || !b && a) {
  96258. return true;
  96259. }
  96260. if (a.length !== b.length) {
  96261. return true;
  96262. }
  96263. for (var i2 = 0; i2 < a.length; i2++) {
  96264. if (a.start(i2) !== b.start(i2) || a.end(i2) !== b.end(i2)) {
  96265. return true;
  96266. }
  96267. }
  96268. return false;
  96269. };
  96270. var lastBufferedEnd = function lastBufferedEnd2(a) {
  96271. if (!a || !a.length || !a.end) {
  96272. return;
  96273. }
  96274. return a.end(a.length - 1);
  96275. };
  96276. var timeAheadOf = function timeAheadOf2(range3, startTime) {
  96277. var time = 0;
  96278. if (!range3 || !range3.length) {
  96279. return time;
  96280. }
  96281. for (var i2 = 0; i2 < range3.length; i2++) {
  96282. var start2 = range3.start(i2);
  96283. var end = range3.end(i2);
  96284. if (startTime > end) {
  96285. continue;
  96286. }
  96287. if (startTime > start2 && startTime <= end) {
  96288. time += end - startTime;
  96289. continue;
  96290. }
  96291. time += end - start2;
  96292. }
  96293. return time;
  96294. };
  96295. var createTimeRange$1 = videojs.createTimeRange;
  96296. var segmentDurationWithParts = function segmentDurationWithParts2(playlist, segment) {
  96297. if (!segment.preload) {
  96298. return segment.duration;
  96299. }
  96300. var result = 0;
  96301. (segment.parts || []).forEach(function(p) {
  96302. result += p.duration;
  96303. });
  96304. (segment.preloadHints || []).forEach(function(p) {
  96305. if (p.type === "PART") {
  96306. result += playlist.partTargetDuration;
  96307. }
  96308. });
  96309. return result;
  96310. };
  96311. var getPartsAndSegments = function getPartsAndSegments2(playlist) {
  96312. return (playlist.segments || []).reduce(function(acc, segment, si) {
  96313. if (segment.parts) {
  96314. segment.parts.forEach(function(part, pi) {
  96315. acc.push({
  96316. duration: part.duration,
  96317. segmentIndex: si,
  96318. partIndex: pi,
  96319. part,
  96320. segment
  96321. });
  96322. });
  96323. } else {
  96324. acc.push({
  96325. duration: segment.duration,
  96326. segmentIndex: si,
  96327. partIndex: null,
  96328. segment,
  96329. part: null
  96330. });
  96331. }
  96332. return acc;
  96333. }, []);
  96334. };
  96335. var getLastParts = function getLastParts2(media) {
  96336. var lastSegment = media.segments && media.segments.length && media.segments[media.segments.length - 1];
  96337. return lastSegment && lastSegment.parts || [];
  96338. };
  96339. var getKnownPartCount = function getKnownPartCount2(_ref) {
  96340. var preloadSegment = _ref.preloadSegment;
  96341. if (!preloadSegment) {
  96342. return;
  96343. }
  96344. var parts = preloadSegment.parts, preloadHints = preloadSegment.preloadHints;
  96345. var partCount = (preloadHints || []).reduce(function(count, hint) {
  96346. return count + (hint.type === "PART" ? 1 : 0);
  96347. }, 0);
  96348. partCount += parts && parts.length ? parts.length : 0;
  96349. return partCount;
  96350. };
  96351. var liveEdgeDelay = function liveEdgeDelay2(master, media) {
  96352. if (media.endList) {
  96353. return 0;
  96354. }
  96355. if (master && master.suggestedPresentationDelay) {
  96356. return master.suggestedPresentationDelay;
  96357. }
  96358. var hasParts = getLastParts(media).length > 0;
  96359. if (hasParts && media.serverControl && media.serverControl.partHoldBack) {
  96360. return media.serverControl.partHoldBack;
  96361. } else if (hasParts && media.partTargetDuration) {
  96362. return media.partTargetDuration * 3;
  96363. } else if (media.serverControl && media.serverControl.holdBack) {
  96364. return media.serverControl.holdBack;
  96365. } else if (media.targetDuration) {
  96366. return media.targetDuration * 3;
  96367. }
  96368. return 0;
  96369. };
  96370. var backwardDuration = function backwardDuration2(playlist, endSequence) {
  96371. var result = 0;
  96372. var i2 = endSequence - playlist.mediaSequence;
  96373. var segment = playlist.segments[i2];
  96374. if (segment) {
  96375. if (typeof segment.start !== "undefined") {
  96376. return {
  96377. result: segment.start,
  96378. precise: true
  96379. };
  96380. }
  96381. if (typeof segment.end !== "undefined") {
  96382. return {
  96383. result: segment.end - segment.duration,
  96384. precise: true
  96385. };
  96386. }
  96387. }
  96388. while (i2--) {
  96389. segment = playlist.segments[i2];
  96390. if (typeof segment.end !== "undefined") {
  96391. return {
  96392. result: result + segment.end,
  96393. precise: true
  96394. };
  96395. }
  96396. result += segmentDurationWithParts(playlist, segment);
  96397. if (typeof segment.start !== "undefined") {
  96398. return {
  96399. result: result + segment.start,
  96400. precise: true
  96401. };
  96402. }
  96403. }
  96404. return {
  96405. result,
  96406. precise: false
  96407. };
  96408. };
  96409. var forwardDuration = function forwardDuration2(playlist, endSequence) {
  96410. var result = 0;
  96411. var segment;
  96412. var i2 = endSequence - playlist.mediaSequence;
  96413. for (; i2 < playlist.segments.length; i2++) {
  96414. segment = playlist.segments[i2];
  96415. if (typeof segment.start !== "undefined") {
  96416. return {
  96417. result: segment.start - result,
  96418. precise: true
  96419. };
  96420. }
  96421. result += segmentDurationWithParts(playlist, segment);
  96422. if (typeof segment.end !== "undefined") {
  96423. return {
  96424. result: segment.end - result,
  96425. precise: true
  96426. };
  96427. }
  96428. }
  96429. return {
  96430. result: -1,
  96431. precise: false
  96432. };
  96433. };
  96434. var intervalDuration = function intervalDuration2(playlist, endSequence, expired) {
  96435. if (typeof endSequence === "undefined") {
  96436. endSequence = playlist.mediaSequence + playlist.segments.length;
  96437. }
  96438. if (endSequence < playlist.mediaSequence) {
  96439. return 0;
  96440. }
  96441. var backward = backwardDuration(playlist, endSequence);
  96442. if (backward.precise) {
  96443. return backward.result;
  96444. }
  96445. var forward = forwardDuration(playlist, endSequence);
  96446. if (forward.precise) {
  96447. return forward.result;
  96448. }
  96449. return backward.result + expired;
  96450. };
  96451. var duration2 = function duration3(playlist, endSequence, expired) {
  96452. if (!playlist) {
  96453. return 0;
  96454. }
  96455. if (typeof expired !== "number") {
  96456. expired = 0;
  96457. }
  96458. if (typeof endSequence === "undefined") {
  96459. if (playlist.totalDuration) {
  96460. return playlist.totalDuration;
  96461. }
  96462. if (!playlist.endList) {
  96463. return window_1.Infinity;
  96464. }
  96465. }
  96466. return intervalDuration(playlist, endSequence, expired);
  96467. };
  96468. var sumDurations = function sumDurations2(_ref2) {
  96469. var defaultDuration = _ref2.defaultDuration, durationList = _ref2.durationList, startIndex = _ref2.startIndex, endIndex = _ref2.endIndex;
  96470. var durations = 0;
  96471. if (startIndex > endIndex) {
  96472. var _ref3 = [endIndex, startIndex];
  96473. startIndex = _ref3[0];
  96474. endIndex = _ref3[1];
  96475. }
  96476. if (startIndex < 0) {
  96477. for (var i2 = startIndex; i2 < Math.min(0, endIndex); i2++) {
  96478. durations += defaultDuration;
  96479. }
  96480. startIndex = 0;
  96481. }
  96482. for (var _i = startIndex; _i < endIndex; _i++) {
  96483. durations += durationList[_i].duration;
  96484. }
  96485. return durations;
  96486. };
  96487. var playlistEnd = function playlistEnd2(playlist, expired, useSafeLiveEnd, liveEdgePadding) {
  96488. if (!playlist || !playlist.segments) {
  96489. return null;
  96490. }
  96491. if (playlist.endList) {
  96492. return duration2(playlist);
  96493. }
  96494. if (expired === null) {
  96495. return null;
  96496. }
  96497. expired = expired || 0;
  96498. var lastSegmentEndTime = intervalDuration(playlist, playlist.mediaSequence + playlist.segments.length, expired);
  96499. if (useSafeLiveEnd) {
  96500. liveEdgePadding = typeof liveEdgePadding === "number" ? liveEdgePadding : liveEdgeDelay(null, playlist);
  96501. lastSegmentEndTime -= liveEdgePadding;
  96502. }
  96503. return Math.max(0, lastSegmentEndTime);
  96504. };
  96505. var seekable = function seekable2(playlist, expired, liveEdgePadding) {
  96506. var useSafeLiveEnd = true;
  96507. var seekableStart = expired || 0;
  96508. var seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding);
  96509. if (seekableEnd === null) {
  96510. return createTimeRange$1();
  96511. }
  96512. return createTimeRange$1(seekableStart, seekableEnd);
  96513. };
  96514. var getMediaInfoForTime = function getMediaInfoForTime2(_ref4) {
  96515. var playlist = _ref4.playlist, currentTime = _ref4.currentTime, startingSegmentIndex = _ref4.startingSegmentIndex, startingPartIndex = _ref4.startingPartIndex, startTime = _ref4.startTime, experimentalExactManifestTimings = _ref4.experimentalExactManifestTimings;
  96516. var time = currentTime - startTime;
  96517. var partsAndSegments = getPartsAndSegments(playlist);
  96518. var startIndex = 0;
  96519. for (var i2 = 0; i2 < partsAndSegments.length; i2++) {
  96520. var partAndSegment = partsAndSegments[i2];
  96521. if (startingSegmentIndex !== partAndSegment.segmentIndex) {
  96522. continue;
  96523. }
  96524. if (typeof startingPartIndex === "number" && typeof partAndSegment.partIndex === "number" && startingPartIndex !== partAndSegment.partIndex) {
  96525. continue;
  96526. }
  96527. startIndex = i2;
  96528. break;
  96529. }
  96530. if (time < 0) {
  96531. if (startIndex > 0) {
  96532. for (var _i2 = startIndex - 1; _i2 >= 0; _i2--) {
  96533. var _partAndSegment = partsAndSegments[_i2];
  96534. time += _partAndSegment.duration;
  96535. if (experimentalExactManifestTimings) {
  96536. if (time < 0) {
  96537. continue;
  96538. }
  96539. } else if (time + TIME_FUDGE_FACTOR <= 0) {
  96540. continue;
  96541. }
  96542. return {
  96543. partIndex: _partAndSegment.partIndex,
  96544. segmentIndex: _partAndSegment.segmentIndex,
  96545. startTime: startTime - sumDurations({
  96546. defaultDuration: playlist.targetDuration,
  96547. durationList: partsAndSegments,
  96548. startIndex,
  96549. endIndex: _i2
  96550. })
  96551. };
  96552. }
  96553. }
  96554. return {
  96555. partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null,
  96556. segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0,
  96557. startTime: currentTime
  96558. };
  96559. }
  96560. if (startIndex < 0) {
  96561. for (var _i3 = startIndex; _i3 < 0; _i3++) {
  96562. time -= playlist.targetDuration;
  96563. if (time < 0) {
  96564. return {
  96565. partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null,
  96566. segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0,
  96567. startTime: currentTime
  96568. };
  96569. }
  96570. }
  96571. startIndex = 0;
  96572. }
  96573. for (var _i4 = startIndex; _i4 < partsAndSegments.length; _i4++) {
  96574. var _partAndSegment2 = partsAndSegments[_i4];
  96575. time -= _partAndSegment2.duration;
  96576. if (experimentalExactManifestTimings) {
  96577. if (time > 0) {
  96578. continue;
  96579. }
  96580. } else if (time - TIME_FUDGE_FACTOR >= 0) {
  96581. continue;
  96582. }
  96583. return {
  96584. partIndex: _partAndSegment2.partIndex,
  96585. segmentIndex: _partAndSegment2.segmentIndex,
  96586. startTime: startTime + sumDurations({
  96587. defaultDuration: playlist.targetDuration,
  96588. durationList: partsAndSegments,
  96589. startIndex,
  96590. endIndex: _i4
  96591. })
  96592. };
  96593. }
  96594. return {
  96595. segmentIndex: partsAndSegments[partsAndSegments.length - 1].segmentIndex,
  96596. partIndex: partsAndSegments[partsAndSegments.length - 1].partIndex,
  96597. startTime: currentTime
  96598. };
  96599. };
  96600. var isBlacklisted = function isBlacklisted2(playlist) {
  96601. return playlist.excludeUntil && playlist.excludeUntil > Date.now();
  96602. };
  96603. var isIncompatible = function isIncompatible2(playlist) {
  96604. return playlist.excludeUntil && playlist.excludeUntil === Infinity;
  96605. };
  96606. var isEnabled = function isEnabled2(playlist) {
  96607. var blacklisted = isBlacklisted(playlist);
  96608. return !playlist.disabled && !blacklisted;
  96609. };
  96610. var isDisabled = function isDisabled2(playlist) {
  96611. return playlist.disabled;
  96612. };
  96613. var isAes = function isAes2(media) {
  96614. for (var i2 = 0; i2 < media.segments.length; i2++) {
  96615. if (media.segments[i2].key) {
  96616. return true;
  96617. }
  96618. }
  96619. return false;
  96620. };
  96621. var hasAttribute = function hasAttribute2(attr, playlist) {
  96622. return playlist.attributes && playlist.attributes[attr];
  96623. };
  96624. var estimateSegmentRequestTime = function estimateSegmentRequestTime2(segmentDuration, bandwidth2, playlist, bytesReceived) {
  96625. if (bytesReceived === void 0) {
  96626. bytesReceived = 0;
  96627. }
  96628. if (!hasAttribute("BANDWIDTH", playlist)) {
  96629. return NaN;
  96630. }
  96631. var size = segmentDuration * playlist.attributes.BANDWIDTH;
  96632. return (size - bytesReceived * 8) / bandwidth2;
  96633. };
  96634. var isLowestEnabledRendition = function isLowestEnabledRendition2(master, media) {
  96635. if (master.playlists.length === 1) {
  96636. return true;
  96637. }
  96638. var currentBandwidth = media.attributes.BANDWIDTH || Number.MAX_VALUE;
  96639. return master.playlists.filter(function(playlist) {
  96640. if (!isEnabled(playlist)) {
  96641. return false;
  96642. }
  96643. return (playlist.attributes.BANDWIDTH || 0) < currentBandwidth;
  96644. }).length === 0;
  96645. };
  96646. var playlistMatch = function playlistMatch2(a, b) {
  96647. if (!a && !b || !a && b || a && !b) {
  96648. return false;
  96649. }
  96650. if (a === b) {
  96651. return true;
  96652. }
  96653. if (a.id && b.id && a.id === b.id) {
  96654. return true;
  96655. }
  96656. if (a.resolvedUri && b.resolvedUri && a.resolvedUri === b.resolvedUri) {
  96657. return true;
  96658. }
  96659. if (a.uri && b.uri && a.uri === b.uri) {
  96660. return true;
  96661. }
  96662. return false;
  96663. };
  96664. var someAudioVariant = function someAudioVariant2(master, callback2) {
  96665. var AUDIO5 = master && master.mediaGroups && master.mediaGroups.AUDIO || {};
  96666. var found = false;
  96667. for (var groupName in AUDIO5) {
  96668. for (var label2 in AUDIO5[groupName]) {
  96669. found = callback2(AUDIO5[groupName][label2]);
  96670. if (found) {
  96671. break;
  96672. }
  96673. }
  96674. if (found) {
  96675. break;
  96676. }
  96677. }
  96678. return !!found;
  96679. };
  96680. var isAudioOnly = function isAudioOnly2(master) {
  96681. if (!master || !master.playlists || !master.playlists.length) {
  96682. var found = someAudioVariant(master, function(variant) {
  96683. return variant.playlists && variant.playlists.length || variant.uri;
  96684. });
  96685. return found;
  96686. }
  96687. var _loop = function _loop2(i3) {
  96688. var playlist = master.playlists[i3];
  96689. var CODECS = playlist.attributes && playlist.attributes.CODECS;
  96690. if (CODECS && CODECS.split(",").every(function(c) {
  96691. return isAudioCodec2(c);
  96692. })) {
  96693. return "continue";
  96694. }
  96695. var found2 = someAudioVariant(master, function(variant) {
  96696. return playlistMatch(playlist, variant);
  96697. });
  96698. if (found2) {
  96699. return "continue";
  96700. }
  96701. return {
  96702. v: false
  96703. };
  96704. };
  96705. for (var i2 = 0; i2 < master.playlists.length; i2++) {
  96706. var _ret = _loop(i2);
  96707. if (_ret === "continue")
  96708. continue;
  96709. if (typeof _ret === "object")
  96710. return _ret.v;
  96711. }
  96712. return true;
  96713. };
  96714. var Playlist = {
  96715. liveEdgeDelay,
  96716. duration: duration2,
  96717. seekable,
  96718. getMediaInfoForTime,
  96719. isEnabled,
  96720. isDisabled,
  96721. isBlacklisted,
  96722. isIncompatible,
  96723. playlistEnd,
  96724. isAes,
  96725. hasAttribute,
  96726. estimateSegmentRequestTime,
  96727. isLowestEnabledRendition,
  96728. isAudioOnly,
  96729. playlistMatch,
  96730. segmentDurationWithParts
  96731. };
  96732. var log = videojs.log;
  96733. var createPlaylistID = function createPlaylistID2(index2, uri) {
  96734. return index2 + "-" + uri;
  96735. };
  96736. var groupID = function groupID2(type2, group, label2) {
  96737. return "placeholder-uri-" + type2 + "-" + group + "-" + label2;
  96738. };
  96739. var parseManifest = function parseManifest2(_ref) {
  96740. var onwarn = _ref.onwarn, oninfo = _ref.oninfo, manifestString = _ref.manifestString, _ref$customTagParsers = _ref.customTagParsers, customTagParsers = _ref$customTagParsers === void 0 ? [] : _ref$customTagParsers, _ref$customTagMappers = _ref.customTagMappers, customTagMappers = _ref$customTagMappers === void 0 ? [] : _ref$customTagMappers, experimentalLLHLS = _ref.experimentalLLHLS;
  96741. var parser2 = new Parser();
  96742. if (onwarn) {
  96743. parser2.on("warn", onwarn);
  96744. }
  96745. if (oninfo) {
  96746. parser2.on("info", oninfo);
  96747. }
  96748. customTagParsers.forEach(function(customParser) {
  96749. return parser2.addParser(customParser);
  96750. });
  96751. customTagMappers.forEach(function(mapper) {
  96752. return parser2.addTagMapper(mapper);
  96753. });
  96754. parser2.push(manifestString);
  96755. parser2.end();
  96756. var manifest = parser2.manifest;
  96757. if (!experimentalLLHLS) {
  96758. ["preloadSegment", "skip", "serverControl", "renditionReports", "partInf", "partTargetDuration"].forEach(function(k) {
  96759. if (manifest.hasOwnProperty(k)) {
  96760. delete manifest[k];
  96761. }
  96762. });
  96763. if (manifest.segments) {
  96764. manifest.segments.forEach(function(segment) {
  96765. ["parts", "preloadHints"].forEach(function(k) {
  96766. if (segment.hasOwnProperty(k)) {
  96767. delete segment[k];
  96768. }
  96769. });
  96770. });
  96771. }
  96772. }
  96773. if (!manifest.targetDuration) {
  96774. var targetDuration = 10;
  96775. if (manifest.segments && manifest.segments.length) {
  96776. targetDuration = manifest.segments.reduce(function(acc, s) {
  96777. return Math.max(acc, s.duration);
  96778. }, 0);
  96779. }
  96780. if (onwarn) {
  96781. onwarn("manifest has no targetDuration defaulting to " + targetDuration);
  96782. }
  96783. manifest.targetDuration = targetDuration;
  96784. }
  96785. var parts = getLastParts(manifest);
  96786. if (parts.length && !manifest.partTargetDuration) {
  96787. var partTargetDuration = parts.reduce(function(acc, p) {
  96788. return Math.max(acc, p.duration);
  96789. }, 0);
  96790. if (onwarn) {
  96791. onwarn("manifest has no partTargetDuration defaulting to " + partTargetDuration);
  96792. log.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.");
  96793. }
  96794. manifest.partTargetDuration = partTargetDuration;
  96795. }
  96796. return manifest;
  96797. };
  96798. var forEachMediaGroup3 = function forEachMediaGroup4(master, callback2) {
  96799. if (!master.mediaGroups) {
  96800. return;
  96801. }
  96802. ["AUDIO", "SUBTITLES"].forEach(function(mediaType) {
  96803. if (!master.mediaGroups[mediaType]) {
  96804. return;
  96805. }
  96806. for (var groupKey in master.mediaGroups[mediaType]) {
  96807. for (var labelKey in master.mediaGroups[mediaType][groupKey]) {
  96808. var mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey];
  96809. callback2(mediaProperties, mediaType, groupKey, labelKey);
  96810. }
  96811. }
  96812. });
  96813. };
  96814. var setupMediaPlaylist = function setupMediaPlaylist2(_ref2) {
  96815. var playlist = _ref2.playlist, uri = _ref2.uri, id = _ref2.id;
  96816. playlist.id = id;
  96817. playlist.playlistErrors_ = 0;
  96818. if (uri) {
  96819. playlist.uri = uri;
  96820. }
  96821. playlist.attributes = playlist.attributes || {};
  96822. };
  96823. var setupMediaPlaylists = function setupMediaPlaylists2(master) {
  96824. var i2 = master.playlists.length;
  96825. while (i2--) {
  96826. var playlist = master.playlists[i2];
  96827. setupMediaPlaylist({
  96828. playlist,
  96829. id: createPlaylistID(i2, playlist.uri)
  96830. });
  96831. playlist.resolvedUri = resolveUrl4(master.uri, playlist.uri);
  96832. master.playlists[playlist.id] = playlist;
  96833. master.playlists[playlist.uri] = playlist;
  96834. if (!playlist.attributes.BANDWIDTH) {
  96835. log.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.");
  96836. }
  96837. }
  96838. };
  96839. var resolveMediaGroupUris = function resolveMediaGroupUris2(master) {
  96840. forEachMediaGroup3(master, function(properties) {
  96841. if (properties.uri) {
  96842. properties.resolvedUri = resolveUrl4(master.uri, properties.uri);
  96843. }
  96844. });
  96845. };
  96846. var masterForMedia = function masterForMedia2(media, uri) {
  96847. var id = createPlaylistID(0, uri);
  96848. var master = {
  96849. mediaGroups: {
  96850. "AUDIO": {},
  96851. "VIDEO": {},
  96852. "CLOSED-CAPTIONS": {},
  96853. "SUBTITLES": {}
  96854. },
  96855. uri: window_1.location.href,
  96856. resolvedUri: window_1.location.href,
  96857. playlists: [{
  96858. uri,
  96859. id,
  96860. resolvedUri: uri,
  96861. attributes: {}
  96862. }]
  96863. };
  96864. master.playlists[id] = master.playlists[0];
  96865. master.playlists[uri] = master.playlists[0];
  96866. return master;
  96867. };
  96868. var addPropertiesToMaster = function addPropertiesToMaster2(master, uri, createGroupID) {
  96869. if (createGroupID === void 0) {
  96870. createGroupID = groupID;
  96871. }
  96872. master.uri = uri;
  96873. for (var i2 = 0; i2 < master.playlists.length; i2++) {
  96874. if (!master.playlists[i2].uri) {
  96875. var phonyUri = "placeholder-uri-" + i2;
  96876. master.playlists[i2].uri = phonyUri;
  96877. }
  96878. }
  96879. var audioOnlyMaster = isAudioOnly(master);
  96880. forEachMediaGroup3(master, function(properties, mediaType, groupKey, labelKey) {
  96881. if (!properties.playlists || !properties.playlists.length) {
  96882. if (audioOnlyMaster && mediaType === "AUDIO" && !properties.uri) {
  96883. for (var _i = 0; _i < master.playlists.length; _i++) {
  96884. var p = master.playlists[_i];
  96885. if (p.attributes && p.attributes.AUDIO && p.attributes.AUDIO === groupKey) {
  96886. return;
  96887. }
  96888. }
  96889. }
  96890. properties.playlists = [_extends$2({}, properties)];
  96891. }
  96892. properties.playlists.forEach(function(p2, i3) {
  96893. var groupId = createGroupID(mediaType, groupKey, labelKey, p2);
  96894. var id = createPlaylistID(i3, groupId);
  96895. if (p2.uri) {
  96896. p2.resolvedUri = p2.resolvedUri || resolveUrl4(master.uri, p2.uri);
  96897. } else {
  96898. p2.uri = i3 === 0 ? groupId : id;
  96899. p2.resolvedUri = p2.uri;
  96900. }
  96901. p2.id = p2.id || id;
  96902. p2.attributes = p2.attributes || {};
  96903. master.playlists[p2.id] = p2;
  96904. master.playlists[p2.uri] = p2;
  96905. });
  96906. });
  96907. setupMediaPlaylists(master);
  96908. resolveMediaGroupUris(master);
  96909. };
  96910. var mergeOptions$2 = videojs.mergeOptions, EventTarget$1 = videojs.EventTarget;
  96911. var addLLHLSQueryDirectives = function addLLHLSQueryDirectives2(uri, media) {
  96912. if (media.endList || !media.serverControl) {
  96913. return uri;
  96914. }
  96915. var parameters = {};
  96916. if (media.serverControl.canBlockReload) {
  96917. var preloadSegment = media.preloadSegment;
  96918. var nextMSN = media.mediaSequence + media.segments.length;
  96919. if (preloadSegment) {
  96920. var parts = preloadSegment.parts || [];
  96921. var nextPart = getKnownPartCount(media) - 1;
  96922. if (nextPart > -1 && nextPart !== parts.length - 1) {
  96923. parameters._HLS_part = nextPart;
  96924. }
  96925. if (nextPart > -1 || parts.length) {
  96926. nextMSN--;
  96927. }
  96928. }
  96929. parameters._HLS_msn = nextMSN;
  96930. }
  96931. if (media.serverControl && media.serverControl.canSkipUntil) {
  96932. parameters._HLS_skip = media.serverControl.canSkipDateranges ? "v2" : "YES";
  96933. }
  96934. if (Object.keys(parameters).length) {
  96935. var parsedUri = new window_1.URL(uri);
  96936. ["_HLS_skip", "_HLS_msn", "_HLS_part"].forEach(function(name) {
  96937. if (!parameters.hasOwnProperty(name)) {
  96938. return;
  96939. }
  96940. parsedUri.searchParams.set(name, parameters[name]);
  96941. });
  96942. uri = parsedUri.toString();
  96943. }
  96944. return uri;
  96945. };
  96946. var updateSegment = function updateSegment2(a, b) {
  96947. if (!a) {
  96948. return b;
  96949. }
  96950. var result = mergeOptions$2(a, b);
  96951. if (a.preloadHints && !b.preloadHints) {
  96952. delete result.preloadHints;
  96953. }
  96954. if (a.parts && !b.parts) {
  96955. delete result.parts;
  96956. } else if (a.parts && b.parts) {
  96957. for (var i2 = 0; i2 < b.parts.length; i2++) {
  96958. if (a.parts && a.parts[i2]) {
  96959. result.parts[i2] = mergeOptions$2(a.parts[i2], b.parts[i2]);
  96960. }
  96961. }
  96962. }
  96963. if (!a.skipped && b.skipped) {
  96964. result.skipped = false;
  96965. }
  96966. if (a.preload && !b.preload) {
  96967. result.preload = false;
  96968. }
  96969. return result;
  96970. };
  96971. var updateSegments = function updateSegments2(original, update, offset) {
  96972. var oldSegments = original.slice();
  96973. var newSegments = update.slice();
  96974. offset = offset || 0;
  96975. var result = [];
  96976. var currentMap;
  96977. for (var newIndex = 0; newIndex < newSegments.length; newIndex++) {
  96978. var oldSegment = oldSegments[newIndex + offset];
  96979. var newSegment = newSegments[newIndex];
  96980. if (oldSegment) {
  96981. currentMap = oldSegment.map || currentMap;
  96982. result.push(updateSegment(oldSegment, newSegment));
  96983. } else {
  96984. if (currentMap && !newSegment.map) {
  96985. newSegment.map = currentMap;
  96986. }
  96987. result.push(newSegment);
  96988. }
  96989. }
  96990. return result;
  96991. };
  96992. var resolveSegmentUris = function resolveSegmentUris2(segment, baseUri) {
  96993. if (!segment.resolvedUri && segment.uri) {
  96994. segment.resolvedUri = resolveUrl4(baseUri, segment.uri);
  96995. }
  96996. if (segment.key && !segment.key.resolvedUri) {
  96997. segment.key.resolvedUri = resolveUrl4(baseUri, segment.key.uri);
  96998. }
  96999. if (segment.map && !segment.map.resolvedUri) {
  97000. segment.map.resolvedUri = resolveUrl4(baseUri, segment.map.uri);
  97001. }
  97002. if (segment.map && segment.map.key && !segment.map.key.resolvedUri) {
  97003. segment.map.key.resolvedUri = resolveUrl4(baseUri, segment.map.key.uri);
  97004. }
  97005. if (segment.parts && segment.parts.length) {
  97006. segment.parts.forEach(function(p) {
  97007. if (p.resolvedUri) {
  97008. return;
  97009. }
  97010. p.resolvedUri = resolveUrl4(baseUri, p.uri);
  97011. });
  97012. }
  97013. if (segment.preloadHints && segment.preloadHints.length) {
  97014. segment.preloadHints.forEach(function(p) {
  97015. if (p.resolvedUri) {
  97016. return;
  97017. }
  97018. p.resolvedUri = resolveUrl4(baseUri, p.uri);
  97019. });
  97020. }
  97021. };
  97022. var getAllSegments = function getAllSegments2(media) {
  97023. var segments = media.segments || [];
  97024. var preloadSegment = media.preloadSegment;
  97025. if (preloadSegment && preloadSegment.parts && preloadSegment.parts.length) {
  97026. if (preloadSegment.preloadHints) {
  97027. for (var i2 = 0; i2 < preloadSegment.preloadHints.length; i2++) {
  97028. if (preloadSegment.preloadHints[i2].type === "MAP") {
  97029. return segments;
  97030. }
  97031. }
  97032. }
  97033. preloadSegment.duration = media.targetDuration;
  97034. preloadSegment.preload = true;
  97035. segments.push(preloadSegment);
  97036. }
  97037. return segments;
  97038. };
  97039. var isPlaylistUnchanged = function isPlaylistUnchanged2(a, b) {
  97040. return a === b || a.segments && b.segments && a.segments.length === b.segments.length && a.endList === b.endList && a.mediaSequence === b.mediaSequence && a.preloadSegment === b.preloadSegment;
  97041. };
  97042. var updateMaster$1 = function updateMaster(master, newMedia, unchangedCheck) {
  97043. if (unchangedCheck === void 0) {
  97044. unchangedCheck = isPlaylistUnchanged;
  97045. }
  97046. var result = mergeOptions$2(master, {});
  97047. var oldMedia = result.playlists[newMedia.id];
  97048. if (!oldMedia) {
  97049. return null;
  97050. }
  97051. if (unchangedCheck(oldMedia, newMedia)) {
  97052. return null;
  97053. }
  97054. newMedia.segments = getAllSegments(newMedia);
  97055. var mergedPlaylist = mergeOptions$2(oldMedia, newMedia);
  97056. if (mergedPlaylist.preloadSegment && !newMedia.preloadSegment) {
  97057. delete mergedPlaylist.preloadSegment;
  97058. }
  97059. if (oldMedia.segments) {
  97060. if (newMedia.skip) {
  97061. newMedia.segments = newMedia.segments || [];
  97062. for (var i2 = 0; i2 < newMedia.skip.skippedSegments; i2++) {
  97063. newMedia.segments.unshift({
  97064. skipped: true
  97065. });
  97066. }
  97067. }
  97068. mergedPlaylist.segments = updateSegments(oldMedia.segments, newMedia.segments, newMedia.mediaSequence - oldMedia.mediaSequence);
  97069. }
  97070. mergedPlaylist.segments.forEach(function(segment) {
  97071. resolveSegmentUris(segment, mergedPlaylist.resolvedUri);
  97072. });
  97073. for (var _i = 0; _i < result.playlists.length; _i++) {
  97074. if (result.playlists[_i].id === newMedia.id) {
  97075. result.playlists[_i] = mergedPlaylist;
  97076. }
  97077. }
  97078. result.playlists[newMedia.id] = mergedPlaylist;
  97079. result.playlists[newMedia.uri] = mergedPlaylist;
  97080. forEachMediaGroup3(master, function(properties, mediaType, groupKey, labelKey) {
  97081. if (!properties.playlists) {
  97082. return;
  97083. }
  97084. for (var _i2 = 0; _i2 < properties.playlists.length; _i2++) {
  97085. if (newMedia.id === properties.playlists[_i2].id) {
  97086. properties.playlists[_i2] = mergedPlaylist;
  97087. }
  97088. }
  97089. });
  97090. return result;
  97091. };
  97092. var refreshDelay = function refreshDelay2(media, update) {
  97093. var segments = media.segments || [];
  97094. var lastSegment = segments[segments.length - 1];
  97095. var lastPart = lastSegment && lastSegment.parts && lastSegment.parts[lastSegment.parts.length - 1];
  97096. var lastDuration = lastPart && lastPart.duration || lastSegment && lastSegment.duration;
  97097. if (update && lastDuration) {
  97098. return lastDuration * 1e3;
  97099. }
  97100. return (media.partTargetDuration || media.targetDuration || 10) * 500;
  97101. };
  97102. var PlaylistLoader = /* @__PURE__ */ function(_EventTarget) {
  97103. _inheritsLoose(PlaylistLoader2, _EventTarget);
  97104. function PlaylistLoader2(src, vhs, options2) {
  97105. var _this;
  97106. if (options2 === void 0) {
  97107. options2 = {};
  97108. }
  97109. _this = _EventTarget.call(this) || this;
  97110. if (!src) {
  97111. throw new Error("A non-empty playlist URL or object is required");
  97112. }
  97113. _this.logger_ = logger("PlaylistLoader");
  97114. var _options = options2, _options$withCredenti = _options.withCredentials, withCredentials = _options$withCredenti === void 0 ? false : _options$withCredenti, _options$handleManife = _options.handleManifestRedirects, handleManifestRedirects = _options$handleManife === void 0 ? false : _options$handleManife;
  97115. _this.src = src;
  97116. _this.vhs_ = vhs;
  97117. _this.withCredentials = withCredentials;
  97118. _this.handleManifestRedirects = handleManifestRedirects;
  97119. var vhsOptions = vhs.options_;
  97120. _this.customTagParsers = vhsOptions && vhsOptions.customTagParsers || [];
  97121. _this.customTagMappers = vhsOptions && vhsOptions.customTagMappers || [];
  97122. _this.experimentalLLHLS = vhsOptions && vhsOptions.experimentalLLHLS || false;
  97123. if (videojs.browser.IE_VERSION) {
  97124. _this.experimentalLLHLS = false;
  97125. }
  97126. _this.state = "HAVE_NOTHING";
  97127. _this.handleMediaupdatetimeout_ = _this.handleMediaupdatetimeout_.bind(_assertThisInitialized(_this));
  97128. _this.on("mediaupdatetimeout", _this.handleMediaupdatetimeout_);
  97129. return _this;
  97130. }
  97131. var _proto = PlaylistLoader2.prototype;
  97132. _proto.handleMediaupdatetimeout_ = function handleMediaupdatetimeout_() {
  97133. var _this2 = this;
  97134. if (this.state !== "HAVE_METADATA") {
  97135. return;
  97136. }
  97137. var media = this.media();
  97138. var uri = resolveUrl4(this.master.uri, media.uri);
  97139. if (this.experimentalLLHLS) {
  97140. uri = addLLHLSQueryDirectives(uri, media);
  97141. }
  97142. this.state = "HAVE_CURRENT_METADATA";
  97143. this.request = this.vhs_.xhr({
  97144. uri,
  97145. withCredentials: this.withCredentials
  97146. }, function(error, req) {
  97147. if (!_this2.request) {
  97148. return;
  97149. }
  97150. if (error) {
  97151. return _this2.playlistRequestError(_this2.request, _this2.media(), "HAVE_METADATA");
  97152. }
  97153. _this2.haveMetadata({
  97154. playlistString: _this2.request.responseText,
  97155. url: _this2.media().uri,
  97156. id: _this2.media().id
  97157. });
  97158. });
  97159. };
  97160. _proto.playlistRequestError = function playlistRequestError(xhr, playlist, startingState) {
  97161. var uri = playlist.uri, id = playlist.id;
  97162. this.request = null;
  97163. if (startingState) {
  97164. this.state = startingState;
  97165. }
  97166. this.error = {
  97167. playlist: this.master.playlists[id],
  97168. status: xhr.status,
  97169. message: "HLS playlist request error at URL: " + uri + ".",
  97170. responseText: xhr.responseText,
  97171. code: xhr.status >= 500 ? 4 : 2
  97172. };
  97173. this.trigger("error");
  97174. };
  97175. _proto.parseManifest_ = function parseManifest_(_ref) {
  97176. var _this3 = this;
  97177. var url = _ref.url, manifestString = _ref.manifestString;
  97178. return parseManifest({
  97179. onwarn: function onwarn(_ref2) {
  97180. var message = _ref2.message;
  97181. return _this3.logger_("m3u8-parser warn for " + url + ": " + message);
  97182. },
  97183. oninfo: function oninfo(_ref3) {
  97184. var message = _ref3.message;
  97185. return _this3.logger_("m3u8-parser info for " + url + ": " + message);
  97186. },
  97187. manifestString,
  97188. customTagParsers: this.customTagParsers,
  97189. customTagMappers: this.customTagMappers,
  97190. experimentalLLHLS: this.experimentalLLHLS
  97191. });
  97192. };
  97193. _proto.haveMetadata = function haveMetadata(_ref4) {
  97194. var playlistString = _ref4.playlistString, playlistObject = _ref4.playlistObject, url = _ref4.url, id = _ref4.id;
  97195. this.request = null;
  97196. this.state = "HAVE_METADATA";
  97197. var playlist = playlistObject || this.parseManifest_({
  97198. url,
  97199. manifestString: playlistString
  97200. });
  97201. playlist.lastRequest = Date.now();
  97202. setupMediaPlaylist({
  97203. playlist,
  97204. uri: url,
  97205. id
  97206. });
  97207. var update = updateMaster$1(this.master, playlist);
  97208. this.targetDuration = playlist.partTargetDuration || playlist.targetDuration;
  97209. this.pendingMedia_ = null;
  97210. if (update) {
  97211. this.master = update;
  97212. this.media_ = this.master.playlists[id];
  97213. } else {
  97214. this.trigger("playlistunchanged");
  97215. }
  97216. this.updateMediaUpdateTimeout_(refreshDelay(this.media(), !!update));
  97217. this.trigger("loadedplaylist");
  97218. };
  97219. _proto.dispose = function dispose() {
  97220. this.trigger("dispose");
  97221. this.stopRequest();
  97222. window_1.clearTimeout(this.mediaUpdateTimeout);
  97223. window_1.clearTimeout(this.finalRenditionTimeout);
  97224. this.off();
  97225. };
  97226. _proto.stopRequest = function stopRequest() {
  97227. if (this.request) {
  97228. var oldRequest = this.request;
  97229. this.request = null;
  97230. oldRequest.onreadystatechange = null;
  97231. oldRequest.abort();
  97232. }
  97233. };
  97234. _proto.media = function media(playlist, shouldDelay) {
  97235. var _this4 = this;
  97236. if (!playlist) {
  97237. return this.media_;
  97238. }
  97239. if (this.state === "HAVE_NOTHING") {
  97240. throw new Error("Cannot switch media playlist from " + this.state);
  97241. }
  97242. if (typeof playlist === "string") {
  97243. if (!this.master.playlists[playlist]) {
  97244. throw new Error("Unknown playlist URI: " + playlist);
  97245. }
  97246. playlist = this.master.playlists[playlist];
  97247. }
  97248. window_1.clearTimeout(this.finalRenditionTimeout);
  97249. if (shouldDelay) {
  97250. var delay = (playlist.partTargetDuration || playlist.targetDuration) / 2 * 1e3 || 5 * 1e3;
  97251. this.finalRenditionTimeout = window_1.setTimeout(this.media.bind(this, playlist, false), delay);
  97252. return;
  97253. }
  97254. var startingState = this.state;
  97255. var mediaChange = !this.media_ || playlist.id !== this.media_.id;
  97256. var masterPlaylistRef = this.master.playlists[playlist.id];
  97257. if (masterPlaylistRef && masterPlaylistRef.endList || playlist.endList && playlist.segments.length) {
  97258. if (this.request) {
  97259. this.request.onreadystatechange = null;
  97260. this.request.abort();
  97261. this.request = null;
  97262. }
  97263. this.state = "HAVE_METADATA";
  97264. this.media_ = playlist;
  97265. if (mediaChange) {
  97266. this.trigger("mediachanging");
  97267. if (startingState === "HAVE_MASTER") {
  97268. this.trigger("loadedmetadata");
  97269. } else {
  97270. this.trigger("mediachange");
  97271. }
  97272. }
  97273. return;
  97274. }
  97275. this.updateMediaUpdateTimeout_(refreshDelay(playlist, true));
  97276. if (!mediaChange) {
  97277. return;
  97278. }
  97279. this.state = "SWITCHING_MEDIA";
  97280. if (this.request) {
  97281. if (playlist.resolvedUri === this.request.url) {
  97282. return;
  97283. }
  97284. this.request.onreadystatechange = null;
  97285. this.request.abort();
  97286. this.request = null;
  97287. }
  97288. if (this.media_) {
  97289. this.trigger("mediachanging");
  97290. }
  97291. this.pendingMedia_ = playlist;
  97292. this.request = this.vhs_.xhr({
  97293. uri: playlist.resolvedUri,
  97294. withCredentials: this.withCredentials
  97295. }, function(error, req) {
  97296. if (!_this4.request) {
  97297. return;
  97298. }
  97299. playlist.lastRequest = Date.now();
  97300. playlist.resolvedUri = resolveManifestRedirect(_this4.handleManifestRedirects, playlist.resolvedUri, req);
  97301. if (error) {
  97302. return _this4.playlistRequestError(_this4.request, playlist, startingState);
  97303. }
  97304. _this4.haveMetadata({
  97305. playlistString: req.responseText,
  97306. url: playlist.uri,
  97307. id: playlist.id
  97308. });
  97309. if (startingState === "HAVE_MASTER") {
  97310. _this4.trigger("loadedmetadata");
  97311. } else {
  97312. _this4.trigger("mediachange");
  97313. }
  97314. });
  97315. };
  97316. _proto.pause = function pause() {
  97317. if (this.mediaUpdateTimeout) {
  97318. window_1.clearTimeout(this.mediaUpdateTimeout);
  97319. this.mediaUpdateTimeout = null;
  97320. }
  97321. this.stopRequest();
  97322. if (this.state === "HAVE_NOTHING") {
  97323. this.started = false;
  97324. }
  97325. if (this.state === "SWITCHING_MEDIA") {
  97326. if (this.media_) {
  97327. this.state = "HAVE_METADATA";
  97328. } else {
  97329. this.state = "HAVE_MASTER";
  97330. }
  97331. } else if (this.state === "HAVE_CURRENT_METADATA") {
  97332. this.state = "HAVE_METADATA";
  97333. }
  97334. };
  97335. _proto.load = function load(shouldDelay) {
  97336. var _this5 = this;
  97337. if (this.mediaUpdateTimeout) {
  97338. window_1.clearTimeout(this.mediaUpdateTimeout);
  97339. this.mediaUpdateTimeout = null;
  97340. }
  97341. var media = this.media();
  97342. if (shouldDelay) {
  97343. var delay = media ? (media.partTargetDuration || media.targetDuration) / 2 * 1e3 : 5 * 1e3;
  97344. this.mediaUpdateTimeout = window_1.setTimeout(function() {
  97345. _this5.mediaUpdateTimeout = null;
  97346. _this5.load();
  97347. }, delay);
  97348. return;
  97349. }
  97350. if (!this.started) {
  97351. this.start();
  97352. return;
  97353. }
  97354. if (media && !media.endList) {
  97355. this.trigger("mediaupdatetimeout");
  97356. } else {
  97357. this.trigger("loadedplaylist");
  97358. }
  97359. };
  97360. _proto.updateMediaUpdateTimeout_ = function updateMediaUpdateTimeout_(delay) {
  97361. var _this6 = this;
  97362. if (this.mediaUpdateTimeout) {
  97363. window_1.clearTimeout(this.mediaUpdateTimeout);
  97364. this.mediaUpdateTimeout = null;
  97365. }
  97366. if (!this.media() || this.media().endList) {
  97367. return;
  97368. }
  97369. this.mediaUpdateTimeout = window_1.setTimeout(function() {
  97370. _this6.mediaUpdateTimeout = null;
  97371. _this6.trigger("mediaupdatetimeout");
  97372. _this6.updateMediaUpdateTimeout_(delay);
  97373. }, delay);
  97374. };
  97375. _proto.start = function start2() {
  97376. var _this7 = this;
  97377. this.started = true;
  97378. if (typeof this.src === "object") {
  97379. if (!this.src.uri) {
  97380. this.src.uri = window_1.location.href;
  97381. }
  97382. this.src.resolvedUri = this.src.uri;
  97383. setTimeout(function() {
  97384. _this7.setupInitialPlaylist(_this7.src);
  97385. }, 0);
  97386. return;
  97387. }
  97388. this.request = this.vhs_.xhr({
  97389. uri: this.src,
  97390. withCredentials: this.withCredentials
  97391. }, function(error, req) {
  97392. if (!_this7.request) {
  97393. return;
  97394. }
  97395. _this7.request = null;
  97396. if (error) {
  97397. _this7.error = {
  97398. status: req.status,
  97399. message: "HLS playlist request error at URL: " + _this7.src + ".",
  97400. responseText: req.responseText,
  97401. code: 2
  97402. };
  97403. if (_this7.state === "HAVE_NOTHING") {
  97404. _this7.started = false;
  97405. }
  97406. return _this7.trigger("error");
  97407. }
  97408. _this7.src = resolveManifestRedirect(_this7.handleManifestRedirects, _this7.src, req);
  97409. var manifest = _this7.parseManifest_({
  97410. manifestString: req.responseText,
  97411. url: _this7.src
  97412. });
  97413. _this7.setupInitialPlaylist(manifest);
  97414. });
  97415. };
  97416. _proto.srcUri = function srcUri() {
  97417. return typeof this.src === "string" ? this.src : this.src.uri;
  97418. };
  97419. _proto.setupInitialPlaylist = function setupInitialPlaylist(manifest) {
  97420. this.state = "HAVE_MASTER";
  97421. if (manifest.playlists) {
  97422. this.master = manifest;
  97423. addPropertiesToMaster(this.master, this.srcUri());
  97424. manifest.playlists.forEach(function(playlist) {
  97425. playlist.segments = getAllSegments(playlist);
  97426. playlist.segments.forEach(function(segment) {
  97427. resolveSegmentUris(segment, playlist.resolvedUri);
  97428. });
  97429. });
  97430. this.trigger("loadedplaylist");
  97431. if (!this.request) {
  97432. this.media(this.master.playlists[0]);
  97433. }
  97434. return;
  97435. }
  97436. var uri = this.srcUri() || window_1.location.href;
  97437. this.master = masterForMedia(manifest, uri);
  97438. this.haveMetadata({
  97439. playlistObject: manifest,
  97440. url: uri,
  97441. id: this.master.playlists[0].id
  97442. });
  97443. this.trigger("loadedmetadata");
  97444. };
  97445. return PlaylistLoader2;
  97446. }(EventTarget$1);
  97447. var videojsXHR = videojs.xhr, mergeOptions$1$1 = videojs.mergeOptions;
  97448. var callbackWrapper = function callbackWrapper2(request, error, response, callback2) {
  97449. var reqResponse = request.responseType === "arraybuffer" ? request.response : request.responseText;
  97450. if (!error && reqResponse) {
  97451. request.responseTime = Date.now();
  97452. request.roundTripTime = request.responseTime - request.requestTime;
  97453. request.bytesReceived = reqResponse.byteLength || reqResponse.length;
  97454. if (!request.bandwidth) {
  97455. request.bandwidth = Math.floor(request.bytesReceived / request.roundTripTime * 8 * 1e3);
  97456. }
  97457. }
  97458. if (response.headers) {
  97459. request.responseHeaders = response.headers;
  97460. }
  97461. if (error && error.code === "ETIMEDOUT") {
  97462. request.timedout = true;
  97463. }
  97464. if (!error && !request.aborted && response.statusCode !== 200 && response.statusCode !== 206 && response.statusCode !== 0) {
  97465. error = new Error("XHR Failed with a response of: " + (request && (reqResponse || request.responseText)));
  97466. }
  97467. callback2(error, request);
  97468. };
  97469. var xhrFactory = function xhrFactory2() {
  97470. var xhr = function XhrFunction(options2, callback2) {
  97471. options2 = mergeOptions$1$1({
  97472. timeout: 45e3
  97473. }, options2);
  97474. var beforeRequest = XhrFunction.beforeRequest || videojs.Vhs.xhr.beforeRequest;
  97475. if (beforeRequest && typeof beforeRequest === "function") {
  97476. var newOptions = beforeRequest(options2);
  97477. if (newOptions) {
  97478. options2 = newOptions;
  97479. }
  97480. }
  97481. var xhrMethod = videojs.Vhs.xhr.original === true ? videojsXHR : videojs.Vhs.xhr;
  97482. var request = xhrMethod(options2, function(error, response) {
  97483. return callbackWrapper(request, error, response, callback2);
  97484. });
  97485. var originalAbort = request.abort;
  97486. request.abort = function() {
  97487. request.aborted = true;
  97488. return originalAbort.apply(request, arguments);
  97489. };
  97490. request.uri = options2.uri;
  97491. request.requestTime = Date.now();
  97492. return request;
  97493. };
  97494. xhr.original = true;
  97495. return xhr;
  97496. };
  97497. var byterangeStr = function byterangeStr2(byterange) {
  97498. var byterangeEnd;
  97499. var byterangeStart = byterange.offset;
  97500. if (typeof byterange.offset === "bigint" || typeof byterange.length === "bigint") {
  97501. byterangeEnd = window_1.BigInt(byterange.offset) + window_1.BigInt(byterange.length) - window_1.BigInt(1);
  97502. } else {
  97503. byterangeEnd = byterange.offset + byterange.length - 1;
  97504. }
  97505. return "bytes=" + byterangeStart + "-" + byterangeEnd;
  97506. };
  97507. var segmentXhrHeaders = function segmentXhrHeaders2(segment) {
  97508. var headers = {};
  97509. if (segment.byterange) {
  97510. headers.Range = byterangeStr(segment.byterange);
  97511. }
  97512. return headers;
  97513. };
  97514. var textRange = function textRange2(range3, i2) {
  97515. return range3.start(i2) + "-" + range3.end(i2);
  97516. };
  97517. var formatHexString = function formatHexString2(e, i2) {
  97518. var value = e.toString(16);
  97519. return "00".substring(0, 2 - value.length) + value + (i2 % 2 ? " " : "");
  97520. };
  97521. var formatAsciiString = function formatAsciiString2(e) {
  97522. if (e >= 32 && e < 126) {
  97523. return String.fromCharCode(e);
  97524. }
  97525. return ".";
  97526. };
  97527. var createTransferableMessage = function createTransferableMessage2(message) {
  97528. var transferable = {};
  97529. Object.keys(message).forEach(function(key) {
  97530. var value = message[key];
  97531. if (isArrayBufferView2(value)) {
  97532. transferable[key] = {
  97533. bytes: value.buffer,
  97534. byteOffset: value.byteOffset,
  97535. byteLength: value.byteLength
  97536. };
  97537. } else {
  97538. transferable[key] = value;
  97539. }
  97540. });
  97541. return transferable;
  97542. };
  97543. var initSegmentId = function initSegmentId2(initSegment) {
  97544. var byterange = initSegment.byterange || {
  97545. length: Infinity,
  97546. offset: 0
  97547. };
  97548. return [byterange.length, byterange.offset, initSegment.resolvedUri].join(",");
  97549. };
  97550. var segmentKeyId = function segmentKeyId2(key) {
  97551. return key.resolvedUri;
  97552. };
  97553. var hexDump = function hexDump2(data) {
  97554. var bytes = Array.prototype.slice.call(data);
  97555. var step = 16;
  97556. var result = "";
  97557. var hex;
  97558. var ascii;
  97559. for (var j = 0; j < bytes.length / step; j++) {
  97560. hex = bytes.slice(j * step, j * step + step).map(formatHexString).join("");
  97561. ascii = bytes.slice(j * step, j * step + step).map(formatAsciiString).join("");
  97562. result += hex + " " + ascii + "\n";
  97563. }
  97564. return result;
  97565. };
  97566. var tagDump = function tagDump2(_ref) {
  97567. var bytes = _ref.bytes;
  97568. return hexDump(bytes);
  97569. };
  97570. var textRanges = function textRanges2(ranges) {
  97571. var result = "";
  97572. var i2;
  97573. for (i2 = 0; i2 < ranges.length; i2++) {
  97574. result += textRange(ranges, i2) + " ";
  97575. }
  97576. return result;
  97577. };
  97578. var utils = /* @__PURE__ */ Object.freeze({
  97579. __proto__: null,
  97580. createTransferableMessage,
  97581. initSegmentId,
  97582. segmentKeyId,
  97583. hexDump,
  97584. tagDump,
  97585. textRanges
  97586. });
  97587. var SEGMENT_END_FUDGE_PERCENT = 0.25;
  97588. var playerTimeToProgramTime = function playerTimeToProgramTime2(playerTime, segment) {
  97589. if (!segment.dateTimeObject) {
  97590. return null;
  97591. }
  97592. var transmuxerPrependedSeconds = segment.videoTimingInfo.transmuxerPrependedSeconds;
  97593. var transmuxedStart = segment.videoTimingInfo.transmuxedPresentationStart;
  97594. var startOfSegment = transmuxedStart + transmuxerPrependedSeconds;
  97595. var offsetFromSegmentStart = playerTime - startOfSegment;
  97596. return new Date(segment.dateTimeObject.getTime() + offsetFromSegmentStart * 1e3);
  97597. };
  97598. var originalSegmentVideoDuration = function originalSegmentVideoDuration2(videoTimingInfo) {
  97599. return videoTimingInfo.transmuxedPresentationEnd - videoTimingInfo.transmuxedPresentationStart - videoTimingInfo.transmuxerPrependedSeconds;
  97600. };
  97601. var findSegmentForProgramTime = function findSegmentForProgramTime2(programTime, playlist) {
  97602. var dateTimeObject;
  97603. try {
  97604. dateTimeObject = new Date(programTime);
  97605. } catch (e) {
  97606. return null;
  97607. }
  97608. if (!playlist || !playlist.segments || playlist.segments.length === 0) {
  97609. return null;
  97610. }
  97611. var segment = playlist.segments[0];
  97612. if (dateTimeObject < segment.dateTimeObject) {
  97613. return null;
  97614. }
  97615. for (var i2 = 0; i2 < playlist.segments.length - 1; i2++) {
  97616. segment = playlist.segments[i2];
  97617. var nextSegmentStart = playlist.segments[i2 + 1].dateTimeObject;
  97618. if (dateTimeObject < nextSegmentStart) {
  97619. break;
  97620. }
  97621. }
  97622. var lastSegment = playlist.segments[playlist.segments.length - 1];
  97623. var lastSegmentStart = lastSegment.dateTimeObject;
  97624. var lastSegmentDuration = lastSegment.videoTimingInfo ? originalSegmentVideoDuration(lastSegment.videoTimingInfo) : lastSegment.duration + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT;
  97625. var lastSegmentEnd = new Date(lastSegmentStart.getTime() + lastSegmentDuration * 1e3);
  97626. if (dateTimeObject > lastSegmentEnd) {
  97627. return null;
  97628. }
  97629. if (dateTimeObject > lastSegmentStart) {
  97630. segment = lastSegment;
  97631. }
  97632. return {
  97633. segment,
  97634. estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : Playlist.duration(playlist, playlist.mediaSequence + playlist.segments.indexOf(segment)),
  97635. type: segment.videoTimingInfo ? "accurate" : "estimate"
  97636. };
  97637. };
  97638. var findSegmentForPlayerTime = function findSegmentForPlayerTime2(time, playlist) {
  97639. if (!playlist || !playlist.segments || playlist.segments.length === 0) {
  97640. return null;
  97641. }
  97642. var segmentEnd = 0;
  97643. var segment;
  97644. for (var i2 = 0; i2 < playlist.segments.length; i2++) {
  97645. segment = playlist.segments[i2];
  97646. segmentEnd = segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationEnd : segmentEnd + segment.duration;
  97647. if (time <= segmentEnd) {
  97648. break;
  97649. }
  97650. }
  97651. var lastSegment = playlist.segments[playlist.segments.length - 1];
  97652. if (lastSegment.videoTimingInfo && lastSegment.videoTimingInfo.transmuxedPresentationEnd < time) {
  97653. return null;
  97654. }
  97655. if (time > segmentEnd) {
  97656. if (time > segmentEnd + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT) {
  97657. return null;
  97658. }
  97659. segment = lastSegment;
  97660. }
  97661. return {
  97662. segment,
  97663. estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : segmentEnd - segment.duration,
  97664. type: segment.videoTimingInfo ? "accurate" : "estimate"
  97665. };
  97666. };
  97667. var getOffsetFromTimestamp = function getOffsetFromTimestamp2(comparisonTimeStamp, programTime) {
  97668. var segmentDateTime;
  97669. var programDateTime;
  97670. try {
  97671. segmentDateTime = new Date(comparisonTimeStamp);
  97672. programDateTime = new Date(programTime);
  97673. } catch (e) {
  97674. }
  97675. var segmentTimeEpoch = segmentDateTime.getTime();
  97676. var programTimeEpoch = programDateTime.getTime();
  97677. return (programTimeEpoch - segmentTimeEpoch) / 1e3;
  97678. };
  97679. var verifyProgramDateTimeTags = function verifyProgramDateTimeTags2(playlist) {
  97680. if (!playlist.segments || playlist.segments.length === 0) {
  97681. return false;
  97682. }
  97683. for (var i2 = 0; i2 < playlist.segments.length; i2++) {
  97684. var segment = playlist.segments[i2];
  97685. if (!segment.dateTimeObject) {
  97686. return false;
  97687. }
  97688. }
  97689. return true;
  97690. };
  97691. var getProgramTime = function getProgramTime2(_ref) {
  97692. var playlist = _ref.playlist, _ref$time = _ref.time, time = _ref$time === void 0 ? void 0 : _ref$time, callback2 = _ref.callback;
  97693. if (!callback2) {
  97694. throw new Error("getProgramTime: callback must be provided");
  97695. }
  97696. if (!playlist || time === void 0) {
  97697. return callback2({
  97698. message: "getProgramTime: playlist and time must be provided"
  97699. });
  97700. }
  97701. var matchedSegment = findSegmentForPlayerTime(time, playlist);
  97702. if (!matchedSegment) {
  97703. return callback2({
  97704. message: "valid programTime was not found"
  97705. });
  97706. }
  97707. if (matchedSegment.type === "estimate") {
  97708. return callback2({
  97709. message: "Accurate programTime could not be determined. Please seek to e.seekTime and try again",
  97710. seekTime: matchedSegment.estimatedStart
  97711. });
  97712. }
  97713. var programTimeObject = {
  97714. mediaSeconds: time
  97715. };
  97716. var programTime = playerTimeToProgramTime(time, matchedSegment.segment);
  97717. if (programTime) {
  97718. programTimeObject.programDateTime = programTime.toISOString();
  97719. }
  97720. return callback2(null, programTimeObject);
  97721. };
  97722. var seekToProgramTime = function seekToProgramTime2(_ref2) {
  97723. var programTime = _ref2.programTime, playlist = _ref2.playlist, _ref2$retryCount = _ref2.retryCount, retryCount = _ref2$retryCount === void 0 ? 2 : _ref2$retryCount, seekTo = _ref2.seekTo, _ref2$pauseAfterSeek = _ref2.pauseAfterSeek, pauseAfterSeek = _ref2$pauseAfterSeek === void 0 ? true : _ref2$pauseAfterSeek, tech = _ref2.tech, callback2 = _ref2.callback;
  97724. if (!callback2) {
  97725. throw new Error("seekToProgramTime: callback must be provided");
  97726. }
  97727. if (typeof programTime === "undefined" || !playlist || !seekTo) {
  97728. return callback2({
  97729. message: "seekToProgramTime: programTime, seekTo and playlist must be provided"
  97730. });
  97731. }
  97732. if (!playlist.endList && !tech.hasStarted_) {
  97733. return callback2({
  97734. message: "player must be playing a live stream to start buffering"
  97735. });
  97736. }
  97737. if (!verifyProgramDateTimeTags(playlist)) {
  97738. return callback2({
  97739. message: "programDateTime tags must be provided in the manifest " + playlist.resolvedUri
  97740. });
  97741. }
  97742. var matchedSegment = findSegmentForProgramTime(programTime, playlist);
  97743. if (!matchedSegment) {
  97744. return callback2({
  97745. message: programTime + " was not found in the stream"
  97746. });
  97747. }
  97748. var segment = matchedSegment.segment;
  97749. var mediaOffset = getOffsetFromTimestamp(segment.dateTimeObject, programTime);
  97750. if (matchedSegment.type === "estimate") {
  97751. if (retryCount === 0) {
  97752. return callback2({
  97753. message: programTime + " is not buffered yet. Try again"
  97754. });
  97755. }
  97756. seekTo(matchedSegment.estimatedStart + mediaOffset);
  97757. tech.one("seeked", function() {
  97758. seekToProgramTime2({
  97759. programTime,
  97760. playlist,
  97761. retryCount: retryCount - 1,
  97762. seekTo,
  97763. pauseAfterSeek,
  97764. tech,
  97765. callback: callback2
  97766. });
  97767. });
  97768. return;
  97769. }
  97770. var seekToTime = segment.start + mediaOffset;
  97771. var seekedCallback = function seekedCallback2() {
  97772. return callback2(null, tech.currentTime());
  97773. };
  97774. tech.one("seeked", seekedCallback);
  97775. if (pauseAfterSeek) {
  97776. tech.pause();
  97777. }
  97778. seekTo(seekToTime);
  97779. };
  97780. var callbackOnCompleted = function callbackOnCompleted2(request, cb) {
  97781. if (request.readyState === 4) {
  97782. return cb();
  97783. }
  97784. return;
  97785. };
  97786. var containerRequest = function containerRequest2(uri, xhr, cb) {
  97787. var bytes = [];
  97788. var id3Offset;
  97789. var finished = false;
  97790. var endRequestAndCallback = function endRequestAndCallback2(err, req, type2, _bytes) {
  97791. req.abort();
  97792. finished = true;
  97793. return cb(err, req, type2, _bytes);
  97794. };
  97795. var progressListener = function progressListener2(error, request2) {
  97796. if (finished) {
  97797. return;
  97798. }
  97799. if (error) {
  97800. return endRequestAndCallback(error, request2, "", bytes);
  97801. }
  97802. var newPart = request2.responseText.substring(bytes && bytes.byteLength || 0, request2.responseText.length);
  97803. bytes = concatTypedArrays2(bytes, stringToBytes2(newPart, true));
  97804. id3Offset = id3Offset || getId3Offset2(bytes);
  97805. if (bytes.length < 10 || id3Offset && bytes.length < id3Offset + 2) {
  97806. return callbackOnCompleted(request2, function() {
  97807. return endRequestAndCallback(error, request2, "", bytes);
  97808. });
  97809. }
  97810. var type2 = detectContainerForBytes2(bytes);
  97811. if (type2 === "ts" && bytes.length < 188) {
  97812. return callbackOnCompleted(request2, function() {
  97813. return endRequestAndCallback(error, request2, "", bytes);
  97814. });
  97815. }
  97816. if (!type2 && bytes.length < 376) {
  97817. return callbackOnCompleted(request2, function() {
  97818. return endRequestAndCallback(error, request2, "", bytes);
  97819. });
  97820. }
  97821. return endRequestAndCallback(null, request2, type2, bytes);
  97822. };
  97823. var options2 = {
  97824. uri,
  97825. beforeSend: function beforeSend(request2) {
  97826. request2.overrideMimeType("text/plain; charset=x-user-defined");
  97827. request2.addEventListener("progress", function(_ref) {
  97828. _ref.total;
  97829. _ref.loaded;
  97830. return callbackWrapper(request2, null, {
  97831. statusCode: request2.status
  97832. }, progressListener);
  97833. });
  97834. }
  97835. };
  97836. var request = xhr(options2, function(error, response) {
  97837. return callbackWrapper(request, error, response, progressListener);
  97838. });
  97839. return request;
  97840. };
  97841. var EventTarget2 = videojs.EventTarget, mergeOptions$4 = videojs.mergeOptions;
  97842. var dashPlaylistUnchanged = function dashPlaylistUnchanged2(a, b) {
  97843. if (!isPlaylistUnchanged(a, b)) {
  97844. return false;
  97845. }
  97846. if (a.sidx && b.sidx && (a.sidx.offset !== b.sidx.offset || a.sidx.length !== b.sidx.length)) {
  97847. return false;
  97848. } else if (!a.sidx && b.sidx || a.sidx && !b.sidx) {
  97849. return false;
  97850. }
  97851. if (a.segments && !b.segments || !a.segments && b.segments) {
  97852. return false;
  97853. }
  97854. if (!a.segments && !b.segments) {
  97855. return true;
  97856. }
  97857. for (var i2 = 0; i2 < a.segments.length; i2++) {
  97858. var aSegment = a.segments[i2];
  97859. var bSegment = b.segments[i2];
  97860. if (aSegment.uri !== bSegment.uri) {
  97861. return false;
  97862. }
  97863. if (!aSegment.byterange && !bSegment.byterange) {
  97864. continue;
  97865. }
  97866. var aByterange = aSegment.byterange;
  97867. var bByterange = bSegment.byterange;
  97868. if (aByterange && !bByterange || !aByterange && bByterange) {
  97869. return false;
  97870. }
  97871. if (aByterange.offset !== bByterange.offset || aByterange.length !== bByterange.length) {
  97872. return false;
  97873. }
  97874. }
  97875. return true;
  97876. };
  97877. var dashGroupId = function dashGroupId2(type2, group, label2, playlist) {
  97878. var playlistId = playlist.attributes.NAME || label2;
  97879. return "placeholder-uri-" + type2 + "-" + group + "-" + playlistId;
  97880. };
  97881. var parseMasterXml = function parseMasterXml2(_ref) {
  97882. var masterXml = _ref.masterXml, srcUrl = _ref.srcUrl, clientOffset = _ref.clientOffset, sidxMapping = _ref.sidxMapping, previousManifest = _ref.previousManifest;
  97883. var manifest = parse(masterXml, {
  97884. manifestUri: srcUrl,
  97885. clientOffset,
  97886. sidxMapping,
  97887. previousManifest
  97888. });
  97889. addPropertiesToMaster(manifest, srcUrl, dashGroupId);
  97890. return manifest;
  97891. };
  97892. var removeOldMediaGroupLabels = function removeOldMediaGroupLabels2(update, newMaster) {
  97893. forEachMediaGroup3(update, function(properties, type2, group, label2) {
  97894. if (!(label2 in newMaster.mediaGroups[type2][group])) {
  97895. delete update.mediaGroups[type2][group][label2];
  97896. }
  97897. });
  97898. };
  97899. var updateMaster2 = function updateMaster3(oldMaster, newMaster, sidxMapping) {
  97900. var noChanges = true;
  97901. var update = mergeOptions$4(oldMaster, {
  97902. duration: newMaster.duration,
  97903. minimumUpdatePeriod: newMaster.minimumUpdatePeriod,
  97904. timelineStarts: newMaster.timelineStarts
  97905. });
  97906. for (var i2 = 0; i2 < newMaster.playlists.length; i2++) {
  97907. var playlist = newMaster.playlists[i2];
  97908. if (playlist.sidx) {
  97909. var sidxKey = generateSidxKey(playlist.sidx);
  97910. if (sidxMapping && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx) {
  97911. addSidxSegmentsToPlaylist$1(playlist, sidxMapping[sidxKey].sidx, playlist.sidx.resolvedUri);
  97912. }
  97913. }
  97914. var playlistUpdate = updateMaster$1(update, playlist, dashPlaylistUnchanged);
  97915. if (playlistUpdate) {
  97916. update = playlistUpdate;
  97917. noChanges = false;
  97918. }
  97919. }
  97920. forEachMediaGroup3(newMaster, function(properties, type2, group, label2) {
  97921. if (properties.playlists && properties.playlists.length) {
  97922. var id = properties.playlists[0].id;
  97923. var _playlistUpdate = updateMaster$1(update, properties.playlists[0], dashPlaylistUnchanged);
  97924. if (_playlistUpdate) {
  97925. update = _playlistUpdate;
  97926. if (!(label2 in update.mediaGroups[type2][group])) {
  97927. update.mediaGroups[type2][group][label2] = properties;
  97928. }
  97929. update.mediaGroups[type2][group][label2].playlists[0] = update.playlists[id];
  97930. noChanges = false;
  97931. }
  97932. }
  97933. });
  97934. removeOldMediaGroupLabels(update, newMaster);
  97935. if (newMaster.minimumUpdatePeriod !== oldMaster.minimumUpdatePeriod) {
  97936. noChanges = false;
  97937. }
  97938. if (noChanges) {
  97939. return null;
  97940. }
  97941. return update;
  97942. };
  97943. var equivalentSidx = function equivalentSidx2(a, b) {
  97944. var neitherMap = Boolean(!a.map && !b.map);
  97945. var equivalentMap = neitherMap || Boolean(a.map && b.map && a.map.byterange.offset === b.map.byterange.offset && a.map.byterange.length === b.map.byterange.length);
  97946. return equivalentMap && a.uri === b.uri && a.byterange.offset === b.byterange.offset && a.byterange.length === b.byterange.length;
  97947. };
  97948. var compareSidxEntry = function compareSidxEntry2(playlists, oldSidxMapping) {
  97949. var newSidxMapping = {};
  97950. for (var id in playlists) {
  97951. var playlist = playlists[id];
  97952. var currentSidxInfo = playlist.sidx;
  97953. if (currentSidxInfo) {
  97954. var key = generateSidxKey(currentSidxInfo);
  97955. if (!oldSidxMapping[key]) {
  97956. break;
  97957. }
  97958. var savedSidxInfo = oldSidxMapping[key].sidxInfo;
  97959. if (equivalentSidx(savedSidxInfo, currentSidxInfo)) {
  97960. newSidxMapping[key] = oldSidxMapping[key];
  97961. }
  97962. }
  97963. }
  97964. return newSidxMapping;
  97965. };
  97966. var filterChangedSidxMappings = function filterChangedSidxMappings2(master, oldSidxMapping) {
  97967. var videoSidx = compareSidxEntry(master.playlists, oldSidxMapping);
  97968. var mediaGroupSidx = videoSidx;
  97969. forEachMediaGroup3(master, function(properties, mediaType, groupKey, labelKey) {
  97970. if (properties.playlists && properties.playlists.length) {
  97971. var playlists = properties.playlists;
  97972. mediaGroupSidx = mergeOptions$4(mediaGroupSidx, compareSidxEntry(playlists, oldSidxMapping));
  97973. }
  97974. });
  97975. return mediaGroupSidx;
  97976. };
  97977. var DashPlaylistLoader = /* @__PURE__ */ function(_EventTarget) {
  97978. _inheritsLoose(DashPlaylistLoader2, _EventTarget);
  97979. function DashPlaylistLoader2(srcUrlOrPlaylist, vhs, options2, masterPlaylistLoader) {
  97980. var _this;
  97981. if (options2 === void 0) {
  97982. options2 = {};
  97983. }
  97984. _this = _EventTarget.call(this) || this;
  97985. _this.masterPlaylistLoader_ = masterPlaylistLoader || _assertThisInitialized(_this);
  97986. if (!masterPlaylistLoader) {
  97987. _this.isMaster_ = true;
  97988. }
  97989. var _options = options2, _options$withCredenti = _options.withCredentials, withCredentials = _options$withCredenti === void 0 ? false : _options$withCredenti, _options$handleManife = _options.handleManifestRedirects, handleManifestRedirects = _options$handleManife === void 0 ? false : _options$handleManife;
  97990. _this.vhs_ = vhs;
  97991. _this.withCredentials = withCredentials;
  97992. _this.handleManifestRedirects = handleManifestRedirects;
  97993. if (!srcUrlOrPlaylist) {
  97994. throw new Error("A non-empty playlist URL or object is required");
  97995. }
  97996. _this.on("minimumUpdatePeriod", function() {
  97997. _this.refreshXml_();
  97998. });
  97999. _this.on("mediaupdatetimeout", function() {
  98000. _this.refreshMedia_(_this.media().id);
  98001. });
  98002. _this.state = "HAVE_NOTHING";
  98003. _this.loadedPlaylists_ = {};
  98004. _this.logger_ = logger("DashPlaylistLoader");
  98005. if (_this.isMaster_) {
  98006. _this.masterPlaylistLoader_.srcUrl = srcUrlOrPlaylist;
  98007. _this.masterPlaylistLoader_.sidxMapping_ = {};
  98008. } else {
  98009. _this.childPlaylist_ = srcUrlOrPlaylist;
  98010. }
  98011. return _this;
  98012. }
  98013. var _proto = DashPlaylistLoader2.prototype;
  98014. _proto.requestErrored_ = function requestErrored_(err, request, startingState) {
  98015. if (!this.request) {
  98016. return true;
  98017. }
  98018. this.request = null;
  98019. if (err) {
  98020. this.error = typeof err === "object" && !(err instanceof Error) ? err : {
  98021. status: request.status,
  98022. message: "DASH request error at URL: " + request.uri,
  98023. response: request.response,
  98024. code: 2
  98025. };
  98026. if (startingState) {
  98027. this.state = startingState;
  98028. }
  98029. this.trigger("error");
  98030. return true;
  98031. }
  98032. };
  98033. _proto.addSidxSegments_ = function addSidxSegments_(playlist, startingState, cb) {
  98034. var _this2 = this;
  98035. var sidxKey = playlist.sidx && generateSidxKey(playlist.sidx);
  98036. if (!playlist.sidx || !sidxKey || this.masterPlaylistLoader_.sidxMapping_[sidxKey]) {
  98037. this.mediaRequest_ = window_1.setTimeout(function() {
  98038. return cb(false);
  98039. }, 0);
  98040. return;
  98041. }
  98042. var uri = resolveManifestRedirect(this.handleManifestRedirects, playlist.sidx.resolvedUri);
  98043. var fin = function fin2(err, request) {
  98044. if (_this2.requestErrored_(err, request, startingState)) {
  98045. return;
  98046. }
  98047. var sidxMapping = _this2.masterPlaylistLoader_.sidxMapping_;
  98048. var sidx;
  98049. try {
  98050. sidx = parseSidx_1(toUint82(request.response).subarray(8));
  98051. } catch (e) {
  98052. _this2.requestErrored_(e, request, startingState);
  98053. return;
  98054. }
  98055. sidxMapping[sidxKey] = {
  98056. sidxInfo: playlist.sidx,
  98057. sidx
  98058. };
  98059. addSidxSegmentsToPlaylist$1(playlist, sidx, playlist.sidx.resolvedUri);
  98060. return cb(true);
  98061. };
  98062. this.request = containerRequest(uri, this.vhs_.xhr, function(err, request, container, bytes) {
  98063. if (err) {
  98064. return fin(err, request);
  98065. }
  98066. if (!container || container !== "mp4") {
  98067. return fin({
  98068. status: request.status,
  98069. message: "Unsupported " + (container || "unknown") + " container type for sidx segment at URL: " + uri,
  98070. response: "",
  98071. playlist,
  98072. internal: true,
  98073. blacklistDuration: Infinity,
  98074. code: 2
  98075. }, request);
  98076. }
  98077. var _playlist$sidx$bytera = playlist.sidx.byterange, offset = _playlist$sidx$bytera.offset, length = _playlist$sidx$bytera.length;
  98078. if (bytes.length >= length + offset) {
  98079. return fin(err, {
  98080. response: bytes.subarray(offset, offset + length),
  98081. status: request.status,
  98082. uri: request.uri
  98083. });
  98084. }
  98085. _this2.request = _this2.vhs_.xhr({
  98086. uri,
  98087. responseType: "arraybuffer",
  98088. headers: segmentXhrHeaders({
  98089. byterange: playlist.sidx.byterange
  98090. })
  98091. }, fin);
  98092. });
  98093. };
  98094. _proto.dispose = function dispose() {
  98095. this.trigger("dispose");
  98096. this.stopRequest();
  98097. this.loadedPlaylists_ = {};
  98098. window_1.clearTimeout(this.minimumUpdatePeriodTimeout_);
  98099. window_1.clearTimeout(this.mediaRequest_);
  98100. window_1.clearTimeout(this.mediaUpdateTimeout);
  98101. this.mediaUpdateTimeout = null;
  98102. this.mediaRequest_ = null;
  98103. this.minimumUpdatePeriodTimeout_ = null;
  98104. if (this.masterPlaylistLoader_.createMupOnMedia_) {
  98105. this.off("loadedmetadata", this.masterPlaylistLoader_.createMupOnMedia_);
  98106. this.masterPlaylistLoader_.createMupOnMedia_ = null;
  98107. }
  98108. this.off();
  98109. };
  98110. _proto.hasPendingRequest = function hasPendingRequest() {
  98111. return this.request || this.mediaRequest_;
  98112. };
  98113. _proto.stopRequest = function stopRequest() {
  98114. if (this.request) {
  98115. var oldRequest = this.request;
  98116. this.request = null;
  98117. oldRequest.onreadystatechange = null;
  98118. oldRequest.abort();
  98119. }
  98120. };
  98121. _proto.media = function media(playlist) {
  98122. var _this3 = this;
  98123. if (!playlist) {
  98124. return this.media_;
  98125. }
  98126. if (this.state === "HAVE_NOTHING") {
  98127. throw new Error("Cannot switch media playlist from " + this.state);
  98128. }
  98129. var startingState = this.state;
  98130. if (typeof playlist === "string") {
  98131. if (!this.masterPlaylistLoader_.master.playlists[playlist]) {
  98132. throw new Error("Unknown playlist URI: " + playlist);
  98133. }
  98134. playlist = this.masterPlaylistLoader_.master.playlists[playlist];
  98135. }
  98136. var mediaChange = !this.media_ || playlist.id !== this.media_.id;
  98137. if (mediaChange && this.loadedPlaylists_[playlist.id] && this.loadedPlaylists_[playlist.id].endList) {
  98138. this.state = "HAVE_METADATA";
  98139. this.media_ = playlist;
  98140. if (mediaChange) {
  98141. this.trigger("mediachanging");
  98142. this.trigger("mediachange");
  98143. }
  98144. return;
  98145. }
  98146. if (!mediaChange) {
  98147. return;
  98148. }
  98149. if (this.media_) {
  98150. this.trigger("mediachanging");
  98151. }
  98152. this.addSidxSegments_(playlist, startingState, function(sidxChanged) {
  98153. _this3.haveMetadata({
  98154. startingState,
  98155. playlist
  98156. });
  98157. });
  98158. };
  98159. _proto.haveMetadata = function haveMetadata(_ref2) {
  98160. var startingState = _ref2.startingState, playlist = _ref2.playlist;
  98161. this.state = "HAVE_METADATA";
  98162. this.loadedPlaylists_[playlist.id] = playlist;
  98163. this.mediaRequest_ = null;
  98164. this.refreshMedia_(playlist.id);
  98165. if (startingState === "HAVE_MASTER") {
  98166. this.trigger("loadedmetadata");
  98167. } else {
  98168. this.trigger("mediachange");
  98169. }
  98170. };
  98171. _proto.pause = function pause() {
  98172. if (this.masterPlaylistLoader_.createMupOnMedia_) {
  98173. this.off("loadedmetadata", this.masterPlaylistLoader_.createMupOnMedia_);
  98174. this.masterPlaylistLoader_.createMupOnMedia_ = null;
  98175. }
  98176. this.stopRequest();
  98177. window_1.clearTimeout(this.mediaUpdateTimeout);
  98178. this.mediaUpdateTimeout = null;
  98179. if (this.isMaster_) {
  98180. window_1.clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_);
  98181. this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_ = null;
  98182. }
  98183. if (this.state === "HAVE_NOTHING") {
  98184. this.started = false;
  98185. }
  98186. };
  98187. _proto.load = function load(isFinalRendition) {
  98188. var _this4 = this;
  98189. window_1.clearTimeout(this.mediaUpdateTimeout);
  98190. this.mediaUpdateTimeout = null;
  98191. var media = this.media();
  98192. if (isFinalRendition) {
  98193. var delay = media ? media.targetDuration / 2 * 1e3 : 5 * 1e3;
  98194. this.mediaUpdateTimeout = window_1.setTimeout(function() {
  98195. return _this4.load();
  98196. }, delay);
  98197. return;
  98198. }
  98199. if (!this.started) {
  98200. this.start();
  98201. return;
  98202. }
  98203. if (media && !media.endList) {
  98204. if (this.isMaster_ && !this.minimumUpdatePeriodTimeout_) {
  98205. this.trigger("minimumUpdatePeriod");
  98206. this.updateMinimumUpdatePeriodTimeout_();
  98207. }
  98208. this.trigger("mediaupdatetimeout");
  98209. } else {
  98210. this.trigger("loadedplaylist");
  98211. }
  98212. };
  98213. _proto.start = function start2() {
  98214. var _this5 = this;
  98215. this.started = true;
  98216. if (!this.isMaster_) {
  98217. this.mediaRequest_ = window_1.setTimeout(function() {
  98218. return _this5.haveMaster_();
  98219. }, 0);
  98220. return;
  98221. }
  98222. this.requestMaster_(function(req, masterChanged) {
  98223. _this5.haveMaster_();
  98224. if (!_this5.hasPendingRequest() && !_this5.media_) {
  98225. _this5.media(_this5.masterPlaylistLoader_.master.playlists[0]);
  98226. }
  98227. });
  98228. };
  98229. _proto.requestMaster_ = function requestMaster_(cb) {
  98230. var _this6 = this;
  98231. this.request = this.vhs_.xhr({
  98232. uri: this.masterPlaylistLoader_.srcUrl,
  98233. withCredentials: this.withCredentials
  98234. }, function(error, req) {
  98235. if (_this6.requestErrored_(error, req)) {
  98236. if (_this6.state === "HAVE_NOTHING") {
  98237. _this6.started = false;
  98238. }
  98239. return;
  98240. }
  98241. var masterChanged = req.responseText !== _this6.masterPlaylistLoader_.masterXml_;
  98242. _this6.masterPlaylistLoader_.masterXml_ = req.responseText;
  98243. if (req.responseHeaders && req.responseHeaders.date) {
  98244. _this6.masterLoaded_ = Date.parse(req.responseHeaders.date);
  98245. } else {
  98246. _this6.masterLoaded_ = Date.now();
  98247. }
  98248. _this6.masterPlaylistLoader_.srcUrl = resolveManifestRedirect(_this6.handleManifestRedirects, _this6.masterPlaylistLoader_.srcUrl, req);
  98249. if (masterChanged) {
  98250. _this6.handleMaster_();
  98251. _this6.syncClientServerClock_(function() {
  98252. return cb(req, masterChanged);
  98253. });
  98254. return;
  98255. }
  98256. return cb(req, masterChanged);
  98257. });
  98258. };
  98259. _proto.syncClientServerClock_ = function syncClientServerClock_(done) {
  98260. var _this7 = this;
  98261. var utcTiming = parseUTCTiming(this.masterPlaylistLoader_.masterXml_);
  98262. if (utcTiming === null) {
  98263. this.masterPlaylistLoader_.clientOffset_ = this.masterLoaded_ - Date.now();
  98264. return done();
  98265. }
  98266. if (utcTiming.method === "DIRECT") {
  98267. this.masterPlaylistLoader_.clientOffset_ = utcTiming.value - Date.now();
  98268. return done();
  98269. }
  98270. this.request = this.vhs_.xhr({
  98271. uri: resolveUrl4(this.masterPlaylistLoader_.srcUrl, utcTiming.value),
  98272. method: utcTiming.method,
  98273. withCredentials: this.withCredentials
  98274. }, function(error, req) {
  98275. if (!_this7.request) {
  98276. return;
  98277. }
  98278. if (error) {
  98279. _this7.masterPlaylistLoader_.clientOffset_ = _this7.masterLoaded_ - Date.now();
  98280. return done();
  98281. }
  98282. var serverTime;
  98283. if (utcTiming.method === "HEAD") {
  98284. if (!req.responseHeaders || !req.responseHeaders.date) {
  98285. serverTime = _this7.masterLoaded_;
  98286. } else {
  98287. serverTime = Date.parse(req.responseHeaders.date);
  98288. }
  98289. } else {
  98290. serverTime = Date.parse(req.responseText);
  98291. }
  98292. _this7.masterPlaylistLoader_.clientOffset_ = serverTime - Date.now();
  98293. done();
  98294. });
  98295. };
  98296. _proto.haveMaster_ = function haveMaster_() {
  98297. this.state = "HAVE_MASTER";
  98298. if (this.isMaster_) {
  98299. this.trigger("loadedplaylist");
  98300. } else if (!this.media_) {
  98301. this.media(this.childPlaylist_);
  98302. }
  98303. };
  98304. _proto.handleMaster_ = function handleMaster_() {
  98305. this.mediaRequest_ = null;
  98306. var oldMaster = this.masterPlaylistLoader_.master;
  98307. var newMaster = parseMasterXml({
  98308. masterXml: this.masterPlaylistLoader_.masterXml_,
  98309. srcUrl: this.masterPlaylistLoader_.srcUrl,
  98310. clientOffset: this.masterPlaylistLoader_.clientOffset_,
  98311. sidxMapping: this.masterPlaylistLoader_.sidxMapping_,
  98312. previousManifest: oldMaster
  98313. });
  98314. if (oldMaster) {
  98315. newMaster = updateMaster2(oldMaster, newMaster, this.masterPlaylistLoader_.sidxMapping_);
  98316. }
  98317. this.masterPlaylistLoader_.master = newMaster ? newMaster : oldMaster;
  98318. var location = this.masterPlaylistLoader_.master.locations && this.masterPlaylistLoader_.master.locations[0];
  98319. if (location && location !== this.masterPlaylistLoader_.srcUrl) {
  98320. this.masterPlaylistLoader_.srcUrl = location;
  98321. }
  98322. if (!oldMaster || newMaster && newMaster.minimumUpdatePeriod !== oldMaster.minimumUpdatePeriod) {
  98323. this.updateMinimumUpdatePeriodTimeout_();
  98324. }
  98325. return Boolean(newMaster);
  98326. };
  98327. _proto.updateMinimumUpdatePeriodTimeout_ = function updateMinimumUpdatePeriodTimeout_() {
  98328. var mpl = this.masterPlaylistLoader_;
  98329. if (mpl.createMupOnMedia_) {
  98330. mpl.off("loadedmetadata", mpl.createMupOnMedia_);
  98331. mpl.createMupOnMedia_ = null;
  98332. }
  98333. if (mpl.minimumUpdatePeriodTimeout_) {
  98334. window_1.clearTimeout(mpl.minimumUpdatePeriodTimeout_);
  98335. mpl.minimumUpdatePeriodTimeout_ = null;
  98336. }
  98337. var mup = mpl.master && mpl.master.minimumUpdatePeriod;
  98338. if (mup === 0) {
  98339. if (mpl.media()) {
  98340. mup = mpl.media().targetDuration * 1e3;
  98341. } else {
  98342. mpl.createMupOnMedia_ = mpl.updateMinimumUpdatePeriodTimeout_;
  98343. mpl.one("loadedmetadata", mpl.createMupOnMedia_);
  98344. }
  98345. }
  98346. if (typeof mup !== "number" || mup <= 0) {
  98347. if (mup < 0) {
  98348. this.logger_("found invalid minimumUpdatePeriod of " + mup + ", not setting a timeout");
  98349. }
  98350. return;
  98351. }
  98352. this.createMUPTimeout_(mup);
  98353. };
  98354. _proto.createMUPTimeout_ = function createMUPTimeout_(mup) {
  98355. var mpl = this.masterPlaylistLoader_;
  98356. mpl.minimumUpdatePeriodTimeout_ = window_1.setTimeout(function() {
  98357. mpl.minimumUpdatePeriodTimeout_ = null;
  98358. mpl.trigger("minimumUpdatePeriod");
  98359. mpl.createMUPTimeout_(mup);
  98360. }, mup);
  98361. };
  98362. _proto.refreshXml_ = function refreshXml_() {
  98363. var _this8 = this;
  98364. this.requestMaster_(function(req, masterChanged) {
  98365. if (!masterChanged) {
  98366. return;
  98367. }
  98368. if (_this8.media_) {
  98369. _this8.media_ = _this8.masterPlaylistLoader_.master.playlists[_this8.media_.id];
  98370. }
  98371. _this8.masterPlaylistLoader_.sidxMapping_ = filterChangedSidxMappings(_this8.masterPlaylistLoader_.master, _this8.masterPlaylistLoader_.sidxMapping_);
  98372. _this8.addSidxSegments_(_this8.media(), _this8.state, function(sidxChanged) {
  98373. _this8.refreshMedia_(_this8.media().id);
  98374. });
  98375. });
  98376. };
  98377. _proto.refreshMedia_ = function refreshMedia_(mediaID) {
  98378. var _this9 = this;
  98379. if (!mediaID) {
  98380. throw new Error("refreshMedia_ must take a media id");
  98381. }
  98382. if (this.media_ && this.isMaster_) {
  98383. this.handleMaster_();
  98384. }
  98385. var playlists = this.masterPlaylistLoader_.master.playlists;
  98386. var mediaChanged = !this.media_ || this.media_ !== playlists[mediaID];
  98387. if (mediaChanged) {
  98388. this.media_ = playlists[mediaID];
  98389. } else {
  98390. this.trigger("playlistunchanged");
  98391. }
  98392. if (!this.mediaUpdateTimeout) {
  98393. var createMediaUpdateTimeout = function createMediaUpdateTimeout2() {
  98394. if (_this9.media().endList) {
  98395. return;
  98396. }
  98397. _this9.mediaUpdateTimeout = window_1.setTimeout(function() {
  98398. _this9.trigger("mediaupdatetimeout");
  98399. createMediaUpdateTimeout2();
  98400. }, refreshDelay(_this9.media(), Boolean(mediaChanged)));
  98401. };
  98402. createMediaUpdateTimeout();
  98403. }
  98404. this.trigger("loadedplaylist");
  98405. };
  98406. return DashPlaylistLoader2;
  98407. }(EventTarget2);
  98408. var Config = {
  98409. GOAL_BUFFER_LENGTH: 30,
  98410. MAX_GOAL_BUFFER_LENGTH: 60,
  98411. BACK_BUFFER_LENGTH: 30,
  98412. GOAL_BUFFER_LENGTH_RATE: 1,
  98413. INITIAL_BANDWIDTH: 4194304,
  98414. BANDWIDTH_VARIANCE: 1.2,
  98415. BUFFER_LOW_WATER_LINE: 0,
  98416. MAX_BUFFER_LOW_WATER_LINE: 30,
  98417. EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE: 16,
  98418. BUFFER_LOW_WATER_LINE_RATE: 1,
  98419. BUFFER_HIGH_WATER_LINE: 30
  98420. };
  98421. var stringToArrayBuffer = function stringToArrayBuffer2(string) {
  98422. var view = new Uint8Array(new ArrayBuffer(string.length));
  98423. for (var i2 = 0; i2 < string.length; i2++) {
  98424. view[i2] = string.charCodeAt(i2);
  98425. }
  98426. return view.buffer;
  98427. };
  98428. var browserWorkerPolyFill = function browserWorkerPolyFill2(workerObj) {
  98429. workerObj.on = workerObj.addEventListener;
  98430. workerObj.off = workerObj.removeEventListener;
  98431. return workerObj;
  98432. };
  98433. var createObjectURL = function createObjectURL2(str) {
  98434. try {
  98435. return URL.createObjectURL(new Blob([str], {
  98436. type: "application/javascript"
  98437. }));
  98438. } catch (e) {
  98439. var blob = new BlobBuilder();
  98440. blob.append(str);
  98441. return URL.createObjectURL(blob.getBlob());
  98442. }
  98443. };
  98444. var factory = function factory2(code) {
  98445. return function() {
  98446. var objectUrl = createObjectURL(code);
  98447. var worker = browserWorkerPolyFill(new Worker(objectUrl));
  98448. worker.objURL = objectUrl;
  98449. var terminate = worker.terminate;
  98450. worker.on = worker.addEventListener;
  98451. worker.off = worker.removeEventListener;
  98452. worker.terminate = function() {
  98453. URL.revokeObjectURL(objectUrl);
  98454. return terminate.call(this);
  98455. };
  98456. return worker;
  98457. };
  98458. };
  98459. var transform = function transform2(code) {
  98460. return "var browserWorkerPolyFill = " + browserWorkerPolyFill.toString() + ";\nbrowserWorkerPolyFill(self);\n" + code;
  98461. };
  98462. var getWorkerString = function getWorkerString2(fn2) {
  98463. return fn2.toString().replace(/^function.+?{/, "").slice(0, -1);
  98464. };
  98465. var workerCode$1 = transform(getWorkerString(function() {
  98466. var Stream2 = function Stream3() {
  98467. this.init = function() {
  98468. var listeners = {};
  98469. this.on = function(type3, listener) {
  98470. if (!listeners[type3]) {
  98471. listeners[type3] = [];
  98472. }
  98473. listeners[type3] = listeners[type3].concat(listener);
  98474. };
  98475. this.off = function(type3, listener) {
  98476. var index2;
  98477. if (!listeners[type3]) {
  98478. return false;
  98479. }
  98480. index2 = listeners[type3].indexOf(listener);
  98481. listeners[type3] = listeners[type3].slice();
  98482. listeners[type3].splice(index2, 1);
  98483. return index2 > -1;
  98484. };
  98485. this.trigger = function(type3) {
  98486. var callbacks, i2, length, args;
  98487. callbacks = listeners[type3];
  98488. if (!callbacks) {
  98489. return;
  98490. }
  98491. if (arguments.length === 2) {
  98492. length = callbacks.length;
  98493. for (i2 = 0; i2 < length; ++i2) {
  98494. callbacks[i2].call(this, arguments[1]);
  98495. }
  98496. } else {
  98497. args = [];
  98498. i2 = arguments.length;
  98499. for (i2 = 1; i2 < arguments.length; ++i2) {
  98500. args.push(arguments[i2]);
  98501. }
  98502. length = callbacks.length;
  98503. for (i2 = 0; i2 < length; ++i2) {
  98504. callbacks[i2].apply(this, args);
  98505. }
  98506. }
  98507. };
  98508. this.dispose = function() {
  98509. listeners = {};
  98510. };
  98511. };
  98512. };
  98513. Stream2.prototype.pipe = function(destination2) {
  98514. this.on("data", function(data) {
  98515. destination2.push(data);
  98516. });
  98517. this.on("done", function(flushSource) {
  98518. destination2.flush(flushSource);
  98519. });
  98520. this.on("partialdone", function(flushSource) {
  98521. destination2.partialFlush(flushSource);
  98522. });
  98523. this.on("endedtimeline", function(flushSource) {
  98524. destination2.endTimeline(flushSource);
  98525. });
  98526. this.on("reset", function(flushSource) {
  98527. destination2.reset(flushSource);
  98528. });
  98529. return destination2;
  98530. };
  98531. Stream2.prototype.push = function(data) {
  98532. this.trigger("data", data);
  98533. };
  98534. Stream2.prototype.flush = function(flushSource) {
  98535. this.trigger("done", flushSource);
  98536. };
  98537. Stream2.prototype.partialFlush = function(flushSource) {
  98538. this.trigger("partialdone", flushSource);
  98539. };
  98540. Stream2.prototype.endTimeline = function(flushSource) {
  98541. this.trigger("endedtimeline", flushSource);
  98542. };
  98543. Stream2.prototype.reset = function(flushSource) {
  98544. this.trigger("reset", flushSource);
  98545. };
  98546. var stream = Stream2;
  98547. var MAX_UINT32$12 = Math.pow(2, 32);
  98548. var getUint64$22 = function getUint643(uint8) {
  98549. var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength);
  98550. var value;
  98551. if (dv.getBigUint64) {
  98552. value = dv.getBigUint64(0);
  98553. if (value < Number.MAX_SAFE_INTEGER) {
  98554. return Number(value);
  98555. }
  98556. return value;
  98557. }
  98558. return dv.getUint32(0) * MAX_UINT32$12 + dv.getUint32(4);
  98559. };
  98560. var numbers2 = {
  98561. getUint64: getUint64$22,
  98562. MAX_UINT32: MAX_UINT32$12
  98563. };
  98564. var MAX_UINT322 = numbers2.MAX_UINT32;
  98565. var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun$1, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS;
  98566. (function() {
  98567. var i2;
  98568. types = {
  98569. avc1: [],
  98570. avcC: [],
  98571. btrt: [],
  98572. dinf: [],
  98573. dref: [],
  98574. esds: [],
  98575. ftyp: [],
  98576. hdlr: [],
  98577. mdat: [],
  98578. mdhd: [],
  98579. mdia: [],
  98580. mfhd: [],
  98581. minf: [],
  98582. moof: [],
  98583. moov: [],
  98584. mp4a: [],
  98585. mvex: [],
  98586. mvhd: [],
  98587. pasp: [],
  98588. sdtp: [],
  98589. smhd: [],
  98590. stbl: [],
  98591. stco: [],
  98592. stsc: [],
  98593. stsd: [],
  98594. stsz: [],
  98595. stts: [],
  98596. styp: [],
  98597. tfdt: [],
  98598. tfhd: [],
  98599. traf: [],
  98600. trak: [],
  98601. trun: [],
  98602. trex: [],
  98603. tkhd: [],
  98604. vmhd: []
  98605. };
  98606. if (typeof Uint8Array === "undefined") {
  98607. return;
  98608. }
  98609. for (i2 in types) {
  98610. if (types.hasOwnProperty(i2)) {
  98611. types[i2] = [i2.charCodeAt(0), i2.charCodeAt(1), i2.charCodeAt(2), i2.charCodeAt(3)];
  98612. }
  98613. }
  98614. MAJOR_BRAND = new Uint8Array(["i".charCodeAt(0), "s".charCodeAt(0), "o".charCodeAt(0), "m".charCodeAt(0)]);
  98615. AVC1_BRAND = new Uint8Array(["a".charCodeAt(0), "v".charCodeAt(0), "c".charCodeAt(0), "1".charCodeAt(0)]);
  98616. MINOR_VERSION = new Uint8Array([0, 0, 0, 1]);
  98617. VIDEO_HDLR = new Uint8Array([
  98618. 0,
  98619. 0,
  98620. 0,
  98621. 0,
  98622. 0,
  98623. 0,
  98624. 0,
  98625. 0,
  98626. 118,
  98627. 105,
  98628. 100,
  98629. 101,
  98630. 0,
  98631. 0,
  98632. 0,
  98633. 0,
  98634. 0,
  98635. 0,
  98636. 0,
  98637. 0,
  98638. 0,
  98639. 0,
  98640. 0,
  98641. 0,
  98642. 86,
  98643. 105,
  98644. 100,
  98645. 101,
  98646. 111,
  98647. 72,
  98648. 97,
  98649. 110,
  98650. 100,
  98651. 108,
  98652. 101,
  98653. 114,
  98654. 0
  98655. ]);
  98656. AUDIO_HDLR = new Uint8Array([
  98657. 0,
  98658. 0,
  98659. 0,
  98660. 0,
  98661. 0,
  98662. 0,
  98663. 0,
  98664. 0,
  98665. 115,
  98666. 111,
  98667. 117,
  98668. 110,
  98669. 0,
  98670. 0,
  98671. 0,
  98672. 0,
  98673. 0,
  98674. 0,
  98675. 0,
  98676. 0,
  98677. 0,
  98678. 0,
  98679. 0,
  98680. 0,
  98681. 83,
  98682. 111,
  98683. 117,
  98684. 110,
  98685. 100,
  98686. 72,
  98687. 97,
  98688. 110,
  98689. 100,
  98690. 108,
  98691. 101,
  98692. 114,
  98693. 0
  98694. ]);
  98695. HDLR_TYPES = {
  98696. video: VIDEO_HDLR,
  98697. audio: AUDIO_HDLR
  98698. };
  98699. DREF = new Uint8Array([
  98700. 0,
  98701. 0,
  98702. 0,
  98703. 0,
  98704. 0,
  98705. 0,
  98706. 0,
  98707. 1,
  98708. 0,
  98709. 0,
  98710. 0,
  98711. 12,
  98712. 117,
  98713. 114,
  98714. 108,
  98715. 32,
  98716. 0,
  98717. 0,
  98718. 0,
  98719. 1
  98720. ]);
  98721. SMHD = new Uint8Array([
  98722. 0,
  98723. 0,
  98724. 0,
  98725. 0,
  98726. 0,
  98727. 0,
  98728. 0,
  98729. 0
  98730. ]);
  98731. STCO = new Uint8Array([
  98732. 0,
  98733. 0,
  98734. 0,
  98735. 0,
  98736. 0,
  98737. 0,
  98738. 0,
  98739. 0
  98740. ]);
  98741. STSC = STCO;
  98742. STSZ = new Uint8Array([
  98743. 0,
  98744. 0,
  98745. 0,
  98746. 0,
  98747. 0,
  98748. 0,
  98749. 0,
  98750. 0,
  98751. 0,
  98752. 0,
  98753. 0,
  98754. 0
  98755. ]);
  98756. STTS = STCO;
  98757. VMHD = new Uint8Array([
  98758. 0,
  98759. 0,
  98760. 0,
  98761. 1,
  98762. 0,
  98763. 0,
  98764. 0,
  98765. 0,
  98766. 0,
  98767. 0,
  98768. 0,
  98769. 0
  98770. ]);
  98771. })();
  98772. box = function box2(type3) {
  98773. var payload = [], size = 0, i2, result, view;
  98774. for (i2 = 1; i2 < arguments.length; i2++) {
  98775. payload.push(arguments[i2]);
  98776. }
  98777. i2 = payload.length;
  98778. while (i2--) {
  98779. size += payload[i2].byteLength;
  98780. }
  98781. result = new Uint8Array(size + 8);
  98782. view = new DataView(result.buffer, result.byteOffset, result.byteLength);
  98783. view.setUint32(0, result.byteLength);
  98784. result.set(type3, 4);
  98785. for (i2 = 0, size = 8; i2 < payload.length; i2++) {
  98786. result.set(payload[i2], size);
  98787. size += payload[i2].byteLength;
  98788. }
  98789. return result;
  98790. };
  98791. dinf = function dinf2() {
  98792. return box(types.dinf, box(types.dref, DREF));
  98793. };
  98794. esds = function esds2(track) {
  98795. return box(types.esds, new Uint8Array([
  98796. 0,
  98797. 0,
  98798. 0,
  98799. 0,
  98800. 3,
  98801. 25,
  98802. 0,
  98803. 0,
  98804. 0,
  98805. 4,
  98806. 17,
  98807. 64,
  98808. 21,
  98809. 0,
  98810. 6,
  98811. 0,
  98812. 0,
  98813. 0,
  98814. 218,
  98815. 192,
  98816. 0,
  98817. 0,
  98818. 218,
  98819. 192,
  98820. 5,
  98821. 2,
  98822. track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1,
  98823. track.samplingfrequencyindex << 7 | track.channelcount << 3,
  98824. 6,
  98825. 1,
  98826. 2
  98827. ]));
  98828. };
  98829. ftyp = function ftyp2() {
  98830. return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND);
  98831. };
  98832. hdlr = function hdlr2(type3) {
  98833. return box(types.hdlr, HDLR_TYPES[type3]);
  98834. };
  98835. mdat = function mdat2(data) {
  98836. return box(types.mdat, data);
  98837. };
  98838. mdhd = function mdhd2(track) {
  98839. var result = new Uint8Array([
  98840. 0,
  98841. 0,
  98842. 0,
  98843. 0,
  98844. 0,
  98845. 0,
  98846. 0,
  98847. 2,
  98848. 0,
  98849. 0,
  98850. 0,
  98851. 3,
  98852. 0,
  98853. 1,
  98854. 95,
  98855. 144,
  98856. track.duration >>> 24 & 255,
  98857. track.duration >>> 16 & 255,
  98858. track.duration >>> 8 & 255,
  98859. track.duration & 255,
  98860. 85,
  98861. 196,
  98862. 0,
  98863. 0
  98864. ]);
  98865. if (track.samplerate) {
  98866. result[12] = track.samplerate >>> 24 & 255;
  98867. result[13] = track.samplerate >>> 16 & 255;
  98868. result[14] = track.samplerate >>> 8 & 255;
  98869. result[15] = track.samplerate & 255;
  98870. }
  98871. return box(types.mdhd, result);
  98872. };
  98873. mdia = function mdia2(track) {
  98874. return box(types.mdia, mdhd(track), hdlr(track.type), minf(track));
  98875. };
  98876. mfhd = function mfhd2(sequenceNumber) {
  98877. return box(types.mfhd, new Uint8Array([
  98878. 0,
  98879. 0,
  98880. 0,
  98881. 0,
  98882. (sequenceNumber & 4278190080) >> 24,
  98883. (sequenceNumber & 16711680) >> 16,
  98884. (sequenceNumber & 65280) >> 8,
  98885. sequenceNumber & 255
  98886. ]));
  98887. };
  98888. minf = function minf2(track) {
  98889. return box(types.minf, track.type === "video" ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track));
  98890. };
  98891. moof = function moof2(sequenceNumber, tracks) {
  98892. var trackFragments = [], i2 = tracks.length;
  98893. while (i2--) {
  98894. trackFragments[i2] = traf(tracks[i2]);
  98895. }
  98896. return box.apply(null, [types.moof, mfhd(sequenceNumber)].concat(trackFragments));
  98897. };
  98898. moov = function moov2(tracks) {
  98899. var i2 = tracks.length, boxes = [];
  98900. while (i2--) {
  98901. boxes[i2] = trak(tracks[i2]);
  98902. }
  98903. return box.apply(null, [types.moov, mvhd(4294967295)].concat(boxes).concat(mvex(tracks)));
  98904. };
  98905. mvex = function mvex2(tracks) {
  98906. var i2 = tracks.length, boxes = [];
  98907. while (i2--) {
  98908. boxes[i2] = trex(tracks[i2]);
  98909. }
  98910. return box.apply(null, [types.mvex].concat(boxes));
  98911. };
  98912. mvhd = function mvhd2(duration5) {
  98913. var bytes = new Uint8Array([
  98914. 0,
  98915. 0,
  98916. 0,
  98917. 0,
  98918. 0,
  98919. 0,
  98920. 0,
  98921. 1,
  98922. 0,
  98923. 0,
  98924. 0,
  98925. 2,
  98926. 0,
  98927. 1,
  98928. 95,
  98929. 144,
  98930. (duration5 & 4278190080) >> 24,
  98931. (duration5 & 16711680) >> 16,
  98932. (duration5 & 65280) >> 8,
  98933. duration5 & 255,
  98934. 0,
  98935. 1,
  98936. 0,
  98937. 0,
  98938. 1,
  98939. 0,
  98940. 0,
  98941. 0,
  98942. 0,
  98943. 0,
  98944. 0,
  98945. 0,
  98946. 0,
  98947. 0,
  98948. 0,
  98949. 0,
  98950. 0,
  98951. 1,
  98952. 0,
  98953. 0,
  98954. 0,
  98955. 0,
  98956. 0,
  98957. 0,
  98958. 0,
  98959. 0,
  98960. 0,
  98961. 0,
  98962. 0,
  98963. 0,
  98964. 0,
  98965. 0,
  98966. 0,
  98967. 1,
  98968. 0,
  98969. 0,
  98970. 0,
  98971. 0,
  98972. 0,
  98973. 0,
  98974. 0,
  98975. 0,
  98976. 0,
  98977. 0,
  98978. 0,
  98979. 0,
  98980. 0,
  98981. 0,
  98982. 64,
  98983. 0,
  98984. 0,
  98985. 0,
  98986. 0,
  98987. 0,
  98988. 0,
  98989. 0,
  98990. 0,
  98991. 0,
  98992. 0,
  98993. 0,
  98994. 0,
  98995. 0,
  98996. 0,
  98997. 0,
  98998. 0,
  98999. 0,
  99000. 0,
  99001. 0,
  99002. 0,
  99003. 0,
  99004. 0,
  99005. 0,
  99006. 0,
  99007. 0,
  99008. 0,
  99009. 0,
  99010. 255,
  99011. 255,
  99012. 255,
  99013. 255
  99014. ]);
  99015. return box(types.mvhd, bytes);
  99016. };
  99017. sdtp = function sdtp2(track) {
  99018. var samples = track.samples || [], bytes = new Uint8Array(4 + samples.length), flags, i2;
  99019. for (i2 = 0; i2 < samples.length; i2++) {
  99020. flags = samples[i2].flags;
  99021. bytes[i2 + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy;
  99022. }
  99023. return box(types.sdtp, bytes);
  99024. };
  99025. stbl = function stbl2(track) {
  99026. return box(types.stbl, stsd(track), box(types.stts, STTS), box(types.stsc, STSC), box(types.stsz, STSZ), box(types.stco, STCO));
  99027. };
  99028. (function() {
  99029. var videoSample, audioSample;
  99030. stsd = function stsd2(track) {
  99031. return box(types.stsd, new Uint8Array([
  99032. 0,
  99033. 0,
  99034. 0,
  99035. 0,
  99036. 0,
  99037. 0,
  99038. 0,
  99039. 1
  99040. ]), track.type === "video" ? videoSample(track) : audioSample(track));
  99041. };
  99042. videoSample = function videoSample2(track) {
  99043. var sps = track.sps || [], pps = track.pps || [], sequenceParameterSets = [], pictureParameterSets = [], i2, avc1Box;
  99044. for (i2 = 0; i2 < sps.length; i2++) {
  99045. sequenceParameterSets.push((sps[i2].byteLength & 65280) >>> 8);
  99046. sequenceParameterSets.push(sps[i2].byteLength & 255);
  99047. sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i2]));
  99048. }
  99049. for (i2 = 0; i2 < pps.length; i2++) {
  99050. pictureParameterSets.push((pps[i2].byteLength & 65280) >>> 8);
  99051. pictureParameterSets.push(pps[i2].byteLength & 255);
  99052. pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i2]));
  99053. }
  99054. avc1Box = [types.avc1, new Uint8Array([
  99055. 0,
  99056. 0,
  99057. 0,
  99058. 0,
  99059. 0,
  99060. 0,
  99061. 0,
  99062. 1,
  99063. 0,
  99064. 0,
  99065. 0,
  99066. 0,
  99067. 0,
  99068. 0,
  99069. 0,
  99070. 0,
  99071. 0,
  99072. 0,
  99073. 0,
  99074. 0,
  99075. 0,
  99076. 0,
  99077. 0,
  99078. 0,
  99079. (track.width & 65280) >> 8,
  99080. track.width & 255,
  99081. (track.height & 65280) >> 8,
  99082. track.height & 255,
  99083. 0,
  99084. 72,
  99085. 0,
  99086. 0,
  99087. 0,
  99088. 72,
  99089. 0,
  99090. 0,
  99091. 0,
  99092. 0,
  99093. 0,
  99094. 0,
  99095. 0,
  99096. 1,
  99097. 19,
  99098. 118,
  99099. 105,
  99100. 100,
  99101. 101,
  99102. 111,
  99103. 106,
  99104. 115,
  99105. 45,
  99106. 99,
  99107. 111,
  99108. 110,
  99109. 116,
  99110. 114,
  99111. 105,
  99112. 98,
  99113. 45,
  99114. 104,
  99115. 108,
  99116. 115,
  99117. 0,
  99118. 0,
  99119. 0,
  99120. 0,
  99121. 0,
  99122. 0,
  99123. 0,
  99124. 0,
  99125. 0,
  99126. 0,
  99127. 0,
  99128. 0,
  99129. 0,
  99130. 24,
  99131. 17,
  99132. 17
  99133. ]), box(types.avcC, new Uint8Array([
  99134. 1,
  99135. track.profileIdc,
  99136. track.profileCompatibility,
  99137. track.levelIdc,
  99138. 255
  99139. ].concat(
  99140. [sps.length],
  99141. sequenceParameterSets,
  99142. [pps.length],
  99143. pictureParameterSets
  99144. ))), box(types.btrt, new Uint8Array([
  99145. 0,
  99146. 28,
  99147. 156,
  99148. 128,
  99149. 0,
  99150. 45,
  99151. 198,
  99152. 192,
  99153. 0,
  99154. 45,
  99155. 198,
  99156. 192
  99157. ]))];
  99158. if (track.sarRatio) {
  99159. var hSpacing = track.sarRatio[0], vSpacing = track.sarRatio[1];
  99160. avc1Box.push(box(types.pasp, new Uint8Array([(hSpacing & 4278190080) >> 24, (hSpacing & 16711680) >> 16, (hSpacing & 65280) >> 8, hSpacing & 255, (vSpacing & 4278190080) >> 24, (vSpacing & 16711680) >> 16, (vSpacing & 65280) >> 8, vSpacing & 255])));
  99161. }
  99162. return box.apply(null, avc1Box);
  99163. };
  99164. audioSample = function audioSample2(track) {
  99165. return box(types.mp4a, new Uint8Array([
  99166. 0,
  99167. 0,
  99168. 0,
  99169. 0,
  99170. 0,
  99171. 0,
  99172. 0,
  99173. 1,
  99174. 0,
  99175. 0,
  99176. 0,
  99177. 0,
  99178. 0,
  99179. 0,
  99180. 0,
  99181. 0,
  99182. (track.channelcount & 65280) >> 8,
  99183. track.channelcount & 255,
  99184. (track.samplesize & 65280) >> 8,
  99185. track.samplesize & 255,
  99186. 0,
  99187. 0,
  99188. 0,
  99189. 0,
  99190. (track.samplerate & 65280) >> 8,
  99191. track.samplerate & 255,
  99192. 0,
  99193. 0
  99194. ]), esds(track));
  99195. };
  99196. })();
  99197. tkhd = function tkhd2(track) {
  99198. var result = new Uint8Array([
  99199. 0,
  99200. 0,
  99201. 0,
  99202. 7,
  99203. 0,
  99204. 0,
  99205. 0,
  99206. 0,
  99207. 0,
  99208. 0,
  99209. 0,
  99210. 0,
  99211. (track.id & 4278190080) >> 24,
  99212. (track.id & 16711680) >> 16,
  99213. (track.id & 65280) >> 8,
  99214. track.id & 255,
  99215. 0,
  99216. 0,
  99217. 0,
  99218. 0,
  99219. (track.duration & 4278190080) >> 24,
  99220. (track.duration & 16711680) >> 16,
  99221. (track.duration & 65280) >> 8,
  99222. track.duration & 255,
  99223. 0,
  99224. 0,
  99225. 0,
  99226. 0,
  99227. 0,
  99228. 0,
  99229. 0,
  99230. 0,
  99231. 0,
  99232. 0,
  99233. 0,
  99234. 0,
  99235. 1,
  99236. 0,
  99237. 0,
  99238. 0,
  99239. 0,
  99240. 1,
  99241. 0,
  99242. 0,
  99243. 0,
  99244. 0,
  99245. 0,
  99246. 0,
  99247. 0,
  99248. 0,
  99249. 0,
  99250. 0,
  99251. 0,
  99252. 0,
  99253. 0,
  99254. 0,
  99255. 0,
  99256. 1,
  99257. 0,
  99258. 0,
  99259. 0,
  99260. 0,
  99261. 0,
  99262. 0,
  99263. 0,
  99264. 0,
  99265. 0,
  99266. 0,
  99267. 0,
  99268. 0,
  99269. 0,
  99270. 0,
  99271. 64,
  99272. 0,
  99273. 0,
  99274. 0,
  99275. (track.width & 65280) >> 8,
  99276. track.width & 255,
  99277. 0,
  99278. 0,
  99279. (track.height & 65280) >> 8,
  99280. track.height & 255,
  99281. 0,
  99282. 0
  99283. ]);
  99284. return box(types.tkhd, result);
  99285. };
  99286. traf = function traf2(track) {
  99287. var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable, dataOffset, upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime;
  99288. trackFragmentHeader = box(types.tfhd, new Uint8Array([
  99289. 0,
  99290. 0,
  99291. 0,
  99292. 58,
  99293. (track.id & 4278190080) >> 24,
  99294. (track.id & 16711680) >> 16,
  99295. (track.id & 65280) >> 8,
  99296. track.id & 255,
  99297. 0,
  99298. 0,
  99299. 0,
  99300. 1,
  99301. 0,
  99302. 0,
  99303. 0,
  99304. 0,
  99305. 0,
  99306. 0,
  99307. 0,
  99308. 0,
  99309. 0,
  99310. 0,
  99311. 0,
  99312. 0
  99313. ]));
  99314. upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / MAX_UINT322);
  99315. lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % MAX_UINT322);
  99316. trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([
  99317. 1,
  99318. 0,
  99319. 0,
  99320. 0,
  99321. upperWordBaseMediaDecodeTime >>> 24 & 255,
  99322. upperWordBaseMediaDecodeTime >>> 16 & 255,
  99323. upperWordBaseMediaDecodeTime >>> 8 & 255,
  99324. upperWordBaseMediaDecodeTime & 255,
  99325. lowerWordBaseMediaDecodeTime >>> 24 & 255,
  99326. lowerWordBaseMediaDecodeTime >>> 16 & 255,
  99327. lowerWordBaseMediaDecodeTime >>> 8 & 255,
  99328. lowerWordBaseMediaDecodeTime & 255
  99329. ]));
  99330. dataOffset = 32 + 20 + 8 + 16 + 8 + 8;
  99331. if (track.type === "audio") {
  99332. trackFragmentRun = trun$1(track, dataOffset);
  99333. return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun);
  99334. }
  99335. sampleDependencyTable = sdtp(track);
  99336. trackFragmentRun = trun$1(track, sampleDependencyTable.length + dataOffset);
  99337. return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable);
  99338. };
  99339. trak = function trak2(track) {
  99340. track.duration = track.duration || 4294967295;
  99341. return box(types.trak, tkhd(track), mdia(track));
  99342. };
  99343. trex = function trex2(track) {
  99344. var result = new Uint8Array([
  99345. 0,
  99346. 0,
  99347. 0,
  99348. 0,
  99349. (track.id & 4278190080) >> 24,
  99350. (track.id & 16711680) >> 16,
  99351. (track.id & 65280) >> 8,
  99352. track.id & 255,
  99353. 0,
  99354. 0,
  99355. 0,
  99356. 1,
  99357. 0,
  99358. 0,
  99359. 0,
  99360. 0,
  99361. 0,
  99362. 0,
  99363. 0,
  99364. 0,
  99365. 0,
  99366. 1,
  99367. 0,
  99368. 1
  99369. ]);
  99370. if (track.type !== "video") {
  99371. result[result.length - 1] = 0;
  99372. }
  99373. return box(types.trex, result);
  99374. };
  99375. (function() {
  99376. var audioTrun, videoTrun, trunHeader;
  99377. trunHeader = function trunHeader2(samples, offset) {
  99378. var durationPresent = 0, sizePresent = 0, flagsPresent = 0, compositionTimeOffset = 0;
  99379. if (samples.length) {
  99380. if (samples[0].duration !== void 0) {
  99381. durationPresent = 1;
  99382. }
  99383. if (samples[0].size !== void 0) {
  99384. sizePresent = 2;
  99385. }
  99386. if (samples[0].flags !== void 0) {
  99387. flagsPresent = 4;
  99388. }
  99389. if (samples[0].compositionTimeOffset !== void 0) {
  99390. compositionTimeOffset = 8;
  99391. }
  99392. }
  99393. return [
  99394. 0,
  99395. 0,
  99396. durationPresent | sizePresent | flagsPresent | compositionTimeOffset,
  99397. 1,
  99398. (samples.length & 4278190080) >>> 24,
  99399. (samples.length & 16711680) >>> 16,
  99400. (samples.length & 65280) >>> 8,
  99401. samples.length & 255,
  99402. (offset & 4278190080) >>> 24,
  99403. (offset & 16711680) >>> 16,
  99404. (offset & 65280) >>> 8,
  99405. offset & 255
  99406. ];
  99407. };
  99408. videoTrun = function videoTrun2(track, offset) {
  99409. var bytesOffest, bytes, header, samples, sample, i2;
  99410. samples = track.samples || [];
  99411. offset += 8 + 12 + 16 * samples.length;
  99412. header = trunHeader(samples, offset);
  99413. bytes = new Uint8Array(header.length + samples.length * 16);
  99414. bytes.set(header);
  99415. bytesOffest = header.length;
  99416. for (i2 = 0; i2 < samples.length; i2++) {
  99417. sample = samples[i2];
  99418. bytes[bytesOffest++] = (sample.duration & 4278190080) >>> 24;
  99419. bytes[bytesOffest++] = (sample.duration & 16711680) >>> 16;
  99420. bytes[bytesOffest++] = (sample.duration & 65280) >>> 8;
  99421. bytes[bytesOffest++] = sample.duration & 255;
  99422. bytes[bytesOffest++] = (sample.size & 4278190080) >>> 24;
  99423. bytes[bytesOffest++] = (sample.size & 16711680) >>> 16;
  99424. bytes[bytesOffest++] = (sample.size & 65280) >>> 8;
  99425. bytes[bytesOffest++] = sample.size & 255;
  99426. bytes[bytesOffest++] = sample.flags.isLeading << 2 | sample.flags.dependsOn;
  99427. bytes[bytesOffest++] = sample.flags.isDependedOn << 6 | sample.flags.hasRedundancy << 4 | sample.flags.paddingValue << 1 | sample.flags.isNonSyncSample;
  99428. bytes[bytesOffest++] = sample.flags.degradationPriority & 240 << 8;
  99429. bytes[bytesOffest++] = sample.flags.degradationPriority & 15;
  99430. bytes[bytesOffest++] = (sample.compositionTimeOffset & 4278190080) >>> 24;
  99431. bytes[bytesOffest++] = (sample.compositionTimeOffset & 16711680) >>> 16;
  99432. bytes[bytesOffest++] = (sample.compositionTimeOffset & 65280) >>> 8;
  99433. bytes[bytesOffest++] = sample.compositionTimeOffset & 255;
  99434. }
  99435. return box(types.trun, bytes);
  99436. };
  99437. audioTrun = function audioTrun2(track, offset) {
  99438. var bytes, bytesOffest, header, samples, sample, i2;
  99439. samples = track.samples || [];
  99440. offset += 8 + 12 + 8 * samples.length;
  99441. header = trunHeader(samples, offset);
  99442. bytes = new Uint8Array(header.length + samples.length * 8);
  99443. bytes.set(header);
  99444. bytesOffest = header.length;
  99445. for (i2 = 0; i2 < samples.length; i2++) {
  99446. sample = samples[i2];
  99447. bytes[bytesOffest++] = (sample.duration & 4278190080) >>> 24;
  99448. bytes[bytesOffest++] = (sample.duration & 16711680) >>> 16;
  99449. bytes[bytesOffest++] = (sample.duration & 65280) >>> 8;
  99450. bytes[bytesOffest++] = sample.duration & 255;
  99451. bytes[bytesOffest++] = (sample.size & 4278190080) >>> 24;
  99452. bytes[bytesOffest++] = (sample.size & 16711680) >>> 16;
  99453. bytes[bytesOffest++] = (sample.size & 65280) >>> 8;
  99454. bytes[bytesOffest++] = sample.size & 255;
  99455. }
  99456. return box(types.trun, bytes);
  99457. };
  99458. trun$1 = function trun2(track, offset) {
  99459. if (track.type === "audio") {
  99460. return audioTrun(track, offset);
  99461. }
  99462. return videoTrun(track, offset);
  99463. };
  99464. })();
  99465. var mp4Generator = {
  99466. ftyp,
  99467. mdat,
  99468. moof,
  99469. moov,
  99470. initSegment: function initSegment(tracks) {
  99471. var fileType = ftyp(), movie = moov(tracks), result;
  99472. result = new Uint8Array(fileType.byteLength + movie.byteLength);
  99473. result.set(fileType);
  99474. result.set(movie, fileType.byteLength);
  99475. return result;
  99476. }
  99477. };
  99478. var groupNalsIntoFrames = function groupNalsIntoFrames2(nalUnits) {
  99479. var i2, currentNal, currentFrame = [], frames = [];
  99480. frames.byteLength = 0;
  99481. frames.nalCount = 0;
  99482. frames.duration = 0;
  99483. currentFrame.byteLength = 0;
  99484. for (i2 = 0; i2 < nalUnits.length; i2++) {
  99485. currentNal = nalUnits[i2];
  99486. if (currentNal.nalUnitType === "access_unit_delimiter_rbsp") {
  99487. if (currentFrame.length) {
  99488. currentFrame.duration = currentNal.dts - currentFrame.dts;
  99489. frames.byteLength += currentFrame.byteLength;
  99490. frames.nalCount += currentFrame.length;
  99491. frames.duration += currentFrame.duration;
  99492. frames.push(currentFrame);
  99493. }
  99494. currentFrame = [currentNal];
  99495. currentFrame.byteLength = currentNal.data.byteLength;
  99496. currentFrame.pts = currentNal.pts;
  99497. currentFrame.dts = currentNal.dts;
  99498. } else {
  99499. if (currentNal.nalUnitType === "slice_layer_without_partitioning_rbsp_idr") {
  99500. currentFrame.keyFrame = true;
  99501. }
  99502. currentFrame.duration = currentNal.dts - currentFrame.dts;
  99503. currentFrame.byteLength += currentNal.data.byteLength;
  99504. currentFrame.push(currentNal);
  99505. }
  99506. }
  99507. if (frames.length && (!currentFrame.duration || currentFrame.duration <= 0)) {
  99508. currentFrame.duration = frames[frames.length - 1].duration;
  99509. }
  99510. frames.byteLength += currentFrame.byteLength;
  99511. frames.nalCount += currentFrame.length;
  99512. frames.duration += currentFrame.duration;
  99513. frames.push(currentFrame);
  99514. return frames;
  99515. };
  99516. var groupFramesIntoGops = function groupFramesIntoGops2(frames) {
  99517. var i2, currentFrame, currentGop = [], gops = [];
  99518. currentGop.byteLength = 0;
  99519. currentGop.nalCount = 0;
  99520. currentGop.duration = 0;
  99521. currentGop.pts = frames[0].pts;
  99522. currentGop.dts = frames[0].dts;
  99523. gops.byteLength = 0;
  99524. gops.nalCount = 0;
  99525. gops.duration = 0;
  99526. gops.pts = frames[0].pts;
  99527. gops.dts = frames[0].dts;
  99528. for (i2 = 0; i2 < frames.length; i2++) {
  99529. currentFrame = frames[i2];
  99530. if (currentFrame.keyFrame) {
  99531. if (currentGop.length) {
  99532. gops.push(currentGop);
  99533. gops.byteLength += currentGop.byteLength;
  99534. gops.nalCount += currentGop.nalCount;
  99535. gops.duration += currentGop.duration;
  99536. }
  99537. currentGop = [currentFrame];
  99538. currentGop.nalCount = currentFrame.length;
  99539. currentGop.byteLength = currentFrame.byteLength;
  99540. currentGop.pts = currentFrame.pts;
  99541. currentGop.dts = currentFrame.dts;
  99542. currentGop.duration = currentFrame.duration;
  99543. } else {
  99544. currentGop.duration += currentFrame.duration;
  99545. currentGop.nalCount += currentFrame.length;
  99546. currentGop.byteLength += currentFrame.byteLength;
  99547. currentGop.push(currentFrame);
  99548. }
  99549. }
  99550. if (gops.length && currentGop.duration <= 0) {
  99551. currentGop.duration = gops[gops.length - 1].duration;
  99552. }
  99553. gops.byteLength += currentGop.byteLength;
  99554. gops.nalCount += currentGop.nalCount;
  99555. gops.duration += currentGop.duration;
  99556. gops.push(currentGop);
  99557. return gops;
  99558. };
  99559. var extendFirstKeyFrame = function extendFirstKeyFrame2(gops) {
  99560. var currentGop;
  99561. if (!gops[0][0].keyFrame && gops.length > 1) {
  99562. currentGop = gops.shift();
  99563. gops.byteLength -= currentGop.byteLength;
  99564. gops.nalCount -= currentGop.nalCount;
  99565. gops[0][0].dts = currentGop.dts;
  99566. gops[0][0].pts = currentGop.pts;
  99567. gops[0][0].duration += currentGop.duration;
  99568. }
  99569. return gops;
  99570. };
  99571. var createDefaultSample = function createDefaultSample2() {
  99572. return {
  99573. size: 0,
  99574. flags: {
  99575. isLeading: 0,
  99576. dependsOn: 1,
  99577. isDependedOn: 0,
  99578. hasRedundancy: 0,
  99579. degradationPriority: 0,
  99580. isNonSyncSample: 1
  99581. }
  99582. };
  99583. };
  99584. var sampleForFrame = function sampleForFrame2(frame, dataOffset) {
  99585. var sample = createDefaultSample();
  99586. sample.dataOffset = dataOffset;
  99587. sample.compositionTimeOffset = frame.pts - frame.dts;
  99588. sample.duration = frame.duration;
  99589. sample.size = 4 * frame.length;
  99590. sample.size += frame.byteLength;
  99591. if (frame.keyFrame) {
  99592. sample.flags.dependsOn = 2;
  99593. sample.flags.isNonSyncSample = 0;
  99594. }
  99595. return sample;
  99596. };
  99597. var generateSampleTable$1 = function generateSampleTable2(gops, baseDataOffset) {
  99598. var h2, i2, sample, currentGop, currentFrame, dataOffset = baseDataOffset || 0, samples = [];
  99599. for (h2 = 0; h2 < gops.length; h2++) {
  99600. currentGop = gops[h2];
  99601. for (i2 = 0; i2 < currentGop.length; i2++) {
  99602. currentFrame = currentGop[i2];
  99603. sample = sampleForFrame(currentFrame, dataOffset);
  99604. dataOffset += sample.size;
  99605. samples.push(sample);
  99606. }
  99607. }
  99608. return samples;
  99609. };
  99610. var concatenateNalData = function concatenateNalData2(gops) {
  99611. var h2, i2, j, currentGop, currentFrame, currentNal, dataOffset = 0, nalsByteLength = gops.byteLength, numberOfNals = gops.nalCount, totalByteLength = nalsByteLength + 4 * numberOfNals, data = new Uint8Array(totalByteLength), view = new DataView(data.buffer);
  99612. for (h2 = 0; h2 < gops.length; h2++) {
  99613. currentGop = gops[h2];
  99614. for (i2 = 0; i2 < currentGop.length; i2++) {
  99615. currentFrame = currentGop[i2];
  99616. for (j = 0; j < currentFrame.length; j++) {
  99617. currentNal = currentFrame[j];
  99618. view.setUint32(dataOffset, currentNal.data.byteLength);
  99619. dataOffset += 4;
  99620. data.set(currentNal.data, dataOffset);
  99621. dataOffset += currentNal.data.byteLength;
  99622. }
  99623. }
  99624. }
  99625. return data;
  99626. };
  99627. var generateSampleTableForFrame = function generateSampleTableForFrame2(frame, baseDataOffset) {
  99628. var sample, dataOffset = baseDataOffset || 0, samples = [];
  99629. sample = sampleForFrame(frame, dataOffset);
  99630. samples.push(sample);
  99631. return samples;
  99632. };
  99633. var concatenateNalDataForFrame = function concatenateNalDataForFrame2(frame) {
  99634. var i2, currentNal, dataOffset = 0, nalsByteLength = frame.byteLength, numberOfNals = frame.length, totalByteLength = nalsByteLength + 4 * numberOfNals, data = new Uint8Array(totalByteLength), view = new DataView(data.buffer);
  99635. for (i2 = 0; i2 < frame.length; i2++) {
  99636. currentNal = frame[i2];
  99637. view.setUint32(dataOffset, currentNal.data.byteLength);
  99638. dataOffset += 4;
  99639. data.set(currentNal.data, dataOffset);
  99640. dataOffset += currentNal.data.byteLength;
  99641. }
  99642. return data;
  99643. };
  99644. var frameUtils = {
  99645. groupNalsIntoFrames,
  99646. groupFramesIntoGops,
  99647. extendFirstKeyFrame,
  99648. generateSampleTable: generateSampleTable$1,
  99649. concatenateNalData,
  99650. generateSampleTableForFrame,
  99651. concatenateNalDataForFrame
  99652. };
  99653. var highPrefix = [33, 16, 5, 32, 164, 27];
  99654. var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252];
  99655. var zeroFill = function zeroFill2(count) {
  99656. var a = [];
  99657. while (count--) {
  99658. a.push(0);
  99659. }
  99660. return a;
  99661. };
  99662. var makeTable = function makeTable2(metaTable) {
  99663. return Object.keys(metaTable).reduce(function(obj, key) {
  99664. obj[key] = new Uint8Array(metaTable[key].reduce(function(arr, part) {
  99665. return arr.concat(part);
  99666. }, []));
  99667. return obj;
  99668. }, {});
  99669. };
  99670. var silence;
  99671. var silence_1 = function silence_12() {
  99672. if (!silence) {
  99673. var coneOfSilence = {
  99674. 96e3: [highPrefix, [227, 64], zeroFill(154), [56]],
  99675. 88200: [highPrefix, [231], zeroFill(170), [56]],
  99676. 64e3: [highPrefix, [248, 192], zeroFill(240), [56]],
  99677. 48e3: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]],
  99678. 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]],
  99679. 32e3: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]],
  99680. 24e3: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]],
  99681. 16e3: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]],
  99682. 12e3: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 253, 128], zeroFill(259), [56]],
  99683. 11025: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 255, 192], zeroFill(268), [55, 175, 128], zeroFill(108), [112]],
  99684. 8e3: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]]
  99685. };
  99686. silence = makeTable(coneOfSilence);
  99687. }
  99688. return silence;
  99689. };
  99690. var ONE_SECOND_IN_TS$4 = 9e4, secondsToVideoTs2, secondsToAudioTs2, videoTsToSeconds2, audioTsToSeconds2, audioTsToVideoTs2, videoTsToAudioTs2, metadataTsToSeconds2;
  99691. secondsToVideoTs2 = function secondsToVideoTs3(seconds) {
  99692. return seconds * ONE_SECOND_IN_TS$4;
  99693. };
  99694. secondsToAudioTs2 = function secondsToAudioTs3(seconds, sampleRate) {
  99695. return seconds * sampleRate;
  99696. };
  99697. videoTsToSeconds2 = function videoTsToSeconds3(timestamp) {
  99698. return timestamp / ONE_SECOND_IN_TS$4;
  99699. };
  99700. audioTsToSeconds2 = function audioTsToSeconds3(timestamp, sampleRate) {
  99701. return timestamp / sampleRate;
  99702. };
  99703. audioTsToVideoTs2 = function audioTsToVideoTs3(timestamp, sampleRate) {
  99704. return secondsToVideoTs2(audioTsToSeconds2(timestamp, sampleRate));
  99705. };
  99706. videoTsToAudioTs2 = function videoTsToAudioTs3(timestamp, sampleRate) {
  99707. return secondsToAudioTs2(videoTsToSeconds2(timestamp), sampleRate);
  99708. };
  99709. metadataTsToSeconds2 = function metadataTsToSeconds3(timestamp, timelineStartPts, keepOriginalTimestamps) {
  99710. return videoTsToSeconds2(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts);
  99711. };
  99712. var clock2 = {
  99713. ONE_SECOND_IN_TS: ONE_SECOND_IN_TS$4,
  99714. secondsToVideoTs: secondsToVideoTs2,
  99715. secondsToAudioTs: secondsToAudioTs2,
  99716. videoTsToSeconds: videoTsToSeconds2,
  99717. audioTsToSeconds: audioTsToSeconds2,
  99718. audioTsToVideoTs: audioTsToVideoTs2,
  99719. videoTsToAudioTs: videoTsToAudioTs2,
  99720. metadataTsToSeconds: metadataTsToSeconds2
  99721. };
  99722. var sumFrameByteLengths = function sumFrameByteLengths2(array) {
  99723. var i2, currentObj, sum = 0;
  99724. for (i2 = 0; i2 < array.length; i2++) {
  99725. currentObj = array[i2];
  99726. sum += currentObj.data.byteLength;
  99727. }
  99728. return sum;
  99729. };
  99730. var prefixWithSilence = function prefixWithSilence2(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) {
  99731. var baseMediaDecodeTimeTs, frameDuration = 0, audioGapDuration = 0, audioFillFrameCount = 0, audioFillDuration = 0, silentFrame, i2, firstFrame;
  99732. if (!frames.length) {
  99733. return;
  99734. }
  99735. baseMediaDecodeTimeTs = clock2.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate);
  99736. frameDuration = Math.ceil(clock2.ONE_SECOND_IN_TS / (track.samplerate / 1024));
  99737. if (audioAppendStartTs && videoBaseMediaDecodeTime) {
  99738. audioGapDuration = baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime);
  99739. audioFillFrameCount = Math.floor(audioGapDuration / frameDuration);
  99740. audioFillDuration = audioFillFrameCount * frameDuration;
  99741. }
  99742. if (audioFillFrameCount < 1 || audioFillDuration > clock2.ONE_SECOND_IN_TS / 2) {
  99743. return;
  99744. }
  99745. silentFrame = silence_1()[track.samplerate];
  99746. if (!silentFrame) {
  99747. silentFrame = frames[0].data;
  99748. }
  99749. for (i2 = 0; i2 < audioFillFrameCount; i2++) {
  99750. firstFrame = frames[0];
  99751. frames.splice(0, 0, {
  99752. data: silentFrame,
  99753. dts: firstFrame.dts - frameDuration,
  99754. pts: firstFrame.pts - frameDuration
  99755. });
  99756. }
  99757. track.baseMediaDecodeTime -= Math.floor(clock2.videoTsToAudioTs(audioFillDuration, track.samplerate));
  99758. return audioFillDuration;
  99759. };
  99760. var trimAdtsFramesByEarliestDts = function trimAdtsFramesByEarliestDts2(adtsFrames, track, earliestAllowedDts) {
  99761. if (track.minSegmentDts >= earliestAllowedDts) {
  99762. return adtsFrames;
  99763. }
  99764. track.minSegmentDts = Infinity;
  99765. return adtsFrames.filter(function(currentFrame) {
  99766. if (currentFrame.dts >= earliestAllowedDts) {
  99767. track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts);
  99768. track.minSegmentPts = track.minSegmentDts;
  99769. return true;
  99770. }
  99771. return false;
  99772. });
  99773. };
  99774. var generateSampleTable = function generateSampleTable2(frames) {
  99775. var i2, currentFrame, samples = [];
  99776. for (i2 = 0; i2 < frames.length; i2++) {
  99777. currentFrame = frames[i2];
  99778. samples.push({
  99779. size: currentFrame.data.byteLength,
  99780. duration: 1024
  99781. });
  99782. }
  99783. return samples;
  99784. };
  99785. var concatenateFrameData = function concatenateFrameData2(frames) {
  99786. var i2, currentFrame, dataOffset = 0, data = new Uint8Array(sumFrameByteLengths(frames));
  99787. for (i2 = 0; i2 < frames.length; i2++) {
  99788. currentFrame = frames[i2];
  99789. data.set(currentFrame.data, dataOffset);
  99790. dataOffset += currentFrame.data.byteLength;
  99791. }
  99792. return data;
  99793. };
  99794. var audioFrameUtils = {
  99795. prefixWithSilence,
  99796. trimAdtsFramesByEarliestDts,
  99797. generateSampleTable,
  99798. concatenateFrameData
  99799. };
  99800. var ONE_SECOND_IN_TS$3 = clock2.ONE_SECOND_IN_TS;
  99801. var collectDtsInfo = function collectDtsInfo2(track, data) {
  99802. if (typeof data.pts === "number") {
  99803. if (track.timelineStartInfo.pts === void 0) {
  99804. track.timelineStartInfo.pts = data.pts;
  99805. }
  99806. if (track.minSegmentPts === void 0) {
  99807. track.minSegmentPts = data.pts;
  99808. } else {
  99809. track.minSegmentPts = Math.min(track.minSegmentPts, data.pts);
  99810. }
  99811. if (track.maxSegmentPts === void 0) {
  99812. track.maxSegmentPts = data.pts;
  99813. } else {
  99814. track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts);
  99815. }
  99816. }
  99817. if (typeof data.dts === "number") {
  99818. if (track.timelineStartInfo.dts === void 0) {
  99819. track.timelineStartInfo.dts = data.dts;
  99820. }
  99821. if (track.minSegmentDts === void 0) {
  99822. track.minSegmentDts = data.dts;
  99823. } else {
  99824. track.minSegmentDts = Math.min(track.minSegmentDts, data.dts);
  99825. }
  99826. if (track.maxSegmentDts === void 0) {
  99827. track.maxSegmentDts = data.dts;
  99828. } else {
  99829. track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts);
  99830. }
  99831. }
  99832. };
  99833. var clearDtsInfo = function clearDtsInfo2(track) {
  99834. delete track.minSegmentDts;
  99835. delete track.maxSegmentDts;
  99836. delete track.minSegmentPts;
  99837. delete track.maxSegmentPts;
  99838. };
  99839. var calculateTrackBaseMediaDecodeTime = function calculateTrackBaseMediaDecodeTime2(track, keepOriginalTimestamps) {
  99840. var baseMediaDecodeTime, scale, minSegmentDts = track.minSegmentDts;
  99841. if (!keepOriginalTimestamps) {
  99842. minSegmentDts -= track.timelineStartInfo.dts;
  99843. }
  99844. baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime;
  99845. baseMediaDecodeTime += minSegmentDts;
  99846. baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime);
  99847. if (track.type === "audio") {
  99848. scale = track.samplerate / ONE_SECOND_IN_TS$3;
  99849. baseMediaDecodeTime *= scale;
  99850. baseMediaDecodeTime = Math.floor(baseMediaDecodeTime);
  99851. }
  99852. return baseMediaDecodeTime;
  99853. };
  99854. var trackDecodeInfo = {
  99855. clearDtsInfo,
  99856. calculateTrackBaseMediaDecodeTime,
  99857. collectDtsInfo
  99858. };
  99859. var USER_DATA_REGISTERED_ITU_T_T35 = 4, RBSP_TRAILING_BITS = 128;
  99860. var parseSei = function parseSei2(bytes) {
  99861. var i2 = 0, result = {
  99862. payloadType: -1,
  99863. payloadSize: 0
  99864. }, payloadType = 0, payloadSize = 0;
  99865. while (i2 < bytes.byteLength) {
  99866. if (bytes[i2] === RBSP_TRAILING_BITS) {
  99867. break;
  99868. }
  99869. while (bytes[i2] === 255) {
  99870. payloadType += 255;
  99871. i2++;
  99872. }
  99873. payloadType += bytes[i2++];
  99874. while (bytes[i2] === 255) {
  99875. payloadSize += 255;
  99876. i2++;
  99877. }
  99878. payloadSize += bytes[i2++];
  99879. if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) {
  99880. var userIdentifier = String.fromCharCode(bytes[i2 + 3], bytes[i2 + 4], bytes[i2 + 5], bytes[i2 + 6]);
  99881. if (userIdentifier === "GA94") {
  99882. result.payloadType = payloadType;
  99883. result.payloadSize = payloadSize;
  99884. result.payload = bytes.subarray(i2, i2 + payloadSize);
  99885. break;
  99886. } else {
  99887. result.payload = void 0;
  99888. }
  99889. }
  99890. i2 += payloadSize;
  99891. payloadType = 0;
  99892. payloadSize = 0;
  99893. }
  99894. return result;
  99895. };
  99896. var parseUserData = function parseUserData2(sei) {
  99897. if (sei.payload[0] !== 181) {
  99898. return null;
  99899. }
  99900. if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) {
  99901. return null;
  99902. }
  99903. if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== "GA94") {
  99904. return null;
  99905. }
  99906. if (sei.payload[7] !== 3) {
  99907. return null;
  99908. }
  99909. return sei.payload.subarray(8, sei.payload.length - 1);
  99910. };
  99911. var parseCaptionPackets = function parseCaptionPackets2(pts, userData) {
  99912. var results = [], i2, count, offset, data;
  99913. if (!(userData[0] & 64)) {
  99914. return results;
  99915. }
  99916. count = userData[0] & 31;
  99917. for (i2 = 0; i2 < count; i2++) {
  99918. offset = i2 * 3;
  99919. data = {
  99920. type: userData[offset + 2] & 3,
  99921. pts
  99922. };
  99923. if (userData[offset + 2] & 4) {
  99924. data.ccData = userData[offset + 3] << 8 | userData[offset + 4];
  99925. results.push(data);
  99926. }
  99927. }
  99928. return results;
  99929. };
  99930. var discardEmulationPreventionBytes$12 = function discardEmulationPreventionBytes5(data) {
  99931. var length = data.byteLength, emulationPreventionBytesPositions = [], i2 = 1, newLength, newData;
  99932. while (i2 < length - 2) {
  99933. if (data[i2] === 0 && data[i2 + 1] === 0 && data[i2 + 2] === 3) {
  99934. emulationPreventionBytesPositions.push(i2 + 2);
  99935. i2 += 2;
  99936. } else {
  99937. i2++;
  99938. }
  99939. }
  99940. if (emulationPreventionBytesPositions.length === 0) {
  99941. return data;
  99942. }
  99943. newLength = length - emulationPreventionBytesPositions.length;
  99944. newData = new Uint8Array(newLength);
  99945. var sourceIndex = 0;
  99946. for (i2 = 0; i2 < newLength; sourceIndex++, i2++) {
  99947. if (sourceIndex === emulationPreventionBytesPositions[0]) {
  99948. sourceIndex++;
  99949. emulationPreventionBytesPositions.shift();
  99950. }
  99951. newData[i2] = data[sourceIndex];
  99952. }
  99953. return newData;
  99954. };
  99955. var captionPacketParser = {
  99956. parseSei,
  99957. parseUserData,
  99958. parseCaptionPackets,
  99959. discardEmulationPreventionBytes: discardEmulationPreventionBytes$12,
  99960. USER_DATA_REGISTERED_ITU_T_T35
  99961. };
  99962. var CaptionStream$1 = function CaptionStream2(options2) {
  99963. options2 = options2 || {};
  99964. CaptionStream2.prototype.init.call(this);
  99965. this.parse708captions_ = typeof options2.parse708captions === "boolean" ? options2.parse708captions : true;
  99966. this.captionPackets_ = [];
  99967. this.ccStreams_ = [
  99968. new Cea608Stream(0, 0),
  99969. new Cea608Stream(0, 1),
  99970. new Cea608Stream(1, 0),
  99971. new Cea608Stream(1, 1)
  99972. ];
  99973. if (this.parse708captions_) {
  99974. this.cc708Stream_ = new Cea708Stream({
  99975. captionServices: options2.captionServices
  99976. });
  99977. }
  99978. this.reset();
  99979. this.ccStreams_.forEach(function(cc) {
  99980. cc.on("data", this.trigger.bind(this, "data"));
  99981. cc.on("partialdone", this.trigger.bind(this, "partialdone"));
  99982. cc.on("done", this.trigger.bind(this, "done"));
  99983. }, this);
  99984. if (this.parse708captions_) {
  99985. this.cc708Stream_.on("data", this.trigger.bind(this, "data"));
  99986. this.cc708Stream_.on("partialdone", this.trigger.bind(this, "partialdone"));
  99987. this.cc708Stream_.on("done", this.trigger.bind(this, "done"));
  99988. }
  99989. };
  99990. CaptionStream$1.prototype = new stream();
  99991. CaptionStream$1.prototype.push = function(event2) {
  99992. var sei, userData, newCaptionPackets;
  99993. if (event2.nalUnitType !== "sei_rbsp") {
  99994. return;
  99995. }
  99996. sei = captionPacketParser.parseSei(event2.escapedRBSP);
  99997. if (!sei.payload) {
  99998. return;
  99999. }
  100000. if (sei.payloadType !== captionPacketParser.USER_DATA_REGISTERED_ITU_T_T35) {
  100001. return;
  100002. }
  100003. userData = captionPacketParser.parseUserData(sei);
  100004. if (!userData) {
  100005. return;
  100006. }
  100007. if (event2.dts < this.latestDts_) {
  100008. this.ignoreNextEqualDts_ = true;
  100009. return;
  100010. } else if (event2.dts === this.latestDts_ && this.ignoreNextEqualDts_) {
  100011. this.numSameDts_--;
  100012. if (!this.numSameDts_) {
  100013. this.ignoreNextEqualDts_ = false;
  100014. }
  100015. return;
  100016. }
  100017. newCaptionPackets = captionPacketParser.parseCaptionPackets(event2.pts, userData);
  100018. this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets);
  100019. if (this.latestDts_ !== event2.dts) {
  100020. this.numSameDts_ = 0;
  100021. }
  100022. this.numSameDts_++;
  100023. this.latestDts_ = event2.dts;
  100024. };
  100025. CaptionStream$1.prototype.flushCCStreams = function(flushType) {
  100026. this.ccStreams_.forEach(function(cc) {
  100027. return flushType === "flush" ? cc.flush() : cc.partialFlush();
  100028. }, this);
  100029. };
  100030. CaptionStream$1.prototype.flushStream = function(flushType) {
  100031. if (!this.captionPackets_.length) {
  100032. this.flushCCStreams(flushType);
  100033. return;
  100034. }
  100035. this.captionPackets_.forEach(function(elem, idx) {
  100036. elem.presortIndex = idx;
  100037. });
  100038. this.captionPackets_.sort(function(a, b) {
  100039. if (a.pts === b.pts) {
  100040. return a.presortIndex - b.presortIndex;
  100041. }
  100042. return a.pts - b.pts;
  100043. });
  100044. this.captionPackets_.forEach(function(packet) {
  100045. if (packet.type < 2) {
  100046. this.dispatchCea608Packet(packet);
  100047. } else {
  100048. this.dispatchCea708Packet(packet);
  100049. }
  100050. }, this);
  100051. this.captionPackets_.length = 0;
  100052. this.flushCCStreams(flushType);
  100053. };
  100054. CaptionStream$1.prototype.flush = function() {
  100055. return this.flushStream("flush");
  100056. };
  100057. CaptionStream$1.prototype.partialFlush = function() {
  100058. return this.flushStream("partialFlush");
  100059. };
  100060. CaptionStream$1.prototype.reset = function() {
  100061. this.latestDts_ = null;
  100062. this.ignoreNextEqualDts_ = false;
  100063. this.numSameDts_ = 0;
  100064. this.activeCea608Channel_ = [null, null];
  100065. this.ccStreams_.forEach(function(ccStream) {
  100066. ccStream.reset();
  100067. });
  100068. };
  100069. CaptionStream$1.prototype.dispatchCea608Packet = function(packet) {
  100070. if (this.setsTextOrXDSActive(packet)) {
  100071. this.activeCea608Channel_[packet.type] = null;
  100072. } else if (this.setsChannel1Active(packet)) {
  100073. this.activeCea608Channel_[packet.type] = 0;
  100074. } else if (this.setsChannel2Active(packet)) {
  100075. this.activeCea608Channel_[packet.type] = 1;
  100076. }
  100077. if (this.activeCea608Channel_[packet.type] === null) {
  100078. return;
  100079. }
  100080. this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet);
  100081. };
  100082. CaptionStream$1.prototype.setsChannel1Active = function(packet) {
  100083. return (packet.ccData & 30720) === 4096;
  100084. };
  100085. CaptionStream$1.prototype.setsChannel2Active = function(packet) {
  100086. return (packet.ccData & 30720) === 6144;
  100087. };
  100088. CaptionStream$1.prototype.setsTextOrXDSActive = function(packet) {
  100089. return (packet.ccData & 28928) === 256 || (packet.ccData & 30974) === 4138 || (packet.ccData & 30974) === 6186;
  100090. };
  100091. CaptionStream$1.prototype.dispatchCea708Packet = function(packet) {
  100092. if (this.parse708captions_) {
  100093. this.cc708Stream_.push(packet);
  100094. }
  100095. };
  100096. var CHARACTER_TRANSLATION_708 = {
  100097. 127: 9834,
  100098. 4128: 32,
  100099. 4129: 160,
  100100. 4133: 8230,
  100101. 4138: 352,
  100102. 4140: 338,
  100103. 4144: 9608,
  100104. 4145: 8216,
  100105. 4146: 8217,
  100106. 4147: 8220,
  100107. 4148: 8221,
  100108. 4149: 8226,
  100109. 4153: 8482,
  100110. 4154: 353,
  100111. 4156: 339,
  100112. 4157: 8480,
  100113. 4159: 376,
  100114. 4214: 8539,
  100115. 4215: 8540,
  100116. 4216: 8541,
  100117. 4217: 8542,
  100118. 4218: 9168,
  100119. 4219: 9124,
  100120. 4220: 9123,
  100121. 4221: 9135,
  100122. 4222: 9126,
  100123. 4223: 9121,
  100124. 4256: 12600
  100125. };
  100126. var get708CharFromCode = function get708CharFromCode2(code) {
  100127. var newCode = CHARACTER_TRANSLATION_708[code] || code;
  100128. if (code & 4096 && code === newCode) {
  100129. return "";
  100130. }
  100131. return String.fromCharCode(newCode);
  100132. };
  100133. var within708TextBlock = function within708TextBlock2(b) {
  100134. return 32 <= b && b <= 127 || 160 <= b && b <= 255;
  100135. };
  100136. var Cea708Window = function Cea708Window2(windowNum) {
  100137. this.windowNum = windowNum;
  100138. this.reset();
  100139. };
  100140. Cea708Window.prototype.reset = function() {
  100141. this.clearText();
  100142. this.pendingNewLine = false;
  100143. this.winAttr = {};
  100144. this.penAttr = {};
  100145. this.penLoc = {};
  100146. this.penColor = {};
  100147. this.visible = 0;
  100148. this.rowLock = 0;
  100149. this.columnLock = 0;
  100150. this.priority = 0;
  100151. this.relativePositioning = 0;
  100152. this.anchorVertical = 0;
  100153. this.anchorHorizontal = 0;
  100154. this.anchorPoint = 0;
  100155. this.rowCount = 1;
  100156. this.virtualRowCount = this.rowCount + 1;
  100157. this.columnCount = 41;
  100158. this.windowStyle = 0;
  100159. this.penStyle = 0;
  100160. };
  100161. Cea708Window.prototype.getText = function() {
  100162. return this.rows.join("\n");
  100163. };
  100164. Cea708Window.prototype.clearText = function() {
  100165. this.rows = [""];
  100166. this.rowIdx = 0;
  100167. };
  100168. Cea708Window.prototype.newLine = function(pts) {
  100169. if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === "function") {
  100170. this.beforeRowOverflow(pts);
  100171. }
  100172. if (this.rows.length > 0) {
  100173. this.rows.push("");
  100174. this.rowIdx++;
  100175. }
  100176. while (this.rows.length > this.virtualRowCount) {
  100177. this.rows.shift();
  100178. this.rowIdx--;
  100179. }
  100180. };
  100181. Cea708Window.prototype.isEmpty = function() {
  100182. if (this.rows.length === 0) {
  100183. return true;
  100184. } else if (this.rows.length === 1) {
  100185. return this.rows[0] === "";
  100186. }
  100187. return false;
  100188. };
  100189. Cea708Window.prototype.addText = function(text) {
  100190. this.rows[this.rowIdx] += text;
  100191. };
  100192. Cea708Window.prototype.backspace = function() {
  100193. if (!this.isEmpty()) {
  100194. var row = this.rows[this.rowIdx];
  100195. this.rows[this.rowIdx] = row.substr(0, row.length - 1);
  100196. }
  100197. };
  100198. var Cea708Service = function Cea708Service2(serviceNum, encoding, stream2) {
  100199. this.serviceNum = serviceNum;
  100200. this.text = "";
  100201. this.currentWindow = new Cea708Window(-1);
  100202. this.windows = [];
  100203. this.stream = stream2;
  100204. if (typeof encoding === "string") {
  100205. this.createTextDecoder(encoding);
  100206. }
  100207. };
  100208. Cea708Service.prototype.init = function(pts, beforeRowOverflow) {
  100209. this.startPts = pts;
  100210. for (var win3 = 0; win3 < 8; win3++) {
  100211. this.windows[win3] = new Cea708Window(win3);
  100212. if (typeof beforeRowOverflow === "function") {
  100213. this.windows[win3].beforeRowOverflow = beforeRowOverflow;
  100214. }
  100215. }
  100216. };
  100217. Cea708Service.prototype.setCurrentWindow = function(windowNum) {
  100218. this.currentWindow = this.windows[windowNum];
  100219. };
  100220. Cea708Service.prototype.createTextDecoder = function(encoding) {
  100221. if (typeof TextDecoder === "undefined") {
  100222. this.stream.trigger("log", {
  100223. level: "warn",
  100224. message: "The `encoding` option is unsupported without TextDecoder support"
  100225. });
  100226. } else {
  100227. try {
  100228. this.textDecoder_ = new TextDecoder(encoding);
  100229. } catch (error) {
  100230. this.stream.trigger("log", {
  100231. level: "warn",
  100232. message: "TextDecoder could not be created with " + encoding + " encoding. " + error
  100233. });
  100234. }
  100235. }
  100236. };
  100237. var Cea708Stream = function Cea708Stream2(options2) {
  100238. options2 = options2 || {};
  100239. Cea708Stream2.prototype.init.call(this);
  100240. var self2 = this;
  100241. var captionServices = options2.captionServices || {};
  100242. var captionServiceEncodings = {};
  100243. var serviceProps;
  100244. Object.keys(captionServices).forEach(function(serviceName) {
  100245. serviceProps = captionServices[serviceName];
  100246. if (/^SERVICE/.test(serviceName)) {
  100247. captionServiceEncodings[serviceName] = serviceProps.encoding;
  100248. }
  100249. });
  100250. this.serviceEncodings = captionServiceEncodings;
  100251. this.current708Packet = null;
  100252. this.services = {};
  100253. this.push = function(packet) {
  100254. if (packet.type === 3) {
  100255. self2.new708Packet();
  100256. self2.add708Bytes(packet);
  100257. } else {
  100258. if (self2.current708Packet === null) {
  100259. self2.new708Packet();
  100260. }
  100261. self2.add708Bytes(packet);
  100262. }
  100263. };
  100264. };
  100265. Cea708Stream.prototype = new stream();
  100266. Cea708Stream.prototype.new708Packet = function() {
  100267. if (this.current708Packet !== null) {
  100268. this.push708Packet();
  100269. }
  100270. this.current708Packet = {
  100271. data: [],
  100272. ptsVals: []
  100273. };
  100274. };
  100275. Cea708Stream.prototype.add708Bytes = function(packet) {
  100276. var data = packet.ccData;
  100277. var byte0 = data >>> 8;
  100278. var byte1 = data & 255;
  100279. this.current708Packet.ptsVals.push(packet.pts);
  100280. this.current708Packet.data.push(byte0);
  100281. this.current708Packet.data.push(byte1);
  100282. };
  100283. Cea708Stream.prototype.push708Packet = function() {
  100284. var packet708 = this.current708Packet;
  100285. var packetData = packet708.data;
  100286. var serviceNum = null;
  100287. var blockSize = null;
  100288. var i2 = 0;
  100289. var b = packetData[i2++];
  100290. packet708.seq = b >> 6;
  100291. packet708.sizeCode = b & 63;
  100292. for (; i2 < packetData.length; i2++) {
  100293. b = packetData[i2++];
  100294. serviceNum = b >> 5;
  100295. blockSize = b & 31;
  100296. if (serviceNum === 7 && blockSize > 0) {
  100297. b = packetData[i2++];
  100298. serviceNum = b;
  100299. }
  100300. this.pushServiceBlock(serviceNum, i2, blockSize);
  100301. if (blockSize > 0) {
  100302. i2 += blockSize - 1;
  100303. }
  100304. }
  100305. };
  100306. Cea708Stream.prototype.pushServiceBlock = function(serviceNum, start2, size) {
  100307. var b;
  100308. var i2 = start2;
  100309. var packetData = this.current708Packet.data;
  100310. var service = this.services[serviceNum];
  100311. if (!service) {
  100312. service = this.initService(serviceNum, i2);
  100313. }
  100314. for (; i2 < start2 + size && i2 < packetData.length; i2++) {
  100315. b = packetData[i2];
  100316. if (within708TextBlock(b)) {
  100317. i2 = this.handleText(i2, service);
  100318. } else if (b === 24) {
  100319. i2 = this.multiByteCharacter(i2, service);
  100320. } else if (b === 16) {
  100321. i2 = this.extendedCommands(i2, service);
  100322. } else if (128 <= b && b <= 135) {
  100323. i2 = this.setCurrentWindow(i2, service);
  100324. } else if (152 <= b && b <= 159) {
  100325. i2 = this.defineWindow(i2, service);
  100326. } else if (b === 136) {
  100327. i2 = this.clearWindows(i2, service);
  100328. } else if (b === 140) {
  100329. i2 = this.deleteWindows(i2, service);
  100330. } else if (b === 137) {
  100331. i2 = this.displayWindows(i2, service);
  100332. } else if (b === 138) {
  100333. i2 = this.hideWindows(i2, service);
  100334. } else if (b === 139) {
  100335. i2 = this.toggleWindows(i2, service);
  100336. } else if (b === 151) {
  100337. i2 = this.setWindowAttributes(i2, service);
  100338. } else if (b === 144) {
  100339. i2 = this.setPenAttributes(i2, service);
  100340. } else if (b === 145) {
  100341. i2 = this.setPenColor(i2, service);
  100342. } else if (b === 146) {
  100343. i2 = this.setPenLocation(i2, service);
  100344. } else if (b === 143) {
  100345. service = this.reset(i2, service);
  100346. } else if (b === 8) {
  100347. service.currentWindow.backspace();
  100348. } else if (b === 12) {
  100349. service.currentWindow.clearText();
  100350. } else if (b === 13) {
  100351. service.currentWindow.pendingNewLine = true;
  100352. } else if (b === 14) {
  100353. service.currentWindow.clearText();
  100354. } else if (b === 141) {
  100355. i2++;
  100356. } else
  100357. ;
  100358. }
  100359. };
  100360. Cea708Stream.prototype.extendedCommands = function(i2, service) {
  100361. var packetData = this.current708Packet.data;
  100362. var b = packetData[++i2];
  100363. if (within708TextBlock(b)) {
  100364. i2 = this.handleText(i2, service, {
  100365. isExtended: true
  100366. });
  100367. }
  100368. return i2;
  100369. };
  100370. Cea708Stream.prototype.getPts = function(byteIndex) {
  100371. return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)];
  100372. };
  100373. Cea708Stream.prototype.initService = function(serviceNum, i2) {
  100374. var serviceName = "SERVICE" + serviceNum;
  100375. var self2 = this;
  100376. var serviceName;
  100377. var encoding;
  100378. if (serviceName in this.serviceEncodings) {
  100379. encoding = this.serviceEncodings[serviceName];
  100380. }
  100381. this.services[serviceNum] = new Cea708Service(serviceNum, encoding, self2);
  100382. this.services[serviceNum].init(this.getPts(i2), function(pts) {
  100383. self2.flushDisplayed(pts, self2.services[serviceNum]);
  100384. });
  100385. return this.services[serviceNum];
  100386. };
  100387. Cea708Stream.prototype.handleText = function(i2, service, options2) {
  100388. var isExtended = options2 && options2.isExtended;
  100389. var isMultiByte = options2 && options2.isMultiByte;
  100390. var packetData = this.current708Packet.data;
  100391. var extended = isExtended ? 4096 : 0;
  100392. var currentByte = packetData[i2];
  100393. var nextByte = packetData[i2 + 1];
  100394. var win3 = service.currentWindow;
  100395. var _char;
  100396. var charCodeArray;
  100397. if (service.textDecoder_ && !isExtended) {
  100398. if (isMultiByte) {
  100399. charCodeArray = [currentByte, nextByte];
  100400. i2++;
  100401. } else {
  100402. charCodeArray = [currentByte];
  100403. }
  100404. _char = service.textDecoder_.decode(new Uint8Array(charCodeArray));
  100405. } else {
  100406. _char = get708CharFromCode(extended | currentByte);
  100407. }
  100408. if (win3.pendingNewLine && !win3.isEmpty()) {
  100409. win3.newLine(this.getPts(i2));
  100410. }
  100411. win3.pendingNewLine = false;
  100412. win3.addText(_char);
  100413. return i2;
  100414. };
  100415. Cea708Stream.prototype.multiByteCharacter = function(i2, service) {
  100416. var packetData = this.current708Packet.data;
  100417. var firstByte = packetData[i2 + 1];
  100418. var secondByte = packetData[i2 + 2];
  100419. if (within708TextBlock(firstByte) && within708TextBlock(secondByte)) {
  100420. i2 = this.handleText(++i2, service, {
  100421. isMultiByte: true
  100422. });
  100423. }
  100424. return i2;
  100425. };
  100426. Cea708Stream.prototype.setCurrentWindow = function(i2, service) {
  100427. var packetData = this.current708Packet.data;
  100428. var b = packetData[i2];
  100429. var windowNum = b & 7;
  100430. service.setCurrentWindow(windowNum);
  100431. return i2;
  100432. };
  100433. Cea708Stream.prototype.defineWindow = function(i2, service) {
  100434. var packetData = this.current708Packet.data;
  100435. var b = packetData[i2];
  100436. var windowNum = b & 7;
  100437. service.setCurrentWindow(windowNum);
  100438. var win3 = service.currentWindow;
  100439. b = packetData[++i2];
  100440. win3.visible = (b & 32) >> 5;
  100441. win3.rowLock = (b & 16) >> 4;
  100442. win3.columnLock = (b & 8) >> 3;
  100443. win3.priority = b & 7;
  100444. b = packetData[++i2];
  100445. win3.relativePositioning = (b & 128) >> 7;
  100446. win3.anchorVertical = b & 127;
  100447. b = packetData[++i2];
  100448. win3.anchorHorizontal = b;
  100449. b = packetData[++i2];
  100450. win3.anchorPoint = (b & 240) >> 4;
  100451. win3.rowCount = b & 15;
  100452. b = packetData[++i2];
  100453. win3.columnCount = b & 63;
  100454. b = packetData[++i2];
  100455. win3.windowStyle = (b & 56) >> 3;
  100456. win3.penStyle = b & 7;
  100457. win3.virtualRowCount = win3.rowCount + 1;
  100458. return i2;
  100459. };
  100460. Cea708Stream.prototype.setWindowAttributes = function(i2, service) {
  100461. var packetData = this.current708Packet.data;
  100462. var b = packetData[i2];
  100463. var winAttr = service.currentWindow.winAttr;
  100464. b = packetData[++i2];
  100465. winAttr.fillOpacity = (b & 192) >> 6;
  100466. winAttr.fillRed = (b & 48) >> 4;
  100467. winAttr.fillGreen = (b & 12) >> 2;
  100468. winAttr.fillBlue = b & 3;
  100469. b = packetData[++i2];
  100470. winAttr.borderType = (b & 192) >> 6;
  100471. winAttr.borderRed = (b & 48) >> 4;
  100472. winAttr.borderGreen = (b & 12) >> 2;
  100473. winAttr.borderBlue = b & 3;
  100474. b = packetData[++i2];
  100475. winAttr.borderType += (b & 128) >> 5;
  100476. winAttr.wordWrap = (b & 64) >> 6;
  100477. winAttr.printDirection = (b & 48) >> 4;
  100478. winAttr.scrollDirection = (b & 12) >> 2;
  100479. winAttr.justify = b & 3;
  100480. b = packetData[++i2];
  100481. winAttr.effectSpeed = (b & 240) >> 4;
  100482. winAttr.effectDirection = (b & 12) >> 2;
  100483. winAttr.displayEffect = b & 3;
  100484. return i2;
  100485. };
  100486. Cea708Stream.prototype.flushDisplayed = function(pts, service) {
  100487. var displayedText = [];
  100488. for (var winId = 0; winId < 8; winId++) {
  100489. if (service.windows[winId].visible && !service.windows[winId].isEmpty()) {
  100490. displayedText.push(service.windows[winId].getText());
  100491. }
  100492. }
  100493. service.endPts = pts;
  100494. service.text = displayedText.join("\n\n");
  100495. this.pushCaption(service);
  100496. service.startPts = pts;
  100497. };
  100498. Cea708Stream.prototype.pushCaption = function(service) {
  100499. if (service.text !== "") {
  100500. this.trigger("data", {
  100501. startPts: service.startPts,
  100502. endPts: service.endPts,
  100503. text: service.text,
  100504. stream: "cc708_" + service.serviceNum
  100505. });
  100506. service.text = "";
  100507. service.startPts = service.endPts;
  100508. }
  100509. };
  100510. Cea708Stream.prototype.displayWindows = function(i2, service) {
  100511. var packetData = this.current708Packet.data;
  100512. var b = packetData[++i2];
  100513. var pts = this.getPts(i2);
  100514. this.flushDisplayed(pts, service);
  100515. for (var winId = 0; winId < 8; winId++) {
  100516. if (b & 1 << winId) {
  100517. service.windows[winId].visible = 1;
  100518. }
  100519. }
  100520. return i2;
  100521. };
  100522. Cea708Stream.prototype.hideWindows = function(i2, service) {
  100523. var packetData = this.current708Packet.data;
  100524. var b = packetData[++i2];
  100525. var pts = this.getPts(i2);
  100526. this.flushDisplayed(pts, service);
  100527. for (var winId = 0; winId < 8; winId++) {
  100528. if (b & 1 << winId) {
  100529. service.windows[winId].visible = 0;
  100530. }
  100531. }
  100532. return i2;
  100533. };
  100534. Cea708Stream.prototype.toggleWindows = function(i2, service) {
  100535. var packetData = this.current708Packet.data;
  100536. var b = packetData[++i2];
  100537. var pts = this.getPts(i2);
  100538. this.flushDisplayed(pts, service);
  100539. for (var winId = 0; winId < 8; winId++) {
  100540. if (b & 1 << winId) {
  100541. service.windows[winId].visible ^= 1;
  100542. }
  100543. }
  100544. return i2;
  100545. };
  100546. Cea708Stream.prototype.clearWindows = function(i2, service) {
  100547. var packetData = this.current708Packet.data;
  100548. var b = packetData[++i2];
  100549. var pts = this.getPts(i2);
  100550. this.flushDisplayed(pts, service);
  100551. for (var winId = 0; winId < 8; winId++) {
  100552. if (b & 1 << winId) {
  100553. service.windows[winId].clearText();
  100554. }
  100555. }
  100556. return i2;
  100557. };
  100558. Cea708Stream.prototype.deleteWindows = function(i2, service) {
  100559. var packetData = this.current708Packet.data;
  100560. var b = packetData[++i2];
  100561. var pts = this.getPts(i2);
  100562. this.flushDisplayed(pts, service);
  100563. for (var winId = 0; winId < 8; winId++) {
  100564. if (b & 1 << winId) {
  100565. service.windows[winId].reset();
  100566. }
  100567. }
  100568. return i2;
  100569. };
  100570. Cea708Stream.prototype.setPenAttributes = function(i2, service) {
  100571. var packetData = this.current708Packet.data;
  100572. var b = packetData[i2];
  100573. var penAttr = service.currentWindow.penAttr;
  100574. b = packetData[++i2];
  100575. penAttr.textTag = (b & 240) >> 4;
  100576. penAttr.offset = (b & 12) >> 2;
  100577. penAttr.penSize = b & 3;
  100578. b = packetData[++i2];
  100579. penAttr.italics = (b & 128) >> 7;
  100580. penAttr.underline = (b & 64) >> 6;
  100581. penAttr.edgeType = (b & 56) >> 3;
  100582. penAttr.fontStyle = b & 7;
  100583. return i2;
  100584. };
  100585. Cea708Stream.prototype.setPenColor = function(i2, service) {
  100586. var packetData = this.current708Packet.data;
  100587. var b = packetData[i2];
  100588. var penColor = service.currentWindow.penColor;
  100589. b = packetData[++i2];
  100590. penColor.fgOpacity = (b & 192) >> 6;
  100591. penColor.fgRed = (b & 48) >> 4;
  100592. penColor.fgGreen = (b & 12) >> 2;
  100593. penColor.fgBlue = b & 3;
  100594. b = packetData[++i2];
  100595. penColor.bgOpacity = (b & 192) >> 6;
  100596. penColor.bgRed = (b & 48) >> 4;
  100597. penColor.bgGreen = (b & 12) >> 2;
  100598. penColor.bgBlue = b & 3;
  100599. b = packetData[++i2];
  100600. penColor.edgeRed = (b & 48) >> 4;
  100601. penColor.edgeGreen = (b & 12) >> 2;
  100602. penColor.edgeBlue = b & 3;
  100603. return i2;
  100604. };
  100605. Cea708Stream.prototype.setPenLocation = function(i2, service) {
  100606. var packetData = this.current708Packet.data;
  100607. var b = packetData[i2];
  100608. var penLoc = service.currentWindow.penLoc;
  100609. service.currentWindow.pendingNewLine = true;
  100610. b = packetData[++i2];
  100611. penLoc.row = b & 15;
  100612. b = packetData[++i2];
  100613. penLoc.column = b & 63;
  100614. return i2;
  100615. };
  100616. Cea708Stream.prototype.reset = function(i2, service) {
  100617. var pts = this.getPts(i2);
  100618. this.flushDisplayed(pts, service);
  100619. return this.initService(service.serviceNum, i2);
  100620. };
  100621. var CHARACTER_TRANSLATION = {
  100622. 42: 225,
  100623. 92: 233,
  100624. 94: 237,
  100625. 95: 243,
  100626. 96: 250,
  100627. 123: 231,
  100628. 124: 247,
  100629. 125: 209,
  100630. 126: 241,
  100631. 127: 9608,
  100632. 304: 174,
  100633. 305: 176,
  100634. 306: 189,
  100635. 307: 191,
  100636. 308: 8482,
  100637. 309: 162,
  100638. 310: 163,
  100639. 311: 9834,
  100640. 312: 224,
  100641. 313: 160,
  100642. 314: 232,
  100643. 315: 226,
  100644. 316: 234,
  100645. 317: 238,
  100646. 318: 244,
  100647. 319: 251,
  100648. 544: 193,
  100649. 545: 201,
  100650. 546: 211,
  100651. 547: 218,
  100652. 548: 220,
  100653. 549: 252,
  100654. 550: 8216,
  100655. 551: 161,
  100656. 552: 42,
  100657. 553: 39,
  100658. 554: 8212,
  100659. 555: 169,
  100660. 556: 8480,
  100661. 557: 8226,
  100662. 558: 8220,
  100663. 559: 8221,
  100664. 560: 192,
  100665. 561: 194,
  100666. 562: 199,
  100667. 563: 200,
  100668. 564: 202,
  100669. 565: 203,
  100670. 566: 235,
  100671. 567: 206,
  100672. 568: 207,
  100673. 569: 239,
  100674. 570: 212,
  100675. 571: 217,
  100676. 572: 249,
  100677. 573: 219,
  100678. 574: 171,
  100679. 575: 187,
  100680. 800: 195,
  100681. 801: 227,
  100682. 802: 205,
  100683. 803: 204,
  100684. 804: 236,
  100685. 805: 210,
  100686. 806: 242,
  100687. 807: 213,
  100688. 808: 245,
  100689. 809: 123,
  100690. 810: 125,
  100691. 811: 92,
  100692. 812: 94,
  100693. 813: 95,
  100694. 814: 124,
  100695. 815: 126,
  100696. 816: 196,
  100697. 817: 228,
  100698. 818: 214,
  100699. 819: 246,
  100700. 820: 223,
  100701. 821: 165,
  100702. 822: 164,
  100703. 823: 9474,
  100704. 824: 197,
  100705. 825: 229,
  100706. 826: 216,
  100707. 827: 248,
  100708. 828: 9484,
  100709. 829: 9488,
  100710. 830: 9492,
  100711. 831: 9496
  100712. };
  100713. var getCharFromCode = function getCharFromCode2(code) {
  100714. if (code === null) {
  100715. return "";
  100716. }
  100717. code = CHARACTER_TRANSLATION[code] || code;
  100718. return String.fromCharCode(code);
  100719. };
  100720. var BOTTOM_ROW = 14;
  100721. var ROWS = [4352, 4384, 4608, 4640, 5376, 5408, 5632, 5664, 5888, 5920, 4096, 4864, 4896, 5120, 5152];
  100722. var createDisplayBuffer = function createDisplayBuffer2() {
  100723. var result = [], i2 = BOTTOM_ROW + 1;
  100724. while (i2--) {
  100725. result.push("");
  100726. }
  100727. return result;
  100728. };
  100729. var Cea608Stream = function Cea608Stream2(field, dataChannel) {
  100730. Cea608Stream2.prototype.init.call(this);
  100731. this.field_ = field || 0;
  100732. this.dataChannel_ = dataChannel || 0;
  100733. this.name_ = "CC" + ((this.field_ << 1 | this.dataChannel_) + 1);
  100734. this.setConstants();
  100735. this.reset();
  100736. this.push = function(packet) {
  100737. var data, swap, char0, char1, text;
  100738. data = packet.ccData & 32639;
  100739. if (data === this.lastControlCode_) {
  100740. this.lastControlCode_ = null;
  100741. return;
  100742. }
  100743. if ((data & 61440) === 4096) {
  100744. this.lastControlCode_ = data;
  100745. } else if (data !== this.PADDING_) {
  100746. this.lastControlCode_ = null;
  100747. }
  100748. char0 = data >>> 8;
  100749. char1 = data & 255;
  100750. if (data === this.PADDING_) {
  100751. return;
  100752. } else if (data === this.RESUME_CAPTION_LOADING_) {
  100753. this.mode_ = "popOn";
  100754. } else if (data === this.END_OF_CAPTION_) {
  100755. this.mode_ = "popOn";
  100756. this.clearFormatting(packet.pts);
  100757. this.flushDisplayed(packet.pts);
  100758. swap = this.displayed_;
  100759. this.displayed_ = this.nonDisplayed_;
  100760. this.nonDisplayed_ = swap;
  100761. this.startPts_ = packet.pts;
  100762. } else if (data === this.ROLL_UP_2_ROWS_) {
  100763. this.rollUpRows_ = 2;
  100764. this.setRollUp(packet.pts);
  100765. } else if (data === this.ROLL_UP_3_ROWS_) {
  100766. this.rollUpRows_ = 3;
  100767. this.setRollUp(packet.pts);
  100768. } else if (data === this.ROLL_UP_4_ROWS_) {
  100769. this.rollUpRows_ = 4;
  100770. this.setRollUp(packet.pts);
  100771. } else if (data === this.CARRIAGE_RETURN_) {
  100772. this.clearFormatting(packet.pts);
  100773. this.flushDisplayed(packet.pts);
  100774. this.shiftRowsUp_();
  100775. this.startPts_ = packet.pts;
  100776. } else if (data === this.BACKSPACE_) {
  100777. if (this.mode_ === "popOn") {
  100778. this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1);
  100779. } else {
  100780. this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1);
  100781. }
  100782. } else if (data === this.ERASE_DISPLAYED_MEMORY_) {
  100783. this.flushDisplayed(packet.pts);
  100784. this.displayed_ = createDisplayBuffer();
  100785. } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) {
  100786. this.nonDisplayed_ = createDisplayBuffer();
  100787. } else if (data === this.RESUME_DIRECT_CAPTIONING_) {
  100788. if (this.mode_ !== "paintOn") {
  100789. this.flushDisplayed(packet.pts);
  100790. this.displayed_ = createDisplayBuffer();
  100791. }
  100792. this.mode_ = "paintOn";
  100793. this.startPts_ = packet.pts;
  100794. } else if (this.isSpecialCharacter(char0, char1)) {
  100795. char0 = (char0 & 3) << 8;
  100796. text = getCharFromCode(char0 | char1);
  100797. this[this.mode_](packet.pts, text);
  100798. this.column_++;
  100799. } else if (this.isExtCharacter(char0, char1)) {
  100800. if (this.mode_ === "popOn") {
  100801. this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1);
  100802. } else {
  100803. this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1);
  100804. }
  100805. char0 = (char0 & 3) << 8;
  100806. text = getCharFromCode(char0 | char1);
  100807. this[this.mode_](packet.pts, text);
  100808. this.column_++;
  100809. } else if (this.isMidRowCode(char0, char1)) {
  100810. this.clearFormatting(packet.pts);
  100811. this[this.mode_](packet.pts, " ");
  100812. this.column_++;
  100813. if ((char1 & 14) === 14) {
  100814. this.addFormatting(packet.pts, ["i"]);
  100815. }
  100816. if ((char1 & 1) === 1) {
  100817. this.addFormatting(packet.pts, ["u"]);
  100818. }
  100819. } else if (this.isOffsetControlCode(char0, char1)) {
  100820. this.column_ += char1 & 3;
  100821. } else if (this.isPAC(char0, char1)) {
  100822. var row = ROWS.indexOf(data & 7968);
  100823. if (this.mode_ === "rollUp") {
  100824. if (row - this.rollUpRows_ + 1 < 0) {
  100825. row = this.rollUpRows_ - 1;
  100826. }
  100827. this.setRollUp(packet.pts, row);
  100828. }
  100829. if (row !== this.row_) {
  100830. this.clearFormatting(packet.pts);
  100831. this.row_ = row;
  100832. }
  100833. if (char1 & 1 && this.formatting_.indexOf("u") === -1) {
  100834. this.addFormatting(packet.pts, ["u"]);
  100835. }
  100836. if ((data & 16) === 16) {
  100837. this.column_ = ((data & 14) >> 1) * 4;
  100838. }
  100839. if (this.isColorPAC(char1)) {
  100840. if ((char1 & 14) === 14) {
  100841. this.addFormatting(packet.pts, ["i"]);
  100842. }
  100843. }
  100844. } else if (this.isNormalChar(char0)) {
  100845. if (char1 === 0) {
  100846. char1 = null;
  100847. }
  100848. text = getCharFromCode(char0);
  100849. text += getCharFromCode(char1);
  100850. this[this.mode_](packet.pts, text);
  100851. this.column_ += text.length;
  100852. }
  100853. };
  100854. };
  100855. Cea608Stream.prototype = new stream();
  100856. Cea608Stream.prototype.flushDisplayed = function(pts) {
  100857. var content = this.displayed_.map(function(row, index2) {
  100858. try {
  100859. return row.trim();
  100860. } catch (e) {
  100861. this.trigger("log", {
  100862. level: "warn",
  100863. message: "Skipping a malformed 608 caption at index " + index2 + "."
  100864. });
  100865. return "";
  100866. }
  100867. }, this).join("\n").replace(/^\n+|\n+$/g, "");
  100868. if (content.length) {
  100869. this.trigger("data", {
  100870. startPts: this.startPts_,
  100871. endPts: pts,
  100872. text: content,
  100873. stream: this.name_
  100874. });
  100875. }
  100876. };
  100877. Cea608Stream.prototype.reset = function() {
  100878. this.mode_ = "popOn";
  100879. this.topRow_ = 0;
  100880. this.startPts_ = 0;
  100881. this.displayed_ = createDisplayBuffer();
  100882. this.nonDisplayed_ = createDisplayBuffer();
  100883. this.lastControlCode_ = null;
  100884. this.column_ = 0;
  100885. this.row_ = BOTTOM_ROW;
  100886. this.rollUpRows_ = 2;
  100887. this.formatting_ = [];
  100888. };
  100889. Cea608Stream.prototype.setConstants = function() {
  100890. if (this.dataChannel_ === 0) {
  100891. this.BASE_ = 16;
  100892. this.EXT_ = 17;
  100893. this.CONTROL_ = (20 | this.field_) << 8;
  100894. this.OFFSET_ = 23;
  100895. } else if (this.dataChannel_ === 1) {
  100896. this.BASE_ = 24;
  100897. this.EXT_ = 25;
  100898. this.CONTROL_ = (28 | this.field_) << 8;
  100899. this.OFFSET_ = 31;
  100900. }
  100901. this.PADDING_ = 0;
  100902. this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 32;
  100903. this.END_OF_CAPTION_ = this.CONTROL_ | 47;
  100904. this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 37;
  100905. this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 38;
  100906. this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 39;
  100907. this.CARRIAGE_RETURN_ = this.CONTROL_ | 45;
  100908. this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 41;
  100909. this.BACKSPACE_ = this.CONTROL_ | 33;
  100910. this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 44;
  100911. this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 46;
  100912. };
  100913. Cea608Stream.prototype.isSpecialCharacter = function(char0, char1) {
  100914. return char0 === this.EXT_ && char1 >= 48 && char1 <= 63;
  100915. };
  100916. Cea608Stream.prototype.isExtCharacter = function(char0, char1) {
  100917. return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 32 && char1 <= 63;
  100918. };
  100919. Cea608Stream.prototype.isMidRowCode = function(char0, char1) {
  100920. return char0 === this.EXT_ && char1 >= 32 && char1 <= 47;
  100921. };
  100922. Cea608Stream.prototype.isOffsetControlCode = function(char0, char1) {
  100923. return char0 === this.OFFSET_ && char1 >= 33 && char1 <= 35;
  100924. };
  100925. Cea608Stream.prototype.isPAC = function(char0, char1) {
  100926. return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 64 && char1 <= 127;
  100927. };
  100928. Cea608Stream.prototype.isColorPAC = function(char1) {
  100929. return char1 >= 64 && char1 <= 79 || char1 >= 96 && char1 <= 127;
  100930. };
  100931. Cea608Stream.prototype.isNormalChar = function(_char2) {
  100932. return _char2 >= 32 && _char2 <= 127;
  100933. };
  100934. Cea608Stream.prototype.setRollUp = function(pts, newBaseRow) {
  100935. if (this.mode_ !== "rollUp") {
  100936. this.row_ = BOTTOM_ROW;
  100937. this.mode_ = "rollUp";
  100938. this.flushDisplayed(pts);
  100939. this.nonDisplayed_ = createDisplayBuffer();
  100940. this.displayed_ = createDisplayBuffer();
  100941. }
  100942. if (newBaseRow !== void 0 && newBaseRow !== this.row_) {
  100943. for (var i2 = 0; i2 < this.rollUpRows_; i2++) {
  100944. this.displayed_[newBaseRow - i2] = this.displayed_[this.row_ - i2];
  100945. this.displayed_[this.row_ - i2] = "";
  100946. }
  100947. }
  100948. if (newBaseRow === void 0) {
  100949. newBaseRow = this.row_;
  100950. }
  100951. this.topRow_ = newBaseRow - this.rollUpRows_ + 1;
  100952. };
  100953. Cea608Stream.prototype.addFormatting = function(pts, format) {
  100954. this.formatting_ = this.formatting_.concat(format);
  100955. var text = format.reduce(function(text2, format2) {
  100956. return text2 + "<" + format2 + ">";
  100957. }, "");
  100958. this[this.mode_](pts, text);
  100959. };
  100960. Cea608Stream.prototype.clearFormatting = function(pts) {
  100961. if (!this.formatting_.length) {
  100962. return;
  100963. }
  100964. var text = this.formatting_.reverse().reduce(function(text2, format) {
  100965. return text2 + "</" + format + ">";
  100966. }, "");
  100967. this.formatting_ = [];
  100968. this[this.mode_](pts, text);
  100969. };
  100970. Cea608Stream.prototype.popOn = function(pts, text) {
  100971. var baseRow = this.nonDisplayed_[this.row_];
  100972. baseRow += text;
  100973. this.nonDisplayed_[this.row_] = baseRow;
  100974. };
  100975. Cea608Stream.prototype.rollUp = function(pts, text) {
  100976. var baseRow = this.displayed_[this.row_];
  100977. baseRow += text;
  100978. this.displayed_[this.row_] = baseRow;
  100979. };
  100980. Cea608Stream.prototype.shiftRowsUp_ = function() {
  100981. var i2;
  100982. for (i2 = 0; i2 < this.topRow_; i2++) {
  100983. this.displayed_[i2] = "";
  100984. }
  100985. for (i2 = this.row_ + 1; i2 < BOTTOM_ROW + 1; i2++) {
  100986. this.displayed_[i2] = "";
  100987. }
  100988. for (i2 = this.topRow_; i2 < this.row_; i2++) {
  100989. this.displayed_[i2] = this.displayed_[i2 + 1];
  100990. }
  100991. this.displayed_[this.row_] = "";
  100992. };
  100993. Cea608Stream.prototype.paintOn = function(pts, text) {
  100994. var baseRow = this.displayed_[this.row_];
  100995. baseRow += text;
  100996. this.displayed_[this.row_] = baseRow;
  100997. };
  100998. var captionStream = {
  100999. CaptionStream: CaptionStream$1,
  101000. Cea608Stream,
  101001. Cea708Stream
  101002. };
  101003. var streamTypes = {
  101004. H264_STREAM_TYPE: 27,
  101005. ADTS_STREAM_TYPE: 15,
  101006. METADATA_STREAM_TYPE: 21
  101007. };
  101008. var MAX_TS = 8589934592;
  101009. var RO_THRESH = 4294967296;
  101010. var TYPE_SHARED = "shared";
  101011. var handleRollover$1 = function handleRollover2(value, reference) {
  101012. var direction = 1;
  101013. if (value > reference) {
  101014. direction = -1;
  101015. }
  101016. while (Math.abs(reference - value) > RO_THRESH) {
  101017. value += direction * MAX_TS;
  101018. }
  101019. return value;
  101020. };
  101021. var TimestampRolloverStream$1 = function TimestampRolloverStream2(type3) {
  101022. var lastDTS, referenceDTS;
  101023. TimestampRolloverStream2.prototype.init.call(this);
  101024. this.type_ = type3 || TYPE_SHARED;
  101025. this.push = function(data) {
  101026. if (this.type_ !== TYPE_SHARED && data.type !== this.type_) {
  101027. return;
  101028. }
  101029. if (referenceDTS === void 0) {
  101030. referenceDTS = data.dts;
  101031. }
  101032. data.dts = handleRollover$1(data.dts, referenceDTS);
  101033. data.pts = handleRollover$1(data.pts, referenceDTS);
  101034. lastDTS = data.dts;
  101035. this.trigger("data", data);
  101036. };
  101037. this.flush = function() {
  101038. referenceDTS = lastDTS;
  101039. this.trigger("done");
  101040. };
  101041. this.endTimeline = function() {
  101042. this.flush();
  101043. this.trigger("endedtimeline");
  101044. };
  101045. this.discontinuity = function() {
  101046. referenceDTS = void 0;
  101047. lastDTS = void 0;
  101048. };
  101049. this.reset = function() {
  101050. this.discontinuity();
  101051. this.trigger("reset");
  101052. };
  101053. };
  101054. TimestampRolloverStream$1.prototype = new stream();
  101055. var timestampRolloverStream = {
  101056. TimestampRolloverStream: TimestampRolloverStream$1,
  101057. handleRollover: handleRollover$1
  101058. };
  101059. var percentEncode$1 = function percentEncode2(bytes, start2, end) {
  101060. var i2, result = "";
  101061. for (i2 = start2; i2 < end; i2++) {
  101062. result += "%" + ("00" + bytes[i2].toString(16)).slice(-2);
  101063. }
  101064. return result;
  101065. }, parseUtf8 = function parseUtf82(bytes, start2, end) {
  101066. return decodeURIComponent(percentEncode$1(bytes, start2, end));
  101067. }, parseIso88591$1 = function parseIso885912(bytes, start2, end) {
  101068. return unescape(percentEncode$1(bytes, start2, end));
  101069. }, parseSyncSafeInteger$1 = function parseSyncSafeInteger2(data) {
  101070. return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3];
  101071. }, tagParsers = {
  101072. TXXX: function TXXX(tag) {
  101073. var i2;
  101074. if (tag.data[0] !== 3) {
  101075. return;
  101076. }
  101077. for (i2 = 1; i2 < tag.data.length; i2++) {
  101078. if (tag.data[i2] === 0) {
  101079. tag.description = parseUtf8(tag.data, 1, i2);
  101080. tag.value = parseUtf8(tag.data, i2 + 1, tag.data.length).replace(/\0*$/, "");
  101081. break;
  101082. }
  101083. }
  101084. tag.data = tag.value;
  101085. },
  101086. WXXX: function WXXX(tag) {
  101087. var i2;
  101088. if (tag.data[0] !== 3) {
  101089. return;
  101090. }
  101091. for (i2 = 1; i2 < tag.data.length; i2++) {
  101092. if (tag.data[i2] === 0) {
  101093. tag.description = parseUtf8(tag.data, 1, i2);
  101094. tag.url = parseUtf8(tag.data, i2 + 1, tag.data.length);
  101095. break;
  101096. }
  101097. }
  101098. },
  101099. PRIV: function PRIV(tag) {
  101100. var i2;
  101101. for (i2 = 0; i2 < tag.data.length; i2++) {
  101102. if (tag.data[i2] === 0) {
  101103. tag.owner = parseIso88591$1(tag.data, 0, i2);
  101104. break;
  101105. }
  101106. }
  101107. tag.privateData = tag.data.subarray(i2 + 1);
  101108. tag.data = tag.privateData;
  101109. }
  101110. }, _MetadataStream;
  101111. _MetadataStream = function MetadataStream(options2) {
  101112. var settings = {
  101113. descriptor: options2 && options2.descriptor
  101114. }, tagSize = 0, buffer = [], bufferSize = 0, i2;
  101115. _MetadataStream.prototype.init.call(this);
  101116. this.dispatchType = streamTypes.METADATA_STREAM_TYPE.toString(16);
  101117. if (settings.descriptor) {
  101118. for (i2 = 0; i2 < settings.descriptor.length; i2++) {
  101119. this.dispatchType += ("00" + settings.descriptor[i2].toString(16)).slice(-2);
  101120. }
  101121. }
  101122. this.push = function(chunk) {
  101123. var tag, frameStart, frameSize, frame, i3, frameHeader;
  101124. if (chunk.type !== "timed-metadata") {
  101125. return;
  101126. }
  101127. if (chunk.dataAlignmentIndicator) {
  101128. bufferSize = 0;
  101129. buffer.length = 0;
  101130. }
  101131. if (buffer.length === 0 && (chunk.data.length < 10 || chunk.data[0] !== "I".charCodeAt(0) || chunk.data[1] !== "D".charCodeAt(0) || chunk.data[2] !== "3".charCodeAt(0))) {
  101132. this.trigger("log", {
  101133. level: "warn",
  101134. message: "Skipping unrecognized metadata packet"
  101135. });
  101136. return;
  101137. }
  101138. buffer.push(chunk);
  101139. bufferSize += chunk.data.byteLength;
  101140. if (buffer.length === 1) {
  101141. tagSize = parseSyncSafeInteger$1(chunk.data.subarray(6, 10));
  101142. tagSize += 10;
  101143. }
  101144. if (bufferSize < tagSize) {
  101145. return;
  101146. }
  101147. tag = {
  101148. data: new Uint8Array(tagSize),
  101149. frames: [],
  101150. pts: buffer[0].pts,
  101151. dts: buffer[0].dts
  101152. };
  101153. for (i3 = 0; i3 < tagSize; ) {
  101154. tag.data.set(buffer[0].data.subarray(0, tagSize - i3), i3);
  101155. i3 += buffer[0].data.byteLength;
  101156. bufferSize -= buffer[0].data.byteLength;
  101157. buffer.shift();
  101158. }
  101159. frameStart = 10;
  101160. if (tag.data[5] & 64) {
  101161. frameStart += 4;
  101162. frameStart += parseSyncSafeInteger$1(tag.data.subarray(10, 14));
  101163. tagSize -= parseSyncSafeInteger$1(tag.data.subarray(16, 20));
  101164. }
  101165. do {
  101166. frameSize = parseSyncSafeInteger$1(tag.data.subarray(frameStart + 4, frameStart + 8));
  101167. if (frameSize < 1) {
  101168. this.trigger("log", {
  101169. level: "warn",
  101170. message: "Malformed ID3 frame encountered. Skipping metadata parsing."
  101171. });
  101172. return;
  101173. }
  101174. frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]);
  101175. frame = {
  101176. id: frameHeader,
  101177. data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10)
  101178. };
  101179. frame.key = frame.id;
  101180. if (tagParsers[frame.id]) {
  101181. tagParsers[frame.id](frame);
  101182. if (frame.owner === "com.apple.streaming.transportStreamTimestamp") {
  101183. var d2 = frame.data, size = (d2[3] & 1) << 30 | d2[4] << 22 | d2[5] << 14 | d2[6] << 6 | d2[7] >>> 2;
  101184. size *= 4;
  101185. size += d2[7] & 3;
  101186. frame.timeStamp = size;
  101187. if (tag.pts === void 0 && tag.dts === void 0) {
  101188. tag.pts = frame.timeStamp;
  101189. tag.dts = frame.timeStamp;
  101190. }
  101191. this.trigger("timestamp", frame);
  101192. }
  101193. }
  101194. tag.frames.push(frame);
  101195. frameStart += 10;
  101196. frameStart += frameSize;
  101197. } while (frameStart < tagSize);
  101198. this.trigger("data", tag);
  101199. };
  101200. };
  101201. _MetadataStream.prototype = new stream();
  101202. var metadataStream = _MetadataStream;
  101203. var TimestampRolloverStream = timestampRolloverStream.TimestampRolloverStream;
  101204. var _TransportPacketStream, _TransportParseStream, _ElementaryStream;
  101205. var MP2T_PACKET_LENGTH$1 = 188, SYNC_BYTE$1 = 71;
  101206. _TransportPacketStream = function TransportPacketStream() {
  101207. var buffer = new Uint8Array(MP2T_PACKET_LENGTH$1), bytesInBuffer = 0;
  101208. _TransportPacketStream.prototype.init.call(this);
  101209. this.push = function(bytes) {
  101210. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH$1, everything;
  101211. if (bytesInBuffer) {
  101212. everything = new Uint8Array(bytes.byteLength + bytesInBuffer);
  101213. everything.set(buffer.subarray(0, bytesInBuffer));
  101214. everything.set(bytes, bytesInBuffer);
  101215. bytesInBuffer = 0;
  101216. } else {
  101217. everything = bytes;
  101218. }
  101219. while (endIndex < everything.byteLength) {
  101220. if (everything[startIndex] === SYNC_BYTE$1 && everything[endIndex] === SYNC_BYTE$1) {
  101221. this.trigger("data", everything.subarray(startIndex, endIndex));
  101222. startIndex += MP2T_PACKET_LENGTH$1;
  101223. endIndex += MP2T_PACKET_LENGTH$1;
  101224. continue;
  101225. }
  101226. startIndex++;
  101227. endIndex++;
  101228. }
  101229. if (startIndex < everything.byteLength) {
  101230. buffer.set(everything.subarray(startIndex), 0);
  101231. bytesInBuffer = everything.byteLength - startIndex;
  101232. }
  101233. };
  101234. this.flush = function() {
  101235. if (bytesInBuffer === MP2T_PACKET_LENGTH$1 && buffer[0] === SYNC_BYTE$1) {
  101236. this.trigger("data", buffer);
  101237. bytesInBuffer = 0;
  101238. }
  101239. this.trigger("done");
  101240. };
  101241. this.endTimeline = function() {
  101242. this.flush();
  101243. this.trigger("endedtimeline");
  101244. };
  101245. this.reset = function() {
  101246. bytesInBuffer = 0;
  101247. this.trigger("reset");
  101248. };
  101249. };
  101250. _TransportPacketStream.prototype = new stream();
  101251. _TransportParseStream = function TransportParseStream() {
  101252. var parsePsi, parsePat2, parsePmt2, self2;
  101253. _TransportParseStream.prototype.init.call(this);
  101254. self2 = this;
  101255. this.packetsWaitingForPmt = [];
  101256. this.programMapTable = void 0;
  101257. parsePsi = function parsePsi2(payload, psi) {
  101258. var offset = 0;
  101259. if (psi.payloadUnitStartIndicator) {
  101260. offset += payload[offset] + 1;
  101261. }
  101262. if (psi.type === "pat") {
  101263. parsePat2(payload.subarray(offset), psi);
  101264. } else {
  101265. parsePmt2(payload.subarray(offset), psi);
  101266. }
  101267. };
  101268. parsePat2 = function parsePat3(payload, pat) {
  101269. pat.section_number = payload[7];
  101270. pat.last_section_number = payload[8];
  101271. self2.pmtPid = (payload[10] & 31) << 8 | payload[11];
  101272. pat.pmtPid = self2.pmtPid;
  101273. };
  101274. parsePmt2 = function parsePmt3(payload, pmt) {
  101275. var sectionLength, tableEnd, programInfoLength, offset;
  101276. if (!(payload[5] & 1)) {
  101277. return;
  101278. }
  101279. self2.programMapTable = {
  101280. video: null,
  101281. audio: null,
  101282. "timed-metadata": {}
  101283. };
  101284. sectionLength = (payload[1] & 15) << 8 | payload[2];
  101285. tableEnd = 3 + sectionLength - 4;
  101286. programInfoLength = (payload[10] & 15) << 8 | payload[11];
  101287. offset = 12 + programInfoLength;
  101288. while (offset < tableEnd) {
  101289. var streamType = payload[offset];
  101290. var pid = (payload[offset + 1] & 31) << 8 | payload[offset + 2];
  101291. if (streamType === streamTypes.H264_STREAM_TYPE && self2.programMapTable.video === null) {
  101292. self2.programMapTable.video = pid;
  101293. } else if (streamType === streamTypes.ADTS_STREAM_TYPE && self2.programMapTable.audio === null) {
  101294. self2.programMapTable.audio = pid;
  101295. } else if (streamType === streamTypes.METADATA_STREAM_TYPE) {
  101296. self2.programMapTable["timed-metadata"][pid] = streamType;
  101297. }
  101298. offset += ((payload[offset + 3] & 15) << 8 | payload[offset + 4]) + 5;
  101299. }
  101300. pmt.programMapTable = self2.programMapTable;
  101301. };
  101302. this.push = function(packet) {
  101303. var result = {}, offset = 4;
  101304. result.payloadUnitStartIndicator = !!(packet[1] & 64);
  101305. result.pid = packet[1] & 31;
  101306. result.pid <<= 8;
  101307. result.pid |= packet[2];
  101308. if ((packet[3] & 48) >>> 4 > 1) {
  101309. offset += packet[offset] + 1;
  101310. }
  101311. if (result.pid === 0) {
  101312. result.type = "pat";
  101313. parsePsi(packet.subarray(offset), result);
  101314. this.trigger("data", result);
  101315. } else if (result.pid === this.pmtPid) {
  101316. result.type = "pmt";
  101317. parsePsi(packet.subarray(offset), result);
  101318. this.trigger("data", result);
  101319. while (this.packetsWaitingForPmt.length) {
  101320. this.processPes_.apply(this, this.packetsWaitingForPmt.shift());
  101321. }
  101322. } else if (this.programMapTable === void 0) {
  101323. this.packetsWaitingForPmt.push([packet, offset, result]);
  101324. } else {
  101325. this.processPes_(packet, offset, result);
  101326. }
  101327. };
  101328. this.processPes_ = function(packet, offset, result) {
  101329. if (result.pid === this.programMapTable.video) {
  101330. result.streamType = streamTypes.H264_STREAM_TYPE;
  101331. } else if (result.pid === this.programMapTable.audio) {
  101332. result.streamType = streamTypes.ADTS_STREAM_TYPE;
  101333. } else {
  101334. result.streamType = this.programMapTable["timed-metadata"][result.pid];
  101335. }
  101336. result.type = "pes";
  101337. result.data = packet.subarray(offset);
  101338. this.trigger("data", result);
  101339. };
  101340. };
  101341. _TransportParseStream.prototype = new stream();
  101342. _TransportParseStream.STREAM_TYPES = {
  101343. h264: 27,
  101344. adts: 15
  101345. };
  101346. _ElementaryStream = function ElementaryStream() {
  101347. var self2 = this, segmentHadPmt = false, video = {
  101348. data: [],
  101349. size: 0
  101350. }, audio = {
  101351. data: [],
  101352. size: 0
  101353. }, timedMetadata = {
  101354. data: [],
  101355. size: 0
  101356. }, programMapTable, parsePes = function parsePes2(payload, pes) {
  101357. var ptsDtsFlags;
  101358. var startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2];
  101359. pes.data = new Uint8Array();
  101360. if (startPrefix !== 1) {
  101361. return;
  101362. }
  101363. pes.packetLength = 6 + (payload[4] << 8 | payload[5]);
  101364. pes.dataAlignmentIndicator = (payload[6] & 4) !== 0;
  101365. ptsDtsFlags = payload[7];
  101366. if (ptsDtsFlags & 192) {
  101367. pes.pts = (payload[9] & 14) << 27 | (payload[10] & 255) << 20 | (payload[11] & 254) << 12 | (payload[12] & 255) << 5 | (payload[13] & 254) >>> 3;
  101368. pes.pts *= 4;
  101369. pes.pts += (payload[13] & 6) >>> 1;
  101370. pes.dts = pes.pts;
  101371. if (ptsDtsFlags & 64) {
  101372. pes.dts = (payload[14] & 14) << 27 | (payload[15] & 255) << 20 | (payload[16] & 254) << 12 | (payload[17] & 255) << 5 | (payload[18] & 254) >>> 3;
  101373. pes.dts *= 4;
  101374. pes.dts += (payload[18] & 6) >>> 1;
  101375. }
  101376. }
  101377. pes.data = payload.subarray(9 + payload[8]);
  101378. }, flushStream = function flushStream2(stream2, type3, forceFlush) {
  101379. var packetData = new Uint8Array(stream2.size), event2 = {
  101380. type: type3
  101381. }, i2 = 0, offset = 0, packetFlushable = false, fragment;
  101382. if (!stream2.data.length || stream2.size < 9) {
  101383. return;
  101384. }
  101385. event2.trackId = stream2.data[0].pid;
  101386. for (i2 = 0; i2 < stream2.data.length; i2++) {
  101387. fragment = stream2.data[i2];
  101388. packetData.set(fragment.data, offset);
  101389. offset += fragment.data.byteLength;
  101390. }
  101391. parsePes(packetData, event2);
  101392. packetFlushable = type3 === "video" || event2.packetLength <= stream2.size;
  101393. if (forceFlush || packetFlushable) {
  101394. stream2.size = 0;
  101395. stream2.data.length = 0;
  101396. }
  101397. if (packetFlushable) {
  101398. self2.trigger("data", event2);
  101399. }
  101400. };
  101401. _ElementaryStream.prototype.init.call(this);
  101402. this.push = function(data) {
  101403. ({
  101404. pat: function pat() {
  101405. },
  101406. pes: function pes() {
  101407. var stream2, streamType;
  101408. switch (data.streamType) {
  101409. case streamTypes.H264_STREAM_TYPE:
  101410. stream2 = video;
  101411. streamType = "video";
  101412. break;
  101413. case streamTypes.ADTS_STREAM_TYPE:
  101414. stream2 = audio;
  101415. streamType = "audio";
  101416. break;
  101417. case streamTypes.METADATA_STREAM_TYPE:
  101418. stream2 = timedMetadata;
  101419. streamType = "timed-metadata";
  101420. break;
  101421. default:
  101422. return;
  101423. }
  101424. if (data.payloadUnitStartIndicator) {
  101425. flushStream(stream2, streamType, true);
  101426. }
  101427. stream2.data.push(data);
  101428. stream2.size += data.data.byteLength;
  101429. },
  101430. pmt: function pmt() {
  101431. var event2 = {
  101432. type: "metadata",
  101433. tracks: []
  101434. };
  101435. programMapTable = data.programMapTable;
  101436. if (programMapTable.video !== null) {
  101437. event2.tracks.push({
  101438. timelineStartInfo: {
  101439. baseMediaDecodeTime: 0
  101440. },
  101441. id: +programMapTable.video,
  101442. codec: "avc",
  101443. type: "video"
  101444. });
  101445. }
  101446. if (programMapTable.audio !== null) {
  101447. event2.tracks.push({
  101448. timelineStartInfo: {
  101449. baseMediaDecodeTime: 0
  101450. },
  101451. id: +programMapTable.audio,
  101452. codec: "adts",
  101453. type: "audio"
  101454. });
  101455. }
  101456. segmentHadPmt = true;
  101457. self2.trigger("data", event2);
  101458. }
  101459. })[data.type]();
  101460. };
  101461. this.reset = function() {
  101462. video.size = 0;
  101463. video.data.length = 0;
  101464. audio.size = 0;
  101465. audio.data.length = 0;
  101466. this.trigger("reset");
  101467. };
  101468. this.flushStreams_ = function() {
  101469. flushStream(video, "video");
  101470. flushStream(audio, "audio");
  101471. flushStream(timedMetadata, "timed-metadata");
  101472. };
  101473. this.flush = function() {
  101474. if (!segmentHadPmt && programMapTable) {
  101475. var pmt = {
  101476. type: "metadata",
  101477. tracks: []
  101478. };
  101479. if (programMapTable.video !== null) {
  101480. pmt.tracks.push({
  101481. timelineStartInfo: {
  101482. baseMediaDecodeTime: 0
  101483. },
  101484. id: +programMapTable.video,
  101485. codec: "avc",
  101486. type: "video"
  101487. });
  101488. }
  101489. if (programMapTable.audio !== null) {
  101490. pmt.tracks.push({
  101491. timelineStartInfo: {
  101492. baseMediaDecodeTime: 0
  101493. },
  101494. id: +programMapTable.audio,
  101495. codec: "adts",
  101496. type: "audio"
  101497. });
  101498. }
  101499. self2.trigger("data", pmt);
  101500. }
  101501. segmentHadPmt = false;
  101502. this.flushStreams_();
  101503. this.trigger("done");
  101504. };
  101505. };
  101506. _ElementaryStream.prototype = new stream();
  101507. var m2ts = {
  101508. PAT_PID: 0,
  101509. MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH$1,
  101510. TransportPacketStream: _TransportPacketStream,
  101511. TransportParseStream: _TransportParseStream,
  101512. ElementaryStream: _ElementaryStream,
  101513. TimestampRolloverStream,
  101514. CaptionStream: captionStream.CaptionStream,
  101515. Cea608Stream: captionStream.Cea608Stream,
  101516. Cea708Stream: captionStream.Cea708Stream,
  101517. MetadataStream: metadataStream
  101518. };
  101519. for (var type2 in streamTypes) {
  101520. if (streamTypes.hasOwnProperty(type2)) {
  101521. m2ts[type2] = streamTypes[type2];
  101522. }
  101523. }
  101524. var m2ts_1 = m2ts;
  101525. var ONE_SECOND_IN_TS$2 = clock2.ONE_SECOND_IN_TS;
  101526. var _AdtsStream;
  101527. var ADTS_SAMPLING_FREQUENCIES$1 = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
  101528. _AdtsStream = function AdtsStream(handlePartialSegments) {
  101529. var buffer, frameNum = 0;
  101530. _AdtsStream.prototype.init.call(this);
  101531. this.skipWarn_ = function(start2, end) {
  101532. this.trigger("log", {
  101533. level: "warn",
  101534. message: "adts skiping bytes " + start2 + " to " + end + " in frame " + frameNum + " outside syncword"
  101535. });
  101536. };
  101537. this.push = function(packet) {
  101538. var i2 = 0, frameLength, protectionSkipBytes, oldBuffer, sampleCount, adtsFrameDuration;
  101539. if (!handlePartialSegments) {
  101540. frameNum = 0;
  101541. }
  101542. if (packet.type !== "audio") {
  101543. return;
  101544. }
  101545. if (buffer && buffer.length) {
  101546. oldBuffer = buffer;
  101547. buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength);
  101548. buffer.set(oldBuffer);
  101549. buffer.set(packet.data, oldBuffer.byteLength);
  101550. } else {
  101551. buffer = packet.data;
  101552. }
  101553. var skip;
  101554. while (i2 + 7 < buffer.length) {
  101555. if (buffer[i2] !== 255 || (buffer[i2 + 1] & 246) !== 240) {
  101556. if (typeof skip !== "number") {
  101557. skip = i2;
  101558. }
  101559. i2++;
  101560. continue;
  101561. }
  101562. if (typeof skip === "number") {
  101563. this.skipWarn_(skip, i2);
  101564. skip = null;
  101565. }
  101566. protectionSkipBytes = (~buffer[i2 + 1] & 1) * 2;
  101567. frameLength = (buffer[i2 + 3] & 3) << 11 | buffer[i2 + 4] << 3 | (buffer[i2 + 5] & 224) >> 5;
  101568. sampleCount = ((buffer[i2 + 6] & 3) + 1) * 1024;
  101569. adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS$2 / ADTS_SAMPLING_FREQUENCIES$1[(buffer[i2 + 2] & 60) >>> 2];
  101570. if (buffer.byteLength - i2 < frameLength) {
  101571. break;
  101572. }
  101573. this.trigger("data", {
  101574. pts: packet.pts + frameNum * adtsFrameDuration,
  101575. dts: packet.dts + frameNum * adtsFrameDuration,
  101576. sampleCount,
  101577. audioobjecttype: (buffer[i2 + 2] >>> 6 & 3) + 1,
  101578. channelcount: (buffer[i2 + 2] & 1) << 2 | (buffer[i2 + 3] & 192) >>> 6,
  101579. samplerate: ADTS_SAMPLING_FREQUENCIES$1[(buffer[i2 + 2] & 60) >>> 2],
  101580. samplingfrequencyindex: (buffer[i2 + 2] & 60) >>> 2,
  101581. samplesize: 16,
  101582. data: buffer.subarray(i2 + 7 + protectionSkipBytes, i2 + frameLength)
  101583. });
  101584. frameNum++;
  101585. i2 += frameLength;
  101586. }
  101587. if (typeof skip === "number") {
  101588. this.skipWarn_(skip, i2);
  101589. skip = null;
  101590. }
  101591. buffer = buffer.subarray(i2);
  101592. };
  101593. this.flush = function() {
  101594. frameNum = 0;
  101595. this.trigger("done");
  101596. };
  101597. this.reset = function() {
  101598. buffer = void 0;
  101599. this.trigger("reset");
  101600. };
  101601. this.endTimeline = function() {
  101602. buffer = void 0;
  101603. this.trigger("endedtimeline");
  101604. };
  101605. };
  101606. _AdtsStream.prototype = new stream();
  101607. var adts = _AdtsStream;
  101608. var ExpGolomb;
  101609. ExpGolomb = function ExpGolomb2(workingData) {
  101610. var workingBytesAvailable = workingData.byteLength, workingWord = 0, workingBitsAvailable = 0;
  101611. this.length = function() {
  101612. return 8 * workingBytesAvailable;
  101613. };
  101614. this.bitsAvailable = function() {
  101615. return 8 * workingBytesAvailable + workingBitsAvailable;
  101616. };
  101617. this.loadWord = function() {
  101618. var position2 = workingData.byteLength - workingBytesAvailable, workingBytes = new Uint8Array(4), availableBytes = Math.min(4, workingBytesAvailable);
  101619. if (availableBytes === 0) {
  101620. throw new Error("no bytes available");
  101621. }
  101622. workingBytes.set(workingData.subarray(position2, position2 + availableBytes));
  101623. workingWord = new DataView(workingBytes.buffer).getUint32(0);
  101624. workingBitsAvailable = availableBytes * 8;
  101625. workingBytesAvailable -= availableBytes;
  101626. };
  101627. this.skipBits = function(count) {
  101628. var skipBytes;
  101629. if (workingBitsAvailable > count) {
  101630. workingWord <<= count;
  101631. workingBitsAvailable -= count;
  101632. } else {
  101633. count -= workingBitsAvailable;
  101634. skipBytes = Math.floor(count / 8);
  101635. count -= skipBytes * 8;
  101636. workingBytesAvailable -= skipBytes;
  101637. this.loadWord();
  101638. workingWord <<= count;
  101639. workingBitsAvailable -= count;
  101640. }
  101641. };
  101642. this.readBits = function(size) {
  101643. var bits = Math.min(workingBitsAvailable, size), valu = workingWord >>> 32 - bits;
  101644. workingBitsAvailable -= bits;
  101645. if (workingBitsAvailable > 0) {
  101646. workingWord <<= bits;
  101647. } else if (workingBytesAvailable > 0) {
  101648. this.loadWord();
  101649. }
  101650. bits = size - bits;
  101651. if (bits > 0) {
  101652. return valu << bits | this.readBits(bits);
  101653. }
  101654. return valu;
  101655. };
  101656. this.skipLeadingZeros = function() {
  101657. var leadingZeroCount;
  101658. for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) {
  101659. if ((workingWord & 2147483648 >>> leadingZeroCount) !== 0) {
  101660. workingWord <<= leadingZeroCount;
  101661. workingBitsAvailable -= leadingZeroCount;
  101662. return leadingZeroCount;
  101663. }
  101664. }
  101665. this.loadWord();
  101666. return leadingZeroCount + this.skipLeadingZeros();
  101667. };
  101668. this.skipUnsignedExpGolomb = function() {
  101669. this.skipBits(1 + this.skipLeadingZeros());
  101670. };
  101671. this.skipExpGolomb = function() {
  101672. this.skipBits(1 + this.skipLeadingZeros());
  101673. };
  101674. this.readUnsignedExpGolomb = function() {
  101675. var clz = this.skipLeadingZeros();
  101676. return this.readBits(clz + 1) - 1;
  101677. };
  101678. this.readExpGolomb = function() {
  101679. var valu = this.readUnsignedExpGolomb();
  101680. if (1 & valu) {
  101681. return 1 + valu >>> 1;
  101682. }
  101683. return -1 * (valu >>> 1);
  101684. };
  101685. this.readBoolean = function() {
  101686. return this.readBits(1) === 1;
  101687. };
  101688. this.readUnsignedByte = function() {
  101689. return this.readBits(8);
  101690. };
  101691. this.loadWord();
  101692. };
  101693. var expGolomb = ExpGolomb;
  101694. var _H264Stream, _NalByteStream;
  101695. var PROFILES_WITH_OPTIONAL_SPS_DATA;
  101696. _NalByteStream = function NalByteStream() {
  101697. var syncPoint = 0, i2, buffer;
  101698. _NalByteStream.prototype.init.call(this);
  101699. this.push = function(data) {
  101700. var swapBuffer;
  101701. if (!buffer) {
  101702. buffer = data.data;
  101703. } else {
  101704. swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength);
  101705. swapBuffer.set(buffer);
  101706. swapBuffer.set(data.data, buffer.byteLength);
  101707. buffer = swapBuffer;
  101708. }
  101709. var len = buffer.byteLength;
  101710. for (; syncPoint < len - 3; syncPoint++) {
  101711. if (buffer[syncPoint + 2] === 1) {
  101712. i2 = syncPoint + 5;
  101713. break;
  101714. }
  101715. }
  101716. while (i2 < len) {
  101717. switch (buffer[i2]) {
  101718. case 0:
  101719. if (buffer[i2 - 1] !== 0) {
  101720. i2 += 2;
  101721. break;
  101722. } else if (buffer[i2 - 2] !== 0) {
  101723. i2++;
  101724. break;
  101725. }
  101726. if (syncPoint + 3 !== i2 - 2) {
  101727. this.trigger("data", buffer.subarray(syncPoint + 3, i2 - 2));
  101728. }
  101729. do {
  101730. i2++;
  101731. } while (buffer[i2] !== 1 && i2 < len);
  101732. syncPoint = i2 - 2;
  101733. i2 += 3;
  101734. break;
  101735. case 1:
  101736. if (buffer[i2 - 1] !== 0 || buffer[i2 - 2] !== 0) {
  101737. i2 += 3;
  101738. break;
  101739. }
  101740. this.trigger("data", buffer.subarray(syncPoint + 3, i2 - 2));
  101741. syncPoint = i2 - 2;
  101742. i2 += 3;
  101743. break;
  101744. default:
  101745. i2 += 3;
  101746. break;
  101747. }
  101748. }
  101749. buffer = buffer.subarray(syncPoint);
  101750. i2 -= syncPoint;
  101751. syncPoint = 0;
  101752. };
  101753. this.reset = function() {
  101754. buffer = null;
  101755. syncPoint = 0;
  101756. this.trigger("reset");
  101757. };
  101758. this.flush = function() {
  101759. if (buffer && buffer.byteLength > 3) {
  101760. this.trigger("data", buffer.subarray(syncPoint + 3));
  101761. }
  101762. buffer = null;
  101763. syncPoint = 0;
  101764. this.trigger("done");
  101765. };
  101766. this.endTimeline = function() {
  101767. this.flush();
  101768. this.trigger("endedtimeline");
  101769. };
  101770. };
  101771. _NalByteStream.prototype = new stream();
  101772. PROFILES_WITH_OPTIONAL_SPS_DATA = {
  101773. 100: true,
  101774. 110: true,
  101775. 122: true,
  101776. 244: true,
  101777. 44: true,
  101778. 83: true,
  101779. 86: true,
  101780. 118: true,
  101781. 128: true,
  101782. 138: true,
  101783. 139: true,
  101784. 134: true
  101785. };
  101786. _H264Stream = function H264Stream2() {
  101787. var nalByteStream = new _NalByteStream(), self2, trackId, currentPts, currentDts, discardEmulationPreventionBytes5, readSequenceParameterSet, skipScalingList;
  101788. _H264Stream.prototype.init.call(this);
  101789. self2 = this;
  101790. this.push = function(packet) {
  101791. if (packet.type !== "video") {
  101792. return;
  101793. }
  101794. trackId = packet.trackId;
  101795. currentPts = packet.pts;
  101796. currentDts = packet.dts;
  101797. nalByteStream.push(packet);
  101798. };
  101799. nalByteStream.on("data", function(data) {
  101800. var event2 = {
  101801. trackId,
  101802. pts: currentPts,
  101803. dts: currentDts,
  101804. data,
  101805. nalUnitTypeCode: data[0] & 31
  101806. };
  101807. switch (event2.nalUnitTypeCode) {
  101808. case 5:
  101809. event2.nalUnitType = "slice_layer_without_partitioning_rbsp_idr";
  101810. break;
  101811. case 6:
  101812. event2.nalUnitType = "sei_rbsp";
  101813. event2.escapedRBSP = discardEmulationPreventionBytes5(data.subarray(1));
  101814. break;
  101815. case 7:
  101816. event2.nalUnitType = "seq_parameter_set_rbsp";
  101817. event2.escapedRBSP = discardEmulationPreventionBytes5(data.subarray(1));
  101818. event2.config = readSequenceParameterSet(event2.escapedRBSP);
  101819. break;
  101820. case 8:
  101821. event2.nalUnitType = "pic_parameter_set_rbsp";
  101822. break;
  101823. case 9:
  101824. event2.nalUnitType = "access_unit_delimiter_rbsp";
  101825. break;
  101826. }
  101827. self2.trigger("data", event2);
  101828. });
  101829. nalByteStream.on("done", function() {
  101830. self2.trigger("done");
  101831. });
  101832. nalByteStream.on("partialdone", function() {
  101833. self2.trigger("partialdone");
  101834. });
  101835. nalByteStream.on("reset", function() {
  101836. self2.trigger("reset");
  101837. });
  101838. nalByteStream.on("endedtimeline", function() {
  101839. self2.trigger("endedtimeline");
  101840. });
  101841. this.flush = function() {
  101842. nalByteStream.flush();
  101843. };
  101844. this.partialFlush = function() {
  101845. nalByteStream.partialFlush();
  101846. };
  101847. this.reset = function() {
  101848. nalByteStream.reset();
  101849. };
  101850. this.endTimeline = function() {
  101851. nalByteStream.endTimeline();
  101852. };
  101853. skipScalingList = function skipScalingList2(count, expGolombDecoder) {
  101854. var lastScale = 8, nextScale = 8, j, deltaScale;
  101855. for (j = 0; j < count; j++) {
  101856. if (nextScale !== 0) {
  101857. deltaScale = expGolombDecoder.readExpGolomb();
  101858. nextScale = (lastScale + deltaScale + 256) % 256;
  101859. }
  101860. lastScale = nextScale === 0 ? lastScale : nextScale;
  101861. }
  101862. };
  101863. discardEmulationPreventionBytes5 = function discardEmulationPreventionBytes6(data) {
  101864. var length = data.byteLength, emulationPreventionBytesPositions = [], i2 = 1, newLength, newData;
  101865. while (i2 < length - 2) {
  101866. if (data[i2] === 0 && data[i2 + 1] === 0 && data[i2 + 2] === 3) {
  101867. emulationPreventionBytesPositions.push(i2 + 2);
  101868. i2 += 2;
  101869. } else {
  101870. i2++;
  101871. }
  101872. }
  101873. if (emulationPreventionBytesPositions.length === 0) {
  101874. return data;
  101875. }
  101876. newLength = length - emulationPreventionBytesPositions.length;
  101877. newData = new Uint8Array(newLength);
  101878. var sourceIndex = 0;
  101879. for (i2 = 0; i2 < newLength; sourceIndex++, i2++) {
  101880. if (sourceIndex === emulationPreventionBytesPositions[0]) {
  101881. sourceIndex++;
  101882. emulationPreventionBytesPositions.shift();
  101883. }
  101884. newData[i2] = data[sourceIndex];
  101885. }
  101886. return newData;
  101887. };
  101888. readSequenceParameterSet = function readSequenceParameterSet2(data) {
  101889. var frameCropLeftOffset = 0, frameCropRightOffset = 0, frameCropTopOffset = 0, frameCropBottomOffset = 0, expGolombDecoder, profileIdc, levelIdc, profileCompatibility, chromaFormatIdc, picOrderCntType, numRefFramesInPicOrderCntCycle, picWidthInMbsMinus1, picHeightInMapUnitsMinus1, frameMbsOnlyFlag, scalingListCount, sarRatio = [1, 1], aspectRatioIdc, i2;
  101890. expGolombDecoder = new expGolomb(data);
  101891. profileIdc = expGolombDecoder.readUnsignedByte();
  101892. profileCompatibility = expGolombDecoder.readUnsignedByte();
  101893. levelIdc = expGolombDecoder.readUnsignedByte();
  101894. expGolombDecoder.skipUnsignedExpGolomb();
  101895. if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) {
  101896. chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb();
  101897. if (chromaFormatIdc === 3) {
  101898. expGolombDecoder.skipBits(1);
  101899. }
  101900. expGolombDecoder.skipUnsignedExpGolomb();
  101901. expGolombDecoder.skipUnsignedExpGolomb();
  101902. expGolombDecoder.skipBits(1);
  101903. if (expGolombDecoder.readBoolean()) {
  101904. scalingListCount = chromaFormatIdc !== 3 ? 8 : 12;
  101905. for (i2 = 0; i2 < scalingListCount; i2++) {
  101906. if (expGolombDecoder.readBoolean()) {
  101907. if (i2 < 6) {
  101908. skipScalingList(16, expGolombDecoder);
  101909. } else {
  101910. skipScalingList(64, expGolombDecoder);
  101911. }
  101912. }
  101913. }
  101914. }
  101915. }
  101916. expGolombDecoder.skipUnsignedExpGolomb();
  101917. picOrderCntType = expGolombDecoder.readUnsignedExpGolomb();
  101918. if (picOrderCntType === 0) {
  101919. expGolombDecoder.readUnsignedExpGolomb();
  101920. } else if (picOrderCntType === 1) {
  101921. expGolombDecoder.skipBits(1);
  101922. expGolombDecoder.skipExpGolomb();
  101923. expGolombDecoder.skipExpGolomb();
  101924. numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb();
  101925. for (i2 = 0; i2 < numRefFramesInPicOrderCntCycle; i2++) {
  101926. expGolombDecoder.skipExpGolomb();
  101927. }
  101928. }
  101929. expGolombDecoder.skipUnsignedExpGolomb();
  101930. expGolombDecoder.skipBits(1);
  101931. picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb();
  101932. picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb();
  101933. frameMbsOnlyFlag = expGolombDecoder.readBits(1);
  101934. if (frameMbsOnlyFlag === 0) {
  101935. expGolombDecoder.skipBits(1);
  101936. }
  101937. expGolombDecoder.skipBits(1);
  101938. if (expGolombDecoder.readBoolean()) {
  101939. frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb();
  101940. frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb();
  101941. frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb();
  101942. frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb();
  101943. }
  101944. if (expGolombDecoder.readBoolean()) {
  101945. if (expGolombDecoder.readBoolean()) {
  101946. aspectRatioIdc = expGolombDecoder.readUnsignedByte();
  101947. switch (aspectRatioIdc) {
  101948. case 1:
  101949. sarRatio = [1, 1];
  101950. break;
  101951. case 2:
  101952. sarRatio = [12, 11];
  101953. break;
  101954. case 3:
  101955. sarRatio = [10, 11];
  101956. break;
  101957. case 4:
  101958. sarRatio = [16, 11];
  101959. break;
  101960. case 5:
  101961. sarRatio = [40, 33];
  101962. break;
  101963. case 6:
  101964. sarRatio = [24, 11];
  101965. break;
  101966. case 7:
  101967. sarRatio = [20, 11];
  101968. break;
  101969. case 8:
  101970. sarRatio = [32, 11];
  101971. break;
  101972. case 9:
  101973. sarRatio = [80, 33];
  101974. break;
  101975. case 10:
  101976. sarRatio = [18, 11];
  101977. break;
  101978. case 11:
  101979. sarRatio = [15, 11];
  101980. break;
  101981. case 12:
  101982. sarRatio = [64, 33];
  101983. break;
  101984. case 13:
  101985. sarRatio = [160, 99];
  101986. break;
  101987. case 14:
  101988. sarRatio = [4, 3];
  101989. break;
  101990. case 15:
  101991. sarRatio = [3, 2];
  101992. break;
  101993. case 16:
  101994. sarRatio = [2, 1];
  101995. break;
  101996. case 255: {
  101997. sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()];
  101998. break;
  101999. }
  102000. }
  102001. if (sarRatio) {
  102002. sarRatio[0] / sarRatio[1];
  102003. }
  102004. }
  102005. }
  102006. return {
  102007. profileIdc,
  102008. levelIdc,
  102009. profileCompatibility,
  102010. width: (picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2,
  102011. height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2,
  102012. sarRatio
  102013. };
  102014. };
  102015. };
  102016. _H264Stream.prototype = new stream();
  102017. var h2643 = {
  102018. H264Stream: _H264Stream,
  102019. NalByteStream: _NalByteStream
  102020. };
  102021. var ADTS_SAMPLING_FREQUENCIES = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
  102022. var parseId3TagSize = function parseId3TagSize2(header, byteIndex) {
  102023. var returnSize = header[byteIndex + 6] << 21 | header[byteIndex + 7] << 14 | header[byteIndex + 8] << 7 | header[byteIndex + 9], flags = header[byteIndex + 5], footerPresent = (flags & 16) >> 4;
  102024. returnSize = returnSize >= 0 ? returnSize : 0;
  102025. if (footerPresent) {
  102026. return returnSize + 20;
  102027. }
  102028. return returnSize + 10;
  102029. };
  102030. var getId3Offset4 = function getId3Offset5(data, offset) {
  102031. if (data.length - offset < 10 || data[offset] !== "I".charCodeAt(0) || data[offset + 1] !== "D".charCodeAt(0) || data[offset + 2] !== "3".charCodeAt(0)) {
  102032. return offset;
  102033. }
  102034. offset += parseId3TagSize(data, offset);
  102035. return getId3Offset5(data, offset);
  102036. };
  102037. var isLikelyAacData$1 = function isLikelyAacData2(data) {
  102038. var offset = getId3Offset4(data, 0);
  102039. return data.length >= offset + 2 && (data[offset] & 255) === 255 && (data[offset + 1] & 240) === 240 && (data[offset + 1] & 22) === 16;
  102040. };
  102041. var parseSyncSafeInteger = function parseSyncSafeInteger2(data) {
  102042. return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3];
  102043. };
  102044. var percentEncode = function percentEncode2(bytes, start2, end) {
  102045. var i2, result = "";
  102046. for (i2 = start2; i2 < end; i2++) {
  102047. result += "%" + ("00" + bytes[i2].toString(16)).slice(-2);
  102048. }
  102049. return result;
  102050. };
  102051. var parseIso88591 = function parseIso885912(bytes, start2, end) {
  102052. return unescape(percentEncode(bytes, start2, end));
  102053. };
  102054. var parseAdtsSize = function parseAdtsSize2(header, byteIndex) {
  102055. var lowThree = (header[byteIndex + 5] & 224) >> 5, middle = header[byteIndex + 4] << 3, highTwo = header[byteIndex + 3] & 3 << 11;
  102056. return highTwo | middle | lowThree;
  102057. };
  102058. var parseType$2 = function parseType2(header, byteIndex) {
  102059. if (header[byteIndex] === "I".charCodeAt(0) && header[byteIndex + 1] === "D".charCodeAt(0) && header[byteIndex + 2] === "3".charCodeAt(0)) {
  102060. return "timed-metadata";
  102061. } else if (header[byteIndex] & true && (header[byteIndex + 1] & 240) === 240) {
  102062. return "audio";
  102063. }
  102064. return null;
  102065. };
  102066. var parseSampleRate = function parseSampleRate2(packet) {
  102067. var i2 = 0;
  102068. while (i2 + 5 < packet.length) {
  102069. if (packet[i2] !== 255 || (packet[i2 + 1] & 246) !== 240) {
  102070. i2++;
  102071. continue;
  102072. }
  102073. return ADTS_SAMPLING_FREQUENCIES[(packet[i2 + 2] & 60) >>> 2];
  102074. }
  102075. return null;
  102076. };
  102077. var parseAacTimestamp = function parseAacTimestamp2(packet) {
  102078. var frameStart, frameSize, frame, frameHeader;
  102079. frameStart = 10;
  102080. if (packet[5] & 64) {
  102081. frameStart += 4;
  102082. frameStart += parseSyncSafeInteger(packet.subarray(10, 14));
  102083. }
  102084. do {
  102085. frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8));
  102086. if (frameSize < 1) {
  102087. return null;
  102088. }
  102089. frameHeader = String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3]);
  102090. if (frameHeader === "PRIV") {
  102091. frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10);
  102092. for (var i2 = 0; i2 < frame.byteLength; i2++) {
  102093. if (frame[i2] === 0) {
  102094. var owner = parseIso88591(frame, 0, i2);
  102095. if (owner === "com.apple.streaming.transportStreamTimestamp") {
  102096. var d2 = frame.subarray(i2 + 1);
  102097. var size = (d2[3] & 1) << 30 | d2[4] << 22 | d2[5] << 14 | d2[6] << 6 | d2[7] >>> 2;
  102098. size *= 4;
  102099. size += d2[7] & 3;
  102100. return size;
  102101. }
  102102. break;
  102103. }
  102104. }
  102105. }
  102106. frameStart += 10;
  102107. frameStart += frameSize;
  102108. } while (frameStart < packet.byteLength);
  102109. return null;
  102110. };
  102111. var utils2 = {
  102112. isLikelyAacData: isLikelyAacData$1,
  102113. parseId3TagSize,
  102114. parseAdtsSize,
  102115. parseType: parseType$2,
  102116. parseSampleRate,
  102117. parseAacTimestamp
  102118. };
  102119. var _AacStream;
  102120. _AacStream = function AacStream() {
  102121. var everything = new Uint8Array(), timeStamp = 0;
  102122. _AacStream.prototype.init.call(this);
  102123. this.setTimestamp = function(timestamp) {
  102124. timeStamp = timestamp;
  102125. };
  102126. this.push = function(bytes) {
  102127. var frameSize = 0, byteIndex = 0, bytesLeft, chunk, packet, tempLength;
  102128. if (everything.length) {
  102129. tempLength = everything.length;
  102130. everything = new Uint8Array(bytes.byteLength + tempLength);
  102131. everything.set(everything.subarray(0, tempLength));
  102132. everything.set(bytes, tempLength);
  102133. } else {
  102134. everything = bytes;
  102135. }
  102136. while (everything.length - byteIndex >= 3) {
  102137. if (everything[byteIndex] === "I".charCodeAt(0) && everything[byteIndex + 1] === "D".charCodeAt(0) && everything[byteIndex + 2] === "3".charCodeAt(0)) {
  102138. if (everything.length - byteIndex < 10) {
  102139. break;
  102140. }
  102141. frameSize = utils2.parseId3TagSize(everything, byteIndex);
  102142. if (byteIndex + frameSize > everything.length) {
  102143. break;
  102144. }
  102145. chunk = {
  102146. type: "timed-metadata",
  102147. data: everything.subarray(byteIndex, byteIndex + frameSize)
  102148. };
  102149. this.trigger("data", chunk);
  102150. byteIndex += frameSize;
  102151. continue;
  102152. } else if ((everything[byteIndex] & 255) === 255 && (everything[byteIndex + 1] & 240) === 240) {
  102153. if (everything.length - byteIndex < 7) {
  102154. break;
  102155. }
  102156. frameSize = utils2.parseAdtsSize(everything, byteIndex);
  102157. if (byteIndex + frameSize > everything.length) {
  102158. break;
  102159. }
  102160. packet = {
  102161. type: "audio",
  102162. data: everything.subarray(byteIndex, byteIndex + frameSize),
  102163. pts: timeStamp,
  102164. dts: timeStamp
  102165. };
  102166. this.trigger("data", packet);
  102167. byteIndex += frameSize;
  102168. continue;
  102169. }
  102170. byteIndex++;
  102171. }
  102172. bytesLeft = everything.length - byteIndex;
  102173. if (bytesLeft > 0) {
  102174. everything = everything.subarray(byteIndex);
  102175. } else {
  102176. everything = new Uint8Array();
  102177. }
  102178. };
  102179. this.reset = function() {
  102180. everything = new Uint8Array();
  102181. this.trigger("reset");
  102182. };
  102183. this.endTimeline = function() {
  102184. everything = new Uint8Array();
  102185. this.trigger("endedtimeline");
  102186. };
  102187. };
  102188. _AacStream.prototype = new stream();
  102189. var aac3 = _AacStream;
  102190. var AUDIO_PROPERTIES = ["audioobjecttype", "channelcount", "samplerate", "samplingfrequencyindex", "samplesize"];
  102191. var audioProperties = AUDIO_PROPERTIES;
  102192. var VIDEO_PROPERTIES = ["width", "height", "profileIdc", "levelIdc", "profileCompatibility", "sarRatio"];
  102193. var videoProperties = VIDEO_PROPERTIES;
  102194. var H264Stream = h2643.H264Stream;
  102195. var isLikelyAacData = utils2.isLikelyAacData;
  102196. var ONE_SECOND_IN_TS$12 = clock2.ONE_SECOND_IN_TS;
  102197. var _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream;
  102198. var retriggerForStream = function retriggerForStream2(key, event2) {
  102199. event2.stream = key;
  102200. this.trigger("log", event2);
  102201. };
  102202. var addPipelineLogRetriggers = function addPipelineLogRetriggers2(transmuxer2, pipeline) {
  102203. var keys3 = Object.keys(pipeline);
  102204. for (var i2 = 0; i2 < keys3.length; i2++) {
  102205. var key = keys3[i2];
  102206. if (key === "headOfPipeline" || !pipeline[key].on) {
  102207. continue;
  102208. }
  102209. pipeline[key].on("log", retriggerForStream.bind(transmuxer2, key));
  102210. }
  102211. };
  102212. var arrayEquals = function arrayEquals2(a, b) {
  102213. var i2;
  102214. if (a.length !== b.length) {
  102215. return false;
  102216. }
  102217. for (i2 = 0; i2 < a.length; i2++) {
  102218. if (a[i2] !== b[i2]) {
  102219. return false;
  102220. }
  102221. }
  102222. return true;
  102223. };
  102224. var generateSegmentTimingInfo = function generateSegmentTimingInfo2(baseMediaDecodeTime, startDts, startPts, endDts, endPts, prependedContentDuration) {
  102225. var ptsOffsetFromDts = startPts - startDts, decodeDuration = endDts - startDts, presentationDuration = endPts - startPts;
  102226. return {
  102227. start: {
  102228. dts: baseMediaDecodeTime,
  102229. pts: baseMediaDecodeTime + ptsOffsetFromDts
  102230. },
  102231. end: {
  102232. dts: baseMediaDecodeTime + decodeDuration,
  102233. pts: baseMediaDecodeTime + presentationDuration
  102234. },
  102235. prependedContentDuration,
  102236. baseMediaDecodeTime
  102237. };
  102238. };
  102239. _AudioSegmentStream = function AudioSegmentStream(track, options2) {
  102240. var adtsFrames = [], sequenceNumber, earliestAllowedDts = 0, audioAppendStartTs = 0, videoBaseMediaDecodeTime = Infinity;
  102241. options2 = options2 || {};
  102242. sequenceNumber = options2.firstSequenceNumber || 0;
  102243. _AudioSegmentStream.prototype.init.call(this);
  102244. this.push = function(data) {
  102245. trackDecodeInfo.collectDtsInfo(track, data);
  102246. if (track) {
  102247. audioProperties.forEach(function(prop) {
  102248. track[prop] = data[prop];
  102249. });
  102250. }
  102251. adtsFrames.push(data);
  102252. };
  102253. this.setEarliestDts = function(earliestDts) {
  102254. earliestAllowedDts = earliestDts;
  102255. };
  102256. this.setVideoBaseMediaDecodeTime = function(baseMediaDecodeTime) {
  102257. videoBaseMediaDecodeTime = baseMediaDecodeTime;
  102258. };
  102259. this.setAudioAppendStart = function(timestamp) {
  102260. audioAppendStartTs = timestamp;
  102261. };
  102262. this.flush = function() {
  102263. var frames, moof2, mdat2, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed;
  102264. if (adtsFrames.length === 0) {
  102265. this.trigger("done", "AudioSegmentStream");
  102266. return;
  102267. }
  102268. frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts);
  102269. track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options2.keepOriginalTimestamps);
  102270. videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime);
  102271. track.samples = audioFrameUtils.generateSampleTable(frames);
  102272. mdat2 = mp4Generator.mdat(audioFrameUtils.concatenateFrameData(frames));
  102273. adtsFrames = [];
  102274. moof2 = mp4Generator.moof(sequenceNumber, [track]);
  102275. boxes = new Uint8Array(moof2.byteLength + mdat2.byteLength);
  102276. sequenceNumber++;
  102277. boxes.set(moof2);
  102278. boxes.set(mdat2, moof2.byteLength);
  102279. trackDecodeInfo.clearDtsInfo(track);
  102280. frameDuration = Math.ceil(ONE_SECOND_IN_TS$12 * 1024 / track.samplerate);
  102281. if (frames.length) {
  102282. segmentDuration = frames.length * frameDuration;
  102283. this.trigger("segmentTimingInfo", generateSegmentTimingInfo(
  102284. clock2.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate),
  102285. frames[0].dts,
  102286. frames[0].pts,
  102287. frames[0].dts + segmentDuration,
  102288. frames[0].pts + segmentDuration,
  102289. videoClockCyclesOfSilencePrefixed || 0
  102290. ));
  102291. this.trigger("timingInfo", {
  102292. start: frames[0].pts,
  102293. end: frames[0].pts + segmentDuration
  102294. });
  102295. }
  102296. this.trigger("data", {
  102297. track,
  102298. boxes
  102299. });
  102300. this.trigger("done", "AudioSegmentStream");
  102301. };
  102302. this.reset = function() {
  102303. trackDecodeInfo.clearDtsInfo(track);
  102304. adtsFrames = [];
  102305. this.trigger("reset");
  102306. };
  102307. };
  102308. _AudioSegmentStream.prototype = new stream();
  102309. _VideoSegmentStream = function VideoSegmentStream(track, options2) {
  102310. var sequenceNumber, nalUnits = [], gopsToAlignWith = [], config, pps;
  102311. options2 = options2 || {};
  102312. sequenceNumber = options2.firstSequenceNumber || 0;
  102313. _VideoSegmentStream.prototype.init.call(this);
  102314. delete track.minPTS;
  102315. this.gopCache_ = [];
  102316. this.push = function(nalUnit) {
  102317. trackDecodeInfo.collectDtsInfo(track, nalUnit);
  102318. if (nalUnit.nalUnitType === "seq_parameter_set_rbsp" && !config) {
  102319. config = nalUnit.config;
  102320. track.sps = [nalUnit.data];
  102321. videoProperties.forEach(function(prop) {
  102322. track[prop] = config[prop];
  102323. }, this);
  102324. }
  102325. if (nalUnit.nalUnitType === "pic_parameter_set_rbsp" && !pps) {
  102326. pps = nalUnit.data;
  102327. track.pps = [nalUnit.data];
  102328. }
  102329. nalUnits.push(nalUnit);
  102330. };
  102331. this.flush = function() {
  102332. var frames, gopForFusion, gops, moof2, mdat2, boxes, prependedContentDuration = 0, firstGop, lastGop;
  102333. while (nalUnits.length) {
  102334. if (nalUnits[0].nalUnitType === "access_unit_delimiter_rbsp") {
  102335. break;
  102336. }
  102337. nalUnits.shift();
  102338. }
  102339. if (nalUnits.length === 0) {
  102340. this.resetStream_();
  102341. this.trigger("done", "VideoSegmentStream");
  102342. return;
  102343. }
  102344. frames = frameUtils.groupNalsIntoFrames(nalUnits);
  102345. gops = frameUtils.groupFramesIntoGops(frames);
  102346. if (!gops[0][0].keyFrame) {
  102347. gopForFusion = this.getGopForFusion_(nalUnits[0], track);
  102348. if (gopForFusion) {
  102349. prependedContentDuration = gopForFusion.duration;
  102350. gops.unshift(gopForFusion);
  102351. gops.byteLength += gopForFusion.byteLength;
  102352. gops.nalCount += gopForFusion.nalCount;
  102353. gops.pts = gopForFusion.pts;
  102354. gops.dts = gopForFusion.dts;
  102355. gops.duration += gopForFusion.duration;
  102356. } else {
  102357. gops = frameUtils.extendFirstKeyFrame(gops);
  102358. }
  102359. }
  102360. if (gopsToAlignWith.length) {
  102361. var alignedGops;
  102362. if (options2.alignGopsAtEnd) {
  102363. alignedGops = this.alignGopsAtEnd_(gops);
  102364. } else {
  102365. alignedGops = this.alignGopsAtStart_(gops);
  102366. }
  102367. if (!alignedGops) {
  102368. this.gopCache_.unshift({
  102369. gop: gops.pop(),
  102370. pps: track.pps,
  102371. sps: track.sps
  102372. });
  102373. this.gopCache_.length = Math.min(6, this.gopCache_.length);
  102374. nalUnits = [];
  102375. this.resetStream_();
  102376. this.trigger("done", "VideoSegmentStream");
  102377. return;
  102378. }
  102379. trackDecodeInfo.clearDtsInfo(track);
  102380. gops = alignedGops;
  102381. }
  102382. trackDecodeInfo.collectDtsInfo(track, gops);
  102383. track.samples = frameUtils.generateSampleTable(gops);
  102384. mdat2 = mp4Generator.mdat(frameUtils.concatenateNalData(gops));
  102385. track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options2.keepOriginalTimestamps);
  102386. this.trigger("processedGopsInfo", gops.map(function(gop) {
  102387. return {
  102388. pts: gop.pts,
  102389. dts: gop.dts,
  102390. byteLength: gop.byteLength
  102391. };
  102392. }));
  102393. firstGop = gops[0];
  102394. lastGop = gops[gops.length - 1];
  102395. this.trigger("segmentTimingInfo", generateSegmentTimingInfo(track.baseMediaDecodeTime, firstGop.dts, firstGop.pts, lastGop.dts + lastGop.duration, lastGop.pts + lastGop.duration, prependedContentDuration));
  102396. this.trigger("timingInfo", {
  102397. start: gops[0].pts,
  102398. end: gops[gops.length - 1].pts + gops[gops.length - 1].duration
  102399. });
  102400. this.gopCache_.unshift({
  102401. gop: gops.pop(),
  102402. pps: track.pps,
  102403. sps: track.sps
  102404. });
  102405. this.gopCache_.length = Math.min(6, this.gopCache_.length);
  102406. nalUnits = [];
  102407. this.trigger("baseMediaDecodeTime", track.baseMediaDecodeTime);
  102408. this.trigger("timelineStartInfo", track.timelineStartInfo);
  102409. moof2 = mp4Generator.moof(sequenceNumber, [track]);
  102410. boxes = new Uint8Array(moof2.byteLength + mdat2.byteLength);
  102411. sequenceNumber++;
  102412. boxes.set(moof2);
  102413. boxes.set(mdat2, moof2.byteLength);
  102414. this.trigger("data", {
  102415. track,
  102416. boxes
  102417. });
  102418. this.resetStream_();
  102419. this.trigger("done", "VideoSegmentStream");
  102420. };
  102421. this.reset = function() {
  102422. this.resetStream_();
  102423. nalUnits = [];
  102424. this.gopCache_.length = 0;
  102425. gopsToAlignWith.length = 0;
  102426. this.trigger("reset");
  102427. };
  102428. this.resetStream_ = function() {
  102429. trackDecodeInfo.clearDtsInfo(track);
  102430. config = void 0;
  102431. pps = void 0;
  102432. };
  102433. this.getGopForFusion_ = function(nalUnit) {
  102434. var halfSecond = 45e3, allowableOverlap = 1e4, nearestDistance = Infinity, dtsDistance, nearestGopObj, currentGop, currentGopObj, i2;
  102435. for (i2 = 0; i2 < this.gopCache_.length; i2++) {
  102436. currentGopObj = this.gopCache_[i2];
  102437. currentGop = currentGopObj.gop;
  102438. if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) {
  102439. continue;
  102440. }
  102441. if (currentGop.dts < track.timelineStartInfo.dts) {
  102442. continue;
  102443. }
  102444. dtsDistance = nalUnit.dts - currentGop.dts - currentGop.duration;
  102445. if (dtsDistance >= -allowableOverlap && dtsDistance <= halfSecond) {
  102446. if (!nearestGopObj || nearestDistance > dtsDistance) {
  102447. nearestGopObj = currentGopObj;
  102448. nearestDistance = dtsDistance;
  102449. }
  102450. }
  102451. }
  102452. if (nearestGopObj) {
  102453. return nearestGopObj.gop;
  102454. }
  102455. return null;
  102456. };
  102457. this.alignGopsAtStart_ = function(gops) {
  102458. var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration5, alignedGops;
  102459. byteLength = gops.byteLength;
  102460. nalCount = gops.nalCount;
  102461. duration5 = gops.duration;
  102462. alignIndex = gopIndex = 0;
  102463. while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) {
  102464. align = gopsToAlignWith[alignIndex];
  102465. gop = gops[gopIndex];
  102466. if (align.pts === gop.pts) {
  102467. break;
  102468. }
  102469. if (gop.pts > align.pts) {
  102470. alignIndex++;
  102471. continue;
  102472. }
  102473. gopIndex++;
  102474. byteLength -= gop.byteLength;
  102475. nalCount -= gop.nalCount;
  102476. duration5 -= gop.duration;
  102477. }
  102478. if (gopIndex === 0) {
  102479. return gops;
  102480. }
  102481. if (gopIndex === gops.length) {
  102482. return null;
  102483. }
  102484. alignedGops = gops.slice(gopIndex);
  102485. alignedGops.byteLength = byteLength;
  102486. alignedGops.duration = duration5;
  102487. alignedGops.nalCount = nalCount;
  102488. alignedGops.pts = alignedGops[0].pts;
  102489. alignedGops.dts = alignedGops[0].dts;
  102490. return alignedGops;
  102491. };
  102492. this.alignGopsAtEnd_ = function(gops) {
  102493. var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound;
  102494. alignIndex = gopsToAlignWith.length - 1;
  102495. gopIndex = gops.length - 1;
  102496. alignEndIndex = null;
  102497. matchFound = false;
  102498. while (alignIndex >= 0 && gopIndex >= 0) {
  102499. align = gopsToAlignWith[alignIndex];
  102500. gop = gops[gopIndex];
  102501. if (align.pts === gop.pts) {
  102502. matchFound = true;
  102503. break;
  102504. }
  102505. if (align.pts > gop.pts) {
  102506. alignIndex--;
  102507. continue;
  102508. }
  102509. if (alignIndex === gopsToAlignWith.length - 1) {
  102510. alignEndIndex = gopIndex;
  102511. }
  102512. gopIndex--;
  102513. }
  102514. if (!matchFound && alignEndIndex === null) {
  102515. return null;
  102516. }
  102517. var trimIndex;
  102518. if (matchFound) {
  102519. trimIndex = gopIndex;
  102520. } else {
  102521. trimIndex = alignEndIndex;
  102522. }
  102523. if (trimIndex === 0) {
  102524. return gops;
  102525. }
  102526. var alignedGops = gops.slice(trimIndex);
  102527. var metadata = alignedGops.reduce(function(total, gop2) {
  102528. total.byteLength += gop2.byteLength;
  102529. total.duration += gop2.duration;
  102530. total.nalCount += gop2.nalCount;
  102531. return total;
  102532. }, {
  102533. byteLength: 0,
  102534. duration: 0,
  102535. nalCount: 0
  102536. });
  102537. alignedGops.byteLength = metadata.byteLength;
  102538. alignedGops.duration = metadata.duration;
  102539. alignedGops.nalCount = metadata.nalCount;
  102540. alignedGops.pts = alignedGops[0].pts;
  102541. alignedGops.dts = alignedGops[0].dts;
  102542. return alignedGops;
  102543. };
  102544. this.alignGopsWith = function(newGopsToAlignWith) {
  102545. gopsToAlignWith = newGopsToAlignWith;
  102546. };
  102547. };
  102548. _VideoSegmentStream.prototype = new stream();
  102549. _CoalesceStream = function CoalesceStream(options2, metadataStream2) {
  102550. this.numberOfTracks = 0;
  102551. this.metadataStream = metadataStream2;
  102552. options2 = options2 || {};
  102553. if (typeof options2.remux !== "undefined") {
  102554. this.remuxTracks = !!options2.remux;
  102555. } else {
  102556. this.remuxTracks = true;
  102557. }
  102558. if (typeof options2.keepOriginalTimestamps === "boolean") {
  102559. this.keepOriginalTimestamps = options2.keepOriginalTimestamps;
  102560. } else {
  102561. this.keepOriginalTimestamps = false;
  102562. }
  102563. this.pendingTracks = [];
  102564. this.videoTrack = null;
  102565. this.pendingBoxes = [];
  102566. this.pendingCaptions = [];
  102567. this.pendingMetadata = [];
  102568. this.pendingBytes = 0;
  102569. this.emittedTracks = 0;
  102570. _CoalesceStream.prototype.init.call(this);
  102571. this.push = function(output) {
  102572. if (output.text) {
  102573. return this.pendingCaptions.push(output);
  102574. }
  102575. if (output.frames) {
  102576. return this.pendingMetadata.push(output);
  102577. }
  102578. this.pendingTracks.push(output.track);
  102579. this.pendingBytes += output.boxes.byteLength;
  102580. if (output.track.type === "video") {
  102581. this.videoTrack = output.track;
  102582. this.pendingBoxes.push(output.boxes);
  102583. }
  102584. if (output.track.type === "audio") {
  102585. this.audioTrack = output.track;
  102586. this.pendingBoxes.unshift(output.boxes);
  102587. }
  102588. };
  102589. };
  102590. _CoalesceStream.prototype = new stream();
  102591. _CoalesceStream.prototype.flush = function(flushSource) {
  102592. var offset = 0, event2 = {
  102593. captions: [],
  102594. captionStreams: {},
  102595. metadata: [],
  102596. info: {}
  102597. }, caption, id3, initSegment, timelineStartPts = 0, i2;
  102598. if (this.pendingTracks.length < this.numberOfTracks) {
  102599. if (flushSource !== "VideoSegmentStream" && flushSource !== "AudioSegmentStream") {
  102600. return;
  102601. } else if (this.remuxTracks) {
  102602. return;
  102603. } else if (this.pendingTracks.length === 0) {
  102604. this.emittedTracks++;
  102605. if (this.emittedTracks >= this.numberOfTracks) {
  102606. this.trigger("done");
  102607. this.emittedTracks = 0;
  102608. }
  102609. return;
  102610. }
  102611. }
  102612. if (this.videoTrack) {
  102613. timelineStartPts = this.videoTrack.timelineStartInfo.pts;
  102614. videoProperties.forEach(function(prop) {
  102615. event2.info[prop] = this.videoTrack[prop];
  102616. }, this);
  102617. } else if (this.audioTrack) {
  102618. timelineStartPts = this.audioTrack.timelineStartInfo.pts;
  102619. audioProperties.forEach(function(prop) {
  102620. event2.info[prop] = this.audioTrack[prop];
  102621. }, this);
  102622. }
  102623. if (this.videoTrack || this.audioTrack) {
  102624. if (this.pendingTracks.length === 1) {
  102625. event2.type = this.pendingTracks[0].type;
  102626. } else {
  102627. event2.type = "combined";
  102628. }
  102629. this.emittedTracks += this.pendingTracks.length;
  102630. initSegment = mp4Generator.initSegment(this.pendingTracks);
  102631. event2.initSegment = new Uint8Array(initSegment.byteLength);
  102632. event2.initSegment.set(initSegment);
  102633. event2.data = new Uint8Array(this.pendingBytes);
  102634. for (i2 = 0; i2 < this.pendingBoxes.length; i2++) {
  102635. event2.data.set(this.pendingBoxes[i2], offset);
  102636. offset += this.pendingBoxes[i2].byteLength;
  102637. }
  102638. for (i2 = 0; i2 < this.pendingCaptions.length; i2++) {
  102639. caption = this.pendingCaptions[i2];
  102640. caption.startTime = clock2.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps);
  102641. caption.endTime = clock2.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps);
  102642. event2.captionStreams[caption.stream] = true;
  102643. event2.captions.push(caption);
  102644. }
  102645. for (i2 = 0; i2 < this.pendingMetadata.length; i2++) {
  102646. id3 = this.pendingMetadata[i2];
  102647. id3.cueTime = clock2.metadataTsToSeconds(id3.pts, timelineStartPts, this.keepOriginalTimestamps);
  102648. event2.metadata.push(id3);
  102649. }
  102650. event2.metadata.dispatchType = this.metadataStream.dispatchType;
  102651. this.pendingTracks.length = 0;
  102652. this.videoTrack = null;
  102653. this.pendingBoxes.length = 0;
  102654. this.pendingCaptions.length = 0;
  102655. this.pendingBytes = 0;
  102656. this.pendingMetadata.length = 0;
  102657. this.trigger("data", event2);
  102658. for (i2 = 0; i2 < event2.captions.length; i2++) {
  102659. caption = event2.captions[i2];
  102660. this.trigger("caption", caption);
  102661. }
  102662. for (i2 = 0; i2 < event2.metadata.length; i2++) {
  102663. id3 = event2.metadata[i2];
  102664. this.trigger("id3Frame", id3);
  102665. }
  102666. }
  102667. if (this.emittedTracks >= this.numberOfTracks) {
  102668. this.trigger("done");
  102669. this.emittedTracks = 0;
  102670. }
  102671. };
  102672. _CoalesceStream.prototype.setRemux = function(val) {
  102673. this.remuxTracks = val;
  102674. };
  102675. _Transmuxer = function Transmuxer(options2) {
  102676. var self2 = this, hasFlushed = true, videoTrack, audioTrack;
  102677. _Transmuxer.prototype.init.call(this);
  102678. options2 = options2 || {};
  102679. this.baseMediaDecodeTime = options2.baseMediaDecodeTime || 0;
  102680. this.transmuxPipeline_ = {};
  102681. this.setupAacPipeline = function() {
  102682. var pipeline = {};
  102683. this.transmuxPipeline_ = pipeline;
  102684. pipeline.type = "aac";
  102685. pipeline.metadataStream = new m2ts_1.MetadataStream();
  102686. pipeline.aacStream = new aac3();
  102687. pipeline.audioTimestampRolloverStream = new m2ts_1.TimestampRolloverStream("audio");
  102688. pipeline.timedMetadataTimestampRolloverStream = new m2ts_1.TimestampRolloverStream("timed-metadata");
  102689. pipeline.adtsStream = new adts();
  102690. pipeline.coalesceStream = new _CoalesceStream(options2, pipeline.metadataStream);
  102691. pipeline.headOfPipeline = pipeline.aacStream;
  102692. pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream);
  102693. pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream);
  102694. pipeline.metadataStream.on("timestamp", function(frame) {
  102695. pipeline.aacStream.setTimestamp(frame.timeStamp);
  102696. });
  102697. pipeline.aacStream.on("data", function(data) {
  102698. if (data.type !== "timed-metadata" && data.type !== "audio" || pipeline.audioSegmentStream) {
  102699. return;
  102700. }
  102701. audioTrack = audioTrack || {
  102702. timelineStartInfo: {
  102703. baseMediaDecodeTime: self2.baseMediaDecodeTime
  102704. },
  102705. codec: "adts",
  102706. type: "audio"
  102707. };
  102708. pipeline.coalesceStream.numberOfTracks++;
  102709. pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options2);
  102710. pipeline.audioSegmentStream.on("log", self2.getLogTrigger_("audioSegmentStream"));
  102711. pipeline.audioSegmentStream.on("timingInfo", self2.trigger.bind(self2, "audioTimingInfo"));
  102712. pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream);
  102713. self2.trigger("trackinfo", {
  102714. hasAudio: !!audioTrack,
  102715. hasVideo: !!videoTrack
  102716. });
  102717. });
  102718. pipeline.coalesceStream.on("data", this.trigger.bind(this, "data"));
  102719. pipeline.coalesceStream.on("done", this.trigger.bind(this, "done"));
  102720. addPipelineLogRetriggers(this, pipeline);
  102721. };
  102722. this.setupTsPipeline = function() {
  102723. var pipeline = {};
  102724. this.transmuxPipeline_ = pipeline;
  102725. pipeline.type = "ts";
  102726. pipeline.metadataStream = new m2ts_1.MetadataStream();
  102727. pipeline.packetStream = new m2ts_1.TransportPacketStream();
  102728. pipeline.parseStream = new m2ts_1.TransportParseStream();
  102729. pipeline.elementaryStream = new m2ts_1.ElementaryStream();
  102730. pipeline.timestampRolloverStream = new m2ts_1.TimestampRolloverStream();
  102731. pipeline.adtsStream = new adts();
  102732. pipeline.h264Stream = new H264Stream();
  102733. pipeline.captionStream = new m2ts_1.CaptionStream(options2);
  102734. pipeline.coalesceStream = new _CoalesceStream(options2, pipeline.metadataStream);
  102735. pipeline.headOfPipeline = pipeline.packetStream;
  102736. pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream);
  102737. pipeline.timestampRolloverStream.pipe(pipeline.h264Stream);
  102738. pipeline.timestampRolloverStream.pipe(pipeline.adtsStream);
  102739. pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream);
  102740. pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream);
  102741. pipeline.elementaryStream.on("data", function(data) {
  102742. var i2;
  102743. if (data.type === "metadata") {
  102744. i2 = data.tracks.length;
  102745. while (i2--) {
  102746. if (!videoTrack && data.tracks[i2].type === "video") {
  102747. videoTrack = data.tracks[i2];
  102748. videoTrack.timelineStartInfo.baseMediaDecodeTime = self2.baseMediaDecodeTime;
  102749. } else if (!audioTrack && data.tracks[i2].type === "audio") {
  102750. audioTrack = data.tracks[i2];
  102751. audioTrack.timelineStartInfo.baseMediaDecodeTime = self2.baseMediaDecodeTime;
  102752. }
  102753. }
  102754. if (videoTrack && !pipeline.videoSegmentStream) {
  102755. pipeline.coalesceStream.numberOfTracks++;
  102756. pipeline.videoSegmentStream = new _VideoSegmentStream(videoTrack, options2);
  102757. pipeline.videoSegmentStream.on("log", self2.getLogTrigger_("videoSegmentStream"));
  102758. pipeline.videoSegmentStream.on("timelineStartInfo", function(timelineStartInfo) {
  102759. if (audioTrack && !options2.keepOriginalTimestamps) {
  102760. audioTrack.timelineStartInfo = timelineStartInfo;
  102761. pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self2.baseMediaDecodeTime);
  102762. }
  102763. });
  102764. pipeline.videoSegmentStream.on("processedGopsInfo", self2.trigger.bind(self2, "gopInfo"));
  102765. pipeline.videoSegmentStream.on("segmentTimingInfo", self2.trigger.bind(self2, "videoSegmentTimingInfo"));
  102766. pipeline.videoSegmentStream.on("baseMediaDecodeTime", function(baseMediaDecodeTime) {
  102767. if (audioTrack) {
  102768. pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime);
  102769. }
  102770. });
  102771. pipeline.videoSegmentStream.on("timingInfo", self2.trigger.bind(self2, "videoTimingInfo"));
  102772. pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream);
  102773. }
  102774. if (audioTrack && !pipeline.audioSegmentStream) {
  102775. pipeline.coalesceStream.numberOfTracks++;
  102776. pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options2);
  102777. pipeline.audioSegmentStream.on("log", self2.getLogTrigger_("audioSegmentStream"));
  102778. pipeline.audioSegmentStream.on("timingInfo", self2.trigger.bind(self2, "audioTimingInfo"));
  102779. pipeline.audioSegmentStream.on("segmentTimingInfo", self2.trigger.bind(self2, "audioSegmentTimingInfo"));
  102780. pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream);
  102781. }
  102782. self2.trigger("trackinfo", {
  102783. hasAudio: !!audioTrack,
  102784. hasVideo: !!videoTrack
  102785. });
  102786. }
  102787. });
  102788. pipeline.coalesceStream.on("data", this.trigger.bind(this, "data"));
  102789. pipeline.coalesceStream.on("id3Frame", function(id3Frame) {
  102790. id3Frame.dispatchType = pipeline.metadataStream.dispatchType;
  102791. self2.trigger("id3Frame", id3Frame);
  102792. });
  102793. pipeline.coalesceStream.on("caption", this.trigger.bind(this, "caption"));
  102794. pipeline.coalesceStream.on("done", this.trigger.bind(this, "done"));
  102795. addPipelineLogRetriggers(this, pipeline);
  102796. };
  102797. this.setBaseMediaDecodeTime = function(baseMediaDecodeTime) {
  102798. var pipeline = this.transmuxPipeline_;
  102799. if (!options2.keepOriginalTimestamps) {
  102800. this.baseMediaDecodeTime = baseMediaDecodeTime;
  102801. }
  102802. if (audioTrack) {
  102803. audioTrack.timelineStartInfo.dts = void 0;
  102804. audioTrack.timelineStartInfo.pts = void 0;
  102805. trackDecodeInfo.clearDtsInfo(audioTrack);
  102806. if (pipeline.audioTimestampRolloverStream) {
  102807. pipeline.audioTimestampRolloverStream.discontinuity();
  102808. }
  102809. }
  102810. if (videoTrack) {
  102811. if (pipeline.videoSegmentStream) {
  102812. pipeline.videoSegmentStream.gopCache_ = [];
  102813. }
  102814. videoTrack.timelineStartInfo.dts = void 0;
  102815. videoTrack.timelineStartInfo.pts = void 0;
  102816. trackDecodeInfo.clearDtsInfo(videoTrack);
  102817. pipeline.captionStream.reset();
  102818. }
  102819. if (pipeline.timestampRolloverStream) {
  102820. pipeline.timestampRolloverStream.discontinuity();
  102821. }
  102822. };
  102823. this.setAudioAppendStart = function(timestamp) {
  102824. if (audioTrack) {
  102825. this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp);
  102826. }
  102827. };
  102828. this.setRemux = function(val) {
  102829. var pipeline = this.transmuxPipeline_;
  102830. options2.remux = val;
  102831. if (pipeline && pipeline.coalesceStream) {
  102832. pipeline.coalesceStream.setRemux(val);
  102833. }
  102834. };
  102835. this.alignGopsWith = function(gopsToAlignWith) {
  102836. if (videoTrack && this.transmuxPipeline_.videoSegmentStream) {
  102837. this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith);
  102838. }
  102839. };
  102840. this.getLogTrigger_ = function(key) {
  102841. var self3 = this;
  102842. return function(event2) {
  102843. event2.stream = key;
  102844. self3.trigger("log", event2);
  102845. };
  102846. };
  102847. this.push = function(data) {
  102848. if (hasFlushed) {
  102849. var isAac = isLikelyAacData(data);
  102850. if (isAac && this.transmuxPipeline_.type !== "aac") {
  102851. this.setupAacPipeline();
  102852. } else if (!isAac && this.transmuxPipeline_.type !== "ts") {
  102853. this.setupTsPipeline();
  102854. }
  102855. hasFlushed = false;
  102856. }
  102857. this.transmuxPipeline_.headOfPipeline.push(data);
  102858. };
  102859. this.flush = function() {
  102860. hasFlushed = true;
  102861. this.transmuxPipeline_.headOfPipeline.flush();
  102862. };
  102863. this.endTimeline = function() {
  102864. this.transmuxPipeline_.headOfPipeline.endTimeline();
  102865. };
  102866. this.reset = function() {
  102867. if (this.transmuxPipeline_.headOfPipeline) {
  102868. this.transmuxPipeline_.headOfPipeline.reset();
  102869. }
  102870. };
  102871. this.resetCaptions = function() {
  102872. if (this.transmuxPipeline_.captionStream) {
  102873. this.transmuxPipeline_.captionStream.reset();
  102874. }
  102875. };
  102876. };
  102877. _Transmuxer.prototype = new stream();
  102878. var transmuxer = {
  102879. Transmuxer: _Transmuxer,
  102880. VideoSegmentStream: _VideoSegmentStream,
  102881. AudioSegmentStream: _AudioSegmentStream,
  102882. AUDIO_PROPERTIES: audioProperties,
  102883. VIDEO_PROPERTIES: videoProperties,
  102884. generateSegmentTimingInfo
  102885. };
  102886. var toUnsigned$3 = function toUnsigned2(value) {
  102887. return value >>> 0;
  102888. };
  102889. var toHexString$1 = function toHexString2(value) {
  102890. return ("00" + value.toString(16)).slice(-2);
  102891. };
  102892. var bin = {
  102893. toUnsigned: toUnsigned$3,
  102894. toHexString: toHexString$1
  102895. };
  102896. var parseType$1 = function parseType2(buffer) {
  102897. var result = "";
  102898. result += String.fromCharCode(buffer[0]);
  102899. result += String.fromCharCode(buffer[1]);
  102900. result += String.fromCharCode(buffer[2]);
  102901. result += String.fromCharCode(buffer[3]);
  102902. return result;
  102903. };
  102904. var parseType_1 = parseType$1;
  102905. var toUnsigned$2 = bin.toUnsigned;
  102906. var findBox4 = function findBox5(data, path) {
  102907. var results = [], i2, size, type3, end, subresults;
  102908. if (!path.length) {
  102909. return null;
  102910. }
  102911. for (i2 = 0; i2 < data.byteLength; ) {
  102912. size = toUnsigned$2(data[i2] << 24 | data[i2 + 1] << 16 | data[i2 + 2] << 8 | data[i2 + 3]);
  102913. type3 = parseType_1(data.subarray(i2 + 4, i2 + 8));
  102914. end = size > 1 ? i2 + size : data.byteLength;
  102915. if (type3 === path[0]) {
  102916. if (path.length === 1) {
  102917. results.push(data.subarray(i2 + 8, end));
  102918. } else {
  102919. subresults = findBox5(data.subarray(i2 + 8, end), path.slice(1));
  102920. if (subresults.length) {
  102921. results = results.concat(subresults);
  102922. }
  102923. }
  102924. }
  102925. i2 = end;
  102926. }
  102927. return results;
  102928. };
  102929. var findBox_1 = findBox4;
  102930. var toUnsigned$1 = bin.toUnsigned;
  102931. var getUint64$12 = numbers2.getUint64;
  102932. var tfdt = function tfdt2(data) {
  102933. var result = {
  102934. version: data[0],
  102935. flags: new Uint8Array(data.subarray(1, 4))
  102936. };
  102937. if (result.version === 1) {
  102938. result.baseMediaDecodeTime = getUint64$12(data.subarray(4));
  102939. } else {
  102940. result.baseMediaDecodeTime = toUnsigned$1(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]);
  102941. }
  102942. return result;
  102943. };
  102944. var parseTfdt = tfdt;
  102945. var parseSampleFlags = function parseSampleFlags2(flags) {
  102946. return {
  102947. isLeading: (flags[0] & 12) >>> 2,
  102948. dependsOn: flags[0] & 3,
  102949. isDependedOn: (flags[1] & 192) >>> 6,
  102950. hasRedundancy: (flags[1] & 48) >>> 4,
  102951. paddingValue: (flags[1] & 14) >>> 1,
  102952. isNonSyncSample: flags[1] & 1,
  102953. degradationPriority: flags[2] << 8 | flags[3]
  102954. };
  102955. };
  102956. var parseSampleFlags_1 = parseSampleFlags;
  102957. var trun = function trun2(data) {
  102958. var result = {
  102959. version: data[0],
  102960. flags: new Uint8Array(data.subarray(1, 4)),
  102961. samples: []
  102962. }, view = new DataView(data.buffer, data.byteOffset, data.byteLength), dataOffsetPresent = result.flags[2] & 1, firstSampleFlagsPresent = result.flags[2] & 4, sampleDurationPresent = result.flags[1] & 1, sampleSizePresent = result.flags[1] & 2, sampleFlagsPresent = result.flags[1] & 4, sampleCompositionTimeOffsetPresent = result.flags[1] & 8, sampleCount = view.getUint32(4), offset = 8, sample;
  102963. if (dataOffsetPresent) {
  102964. result.dataOffset = view.getInt32(offset);
  102965. offset += 4;
  102966. }
  102967. if (firstSampleFlagsPresent && sampleCount) {
  102968. sample = {
  102969. flags: parseSampleFlags_1(data.subarray(offset, offset + 4))
  102970. };
  102971. offset += 4;
  102972. if (sampleDurationPresent) {
  102973. sample.duration = view.getUint32(offset);
  102974. offset += 4;
  102975. }
  102976. if (sampleSizePresent) {
  102977. sample.size = view.getUint32(offset);
  102978. offset += 4;
  102979. }
  102980. if (sampleCompositionTimeOffsetPresent) {
  102981. if (result.version === 1) {
  102982. sample.compositionTimeOffset = view.getInt32(offset);
  102983. } else {
  102984. sample.compositionTimeOffset = view.getUint32(offset);
  102985. }
  102986. offset += 4;
  102987. }
  102988. result.samples.push(sample);
  102989. sampleCount--;
  102990. }
  102991. while (sampleCount--) {
  102992. sample = {};
  102993. if (sampleDurationPresent) {
  102994. sample.duration = view.getUint32(offset);
  102995. offset += 4;
  102996. }
  102997. if (sampleSizePresent) {
  102998. sample.size = view.getUint32(offset);
  102999. offset += 4;
  103000. }
  103001. if (sampleFlagsPresent) {
  103002. sample.flags = parseSampleFlags_1(data.subarray(offset, offset + 4));
  103003. offset += 4;
  103004. }
  103005. if (sampleCompositionTimeOffsetPresent) {
  103006. if (result.version === 1) {
  103007. sample.compositionTimeOffset = view.getInt32(offset);
  103008. } else {
  103009. sample.compositionTimeOffset = view.getUint32(offset);
  103010. }
  103011. offset += 4;
  103012. }
  103013. result.samples.push(sample);
  103014. }
  103015. return result;
  103016. };
  103017. var parseTrun = trun;
  103018. var tfhd = function tfhd2(data) {
  103019. var view = new DataView(data.buffer, data.byteOffset, data.byteLength), result = {
  103020. version: data[0],
  103021. flags: new Uint8Array(data.subarray(1, 4)),
  103022. trackId: view.getUint32(4)
  103023. }, baseDataOffsetPresent = result.flags[2] & 1, sampleDescriptionIndexPresent = result.flags[2] & 2, defaultSampleDurationPresent = result.flags[2] & 8, defaultSampleSizePresent = result.flags[2] & 16, defaultSampleFlagsPresent = result.flags[2] & 32, durationIsEmpty = result.flags[0] & 65536, defaultBaseIsMoof = result.flags[0] & 131072, i2;
  103024. i2 = 8;
  103025. if (baseDataOffsetPresent) {
  103026. i2 += 4;
  103027. result.baseDataOffset = view.getUint32(12);
  103028. i2 += 4;
  103029. }
  103030. if (sampleDescriptionIndexPresent) {
  103031. result.sampleDescriptionIndex = view.getUint32(i2);
  103032. i2 += 4;
  103033. }
  103034. if (defaultSampleDurationPresent) {
  103035. result.defaultSampleDuration = view.getUint32(i2);
  103036. i2 += 4;
  103037. }
  103038. if (defaultSampleSizePresent) {
  103039. result.defaultSampleSize = view.getUint32(i2);
  103040. i2 += 4;
  103041. }
  103042. if (defaultSampleFlagsPresent) {
  103043. result.defaultSampleFlags = view.getUint32(i2);
  103044. }
  103045. if (durationIsEmpty) {
  103046. result.durationIsEmpty = true;
  103047. }
  103048. if (!baseDataOffsetPresent && defaultBaseIsMoof) {
  103049. result.baseDataOffsetIsMoof = true;
  103050. }
  103051. return result;
  103052. };
  103053. var parseTfhd = tfhd;
  103054. var commonjsGlobal2 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  103055. var win2;
  103056. if (typeof window !== "undefined") {
  103057. win2 = window;
  103058. } else if (typeof commonjsGlobal2 !== "undefined") {
  103059. win2 = commonjsGlobal2;
  103060. } else if (typeof self !== "undefined") {
  103061. win2 = self;
  103062. } else {
  103063. win2 = {};
  103064. }
  103065. var window_12 = win2;
  103066. var discardEmulationPreventionBytes4 = captionPacketParser.discardEmulationPreventionBytes;
  103067. var CaptionStream = captionStream.CaptionStream;
  103068. var mapToSample = function mapToSample2(offset, samples) {
  103069. var approximateOffset = offset;
  103070. for (var i2 = 0; i2 < samples.length; i2++) {
  103071. var sample = samples[i2];
  103072. if (approximateOffset < sample.size) {
  103073. return sample;
  103074. }
  103075. approximateOffset -= sample.size;
  103076. }
  103077. return null;
  103078. };
  103079. var findSeiNals = function findSeiNals2(avcStream, samples, trackId) {
  103080. var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), result = {
  103081. logs: [],
  103082. seiNals: []
  103083. }, seiNal, i2, length, lastMatchedSample;
  103084. for (i2 = 0; i2 + 4 < avcStream.length; i2 += length) {
  103085. length = avcView.getUint32(i2);
  103086. i2 += 4;
  103087. if (length <= 0) {
  103088. continue;
  103089. }
  103090. switch (avcStream[i2] & 31) {
  103091. case 6:
  103092. var data = avcStream.subarray(i2 + 1, i2 + 1 + length);
  103093. var matchingSample = mapToSample(i2, samples);
  103094. seiNal = {
  103095. nalUnitType: "sei_rbsp",
  103096. size: length,
  103097. data,
  103098. escapedRBSP: discardEmulationPreventionBytes4(data),
  103099. trackId
  103100. };
  103101. if (matchingSample) {
  103102. seiNal.pts = matchingSample.pts;
  103103. seiNal.dts = matchingSample.dts;
  103104. lastMatchedSample = matchingSample;
  103105. } else if (lastMatchedSample) {
  103106. seiNal.pts = lastMatchedSample.pts;
  103107. seiNal.dts = lastMatchedSample.dts;
  103108. } else {
  103109. result.logs.push({
  103110. level: "warn",
  103111. message: "We've encountered a nal unit without data at " + i2 + " for trackId " + trackId + ". See mux.js#223."
  103112. });
  103113. break;
  103114. }
  103115. result.seiNals.push(seiNal);
  103116. break;
  103117. }
  103118. }
  103119. return result;
  103120. };
  103121. var parseSamples = function parseSamples2(truns, baseMediaDecodeTime, tfhd2) {
  103122. var currentDts = baseMediaDecodeTime;
  103123. var defaultSampleDuration = tfhd2.defaultSampleDuration || 0;
  103124. var defaultSampleSize = tfhd2.defaultSampleSize || 0;
  103125. var trackId = tfhd2.trackId;
  103126. var allSamples = [];
  103127. truns.forEach(function(trun2) {
  103128. var trackRun = parseTrun(trun2);
  103129. var samples = trackRun.samples;
  103130. samples.forEach(function(sample) {
  103131. if (sample.duration === void 0) {
  103132. sample.duration = defaultSampleDuration;
  103133. }
  103134. if (sample.size === void 0) {
  103135. sample.size = defaultSampleSize;
  103136. }
  103137. sample.trackId = trackId;
  103138. sample.dts = currentDts;
  103139. if (sample.compositionTimeOffset === void 0) {
  103140. sample.compositionTimeOffset = 0;
  103141. }
  103142. if (typeof currentDts === "bigint") {
  103143. sample.pts = currentDts + window_12.BigInt(sample.compositionTimeOffset);
  103144. currentDts += window_12.BigInt(sample.duration);
  103145. } else {
  103146. sample.pts = currentDts + sample.compositionTimeOffset;
  103147. currentDts += sample.duration;
  103148. }
  103149. });
  103150. allSamples = allSamples.concat(samples);
  103151. });
  103152. return allSamples;
  103153. };
  103154. var parseCaptionNals = function parseCaptionNals2(segment, videoTrackId) {
  103155. var trafs = findBox_1(segment, ["moof", "traf"]);
  103156. var mdats = findBox_1(segment, ["mdat"]);
  103157. var captionNals = {};
  103158. var mdatTrafPairs = [];
  103159. mdats.forEach(function(mdat2, index2) {
  103160. var matchingTraf = trafs[index2];
  103161. mdatTrafPairs.push({
  103162. mdat: mdat2,
  103163. traf: matchingTraf
  103164. });
  103165. });
  103166. mdatTrafPairs.forEach(function(pair) {
  103167. var mdat2 = pair.mdat;
  103168. var traf2 = pair.traf;
  103169. var tfhd2 = findBox_1(traf2, ["tfhd"]);
  103170. var headerInfo = parseTfhd(tfhd2[0]);
  103171. var trackId = headerInfo.trackId;
  103172. var tfdt2 = findBox_1(traf2, ["tfdt"]);
  103173. var baseMediaDecodeTime = tfdt2.length > 0 ? parseTfdt(tfdt2[0]).baseMediaDecodeTime : 0;
  103174. var truns = findBox_1(traf2, ["trun"]);
  103175. var samples;
  103176. var result;
  103177. if (videoTrackId === trackId && truns.length > 0) {
  103178. samples = parseSamples(truns, baseMediaDecodeTime, headerInfo);
  103179. result = findSeiNals(mdat2, samples, trackId);
  103180. if (!captionNals[trackId]) {
  103181. captionNals[trackId] = {
  103182. seiNals: [],
  103183. logs: []
  103184. };
  103185. }
  103186. captionNals[trackId].seiNals = captionNals[trackId].seiNals.concat(result.seiNals);
  103187. captionNals[trackId].logs = captionNals[trackId].logs.concat(result.logs);
  103188. }
  103189. });
  103190. return captionNals;
  103191. };
  103192. var parseEmbeddedCaptions = function parseEmbeddedCaptions2(segment, trackId, timescale3) {
  103193. var captionNals;
  103194. if (trackId === null) {
  103195. return null;
  103196. }
  103197. captionNals = parseCaptionNals(segment, trackId);
  103198. var trackNals = captionNals[trackId] || {};
  103199. return {
  103200. seiNals: trackNals.seiNals,
  103201. logs: trackNals.logs,
  103202. timescale: timescale3
  103203. };
  103204. };
  103205. var CaptionParser = function CaptionParser2() {
  103206. var isInitialized = false;
  103207. var captionStream2;
  103208. var segmentCache;
  103209. var trackId;
  103210. var timescale3;
  103211. var parsedCaptions;
  103212. var parsingPartial;
  103213. this.isInitialized = function() {
  103214. return isInitialized;
  103215. };
  103216. this.init = function(options2) {
  103217. captionStream2 = new CaptionStream();
  103218. isInitialized = true;
  103219. parsingPartial = options2 ? options2.isPartial : false;
  103220. captionStream2.on("data", function(event2) {
  103221. event2.startTime = event2.startPts / timescale3;
  103222. event2.endTime = event2.endPts / timescale3;
  103223. parsedCaptions.captions.push(event2);
  103224. parsedCaptions.captionStreams[event2.stream] = true;
  103225. });
  103226. captionStream2.on("log", function(log2) {
  103227. parsedCaptions.logs.push(log2);
  103228. });
  103229. };
  103230. this.isNewInit = function(videoTrackIds, timescales) {
  103231. if (videoTrackIds && videoTrackIds.length === 0 || timescales && typeof timescales === "object" && Object.keys(timescales).length === 0) {
  103232. return false;
  103233. }
  103234. return trackId !== videoTrackIds[0] || timescale3 !== timescales[trackId];
  103235. };
  103236. this.parse = function(segment, videoTrackIds, timescales) {
  103237. var parsedData;
  103238. if (!this.isInitialized()) {
  103239. return null;
  103240. } else if (!videoTrackIds || !timescales) {
  103241. return null;
  103242. } else if (this.isNewInit(videoTrackIds, timescales)) {
  103243. trackId = videoTrackIds[0];
  103244. timescale3 = timescales[trackId];
  103245. } else if (trackId === null || !timescale3) {
  103246. segmentCache.push(segment);
  103247. return null;
  103248. }
  103249. while (segmentCache.length > 0) {
  103250. var cachedSegment = segmentCache.shift();
  103251. this.parse(cachedSegment, videoTrackIds, timescales);
  103252. }
  103253. parsedData = parseEmbeddedCaptions(segment, trackId, timescale3);
  103254. if (parsedData && parsedData.logs) {
  103255. parsedCaptions.logs = parsedCaptions.logs.concat(parsedData.logs);
  103256. }
  103257. if (parsedData === null || !parsedData.seiNals) {
  103258. if (parsedCaptions.logs.length) {
  103259. return {
  103260. logs: parsedCaptions.logs,
  103261. captions: [],
  103262. captionStreams: []
  103263. };
  103264. }
  103265. return null;
  103266. }
  103267. this.pushNals(parsedData.seiNals);
  103268. this.flushStream();
  103269. return parsedCaptions;
  103270. };
  103271. this.pushNals = function(nals) {
  103272. if (!this.isInitialized() || !nals || nals.length === 0) {
  103273. return null;
  103274. }
  103275. nals.forEach(function(nal) {
  103276. captionStream2.push(nal);
  103277. });
  103278. };
  103279. this.flushStream = function() {
  103280. if (!this.isInitialized()) {
  103281. return null;
  103282. }
  103283. if (!parsingPartial) {
  103284. captionStream2.flush();
  103285. } else {
  103286. captionStream2.partialFlush();
  103287. }
  103288. };
  103289. this.clearParsedCaptions = function() {
  103290. parsedCaptions.captions = [];
  103291. parsedCaptions.captionStreams = {};
  103292. parsedCaptions.logs = [];
  103293. };
  103294. this.resetCaptionStream = function() {
  103295. if (!this.isInitialized()) {
  103296. return null;
  103297. }
  103298. captionStream2.reset();
  103299. };
  103300. this.clearAllCaptions = function() {
  103301. this.clearParsedCaptions();
  103302. this.resetCaptionStream();
  103303. };
  103304. this.reset = function() {
  103305. segmentCache = [];
  103306. trackId = null;
  103307. timescale3 = null;
  103308. if (!parsedCaptions) {
  103309. parsedCaptions = {
  103310. captions: [],
  103311. captionStreams: {},
  103312. logs: []
  103313. };
  103314. } else {
  103315. this.clearParsedCaptions();
  103316. }
  103317. this.resetCaptionStream();
  103318. };
  103319. this.reset();
  103320. };
  103321. var captionParser = CaptionParser;
  103322. var toUnsigned = bin.toUnsigned;
  103323. var toHexString = bin.toHexString;
  103324. var getUint642 = numbers2.getUint64;
  103325. var timescale2, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader;
  103326. timescale2 = function timescale3(init) {
  103327. var result = {}, traks = findBox_1(init, ["moov", "trak"]);
  103328. return traks.reduce(function(result2, trak2) {
  103329. var tkhd2, version2, index2, id, mdhd2;
  103330. tkhd2 = findBox_1(trak2, ["tkhd"])[0];
  103331. if (!tkhd2) {
  103332. return null;
  103333. }
  103334. version2 = tkhd2[0];
  103335. index2 = version2 === 0 ? 12 : 20;
  103336. id = toUnsigned(tkhd2[index2] << 24 | tkhd2[index2 + 1] << 16 | tkhd2[index2 + 2] << 8 | tkhd2[index2 + 3]);
  103337. mdhd2 = findBox_1(trak2, ["mdia", "mdhd"])[0];
  103338. if (!mdhd2) {
  103339. return null;
  103340. }
  103341. version2 = mdhd2[0];
  103342. index2 = version2 === 0 ? 12 : 20;
  103343. result2[id] = toUnsigned(mdhd2[index2] << 24 | mdhd2[index2 + 1] << 16 | mdhd2[index2 + 2] << 8 | mdhd2[index2 + 3]);
  103344. return result2;
  103345. }, result);
  103346. };
  103347. startTime = function startTime2(timescale3, fragment) {
  103348. var trafs;
  103349. trafs = findBox_1(fragment, ["moof", "traf"]);
  103350. var lowestTime = trafs.reduce(function(acc, traf2) {
  103351. var tfhd2 = findBox_1(traf2, ["tfhd"])[0];
  103352. var id = toUnsigned(tfhd2[4] << 24 | tfhd2[5] << 16 | tfhd2[6] << 8 | tfhd2[7]);
  103353. var scale = timescale3[id] || 9e4;
  103354. var tfdt2 = findBox_1(traf2, ["tfdt"])[0];
  103355. var dv = new DataView(tfdt2.buffer, tfdt2.byteOffset, tfdt2.byteLength);
  103356. var baseTime;
  103357. if (tfdt2[0] === 1) {
  103358. baseTime = getUint642(tfdt2.subarray(4, 12));
  103359. } else {
  103360. baseTime = dv.getUint32(4);
  103361. }
  103362. var seconds;
  103363. if (typeof baseTime === "bigint") {
  103364. seconds = baseTime / window_12.BigInt(scale);
  103365. } else if (typeof baseTime === "number" && !isNaN(baseTime)) {
  103366. seconds = baseTime / scale;
  103367. }
  103368. if (seconds < Number.MAX_SAFE_INTEGER) {
  103369. seconds = Number(seconds);
  103370. }
  103371. if (seconds < acc) {
  103372. acc = seconds;
  103373. }
  103374. return acc;
  103375. }, Infinity);
  103376. return typeof lowestTime === "bigint" || isFinite(lowestTime) ? lowestTime : 0;
  103377. };
  103378. compositionStartTime = function compositionStartTime2(timescales, fragment) {
  103379. var trafBoxes = findBox_1(fragment, ["moof", "traf"]);
  103380. var baseMediaDecodeTime = 0;
  103381. var compositionTimeOffset = 0;
  103382. var trackId;
  103383. if (trafBoxes && trafBoxes.length) {
  103384. var tfhd2 = findBox_1(trafBoxes[0], ["tfhd"])[0];
  103385. var trun2 = findBox_1(trafBoxes[0], ["trun"])[0];
  103386. var tfdt2 = findBox_1(trafBoxes[0], ["tfdt"])[0];
  103387. if (tfhd2) {
  103388. var parsedTfhd = parseTfhd(tfhd2);
  103389. trackId = parsedTfhd.trackId;
  103390. }
  103391. if (tfdt2) {
  103392. var parsedTfdt = parseTfdt(tfdt2);
  103393. baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime;
  103394. }
  103395. if (trun2) {
  103396. var parsedTrun = parseTrun(trun2);
  103397. if (parsedTrun.samples && parsedTrun.samples.length) {
  103398. compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0;
  103399. }
  103400. }
  103401. }
  103402. var timescale3 = timescales[trackId] || 9e4;
  103403. if (typeof baseMediaDecodeTime === "bigint") {
  103404. compositionTimeOffset = window_12.BigInt(compositionTimeOffset);
  103405. timescale3 = window_12.BigInt(timescale3);
  103406. }
  103407. var result = (baseMediaDecodeTime + compositionTimeOffset) / timescale3;
  103408. if (typeof result === "bigint" && result < Number.MAX_SAFE_INTEGER) {
  103409. result = Number(result);
  103410. }
  103411. return result;
  103412. };
  103413. getVideoTrackIds = function getVideoTrackIds2(init) {
  103414. var traks = findBox_1(init, ["moov", "trak"]);
  103415. var videoTrackIds = [];
  103416. traks.forEach(function(trak2) {
  103417. var hdlrs = findBox_1(trak2, ["mdia", "hdlr"]);
  103418. var tkhds = findBox_1(trak2, ["tkhd"]);
  103419. hdlrs.forEach(function(hdlr2, index2) {
  103420. var handlerType = parseType_1(hdlr2.subarray(8, 12));
  103421. var tkhd2 = tkhds[index2];
  103422. var view;
  103423. var version2;
  103424. var trackId;
  103425. if (handlerType === "vide") {
  103426. view = new DataView(tkhd2.buffer, tkhd2.byteOffset, tkhd2.byteLength);
  103427. version2 = view.getUint8(0);
  103428. trackId = version2 === 0 ? view.getUint32(12) : view.getUint32(20);
  103429. videoTrackIds.push(trackId);
  103430. }
  103431. });
  103432. });
  103433. return videoTrackIds;
  103434. };
  103435. getTimescaleFromMediaHeader = function getTimescaleFromMediaHeader2(mdhd2) {
  103436. var version2 = mdhd2[0];
  103437. var index2 = version2 === 0 ? 12 : 20;
  103438. return toUnsigned(mdhd2[index2] << 24 | mdhd2[index2 + 1] << 16 | mdhd2[index2 + 2] << 8 | mdhd2[index2 + 3]);
  103439. };
  103440. getTracks = function getTracks2(init) {
  103441. var traks = findBox_1(init, ["moov", "trak"]);
  103442. var tracks = [];
  103443. traks.forEach(function(trak2) {
  103444. var track = {};
  103445. var tkhd2 = findBox_1(trak2, ["tkhd"])[0];
  103446. var view, tkhdVersion;
  103447. if (tkhd2) {
  103448. view = new DataView(tkhd2.buffer, tkhd2.byteOffset, tkhd2.byteLength);
  103449. tkhdVersion = view.getUint8(0);
  103450. track.id = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20);
  103451. }
  103452. var hdlr2 = findBox_1(trak2, ["mdia", "hdlr"])[0];
  103453. if (hdlr2) {
  103454. var type3 = parseType_1(hdlr2.subarray(8, 12));
  103455. if (type3 === "vide") {
  103456. track.type = "video";
  103457. } else if (type3 === "soun") {
  103458. track.type = "audio";
  103459. } else {
  103460. track.type = type3;
  103461. }
  103462. }
  103463. var stsd2 = findBox_1(trak2, ["mdia", "minf", "stbl", "stsd"])[0];
  103464. if (stsd2) {
  103465. var sampleDescriptions = stsd2.subarray(8);
  103466. track.codec = parseType_1(sampleDescriptions.subarray(4, 8));
  103467. var codecBox = findBox_1(sampleDescriptions, [track.codec])[0];
  103468. var codecConfig, codecConfigType;
  103469. if (codecBox) {
  103470. if (/^[asm]vc[1-9]$/i.test(track.codec)) {
  103471. codecConfig = codecBox.subarray(78);
  103472. codecConfigType = parseType_1(codecConfig.subarray(4, 8));
  103473. if (codecConfigType === "avcC" && codecConfig.length > 11) {
  103474. track.codec += ".";
  103475. track.codec += toHexString(codecConfig[9]);
  103476. track.codec += toHexString(codecConfig[10]);
  103477. track.codec += toHexString(codecConfig[11]);
  103478. } else {
  103479. track.codec = "avc1.4d400d";
  103480. }
  103481. } else if (/^mp4[a,v]$/i.test(track.codec)) {
  103482. codecConfig = codecBox.subarray(28);
  103483. codecConfigType = parseType_1(codecConfig.subarray(4, 8));
  103484. if (codecConfigType === "esds" && codecConfig.length > 20 && codecConfig[19] !== 0) {
  103485. track.codec += "." + toHexString(codecConfig[19]);
  103486. track.codec += "." + toHexString(codecConfig[20] >>> 2 & 63).replace(/^0/, "");
  103487. } else {
  103488. track.codec = "mp4a.40.2";
  103489. }
  103490. } else {
  103491. track.codec = track.codec.toLowerCase();
  103492. }
  103493. }
  103494. }
  103495. var mdhd2 = findBox_1(trak2, ["mdia", "mdhd"])[0];
  103496. if (mdhd2) {
  103497. track.timescale = getTimescaleFromMediaHeader(mdhd2);
  103498. }
  103499. tracks.push(track);
  103500. });
  103501. return tracks;
  103502. };
  103503. var probe$2 = {
  103504. findBox: findBox_1,
  103505. parseType: parseType_1,
  103506. timescale: timescale2,
  103507. startTime,
  103508. compositionStartTime,
  103509. videoTrackIds: getVideoTrackIds,
  103510. tracks: getTracks,
  103511. getTimescaleFromMediaHeader
  103512. };
  103513. var parsePid = function parsePid2(packet) {
  103514. var pid = packet[1] & 31;
  103515. pid <<= 8;
  103516. pid |= packet[2];
  103517. return pid;
  103518. };
  103519. var parsePayloadUnitStartIndicator = function parsePayloadUnitStartIndicator2(packet) {
  103520. return !!(packet[1] & 64);
  103521. };
  103522. var parseAdaptionField = function parseAdaptionField2(packet) {
  103523. var offset = 0;
  103524. if ((packet[3] & 48) >>> 4 > 1) {
  103525. offset += packet[4] + 1;
  103526. }
  103527. return offset;
  103528. };
  103529. var parseType = function parseType2(packet, pmtPid) {
  103530. var pid = parsePid(packet);
  103531. if (pid === 0) {
  103532. return "pat";
  103533. } else if (pid === pmtPid) {
  103534. return "pmt";
  103535. } else if (pmtPid) {
  103536. return "pes";
  103537. }
  103538. return null;
  103539. };
  103540. var parsePat = function parsePat2(packet) {
  103541. var pusi = parsePayloadUnitStartIndicator(packet);
  103542. var offset = 4 + parseAdaptionField(packet);
  103543. if (pusi) {
  103544. offset += packet[offset] + 1;
  103545. }
  103546. return (packet[offset + 10] & 31) << 8 | packet[offset + 11];
  103547. };
  103548. var parsePmt = function parsePmt2(packet) {
  103549. var programMapTable = {};
  103550. var pusi = parsePayloadUnitStartIndicator(packet);
  103551. var payloadOffset = 4 + parseAdaptionField(packet);
  103552. if (pusi) {
  103553. payloadOffset += packet[payloadOffset] + 1;
  103554. }
  103555. if (!(packet[payloadOffset + 5] & 1)) {
  103556. return;
  103557. }
  103558. var sectionLength, tableEnd, programInfoLength;
  103559. sectionLength = (packet[payloadOffset + 1] & 15) << 8 | packet[payloadOffset + 2];
  103560. tableEnd = 3 + sectionLength - 4;
  103561. programInfoLength = (packet[payloadOffset + 10] & 15) << 8 | packet[payloadOffset + 11];
  103562. var offset = 12 + programInfoLength;
  103563. while (offset < tableEnd) {
  103564. var i2 = payloadOffset + offset;
  103565. programMapTable[(packet[i2 + 1] & 31) << 8 | packet[i2 + 2]] = packet[i2];
  103566. offset += ((packet[i2 + 3] & 15) << 8 | packet[i2 + 4]) + 5;
  103567. }
  103568. return programMapTable;
  103569. };
  103570. var parsePesType = function parsePesType2(packet, programMapTable) {
  103571. var pid = parsePid(packet);
  103572. var type3 = programMapTable[pid];
  103573. switch (type3) {
  103574. case streamTypes.H264_STREAM_TYPE:
  103575. return "video";
  103576. case streamTypes.ADTS_STREAM_TYPE:
  103577. return "audio";
  103578. case streamTypes.METADATA_STREAM_TYPE:
  103579. return "timed-metadata";
  103580. default:
  103581. return null;
  103582. }
  103583. };
  103584. var parsePesTime = function parsePesTime2(packet) {
  103585. var pusi = parsePayloadUnitStartIndicator(packet);
  103586. if (!pusi) {
  103587. return null;
  103588. }
  103589. var offset = 4 + parseAdaptionField(packet);
  103590. if (offset >= packet.byteLength) {
  103591. return null;
  103592. }
  103593. var pes = null;
  103594. var ptsDtsFlags;
  103595. ptsDtsFlags = packet[offset + 7];
  103596. if (ptsDtsFlags & 192) {
  103597. pes = {};
  103598. pes.pts = (packet[offset + 9] & 14) << 27 | (packet[offset + 10] & 255) << 20 | (packet[offset + 11] & 254) << 12 | (packet[offset + 12] & 255) << 5 | (packet[offset + 13] & 254) >>> 3;
  103599. pes.pts *= 4;
  103600. pes.pts += (packet[offset + 13] & 6) >>> 1;
  103601. pes.dts = pes.pts;
  103602. if (ptsDtsFlags & 64) {
  103603. pes.dts = (packet[offset + 14] & 14) << 27 | (packet[offset + 15] & 255) << 20 | (packet[offset + 16] & 254) << 12 | (packet[offset + 17] & 255) << 5 | (packet[offset + 18] & 254) >>> 3;
  103604. pes.dts *= 4;
  103605. pes.dts += (packet[offset + 18] & 6) >>> 1;
  103606. }
  103607. }
  103608. return pes;
  103609. };
  103610. var parseNalUnitType = function parseNalUnitType2(type3) {
  103611. switch (type3) {
  103612. case 5:
  103613. return "slice_layer_without_partitioning_rbsp_idr";
  103614. case 6:
  103615. return "sei_rbsp";
  103616. case 7:
  103617. return "seq_parameter_set_rbsp";
  103618. case 8:
  103619. return "pic_parameter_set_rbsp";
  103620. case 9:
  103621. return "access_unit_delimiter_rbsp";
  103622. default:
  103623. return null;
  103624. }
  103625. };
  103626. var videoPacketContainsKeyFrame = function videoPacketContainsKeyFrame2(packet) {
  103627. var offset = 4 + parseAdaptionField(packet);
  103628. var frameBuffer = packet.subarray(offset);
  103629. var frameI = 0;
  103630. var frameSyncPoint = 0;
  103631. var foundKeyFrame = false;
  103632. var nalType;
  103633. for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) {
  103634. if (frameBuffer[frameSyncPoint + 2] === 1) {
  103635. frameI = frameSyncPoint + 5;
  103636. break;
  103637. }
  103638. }
  103639. while (frameI < frameBuffer.byteLength) {
  103640. switch (frameBuffer[frameI]) {
  103641. case 0:
  103642. if (frameBuffer[frameI - 1] !== 0) {
  103643. frameI += 2;
  103644. break;
  103645. } else if (frameBuffer[frameI - 2] !== 0) {
  103646. frameI++;
  103647. break;
  103648. }
  103649. if (frameSyncPoint + 3 !== frameI - 2) {
  103650. nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 31);
  103651. if (nalType === "slice_layer_without_partitioning_rbsp_idr") {
  103652. foundKeyFrame = true;
  103653. }
  103654. }
  103655. do {
  103656. frameI++;
  103657. } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length);
  103658. frameSyncPoint = frameI - 2;
  103659. frameI += 3;
  103660. break;
  103661. case 1:
  103662. if (frameBuffer[frameI - 1] !== 0 || frameBuffer[frameI - 2] !== 0) {
  103663. frameI += 3;
  103664. break;
  103665. }
  103666. nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 31);
  103667. if (nalType === "slice_layer_without_partitioning_rbsp_idr") {
  103668. foundKeyFrame = true;
  103669. }
  103670. frameSyncPoint = frameI - 2;
  103671. frameI += 3;
  103672. break;
  103673. default:
  103674. frameI += 3;
  103675. break;
  103676. }
  103677. }
  103678. frameBuffer = frameBuffer.subarray(frameSyncPoint);
  103679. frameI -= frameSyncPoint;
  103680. frameSyncPoint = 0;
  103681. if (frameBuffer && frameBuffer.byteLength > 3) {
  103682. nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 31);
  103683. if (nalType === "slice_layer_without_partitioning_rbsp_idr") {
  103684. foundKeyFrame = true;
  103685. }
  103686. }
  103687. return foundKeyFrame;
  103688. };
  103689. var probe$1 = {
  103690. parseType,
  103691. parsePat,
  103692. parsePmt,
  103693. parsePayloadUnitStartIndicator,
  103694. parsePesType,
  103695. parsePesTime,
  103696. videoPacketContainsKeyFrame
  103697. };
  103698. var handleRollover = timestampRolloverStream.handleRollover;
  103699. var probe = {};
  103700. probe.ts = probe$1;
  103701. probe.aac = utils2;
  103702. var ONE_SECOND_IN_TS2 = clock2.ONE_SECOND_IN_TS;
  103703. var MP2T_PACKET_LENGTH = 188, SYNC_BYTE = 71;
  103704. var parsePsi_ = function parsePsi_2(bytes, pmt) {
  103705. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH, packet, type3;
  103706. while (endIndex < bytes.byteLength) {
  103707. if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {
  103708. packet = bytes.subarray(startIndex, endIndex);
  103709. type3 = probe.ts.parseType(packet, pmt.pid);
  103710. switch (type3) {
  103711. case "pat":
  103712. pmt.pid = probe.ts.parsePat(packet);
  103713. break;
  103714. case "pmt":
  103715. var table = probe.ts.parsePmt(packet);
  103716. pmt.table = pmt.table || {};
  103717. Object.keys(table).forEach(function(key) {
  103718. pmt.table[key] = table[key];
  103719. });
  103720. break;
  103721. }
  103722. startIndex += MP2T_PACKET_LENGTH;
  103723. endIndex += MP2T_PACKET_LENGTH;
  103724. continue;
  103725. }
  103726. startIndex++;
  103727. endIndex++;
  103728. }
  103729. };
  103730. var parseAudioPes_ = function parseAudioPes_2(bytes, pmt, result) {
  103731. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH, packet, type3, pesType, pusi, parsed;
  103732. var endLoop = false;
  103733. while (endIndex <= bytes.byteLength) {
  103734. if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) {
  103735. packet = bytes.subarray(startIndex, endIndex);
  103736. type3 = probe.ts.parseType(packet, pmt.pid);
  103737. switch (type3) {
  103738. case "pes":
  103739. pesType = probe.ts.parsePesType(packet, pmt.table);
  103740. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  103741. if (pesType === "audio" && pusi) {
  103742. parsed = probe.ts.parsePesTime(packet);
  103743. if (parsed) {
  103744. parsed.type = "audio";
  103745. result.audio.push(parsed);
  103746. endLoop = true;
  103747. }
  103748. }
  103749. break;
  103750. }
  103751. if (endLoop) {
  103752. break;
  103753. }
  103754. startIndex += MP2T_PACKET_LENGTH;
  103755. endIndex += MP2T_PACKET_LENGTH;
  103756. continue;
  103757. }
  103758. startIndex++;
  103759. endIndex++;
  103760. }
  103761. endIndex = bytes.byteLength;
  103762. startIndex = endIndex - MP2T_PACKET_LENGTH;
  103763. endLoop = false;
  103764. while (startIndex >= 0) {
  103765. if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) {
  103766. packet = bytes.subarray(startIndex, endIndex);
  103767. type3 = probe.ts.parseType(packet, pmt.pid);
  103768. switch (type3) {
  103769. case "pes":
  103770. pesType = probe.ts.parsePesType(packet, pmt.table);
  103771. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  103772. if (pesType === "audio" && pusi) {
  103773. parsed = probe.ts.parsePesTime(packet);
  103774. if (parsed) {
  103775. parsed.type = "audio";
  103776. result.audio.push(parsed);
  103777. endLoop = true;
  103778. }
  103779. }
  103780. break;
  103781. }
  103782. if (endLoop) {
  103783. break;
  103784. }
  103785. startIndex -= MP2T_PACKET_LENGTH;
  103786. endIndex -= MP2T_PACKET_LENGTH;
  103787. continue;
  103788. }
  103789. startIndex--;
  103790. endIndex--;
  103791. }
  103792. };
  103793. var parseVideoPes_ = function parseVideoPes_2(bytes, pmt, result) {
  103794. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH, packet, type3, pesType, pusi, parsed, frame, i2, pes;
  103795. var endLoop = false;
  103796. var currentFrame = {
  103797. data: [],
  103798. size: 0
  103799. };
  103800. while (endIndex < bytes.byteLength) {
  103801. if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {
  103802. packet = bytes.subarray(startIndex, endIndex);
  103803. type3 = probe.ts.parseType(packet, pmt.pid);
  103804. switch (type3) {
  103805. case "pes":
  103806. pesType = probe.ts.parsePesType(packet, pmt.table);
  103807. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  103808. if (pesType === "video") {
  103809. if (pusi && !endLoop) {
  103810. parsed = probe.ts.parsePesTime(packet);
  103811. if (parsed) {
  103812. parsed.type = "video";
  103813. result.video.push(parsed);
  103814. endLoop = true;
  103815. }
  103816. }
  103817. if (!result.firstKeyFrame) {
  103818. if (pusi) {
  103819. if (currentFrame.size !== 0) {
  103820. frame = new Uint8Array(currentFrame.size);
  103821. i2 = 0;
  103822. while (currentFrame.data.length) {
  103823. pes = currentFrame.data.shift();
  103824. frame.set(pes, i2);
  103825. i2 += pes.byteLength;
  103826. }
  103827. if (probe.ts.videoPacketContainsKeyFrame(frame)) {
  103828. var firstKeyFrame = probe.ts.parsePesTime(frame);
  103829. if (firstKeyFrame) {
  103830. result.firstKeyFrame = firstKeyFrame;
  103831. result.firstKeyFrame.type = "video";
  103832. } else {
  103833. console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.");
  103834. }
  103835. }
  103836. currentFrame.size = 0;
  103837. }
  103838. }
  103839. currentFrame.data.push(packet);
  103840. currentFrame.size += packet.byteLength;
  103841. }
  103842. }
  103843. break;
  103844. }
  103845. if (endLoop && result.firstKeyFrame) {
  103846. break;
  103847. }
  103848. startIndex += MP2T_PACKET_LENGTH;
  103849. endIndex += MP2T_PACKET_LENGTH;
  103850. continue;
  103851. }
  103852. startIndex++;
  103853. endIndex++;
  103854. }
  103855. endIndex = bytes.byteLength;
  103856. startIndex = endIndex - MP2T_PACKET_LENGTH;
  103857. endLoop = false;
  103858. while (startIndex >= 0) {
  103859. if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {
  103860. packet = bytes.subarray(startIndex, endIndex);
  103861. type3 = probe.ts.parseType(packet, pmt.pid);
  103862. switch (type3) {
  103863. case "pes":
  103864. pesType = probe.ts.parsePesType(packet, pmt.table);
  103865. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  103866. if (pesType === "video" && pusi) {
  103867. parsed = probe.ts.parsePesTime(packet);
  103868. if (parsed) {
  103869. parsed.type = "video";
  103870. result.video.push(parsed);
  103871. endLoop = true;
  103872. }
  103873. }
  103874. break;
  103875. }
  103876. if (endLoop) {
  103877. break;
  103878. }
  103879. startIndex -= MP2T_PACKET_LENGTH;
  103880. endIndex -= MP2T_PACKET_LENGTH;
  103881. continue;
  103882. }
  103883. startIndex--;
  103884. endIndex--;
  103885. }
  103886. };
  103887. var adjustTimestamp_ = function adjustTimestamp_2(segmentInfo, baseTimestamp) {
  103888. if (segmentInfo.audio && segmentInfo.audio.length) {
  103889. var audioBaseTimestamp = baseTimestamp;
  103890. if (typeof audioBaseTimestamp === "undefined" || isNaN(audioBaseTimestamp)) {
  103891. audioBaseTimestamp = segmentInfo.audio[0].dts;
  103892. }
  103893. segmentInfo.audio.forEach(function(info) {
  103894. info.dts = handleRollover(info.dts, audioBaseTimestamp);
  103895. info.pts = handleRollover(info.pts, audioBaseTimestamp);
  103896. info.dtsTime = info.dts / ONE_SECOND_IN_TS2;
  103897. info.ptsTime = info.pts / ONE_SECOND_IN_TS2;
  103898. });
  103899. }
  103900. if (segmentInfo.video && segmentInfo.video.length) {
  103901. var videoBaseTimestamp = baseTimestamp;
  103902. if (typeof videoBaseTimestamp === "undefined" || isNaN(videoBaseTimestamp)) {
  103903. videoBaseTimestamp = segmentInfo.video[0].dts;
  103904. }
  103905. segmentInfo.video.forEach(function(info) {
  103906. info.dts = handleRollover(info.dts, videoBaseTimestamp);
  103907. info.pts = handleRollover(info.pts, videoBaseTimestamp);
  103908. info.dtsTime = info.dts / ONE_SECOND_IN_TS2;
  103909. info.ptsTime = info.pts / ONE_SECOND_IN_TS2;
  103910. });
  103911. if (segmentInfo.firstKeyFrame) {
  103912. var frame = segmentInfo.firstKeyFrame;
  103913. frame.dts = handleRollover(frame.dts, videoBaseTimestamp);
  103914. frame.pts = handleRollover(frame.pts, videoBaseTimestamp);
  103915. frame.dtsTime = frame.dts / ONE_SECOND_IN_TS2;
  103916. frame.ptsTime = frame.pts / ONE_SECOND_IN_TS2;
  103917. }
  103918. }
  103919. };
  103920. var inspectAac_ = function inspectAac_2(bytes) {
  103921. var endLoop = false, audioCount = 0, sampleRate = null, timestamp = null, frameSize = 0, byteIndex = 0, packet;
  103922. while (bytes.length - byteIndex >= 3) {
  103923. var type3 = probe.aac.parseType(bytes, byteIndex);
  103924. switch (type3) {
  103925. case "timed-metadata":
  103926. if (bytes.length - byteIndex < 10) {
  103927. endLoop = true;
  103928. break;
  103929. }
  103930. frameSize = probe.aac.parseId3TagSize(bytes, byteIndex);
  103931. if (frameSize > bytes.length) {
  103932. endLoop = true;
  103933. break;
  103934. }
  103935. if (timestamp === null) {
  103936. packet = bytes.subarray(byteIndex, byteIndex + frameSize);
  103937. timestamp = probe.aac.parseAacTimestamp(packet);
  103938. }
  103939. byteIndex += frameSize;
  103940. break;
  103941. case "audio":
  103942. if (bytes.length - byteIndex < 7) {
  103943. endLoop = true;
  103944. break;
  103945. }
  103946. frameSize = probe.aac.parseAdtsSize(bytes, byteIndex);
  103947. if (frameSize > bytes.length) {
  103948. endLoop = true;
  103949. break;
  103950. }
  103951. if (sampleRate === null) {
  103952. packet = bytes.subarray(byteIndex, byteIndex + frameSize);
  103953. sampleRate = probe.aac.parseSampleRate(packet);
  103954. }
  103955. audioCount++;
  103956. byteIndex += frameSize;
  103957. break;
  103958. default:
  103959. byteIndex++;
  103960. break;
  103961. }
  103962. if (endLoop) {
  103963. return null;
  103964. }
  103965. }
  103966. if (sampleRate === null || timestamp === null) {
  103967. return null;
  103968. }
  103969. var audioTimescale = ONE_SECOND_IN_TS2 / sampleRate;
  103970. var result = {
  103971. audio: [{
  103972. type: "audio",
  103973. dts: timestamp,
  103974. pts: timestamp
  103975. }, {
  103976. type: "audio",
  103977. dts: timestamp + audioCount * 1024 * audioTimescale,
  103978. pts: timestamp + audioCount * 1024 * audioTimescale
  103979. }]
  103980. };
  103981. return result;
  103982. };
  103983. var inspectTs_ = function inspectTs_2(bytes) {
  103984. var pmt = {
  103985. pid: null,
  103986. table: null
  103987. };
  103988. var result = {};
  103989. parsePsi_(bytes, pmt);
  103990. for (var pid in pmt.table) {
  103991. if (pmt.table.hasOwnProperty(pid)) {
  103992. var type3 = pmt.table[pid];
  103993. switch (type3) {
  103994. case streamTypes.H264_STREAM_TYPE:
  103995. result.video = [];
  103996. parseVideoPes_(bytes, pmt, result);
  103997. if (result.video.length === 0) {
  103998. delete result.video;
  103999. }
  104000. break;
  104001. case streamTypes.ADTS_STREAM_TYPE:
  104002. result.audio = [];
  104003. parseAudioPes_(bytes, pmt, result);
  104004. if (result.audio.length === 0) {
  104005. delete result.audio;
  104006. }
  104007. break;
  104008. }
  104009. }
  104010. }
  104011. return result;
  104012. };
  104013. var inspect = function inspect2(bytes, baseTimestamp) {
  104014. var isAacData = probe.aac.isLikelyAacData(bytes);
  104015. var result;
  104016. if (isAacData) {
  104017. result = inspectAac_(bytes);
  104018. } else {
  104019. result = inspectTs_(bytes);
  104020. }
  104021. if (!result || !result.audio && !result.video) {
  104022. return null;
  104023. }
  104024. adjustTimestamp_(result, baseTimestamp);
  104025. return result;
  104026. };
  104027. var tsInspector = {
  104028. inspect,
  104029. parseAudioPes_
  104030. };
  104031. var wireTransmuxerEvents = function wireTransmuxerEvents2(self2, transmuxer2) {
  104032. transmuxer2.on("data", function(segment) {
  104033. var initArray = segment.initSegment;
  104034. segment.initSegment = {
  104035. data: initArray.buffer,
  104036. byteOffset: initArray.byteOffset,
  104037. byteLength: initArray.byteLength
  104038. };
  104039. var typedArray = segment.data;
  104040. segment.data = typedArray.buffer;
  104041. self2.postMessage({
  104042. action: "data",
  104043. segment,
  104044. byteOffset: typedArray.byteOffset,
  104045. byteLength: typedArray.byteLength
  104046. }, [segment.data]);
  104047. });
  104048. transmuxer2.on("done", function(data) {
  104049. self2.postMessage({
  104050. action: "done"
  104051. });
  104052. });
  104053. transmuxer2.on("gopInfo", function(gopInfo) {
  104054. self2.postMessage({
  104055. action: "gopInfo",
  104056. gopInfo
  104057. });
  104058. });
  104059. transmuxer2.on("videoSegmentTimingInfo", function(timingInfo) {
  104060. var videoSegmentTimingInfo = {
  104061. start: {
  104062. decode: clock2.videoTsToSeconds(timingInfo.start.dts),
  104063. presentation: clock2.videoTsToSeconds(timingInfo.start.pts)
  104064. },
  104065. end: {
  104066. decode: clock2.videoTsToSeconds(timingInfo.end.dts),
  104067. presentation: clock2.videoTsToSeconds(timingInfo.end.pts)
  104068. },
  104069. baseMediaDecodeTime: clock2.videoTsToSeconds(timingInfo.baseMediaDecodeTime)
  104070. };
  104071. if (timingInfo.prependedContentDuration) {
  104072. videoSegmentTimingInfo.prependedContentDuration = clock2.videoTsToSeconds(timingInfo.prependedContentDuration);
  104073. }
  104074. self2.postMessage({
  104075. action: "videoSegmentTimingInfo",
  104076. videoSegmentTimingInfo
  104077. });
  104078. });
  104079. transmuxer2.on("audioSegmentTimingInfo", function(timingInfo) {
  104080. var audioSegmentTimingInfo = {
  104081. start: {
  104082. decode: clock2.videoTsToSeconds(timingInfo.start.dts),
  104083. presentation: clock2.videoTsToSeconds(timingInfo.start.pts)
  104084. },
  104085. end: {
  104086. decode: clock2.videoTsToSeconds(timingInfo.end.dts),
  104087. presentation: clock2.videoTsToSeconds(timingInfo.end.pts)
  104088. },
  104089. baseMediaDecodeTime: clock2.videoTsToSeconds(timingInfo.baseMediaDecodeTime)
  104090. };
  104091. if (timingInfo.prependedContentDuration) {
  104092. audioSegmentTimingInfo.prependedContentDuration = clock2.videoTsToSeconds(timingInfo.prependedContentDuration);
  104093. }
  104094. self2.postMessage({
  104095. action: "audioSegmentTimingInfo",
  104096. audioSegmentTimingInfo
  104097. });
  104098. });
  104099. transmuxer2.on("id3Frame", function(id3Frame) {
  104100. self2.postMessage({
  104101. action: "id3Frame",
  104102. id3Frame
  104103. });
  104104. });
  104105. transmuxer2.on("caption", function(caption) {
  104106. self2.postMessage({
  104107. action: "caption",
  104108. caption
  104109. });
  104110. });
  104111. transmuxer2.on("trackinfo", function(trackInfo) {
  104112. self2.postMessage({
  104113. action: "trackinfo",
  104114. trackInfo
  104115. });
  104116. });
  104117. transmuxer2.on("audioTimingInfo", function(audioTimingInfo) {
  104118. self2.postMessage({
  104119. action: "audioTimingInfo",
  104120. audioTimingInfo: {
  104121. start: clock2.videoTsToSeconds(audioTimingInfo.start),
  104122. end: clock2.videoTsToSeconds(audioTimingInfo.end)
  104123. }
  104124. });
  104125. });
  104126. transmuxer2.on("videoTimingInfo", function(videoTimingInfo) {
  104127. self2.postMessage({
  104128. action: "videoTimingInfo",
  104129. videoTimingInfo: {
  104130. start: clock2.videoTsToSeconds(videoTimingInfo.start),
  104131. end: clock2.videoTsToSeconds(videoTimingInfo.end)
  104132. }
  104133. });
  104134. });
  104135. transmuxer2.on("log", function(log2) {
  104136. self2.postMessage({
  104137. action: "log",
  104138. log: log2
  104139. });
  104140. });
  104141. };
  104142. var MessageHandlers = /* @__PURE__ */ function() {
  104143. function MessageHandlers2(self2, options2) {
  104144. this.options = options2 || {};
  104145. this.self = self2;
  104146. this.init();
  104147. }
  104148. var _proto = MessageHandlers2.prototype;
  104149. _proto.init = function init() {
  104150. if (this.transmuxer) {
  104151. this.transmuxer.dispose();
  104152. }
  104153. this.transmuxer = new transmuxer.Transmuxer(this.options);
  104154. wireTransmuxerEvents(this.self, this.transmuxer);
  104155. };
  104156. _proto.pushMp4Captions = function pushMp4Captions(data) {
  104157. if (!this.captionParser) {
  104158. this.captionParser = new captionParser();
  104159. this.captionParser.init();
  104160. }
  104161. var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength);
  104162. var parsed = this.captionParser.parse(segment, data.trackIds, data.timescales);
  104163. this.self.postMessage({
  104164. action: "mp4Captions",
  104165. captions: parsed && parsed.captions || [],
  104166. logs: parsed && parsed.logs || [],
  104167. data: segment.buffer
  104168. }, [segment.buffer]);
  104169. };
  104170. _proto.probeMp4StartTime = function probeMp4StartTime(_ref) {
  104171. var timescales = _ref.timescales, data = _ref.data;
  104172. var startTime2 = probe$2.startTime(timescales, data);
  104173. this.self.postMessage({
  104174. action: "probeMp4StartTime",
  104175. startTime: startTime2,
  104176. data
  104177. }, [data.buffer]);
  104178. };
  104179. _proto.probeMp4Tracks = function probeMp4Tracks(_ref2) {
  104180. var data = _ref2.data;
  104181. var tracks = probe$2.tracks(data);
  104182. this.self.postMessage({
  104183. action: "probeMp4Tracks",
  104184. tracks,
  104185. data
  104186. }, [data.buffer]);
  104187. };
  104188. _proto.probeTs = function probeTs(_ref3) {
  104189. var data = _ref3.data, baseStartTime = _ref3.baseStartTime;
  104190. var tsStartTime = typeof baseStartTime === "number" && !isNaN(baseStartTime) ? baseStartTime * clock2.ONE_SECOND_IN_TS : void 0;
  104191. var timeInfo = tsInspector.inspect(data, tsStartTime);
  104192. var result = null;
  104193. if (timeInfo) {
  104194. result = {
  104195. hasVideo: timeInfo.video && timeInfo.video.length === 2 || false,
  104196. hasAudio: timeInfo.audio && timeInfo.audio.length === 2 || false
  104197. };
  104198. if (result.hasVideo) {
  104199. result.videoStart = timeInfo.video[0].ptsTime;
  104200. }
  104201. if (result.hasAudio) {
  104202. result.audioStart = timeInfo.audio[0].ptsTime;
  104203. }
  104204. }
  104205. this.self.postMessage({
  104206. action: "probeTs",
  104207. result,
  104208. data
  104209. }, [data.buffer]);
  104210. };
  104211. _proto.clearAllMp4Captions = function clearAllMp4Captions() {
  104212. if (this.captionParser) {
  104213. this.captionParser.clearAllCaptions();
  104214. }
  104215. };
  104216. _proto.clearParsedMp4Captions = function clearParsedMp4Captions() {
  104217. if (this.captionParser) {
  104218. this.captionParser.clearParsedCaptions();
  104219. }
  104220. };
  104221. _proto.push = function push(data) {
  104222. var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength);
  104223. this.transmuxer.push(segment);
  104224. };
  104225. _proto.reset = function reset3() {
  104226. this.transmuxer.reset();
  104227. };
  104228. _proto.setTimestampOffset = function setTimestampOffset(data) {
  104229. var timestampOffset2 = data.timestampOffset || 0;
  104230. this.transmuxer.setBaseMediaDecodeTime(Math.round(clock2.secondsToVideoTs(timestampOffset2)));
  104231. };
  104232. _proto.setAudioAppendStart = function setAudioAppendStart(data) {
  104233. this.transmuxer.setAudioAppendStart(Math.ceil(clock2.secondsToVideoTs(data.appendStart)));
  104234. };
  104235. _proto.setRemux = function setRemux(data) {
  104236. this.transmuxer.setRemux(data.remux);
  104237. };
  104238. _proto.flush = function flush(data) {
  104239. this.transmuxer.flush();
  104240. self.postMessage({
  104241. action: "done",
  104242. type: "transmuxed"
  104243. });
  104244. };
  104245. _proto.endTimeline = function endTimeline3() {
  104246. this.transmuxer.endTimeline();
  104247. self.postMessage({
  104248. action: "endedtimeline",
  104249. type: "transmuxed"
  104250. });
  104251. };
  104252. _proto.alignGopsWith = function alignGopsWith(data) {
  104253. this.transmuxer.alignGopsWith(data.gopsToAlignWith.slice());
  104254. };
  104255. return MessageHandlers2;
  104256. }();
  104257. self.onmessage = function(event2) {
  104258. if (event2.data.action === "init" && event2.data.options) {
  104259. this.messageHandlers = new MessageHandlers(self, event2.data.options);
  104260. return;
  104261. }
  104262. if (!this.messageHandlers) {
  104263. this.messageHandlers = new MessageHandlers(self);
  104264. }
  104265. if (event2.data && event2.data.action && event2.data.action !== "init") {
  104266. if (this.messageHandlers[event2.data.action]) {
  104267. this.messageHandlers[event2.data.action](event2.data);
  104268. }
  104269. }
  104270. };
  104271. }));
  104272. var TransmuxWorker = factory(workerCode$1);
  104273. var handleData_ = function handleData_2(event2, transmuxedData, callback2) {
  104274. var _event$data$segment = event2.data.segment, type2 = _event$data$segment.type, initSegment = _event$data$segment.initSegment, captions = _event$data$segment.captions, captionStreams = _event$data$segment.captionStreams, metadata = _event$data$segment.metadata, videoFrameDtsTime = _event$data$segment.videoFrameDtsTime, videoFramePtsTime = _event$data$segment.videoFramePtsTime;
  104275. transmuxedData.buffer.push({
  104276. captions,
  104277. captionStreams,
  104278. metadata
  104279. });
  104280. var boxes = event2.data.segment.boxes || {
  104281. data: event2.data.segment.data
  104282. };
  104283. var result = {
  104284. type: type2,
  104285. data: new Uint8Array(boxes.data, boxes.data.byteOffset, boxes.data.byteLength),
  104286. initSegment: new Uint8Array(initSegment.data, initSegment.byteOffset, initSegment.byteLength)
  104287. };
  104288. if (typeof videoFrameDtsTime !== "undefined") {
  104289. result.videoFrameDtsTime = videoFrameDtsTime;
  104290. }
  104291. if (typeof videoFramePtsTime !== "undefined") {
  104292. result.videoFramePtsTime = videoFramePtsTime;
  104293. }
  104294. callback2(result);
  104295. };
  104296. var handleDone_ = function handleDone_2(_ref) {
  104297. var transmuxedData = _ref.transmuxedData, callback2 = _ref.callback;
  104298. transmuxedData.buffer = [];
  104299. callback2(transmuxedData);
  104300. };
  104301. var handleGopInfo_ = function handleGopInfo_2(event2, transmuxedData) {
  104302. transmuxedData.gopInfo = event2.data.gopInfo;
  104303. };
  104304. var processTransmux = function processTransmux2(options2) {
  104305. var transmuxer = options2.transmuxer, bytes = options2.bytes, audioAppendStart = options2.audioAppendStart, gopsToAlignWith = options2.gopsToAlignWith, remux = options2.remux, onData = options2.onData, onTrackInfo = options2.onTrackInfo, onAudioTimingInfo = options2.onAudioTimingInfo, onVideoTimingInfo = options2.onVideoTimingInfo, onVideoSegmentTimingInfo = options2.onVideoSegmentTimingInfo, onAudioSegmentTimingInfo = options2.onAudioSegmentTimingInfo, onId3 = options2.onId3, onCaptions = options2.onCaptions, onDone = options2.onDone, onEndedTimeline = options2.onEndedTimeline, onTransmuxerLog = options2.onTransmuxerLog, isEndOfTimeline = options2.isEndOfTimeline;
  104306. var transmuxedData = {
  104307. buffer: []
  104308. };
  104309. var waitForEndedTimelineEvent = isEndOfTimeline;
  104310. var handleMessage = function handleMessage2(event2) {
  104311. if (transmuxer.currentTransmux !== options2) {
  104312. return;
  104313. }
  104314. if (event2.data.action === "data") {
  104315. handleData_(event2, transmuxedData, onData);
  104316. }
  104317. if (event2.data.action === "trackinfo") {
  104318. onTrackInfo(event2.data.trackInfo);
  104319. }
  104320. if (event2.data.action === "gopInfo") {
  104321. handleGopInfo_(event2, transmuxedData);
  104322. }
  104323. if (event2.data.action === "audioTimingInfo") {
  104324. onAudioTimingInfo(event2.data.audioTimingInfo);
  104325. }
  104326. if (event2.data.action === "videoTimingInfo") {
  104327. onVideoTimingInfo(event2.data.videoTimingInfo);
  104328. }
  104329. if (event2.data.action === "videoSegmentTimingInfo") {
  104330. onVideoSegmentTimingInfo(event2.data.videoSegmentTimingInfo);
  104331. }
  104332. if (event2.data.action === "audioSegmentTimingInfo") {
  104333. onAudioSegmentTimingInfo(event2.data.audioSegmentTimingInfo);
  104334. }
  104335. if (event2.data.action === "id3Frame") {
  104336. onId3([event2.data.id3Frame], event2.data.id3Frame.dispatchType);
  104337. }
  104338. if (event2.data.action === "caption") {
  104339. onCaptions(event2.data.caption);
  104340. }
  104341. if (event2.data.action === "endedtimeline") {
  104342. waitForEndedTimelineEvent = false;
  104343. onEndedTimeline();
  104344. }
  104345. if (event2.data.action === "log") {
  104346. onTransmuxerLog(event2.data.log);
  104347. }
  104348. if (event2.data.type !== "transmuxed") {
  104349. return;
  104350. }
  104351. if (waitForEndedTimelineEvent) {
  104352. return;
  104353. }
  104354. transmuxer.onmessage = null;
  104355. handleDone_({
  104356. transmuxedData,
  104357. callback: onDone
  104358. });
  104359. dequeue(transmuxer);
  104360. };
  104361. transmuxer.onmessage = handleMessage;
  104362. if (audioAppendStart) {
  104363. transmuxer.postMessage({
  104364. action: "setAudioAppendStart",
  104365. appendStart: audioAppendStart
  104366. });
  104367. }
  104368. if (Array.isArray(gopsToAlignWith)) {
  104369. transmuxer.postMessage({
  104370. action: "alignGopsWith",
  104371. gopsToAlignWith
  104372. });
  104373. }
  104374. if (typeof remux !== "undefined") {
  104375. transmuxer.postMessage({
  104376. action: "setRemux",
  104377. remux
  104378. });
  104379. }
  104380. if (bytes.byteLength) {
  104381. var buffer = bytes instanceof ArrayBuffer ? bytes : bytes.buffer;
  104382. var byteOffset = bytes instanceof ArrayBuffer ? 0 : bytes.byteOffset;
  104383. transmuxer.postMessage({
  104384. action: "push",
  104385. data: buffer,
  104386. byteOffset,
  104387. byteLength: bytes.byteLength
  104388. }, [buffer]);
  104389. }
  104390. if (isEndOfTimeline) {
  104391. transmuxer.postMessage({
  104392. action: "endTimeline"
  104393. });
  104394. }
  104395. transmuxer.postMessage({
  104396. action: "flush"
  104397. });
  104398. };
  104399. var dequeue = function dequeue2(transmuxer) {
  104400. transmuxer.currentTransmux = null;
  104401. if (transmuxer.transmuxQueue.length) {
  104402. transmuxer.currentTransmux = transmuxer.transmuxQueue.shift();
  104403. if (typeof transmuxer.currentTransmux === "function") {
  104404. transmuxer.currentTransmux();
  104405. } else {
  104406. processTransmux(transmuxer.currentTransmux);
  104407. }
  104408. }
  104409. };
  104410. var processAction = function processAction2(transmuxer, action) {
  104411. transmuxer.postMessage({
  104412. action
  104413. });
  104414. dequeue(transmuxer);
  104415. };
  104416. var enqueueAction = function enqueueAction2(action, transmuxer) {
  104417. if (!transmuxer.currentTransmux) {
  104418. transmuxer.currentTransmux = action;
  104419. processAction(transmuxer, action);
  104420. return;
  104421. }
  104422. transmuxer.transmuxQueue.push(processAction.bind(null, transmuxer, action));
  104423. };
  104424. var reset = function reset2(transmuxer) {
  104425. enqueueAction("reset", transmuxer);
  104426. };
  104427. var endTimeline = function endTimeline2(transmuxer) {
  104428. enqueueAction("endTimeline", transmuxer);
  104429. };
  104430. var transmux = function transmux2(options2) {
  104431. if (!options2.transmuxer.currentTransmux) {
  104432. options2.transmuxer.currentTransmux = options2;
  104433. processTransmux(options2);
  104434. return;
  104435. }
  104436. options2.transmuxer.transmuxQueue.push(options2);
  104437. };
  104438. var createTransmuxer = function createTransmuxer2(options2) {
  104439. var transmuxer = new TransmuxWorker();
  104440. transmuxer.currentTransmux = null;
  104441. transmuxer.transmuxQueue = [];
  104442. var term = transmuxer.terminate;
  104443. transmuxer.terminate = function() {
  104444. transmuxer.currentTransmux = null;
  104445. transmuxer.transmuxQueue.length = 0;
  104446. return term.call(transmuxer);
  104447. };
  104448. transmuxer.postMessage({
  104449. action: "init",
  104450. options: options2
  104451. });
  104452. return transmuxer;
  104453. };
  104454. var segmentTransmuxer = {
  104455. reset,
  104456. endTimeline,
  104457. transmux,
  104458. createTransmuxer
  104459. };
  104460. var workerCallback = function workerCallback2(options2) {
  104461. var transmuxer = options2.transmuxer;
  104462. var endAction = options2.endAction || options2.action;
  104463. var callback2 = options2.callback;
  104464. var message = _extends$2({}, options2, {
  104465. endAction: null,
  104466. transmuxer: null,
  104467. callback: null
  104468. });
  104469. var listenForEndEvent = function listenForEndEvent2(event2) {
  104470. if (event2.data.action !== endAction) {
  104471. return;
  104472. }
  104473. transmuxer.removeEventListener("message", listenForEndEvent2);
  104474. if (event2.data.data) {
  104475. event2.data.data = new Uint8Array(event2.data.data, options2.byteOffset || 0, options2.byteLength || event2.data.data.byteLength);
  104476. if (options2.data) {
  104477. options2.data = event2.data.data;
  104478. }
  104479. }
  104480. callback2(event2.data);
  104481. };
  104482. transmuxer.addEventListener("message", listenForEndEvent);
  104483. if (options2.data) {
  104484. var isArrayBuffer = options2.data instanceof ArrayBuffer;
  104485. message.byteOffset = isArrayBuffer ? 0 : options2.data.byteOffset;
  104486. message.byteLength = options2.data.byteLength;
  104487. var transfers = [isArrayBuffer ? options2.data : options2.data.buffer];
  104488. transmuxer.postMessage(message, transfers);
  104489. } else {
  104490. transmuxer.postMessage(message);
  104491. }
  104492. };
  104493. var REQUEST_ERRORS = {
  104494. FAILURE: 2,
  104495. TIMEOUT: -101,
  104496. ABORTED: -102
  104497. };
  104498. var abortAll = function abortAll2(activeXhrs) {
  104499. activeXhrs.forEach(function(xhr) {
  104500. xhr.abort();
  104501. });
  104502. };
  104503. var getRequestStats = function getRequestStats2(request) {
  104504. return {
  104505. bandwidth: request.bandwidth,
  104506. bytesReceived: request.bytesReceived || 0,
  104507. roundTripTime: request.roundTripTime || 0
  104508. };
  104509. };
  104510. var getProgressStats = function getProgressStats2(progressEvent) {
  104511. var request = progressEvent.target;
  104512. var roundTripTime = Date.now() - request.requestTime;
  104513. var stats = {
  104514. bandwidth: Infinity,
  104515. bytesReceived: 0,
  104516. roundTripTime: roundTripTime || 0
  104517. };
  104518. stats.bytesReceived = progressEvent.loaded;
  104519. stats.bandwidth = Math.floor(stats.bytesReceived / stats.roundTripTime * 8 * 1e3);
  104520. return stats;
  104521. };
  104522. var handleErrors = function handleErrors2(error, request) {
  104523. if (request.timedout) {
  104524. return {
  104525. status: request.status,
  104526. message: "HLS request timed-out at URL: " + request.uri,
  104527. code: REQUEST_ERRORS.TIMEOUT,
  104528. xhr: request
  104529. };
  104530. }
  104531. if (request.aborted) {
  104532. return {
  104533. status: request.status,
  104534. message: "HLS request aborted at URL: " + request.uri,
  104535. code: REQUEST_ERRORS.ABORTED,
  104536. xhr: request
  104537. };
  104538. }
  104539. if (error) {
  104540. return {
  104541. status: request.status,
  104542. message: "HLS request errored at URL: " + request.uri,
  104543. code: REQUEST_ERRORS.FAILURE,
  104544. xhr: request
  104545. };
  104546. }
  104547. if (request.responseType === "arraybuffer" && request.response.byteLength === 0) {
  104548. return {
  104549. status: request.status,
  104550. message: "Empty HLS response at URL: " + request.uri,
  104551. code: REQUEST_ERRORS.FAILURE,
  104552. xhr: request
  104553. };
  104554. }
  104555. return null;
  104556. };
  104557. var handleKeyResponse = function handleKeyResponse2(segment, objects, finishProcessingFn) {
  104558. return function(error, request) {
  104559. var response = request.response;
  104560. var errorObj = handleErrors(error, request);
  104561. if (errorObj) {
  104562. return finishProcessingFn(errorObj, segment);
  104563. }
  104564. if (response.byteLength !== 16) {
  104565. return finishProcessingFn({
  104566. status: request.status,
  104567. message: "Invalid HLS key at URL: " + request.uri,
  104568. code: REQUEST_ERRORS.FAILURE,
  104569. xhr: request
  104570. }, segment);
  104571. }
  104572. var view = new DataView(response);
  104573. var bytes = new Uint32Array([view.getUint32(0), view.getUint32(4), view.getUint32(8), view.getUint32(12)]);
  104574. for (var i2 = 0; i2 < objects.length; i2++) {
  104575. objects[i2].bytes = bytes;
  104576. }
  104577. return finishProcessingFn(null, segment);
  104578. };
  104579. };
  104580. var parseInitSegment = function parseInitSegment2(segment, _callback) {
  104581. var type2 = detectContainerForBytes2(segment.map.bytes);
  104582. if (type2 !== "mp4") {
  104583. var uri = segment.map.resolvedUri || segment.map.uri;
  104584. return _callback({
  104585. internal: true,
  104586. message: "Found unsupported " + (type2 || "unknown") + " container for initialization segment at URL: " + uri,
  104587. code: REQUEST_ERRORS.FAILURE
  104588. });
  104589. }
  104590. workerCallback({
  104591. action: "probeMp4Tracks",
  104592. data: segment.map.bytes,
  104593. transmuxer: segment.transmuxer,
  104594. callback: function callback2(_ref) {
  104595. var tracks = _ref.tracks, data = _ref.data;
  104596. segment.map.bytes = data;
  104597. tracks.forEach(function(track) {
  104598. segment.map.tracks = segment.map.tracks || {};
  104599. if (segment.map.tracks[track.type]) {
  104600. return;
  104601. }
  104602. segment.map.tracks[track.type] = track;
  104603. if (typeof track.id === "number" && track.timescale) {
  104604. segment.map.timescales = segment.map.timescales || {};
  104605. segment.map.timescales[track.id] = track.timescale;
  104606. }
  104607. });
  104608. return _callback(null);
  104609. }
  104610. });
  104611. };
  104612. var handleInitSegmentResponse = function handleInitSegmentResponse2(_ref2) {
  104613. var segment = _ref2.segment, finishProcessingFn = _ref2.finishProcessingFn;
  104614. return function(error, request) {
  104615. var errorObj = handleErrors(error, request);
  104616. if (errorObj) {
  104617. return finishProcessingFn(errorObj, segment);
  104618. }
  104619. var bytes = new Uint8Array(request.response);
  104620. if (segment.map.key) {
  104621. segment.map.encryptedBytes = bytes;
  104622. return finishProcessingFn(null, segment);
  104623. }
  104624. segment.map.bytes = bytes;
  104625. parseInitSegment(segment, function(parseError) {
  104626. if (parseError) {
  104627. parseError.xhr = request;
  104628. parseError.status = request.status;
  104629. return finishProcessingFn(parseError, segment);
  104630. }
  104631. finishProcessingFn(null, segment);
  104632. });
  104633. };
  104634. };
  104635. var handleSegmentResponse = function handleSegmentResponse2(_ref3) {
  104636. var segment = _ref3.segment, finishProcessingFn = _ref3.finishProcessingFn, responseType = _ref3.responseType;
  104637. return function(error, request) {
  104638. var errorObj = handleErrors(error, request);
  104639. if (errorObj) {
  104640. return finishProcessingFn(errorObj, segment);
  104641. }
  104642. var newBytes = responseType === "arraybuffer" || !request.responseText ? request.response : stringToArrayBuffer(request.responseText.substring(segment.lastReachedChar || 0));
  104643. segment.stats = getRequestStats(request);
  104644. if (segment.key) {
  104645. segment.encryptedBytes = new Uint8Array(newBytes);
  104646. } else {
  104647. segment.bytes = new Uint8Array(newBytes);
  104648. }
  104649. return finishProcessingFn(null, segment);
  104650. };
  104651. };
  104652. var transmuxAndNotify = function transmuxAndNotify2(_ref4) {
  104653. var segment = _ref4.segment, bytes = _ref4.bytes, trackInfoFn = _ref4.trackInfoFn, timingInfoFn = _ref4.timingInfoFn, videoSegmentTimingInfoFn = _ref4.videoSegmentTimingInfoFn, audioSegmentTimingInfoFn = _ref4.audioSegmentTimingInfoFn, id3Fn = _ref4.id3Fn, captionsFn = _ref4.captionsFn, isEndOfTimeline = _ref4.isEndOfTimeline, endedTimelineFn = _ref4.endedTimelineFn, dataFn = _ref4.dataFn, doneFn = _ref4.doneFn, onTransmuxerLog = _ref4.onTransmuxerLog;
  104654. var fmp4Tracks = segment.map && segment.map.tracks || {};
  104655. var isMuxed3 = Boolean(fmp4Tracks.audio && fmp4Tracks.video);
  104656. var audioStartFn = timingInfoFn.bind(null, segment, "audio", "start");
  104657. var audioEndFn = timingInfoFn.bind(null, segment, "audio", "end");
  104658. var videoStartFn = timingInfoFn.bind(null, segment, "video", "start");
  104659. var videoEndFn = timingInfoFn.bind(null, segment, "video", "end");
  104660. var finish = function finish2() {
  104661. return transmux({
  104662. bytes,
  104663. transmuxer: segment.transmuxer,
  104664. audioAppendStart: segment.audioAppendStart,
  104665. gopsToAlignWith: segment.gopsToAlignWith,
  104666. remux: isMuxed3,
  104667. onData: function onData(result) {
  104668. result.type = result.type === "combined" ? "video" : result.type;
  104669. dataFn(segment, result);
  104670. },
  104671. onTrackInfo: function onTrackInfo(trackInfo) {
  104672. if (trackInfoFn) {
  104673. if (isMuxed3) {
  104674. trackInfo.isMuxed = true;
  104675. }
  104676. trackInfoFn(segment, trackInfo);
  104677. }
  104678. },
  104679. onAudioTimingInfo: function onAudioTimingInfo(audioTimingInfo) {
  104680. if (audioStartFn && typeof audioTimingInfo.start !== "undefined") {
  104681. audioStartFn(audioTimingInfo.start);
  104682. audioStartFn = null;
  104683. }
  104684. if (audioEndFn && typeof audioTimingInfo.end !== "undefined") {
  104685. audioEndFn(audioTimingInfo.end);
  104686. }
  104687. },
  104688. onVideoTimingInfo: function onVideoTimingInfo(videoTimingInfo) {
  104689. if (videoStartFn && typeof videoTimingInfo.start !== "undefined") {
  104690. videoStartFn(videoTimingInfo.start);
  104691. videoStartFn = null;
  104692. }
  104693. if (videoEndFn && typeof videoTimingInfo.end !== "undefined") {
  104694. videoEndFn(videoTimingInfo.end);
  104695. }
  104696. },
  104697. onVideoSegmentTimingInfo: function onVideoSegmentTimingInfo(videoSegmentTimingInfo) {
  104698. videoSegmentTimingInfoFn(videoSegmentTimingInfo);
  104699. },
  104700. onAudioSegmentTimingInfo: function onAudioSegmentTimingInfo(audioSegmentTimingInfo) {
  104701. audioSegmentTimingInfoFn(audioSegmentTimingInfo);
  104702. },
  104703. onId3: function onId3(id3Frames, dispatchType) {
  104704. id3Fn(segment, id3Frames, dispatchType);
  104705. },
  104706. onCaptions: function onCaptions(captions) {
  104707. captionsFn(segment, [captions]);
  104708. },
  104709. isEndOfTimeline,
  104710. onEndedTimeline: function onEndedTimeline() {
  104711. endedTimelineFn();
  104712. },
  104713. onTransmuxerLog,
  104714. onDone: function onDone(result) {
  104715. if (!doneFn) {
  104716. return;
  104717. }
  104718. result.type = result.type === "combined" ? "video" : result.type;
  104719. doneFn(null, segment, result);
  104720. }
  104721. });
  104722. };
  104723. workerCallback({
  104724. action: "probeTs",
  104725. transmuxer: segment.transmuxer,
  104726. data: bytes,
  104727. baseStartTime: segment.baseStartTime,
  104728. callback: function callback2(data) {
  104729. segment.bytes = bytes = data.data;
  104730. var probeResult = data.result;
  104731. if (probeResult) {
  104732. trackInfoFn(segment, {
  104733. hasAudio: probeResult.hasAudio,
  104734. hasVideo: probeResult.hasVideo,
  104735. isMuxed: isMuxed3
  104736. });
  104737. trackInfoFn = null;
  104738. if (probeResult.hasAudio && !isMuxed3) {
  104739. audioStartFn(probeResult.audioStart);
  104740. }
  104741. if (probeResult.hasVideo) {
  104742. videoStartFn(probeResult.videoStart);
  104743. }
  104744. audioStartFn = null;
  104745. videoStartFn = null;
  104746. }
  104747. finish();
  104748. }
  104749. });
  104750. };
  104751. var handleSegmentBytes = function handleSegmentBytes2(_ref5) {
  104752. var segment = _ref5.segment, bytes = _ref5.bytes, trackInfoFn = _ref5.trackInfoFn, timingInfoFn = _ref5.timingInfoFn, videoSegmentTimingInfoFn = _ref5.videoSegmentTimingInfoFn, audioSegmentTimingInfoFn = _ref5.audioSegmentTimingInfoFn, id3Fn = _ref5.id3Fn, captionsFn = _ref5.captionsFn, isEndOfTimeline = _ref5.isEndOfTimeline, endedTimelineFn = _ref5.endedTimelineFn, dataFn = _ref5.dataFn, doneFn = _ref5.doneFn, onTransmuxerLog = _ref5.onTransmuxerLog;
  104753. var bytesAsUint8Array = new Uint8Array(bytes);
  104754. if (isLikelyFmp4MediaSegment2(bytesAsUint8Array)) {
  104755. segment.isFmp4 = true;
  104756. var tracks = segment.map.tracks;
  104757. var trackInfo = {
  104758. isFmp4: true,
  104759. hasVideo: !!tracks.video,
  104760. hasAudio: !!tracks.audio
  104761. };
  104762. if (tracks.audio && tracks.audio.codec && tracks.audio.codec !== "enca") {
  104763. trackInfo.audioCodec = tracks.audio.codec;
  104764. }
  104765. if (tracks.video && tracks.video.codec && tracks.video.codec !== "encv") {
  104766. trackInfo.videoCodec = tracks.video.codec;
  104767. }
  104768. if (tracks.video && tracks.audio) {
  104769. trackInfo.isMuxed = true;
  104770. }
  104771. trackInfoFn(segment, trackInfo);
  104772. var finishLoading = function finishLoading2(captions) {
  104773. dataFn(segment, {
  104774. data: bytesAsUint8Array,
  104775. type: trackInfo.hasAudio && !trackInfo.isMuxed ? "audio" : "video"
  104776. });
  104777. if (captions && captions.length) {
  104778. captionsFn(segment, captions);
  104779. }
  104780. doneFn(null, segment, {});
  104781. };
  104782. workerCallback({
  104783. action: "probeMp4StartTime",
  104784. timescales: segment.map.timescales,
  104785. data: bytesAsUint8Array,
  104786. transmuxer: segment.transmuxer,
  104787. callback: function callback2(_ref6) {
  104788. var data = _ref6.data, startTime = _ref6.startTime;
  104789. bytes = data.buffer;
  104790. segment.bytes = bytesAsUint8Array = data;
  104791. if (trackInfo.hasAudio && !trackInfo.isMuxed) {
  104792. timingInfoFn(segment, "audio", "start", startTime);
  104793. }
  104794. if (trackInfo.hasVideo) {
  104795. timingInfoFn(segment, "video", "start", startTime);
  104796. }
  104797. if (!tracks.video || !data.byteLength || !segment.transmuxer) {
  104798. finishLoading();
  104799. return;
  104800. }
  104801. workerCallback({
  104802. action: "pushMp4Captions",
  104803. endAction: "mp4Captions",
  104804. transmuxer: segment.transmuxer,
  104805. data: bytesAsUint8Array,
  104806. timescales: segment.map.timescales,
  104807. trackIds: [tracks.video.id],
  104808. callback: function callback3(message) {
  104809. bytes = message.data.buffer;
  104810. segment.bytes = bytesAsUint8Array = message.data;
  104811. message.logs.forEach(function(log2) {
  104812. onTransmuxerLog(videojs.mergeOptions(log2, {
  104813. stream: "mp4CaptionParser"
  104814. }));
  104815. });
  104816. finishLoading(message.captions);
  104817. }
  104818. });
  104819. }
  104820. });
  104821. return;
  104822. }
  104823. if (!segment.transmuxer) {
  104824. doneFn(null, segment, {});
  104825. return;
  104826. }
  104827. if (typeof segment.container === "undefined") {
  104828. segment.container = detectContainerForBytes2(bytesAsUint8Array);
  104829. }
  104830. if (segment.container !== "ts" && segment.container !== "aac") {
  104831. trackInfoFn(segment, {
  104832. hasAudio: false,
  104833. hasVideo: false
  104834. });
  104835. doneFn(null, segment, {});
  104836. return;
  104837. }
  104838. transmuxAndNotify({
  104839. segment,
  104840. bytes,
  104841. trackInfoFn,
  104842. timingInfoFn,
  104843. videoSegmentTimingInfoFn,
  104844. audioSegmentTimingInfoFn,
  104845. id3Fn,
  104846. captionsFn,
  104847. isEndOfTimeline,
  104848. endedTimelineFn,
  104849. dataFn,
  104850. doneFn,
  104851. onTransmuxerLog
  104852. });
  104853. };
  104854. var decrypt = function decrypt2(_ref7, callback2) {
  104855. var id = _ref7.id, key = _ref7.key, encryptedBytes = _ref7.encryptedBytes, decryptionWorker = _ref7.decryptionWorker;
  104856. var decryptionHandler = function decryptionHandler2(event2) {
  104857. if (event2.data.source === id) {
  104858. decryptionWorker.removeEventListener("message", decryptionHandler2);
  104859. var decrypted = event2.data.decrypted;
  104860. callback2(new Uint8Array(decrypted.bytes, decrypted.byteOffset, decrypted.byteLength));
  104861. }
  104862. };
  104863. decryptionWorker.addEventListener("message", decryptionHandler);
  104864. var keyBytes;
  104865. if (key.bytes.slice) {
  104866. keyBytes = key.bytes.slice();
  104867. } else {
  104868. keyBytes = new Uint32Array(Array.prototype.slice.call(key.bytes));
  104869. }
  104870. decryptionWorker.postMessage(createTransferableMessage({
  104871. source: id,
  104872. encrypted: encryptedBytes,
  104873. key: keyBytes,
  104874. iv: key.iv
  104875. }), [encryptedBytes.buffer, keyBytes.buffer]);
  104876. };
  104877. var decryptSegment = function decryptSegment2(_ref8) {
  104878. var decryptionWorker = _ref8.decryptionWorker, segment = _ref8.segment, trackInfoFn = _ref8.trackInfoFn, timingInfoFn = _ref8.timingInfoFn, videoSegmentTimingInfoFn = _ref8.videoSegmentTimingInfoFn, audioSegmentTimingInfoFn = _ref8.audioSegmentTimingInfoFn, id3Fn = _ref8.id3Fn, captionsFn = _ref8.captionsFn, isEndOfTimeline = _ref8.isEndOfTimeline, endedTimelineFn = _ref8.endedTimelineFn, dataFn = _ref8.dataFn, doneFn = _ref8.doneFn, onTransmuxerLog = _ref8.onTransmuxerLog;
  104879. decrypt({
  104880. id: segment.requestId,
  104881. key: segment.key,
  104882. encryptedBytes: segment.encryptedBytes,
  104883. decryptionWorker
  104884. }, function(decryptedBytes) {
  104885. segment.bytes = decryptedBytes;
  104886. handleSegmentBytes({
  104887. segment,
  104888. bytes: segment.bytes,
  104889. trackInfoFn,
  104890. timingInfoFn,
  104891. videoSegmentTimingInfoFn,
  104892. audioSegmentTimingInfoFn,
  104893. id3Fn,
  104894. captionsFn,
  104895. isEndOfTimeline,
  104896. endedTimelineFn,
  104897. dataFn,
  104898. doneFn,
  104899. onTransmuxerLog
  104900. });
  104901. });
  104902. };
  104903. var waitForCompletion = function waitForCompletion2(_ref9) {
  104904. var activeXhrs = _ref9.activeXhrs, decryptionWorker = _ref9.decryptionWorker, trackInfoFn = _ref9.trackInfoFn, timingInfoFn = _ref9.timingInfoFn, videoSegmentTimingInfoFn = _ref9.videoSegmentTimingInfoFn, audioSegmentTimingInfoFn = _ref9.audioSegmentTimingInfoFn, id3Fn = _ref9.id3Fn, captionsFn = _ref9.captionsFn, isEndOfTimeline = _ref9.isEndOfTimeline, endedTimelineFn = _ref9.endedTimelineFn, dataFn = _ref9.dataFn, doneFn = _ref9.doneFn, onTransmuxerLog = _ref9.onTransmuxerLog;
  104905. var count = 0;
  104906. var didError = false;
  104907. return function(error, segment) {
  104908. if (didError) {
  104909. return;
  104910. }
  104911. if (error) {
  104912. didError = true;
  104913. abortAll(activeXhrs);
  104914. return doneFn(error, segment);
  104915. }
  104916. count += 1;
  104917. if (count === activeXhrs.length) {
  104918. var segmentFinish = function segmentFinish2() {
  104919. if (segment.encryptedBytes) {
  104920. return decryptSegment({
  104921. decryptionWorker,
  104922. segment,
  104923. trackInfoFn,
  104924. timingInfoFn,
  104925. videoSegmentTimingInfoFn,
  104926. audioSegmentTimingInfoFn,
  104927. id3Fn,
  104928. captionsFn,
  104929. isEndOfTimeline,
  104930. endedTimelineFn,
  104931. dataFn,
  104932. doneFn,
  104933. onTransmuxerLog
  104934. });
  104935. }
  104936. handleSegmentBytes({
  104937. segment,
  104938. bytes: segment.bytes,
  104939. trackInfoFn,
  104940. timingInfoFn,
  104941. videoSegmentTimingInfoFn,
  104942. audioSegmentTimingInfoFn,
  104943. id3Fn,
  104944. captionsFn,
  104945. isEndOfTimeline,
  104946. endedTimelineFn,
  104947. dataFn,
  104948. doneFn,
  104949. onTransmuxerLog
  104950. });
  104951. };
  104952. segment.endOfAllRequests = Date.now();
  104953. if (segment.map && segment.map.encryptedBytes && !segment.map.bytes) {
  104954. return decrypt({
  104955. decryptionWorker,
  104956. id: segment.requestId + "-init",
  104957. encryptedBytes: segment.map.encryptedBytes,
  104958. key: segment.map.key
  104959. }, function(decryptedBytes) {
  104960. segment.map.bytes = decryptedBytes;
  104961. parseInitSegment(segment, function(parseError) {
  104962. if (parseError) {
  104963. abortAll(activeXhrs);
  104964. return doneFn(parseError, segment);
  104965. }
  104966. segmentFinish();
  104967. });
  104968. });
  104969. }
  104970. segmentFinish();
  104971. }
  104972. };
  104973. };
  104974. var handleLoadEnd = function handleLoadEnd2(_ref10) {
  104975. var loadendState = _ref10.loadendState, abortFn = _ref10.abortFn;
  104976. return function(event2) {
  104977. var request = event2.target;
  104978. if (request.aborted && abortFn && !loadendState.calledAbortFn) {
  104979. abortFn();
  104980. loadendState.calledAbortFn = true;
  104981. }
  104982. };
  104983. };
  104984. var handleProgress = function handleProgress2(_ref11) {
  104985. var segment = _ref11.segment, progressFn = _ref11.progressFn;
  104986. _ref11.trackInfoFn;
  104987. _ref11.timingInfoFn;
  104988. _ref11.videoSegmentTimingInfoFn;
  104989. _ref11.audioSegmentTimingInfoFn;
  104990. _ref11.id3Fn;
  104991. _ref11.captionsFn;
  104992. _ref11.isEndOfTimeline;
  104993. _ref11.endedTimelineFn;
  104994. _ref11.dataFn;
  104995. return function(event2) {
  104996. var request = event2.target;
  104997. if (request.aborted) {
  104998. return;
  104999. }
  105000. segment.stats = videojs.mergeOptions(segment.stats, getProgressStats(event2));
  105001. if (!segment.stats.firstBytesReceivedAt && segment.stats.bytesReceived) {
  105002. segment.stats.firstBytesReceivedAt = Date.now();
  105003. }
  105004. return progressFn(event2, segment);
  105005. };
  105006. };
  105007. var mediaSegmentRequest = function mediaSegmentRequest2(_ref12) {
  105008. var xhr = _ref12.xhr, xhrOptions = _ref12.xhrOptions, decryptionWorker = _ref12.decryptionWorker, segment = _ref12.segment, abortFn = _ref12.abortFn, progressFn = _ref12.progressFn, trackInfoFn = _ref12.trackInfoFn, timingInfoFn = _ref12.timingInfoFn, videoSegmentTimingInfoFn = _ref12.videoSegmentTimingInfoFn, audioSegmentTimingInfoFn = _ref12.audioSegmentTimingInfoFn, id3Fn = _ref12.id3Fn, captionsFn = _ref12.captionsFn, isEndOfTimeline = _ref12.isEndOfTimeline, endedTimelineFn = _ref12.endedTimelineFn, dataFn = _ref12.dataFn, doneFn = _ref12.doneFn, onTransmuxerLog = _ref12.onTransmuxerLog;
  105009. var activeXhrs = [];
  105010. var finishProcessingFn = waitForCompletion({
  105011. activeXhrs,
  105012. decryptionWorker,
  105013. trackInfoFn,
  105014. timingInfoFn,
  105015. videoSegmentTimingInfoFn,
  105016. audioSegmentTimingInfoFn,
  105017. id3Fn,
  105018. captionsFn,
  105019. isEndOfTimeline,
  105020. endedTimelineFn,
  105021. dataFn,
  105022. doneFn,
  105023. onTransmuxerLog
  105024. });
  105025. if (segment.key && !segment.key.bytes) {
  105026. var objects = [segment.key];
  105027. if (segment.map && !segment.map.bytes && segment.map.key && segment.map.key.resolvedUri === segment.key.resolvedUri) {
  105028. objects.push(segment.map.key);
  105029. }
  105030. var keyRequestOptions = videojs.mergeOptions(xhrOptions, {
  105031. uri: segment.key.resolvedUri,
  105032. responseType: "arraybuffer"
  105033. });
  105034. var keyRequestCallback = handleKeyResponse(segment, objects, finishProcessingFn);
  105035. var keyXhr = xhr(keyRequestOptions, keyRequestCallback);
  105036. activeXhrs.push(keyXhr);
  105037. }
  105038. if (segment.map && !segment.map.bytes) {
  105039. var differentMapKey = segment.map.key && (!segment.key || segment.key.resolvedUri !== segment.map.key.resolvedUri);
  105040. if (differentMapKey) {
  105041. var mapKeyRequestOptions = videojs.mergeOptions(xhrOptions, {
  105042. uri: segment.map.key.resolvedUri,
  105043. responseType: "arraybuffer"
  105044. });
  105045. var mapKeyRequestCallback = handleKeyResponse(segment, [segment.map.key], finishProcessingFn);
  105046. var mapKeyXhr = xhr(mapKeyRequestOptions, mapKeyRequestCallback);
  105047. activeXhrs.push(mapKeyXhr);
  105048. }
  105049. var initSegmentOptions = videojs.mergeOptions(xhrOptions, {
  105050. uri: segment.map.resolvedUri,
  105051. responseType: "arraybuffer",
  105052. headers: segmentXhrHeaders(segment.map)
  105053. });
  105054. var initSegmentRequestCallback = handleInitSegmentResponse({
  105055. segment,
  105056. finishProcessingFn
  105057. });
  105058. var initSegmentXhr = xhr(initSegmentOptions, initSegmentRequestCallback);
  105059. activeXhrs.push(initSegmentXhr);
  105060. }
  105061. var segmentRequestOptions = videojs.mergeOptions(xhrOptions, {
  105062. uri: segment.part && segment.part.resolvedUri || segment.resolvedUri,
  105063. responseType: "arraybuffer",
  105064. headers: segmentXhrHeaders(segment)
  105065. });
  105066. var segmentRequestCallback = handleSegmentResponse({
  105067. segment,
  105068. finishProcessingFn,
  105069. responseType: segmentRequestOptions.responseType
  105070. });
  105071. var segmentXhr = xhr(segmentRequestOptions, segmentRequestCallback);
  105072. segmentXhr.addEventListener("progress", handleProgress({
  105073. segment,
  105074. progressFn,
  105075. trackInfoFn,
  105076. timingInfoFn,
  105077. videoSegmentTimingInfoFn,
  105078. audioSegmentTimingInfoFn,
  105079. id3Fn,
  105080. captionsFn,
  105081. isEndOfTimeline,
  105082. endedTimelineFn,
  105083. dataFn
  105084. }));
  105085. activeXhrs.push(segmentXhr);
  105086. var loadendState = {};
  105087. activeXhrs.forEach(function(activeXhr) {
  105088. activeXhr.addEventListener("loadend", handleLoadEnd({
  105089. loadendState,
  105090. abortFn
  105091. }));
  105092. });
  105093. return function() {
  105094. return abortAll(activeXhrs);
  105095. };
  105096. };
  105097. var logFn$1 = logger("CodecUtils");
  105098. var getCodecs = function getCodecs2(media) {
  105099. var mediaAttributes = media.attributes || {};
  105100. if (mediaAttributes.CODECS) {
  105101. return parseCodecs2(mediaAttributes.CODECS);
  105102. }
  105103. };
  105104. var isMaat = function isMaat2(master, media) {
  105105. var mediaAttributes = media.attributes || {};
  105106. return master && master.mediaGroups && master.mediaGroups.AUDIO && mediaAttributes.AUDIO && master.mediaGroups.AUDIO[mediaAttributes.AUDIO];
  105107. };
  105108. var isMuxed = function isMuxed2(master, media) {
  105109. if (!isMaat(master, media)) {
  105110. return true;
  105111. }
  105112. var mediaAttributes = media.attributes || {};
  105113. var audioGroup = master.mediaGroups.AUDIO[mediaAttributes.AUDIO];
  105114. for (var groupId in audioGroup) {
  105115. if (!audioGroup[groupId].uri && !audioGroup[groupId].playlists) {
  105116. return true;
  105117. }
  105118. }
  105119. return false;
  105120. };
  105121. var unwrapCodecList = function unwrapCodecList2(codecList) {
  105122. var codecs = {};
  105123. codecList.forEach(function(_ref) {
  105124. var mediaType = _ref.mediaType, type2 = _ref.type, details = _ref.details;
  105125. codecs[mediaType] = codecs[mediaType] || [];
  105126. codecs[mediaType].push(translateLegacyCodec2("" + type2 + details));
  105127. });
  105128. Object.keys(codecs).forEach(function(mediaType) {
  105129. if (codecs[mediaType].length > 1) {
  105130. logFn$1("multiple " + mediaType + " codecs found as attributes: " + codecs[mediaType].join(", ") + ". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.");
  105131. codecs[mediaType] = null;
  105132. return;
  105133. }
  105134. codecs[mediaType] = codecs[mediaType][0];
  105135. });
  105136. return codecs;
  105137. };
  105138. var codecCount = function codecCount2(codecObj) {
  105139. var count = 0;
  105140. if (codecObj.audio) {
  105141. count++;
  105142. }
  105143. if (codecObj.video) {
  105144. count++;
  105145. }
  105146. return count;
  105147. };
  105148. var codecsForPlaylist = function codecsForPlaylist2(master, media) {
  105149. var mediaAttributes = media.attributes || {};
  105150. var codecInfo = unwrapCodecList(getCodecs(media) || []);
  105151. if (isMaat(master, media) && !codecInfo.audio) {
  105152. if (!isMuxed(master, media)) {
  105153. var defaultCodecs = unwrapCodecList(codecsFromDefault2(master, mediaAttributes.AUDIO) || []);
  105154. if (defaultCodecs.audio) {
  105155. codecInfo.audio = defaultCodecs.audio;
  105156. }
  105157. }
  105158. }
  105159. return codecInfo;
  105160. };
  105161. var logFn = logger("PlaylistSelector");
  105162. var representationToString = function representationToString2(representation) {
  105163. if (!representation || !representation.playlist) {
  105164. return;
  105165. }
  105166. var playlist = representation.playlist;
  105167. return JSON.stringify({
  105168. id: playlist.id,
  105169. bandwidth: representation.bandwidth,
  105170. width: representation.width,
  105171. height: representation.height,
  105172. codecs: playlist.attributes && playlist.attributes.CODECS || ""
  105173. });
  105174. };
  105175. var safeGetComputedStyle = function safeGetComputedStyle2(el, property) {
  105176. if (!el) {
  105177. return "";
  105178. }
  105179. var result = window_1.getComputedStyle(el);
  105180. if (!result) {
  105181. return "";
  105182. }
  105183. return result[property];
  105184. };
  105185. var stableSort = function stableSort2(array, sortFn) {
  105186. var newArray = array.slice();
  105187. array.sort(function(left, right) {
  105188. var cmp = sortFn(left, right);
  105189. if (cmp === 0) {
  105190. return newArray.indexOf(left) - newArray.indexOf(right);
  105191. }
  105192. return cmp;
  105193. });
  105194. };
  105195. var comparePlaylistBandwidth = function comparePlaylistBandwidth2(left, right) {
  105196. var leftBandwidth;
  105197. var rightBandwidth;
  105198. if (left.attributes.BANDWIDTH) {
  105199. leftBandwidth = left.attributes.BANDWIDTH;
  105200. }
  105201. leftBandwidth = leftBandwidth || window_1.Number.MAX_VALUE;
  105202. if (right.attributes.BANDWIDTH) {
  105203. rightBandwidth = right.attributes.BANDWIDTH;
  105204. }
  105205. rightBandwidth = rightBandwidth || window_1.Number.MAX_VALUE;
  105206. return leftBandwidth - rightBandwidth;
  105207. };
  105208. var comparePlaylistResolution = function comparePlaylistResolution2(left, right) {
  105209. var leftWidth;
  105210. var rightWidth;
  105211. if (left.attributes.RESOLUTION && left.attributes.RESOLUTION.width) {
  105212. leftWidth = left.attributes.RESOLUTION.width;
  105213. }
  105214. leftWidth = leftWidth || window_1.Number.MAX_VALUE;
  105215. if (right.attributes.RESOLUTION && right.attributes.RESOLUTION.width) {
  105216. rightWidth = right.attributes.RESOLUTION.width;
  105217. }
  105218. rightWidth = rightWidth || window_1.Number.MAX_VALUE;
  105219. if (leftWidth === rightWidth && left.attributes.BANDWIDTH && right.attributes.BANDWIDTH) {
  105220. return left.attributes.BANDWIDTH - right.attributes.BANDWIDTH;
  105221. }
  105222. return leftWidth - rightWidth;
  105223. };
  105224. var simpleSelector = function simpleSelector2(master, playerBandwidth, playerWidth, playerHeight, limitRenditionByPlayerDimensions, masterPlaylistController) {
  105225. if (!master) {
  105226. return;
  105227. }
  105228. var options2 = {
  105229. bandwidth: playerBandwidth,
  105230. width: playerWidth,
  105231. height: playerHeight,
  105232. limitRenditionByPlayerDimensions
  105233. };
  105234. var playlists = master.playlists;
  105235. if (Playlist.isAudioOnly(master)) {
  105236. playlists = masterPlaylistController.getAudioTrackPlaylists_();
  105237. options2.audioOnly = true;
  105238. }
  105239. var sortedPlaylistReps = playlists.map(function(playlist) {
  105240. var bandwidth2;
  105241. var width2 = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.width;
  105242. var height2 = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height;
  105243. bandwidth2 = playlist.attributes && playlist.attributes.BANDWIDTH;
  105244. bandwidth2 = bandwidth2 || window_1.Number.MAX_VALUE;
  105245. return {
  105246. bandwidth: bandwidth2,
  105247. width: width2,
  105248. height: height2,
  105249. playlist
  105250. };
  105251. });
  105252. stableSort(sortedPlaylistReps, function(left, right) {
  105253. return left.bandwidth - right.bandwidth;
  105254. });
  105255. sortedPlaylistReps = sortedPlaylistReps.filter(function(rep2) {
  105256. return !Playlist.isIncompatible(rep2.playlist);
  105257. });
  105258. var enabledPlaylistReps = sortedPlaylistReps.filter(function(rep2) {
  105259. return Playlist.isEnabled(rep2.playlist);
  105260. });
  105261. if (!enabledPlaylistReps.length) {
  105262. enabledPlaylistReps = sortedPlaylistReps.filter(function(rep2) {
  105263. return !Playlist.isDisabled(rep2.playlist);
  105264. });
  105265. }
  105266. var bandwidthPlaylistReps = enabledPlaylistReps.filter(function(rep2) {
  105267. return rep2.bandwidth * Config.BANDWIDTH_VARIANCE < playerBandwidth;
  105268. });
  105269. var highestRemainingBandwidthRep = bandwidthPlaylistReps[bandwidthPlaylistReps.length - 1];
  105270. var bandwidthBestRep = bandwidthPlaylistReps.filter(function(rep2) {
  105271. return rep2.bandwidth === highestRemainingBandwidthRep.bandwidth;
  105272. })[0];
  105273. if (limitRenditionByPlayerDimensions === false) {
  105274. var _chosenRep = bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0];
  105275. if (_chosenRep && _chosenRep.playlist) {
  105276. var type2 = "sortedPlaylistReps";
  105277. if (bandwidthBestRep) {
  105278. type2 = "bandwidthBestRep";
  105279. }
  105280. if (enabledPlaylistReps[0]) {
  105281. type2 = "enabledPlaylistReps";
  105282. }
  105283. logFn("choosing " + representationToString(_chosenRep) + " using " + type2 + " with options", options2);
  105284. return _chosenRep.playlist;
  105285. }
  105286. logFn("could not choose a playlist with options", options2);
  105287. return null;
  105288. }
  105289. var haveResolution = bandwidthPlaylistReps.filter(function(rep2) {
  105290. return rep2.width && rep2.height;
  105291. });
  105292. stableSort(haveResolution, function(left, right) {
  105293. return left.width - right.width;
  105294. });
  105295. var resolutionBestRepList = haveResolution.filter(function(rep2) {
  105296. return rep2.width === playerWidth && rep2.height === playerHeight;
  105297. });
  105298. highestRemainingBandwidthRep = resolutionBestRepList[resolutionBestRepList.length - 1];
  105299. var resolutionBestRep = resolutionBestRepList.filter(function(rep2) {
  105300. return rep2.bandwidth === highestRemainingBandwidthRep.bandwidth;
  105301. })[0];
  105302. var resolutionPlusOneList;
  105303. var resolutionPlusOneSmallest;
  105304. var resolutionPlusOneRep;
  105305. if (!resolutionBestRep) {
  105306. resolutionPlusOneList = haveResolution.filter(function(rep2) {
  105307. return rep2.width > playerWidth || rep2.height > playerHeight;
  105308. });
  105309. resolutionPlusOneSmallest = resolutionPlusOneList.filter(function(rep2) {
  105310. return rep2.width === resolutionPlusOneList[0].width && rep2.height === resolutionPlusOneList[0].height;
  105311. });
  105312. highestRemainingBandwidthRep = resolutionPlusOneSmallest[resolutionPlusOneSmallest.length - 1];
  105313. resolutionPlusOneRep = resolutionPlusOneSmallest.filter(function(rep2) {
  105314. return rep2.bandwidth === highestRemainingBandwidthRep.bandwidth;
  105315. })[0];
  105316. }
  105317. var leastPixelDiffRep;
  105318. if (masterPlaylistController.experimentalLeastPixelDiffSelector) {
  105319. var leastPixelDiffList = haveResolution.map(function(rep2) {
  105320. rep2.pixelDiff = Math.abs(rep2.width - playerWidth) + Math.abs(rep2.height - playerHeight);
  105321. return rep2;
  105322. });
  105323. stableSort(leastPixelDiffList, function(left, right) {
  105324. if (left.pixelDiff === right.pixelDiff) {
  105325. return right.bandwidth - left.bandwidth;
  105326. }
  105327. return left.pixelDiff - right.pixelDiff;
  105328. });
  105329. leastPixelDiffRep = leastPixelDiffList[0];
  105330. }
  105331. var chosenRep = leastPixelDiffRep || resolutionPlusOneRep || resolutionBestRep || bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0];
  105332. if (chosenRep && chosenRep.playlist) {
  105333. var _type = "sortedPlaylistReps";
  105334. if (leastPixelDiffRep) {
  105335. _type = "leastPixelDiffRep";
  105336. } else if (resolutionPlusOneRep) {
  105337. _type = "resolutionPlusOneRep";
  105338. } else if (resolutionBestRep) {
  105339. _type = "resolutionBestRep";
  105340. } else if (bandwidthBestRep) {
  105341. _type = "bandwidthBestRep";
  105342. } else if (enabledPlaylistReps[0]) {
  105343. _type = "enabledPlaylistReps";
  105344. }
  105345. logFn("choosing " + representationToString(chosenRep) + " using " + _type + " with options", options2);
  105346. return chosenRep.playlist;
  105347. }
  105348. logFn("could not choose a playlist with options", options2);
  105349. return null;
  105350. };
  105351. var lastBandwidthSelector = function lastBandwidthSelector2() {
  105352. var pixelRatio = this.useDevicePixelRatio ? window_1.devicePixelRatio || 1 : 1;
  105353. return simpleSelector(this.playlists.master, this.systemBandwidth, parseInt(safeGetComputedStyle(this.tech_.el(), "width"), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), "height"), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_);
  105354. };
  105355. var movingAverageBandwidthSelector = function movingAverageBandwidthSelector2(decay) {
  105356. var average = -1;
  105357. var lastSystemBandwidth = -1;
  105358. if (decay < 0 || decay > 1) {
  105359. throw new Error("Moving average bandwidth decay must be between 0 and 1.");
  105360. }
  105361. return function() {
  105362. var pixelRatio = this.useDevicePixelRatio ? window_1.devicePixelRatio || 1 : 1;
  105363. if (average < 0) {
  105364. average = this.systemBandwidth;
  105365. lastSystemBandwidth = this.systemBandwidth;
  105366. }
  105367. if (this.systemBandwidth > 0 && this.systemBandwidth !== lastSystemBandwidth) {
  105368. average = decay * this.systemBandwidth + (1 - decay) * average;
  105369. lastSystemBandwidth = this.systemBandwidth;
  105370. }
  105371. return simpleSelector(this.playlists.master, average, parseInt(safeGetComputedStyle(this.tech_.el(), "width"), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), "height"), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_);
  105372. };
  105373. };
  105374. var minRebufferMaxBandwidthSelector = function minRebufferMaxBandwidthSelector2(settings) {
  105375. var master = settings.master, currentTime = settings.currentTime, bandwidth2 = settings.bandwidth, duration5 = settings.duration, segmentDuration = settings.segmentDuration, timeUntilRebuffer3 = settings.timeUntilRebuffer, currentTimeline = settings.currentTimeline, syncController = settings.syncController;
  105376. var compatiblePlaylists = master.playlists.filter(function(playlist) {
  105377. return !Playlist.isIncompatible(playlist);
  105378. });
  105379. var enabledPlaylists = compatiblePlaylists.filter(Playlist.isEnabled);
  105380. if (!enabledPlaylists.length) {
  105381. enabledPlaylists = compatiblePlaylists.filter(function(playlist) {
  105382. return !Playlist.isDisabled(playlist);
  105383. });
  105384. }
  105385. var bandwidthPlaylists = enabledPlaylists.filter(Playlist.hasAttribute.bind(null, "BANDWIDTH"));
  105386. var rebufferingEstimates = bandwidthPlaylists.map(function(playlist) {
  105387. var syncPoint = syncController.getSyncPoint(playlist, duration5, currentTimeline, currentTime);
  105388. var numRequests = syncPoint ? 1 : 2;
  105389. var requestTimeEstimate = Playlist.estimateSegmentRequestTime(segmentDuration, bandwidth2, playlist);
  105390. var rebufferingImpact = requestTimeEstimate * numRequests - timeUntilRebuffer3;
  105391. return {
  105392. playlist,
  105393. rebufferingImpact
  105394. };
  105395. });
  105396. var noRebufferingPlaylists = rebufferingEstimates.filter(function(estimate) {
  105397. return estimate.rebufferingImpact <= 0;
  105398. });
  105399. stableSort(noRebufferingPlaylists, function(a, b) {
  105400. return comparePlaylistBandwidth(b.playlist, a.playlist);
  105401. });
  105402. if (noRebufferingPlaylists.length) {
  105403. return noRebufferingPlaylists[0];
  105404. }
  105405. stableSort(rebufferingEstimates, function(a, b) {
  105406. return a.rebufferingImpact - b.rebufferingImpact;
  105407. });
  105408. return rebufferingEstimates[0] || null;
  105409. };
  105410. var lowestBitrateCompatibleVariantSelector = function lowestBitrateCompatibleVariantSelector2() {
  105411. var _this = this;
  105412. var playlists = this.playlists.master.playlists.filter(Playlist.isEnabled);
  105413. stableSort(playlists, function(a, b) {
  105414. return comparePlaylistBandwidth(a, b);
  105415. });
  105416. var playlistsWithVideo = playlists.filter(function(playlist) {
  105417. return !!codecsForPlaylist(_this.playlists.master, playlist).video;
  105418. });
  105419. return playlistsWithVideo[0] || null;
  105420. };
  105421. var concatSegments = function concatSegments2(segmentObj) {
  105422. var offset = 0;
  105423. var tempBuffer;
  105424. if (segmentObj.bytes) {
  105425. tempBuffer = new Uint8Array(segmentObj.bytes);
  105426. segmentObj.segments.forEach(function(segment) {
  105427. tempBuffer.set(segment, offset);
  105428. offset += segment.byteLength;
  105429. });
  105430. }
  105431. return tempBuffer;
  105432. };
  105433. var createCaptionsTrackIfNotExists = function createCaptionsTrackIfNotExists2(inbandTextTracks, tech, captionStream) {
  105434. if (!inbandTextTracks[captionStream]) {
  105435. tech.trigger({
  105436. type: "usage",
  105437. name: "vhs-608"
  105438. });
  105439. tech.trigger({
  105440. type: "usage",
  105441. name: "hls-608"
  105442. });
  105443. var instreamId = captionStream;
  105444. if (/^cc708_/.test(captionStream)) {
  105445. instreamId = "SERVICE" + captionStream.split("_")[1];
  105446. }
  105447. var track = tech.textTracks().getTrackById(instreamId);
  105448. if (track) {
  105449. inbandTextTracks[captionStream] = track;
  105450. } else {
  105451. var captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {};
  105452. var label2 = captionStream;
  105453. var language = captionStream;
  105454. var def = false;
  105455. var captionService = captionServices[instreamId];
  105456. if (captionService) {
  105457. label2 = captionService.label;
  105458. language = captionService.language;
  105459. def = captionService["default"];
  105460. }
  105461. inbandTextTracks[captionStream] = tech.addRemoteTextTrack({
  105462. kind: "captions",
  105463. id: instreamId,
  105464. "default": def,
  105465. label: label2,
  105466. language
  105467. }, false).track;
  105468. }
  105469. }
  105470. };
  105471. var addCaptionData = function addCaptionData2(_ref) {
  105472. var inbandTextTracks = _ref.inbandTextTracks, captionArray = _ref.captionArray, timestampOffset2 = _ref.timestampOffset;
  105473. if (!captionArray) {
  105474. return;
  105475. }
  105476. var Cue = window_1.WebKitDataCue || window_1.VTTCue;
  105477. captionArray.forEach(function(caption) {
  105478. var track = caption.stream;
  105479. inbandTextTracks[track].addCue(new Cue(caption.startTime + timestampOffset2, caption.endTime + timestampOffset2, caption.text));
  105480. });
  105481. };
  105482. var deprecateOldCue = function deprecateOldCue2(cue) {
  105483. Object.defineProperties(cue.frame, {
  105484. id: {
  105485. get: function get7() {
  105486. videojs.log.warn("cue.frame.id is deprecated. Use cue.value.key instead.");
  105487. return cue.value.key;
  105488. }
  105489. },
  105490. value: {
  105491. get: function get7() {
  105492. videojs.log.warn("cue.frame.value is deprecated. Use cue.value.data instead.");
  105493. return cue.value.data;
  105494. }
  105495. },
  105496. privateData: {
  105497. get: function get7() {
  105498. videojs.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead.");
  105499. return cue.value.data;
  105500. }
  105501. }
  105502. });
  105503. };
  105504. var addMetadata = function addMetadata2(_ref2) {
  105505. var inbandTextTracks = _ref2.inbandTextTracks, metadataArray = _ref2.metadataArray, timestampOffset2 = _ref2.timestampOffset, videoDuration = _ref2.videoDuration;
  105506. if (!metadataArray) {
  105507. return;
  105508. }
  105509. var Cue = window_1.WebKitDataCue || window_1.VTTCue;
  105510. var metadataTrack = inbandTextTracks.metadataTrack_;
  105511. if (!metadataTrack) {
  105512. return;
  105513. }
  105514. metadataArray.forEach(function(metadata) {
  105515. var time = metadata.cueTime + timestampOffset2;
  105516. if (typeof time !== "number" || window_1.isNaN(time) || time < 0 || !(time < Infinity)) {
  105517. return;
  105518. }
  105519. metadata.frames.forEach(function(frame) {
  105520. var cue = new Cue(time, time, frame.value || frame.url || frame.data || "");
  105521. cue.frame = frame;
  105522. cue.value = frame;
  105523. deprecateOldCue(cue);
  105524. metadataTrack.addCue(cue);
  105525. });
  105526. });
  105527. if (!metadataTrack.cues || !metadataTrack.cues.length) {
  105528. return;
  105529. }
  105530. var cues = metadataTrack.cues;
  105531. var cuesArray = [];
  105532. for (var i2 = 0; i2 < cues.length; i2++) {
  105533. if (cues[i2]) {
  105534. cuesArray.push(cues[i2]);
  105535. }
  105536. }
  105537. var cuesGroupedByStartTime = cuesArray.reduce(function(obj, cue) {
  105538. var timeSlot = obj[cue.startTime] || [];
  105539. timeSlot.push(cue);
  105540. obj[cue.startTime] = timeSlot;
  105541. return obj;
  105542. }, {});
  105543. var sortedStartTimes = Object.keys(cuesGroupedByStartTime).sort(function(a, b) {
  105544. return Number(a) - Number(b);
  105545. });
  105546. sortedStartTimes.forEach(function(startTime, idx) {
  105547. var cueGroup = cuesGroupedByStartTime[startTime];
  105548. var nextTime = Number(sortedStartTimes[idx + 1]) || videoDuration;
  105549. cueGroup.forEach(function(cue) {
  105550. cue.endTime = nextTime;
  105551. });
  105552. });
  105553. };
  105554. var createMetadataTrackIfNotExists = function createMetadataTrackIfNotExists2(inbandTextTracks, dispatchType, tech) {
  105555. if (inbandTextTracks.metadataTrack_) {
  105556. return;
  105557. }
  105558. inbandTextTracks.metadataTrack_ = tech.addRemoteTextTrack({
  105559. kind: "metadata",
  105560. label: "Timed Metadata"
  105561. }, false).track;
  105562. inbandTextTracks.metadataTrack_.inBandMetadataTrackDispatchType = dispatchType;
  105563. };
  105564. var removeCuesFromTrack = function removeCuesFromTrack2(start2, end, track) {
  105565. var i2;
  105566. var cue;
  105567. if (!track) {
  105568. return;
  105569. }
  105570. if (!track.cues) {
  105571. return;
  105572. }
  105573. i2 = track.cues.length;
  105574. while (i2--) {
  105575. cue = track.cues[i2];
  105576. if (cue.startTime >= start2 && cue.endTime <= end) {
  105577. track.removeCue(cue);
  105578. }
  105579. }
  105580. };
  105581. var removeDuplicateCuesFromTrack = function removeDuplicateCuesFromTrack2(track) {
  105582. var cues = track.cues;
  105583. if (!cues) {
  105584. return;
  105585. }
  105586. for (var i2 = 0; i2 < cues.length; i2++) {
  105587. var duplicates = [];
  105588. var occurrences = 0;
  105589. for (var j = 0; j < cues.length; j++) {
  105590. if (cues[i2].startTime === cues[j].startTime && cues[i2].endTime === cues[j].endTime && cues[i2].text === cues[j].text) {
  105591. occurrences++;
  105592. if (occurrences > 1) {
  105593. duplicates.push(cues[j]);
  105594. }
  105595. }
  105596. }
  105597. if (duplicates.length) {
  105598. duplicates.forEach(function(dupe) {
  105599. return track.removeCue(dupe);
  105600. });
  105601. }
  105602. }
  105603. };
  105604. var gopsSafeToAlignWith = function gopsSafeToAlignWith2(buffer, currentTime, mapping) {
  105605. if (typeof currentTime === "undefined" || currentTime === null || !buffer.length) {
  105606. return [];
  105607. }
  105608. var currentTimePts = Math.ceil((currentTime - mapping + 3) * clock.ONE_SECOND_IN_TS);
  105609. var i2;
  105610. for (i2 = 0; i2 < buffer.length; i2++) {
  105611. if (buffer[i2].pts > currentTimePts) {
  105612. break;
  105613. }
  105614. }
  105615. return buffer.slice(i2);
  105616. };
  105617. var updateGopBuffer = function updateGopBuffer2(buffer, gops, replace) {
  105618. if (!gops.length) {
  105619. return buffer;
  105620. }
  105621. if (replace) {
  105622. return gops.slice();
  105623. }
  105624. var start2 = gops[0].pts;
  105625. var i2 = 0;
  105626. for (i2; i2 < buffer.length; i2++) {
  105627. if (buffer[i2].pts >= start2) {
  105628. break;
  105629. }
  105630. }
  105631. return buffer.slice(0, i2).concat(gops);
  105632. };
  105633. var removeGopBuffer = function removeGopBuffer2(buffer, start2, end, mapping) {
  105634. var startPts = Math.ceil((start2 - mapping) * clock.ONE_SECOND_IN_TS);
  105635. var endPts = Math.ceil((end - mapping) * clock.ONE_SECOND_IN_TS);
  105636. var updatedBuffer = buffer.slice();
  105637. var i2 = buffer.length;
  105638. while (i2--) {
  105639. if (buffer[i2].pts <= endPts) {
  105640. break;
  105641. }
  105642. }
  105643. if (i2 === -1) {
  105644. return updatedBuffer;
  105645. }
  105646. var j = i2 + 1;
  105647. while (j--) {
  105648. if (buffer[j].pts <= startPts) {
  105649. break;
  105650. }
  105651. }
  105652. j = Math.max(j, 0);
  105653. updatedBuffer.splice(j, i2 - j + 1);
  105654. return updatedBuffer;
  105655. };
  105656. var shallowEqual = function shallowEqual2(a, b) {
  105657. if (!a && !b || !a && b || a && !b) {
  105658. return false;
  105659. }
  105660. if (a === b) {
  105661. return true;
  105662. }
  105663. var akeys = Object.keys(a).sort();
  105664. var bkeys = Object.keys(b).sort();
  105665. if (akeys.length !== bkeys.length) {
  105666. return false;
  105667. }
  105668. for (var i2 = 0; i2 < akeys.length; i2++) {
  105669. var key = akeys[i2];
  105670. if (key !== bkeys[i2]) {
  105671. return false;
  105672. }
  105673. if (a[key] !== b[key]) {
  105674. return false;
  105675. }
  105676. }
  105677. return true;
  105678. };
  105679. var QUOTA_EXCEEDED_ERR = 22;
  105680. var getSyncSegmentCandidate = function getSyncSegmentCandidate2(currentTimeline, segments, targetTime) {
  105681. segments = segments || [];
  105682. var timelineSegments = [];
  105683. var time = 0;
  105684. for (var i2 = 0; i2 < segments.length; i2++) {
  105685. var segment = segments[i2];
  105686. if (currentTimeline === segment.timeline) {
  105687. timelineSegments.push(i2);
  105688. time += segment.duration;
  105689. if (time > targetTime) {
  105690. return i2;
  105691. }
  105692. }
  105693. }
  105694. if (timelineSegments.length === 0) {
  105695. return 0;
  105696. }
  105697. return timelineSegments[timelineSegments.length - 1];
  105698. };
  105699. var MIN_BACK_BUFFER = 1;
  105700. var CHECK_BUFFER_DELAY = 500;
  105701. var finite = function finite2(num) {
  105702. return typeof num === "number" && isFinite(num);
  105703. };
  105704. var MIN_SEGMENT_DURATION_TO_SAVE_STATS = 1 / 60;
  105705. var illegalMediaSwitch = function illegalMediaSwitch2(loaderType, startingMedia, trackInfo) {
  105706. if (loaderType !== "main" || !startingMedia || !trackInfo) {
  105707. return null;
  105708. }
  105709. if (!trackInfo.hasAudio && !trackInfo.hasVideo) {
  105710. return "Neither audio nor video found in segment.";
  105711. }
  105712. if (startingMedia.hasVideo && !trackInfo.hasVideo) {
  105713. return "Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.";
  105714. }
  105715. if (!startingMedia.hasVideo && trackInfo.hasVideo) {
  105716. return "Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.";
  105717. }
  105718. return null;
  105719. };
  105720. var safeBackBufferTrimTime = function safeBackBufferTrimTime2(seekable3, currentTime, targetDuration) {
  105721. var trimTime = currentTime - Config.BACK_BUFFER_LENGTH;
  105722. if (seekable3.length) {
  105723. trimTime = Math.max(trimTime, seekable3.start(0));
  105724. }
  105725. var maxTrimTime = currentTime - targetDuration;
  105726. return Math.min(maxTrimTime, trimTime);
  105727. };
  105728. var segmentInfoString = function segmentInfoString2(segmentInfo) {
  105729. var startOfSegment = segmentInfo.startOfSegment, duration5 = segmentInfo.duration, segment = segmentInfo.segment, part = segmentInfo.part, _segmentInfo$playlist = segmentInfo.playlist, seq = _segmentInfo$playlist.mediaSequence, id = _segmentInfo$playlist.id, _segmentInfo$playlist2 = _segmentInfo$playlist.segments, segments = _segmentInfo$playlist2 === void 0 ? [] : _segmentInfo$playlist2, index2 = segmentInfo.mediaIndex, partIndex = segmentInfo.partIndex, timeline = segmentInfo.timeline;
  105730. var segmentLen = segments.length - 1;
  105731. var selection = "mediaIndex/partIndex increment";
  105732. if (segmentInfo.getMediaInfoForTime) {
  105733. selection = "getMediaInfoForTime (" + segmentInfo.getMediaInfoForTime + ")";
  105734. } else if (segmentInfo.isSyncRequest) {
  105735. selection = "getSyncSegmentCandidate (isSyncRequest)";
  105736. }
  105737. if (segmentInfo.independent) {
  105738. selection += " with independent " + segmentInfo.independent;
  105739. }
  105740. var hasPartIndex = typeof partIndex === "number";
  105741. var name = segmentInfo.segment.uri ? "segment" : "pre-segment";
  105742. var zeroBasedPartCount = hasPartIndex ? getKnownPartCount({
  105743. preloadSegment: segment
  105744. }) - 1 : 0;
  105745. return name + " [" + (seq + index2) + "/" + (seq + segmentLen) + "]" + (hasPartIndex ? " part [" + partIndex + "/" + zeroBasedPartCount + "]" : "") + (" segment start/end [" + segment.start + " => " + segment.end + "]") + (hasPartIndex ? " part start/end [" + part.start + " => " + part.end + "]" : "") + (" startOfSegment [" + startOfSegment + "]") + (" duration [" + duration5 + "]") + (" timeline [" + timeline + "]") + (" selected by [" + selection + "]") + (" playlist [" + id + "]");
  105746. };
  105747. var timingInfoPropertyForMedia = function timingInfoPropertyForMedia2(mediaType) {
  105748. return mediaType + "TimingInfo";
  105749. };
  105750. var timestampOffsetForSegment = function timestampOffsetForSegment2(_ref) {
  105751. var segmentTimeline = _ref.segmentTimeline, currentTimeline = _ref.currentTimeline, startOfSegment = _ref.startOfSegment, buffered = _ref.buffered, overrideCheck = _ref.overrideCheck;
  105752. if (!overrideCheck && segmentTimeline === currentTimeline) {
  105753. return null;
  105754. }
  105755. if (segmentTimeline < currentTimeline) {
  105756. return startOfSegment;
  105757. }
  105758. return buffered.length ? buffered.end(buffered.length - 1) : startOfSegment;
  105759. };
  105760. var shouldWaitForTimelineChange = function shouldWaitForTimelineChange2(_ref2) {
  105761. var timelineChangeController = _ref2.timelineChangeController, currentTimeline = _ref2.currentTimeline, segmentTimeline = _ref2.segmentTimeline, loaderType = _ref2.loaderType, audioDisabled = _ref2.audioDisabled;
  105762. if (currentTimeline === segmentTimeline) {
  105763. return false;
  105764. }
  105765. if (loaderType === "audio") {
  105766. var lastMainTimelineChange = timelineChangeController.lastTimelineChange({
  105767. type: "main"
  105768. });
  105769. return !lastMainTimelineChange || lastMainTimelineChange.to !== segmentTimeline;
  105770. }
  105771. if (loaderType === "main" && audioDisabled) {
  105772. var pendingAudioTimelineChange = timelineChangeController.pendingTimelineChange({
  105773. type: "audio"
  105774. });
  105775. if (pendingAudioTimelineChange && pendingAudioTimelineChange.to === segmentTimeline) {
  105776. return false;
  105777. }
  105778. return true;
  105779. }
  105780. return false;
  105781. };
  105782. var mediaDuration = function mediaDuration2(timingInfos) {
  105783. var maxDuration = 0;
  105784. ["video", "audio"].forEach(function(type2) {
  105785. var typeTimingInfo = timingInfos[type2 + "TimingInfo"];
  105786. if (!typeTimingInfo) {
  105787. return;
  105788. }
  105789. var start2 = typeTimingInfo.start, end = typeTimingInfo.end;
  105790. var duration5;
  105791. if (typeof start2 === "bigint" || typeof end === "bigint") {
  105792. duration5 = window_1.BigInt(end) - window_1.BigInt(start2);
  105793. } else if (typeof start2 === "number" && typeof end === "number") {
  105794. duration5 = end - start2;
  105795. }
  105796. if (typeof duration5 !== "undefined" && duration5 > maxDuration) {
  105797. maxDuration = duration5;
  105798. }
  105799. });
  105800. if (typeof maxDuration === "bigint" && maxDuration < Number.MAX_SAFE_INTEGER) {
  105801. maxDuration = Number(maxDuration);
  105802. }
  105803. return maxDuration;
  105804. };
  105805. var segmentTooLong = function segmentTooLong2(_ref3) {
  105806. var segmentDuration = _ref3.segmentDuration, maxDuration = _ref3.maxDuration;
  105807. if (!segmentDuration) {
  105808. return false;
  105809. }
  105810. return Math.round(segmentDuration) > maxDuration + TIME_FUDGE_FACTOR;
  105811. };
  105812. var getTroublesomeSegmentDurationMessage = function getTroublesomeSegmentDurationMessage2(segmentInfo, sourceType) {
  105813. if (sourceType !== "hls") {
  105814. return null;
  105815. }
  105816. var segmentDuration = mediaDuration({
  105817. audioTimingInfo: segmentInfo.audioTimingInfo,
  105818. videoTimingInfo: segmentInfo.videoTimingInfo
  105819. });
  105820. if (!segmentDuration) {
  105821. return null;
  105822. }
  105823. var targetDuration = segmentInfo.playlist.targetDuration;
  105824. var isSegmentWayTooLong = segmentTooLong({
  105825. segmentDuration,
  105826. maxDuration: targetDuration * 2
  105827. });
  105828. var isSegmentSlightlyTooLong = segmentTooLong({
  105829. segmentDuration,
  105830. maxDuration: targetDuration
  105831. });
  105832. var segmentTooLongMessage = "Segment with index " + segmentInfo.mediaIndex + " " + ("from playlist " + segmentInfo.playlist.id + " ") + ("has a duration of " + segmentDuration + " ") + ("when the reported duration is " + segmentInfo.duration + " ") + ("and the target duration is " + targetDuration + ". ") + "For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1";
  105833. if (isSegmentWayTooLong || isSegmentSlightlyTooLong) {
  105834. return {
  105835. severity: isSegmentWayTooLong ? "warn" : "info",
  105836. message: segmentTooLongMessage
  105837. };
  105838. }
  105839. return null;
  105840. };
  105841. var SegmentLoader = /* @__PURE__ */ function(_videojs$EventTarget) {
  105842. _inheritsLoose(SegmentLoader2, _videojs$EventTarget);
  105843. function SegmentLoader2(settings, options2) {
  105844. var _this;
  105845. _this = _videojs$EventTarget.call(this) || this;
  105846. if (!settings) {
  105847. throw new TypeError("Initialization settings are required");
  105848. }
  105849. if (typeof settings.currentTime !== "function") {
  105850. throw new TypeError("No currentTime getter specified");
  105851. }
  105852. if (!settings.mediaSource) {
  105853. throw new TypeError("No MediaSource specified");
  105854. }
  105855. _this.bandwidth = settings.bandwidth;
  105856. _this.throughput = {
  105857. rate: 0,
  105858. count: 0
  105859. };
  105860. _this.roundTrip = NaN;
  105861. _this.resetStats_();
  105862. _this.mediaIndex = null;
  105863. _this.partIndex = null;
  105864. _this.hasPlayed_ = settings.hasPlayed;
  105865. _this.currentTime_ = settings.currentTime;
  105866. _this.seekable_ = settings.seekable;
  105867. _this.seeking_ = settings.seeking;
  105868. _this.duration_ = settings.duration;
  105869. _this.mediaSource_ = settings.mediaSource;
  105870. _this.vhs_ = settings.vhs;
  105871. _this.loaderType_ = settings.loaderType;
  105872. _this.currentMediaInfo_ = void 0;
  105873. _this.startingMediaInfo_ = void 0;
  105874. _this.segmentMetadataTrack_ = settings.segmentMetadataTrack;
  105875. _this.goalBufferLength_ = settings.goalBufferLength;
  105876. _this.sourceType_ = settings.sourceType;
  105877. _this.sourceUpdater_ = settings.sourceUpdater;
  105878. _this.inbandTextTracks_ = settings.inbandTextTracks;
  105879. _this.state_ = "INIT";
  105880. _this.timelineChangeController_ = settings.timelineChangeController;
  105881. _this.shouldSaveSegmentTimingInfo_ = true;
  105882. _this.parse708captions_ = settings.parse708captions;
  105883. _this.useDtsForTimestampOffset_ = settings.useDtsForTimestampOffset;
  105884. _this.captionServices_ = settings.captionServices;
  105885. _this.experimentalExactManifestTimings = settings.experimentalExactManifestTimings;
  105886. _this.checkBufferTimeout_ = null;
  105887. _this.error_ = void 0;
  105888. _this.currentTimeline_ = -1;
  105889. _this.pendingSegment_ = null;
  105890. _this.xhrOptions_ = null;
  105891. _this.pendingSegments_ = [];
  105892. _this.audioDisabled_ = false;
  105893. _this.isPendingTimestampOffset_ = false;
  105894. _this.gopBuffer_ = [];
  105895. _this.timeMapping_ = 0;
  105896. _this.safeAppend_ = videojs.browser.IE_VERSION >= 11;
  105897. _this.appendInitSegment_ = {
  105898. audio: true,
  105899. video: true
  105900. };
  105901. _this.playlistOfLastInitSegment_ = {
  105902. audio: null,
  105903. video: null
  105904. };
  105905. _this.callQueue_ = [];
  105906. _this.loadQueue_ = [];
  105907. _this.metadataQueue_ = {
  105908. id3: [],
  105909. caption: []
  105910. };
  105911. _this.waitingOnRemove_ = false;
  105912. _this.quotaExceededErrorRetryTimeout_ = null;
  105913. _this.activeInitSegmentId_ = null;
  105914. _this.initSegments_ = {};
  105915. _this.cacheEncryptionKeys_ = settings.cacheEncryptionKeys;
  105916. _this.keyCache_ = {};
  105917. _this.decrypter_ = settings.decrypter;
  105918. _this.syncController_ = settings.syncController;
  105919. _this.syncPoint_ = {
  105920. segmentIndex: 0,
  105921. time: 0
  105922. };
  105923. _this.transmuxer_ = _this.createTransmuxer_();
  105924. _this.triggerSyncInfoUpdate_ = function() {
  105925. return _this.trigger("syncinfoupdate");
  105926. };
  105927. _this.syncController_.on("syncinfoupdate", _this.triggerSyncInfoUpdate_);
  105928. _this.mediaSource_.addEventListener("sourceopen", function() {
  105929. if (!_this.isEndOfStream_()) {
  105930. _this.ended_ = false;
  105931. }
  105932. });
  105933. _this.fetchAtBuffer_ = false;
  105934. _this.logger_ = logger("SegmentLoader[" + _this.loaderType_ + "]");
  105935. Object.defineProperty(_assertThisInitialized(_this), "state", {
  105936. get: function get7() {
  105937. return this.state_;
  105938. },
  105939. set: function set4(newState) {
  105940. if (newState !== this.state_) {
  105941. this.logger_(this.state_ + " -> " + newState);
  105942. this.state_ = newState;
  105943. this.trigger("statechange");
  105944. }
  105945. }
  105946. });
  105947. _this.sourceUpdater_.on("ready", function() {
  105948. if (_this.hasEnoughInfoToAppend_()) {
  105949. _this.processCallQueue_();
  105950. }
  105951. });
  105952. if (_this.loaderType_ === "main") {
  105953. _this.timelineChangeController_.on("pendingtimelinechange", function() {
  105954. if (_this.hasEnoughInfoToAppend_()) {
  105955. _this.processCallQueue_();
  105956. }
  105957. });
  105958. }
  105959. if (_this.loaderType_ === "audio") {
  105960. _this.timelineChangeController_.on("timelinechange", function() {
  105961. if (_this.hasEnoughInfoToLoad_()) {
  105962. _this.processLoadQueue_();
  105963. }
  105964. if (_this.hasEnoughInfoToAppend_()) {
  105965. _this.processCallQueue_();
  105966. }
  105967. });
  105968. }
  105969. return _this;
  105970. }
  105971. var _proto = SegmentLoader2.prototype;
  105972. _proto.createTransmuxer_ = function createTransmuxer_() {
  105973. return segmentTransmuxer.createTransmuxer({
  105974. remux: false,
  105975. alignGopsAtEnd: this.safeAppend_,
  105976. keepOriginalTimestamps: true,
  105977. parse708captions: this.parse708captions_,
  105978. captionServices: this.captionServices_
  105979. });
  105980. };
  105981. _proto.resetStats_ = function resetStats_() {
  105982. this.mediaBytesTransferred = 0;
  105983. this.mediaRequests = 0;
  105984. this.mediaRequestsAborted = 0;
  105985. this.mediaRequestsTimedout = 0;
  105986. this.mediaRequestsErrored = 0;
  105987. this.mediaTransferDuration = 0;
  105988. this.mediaSecondsLoaded = 0;
  105989. this.mediaAppends = 0;
  105990. };
  105991. _proto.dispose = function dispose() {
  105992. this.trigger("dispose");
  105993. this.state = "DISPOSED";
  105994. this.pause();
  105995. this.abort_();
  105996. if (this.transmuxer_) {
  105997. this.transmuxer_.terminate();
  105998. }
  105999. this.resetStats_();
  106000. if (this.checkBufferTimeout_) {
  106001. window_1.clearTimeout(this.checkBufferTimeout_);
  106002. }
  106003. if (this.syncController_ && this.triggerSyncInfoUpdate_) {
  106004. this.syncController_.off("syncinfoupdate", this.triggerSyncInfoUpdate_);
  106005. }
  106006. this.off();
  106007. };
  106008. _proto.setAudio = function setAudio(enable) {
  106009. this.audioDisabled_ = !enable;
  106010. if (enable) {
  106011. this.appendInitSegment_.audio = true;
  106012. } else {
  106013. this.sourceUpdater_.removeAudio(0, this.duration_());
  106014. }
  106015. };
  106016. _proto.abort = function abort2() {
  106017. if (this.state !== "WAITING") {
  106018. if (this.pendingSegment_) {
  106019. this.pendingSegment_ = null;
  106020. }
  106021. return;
  106022. }
  106023. this.abort_();
  106024. this.state = "READY";
  106025. if (!this.paused()) {
  106026. this.monitorBuffer_();
  106027. }
  106028. };
  106029. _proto.abort_ = function abort_() {
  106030. if (this.pendingSegment_ && this.pendingSegment_.abortRequests) {
  106031. this.pendingSegment_.abortRequests();
  106032. }
  106033. this.pendingSegment_ = null;
  106034. this.callQueue_ = [];
  106035. this.loadQueue_ = [];
  106036. this.metadataQueue_.id3 = [];
  106037. this.metadataQueue_.caption = [];
  106038. this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);
  106039. this.waitingOnRemove_ = false;
  106040. window_1.clearTimeout(this.quotaExceededErrorRetryTimeout_);
  106041. this.quotaExceededErrorRetryTimeout_ = null;
  106042. };
  106043. _proto.checkForAbort_ = function checkForAbort_(requestId) {
  106044. if (this.state === "APPENDING" && !this.pendingSegment_) {
  106045. this.state = "READY";
  106046. return true;
  106047. }
  106048. if (!this.pendingSegment_ || this.pendingSegment_.requestId !== requestId) {
  106049. return true;
  106050. }
  106051. return false;
  106052. };
  106053. _proto.error = function error(_error) {
  106054. if (typeof _error !== "undefined") {
  106055. this.logger_("error occurred:", _error);
  106056. this.error_ = _error;
  106057. }
  106058. this.pendingSegment_ = null;
  106059. return this.error_;
  106060. };
  106061. _proto.endOfStream = function endOfStream2() {
  106062. this.ended_ = true;
  106063. if (this.transmuxer_) {
  106064. segmentTransmuxer.reset(this.transmuxer_);
  106065. }
  106066. this.gopBuffer_.length = 0;
  106067. this.pause();
  106068. this.trigger("ended");
  106069. };
  106070. _proto.buffered_ = function buffered_() {
  106071. var trackInfo = this.getMediaInfo_();
  106072. if (!this.sourceUpdater_ || !trackInfo) {
  106073. return videojs.createTimeRanges();
  106074. }
  106075. if (this.loaderType_ === "main") {
  106076. var hasAudio = trackInfo.hasAudio, hasVideo = trackInfo.hasVideo, isMuxed3 = trackInfo.isMuxed;
  106077. if (hasVideo && hasAudio && !this.audioDisabled_ && !isMuxed3) {
  106078. return this.sourceUpdater_.buffered();
  106079. }
  106080. if (hasVideo) {
  106081. return this.sourceUpdater_.videoBuffered();
  106082. }
  106083. }
  106084. return this.sourceUpdater_.audioBuffered();
  106085. };
  106086. _proto.initSegmentForMap = function initSegmentForMap(map, set4) {
  106087. if (set4 === void 0) {
  106088. set4 = false;
  106089. }
  106090. if (!map) {
  106091. return null;
  106092. }
  106093. var id = initSegmentId(map);
  106094. var storedMap = this.initSegments_[id];
  106095. if (set4 && !storedMap && map.bytes) {
  106096. this.initSegments_[id] = storedMap = {
  106097. resolvedUri: map.resolvedUri,
  106098. byterange: map.byterange,
  106099. bytes: map.bytes,
  106100. tracks: map.tracks,
  106101. timescales: map.timescales
  106102. };
  106103. }
  106104. return storedMap || map;
  106105. };
  106106. _proto.segmentKey = function segmentKey(key, set4) {
  106107. if (set4 === void 0) {
  106108. set4 = false;
  106109. }
  106110. if (!key) {
  106111. return null;
  106112. }
  106113. var id = segmentKeyId(key);
  106114. var storedKey = this.keyCache_[id];
  106115. if (this.cacheEncryptionKeys_ && set4 && !storedKey && key.bytes) {
  106116. this.keyCache_[id] = storedKey = {
  106117. resolvedUri: key.resolvedUri,
  106118. bytes: key.bytes
  106119. };
  106120. }
  106121. var result = {
  106122. resolvedUri: (storedKey || key).resolvedUri
  106123. };
  106124. if (storedKey) {
  106125. result.bytes = storedKey.bytes;
  106126. }
  106127. return result;
  106128. };
  106129. _proto.couldBeginLoading_ = function couldBeginLoading_() {
  106130. return this.playlist_ && !this.paused();
  106131. };
  106132. _proto.load = function load() {
  106133. this.monitorBuffer_();
  106134. if (!this.playlist_) {
  106135. return;
  106136. }
  106137. if (this.state === "INIT" && this.couldBeginLoading_()) {
  106138. return this.init_();
  106139. }
  106140. if (!this.couldBeginLoading_() || this.state !== "READY" && this.state !== "INIT") {
  106141. return;
  106142. }
  106143. this.state = "READY";
  106144. };
  106145. _proto.init_ = function init_() {
  106146. this.state = "READY";
  106147. this.resetEverything();
  106148. return this.monitorBuffer_();
  106149. };
  106150. _proto.playlist = function playlist(newPlaylist, options2) {
  106151. if (options2 === void 0) {
  106152. options2 = {};
  106153. }
  106154. if (!newPlaylist) {
  106155. return;
  106156. }
  106157. var oldPlaylist = this.playlist_;
  106158. var segmentInfo = this.pendingSegment_;
  106159. this.playlist_ = newPlaylist;
  106160. this.xhrOptions_ = options2;
  106161. if (this.state === "INIT") {
  106162. newPlaylist.syncInfo = {
  106163. mediaSequence: newPlaylist.mediaSequence,
  106164. time: 0
  106165. };
  106166. if (this.loaderType_ === "main") {
  106167. this.syncController_.setDateTimeMappingForStart(newPlaylist);
  106168. }
  106169. }
  106170. var oldId = null;
  106171. if (oldPlaylist) {
  106172. if (oldPlaylist.id) {
  106173. oldId = oldPlaylist.id;
  106174. } else if (oldPlaylist.uri) {
  106175. oldId = oldPlaylist.uri;
  106176. }
  106177. }
  106178. this.logger_("playlist update [" + oldId + " => " + (newPlaylist.id || newPlaylist.uri) + "]");
  106179. this.trigger("syncinfoupdate");
  106180. if (this.state === "INIT" && this.couldBeginLoading_()) {
  106181. return this.init_();
  106182. }
  106183. if (!oldPlaylist || oldPlaylist.uri !== newPlaylist.uri) {
  106184. if (this.mediaIndex !== null) {
  106185. if (!newPlaylist.endList) {
  106186. this.resetLoader();
  106187. } else {
  106188. this.resyncLoader();
  106189. }
  106190. }
  106191. this.currentMediaInfo_ = void 0;
  106192. this.trigger("playlistupdate");
  106193. return;
  106194. }
  106195. var mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence;
  106196. this.logger_("live window shift [" + mediaSequenceDiff + "]");
  106197. if (this.mediaIndex !== null) {
  106198. this.mediaIndex -= mediaSequenceDiff;
  106199. if (this.mediaIndex < 0) {
  106200. this.mediaIndex = null;
  106201. this.partIndex = null;
  106202. } else {
  106203. var segment = this.playlist_.segments[this.mediaIndex];
  106204. if (this.partIndex && (!segment.parts || !segment.parts.length || !segment.parts[this.partIndex])) {
  106205. var mediaIndex = this.mediaIndex;
  106206. this.logger_("currently processing part (index " + this.partIndex + ") no longer exists.");
  106207. this.resetLoader();
  106208. this.mediaIndex = mediaIndex;
  106209. }
  106210. }
  106211. }
  106212. if (segmentInfo) {
  106213. segmentInfo.mediaIndex -= mediaSequenceDiff;
  106214. if (segmentInfo.mediaIndex < 0) {
  106215. segmentInfo.mediaIndex = null;
  106216. segmentInfo.partIndex = null;
  106217. } else {
  106218. if (segmentInfo.mediaIndex >= 0) {
  106219. segmentInfo.segment = newPlaylist.segments[segmentInfo.mediaIndex];
  106220. }
  106221. if (segmentInfo.partIndex >= 0 && segmentInfo.segment.parts) {
  106222. segmentInfo.part = segmentInfo.segment.parts[segmentInfo.partIndex];
  106223. }
  106224. }
  106225. }
  106226. this.syncController_.saveExpiredSegmentInfo(oldPlaylist, newPlaylist);
  106227. };
  106228. _proto.pause = function pause() {
  106229. if (this.checkBufferTimeout_) {
  106230. window_1.clearTimeout(this.checkBufferTimeout_);
  106231. this.checkBufferTimeout_ = null;
  106232. }
  106233. };
  106234. _proto.paused = function paused() {
  106235. return this.checkBufferTimeout_ === null;
  106236. };
  106237. _proto.resetEverything = function resetEverything(done) {
  106238. this.ended_ = false;
  106239. this.activeInitSegmentId_ = null;
  106240. this.appendInitSegment_ = {
  106241. audio: true,
  106242. video: true
  106243. };
  106244. this.resetLoader();
  106245. this.remove(0, Infinity, done);
  106246. if (this.transmuxer_) {
  106247. this.transmuxer_.postMessage({
  106248. action: "clearAllMp4Captions"
  106249. });
  106250. this.transmuxer_.postMessage({
  106251. action: "reset"
  106252. });
  106253. }
  106254. };
  106255. _proto.resetLoader = function resetLoader() {
  106256. this.fetchAtBuffer_ = false;
  106257. this.resyncLoader();
  106258. };
  106259. _proto.resyncLoader = function resyncLoader() {
  106260. if (this.transmuxer_) {
  106261. segmentTransmuxer.reset(this.transmuxer_);
  106262. }
  106263. this.mediaIndex = null;
  106264. this.partIndex = null;
  106265. this.syncPoint_ = null;
  106266. this.isPendingTimestampOffset_ = false;
  106267. this.callQueue_ = [];
  106268. this.loadQueue_ = [];
  106269. this.metadataQueue_.id3 = [];
  106270. this.metadataQueue_.caption = [];
  106271. this.abort();
  106272. if (this.transmuxer_) {
  106273. this.transmuxer_.postMessage({
  106274. action: "clearParsedMp4Captions"
  106275. });
  106276. }
  106277. };
  106278. _proto.remove = function remove2(start2, end, done, force) {
  106279. if (done === void 0) {
  106280. done = function done2() {
  106281. };
  106282. }
  106283. if (force === void 0) {
  106284. force = false;
  106285. }
  106286. if (end === Infinity) {
  106287. end = this.duration_();
  106288. }
  106289. if (end <= start2) {
  106290. this.logger_("skipping remove because end ${end} is <= start ${start}");
  106291. return;
  106292. }
  106293. if (!this.sourceUpdater_ || !this.getMediaInfo_()) {
  106294. this.logger_("skipping remove because no source updater or starting media info");
  106295. return;
  106296. }
  106297. var removesRemaining = 1;
  106298. var removeFinished = function removeFinished2() {
  106299. removesRemaining--;
  106300. if (removesRemaining === 0) {
  106301. done();
  106302. }
  106303. };
  106304. if (force || !this.audioDisabled_) {
  106305. removesRemaining++;
  106306. this.sourceUpdater_.removeAudio(start2, end, removeFinished);
  106307. }
  106308. if (force || this.loaderType_ === "main") {
  106309. this.gopBuffer_ = removeGopBuffer(this.gopBuffer_, start2, end, this.timeMapping_);
  106310. removesRemaining++;
  106311. this.sourceUpdater_.removeVideo(start2, end, removeFinished);
  106312. }
  106313. for (var track in this.inbandTextTracks_) {
  106314. removeCuesFromTrack(start2, end, this.inbandTextTracks_[track]);
  106315. }
  106316. removeCuesFromTrack(start2, end, this.segmentMetadataTrack_);
  106317. removeFinished();
  106318. };
  106319. _proto.monitorBuffer_ = function monitorBuffer_() {
  106320. if (this.checkBufferTimeout_) {
  106321. window_1.clearTimeout(this.checkBufferTimeout_);
  106322. }
  106323. this.checkBufferTimeout_ = window_1.setTimeout(this.monitorBufferTick_.bind(this), 1);
  106324. };
  106325. _proto.monitorBufferTick_ = function monitorBufferTick_() {
  106326. if (this.state === "READY") {
  106327. this.fillBuffer_();
  106328. }
  106329. if (this.checkBufferTimeout_) {
  106330. window_1.clearTimeout(this.checkBufferTimeout_);
  106331. }
  106332. this.checkBufferTimeout_ = window_1.setTimeout(this.monitorBufferTick_.bind(this), CHECK_BUFFER_DELAY);
  106333. };
  106334. _proto.fillBuffer_ = function fillBuffer_() {
  106335. if (this.sourceUpdater_.updating()) {
  106336. return;
  106337. }
  106338. var segmentInfo = this.chooseNextRequest_();
  106339. if (!segmentInfo) {
  106340. return;
  106341. }
  106342. if (typeof segmentInfo.timestampOffset === "number") {
  106343. this.isPendingTimestampOffset_ = false;
  106344. this.timelineChangeController_.pendingTimelineChange({
  106345. type: this.loaderType_,
  106346. from: this.currentTimeline_,
  106347. to: segmentInfo.timeline
  106348. });
  106349. }
  106350. this.loadSegment_(segmentInfo);
  106351. };
  106352. _proto.isEndOfStream_ = function isEndOfStream_(mediaIndex, playlist, partIndex) {
  106353. if (mediaIndex === void 0) {
  106354. mediaIndex = this.mediaIndex;
  106355. }
  106356. if (playlist === void 0) {
  106357. playlist = this.playlist_;
  106358. }
  106359. if (partIndex === void 0) {
  106360. partIndex = this.partIndex;
  106361. }
  106362. if (!playlist || !this.mediaSource_) {
  106363. return false;
  106364. }
  106365. var segment = typeof mediaIndex === "number" && playlist.segments[mediaIndex];
  106366. var appendedLastSegment = mediaIndex + 1 === playlist.segments.length;
  106367. var appendedLastPart = !segment || !segment.parts || partIndex + 1 === segment.parts.length;
  106368. return playlist.endList && this.mediaSource_.readyState === "open" && appendedLastSegment && appendedLastPart;
  106369. };
  106370. _proto.chooseNextRequest_ = function chooseNextRequest_() {
  106371. var buffered = this.buffered_();
  106372. var bufferedEnd = lastBufferedEnd(buffered) || 0;
  106373. var bufferedTime = timeAheadOf(buffered, this.currentTime_());
  106374. var preloaded = !this.hasPlayed_() && bufferedTime >= 1;
  106375. var haveEnoughBuffer = bufferedTime >= this.goalBufferLength_();
  106376. var segments = this.playlist_.segments;
  106377. if (!segments.length || preloaded || haveEnoughBuffer) {
  106378. return null;
  106379. }
  106380. this.syncPoint_ = this.syncPoint_ || this.syncController_.getSyncPoint(this.playlist_, this.duration_(), this.currentTimeline_, this.currentTime_());
  106381. var next = {
  106382. partIndex: null,
  106383. mediaIndex: null,
  106384. startOfSegment: null,
  106385. playlist: this.playlist_,
  106386. isSyncRequest: Boolean(!this.syncPoint_)
  106387. };
  106388. if (next.isSyncRequest) {
  106389. next.mediaIndex = getSyncSegmentCandidate(this.currentTimeline_, segments, bufferedEnd);
  106390. } else if (this.mediaIndex !== null) {
  106391. var segment = segments[this.mediaIndex];
  106392. var partIndex = typeof this.partIndex === "number" ? this.partIndex : -1;
  106393. next.startOfSegment = segment.end ? segment.end : bufferedEnd;
  106394. if (segment.parts && segment.parts[partIndex + 1]) {
  106395. next.mediaIndex = this.mediaIndex;
  106396. next.partIndex = partIndex + 1;
  106397. } else {
  106398. next.mediaIndex = this.mediaIndex + 1;
  106399. }
  106400. } else {
  106401. var _Playlist$getMediaInf = Playlist.getMediaInfoForTime({
  106402. experimentalExactManifestTimings: this.experimentalExactManifestTimings,
  106403. playlist: this.playlist_,
  106404. currentTime: this.fetchAtBuffer_ ? bufferedEnd : this.currentTime_(),
  106405. startingPartIndex: this.syncPoint_.partIndex,
  106406. startingSegmentIndex: this.syncPoint_.segmentIndex,
  106407. startTime: this.syncPoint_.time
  106408. }), segmentIndex = _Playlist$getMediaInf.segmentIndex, startTime = _Playlist$getMediaInf.startTime, _partIndex = _Playlist$getMediaInf.partIndex;
  106409. next.getMediaInfoForTime = this.fetchAtBuffer_ ? "bufferedEnd " + bufferedEnd : "currentTime " + this.currentTime_();
  106410. next.mediaIndex = segmentIndex;
  106411. next.startOfSegment = startTime;
  106412. next.partIndex = _partIndex;
  106413. }
  106414. var nextSegment = segments[next.mediaIndex];
  106415. var nextPart = nextSegment && typeof next.partIndex === "number" && nextSegment.parts && nextSegment.parts[next.partIndex];
  106416. if (!nextSegment || typeof next.partIndex === "number" && !nextPart) {
  106417. return null;
  106418. }
  106419. if (typeof next.partIndex !== "number" && nextSegment.parts) {
  106420. next.partIndex = 0;
  106421. nextPart = nextSegment.parts[0];
  106422. }
  106423. if (!bufferedTime && nextPart && !nextPart.independent) {
  106424. if (next.partIndex === 0) {
  106425. var lastSegment = segments[next.mediaIndex - 1];
  106426. var lastSegmentLastPart = lastSegment.parts && lastSegment.parts.length && lastSegment.parts[lastSegment.parts.length - 1];
  106427. if (lastSegmentLastPart && lastSegmentLastPart.independent) {
  106428. next.mediaIndex -= 1;
  106429. next.partIndex = lastSegment.parts.length - 1;
  106430. next.independent = "previous segment";
  106431. }
  106432. } else if (nextSegment.parts[next.partIndex - 1].independent) {
  106433. next.partIndex -= 1;
  106434. next.independent = "previous part";
  106435. }
  106436. }
  106437. var ended = this.mediaSource_ && this.mediaSource_.readyState === "ended";
  106438. if (next.mediaIndex >= segments.length - 1 && ended && !this.seeking_()) {
  106439. return null;
  106440. }
  106441. return this.generateSegmentInfo_(next);
  106442. };
  106443. _proto.generateSegmentInfo_ = function generateSegmentInfo_(options2) {
  106444. var independent = options2.independent, playlist = options2.playlist, mediaIndex = options2.mediaIndex, startOfSegment = options2.startOfSegment, isSyncRequest = options2.isSyncRequest, partIndex = options2.partIndex, forceTimestampOffset = options2.forceTimestampOffset, getMediaInfoForTime3 = options2.getMediaInfoForTime;
  106445. var segment = playlist.segments[mediaIndex];
  106446. var part = typeof partIndex === "number" && segment.parts[partIndex];
  106447. var segmentInfo = {
  106448. requestId: "segment-loader-" + Math.random(),
  106449. uri: part && part.resolvedUri || segment.resolvedUri,
  106450. mediaIndex,
  106451. partIndex: part ? partIndex : null,
  106452. isSyncRequest,
  106453. startOfSegment,
  106454. playlist,
  106455. bytes: null,
  106456. encryptedBytes: null,
  106457. timestampOffset: null,
  106458. timeline: segment.timeline,
  106459. duration: part && part.duration || segment.duration,
  106460. segment,
  106461. part,
  106462. byteLength: 0,
  106463. transmuxer: this.transmuxer_,
  106464. getMediaInfoForTime: getMediaInfoForTime3,
  106465. independent
  106466. };
  106467. var overrideCheck = typeof forceTimestampOffset !== "undefined" ? forceTimestampOffset : this.isPendingTimestampOffset_;
  106468. segmentInfo.timestampOffset = this.timestampOffsetForSegment_({
  106469. segmentTimeline: segment.timeline,
  106470. currentTimeline: this.currentTimeline_,
  106471. startOfSegment,
  106472. buffered: this.buffered_(),
  106473. overrideCheck
  106474. });
  106475. var audioBufferedEnd = lastBufferedEnd(this.sourceUpdater_.audioBuffered());
  106476. if (typeof audioBufferedEnd === "number") {
  106477. segmentInfo.audioAppendStart = audioBufferedEnd - this.sourceUpdater_.audioTimestampOffset();
  106478. }
  106479. if (this.sourceUpdater_.videoBuffered().length) {
  106480. segmentInfo.gopsToAlignWith = gopsSafeToAlignWith(
  106481. this.gopBuffer_,
  106482. this.currentTime_() - this.sourceUpdater_.videoTimestampOffset(),
  106483. this.timeMapping_
  106484. );
  106485. }
  106486. return segmentInfo;
  106487. };
  106488. _proto.timestampOffsetForSegment_ = function timestampOffsetForSegment_(options2) {
  106489. return timestampOffsetForSegment(options2);
  106490. };
  106491. _proto.earlyAbortWhenNeeded_ = function earlyAbortWhenNeeded_(stats) {
  106492. if (this.vhs_.tech_.paused() || !this.xhrOptions_.timeout || !this.playlist_.attributes.BANDWIDTH) {
  106493. return;
  106494. }
  106495. if (Date.now() - (stats.firstBytesReceivedAt || Date.now()) < 1e3) {
  106496. return;
  106497. }
  106498. var currentTime = this.currentTime_();
  106499. var measuredBandwidth = stats.bandwidth;
  106500. var segmentDuration = this.pendingSegment_.duration;
  106501. var requestTimeRemaining = Playlist.estimateSegmentRequestTime(segmentDuration, measuredBandwidth, this.playlist_, stats.bytesReceived);
  106502. var timeUntilRebuffer$12 = timeUntilRebuffer(this.buffered_(), currentTime, this.vhs_.tech_.playbackRate()) - 1;
  106503. if (requestTimeRemaining <= timeUntilRebuffer$12) {
  106504. return;
  106505. }
  106506. var switchCandidate = minRebufferMaxBandwidthSelector({
  106507. master: this.vhs_.playlists.master,
  106508. currentTime,
  106509. bandwidth: measuredBandwidth,
  106510. duration: this.duration_(),
  106511. segmentDuration,
  106512. timeUntilRebuffer: timeUntilRebuffer$12,
  106513. currentTimeline: this.currentTimeline_,
  106514. syncController: this.syncController_
  106515. });
  106516. if (!switchCandidate) {
  106517. return;
  106518. }
  106519. var rebufferingImpact = requestTimeRemaining - timeUntilRebuffer$12;
  106520. var timeSavedBySwitching = rebufferingImpact - switchCandidate.rebufferingImpact;
  106521. var minimumTimeSaving = 0.5;
  106522. if (timeUntilRebuffer$12 <= TIME_FUDGE_FACTOR) {
  106523. minimumTimeSaving = 1;
  106524. }
  106525. if (!switchCandidate.playlist || switchCandidate.playlist.uri === this.playlist_.uri || timeSavedBySwitching < minimumTimeSaving) {
  106526. return;
  106527. }
  106528. this.bandwidth = switchCandidate.playlist.attributes.BANDWIDTH * Config.BANDWIDTH_VARIANCE + 1;
  106529. this.trigger("earlyabort");
  106530. };
  106531. _proto.handleAbort_ = function handleAbort_(segmentInfo) {
  106532. this.logger_("Aborting " + segmentInfoString(segmentInfo));
  106533. this.mediaRequestsAborted += 1;
  106534. };
  106535. _proto.handleProgress_ = function handleProgress_(event2, simpleSegment) {
  106536. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  106537. if (this.checkForAbort_(simpleSegment.requestId)) {
  106538. return;
  106539. }
  106540. this.trigger("progress");
  106541. };
  106542. _proto.handleTrackInfo_ = function handleTrackInfo_(simpleSegment, trackInfo) {
  106543. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  106544. if (this.checkForAbort_(simpleSegment.requestId)) {
  106545. return;
  106546. }
  106547. if (this.checkForIllegalMediaSwitch(trackInfo)) {
  106548. return;
  106549. }
  106550. trackInfo = trackInfo || {};
  106551. if (!shallowEqual(this.currentMediaInfo_, trackInfo)) {
  106552. this.appendInitSegment_ = {
  106553. audio: true,
  106554. video: true
  106555. };
  106556. this.startingMediaInfo_ = trackInfo;
  106557. this.currentMediaInfo_ = trackInfo;
  106558. this.logger_("trackinfo update", trackInfo);
  106559. this.trigger("trackinfo");
  106560. }
  106561. if (this.checkForAbort_(simpleSegment.requestId)) {
  106562. return;
  106563. }
  106564. this.pendingSegment_.trackInfo = trackInfo;
  106565. if (this.hasEnoughInfoToAppend_()) {
  106566. this.processCallQueue_();
  106567. }
  106568. };
  106569. _proto.handleTimingInfo_ = function handleTimingInfo_(simpleSegment, mediaType, timeType, time) {
  106570. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  106571. if (this.checkForAbort_(simpleSegment.requestId)) {
  106572. return;
  106573. }
  106574. var segmentInfo = this.pendingSegment_;
  106575. var timingInfoProperty = timingInfoPropertyForMedia(mediaType);
  106576. segmentInfo[timingInfoProperty] = segmentInfo[timingInfoProperty] || {};
  106577. segmentInfo[timingInfoProperty][timeType] = time;
  106578. this.logger_("timinginfo: " + mediaType + " - " + timeType + " - " + time);
  106579. if (this.hasEnoughInfoToAppend_()) {
  106580. this.processCallQueue_();
  106581. }
  106582. };
  106583. _proto.handleCaptions_ = function handleCaptions_(simpleSegment, captionData) {
  106584. var _this2 = this;
  106585. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  106586. if (this.checkForAbort_(simpleSegment.requestId)) {
  106587. return;
  106588. }
  106589. if (captionData.length === 0) {
  106590. this.logger_("SegmentLoader received no captions from a caption event");
  106591. return;
  106592. }
  106593. var segmentInfo = this.pendingSegment_;
  106594. if (!segmentInfo.hasAppendedData_) {
  106595. this.metadataQueue_.caption.push(this.handleCaptions_.bind(this, simpleSegment, captionData));
  106596. return;
  106597. }
  106598. var timestampOffset2 = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset();
  106599. var captionTracks = {};
  106600. captionData.forEach(function(caption) {
  106601. captionTracks[caption.stream] = captionTracks[caption.stream] || {
  106602. startTime: Infinity,
  106603. captions: [],
  106604. endTime: 0
  106605. };
  106606. var captionTrack = captionTracks[caption.stream];
  106607. captionTrack.startTime = Math.min(captionTrack.startTime, caption.startTime + timestampOffset2);
  106608. captionTrack.endTime = Math.max(captionTrack.endTime, caption.endTime + timestampOffset2);
  106609. captionTrack.captions.push(caption);
  106610. });
  106611. Object.keys(captionTracks).forEach(function(trackName) {
  106612. var _captionTracks$trackN = captionTracks[trackName], startTime = _captionTracks$trackN.startTime, endTime = _captionTracks$trackN.endTime, captions = _captionTracks$trackN.captions;
  106613. var inbandTextTracks = _this2.inbandTextTracks_;
  106614. _this2.logger_("adding cues from " + startTime + " -> " + endTime + " for " + trackName);
  106615. createCaptionsTrackIfNotExists(inbandTextTracks, _this2.vhs_.tech_, trackName);
  106616. removeCuesFromTrack(startTime, endTime, inbandTextTracks[trackName]);
  106617. addCaptionData({
  106618. captionArray: captions,
  106619. inbandTextTracks,
  106620. timestampOffset: timestampOffset2
  106621. });
  106622. });
  106623. if (this.transmuxer_) {
  106624. this.transmuxer_.postMessage({
  106625. action: "clearParsedMp4Captions"
  106626. });
  106627. }
  106628. };
  106629. _proto.handleId3_ = function handleId3_(simpleSegment, id3Frames, dispatchType) {
  106630. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  106631. if (this.checkForAbort_(simpleSegment.requestId)) {
  106632. return;
  106633. }
  106634. var segmentInfo = this.pendingSegment_;
  106635. if (!segmentInfo.hasAppendedData_) {
  106636. this.metadataQueue_.id3.push(this.handleId3_.bind(this, simpleSegment, id3Frames, dispatchType));
  106637. return;
  106638. }
  106639. var timestampOffset2 = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset();
  106640. createMetadataTrackIfNotExists(this.inbandTextTracks_, dispatchType, this.vhs_.tech_);
  106641. addMetadata({
  106642. inbandTextTracks: this.inbandTextTracks_,
  106643. metadataArray: id3Frames,
  106644. timestampOffset: timestampOffset2,
  106645. videoDuration: this.duration_()
  106646. });
  106647. };
  106648. _proto.processMetadataQueue_ = function processMetadataQueue_() {
  106649. this.metadataQueue_.id3.forEach(function(fn2) {
  106650. return fn2();
  106651. });
  106652. this.metadataQueue_.caption.forEach(function(fn2) {
  106653. return fn2();
  106654. });
  106655. this.metadataQueue_.id3 = [];
  106656. this.metadataQueue_.caption = [];
  106657. };
  106658. _proto.processCallQueue_ = function processCallQueue_() {
  106659. var callQueue = this.callQueue_;
  106660. this.callQueue_ = [];
  106661. callQueue.forEach(function(fun) {
  106662. return fun();
  106663. });
  106664. };
  106665. _proto.processLoadQueue_ = function processLoadQueue_() {
  106666. var loadQueue = this.loadQueue_;
  106667. this.loadQueue_ = [];
  106668. loadQueue.forEach(function(fun) {
  106669. return fun();
  106670. });
  106671. };
  106672. _proto.hasEnoughInfoToLoad_ = function hasEnoughInfoToLoad_() {
  106673. if (this.loaderType_ !== "audio") {
  106674. return true;
  106675. }
  106676. var segmentInfo = this.pendingSegment_;
  106677. if (!segmentInfo) {
  106678. return false;
  106679. }
  106680. if (!this.getCurrentMediaInfo_()) {
  106681. return true;
  106682. }
  106683. if (shouldWaitForTimelineChange({
  106684. timelineChangeController: this.timelineChangeController_,
  106685. currentTimeline: this.currentTimeline_,
  106686. segmentTimeline: segmentInfo.timeline,
  106687. loaderType: this.loaderType_,
  106688. audioDisabled: this.audioDisabled_
  106689. })) {
  106690. return false;
  106691. }
  106692. return true;
  106693. };
  106694. _proto.getCurrentMediaInfo_ = function getCurrentMediaInfo_(segmentInfo) {
  106695. if (segmentInfo === void 0) {
  106696. segmentInfo = this.pendingSegment_;
  106697. }
  106698. return segmentInfo && segmentInfo.trackInfo || this.currentMediaInfo_;
  106699. };
  106700. _proto.getMediaInfo_ = function getMediaInfo_(segmentInfo) {
  106701. if (segmentInfo === void 0) {
  106702. segmentInfo = this.pendingSegment_;
  106703. }
  106704. return this.getCurrentMediaInfo_(segmentInfo) || this.startingMediaInfo_;
  106705. };
  106706. _proto.getPendingSegmentPlaylist = function getPendingSegmentPlaylist() {
  106707. return this.pendingSegment_ ? this.pendingSegment_.playlist : null;
  106708. };
  106709. _proto.hasEnoughInfoToAppend_ = function hasEnoughInfoToAppend_() {
  106710. if (!this.sourceUpdater_.ready()) {
  106711. return false;
  106712. }
  106713. if (this.waitingOnRemove_ || this.quotaExceededErrorRetryTimeout_) {
  106714. return false;
  106715. }
  106716. var segmentInfo = this.pendingSegment_;
  106717. var trackInfo = this.getCurrentMediaInfo_();
  106718. if (!segmentInfo || !trackInfo) {
  106719. return false;
  106720. }
  106721. var hasAudio = trackInfo.hasAudio, hasVideo = trackInfo.hasVideo, isMuxed3 = trackInfo.isMuxed;
  106722. if (hasVideo && !segmentInfo.videoTimingInfo) {
  106723. return false;
  106724. }
  106725. if (hasAudio && !this.audioDisabled_ && !isMuxed3 && !segmentInfo.audioTimingInfo) {
  106726. return false;
  106727. }
  106728. if (shouldWaitForTimelineChange({
  106729. timelineChangeController: this.timelineChangeController_,
  106730. currentTimeline: this.currentTimeline_,
  106731. segmentTimeline: segmentInfo.timeline,
  106732. loaderType: this.loaderType_,
  106733. audioDisabled: this.audioDisabled_
  106734. })) {
  106735. return false;
  106736. }
  106737. return true;
  106738. };
  106739. _proto.handleData_ = function handleData_3(simpleSegment, result) {
  106740. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  106741. if (this.checkForAbort_(simpleSegment.requestId)) {
  106742. return;
  106743. }
  106744. if (this.callQueue_.length || !this.hasEnoughInfoToAppend_()) {
  106745. this.callQueue_.push(this.handleData_.bind(this, simpleSegment, result));
  106746. return;
  106747. }
  106748. var segmentInfo = this.pendingSegment_;
  106749. this.setTimeMapping_(segmentInfo.timeline);
  106750. this.updateMediaSecondsLoaded_(segmentInfo.part || segmentInfo.segment);
  106751. if (this.mediaSource_.readyState === "closed") {
  106752. return;
  106753. }
  106754. if (simpleSegment.map) {
  106755. simpleSegment.map = this.initSegmentForMap(simpleSegment.map, true);
  106756. segmentInfo.segment.map = simpleSegment.map;
  106757. }
  106758. if (simpleSegment.key) {
  106759. this.segmentKey(simpleSegment.key, true);
  106760. }
  106761. segmentInfo.isFmp4 = simpleSegment.isFmp4;
  106762. segmentInfo.timingInfo = segmentInfo.timingInfo || {};
  106763. if (segmentInfo.isFmp4) {
  106764. this.trigger("fmp4");
  106765. segmentInfo.timingInfo.start = segmentInfo[timingInfoPropertyForMedia(result.type)].start;
  106766. } else {
  106767. var trackInfo = this.getCurrentMediaInfo_();
  106768. var useVideoTimingInfo = this.loaderType_ === "main" && trackInfo && trackInfo.hasVideo;
  106769. var firstVideoFrameTimeForData;
  106770. if (useVideoTimingInfo) {
  106771. firstVideoFrameTimeForData = segmentInfo.videoTimingInfo.start;
  106772. }
  106773. segmentInfo.timingInfo.start = this.trueSegmentStart_({
  106774. currentStart: segmentInfo.timingInfo.start,
  106775. playlist: segmentInfo.playlist,
  106776. mediaIndex: segmentInfo.mediaIndex,
  106777. currentVideoTimestampOffset: this.sourceUpdater_.videoTimestampOffset(),
  106778. useVideoTimingInfo,
  106779. firstVideoFrameTimeForData,
  106780. videoTimingInfo: segmentInfo.videoTimingInfo,
  106781. audioTimingInfo: segmentInfo.audioTimingInfo
  106782. });
  106783. }
  106784. this.updateAppendInitSegmentStatus(segmentInfo, result.type);
  106785. this.updateSourceBufferTimestampOffset_(segmentInfo);
  106786. if (segmentInfo.isSyncRequest) {
  106787. this.updateTimingInfoEnd_(segmentInfo);
  106788. this.syncController_.saveSegmentTimingInfo({
  106789. segmentInfo,
  106790. shouldSaveTimelineMapping: this.loaderType_ === "main"
  106791. });
  106792. var next = this.chooseNextRequest_();
  106793. if (next.mediaIndex !== segmentInfo.mediaIndex || next.partIndex !== segmentInfo.partIndex) {
  106794. this.logger_("sync segment was incorrect, not appending");
  106795. return;
  106796. }
  106797. this.logger_("sync segment was correct, appending");
  106798. }
  106799. segmentInfo.hasAppendedData_ = true;
  106800. this.processMetadataQueue_();
  106801. this.appendData_(segmentInfo, result);
  106802. };
  106803. _proto.updateAppendInitSegmentStatus = function updateAppendInitSegmentStatus(segmentInfo, type2) {
  106804. if (this.loaderType_ === "main" && typeof segmentInfo.timestampOffset === "number" && !segmentInfo.changedTimestampOffset) {
  106805. this.appendInitSegment_ = {
  106806. audio: true,
  106807. video: true
  106808. };
  106809. }
  106810. if (this.playlistOfLastInitSegment_[type2] !== segmentInfo.playlist) {
  106811. this.appendInitSegment_[type2] = true;
  106812. }
  106813. };
  106814. _proto.getInitSegmentAndUpdateState_ = function getInitSegmentAndUpdateState_(_ref4) {
  106815. var type2 = _ref4.type, initSegment = _ref4.initSegment, map = _ref4.map, playlist = _ref4.playlist;
  106816. if (map) {
  106817. var id = initSegmentId(map);
  106818. if (this.activeInitSegmentId_ === id) {
  106819. return null;
  106820. }
  106821. initSegment = this.initSegmentForMap(map, true).bytes;
  106822. this.activeInitSegmentId_ = id;
  106823. }
  106824. if (initSegment && this.appendInitSegment_[type2]) {
  106825. this.playlistOfLastInitSegment_[type2] = playlist;
  106826. this.appendInitSegment_[type2] = false;
  106827. this.activeInitSegmentId_ = null;
  106828. return initSegment;
  106829. }
  106830. return null;
  106831. };
  106832. _proto.handleQuotaExceededError_ = function handleQuotaExceededError_(_ref5, error) {
  106833. var _this3 = this;
  106834. var segmentInfo = _ref5.segmentInfo, type2 = _ref5.type, bytes = _ref5.bytes;
  106835. var audioBuffered = this.sourceUpdater_.audioBuffered();
  106836. var videoBuffered = this.sourceUpdater_.videoBuffered();
  106837. if (audioBuffered.length > 1) {
  106838. this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: " + timeRangesToArray(audioBuffered).join(", "));
  106839. }
  106840. if (videoBuffered.length > 1) {
  106841. this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: " + timeRangesToArray(videoBuffered).join(", "));
  106842. }
  106843. var audioBufferStart = audioBuffered.length ? audioBuffered.start(0) : 0;
  106844. var audioBufferEnd = audioBuffered.length ? audioBuffered.end(audioBuffered.length - 1) : 0;
  106845. var videoBufferStart = videoBuffered.length ? videoBuffered.start(0) : 0;
  106846. var videoBufferEnd = videoBuffered.length ? videoBuffered.end(videoBuffered.length - 1) : 0;
  106847. if (audioBufferEnd - audioBufferStart <= MIN_BACK_BUFFER && videoBufferEnd - videoBufferStart <= MIN_BACK_BUFFER) {
  106848. this.logger_("On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. " + ("Appended byte length: " + bytes.byteLength + ", ") + ("audio buffer: " + timeRangesToArray(audioBuffered).join(", ") + ", ") + ("video buffer: " + timeRangesToArray(videoBuffered).join(", ") + ", "));
  106849. this.error({
  106850. message: "Quota exceeded error with append of a single segment of content",
  106851. excludeUntil: Infinity
  106852. });
  106853. this.trigger("error");
  106854. return;
  106855. }
  106856. this.waitingOnRemove_ = true;
  106857. this.callQueue_.push(this.appendToSourceBuffer_.bind(this, {
  106858. segmentInfo,
  106859. type: type2,
  106860. bytes
  106861. }));
  106862. var currentTime = this.currentTime_();
  106863. var timeToRemoveUntil = currentTime - MIN_BACK_BUFFER;
  106864. this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to " + timeToRemoveUntil);
  106865. this.remove(0, timeToRemoveUntil, function() {
  106866. _this3.logger_("On QUOTA_EXCEEDED_ERR, retrying append in " + MIN_BACK_BUFFER + "s");
  106867. _this3.waitingOnRemove_ = false;
  106868. _this3.quotaExceededErrorRetryTimeout_ = window_1.setTimeout(function() {
  106869. _this3.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue");
  106870. _this3.quotaExceededErrorRetryTimeout_ = null;
  106871. _this3.processCallQueue_();
  106872. }, MIN_BACK_BUFFER * 1e3);
  106873. }, true);
  106874. };
  106875. _proto.handleAppendError_ = function handleAppendError_(_ref6, error) {
  106876. var segmentInfo = _ref6.segmentInfo, type2 = _ref6.type, bytes = _ref6.bytes;
  106877. if (!error) {
  106878. return;
  106879. }
  106880. if (error.code === QUOTA_EXCEEDED_ERR) {
  106881. this.handleQuotaExceededError_({
  106882. segmentInfo,
  106883. type: type2,
  106884. bytes
  106885. });
  106886. return;
  106887. }
  106888. this.logger_("Received non QUOTA_EXCEEDED_ERR on append", error);
  106889. this.error(type2 + " append of " + bytes.length + "b failed for segment " + ("#" + segmentInfo.mediaIndex + " in playlist " + segmentInfo.playlist.id));
  106890. this.trigger("appenderror");
  106891. };
  106892. _proto.appendToSourceBuffer_ = function appendToSourceBuffer_(_ref7) {
  106893. var segmentInfo = _ref7.segmentInfo, type2 = _ref7.type, initSegment = _ref7.initSegment, data = _ref7.data, bytes = _ref7.bytes;
  106894. if (!bytes) {
  106895. var segments = [data];
  106896. var byteLength = data.byteLength;
  106897. if (initSegment) {
  106898. segments.unshift(initSegment);
  106899. byteLength += initSegment.byteLength;
  106900. }
  106901. bytes = concatSegments({
  106902. bytes: byteLength,
  106903. segments
  106904. });
  106905. }
  106906. this.sourceUpdater_.appendBuffer({
  106907. segmentInfo,
  106908. type: type2,
  106909. bytes
  106910. }, this.handleAppendError_.bind(this, {
  106911. segmentInfo,
  106912. type: type2,
  106913. bytes
  106914. }));
  106915. };
  106916. _proto.handleSegmentTimingInfo_ = function handleSegmentTimingInfo_(type2, requestId, segmentTimingInfo) {
  106917. if (!this.pendingSegment_ || requestId !== this.pendingSegment_.requestId) {
  106918. return;
  106919. }
  106920. var segment = this.pendingSegment_.segment;
  106921. var timingInfoProperty = type2 + "TimingInfo";
  106922. if (!segment[timingInfoProperty]) {
  106923. segment[timingInfoProperty] = {};
  106924. }
  106925. segment[timingInfoProperty].transmuxerPrependedSeconds = segmentTimingInfo.prependedContentDuration || 0;
  106926. segment[timingInfoProperty].transmuxedPresentationStart = segmentTimingInfo.start.presentation;
  106927. segment[timingInfoProperty].transmuxedDecodeStart = segmentTimingInfo.start.decode;
  106928. segment[timingInfoProperty].transmuxedPresentationEnd = segmentTimingInfo.end.presentation;
  106929. segment[timingInfoProperty].transmuxedDecodeEnd = segmentTimingInfo.end.decode;
  106930. segment[timingInfoProperty].baseMediaDecodeTime = segmentTimingInfo.baseMediaDecodeTime;
  106931. };
  106932. _proto.appendData_ = function appendData_(segmentInfo, result) {
  106933. var type2 = result.type, data = result.data;
  106934. if (!data || !data.byteLength) {
  106935. return;
  106936. }
  106937. if (type2 === "audio" && this.audioDisabled_) {
  106938. return;
  106939. }
  106940. var initSegment = this.getInitSegmentAndUpdateState_({
  106941. type: type2,
  106942. initSegment: result.initSegment,
  106943. playlist: segmentInfo.playlist,
  106944. map: segmentInfo.isFmp4 ? segmentInfo.segment.map : null
  106945. });
  106946. this.appendToSourceBuffer_({
  106947. segmentInfo,
  106948. type: type2,
  106949. initSegment,
  106950. data
  106951. });
  106952. };
  106953. _proto.loadSegment_ = function loadSegment_(segmentInfo) {
  106954. var _this4 = this;
  106955. this.state = "WAITING";
  106956. this.pendingSegment_ = segmentInfo;
  106957. this.trimBackBuffer_(segmentInfo);
  106958. if (typeof segmentInfo.timestampOffset === "number") {
  106959. if (this.transmuxer_) {
  106960. this.transmuxer_.postMessage({
  106961. action: "clearAllMp4Captions"
  106962. });
  106963. }
  106964. }
  106965. if (!this.hasEnoughInfoToLoad_()) {
  106966. this.loadQueue_.push(function() {
  106967. var options2 = _extends$2({}, segmentInfo, {
  106968. forceTimestampOffset: true
  106969. });
  106970. _extends$2(segmentInfo, _this4.generateSegmentInfo_(options2));
  106971. _this4.isPendingTimestampOffset_ = false;
  106972. _this4.updateTransmuxerAndRequestSegment_(segmentInfo);
  106973. });
  106974. return;
  106975. }
  106976. this.updateTransmuxerAndRequestSegment_(segmentInfo);
  106977. };
  106978. _proto.updateTransmuxerAndRequestSegment_ = function updateTransmuxerAndRequestSegment_(segmentInfo) {
  106979. var _this5 = this;
  106980. if (this.shouldUpdateTransmuxerTimestampOffset_(segmentInfo.timestampOffset)) {
  106981. this.gopBuffer_.length = 0;
  106982. segmentInfo.gopsToAlignWith = [];
  106983. this.timeMapping_ = 0;
  106984. this.transmuxer_.postMessage({
  106985. action: "reset"
  106986. });
  106987. this.transmuxer_.postMessage({
  106988. action: "setTimestampOffset",
  106989. timestampOffset: segmentInfo.timestampOffset
  106990. });
  106991. }
  106992. var simpleSegment = this.createSimplifiedSegmentObj_(segmentInfo);
  106993. var isEndOfStream = this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex);
  106994. var isWalkingForward = this.mediaIndex !== null;
  106995. var isDiscontinuity = segmentInfo.timeline !== this.currentTimeline_ && segmentInfo.timeline > 0;
  106996. var isEndOfTimeline = isEndOfStream || isWalkingForward && isDiscontinuity;
  106997. this.logger_("Requesting " + segmentInfoString(segmentInfo));
  106998. if (simpleSegment.map && !simpleSegment.map.bytes) {
  106999. this.logger_("going to request init segment.");
  107000. this.appendInitSegment_ = {
  107001. video: true,
  107002. audio: true
  107003. };
  107004. }
  107005. segmentInfo.abortRequests = mediaSegmentRequest({
  107006. xhr: this.vhs_.xhr,
  107007. xhrOptions: this.xhrOptions_,
  107008. decryptionWorker: this.decrypter_,
  107009. segment: simpleSegment,
  107010. abortFn: this.handleAbort_.bind(this, segmentInfo),
  107011. progressFn: this.handleProgress_.bind(this),
  107012. trackInfoFn: this.handleTrackInfo_.bind(this),
  107013. timingInfoFn: this.handleTimingInfo_.bind(this),
  107014. videoSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, "video", segmentInfo.requestId),
  107015. audioSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, "audio", segmentInfo.requestId),
  107016. captionsFn: this.handleCaptions_.bind(this),
  107017. isEndOfTimeline,
  107018. endedTimelineFn: function endedTimelineFn() {
  107019. _this5.logger_("received endedtimeline callback");
  107020. },
  107021. id3Fn: this.handleId3_.bind(this),
  107022. dataFn: this.handleData_.bind(this),
  107023. doneFn: this.segmentRequestFinished_.bind(this),
  107024. onTransmuxerLog: function onTransmuxerLog(_ref8) {
  107025. var message = _ref8.message, level = _ref8.level, stream = _ref8.stream;
  107026. _this5.logger_(segmentInfoString(segmentInfo) + " logged from transmuxer stream " + stream + " as a " + level + ": " + message);
  107027. }
  107028. });
  107029. };
  107030. _proto.trimBackBuffer_ = function trimBackBuffer_(segmentInfo) {
  107031. var removeToTime = safeBackBufferTrimTime(this.seekable_(), this.currentTime_(), this.playlist_.targetDuration || 10);
  107032. if (removeToTime > 0) {
  107033. this.remove(0, removeToTime);
  107034. }
  107035. };
  107036. _proto.createSimplifiedSegmentObj_ = function createSimplifiedSegmentObj_(segmentInfo) {
  107037. var segment = segmentInfo.segment;
  107038. var part = segmentInfo.part;
  107039. var simpleSegment = {
  107040. resolvedUri: part ? part.resolvedUri : segment.resolvedUri,
  107041. byterange: part ? part.byterange : segment.byterange,
  107042. requestId: segmentInfo.requestId,
  107043. transmuxer: segmentInfo.transmuxer,
  107044. audioAppendStart: segmentInfo.audioAppendStart,
  107045. gopsToAlignWith: segmentInfo.gopsToAlignWith,
  107046. part: segmentInfo.part
  107047. };
  107048. var previousSegment = segmentInfo.playlist.segments[segmentInfo.mediaIndex - 1];
  107049. if (previousSegment && previousSegment.timeline === segment.timeline) {
  107050. if (previousSegment.videoTimingInfo) {
  107051. simpleSegment.baseStartTime = previousSegment.videoTimingInfo.transmuxedDecodeEnd;
  107052. } else if (previousSegment.audioTimingInfo) {
  107053. simpleSegment.baseStartTime = previousSegment.audioTimingInfo.transmuxedDecodeEnd;
  107054. }
  107055. }
  107056. if (segment.key) {
  107057. var iv = segment.key.iv || new Uint32Array([0, 0, 0, segmentInfo.mediaIndex + segmentInfo.playlist.mediaSequence]);
  107058. simpleSegment.key = this.segmentKey(segment.key);
  107059. simpleSegment.key.iv = iv;
  107060. }
  107061. if (segment.map) {
  107062. simpleSegment.map = this.initSegmentForMap(segment.map);
  107063. }
  107064. return simpleSegment;
  107065. };
  107066. _proto.saveTransferStats_ = function saveTransferStats_(stats) {
  107067. this.mediaRequests += 1;
  107068. if (stats) {
  107069. this.mediaBytesTransferred += stats.bytesReceived;
  107070. this.mediaTransferDuration += stats.roundTripTime;
  107071. }
  107072. };
  107073. _proto.saveBandwidthRelatedStats_ = function saveBandwidthRelatedStats_(duration5, stats) {
  107074. this.pendingSegment_.byteLength = stats.bytesReceived;
  107075. if (duration5 < MIN_SEGMENT_DURATION_TO_SAVE_STATS) {
  107076. this.logger_("Ignoring segment's bandwidth because its duration of " + duration5 + (" is less than the min to record " + MIN_SEGMENT_DURATION_TO_SAVE_STATS));
  107077. return;
  107078. }
  107079. this.bandwidth = stats.bandwidth;
  107080. this.roundTrip = stats.roundTripTime;
  107081. };
  107082. _proto.handleTimeout_ = function handleTimeout_() {
  107083. this.mediaRequestsTimedout += 1;
  107084. this.bandwidth = 1;
  107085. this.roundTrip = NaN;
  107086. this.trigger("bandwidthupdate");
  107087. this.trigger("timeout");
  107088. };
  107089. _proto.segmentRequestFinished_ = function segmentRequestFinished_(error, simpleSegment, result) {
  107090. if (this.callQueue_.length) {
  107091. this.callQueue_.push(this.segmentRequestFinished_.bind(this, error, simpleSegment, result));
  107092. return;
  107093. }
  107094. this.saveTransferStats_(simpleSegment.stats);
  107095. if (!this.pendingSegment_) {
  107096. return;
  107097. }
  107098. if (simpleSegment.requestId !== this.pendingSegment_.requestId) {
  107099. return;
  107100. }
  107101. if (error) {
  107102. this.pendingSegment_ = null;
  107103. this.state = "READY";
  107104. if (error.code === REQUEST_ERRORS.ABORTED) {
  107105. return;
  107106. }
  107107. this.pause();
  107108. if (error.code === REQUEST_ERRORS.TIMEOUT) {
  107109. this.handleTimeout_();
  107110. return;
  107111. }
  107112. this.mediaRequestsErrored += 1;
  107113. this.error(error);
  107114. this.trigger("error");
  107115. return;
  107116. }
  107117. var segmentInfo = this.pendingSegment_;
  107118. this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats);
  107119. segmentInfo.endOfAllRequests = simpleSegment.endOfAllRequests;
  107120. if (result.gopInfo) {
  107121. this.gopBuffer_ = updateGopBuffer(this.gopBuffer_, result.gopInfo, this.safeAppend_);
  107122. }
  107123. this.state = "APPENDING";
  107124. this.trigger("appending");
  107125. this.waitForAppendsToComplete_(segmentInfo);
  107126. };
  107127. _proto.setTimeMapping_ = function setTimeMapping_(timeline) {
  107128. var timelineMapping = this.syncController_.mappingForTimeline(timeline);
  107129. if (timelineMapping !== null) {
  107130. this.timeMapping_ = timelineMapping;
  107131. }
  107132. };
  107133. _proto.updateMediaSecondsLoaded_ = function updateMediaSecondsLoaded_(segment) {
  107134. if (typeof segment.start === "number" && typeof segment.end === "number") {
  107135. this.mediaSecondsLoaded += segment.end - segment.start;
  107136. } else {
  107137. this.mediaSecondsLoaded += segment.duration;
  107138. }
  107139. };
  107140. _proto.shouldUpdateTransmuxerTimestampOffset_ = function shouldUpdateTransmuxerTimestampOffset_(timestampOffset2) {
  107141. if (timestampOffset2 === null) {
  107142. return false;
  107143. }
  107144. if (this.loaderType_ === "main" && timestampOffset2 !== this.sourceUpdater_.videoTimestampOffset()) {
  107145. return true;
  107146. }
  107147. if (!this.audioDisabled_ && timestampOffset2 !== this.sourceUpdater_.audioTimestampOffset()) {
  107148. return true;
  107149. }
  107150. return false;
  107151. };
  107152. _proto.trueSegmentStart_ = function trueSegmentStart_(_ref9) {
  107153. var currentStart = _ref9.currentStart, playlist = _ref9.playlist, mediaIndex = _ref9.mediaIndex, firstVideoFrameTimeForData = _ref9.firstVideoFrameTimeForData, currentVideoTimestampOffset = _ref9.currentVideoTimestampOffset, useVideoTimingInfo = _ref9.useVideoTimingInfo, videoTimingInfo = _ref9.videoTimingInfo, audioTimingInfo = _ref9.audioTimingInfo;
  107154. if (typeof currentStart !== "undefined") {
  107155. return currentStart;
  107156. }
  107157. if (!useVideoTimingInfo) {
  107158. return audioTimingInfo.start;
  107159. }
  107160. var previousSegment = playlist.segments[mediaIndex - 1];
  107161. if (mediaIndex === 0 || !previousSegment || typeof previousSegment.start === "undefined" || previousSegment.end !== firstVideoFrameTimeForData + currentVideoTimestampOffset) {
  107162. return firstVideoFrameTimeForData;
  107163. }
  107164. return videoTimingInfo.start;
  107165. };
  107166. _proto.waitForAppendsToComplete_ = function waitForAppendsToComplete_(segmentInfo) {
  107167. var trackInfo = this.getCurrentMediaInfo_(segmentInfo);
  107168. if (!trackInfo) {
  107169. this.error({
  107170. message: "No starting media returned, likely due to an unsupported media format.",
  107171. blacklistDuration: Infinity
  107172. });
  107173. this.trigger("error");
  107174. return;
  107175. }
  107176. var hasAudio = trackInfo.hasAudio, hasVideo = trackInfo.hasVideo, isMuxed3 = trackInfo.isMuxed;
  107177. var waitForVideo = this.loaderType_ === "main" && hasVideo;
  107178. var waitForAudio = !this.audioDisabled_ && hasAudio && !isMuxed3;
  107179. segmentInfo.waitingOnAppends = 0;
  107180. if (!segmentInfo.hasAppendedData_) {
  107181. if (!segmentInfo.timingInfo && typeof segmentInfo.timestampOffset === "number") {
  107182. this.isPendingTimestampOffset_ = true;
  107183. }
  107184. segmentInfo.timingInfo = {
  107185. start: 0
  107186. };
  107187. segmentInfo.waitingOnAppends++;
  107188. if (!this.isPendingTimestampOffset_) {
  107189. this.updateSourceBufferTimestampOffset_(segmentInfo);
  107190. this.processMetadataQueue_();
  107191. }
  107192. this.checkAppendsDone_(segmentInfo);
  107193. return;
  107194. }
  107195. if (waitForVideo) {
  107196. segmentInfo.waitingOnAppends++;
  107197. }
  107198. if (waitForAudio) {
  107199. segmentInfo.waitingOnAppends++;
  107200. }
  107201. if (waitForVideo) {
  107202. this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo));
  107203. }
  107204. if (waitForAudio) {
  107205. this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo));
  107206. }
  107207. };
  107208. _proto.checkAppendsDone_ = function checkAppendsDone_(segmentInfo) {
  107209. if (this.checkForAbort_(segmentInfo.requestId)) {
  107210. return;
  107211. }
  107212. segmentInfo.waitingOnAppends--;
  107213. if (segmentInfo.waitingOnAppends === 0) {
  107214. this.handleAppendsDone_();
  107215. }
  107216. };
  107217. _proto.checkForIllegalMediaSwitch = function checkForIllegalMediaSwitch(trackInfo) {
  107218. var illegalMediaSwitchError = illegalMediaSwitch(this.loaderType_, this.getCurrentMediaInfo_(), trackInfo);
  107219. if (illegalMediaSwitchError) {
  107220. this.error({
  107221. message: illegalMediaSwitchError,
  107222. blacklistDuration: Infinity
  107223. });
  107224. this.trigger("error");
  107225. return true;
  107226. }
  107227. return false;
  107228. };
  107229. _proto.updateSourceBufferTimestampOffset_ = function updateSourceBufferTimestampOffset_(segmentInfo) {
  107230. if (segmentInfo.timestampOffset === null || typeof segmentInfo.timingInfo.start !== "number" || segmentInfo.changedTimestampOffset || this.loaderType_ !== "main") {
  107231. return;
  107232. }
  107233. var didChange = false;
  107234. segmentInfo.timestampOffset -= this.getSegmentStartTimeForTimestampOffsetCalculation_({
  107235. videoTimingInfo: segmentInfo.segment.videoTimingInfo,
  107236. audioTimingInfo: segmentInfo.segment.audioTimingInfo,
  107237. timingInfo: segmentInfo.timingInfo
  107238. });
  107239. segmentInfo.changedTimestampOffset = true;
  107240. if (segmentInfo.timestampOffset !== this.sourceUpdater_.videoTimestampOffset()) {
  107241. this.sourceUpdater_.videoTimestampOffset(segmentInfo.timestampOffset);
  107242. didChange = true;
  107243. }
  107244. if (segmentInfo.timestampOffset !== this.sourceUpdater_.audioTimestampOffset()) {
  107245. this.sourceUpdater_.audioTimestampOffset(segmentInfo.timestampOffset);
  107246. didChange = true;
  107247. }
  107248. if (didChange) {
  107249. this.trigger("timestampoffset");
  107250. }
  107251. };
  107252. _proto.getSegmentStartTimeForTimestampOffsetCalculation_ = function getSegmentStartTimeForTimestampOffsetCalculation_(_ref10) {
  107253. var videoTimingInfo = _ref10.videoTimingInfo, audioTimingInfo = _ref10.audioTimingInfo, timingInfo = _ref10.timingInfo;
  107254. if (!this.useDtsForTimestampOffset_) {
  107255. return timingInfo.start;
  107256. }
  107257. if (videoTimingInfo && typeof videoTimingInfo.transmuxedDecodeStart === "number") {
  107258. return videoTimingInfo.transmuxedDecodeStart;
  107259. }
  107260. if (audioTimingInfo && typeof audioTimingInfo.transmuxedDecodeStart === "number") {
  107261. return audioTimingInfo.transmuxedDecodeStart;
  107262. }
  107263. return timingInfo.start;
  107264. };
  107265. _proto.updateTimingInfoEnd_ = function updateTimingInfoEnd_(segmentInfo) {
  107266. segmentInfo.timingInfo = segmentInfo.timingInfo || {};
  107267. var trackInfo = this.getMediaInfo_();
  107268. var useVideoTimingInfo = this.loaderType_ === "main" && trackInfo && trackInfo.hasVideo;
  107269. var prioritizedTimingInfo = useVideoTimingInfo && segmentInfo.videoTimingInfo ? segmentInfo.videoTimingInfo : segmentInfo.audioTimingInfo;
  107270. if (!prioritizedTimingInfo) {
  107271. return;
  107272. }
  107273. segmentInfo.timingInfo.end = typeof prioritizedTimingInfo.end === "number" ? prioritizedTimingInfo.end : prioritizedTimingInfo.start + segmentInfo.duration;
  107274. };
  107275. _proto.handleAppendsDone_ = function handleAppendsDone_() {
  107276. if (this.pendingSegment_) {
  107277. this.trigger("appendsdone");
  107278. }
  107279. if (!this.pendingSegment_) {
  107280. this.state = "READY";
  107281. if (!this.paused()) {
  107282. this.monitorBuffer_();
  107283. }
  107284. return;
  107285. }
  107286. var segmentInfo = this.pendingSegment_;
  107287. this.updateTimingInfoEnd_(segmentInfo);
  107288. if (this.shouldSaveSegmentTimingInfo_) {
  107289. this.syncController_.saveSegmentTimingInfo({
  107290. segmentInfo,
  107291. shouldSaveTimelineMapping: this.loaderType_ === "main"
  107292. });
  107293. }
  107294. var segmentDurationMessage = getTroublesomeSegmentDurationMessage(segmentInfo, this.sourceType_);
  107295. if (segmentDurationMessage) {
  107296. if (segmentDurationMessage.severity === "warn") {
  107297. videojs.log.warn(segmentDurationMessage.message);
  107298. } else {
  107299. this.logger_(segmentDurationMessage.message);
  107300. }
  107301. }
  107302. this.recordThroughput_(segmentInfo);
  107303. this.pendingSegment_ = null;
  107304. this.state = "READY";
  107305. if (segmentInfo.isSyncRequest) {
  107306. this.trigger("syncinfoupdate");
  107307. if (!segmentInfo.hasAppendedData_) {
  107308. this.logger_("Throwing away un-appended sync request " + segmentInfoString(segmentInfo));
  107309. return;
  107310. }
  107311. }
  107312. this.logger_("Appended " + segmentInfoString(segmentInfo));
  107313. this.addSegmentMetadataCue_(segmentInfo);
  107314. this.fetchAtBuffer_ = true;
  107315. if (this.currentTimeline_ !== segmentInfo.timeline) {
  107316. this.timelineChangeController_.lastTimelineChange({
  107317. type: this.loaderType_,
  107318. from: this.currentTimeline_,
  107319. to: segmentInfo.timeline
  107320. });
  107321. if (this.loaderType_ === "main" && !this.audioDisabled_) {
  107322. this.timelineChangeController_.lastTimelineChange({
  107323. type: "audio",
  107324. from: this.currentTimeline_,
  107325. to: segmentInfo.timeline
  107326. });
  107327. }
  107328. }
  107329. this.currentTimeline_ = segmentInfo.timeline;
  107330. this.trigger("syncinfoupdate");
  107331. var segment = segmentInfo.segment;
  107332. var part = segmentInfo.part;
  107333. var badSegmentGuess = segment.end && this.currentTime_() - segment.end > segmentInfo.playlist.targetDuration * 3;
  107334. var badPartGuess = part && part.end && this.currentTime_() - part.end > segmentInfo.playlist.partTargetDuration * 3;
  107335. if (badSegmentGuess || badPartGuess) {
  107336. this.logger_("bad " + (badSegmentGuess ? "segment" : "part") + " " + segmentInfoString(segmentInfo));
  107337. this.resetEverything();
  107338. return;
  107339. }
  107340. var isWalkingForward = this.mediaIndex !== null;
  107341. if (isWalkingForward) {
  107342. this.trigger("bandwidthupdate");
  107343. }
  107344. this.trigger("progress");
  107345. this.mediaIndex = segmentInfo.mediaIndex;
  107346. this.partIndex = segmentInfo.partIndex;
  107347. if (this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex)) {
  107348. this.endOfStream();
  107349. }
  107350. this.trigger("appended");
  107351. if (segmentInfo.hasAppendedData_) {
  107352. this.mediaAppends++;
  107353. }
  107354. if (!this.paused()) {
  107355. this.monitorBuffer_();
  107356. }
  107357. };
  107358. _proto.recordThroughput_ = function recordThroughput_(segmentInfo) {
  107359. if (segmentInfo.duration < MIN_SEGMENT_DURATION_TO_SAVE_STATS) {
  107360. this.logger_("Ignoring segment's throughput because its duration of " + segmentInfo.duration + (" is less than the min to record " + MIN_SEGMENT_DURATION_TO_SAVE_STATS));
  107361. return;
  107362. }
  107363. var rate = this.throughput.rate;
  107364. var segmentProcessingTime = Date.now() - segmentInfo.endOfAllRequests + 1;
  107365. var segmentProcessingThroughput = Math.floor(segmentInfo.byteLength / segmentProcessingTime * 8 * 1e3);
  107366. this.throughput.rate += (segmentProcessingThroughput - rate) / ++this.throughput.count;
  107367. };
  107368. _proto.addSegmentMetadataCue_ = function addSegmentMetadataCue_(segmentInfo) {
  107369. if (!this.segmentMetadataTrack_) {
  107370. return;
  107371. }
  107372. var segment = segmentInfo.segment;
  107373. var start2 = segment.start;
  107374. var end = segment.end;
  107375. if (!finite(start2) || !finite(end)) {
  107376. return;
  107377. }
  107378. removeCuesFromTrack(start2, end, this.segmentMetadataTrack_);
  107379. var Cue = window_1.WebKitDataCue || window_1.VTTCue;
  107380. var value = {
  107381. custom: segment.custom,
  107382. dateTimeObject: segment.dateTimeObject,
  107383. dateTimeString: segment.dateTimeString,
  107384. bandwidth: segmentInfo.playlist.attributes.BANDWIDTH,
  107385. resolution: segmentInfo.playlist.attributes.RESOLUTION,
  107386. codecs: segmentInfo.playlist.attributes.CODECS,
  107387. byteLength: segmentInfo.byteLength,
  107388. uri: segmentInfo.uri,
  107389. timeline: segmentInfo.timeline,
  107390. playlist: segmentInfo.playlist.id,
  107391. start: start2,
  107392. end
  107393. };
  107394. var data = JSON.stringify(value);
  107395. var cue = new Cue(start2, end, data);
  107396. cue.value = value;
  107397. this.segmentMetadataTrack_.addCue(cue);
  107398. };
  107399. return SegmentLoader2;
  107400. }(videojs.EventTarget);
  107401. function noop() {
  107402. }
  107403. var toTitleCase2 = function toTitleCase3(string) {
  107404. if (typeof string !== "string") {
  107405. return string;
  107406. }
  107407. return string.replace(/./, function(w) {
  107408. return w.toUpperCase();
  107409. });
  107410. };
  107411. var bufferTypes = ["video", "audio"];
  107412. var _updating = function updating2(type2, sourceUpdater) {
  107413. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107414. return sourceBuffer && sourceBuffer.updating || sourceUpdater.queuePending[type2];
  107415. };
  107416. var nextQueueIndexOfType = function nextQueueIndexOfType2(type2, queue) {
  107417. for (var i2 = 0; i2 < queue.length; i2++) {
  107418. var queueEntry = queue[i2];
  107419. if (queueEntry.type === "mediaSource") {
  107420. return null;
  107421. }
  107422. if (queueEntry.type === type2) {
  107423. return i2;
  107424. }
  107425. }
  107426. return null;
  107427. };
  107428. var shiftQueue = function shiftQueue2(type2, sourceUpdater) {
  107429. if (sourceUpdater.queue.length === 0) {
  107430. return;
  107431. }
  107432. var queueIndex = 0;
  107433. var queueEntry = sourceUpdater.queue[queueIndex];
  107434. if (queueEntry.type === "mediaSource") {
  107435. if (!sourceUpdater.updating() && sourceUpdater.mediaSource.readyState !== "closed") {
  107436. sourceUpdater.queue.shift();
  107437. queueEntry.action(sourceUpdater);
  107438. if (queueEntry.doneFn) {
  107439. queueEntry.doneFn();
  107440. }
  107441. shiftQueue2("audio", sourceUpdater);
  107442. shiftQueue2("video", sourceUpdater);
  107443. }
  107444. return;
  107445. }
  107446. if (type2 === "mediaSource") {
  107447. return;
  107448. }
  107449. if (!sourceUpdater.ready() || sourceUpdater.mediaSource.readyState === "closed" || _updating(type2, sourceUpdater)) {
  107450. return;
  107451. }
  107452. if (queueEntry.type !== type2) {
  107453. queueIndex = nextQueueIndexOfType(type2, sourceUpdater.queue);
  107454. if (queueIndex === null) {
  107455. return;
  107456. }
  107457. queueEntry = sourceUpdater.queue[queueIndex];
  107458. }
  107459. sourceUpdater.queue.splice(queueIndex, 1);
  107460. sourceUpdater.queuePending[type2] = queueEntry;
  107461. queueEntry.action(type2, sourceUpdater);
  107462. if (!queueEntry.doneFn) {
  107463. sourceUpdater.queuePending[type2] = null;
  107464. shiftQueue2(type2, sourceUpdater);
  107465. return;
  107466. }
  107467. };
  107468. var cleanupBuffer = function cleanupBuffer2(type2, sourceUpdater) {
  107469. var buffer = sourceUpdater[type2 + "Buffer"];
  107470. var titleType = toTitleCase2(type2);
  107471. if (!buffer) {
  107472. return;
  107473. }
  107474. buffer.removeEventListener("updateend", sourceUpdater["on" + titleType + "UpdateEnd_"]);
  107475. buffer.removeEventListener("error", sourceUpdater["on" + titleType + "Error_"]);
  107476. sourceUpdater.codecs[type2] = null;
  107477. sourceUpdater[type2 + "Buffer"] = null;
  107478. };
  107479. var inSourceBuffers = function inSourceBuffers2(mediaSource, sourceBuffer) {
  107480. return mediaSource && sourceBuffer && Array.prototype.indexOf.call(mediaSource.sourceBuffers, sourceBuffer) !== -1;
  107481. };
  107482. var actions = {
  107483. appendBuffer: function appendBuffer(bytes, segmentInfo, onError2) {
  107484. return function(type2, sourceUpdater) {
  107485. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107486. if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {
  107487. return;
  107488. }
  107489. sourceUpdater.logger_("Appending segment " + segmentInfo.mediaIndex + "'s " + bytes.length + " bytes to " + type2 + "Buffer");
  107490. try {
  107491. sourceBuffer.appendBuffer(bytes);
  107492. } catch (e) {
  107493. sourceUpdater.logger_("Error with code " + e.code + " " + (e.code === QUOTA_EXCEEDED_ERR ? "(QUOTA_EXCEEDED_ERR) " : "") + ("when appending segment " + segmentInfo.mediaIndex + " to " + type2 + "Buffer"));
  107494. sourceUpdater.queuePending[type2] = null;
  107495. onError2(e);
  107496. }
  107497. };
  107498. },
  107499. remove: function remove(start2, end) {
  107500. return function(type2, sourceUpdater) {
  107501. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107502. if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {
  107503. return;
  107504. }
  107505. sourceUpdater.logger_("Removing " + start2 + " to " + end + " from " + type2 + "Buffer");
  107506. try {
  107507. sourceBuffer.remove(start2, end);
  107508. } catch (e) {
  107509. sourceUpdater.logger_("Remove " + start2 + " to " + end + " from " + type2 + "Buffer failed");
  107510. }
  107511. };
  107512. },
  107513. timestampOffset: function timestampOffset(offset) {
  107514. return function(type2, sourceUpdater) {
  107515. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107516. if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {
  107517. return;
  107518. }
  107519. sourceUpdater.logger_("Setting " + type2 + "timestampOffset to " + offset);
  107520. sourceBuffer.timestampOffset = offset;
  107521. };
  107522. },
  107523. callback: function callback(_callback) {
  107524. return function(type2, sourceUpdater) {
  107525. _callback();
  107526. };
  107527. },
  107528. endOfStream: function endOfStream(error) {
  107529. return function(sourceUpdater) {
  107530. if (sourceUpdater.mediaSource.readyState !== "open") {
  107531. return;
  107532. }
  107533. sourceUpdater.logger_("Calling mediaSource endOfStream(" + (error || "") + ")");
  107534. try {
  107535. sourceUpdater.mediaSource.endOfStream(error);
  107536. } catch (e) {
  107537. videojs.log.warn("Failed to call media source endOfStream", e);
  107538. }
  107539. };
  107540. },
  107541. duration: function duration4(_duration) {
  107542. return function(sourceUpdater) {
  107543. sourceUpdater.logger_("Setting mediaSource duration to " + _duration);
  107544. try {
  107545. sourceUpdater.mediaSource.duration = _duration;
  107546. } catch (e) {
  107547. videojs.log.warn("Failed to set media source duration", e);
  107548. }
  107549. };
  107550. },
  107551. abort: function abort() {
  107552. return function(type2, sourceUpdater) {
  107553. if (sourceUpdater.mediaSource.readyState !== "open") {
  107554. return;
  107555. }
  107556. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107557. if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {
  107558. return;
  107559. }
  107560. sourceUpdater.logger_("calling abort on " + type2 + "Buffer");
  107561. try {
  107562. sourceBuffer.abort();
  107563. } catch (e) {
  107564. videojs.log.warn("Failed to abort on " + type2 + "Buffer", e);
  107565. }
  107566. };
  107567. },
  107568. addSourceBuffer: function addSourceBuffer(type2, codec) {
  107569. return function(sourceUpdater) {
  107570. var titleType = toTitleCase2(type2);
  107571. var mime = getMimeForCodec2(codec);
  107572. sourceUpdater.logger_("Adding " + type2 + "Buffer with codec " + codec + " to mediaSource");
  107573. var sourceBuffer = sourceUpdater.mediaSource.addSourceBuffer(mime);
  107574. sourceBuffer.addEventListener("updateend", sourceUpdater["on" + titleType + "UpdateEnd_"]);
  107575. sourceBuffer.addEventListener("error", sourceUpdater["on" + titleType + "Error_"]);
  107576. sourceUpdater.codecs[type2] = codec;
  107577. sourceUpdater[type2 + "Buffer"] = sourceBuffer;
  107578. };
  107579. },
  107580. removeSourceBuffer: function removeSourceBuffer(type2) {
  107581. return function(sourceUpdater) {
  107582. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107583. cleanupBuffer(type2, sourceUpdater);
  107584. if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {
  107585. return;
  107586. }
  107587. sourceUpdater.logger_("Removing " + type2 + "Buffer with codec " + sourceUpdater.codecs[type2] + " from mediaSource");
  107588. try {
  107589. sourceUpdater.mediaSource.removeSourceBuffer(sourceBuffer);
  107590. } catch (e) {
  107591. videojs.log.warn("Failed to removeSourceBuffer " + type2 + "Buffer", e);
  107592. }
  107593. };
  107594. },
  107595. changeType: function changeType(codec) {
  107596. return function(type2, sourceUpdater) {
  107597. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107598. var mime = getMimeForCodec2(codec);
  107599. if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {
  107600. return;
  107601. }
  107602. if (sourceUpdater.codecs[type2] === codec) {
  107603. return;
  107604. }
  107605. sourceUpdater.logger_("changing " + type2 + "Buffer codec from " + sourceUpdater.codecs[type2] + " to " + codec);
  107606. sourceBuffer.changeType(mime);
  107607. sourceUpdater.codecs[type2] = codec;
  107608. };
  107609. }
  107610. };
  107611. var pushQueue = function pushQueue2(_ref) {
  107612. var type2 = _ref.type, sourceUpdater = _ref.sourceUpdater, action = _ref.action, doneFn = _ref.doneFn, name = _ref.name;
  107613. sourceUpdater.queue.push({
  107614. type: type2,
  107615. action,
  107616. doneFn,
  107617. name
  107618. });
  107619. shiftQueue(type2, sourceUpdater);
  107620. };
  107621. var onUpdateend = function onUpdateend2(type2, sourceUpdater) {
  107622. return function(e) {
  107623. if (sourceUpdater.queuePending[type2]) {
  107624. var doneFn = sourceUpdater.queuePending[type2].doneFn;
  107625. sourceUpdater.queuePending[type2] = null;
  107626. if (doneFn) {
  107627. doneFn(sourceUpdater[type2 + "Error_"]);
  107628. }
  107629. }
  107630. shiftQueue(type2, sourceUpdater);
  107631. };
  107632. };
  107633. var SourceUpdater = /* @__PURE__ */ function(_videojs$EventTarget) {
  107634. _inheritsLoose(SourceUpdater2, _videojs$EventTarget);
  107635. function SourceUpdater2(mediaSource) {
  107636. var _this;
  107637. _this = _videojs$EventTarget.call(this) || this;
  107638. _this.mediaSource = mediaSource;
  107639. _this.sourceopenListener_ = function() {
  107640. return shiftQueue("mediaSource", _assertThisInitialized(_this));
  107641. };
  107642. _this.mediaSource.addEventListener("sourceopen", _this.sourceopenListener_);
  107643. _this.logger_ = logger("SourceUpdater");
  107644. _this.audioTimestampOffset_ = 0;
  107645. _this.videoTimestampOffset_ = 0;
  107646. _this.queue = [];
  107647. _this.queuePending = {
  107648. audio: null,
  107649. video: null
  107650. };
  107651. _this.delayedAudioAppendQueue_ = [];
  107652. _this.videoAppendQueued_ = false;
  107653. _this.codecs = {};
  107654. _this.onVideoUpdateEnd_ = onUpdateend("video", _assertThisInitialized(_this));
  107655. _this.onAudioUpdateEnd_ = onUpdateend("audio", _assertThisInitialized(_this));
  107656. _this.onVideoError_ = function(e) {
  107657. _this.videoError_ = e;
  107658. };
  107659. _this.onAudioError_ = function(e) {
  107660. _this.audioError_ = e;
  107661. };
  107662. _this.createdSourceBuffers_ = false;
  107663. _this.initializedEme_ = false;
  107664. _this.triggeredReady_ = false;
  107665. return _this;
  107666. }
  107667. var _proto = SourceUpdater2.prototype;
  107668. _proto.initializedEme = function initializedEme() {
  107669. this.initializedEme_ = true;
  107670. this.triggerReady();
  107671. };
  107672. _proto.hasCreatedSourceBuffers = function hasCreatedSourceBuffers() {
  107673. return this.createdSourceBuffers_;
  107674. };
  107675. _proto.hasInitializedAnyEme = function hasInitializedAnyEme() {
  107676. return this.initializedEme_;
  107677. };
  107678. _proto.ready = function ready() {
  107679. return this.hasCreatedSourceBuffers() && this.hasInitializedAnyEme();
  107680. };
  107681. _proto.createSourceBuffers = function createSourceBuffers(codecs) {
  107682. if (this.hasCreatedSourceBuffers()) {
  107683. return;
  107684. }
  107685. this.addOrChangeSourceBuffers(codecs);
  107686. this.createdSourceBuffers_ = true;
  107687. this.trigger("createdsourcebuffers");
  107688. this.triggerReady();
  107689. };
  107690. _proto.triggerReady = function triggerReady() {
  107691. if (this.ready() && !this.triggeredReady_) {
  107692. this.triggeredReady_ = true;
  107693. this.trigger("ready");
  107694. }
  107695. };
  107696. _proto.addSourceBuffer = function addSourceBuffer2(type2, codec) {
  107697. pushQueue({
  107698. type: "mediaSource",
  107699. sourceUpdater: this,
  107700. action: actions.addSourceBuffer(type2, codec),
  107701. name: "addSourceBuffer"
  107702. });
  107703. };
  107704. _proto.abort = function abort2(type2) {
  107705. pushQueue({
  107706. type: type2,
  107707. sourceUpdater: this,
  107708. action: actions.abort(type2),
  107709. name: "abort"
  107710. });
  107711. };
  107712. _proto.removeSourceBuffer = function removeSourceBuffer2(type2) {
  107713. if (!this.canRemoveSourceBuffer()) {
  107714. videojs.log.error("removeSourceBuffer is not supported!");
  107715. return;
  107716. }
  107717. pushQueue({
  107718. type: "mediaSource",
  107719. sourceUpdater: this,
  107720. action: actions.removeSourceBuffer(type2),
  107721. name: "removeSourceBuffer"
  107722. });
  107723. };
  107724. _proto.canRemoveSourceBuffer = function canRemoveSourceBuffer() {
  107725. return !videojs.browser.IE_VERSION && !videojs.browser.IS_FIREFOX && window_1.MediaSource && window_1.MediaSource.prototype && typeof window_1.MediaSource.prototype.removeSourceBuffer === "function";
  107726. };
  107727. SourceUpdater2.canChangeType = function canChangeType() {
  107728. return window_1.SourceBuffer && window_1.SourceBuffer.prototype && typeof window_1.SourceBuffer.prototype.changeType === "function";
  107729. };
  107730. _proto.canChangeType = function canChangeType() {
  107731. return this.constructor.canChangeType();
  107732. };
  107733. _proto.changeType = function changeType2(type2, codec) {
  107734. if (!this.canChangeType()) {
  107735. videojs.log.error("changeType is not supported!");
  107736. return;
  107737. }
  107738. pushQueue({
  107739. type: type2,
  107740. sourceUpdater: this,
  107741. action: actions.changeType(codec),
  107742. name: "changeType"
  107743. });
  107744. };
  107745. _proto.addOrChangeSourceBuffers = function addOrChangeSourceBuffers(codecs) {
  107746. var _this2 = this;
  107747. if (!codecs || typeof codecs !== "object" || Object.keys(codecs).length === 0) {
  107748. throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");
  107749. }
  107750. Object.keys(codecs).forEach(function(type2) {
  107751. var codec = codecs[type2];
  107752. if (!_this2.hasCreatedSourceBuffers()) {
  107753. return _this2.addSourceBuffer(type2, codec);
  107754. }
  107755. if (_this2.canChangeType()) {
  107756. _this2.changeType(type2, codec);
  107757. }
  107758. });
  107759. };
  107760. _proto.appendBuffer = function appendBuffer2(options2, doneFn) {
  107761. var _this3 = this;
  107762. var segmentInfo = options2.segmentInfo, type2 = options2.type, bytes = options2.bytes;
  107763. this.processedAppend_ = true;
  107764. if (type2 === "audio" && this.videoBuffer && !this.videoAppendQueued_) {
  107765. this.delayedAudioAppendQueue_.push([options2, doneFn]);
  107766. this.logger_("delayed audio append of " + bytes.length + " until video append");
  107767. return;
  107768. }
  107769. var onError2 = doneFn;
  107770. pushQueue({
  107771. type: type2,
  107772. sourceUpdater: this,
  107773. action: actions.appendBuffer(bytes, segmentInfo || {
  107774. mediaIndex: -1
  107775. }, onError2),
  107776. doneFn,
  107777. name: "appendBuffer"
  107778. });
  107779. if (type2 === "video") {
  107780. this.videoAppendQueued_ = true;
  107781. if (!this.delayedAudioAppendQueue_.length) {
  107782. return;
  107783. }
  107784. var queue = this.delayedAudioAppendQueue_.slice();
  107785. this.logger_("queuing delayed audio " + queue.length + " appendBuffers");
  107786. this.delayedAudioAppendQueue_.length = 0;
  107787. queue.forEach(function(que) {
  107788. _this3.appendBuffer.apply(_this3, que);
  107789. });
  107790. }
  107791. };
  107792. _proto.audioBuffered = function audioBuffered() {
  107793. if (!inSourceBuffers(this.mediaSource, this.audioBuffer)) {
  107794. return videojs.createTimeRange();
  107795. }
  107796. return this.audioBuffer.buffered ? this.audioBuffer.buffered : videojs.createTimeRange();
  107797. };
  107798. _proto.videoBuffered = function videoBuffered() {
  107799. if (!inSourceBuffers(this.mediaSource, this.videoBuffer)) {
  107800. return videojs.createTimeRange();
  107801. }
  107802. return this.videoBuffer.buffered ? this.videoBuffer.buffered : videojs.createTimeRange();
  107803. };
  107804. _proto.buffered = function buffered() {
  107805. var video = inSourceBuffers(this.mediaSource, this.videoBuffer) ? this.videoBuffer : null;
  107806. var audio = inSourceBuffers(this.mediaSource, this.audioBuffer) ? this.audioBuffer : null;
  107807. if (audio && !video) {
  107808. return this.audioBuffered();
  107809. }
  107810. if (video && !audio) {
  107811. return this.videoBuffered();
  107812. }
  107813. return bufferIntersection(this.audioBuffered(), this.videoBuffered());
  107814. };
  107815. _proto.setDuration = function setDuration(duration5, doneFn) {
  107816. if (doneFn === void 0) {
  107817. doneFn = noop;
  107818. }
  107819. pushQueue({
  107820. type: "mediaSource",
  107821. sourceUpdater: this,
  107822. action: actions.duration(duration5),
  107823. name: "duration",
  107824. doneFn
  107825. });
  107826. };
  107827. _proto.endOfStream = function endOfStream2(error, doneFn) {
  107828. if (error === void 0) {
  107829. error = null;
  107830. }
  107831. if (doneFn === void 0) {
  107832. doneFn = noop;
  107833. }
  107834. if (typeof error !== "string") {
  107835. error = void 0;
  107836. }
  107837. pushQueue({
  107838. type: "mediaSource",
  107839. sourceUpdater: this,
  107840. action: actions.endOfStream(error),
  107841. name: "endOfStream",
  107842. doneFn
  107843. });
  107844. };
  107845. _proto.removeAudio = function removeAudio(start2, end, done) {
  107846. if (done === void 0) {
  107847. done = noop;
  107848. }
  107849. if (!this.audioBuffered().length || this.audioBuffered().end(0) === 0) {
  107850. done();
  107851. return;
  107852. }
  107853. pushQueue({
  107854. type: "audio",
  107855. sourceUpdater: this,
  107856. action: actions.remove(start2, end),
  107857. doneFn: done,
  107858. name: "remove"
  107859. });
  107860. };
  107861. _proto.removeVideo = function removeVideo(start2, end, done) {
  107862. if (done === void 0) {
  107863. done = noop;
  107864. }
  107865. if (!this.videoBuffered().length || this.videoBuffered().end(0) === 0) {
  107866. done();
  107867. return;
  107868. }
  107869. pushQueue({
  107870. type: "video",
  107871. sourceUpdater: this,
  107872. action: actions.remove(start2, end),
  107873. doneFn: done,
  107874. name: "remove"
  107875. });
  107876. };
  107877. _proto.updating = function updating3() {
  107878. if (_updating("audio", this) || _updating("video", this)) {
  107879. return true;
  107880. }
  107881. return false;
  107882. };
  107883. _proto.audioTimestampOffset = function audioTimestampOffset(offset) {
  107884. if (typeof offset !== "undefined" && this.audioBuffer && this.audioTimestampOffset_ !== offset) {
  107885. pushQueue({
  107886. type: "audio",
  107887. sourceUpdater: this,
  107888. action: actions.timestampOffset(offset),
  107889. name: "timestampOffset"
  107890. });
  107891. this.audioTimestampOffset_ = offset;
  107892. }
  107893. return this.audioTimestampOffset_;
  107894. };
  107895. _proto.videoTimestampOffset = function videoTimestampOffset(offset) {
  107896. if (typeof offset !== "undefined" && this.videoBuffer && this.videoTimestampOffset !== offset) {
  107897. pushQueue({
  107898. type: "video",
  107899. sourceUpdater: this,
  107900. action: actions.timestampOffset(offset),
  107901. name: "timestampOffset"
  107902. });
  107903. this.videoTimestampOffset_ = offset;
  107904. }
  107905. return this.videoTimestampOffset_;
  107906. };
  107907. _proto.audioQueueCallback = function audioQueueCallback(callback2) {
  107908. if (!this.audioBuffer) {
  107909. return;
  107910. }
  107911. pushQueue({
  107912. type: "audio",
  107913. sourceUpdater: this,
  107914. action: actions.callback(callback2),
  107915. name: "callback"
  107916. });
  107917. };
  107918. _proto.videoQueueCallback = function videoQueueCallback(callback2) {
  107919. if (!this.videoBuffer) {
  107920. return;
  107921. }
  107922. pushQueue({
  107923. type: "video",
  107924. sourceUpdater: this,
  107925. action: actions.callback(callback2),
  107926. name: "callback"
  107927. });
  107928. };
  107929. _proto.dispose = function dispose() {
  107930. var _this4 = this;
  107931. this.trigger("dispose");
  107932. bufferTypes.forEach(function(type2) {
  107933. _this4.abort(type2);
  107934. if (_this4.canRemoveSourceBuffer()) {
  107935. _this4.removeSourceBuffer(type2);
  107936. } else {
  107937. _this4[type2 + "QueueCallback"](function() {
  107938. return cleanupBuffer(type2, _this4);
  107939. });
  107940. }
  107941. });
  107942. this.videoAppendQueued_ = false;
  107943. this.delayedAudioAppendQueue_.length = 0;
  107944. if (this.sourceopenListener_) {
  107945. this.mediaSource.removeEventListener("sourceopen", this.sourceopenListener_);
  107946. }
  107947. this.off();
  107948. };
  107949. return SourceUpdater2;
  107950. }(videojs.EventTarget);
  107951. var uint8ToUtf8 = function uint8ToUtf82(uintArray) {
  107952. return decodeURIComponent(escape(String.fromCharCode.apply(null, uintArray)));
  107953. };
  107954. var VTT_LINE_TERMINATORS = new Uint8Array("\n\n".split("").map(function(_char3) {
  107955. return _char3.charCodeAt(0);
  107956. }));
  107957. var NoVttJsError = /* @__PURE__ */ function(_Error) {
  107958. _inheritsLoose(NoVttJsError2, _Error);
  107959. function NoVttJsError2() {
  107960. return _Error.call(this, "Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.") || this;
  107961. }
  107962. return NoVttJsError2;
  107963. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  107964. var VTTSegmentLoader = /* @__PURE__ */ function(_SegmentLoader) {
  107965. _inheritsLoose(VTTSegmentLoader2, _SegmentLoader);
  107966. function VTTSegmentLoader2(settings, options2) {
  107967. var _this;
  107968. if (options2 === void 0) {
  107969. options2 = {};
  107970. }
  107971. _this = _SegmentLoader.call(this, settings, options2) || this;
  107972. _this.mediaSource_ = null;
  107973. _this.subtitlesTrack_ = null;
  107974. _this.loaderType_ = "subtitle";
  107975. _this.featuresNativeTextTracks_ = settings.featuresNativeTextTracks;
  107976. _this.loadVttJs = settings.loadVttJs;
  107977. _this.shouldSaveSegmentTimingInfo_ = false;
  107978. return _this;
  107979. }
  107980. var _proto = VTTSegmentLoader2.prototype;
  107981. _proto.createTransmuxer_ = function createTransmuxer_() {
  107982. return null;
  107983. };
  107984. _proto.buffered_ = function buffered_() {
  107985. if (!this.subtitlesTrack_ || !this.subtitlesTrack_.cues || !this.subtitlesTrack_.cues.length) {
  107986. return videojs.createTimeRanges();
  107987. }
  107988. var cues = this.subtitlesTrack_.cues;
  107989. var start2 = cues[0].startTime;
  107990. var end = cues[cues.length - 1].startTime;
  107991. return videojs.createTimeRanges([[start2, end]]);
  107992. };
  107993. _proto.initSegmentForMap = function initSegmentForMap(map, set4) {
  107994. if (set4 === void 0) {
  107995. set4 = false;
  107996. }
  107997. if (!map) {
  107998. return null;
  107999. }
  108000. var id = initSegmentId(map);
  108001. var storedMap = this.initSegments_[id];
  108002. if (set4 && !storedMap && map.bytes) {
  108003. var combinedByteLength = VTT_LINE_TERMINATORS.byteLength + map.bytes.byteLength;
  108004. var combinedSegment = new Uint8Array(combinedByteLength);
  108005. combinedSegment.set(map.bytes);
  108006. combinedSegment.set(VTT_LINE_TERMINATORS, map.bytes.byteLength);
  108007. this.initSegments_[id] = storedMap = {
  108008. resolvedUri: map.resolvedUri,
  108009. byterange: map.byterange,
  108010. bytes: combinedSegment
  108011. };
  108012. }
  108013. return storedMap || map;
  108014. };
  108015. _proto.couldBeginLoading_ = function couldBeginLoading_() {
  108016. return this.playlist_ && this.subtitlesTrack_ && !this.paused();
  108017. };
  108018. _proto.init_ = function init_() {
  108019. this.state = "READY";
  108020. this.resetEverything();
  108021. return this.monitorBuffer_();
  108022. };
  108023. _proto.track = function track(_track) {
  108024. if (typeof _track === "undefined") {
  108025. return this.subtitlesTrack_;
  108026. }
  108027. this.subtitlesTrack_ = _track;
  108028. if (this.state === "INIT" && this.couldBeginLoading_()) {
  108029. this.init_();
  108030. }
  108031. return this.subtitlesTrack_;
  108032. };
  108033. _proto.remove = function remove2(start2, end) {
  108034. removeCuesFromTrack(start2, end, this.subtitlesTrack_);
  108035. };
  108036. _proto.fillBuffer_ = function fillBuffer_() {
  108037. var _this2 = this;
  108038. var segmentInfo = this.chooseNextRequest_();
  108039. if (!segmentInfo) {
  108040. return;
  108041. }
  108042. if (this.syncController_.timestampOffsetForTimeline(segmentInfo.timeline) === null) {
  108043. var checkTimestampOffset = function checkTimestampOffset2() {
  108044. _this2.state = "READY";
  108045. if (!_this2.paused()) {
  108046. _this2.monitorBuffer_();
  108047. }
  108048. };
  108049. this.syncController_.one("timestampoffset", checkTimestampOffset);
  108050. this.state = "WAITING_ON_TIMELINE";
  108051. return;
  108052. }
  108053. this.loadSegment_(segmentInfo);
  108054. };
  108055. _proto.timestampOffsetForSegment_ = function timestampOffsetForSegment_() {
  108056. return null;
  108057. };
  108058. _proto.chooseNextRequest_ = function chooseNextRequest_() {
  108059. return this.skipEmptySegments_(_SegmentLoader.prototype.chooseNextRequest_.call(this));
  108060. };
  108061. _proto.skipEmptySegments_ = function skipEmptySegments_(segmentInfo) {
  108062. while (segmentInfo && segmentInfo.segment.empty) {
  108063. if (segmentInfo.mediaIndex + 1 >= segmentInfo.playlist.segments.length) {
  108064. segmentInfo = null;
  108065. break;
  108066. }
  108067. segmentInfo = this.generateSegmentInfo_({
  108068. playlist: segmentInfo.playlist,
  108069. mediaIndex: segmentInfo.mediaIndex + 1,
  108070. startOfSegment: segmentInfo.startOfSegment + segmentInfo.duration,
  108071. isSyncRequest: segmentInfo.isSyncRequest
  108072. });
  108073. }
  108074. return segmentInfo;
  108075. };
  108076. _proto.stopForError = function stopForError(error) {
  108077. this.error(error);
  108078. this.state = "READY";
  108079. this.pause();
  108080. this.trigger("error");
  108081. };
  108082. _proto.segmentRequestFinished_ = function segmentRequestFinished_(error, simpleSegment, result) {
  108083. var _this3 = this;
  108084. if (!this.subtitlesTrack_) {
  108085. this.state = "READY";
  108086. return;
  108087. }
  108088. this.saveTransferStats_(simpleSegment.stats);
  108089. if (!this.pendingSegment_) {
  108090. this.state = "READY";
  108091. this.mediaRequestsAborted += 1;
  108092. return;
  108093. }
  108094. if (error) {
  108095. if (error.code === REQUEST_ERRORS.TIMEOUT) {
  108096. this.handleTimeout_();
  108097. }
  108098. if (error.code === REQUEST_ERRORS.ABORTED) {
  108099. this.mediaRequestsAborted += 1;
  108100. } else {
  108101. this.mediaRequestsErrored += 1;
  108102. }
  108103. this.stopForError(error);
  108104. return;
  108105. }
  108106. var segmentInfo = this.pendingSegment_;
  108107. this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats);
  108108. if (simpleSegment.key) {
  108109. this.segmentKey(simpleSegment.key, true);
  108110. }
  108111. this.state = "APPENDING";
  108112. this.trigger("appending");
  108113. var segment = segmentInfo.segment;
  108114. if (segment.map) {
  108115. segment.map.bytes = simpleSegment.map.bytes;
  108116. }
  108117. segmentInfo.bytes = simpleSegment.bytes;
  108118. if (typeof window_1.WebVTT !== "function" && typeof this.loadVttJs === "function") {
  108119. this.state = "WAITING_ON_VTTJS";
  108120. this.loadVttJs().then(function() {
  108121. return _this3.segmentRequestFinished_(error, simpleSegment, result);
  108122. }, function() {
  108123. return _this3.stopForError({
  108124. message: "Error loading vtt.js"
  108125. });
  108126. });
  108127. return;
  108128. }
  108129. segment.requested = true;
  108130. try {
  108131. this.parseVTTCues_(segmentInfo);
  108132. } catch (e) {
  108133. this.stopForError({
  108134. message: e.message
  108135. });
  108136. return;
  108137. }
  108138. this.updateTimeMapping_(segmentInfo, this.syncController_.timelines[segmentInfo.timeline], this.playlist_);
  108139. if (segmentInfo.cues.length) {
  108140. segmentInfo.timingInfo = {
  108141. start: segmentInfo.cues[0].startTime,
  108142. end: segmentInfo.cues[segmentInfo.cues.length - 1].endTime
  108143. };
  108144. } else {
  108145. segmentInfo.timingInfo = {
  108146. start: segmentInfo.startOfSegment,
  108147. end: segmentInfo.startOfSegment + segmentInfo.duration
  108148. };
  108149. }
  108150. if (segmentInfo.isSyncRequest) {
  108151. this.trigger("syncinfoupdate");
  108152. this.pendingSegment_ = null;
  108153. this.state = "READY";
  108154. return;
  108155. }
  108156. segmentInfo.byteLength = segmentInfo.bytes.byteLength;
  108157. this.mediaSecondsLoaded += segment.duration;
  108158. segmentInfo.cues.forEach(function(cue) {
  108159. _this3.subtitlesTrack_.addCue(_this3.featuresNativeTextTracks_ ? new window_1.VTTCue(cue.startTime, cue.endTime, cue.text) : cue);
  108160. });
  108161. removeDuplicateCuesFromTrack(this.subtitlesTrack_);
  108162. this.handleAppendsDone_();
  108163. };
  108164. _proto.handleData_ = function handleData_3() {
  108165. };
  108166. _proto.updateTimingInfoEnd_ = function updateTimingInfoEnd_() {
  108167. };
  108168. _proto.parseVTTCues_ = function parseVTTCues_(segmentInfo) {
  108169. var decoder;
  108170. var decodeBytesToString = false;
  108171. if (typeof window_1.WebVTT !== "function") {
  108172. throw new NoVttJsError();
  108173. }
  108174. if (typeof window_1.TextDecoder === "function") {
  108175. decoder = new window_1.TextDecoder("utf8");
  108176. } else {
  108177. decoder = window_1.WebVTT.StringDecoder();
  108178. decodeBytesToString = true;
  108179. }
  108180. var parser2 = new window_1.WebVTT.Parser(window_1, window_1.vttjs, decoder);
  108181. segmentInfo.cues = [];
  108182. segmentInfo.timestampmap = {
  108183. MPEGTS: 0,
  108184. LOCAL: 0
  108185. };
  108186. parser2.oncue = segmentInfo.cues.push.bind(segmentInfo.cues);
  108187. parser2.ontimestampmap = function(map) {
  108188. segmentInfo.timestampmap = map;
  108189. };
  108190. parser2.onparsingerror = function(error) {
  108191. videojs.log.warn("Error encountered when parsing cues: " + error.message);
  108192. };
  108193. if (segmentInfo.segment.map) {
  108194. var mapData = segmentInfo.segment.map.bytes;
  108195. if (decodeBytesToString) {
  108196. mapData = uint8ToUtf8(mapData);
  108197. }
  108198. parser2.parse(mapData);
  108199. }
  108200. var segmentData = segmentInfo.bytes;
  108201. if (decodeBytesToString) {
  108202. segmentData = uint8ToUtf8(segmentData);
  108203. }
  108204. parser2.parse(segmentData);
  108205. parser2.flush();
  108206. };
  108207. _proto.updateTimeMapping_ = function updateTimeMapping_(segmentInfo, mappingObj, playlist) {
  108208. var segment = segmentInfo.segment;
  108209. if (!mappingObj) {
  108210. return;
  108211. }
  108212. if (!segmentInfo.cues.length) {
  108213. segment.empty = true;
  108214. return;
  108215. }
  108216. var timestampmap = segmentInfo.timestampmap;
  108217. var diff = timestampmap.MPEGTS / clock.ONE_SECOND_IN_TS - timestampmap.LOCAL + mappingObj.mapping;
  108218. segmentInfo.cues.forEach(function(cue) {
  108219. cue.startTime += diff;
  108220. cue.endTime += diff;
  108221. });
  108222. if (!playlist.syncInfo) {
  108223. var firstStart = segmentInfo.cues[0].startTime;
  108224. var lastStart = segmentInfo.cues[segmentInfo.cues.length - 1].startTime;
  108225. playlist.syncInfo = {
  108226. mediaSequence: playlist.mediaSequence + segmentInfo.mediaIndex,
  108227. time: Math.min(firstStart, lastStart - segment.duration)
  108228. };
  108229. }
  108230. };
  108231. return VTTSegmentLoader2;
  108232. }(SegmentLoader);
  108233. var findAdCue = function findAdCue2(track, mediaTime) {
  108234. var cues = track.cues;
  108235. for (var i2 = 0; i2 < cues.length; i2++) {
  108236. var cue = cues[i2];
  108237. if (mediaTime >= cue.adStartTime && mediaTime <= cue.adEndTime) {
  108238. return cue;
  108239. }
  108240. }
  108241. return null;
  108242. };
  108243. var updateAdCues = function updateAdCues2(media, track, offset) {
  108244. if (offset === void 0) {
  108245. offset = 0;
  108246. }
  108247. if (!media.segments) {
  108248. return;
  108249. }
  108250. var mediaTime = offset;
  108251. var cue;
  108252. for (var i2 = 0; i2 < media.segments.length; i2++) {
  108253. var segment = media.segments[i2];
  108254. if (!cue) {
  108255. cue = findAdCue(track, mediaTime + segment.duration / 2);
  108256. }
  108257. if (cue) {
  108258. if ("cueIn" in segment) {
  108259. cue.endTime = mediaTime;
  108260. cue.adEndTime = mediaTime;
  108261. mediaTime += segment.duration;
  108262. cue = null;
  108263. continue;
  108264. }
  108265. if (mediaTime < cue.endTime) {
  108266. mediaTime += segment.duration;
  108267. continue;
  108268. }
  108269. cue.endTime += segment.duration;
  108270. } else {
  108271. if ("cueOut" in segment) {
  108272. cue = new window_1.VTTCue(mediaTime, mediaTime + segment.duration, segment.cueOut);
  108273. cue.adStartTime = mediaTime;
  108274. cue.adEndTime = mediaTime + parseFloat(segment.cueOut);
  108275. track.addCue(cue);
  108276. }
  108277. if ("cueOutCont" in segment) {
  108278. var _segment$cueOutCont$s = segment.cueOutCont.split("/").map(parseFloat), adOffset = _segment$cueOutCont$s[0], adTotal = _segment$cueOutCont$s[1];
  108279. cue = new window_1.VTTCue(mediaTime, mediaTime + segment.duration, "");
  108280. cue.adStartTime = mediaTime - adOffset;
  108281. cue.adEndTime = cue.adStartTime + adTotal;
  108282. track.addCue(cue);
  108283. }
  108284. }
  108285. mediaTime += segment.duration;
  108286. }
  108287. };
  108288. var MAX_MEDIA_SEQUENCE_DIFF_FOR_SYNC = 86400;
  108289. var syncPointStrategies = [
  108290. {
  108291. name: "VOD",
  108292. run: function run(syncController, playlist, duration5, currentTimeline, currentTime) {
  108293. if (duration5 !== Infinity) {
  108294. var syncPoint = {
  108295. time: 0,
  108296. segmentIndex: 0,
  108297. partIndex: null
  108298. };
  108299. return syncPoint;
  108300. }
  108301. return null;
  108302. }
  108303. },
  108304. {
  108305. name: "ProgramDateTime",
  108306. run: function run2(syncController, playlist, duration5, currentTimeline, currentTime) {
  108307. if (!Object.keys(syncController.timelineToDatetimeMappings).length) {
  108308. return null;
  108309. }
  108310. var syncPoint = null;
  108311. var lastDistance = null;
  108312. var partsAndSegments = getPartsAndSegments(playlist);
  108313. currentTime = currentTime || 0;
  108314. for (var i2 = 0; i2 < partsAndSegments.length; i2++) {
  108315. var index2 = playlist.endList || currentTime === 0 ? i2 : partsAndSegments.length - (i2 + 1);
  108316. var partAndSegment = partsAndSegments[index2];
  108317. var segment = partAndSegment.segment;
  108318. var datetimeMapping = syncController.timelineToDatetimeMappings[segment.timeline];
  108319. if (!datetimeMapping || !segment.dateTimeObject) {
  108320. continue;
  108321. }
  108322. var segmentTime = segment.dateTimeObject.getTime() / 1e3;
  108323. var start2 = segmentTime + datetimeMapping;
  108324. if (segment.parts && typeof partAndSegment.partIndex === "number") {
  108325. for (var z = 0; z < partAndSegment.partIndex; z++) {
  108326. start2 += segment.parts[z].duration;
  108327. }
  108328. }
  108329. var distance2 = Math.abs(currentTime - start2);
  108330. if (lastDistance !== null && (distance2 === 0 || lastDistance < distance2)) {
  108331. break;
  108332. }
  108333. lastDistance = distance2;
  108334. syncPoint = {
  108335. time: start2,
  108336. segmentIndex: partAndSegment.segmentIndex,
  108337. partIndex: partAndSegment.partIndex
  108338. };
  108339. }
  108340. return syncPoint;
  108341. }
  108342. },
  108343. {
  108344. name: "Segment",
  108345. run: function run3(syncController, playlist, duration5, currentTimeline, currentTime) {
  108346. var syncPoint = null;
  108347. var lastDistance = null;
  108348. currentTime = currentTime || 0;
  108349. var partsAndSegments = getPartsAndSegments(playlist);
  108350. for (var i2 = 0; i2 < partsAndSegments.length; i2++) {
  108351. var index2 = playlist.endList || currentTime === 0 ? i2 : partsAndSegments.length - (i2 + 1);
  108352. var partAndSegment = partsAndSegments[index2];
  108353. var segment = partAndSegment.segment;
  108354. var start2 = partAndSegment.part && partAndSegment.part.start || segment && segment.start;
  108355. if (segment.timeline === currentTimeline && typeof start2 !== "undefined") {
  108356. var distance2 = Math.abs(currentTime - start2);
  108357. if (lastDistance !== null && lastDistance < distance2) {
  108358. break;
  108359. }
  108360. if (!syncPoint || lastDistance === null || lastDistance >= distance2) {
  108361. lastDistance = distance2;
  108362. syncPoint = {
  108363. time: start2,
  108364. segmentIndex: partAndSegment.segmentIndex,
  108365. partIndex: partAndSegment.partIndex
  108366. };
  108367. }
  108368. }
  108369. }
  108370. return syncPoint;
  108371. }
  108372. },
  108373. {
  108374. name: "Discontinuity",
  108375. run: function run4(syncController, playlist, duration5, currentTimeline, currentTime) {
  108376. var syncPoint = null;
  108377. currentTime = currentTime || 0;
  108378. if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) {
  108379. var lastDistance = null;
  108380. for (var i2 = 0; i2 < playlist.discontinuityStarts.length; i2++) {
  108381. var segmentIndex = playlist.discontinuityStarts[i2];
  108382. var discontinuity = playlist.discontinuitySequence + i2 + 1;
  108383. var discontinuitySync = syncController.discontinuities[discontinuity];
  108384. if (discontinuitySync) {
  108385. var distance2 = Math.abs(currentTime - discontinuitySync.time);
  108386. if (lastDistance !== null && lastDistance < distance2) {
  108387. break;
  108388. }
  108389. if (!syncPoint || lastDistance === null || lastDistance >= distance2) {
  108390. lastDistance = distance2;
  108391. syncPoint = {
  108392. time: discontinuitySync.time,
  108393. segmentIndex,
  108394. partIndex: null
  108395. };
  108396. }
  108397. }
  108398. }
  108399. }
  108400. return syncPoint;
  108401. }
  108402. },
  108403. {
  108404. name: "Playlist",
  108405. run: function run5(syncController, playlist, duration5, currentTimeline, currentTime) {
  108406. if (playlist.syncInfo) {
  108407. var syncPoint = {
  108408. time: playlist.syncInfo.time,
  108409. segmentIndex: playlist.syncInfo.mediaSequence - playlist.mediaSequence,
  108410. partIndex: null
  108411. };
  108412. return syncPoint;
  108413. }
  108414. return null;
  108415. }
  108416. }
  108417. ];
  108418. var SyncController = /* @__PURE__ */ function(_videojs$EventTarget) {
  108419. _inheritsLoose(SyncController2, _videojs$EventTarget);
  108420. function SyncController2(options2) {
  108421. var _this;
  108422. _this = _videojs$EventTarget.call(this) || this;
  108423. _this.timelines = [];
  108424. _this.discontinuities = [];
  108425. _this.timelineToDatetimeMappings = {};
  108426. _this.logger_ = logger("SyncController");
  108427. return _this;
  108428. }
  108429. var _proto = SyncController2.prototype;
  108430. _proto.getSyncPoint = function getSyncPoint(playlist, duration5, currentTimeline, currentTime) {
  108431. var syncPoints = this.runStrategies_(playlist, duration5, currentTimeline, currentTime);
  108432. if (!syncPoints.length) {
  108433. return null;
  108434. }
  108435. return this.selectSyncPoint_(syncPoints, {
  108436. key: "time",
  108437. value: currentTime
  108438. });
  108439. };
  108440. _proto.getExpiredTime = function getExpiredTime(playlist, duration5) {
  108441. if (!playlist || !playlist.segments) {
  108442. return null;
  108443. }
  108444. var syncPoints = this.runStrategies_(playlist, duration5, playlist.discontinuitySequence, 0);
  108445. if (!syncPoints.length) {
  108446. return null;
  108447. }
  108448. var syncPoint = this.selectSyncPoint_(syncPoints, {
  108449. key: "segmentIndex",
  108450. value: 0
  108451. });
  108452. if (syncPoint.segmentIndex > 0) {
  108453. syncPoint.time *= -1;
  108454. }
  108455. return Math.abs(syncPoint.time + sumDurations({
  108456. defaultDuration: playlist.targetDuration,
  108457. durationList: playlist.segments,
  108458. startIndex: syncPoint.segmentIndex,
  108459. endIndex: 0
  108460. }));
  108461. };
  108462. _proto.runStrategies_ = function runStrategies_(playlist, duration5, currentTimeline, currentTime) {
  108463. var syncPoints = [];
  108464. for (var i2 = 0; i2 < syncPointStrategies.length; i2++) {
  108465. var strategy = syncPointStrategies[i2];
  108466. var syncPoint = strategy.run(this, playlist, duration5, currentTimeline, currentTime);
  108467. if (syncPoint) {
  108468. syncPoint.strategy = strategy.name;
  108469. syncPoints.push({
  108470. strategy: strategy.name,
  108471. syncPoint
  108472. });
  108473. }
  108474. }
  108475. return syncPoints;
  108476. };
  108477. _proto.selectSyncPoint_ = function selectSyncPoint_(syncPoints, target) {
  108478. var bestSyncPoint = syncPoints[0].syncPoint;
  108479. var bestDistance = Math.abs(syncPoints[0].syncPoint[target.key] - target.value);
  108480. var bestStrategy = syncPoints[0].strategy;
  108481. for (var i2 = 1; i2 < syncPoints.length; i2++) {
  108482. var newDistance = Math.abs(syncPoints[i2].syncPoint[target.key] - target.value);
  108483. if (newDistance < bestDistance) {
  108484. bestDistance = newDistance;
  108485. bestSyncPoint = syncPoints[i2].syncPoint;
  108486. bestStrategy = syncPoints[i2].strategy;
  108487. }
  108488. }
  108489. this.logger_("syncPoint for [" + target.key + ": " + target.value + "] chosen with strategy" + (" [" + bestStrategy + "]: [time:" + bestSyncPoint.time + ",") + (" segmentIndex:" + bestSyncPoint.segmentIndex) + (typeof bestSyncPoint.partIndex === "number" ? ",partIndex:" + bestSyncPoint.partIndex : "") + "]");
  108490. return bestSyncPoint;
  108491. };
  108492. _proto.saveExpiredSegmentInfo = function saveExpiredSegmentInfo(oldPlaylist, newPlaylist) {
  108493. var mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence;
  108494. if (mediaSequenceDiff > MAX_MEDIA_SEQUENCE_DIFF_FOR_SYNC) {
  108495. videojs.log.warn("Not saving expired segment info. Media sequence gap " + mediaSequenceDiff + " is too large.");
  108496. return;
  108497. }
  108498. for (var i2 = mediaSequenceDiff - 1; i2 >= 0; i2--) {
  108499. var lastRemovedSegment = oldPlaylist.segments[i2];
  108500. if (lastRemovedSegment && typeof lastRemovedSegment.start !== "undefined") {
  108501. newPlaylist.syncInfo = {
  108502. mediaSequence: oldPlaylist.mediaSequence + i2,
  108503. time: lastRemovedSegment.start
  108504. };
  108505. this.logger_("playlist refresh sync: [time:" + newPlaylist.syncInfo.time + "," + (" mediaSequence: " + newPlaylist.syncInfo.mediaSequence + "]"));
  108506. this.trigger("syncinfoupdate");
  108507. break;
  108508. }
  108509. }
  108510. };
  108511. _proto.setDateTimeMappingForStart = function setDateTimeMappingForStart(playlist) {
  108512. this.timelineToDatetimeMappings = {};
  108513. if (playlist.segments && playlist.segments.length && playlist.segments[0].dateTimeObject) {
  108514. var firstSegment = playlist.segments[0];
  108515. var playlistTimestamp = firstSegment.dateTimeObject.getTime() / 1e3;
  108516. this.timelineToDatetimeMappings[firstSegment.timeline] = -playlistTimestamp;
  108517. }
  108518. };
  108519. _proto.saveSegmentTimingInfo = function saveSegmentTimingInfo(_ref) {
  108520. var segmentInfo = _ref.segmentInfo, shouldSaveTimelineMapping = _ref.shouldSaveTimelineMapping;
  108521. var didCalculateSegmentTimeMapping = this.calculateSegmentTimeMapping_(segmentInfo, segmentInfo.timingInfo, shouldSaveTimelineMapping);
  108522. var segment = segmentInfo.segment;
  108523. if (didCalculateSegmentTimeMapping) {
  108524. this.saveDiscontinuitySyncInfo_(segmentInfo);
  108525. if (!segmentInfo.playlist.syncInfo) {
  108526. segmentInfo.playlist.syncInfo = {
  108527. mediaSequence: segmentInfo.playlist.mediaSequence + segmentInfo.mediaIndex,
  108528. time: segment.start
  108529. };
  108530. }
  108531. }
  108532. var dateTime = segment.dateTimeObject;
  108533. if (segment.discontinuity && shouldSaveTimelineMapping && dateTime) {
  108534. this.timelineToDatetimeMappings[segment.timeline] = -(dateTime.getTime() / 1e3);
  108535. }
  108536. };
  108537. _proto.timestampOffsetForTimeline = function timestampOffsetForTimeline(timeline) {
  108538. if (typeof this.timelines[timeline] === "undefined") {
  108539. return null;
  108540. }
  108541. return this.timelines[timeline].time;
  108542. };
  108543. _proto.mappingForTimeline = function mappingForTimeline(timeline) {
  108544. if (typeof this.timelines[timeline] === "undefined") {
  108545. return null;
  108546. }
  108547. return this.timelines[timeline].mapping;
  108548. };
  108549. _proto.calculateSegmentTimeMapping_ = function calculateSegmentTimeMapping_(segmentInfo, timingInfo, shouldSaveTimelineMapping) {
  108550. var segment = segmentInfo.segment;
  108551. var part = segmentInfo.part;
  108552. var mappingObj = this.timelines[segmentInfo.timeline];
  108553. var start2;
  108554. var end;
  108555. if (typeof segmentInfo.timestampOffset === "number") {
  108556. mappingObj = {
  108557. time: segmentInfo.startOfSegment,
  108558. mapping: segmentInfo.startOfSegment - timingInfo.start
  108559. };
  108560. if (shouldSaveTimelineMapping) {
  108561. this.timelines[segmentInfo.timeline] = mappingObj;
  108562. this.trigger("timestampoffset");
  108563. this.logger_("time mapping for timeline " + segmentInfo.timeline + ": " + ("[time: " + mappingObj.time + "] [mapping: " + mappingObj.mapping + "]"));
  108564. }
  108565. start2 = segmentInfo.startOfSegment;
  108566. end = timingInfo.end + mappingObj.mapping;
  108567. } else if (mappingObj) {
  108568. start2 = timingInfo.start + mappingObj.mapping;
  108569. end = timingInfo.end + mappingObj.mapping;
  108570. } else {
  108571. return false;
  108572. }
  108573. if (part) {
  108574. part.start = start2;
  108575. part.end = end;
  108576. }
  108577. if (!segment.start || start2 < segment.start) {
  108578. segment.start = start2;
  108579. }
  108580. segment.end = end;
  108581. return true;
  108582. };
  108583. _proto.saveDiscontinuitySyncInfo_ = function saveDiscontinuitySyncInfo_(segmentInfo) {
  108584. var playlist = segmentInfo.playlist;
  108585. var segment = segmentInfo.segment;
  108586. if (segment.discontinuity) {
  108587. this.discontinuities[segment.timeline] = {
  108588. time: segment.start,
  108589. accuracy: 0
  108590. };
  108591. } else if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) {
  108592. for (var i2 = 0; i2 < playlist.discontinuityStarts.length; i2++) {
  108593. var segmentIndex = playlist.discontinuityStarts[i2];
  108594. var discontinuity = playlist.discontinuitySequence + i2 + 1;
  108595. var mediaIndexDiff = segmentIndex - segmentInfo.mediaIndex;
  108596. var accuracy = Math.abs(mediaIndexDiff);
  108597. if (!this.discontinuities[discontinuity] || this.discontinuities[discontinuity].accuracy > accuracy) {
  108598. var time = void 0;
  108599. if (mediaIndexDiff < 0) {
  108600. time = segment.start - sumDurations({
  108601. defaultDuration: playlist.targetDuration,
  108602. durationList: playlist.segments,
  108603. startIndex: segmentInfo.mediaIndex,
  108604. endIndex: segmentIndex
  108605. });
  108606. } else {
  108607. time = segment.end + sumDurations({
  108608. defaultDuration: playlist.targetDuration,
  108609. durationList: playlist.segments,
  108610. startIndex: segmentInfo.mediaIndex + 1,
  108611. endIndex: segmentIndex
  108612. });
  108613. }
  108614. this.discontinuities[discontinuity] = {
  108615. time,
  108616. accuracy
  108617. };
  108618. }
  108619. }
  108620. }
  108621. };
  108622. _proto.dispose = function dispose() {
  108623. this.trigger("dispose");
  108624. this.off();
  108625. };
  108626. return SyncController2;
  108627. }(videojs.EventTarget);
  108628. var TimelineChangeController = /* @__PURE__ */ function(_videojs$EventTarget) {
  108629. _inheritsLoose(TimelineChangeController2, _videojs$EventTarget);
  108630. function TimelineChangeController2() {
  108631. var _this;
  108632. _this = _videojs$EventTarget.call(this) || this;
  108633. _this.pendingTimelineChanges_ = {};
  108634. _this.lastTimelineChanges_ = {};
  108635. return _this;
  108636. }
  108637. var _proto = TimelineChangeController2.prototype;
  108638. _proto.clearPendingTimelineChange = function clearPendingTimelineChange(type2) {
  108639. this.pendingTimelineChanges_[type2] = null;
  108640. this.trigger("pendingtimelinechange");
  108641. };
  108642. _proto.pendingTimelineChange = function pendingTimelineChange(_ref) {
  108643. var type2 = _ref.type, from3 = _ref.from, to = _ref.to;
  108644. if (typeof from3 === "number" && typeof to === "number") {
  108645. this.pendingTimelineChanges_[type2] = {
  108646. type: type2,
  108647. from: from3,
  108648. to
  108649. };
  108650. this.trigger("pendingtimelinechange");
  108651. }
  108652. return this.pendingTimelineChanges_[type2];
  108653. };
  108654. _proto.lastTimelineChange = function lastTimelineChange(_ref2) {
  108655. var type2 = _ref2.type, from3 = _ref2.from, to = _ref2.to;
  108656. if (typeof from3 === "number" && typeof to === "number") {
  108657. this.lastTimelineChanges_[type2] = {
  108658. type: type2,
  108659. from: from3,
  108660. to
  108661. };
  108662. delete this.pendingTimelineChanges_[type2];
  108663. this.trigger("timelinechange");
  108664. }
  108665. return this.lastTimelineChanges_[type2];
  108666. };
  108667. _proto.dispose = function dispose() {
  108668. this.trigger("dispose");
  108669. this.pendingTimelineChanges_ = {};
  108670. this.lastTimelineChanges_ = {};
  108671. this.off();
  108672. };
  108673. return TimelineChangeController2;
  108674. }(videojs.EventTarget);
  108675. var workerCode = transform(getWorkerString(function() {
  108676. var commonjsGlobal2 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  108677. function createCommonjsModule(fn2, basedir, module2) {
  108678. return module2 = {
  108679. path: basedir,
  108680. exports: {},
  108681. require: function require2(path, base2) {
  108682. return commonjsRequire(path, base2 === void 0 || base2 === null ? module2.path : base2);
  108683. }
  108684. }, fn2(module2, module2.exports), module2.exports;
  108685. }
  108686. function commonjsRequire() {
  108687. throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");
  108688. }
  108689. var createClass = createCommonjsModule(function(module2) {
  108690. function _defineProperties(target, props) {
  108691. for (var i2 = 0; i2 < props.length; i2++) {
  108692. var descriptor = props[i2];
  108693. descriptor.enumerable = descriptor.enumerable || false;
  108694. descriptor.configurable = true;
  108695. if ("value" in descriptor)
  108696. descriptor.writable = true;
  108697. Object.defineProperty(target, descriptor.key, descriptor);
  108698. }
  108699. }
  108700. function _createClass(Constructor, protoProps, staticProps) {
  108701. if (protoProps)
  108702. _defineProperties(Constructor.prototype, protoProps);
  108703. if (staticProps)
  108704. _defineProperties(Constructor, staticProps);
  108705. return Constructor;
  108706. }
  108707. module2.exports = _createClass;
  108708. module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
  108709. });
  108710. var setPrototypeOf = createCommonjsModule(function(module2) {
  108711. function _setPrototypeOf2(o, p) {
  108712. module2.exports = _setPrototypeOf2 = Object.setPrototypeOf || function _setPrototypeOf3(o2, p2) {
  108713. o2.__proto__ = p2;
  108714. return o2;
  108715. };
  108716. module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
  108717. return _setPrototypeOf2(o, p);
  108718. }
  108719. module2.exports = _setPrototypeOf2;
  108720. module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
  108721. });
  108722. var inheritsLoose = createCommonjsModule(function(module2) {
  108723. function _inheritsLoose2(subClass, superClass) {
  108724. subClass.prototype = Object.create(superClass.prototype);
  108725. subClass.prototype.constructor = subClass;
  108726. setPrototypeOf(subClass, superClass);
  108727. }
  108728. module2.exports = _inheritsLoose2;
  108729. module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
  108730. });
  108731. var Stream2 = /* @__PURE__ */ function() {
  108732. function Stream3() {
  108733. this.listeners = {};
  108734. }
  108735. var _proto = Stream3.prototype;
  108736. _proto.on = function on3(type2, listener) {
  108737. if (!this.listeners[type2]) {
  108738. this.listeners[type2] = [];
  108739. }
  108740. this.listeners[type2].push(listener);
  108741. };
  108742. _proto.off = function off2(type2, listener) {
  108743. if (!this.listeners[type2]) {
  108744. return false;
  108745. }
  108746. var index2 = this.listeners[type2].indexOf(listener);
  108747. this.listeners[type2] = this.listeners[type2].slice(0);
  108748. this.listeners[type2].splice(index2, 1);
  108749. return index2 > -1;
  108750. };
  108751. _proto.trigger = function trigger2(type2) {
  108752. var callbacks = this.listeners[type2];
  108753. if (!callbacks) {
  108754. return;
  108755. }
  108756. if (arguments.length === 2) {
  108757. var length = callbacks.length;
  108758. for (var i2 = 0; i2 < length; ++i2) {
  108759. callbacks[i2].call(this, arguments[1]);
  108760. }
  108761. } else {
  108762. var args = Array.prototype.slice.call(arguments, 1);
  108763. var _length = callbacks.length;
  108764. for (var _i = 0; _i < _length; ++_i) {
  108765. callbacks[_i].apply(this, args);
  108766. }
  108767. }
  108768. };
  108769. _proto.dispose = function dispose() {
  108770. this.listeners = {};
  108771. };
  108772. _proto.pipe = function pipe(destination2) {
  108773. this.on("data", function(data) {
  108774. destination2.push(data);
  108775. });
  108776. };
  108777. return Stream3;
  108778. }();
  108779. /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */
  108780. function unpad(padded) {
  108781. return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]);
  108782. }
  108783. /*! @name aes-decrypter @version 3.1.3 @license Apache-2.0 */
  108784. var precompute = function precompute2() {
  108785. var tables = [[[], [], [], [], []], [[], [], [], [], []]];
  108786. var encTable = tables[0];
  108787. var decTable = tables[1];
  108788. var sbox = encTable[4];
  108789. var sboxInv = decTable[4];
  108790. var i2;
  108791. var x;
  108792. var xInv;
  108793. var d2 = [];
  108794. var th = [];
  108795. var x2;
  108796. var x4;
  108797. var x8;
  108798. var s;
  108799. var tEnc;
  108800. var tDec;
  108801. for (i2 = 0; i2 < 256; i2++) {
  108802. th[(d2[i2] = i2 << 1 ^ (i2 >> 7) * 283) ^ i2] = i2;
  108803. }
  108804. for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) {
  108805. s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4;
  108806. s = s >> 8 ^ s & 255 ^ 99;
  108807. sbox[x] = s;
  108808. sboxInv[s] = x;
  108809. x8 = d2[x4 = d2[x2 = d2[x]]];
  108810. tDec = x8 * 16843009 ^ x4 * 65537 ^ x2 * 257 ^ x * 16843008;
  108811. tEnc = d2[s] * 257 ^ s * 16843008;
  108812. for (i2 = 0; i2 < 4; i2++) {
  108813. encTable[i2][x] = tEnc = tEnc << 24 ^ tEnc >>> 8;
  108814. decTable[i2][s] = tDec = tDec << 24 ^ tDec >>> 8;
  108815. }
  108816. }
  108817. for (i2 = 0; i2 < 5; i2++) {
  108818. encTable[i2] = encTable[i2].slice(0);
  108819. decTable[i2] = decTable[i2].slice(0);
  108820. }
  108821. return tables;
  108822. };
  108823. var aesTables = null;
  108824. var AES = /* @__PURE__ */ function() {
  108825. function AES2(key) {
  108826. if (!aesTables) {
  108827. aesTables = precompute();
  108828. }
  108829. this._tables = [[aesTables[0][0].slice(), aesTables[0][1].slice(), aesTables[0][2].slice(), aesTables[0][3].slice(), aesTables[0][4].slice()], [aesTables[1][0].slice(), aesTables[1][1].slice(), aesTables[1][2].slice(), aesTables[1][3].slice(), aesTables[1][4].slice()]];
  108830. var i2;
  108831. var j;
  108832. var tmp;
  108833. var sbox = this._tables[0][4];
  108834. var decTable = this._tables[1];
  108835. var keyLen = key.length;
  108836. var rcon = 1;
  108837. if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) {
  108838. throw new Error("Invalid aes key size");
  108839. }
  108840. var encKey = key.slice(0);
  108841. var decKey = [];
  108842. this._key = [encKey, decKey];
  108843. for (i2 = keyLen; i2 < 4 * keyLen + 28; i2++) {
  108844. tmp = encKey[i2 - 1];
  108845. if (i2 % keyLen === 0 || keyLen === 8 && i2 % keyLen === 4) {
  108846. tmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255];
  108847. if (i2 % keyLen === 0) {
  108848. tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24;
  108849. rcon = rcon << 1 ^ (rcon >> 7) * 283;
  108850. }
  108851. }
  108852. encKey[i2] = encKey[i2 - keyLen] ^ tmp;
  108853. }
  108854. for (j = 0; i2; j++, i2--) {
  108855. tmp = encKey[j & 3 ? i2 : i2 - 4];
  108856. if (i2 <= 4 || j < 4) {
  108857. decKey[j] = tmp;
  108858. } else {
  108859. decKey[j] = decTable[0][sbox[tmp >>> 24]] ^ decTable[1][sbox[tmp >> 16 & 255]] ^ decTable[2][sbox[tmp >> 8 & 255]] ^ decTable[3][sbox[tmp & 255]];
  108860. }
  108861. }
  108862. }
  108863. var _proto = AES2.prototype;
  108864. _proto.decrypt = function decrypt4(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) {
  108865. var key = this._key[1];
  108866. var a = encrypted0 ^ key[0];
  108867. var b = encrypted3 ^ key[1];
  108868. var c = encrypted2 ^ key[2];
  108869. var d2 = encrypted1 ^ key[3];
  108870. var a2;
  108871. var b2;
  108872. var c2;
  108873. var nInnerRounds = key.length / 4 - 2;
  108874. var i2;
  108875. var kIndex = 4;
  108876. var table = this._tables[1];
  108877. var table0 = table[0];
  108878. var table1 = table[1];
  108879. var table2 = table[2];
  108880. var table3 = table[3];
  108881. var sbox = table[4];
  108882. for (i2 = 0; i2 < nInnerRounds; i2++) {
  108883. a2 = table0[a >>> 24] ^ table1[b >> 16 & 255] ^ table2[c >> 8 & 255] ^ table3[d2 & 255] ^ key[kIndex];
  108884. b2 = table0[b >>> 24] ^ table1[c >> 16 & 255] ^ table2[d2 >> 8 & 255] ^ table3[a & 255] ^ key[kIndex + 1];
  108885. c2 = table0[c >>> 24] ^ table1[d2 >> 16 & 255] ^ table2[a >> 8 & 255] ^ table3[b & 255] ^ key[kIndex + 2];
  108886. d2 = table0[d2 >>> 24] ^ table1[a >> 16 & 255] ^ table2[b >> 8 & 255] ^ table3[c & 255] ^ key[kIndex + 3];
  108887. kIndex += 4;
  108888. a = a2;
  108889. b = b2;
  108890. c = c2;
  108891. }
  108892. for (i2 = 0; i2 < 4; i2++) {
  108893. out[(3 & -i2) + offset] = sbox[a >>> 24] << 24 ^ sbox[b >> 16 & 255] << 16 ^ sbox[c >> 8 & 255] << 8 ^ sbox[d2 & 255] ^ key[kIndex++];
  108894. a2 = a;
  108895. a = b;
  108896. b = c;
  108897. c = d2;
  108898. d2 = a2;
  108899. }
  108900. };
  108901. return AES2;
  108902. }();
  108903. var AsyncStream = /* @__PURE__ */ function(_Stream) {
  108904. inheritsLoose(AsyncStream2, _Stream);
  108905. function AsyncStream2() {
  108906. var _this;
  108907. _this = _Stream.call(this, Stream2) || this;
  108908. _this.jobs = [];
  108909. _this.delay = 1;
  108910. _this.timeout_ = null;
  108911. return _this;
  108912. }
  108913. var _proto = AsyncStream2.prototype;
  108914. _proto.processJob_ = function processJob_() {
  108915. this.jobs.shift()();
  108916. if (this.jobs.length) {
  108917. this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay);
  108918. } else {
  108919. this.timeout_ = null;
  108920. }
  108921. };
  108922. _proto.push = function push(job) {
  108923. this.jobs.push(job);
  108924. if (!this.timeout_) {
  108925. this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay);
  108926. }
  108927. };
  108928. return AsyncStream2;
  108929. }(Stream2);
  108930. var ntoh = function ntoh2(word) {
  108931. return word << 24 | (word & 65280) << 8 | (word & 16711680) >> 8 | word >>> 24;
  108932. };
  108933. var decrypt3 = function decrypt4(encrypted, key, initVector) {
  108934. var encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2);
  108935. var decipher = new AES(Array.prototype.slice.call(key));
  108936. var decrypted = new Uint8Array(encrypted.byteLength);
  108937. var decrypted32 = new Int32Array(decrypted.buffer);
  108938. var init0;
  108939. var init1;
  108940. var init2;
  108941. var init3;
  108942. var encrypted0;
  108943. var encrypted1;
  108944. var encrypted2;
  108945. var encrypted3;
  108946. var wordIx;
  108947. init0 = initVector[0];
  108948. init1 = initVector[1];
  108949. init2 = initVector[2];
  108950. init3 = initVector[3];
  108951. for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) {
  108952. encrypted0 = ntoh(encrypted32[wordIx]);
  108953. encrypted1 = ntoh(encrypted32[wordIx + 1]);
  108954. encrypted2 = ntoh(encrypted32[wordIx + 2]);
  108955. encrypted3 = ntoh(encrypted32[wordIx + 3]);
  108956. decipher.decrypt(encrypted0, encrypted1, encrypted2, encrypted3, decrypted32, wordIx);
  108957. decrypted32[wordIx] = ntoh(decrypted32[wordIx] ^ init0);
  108958. decrypted32[wordIx + 1] = ntoh(decrypted32[wordIx + 1] ^ init1);
  108959. decrypted32[wordIx + 2] = ntoh(decrypted32[wordIx + 2] ^ init2);
  108960. decrypted32[wordIx + 3] = ntoh(decrypted32[wordIx + 3] ^ init3);
  108961. init0 = encrypted0;
  108962. init1 = encrypted1;
  108963. init2 = encrypted2;
  108964. init3 = encrypted3;
  108965. }
  108966. return decrypted;
  108967. };
  108968. var Decrypter2 = /* @__PURE__ */ function() {
  108969. function Decrypter3(encrypted, key, initVector, done) {
  108970. var step = Decrypter3.STEP;
  108971. var encrypted32 = new Int32Array(encrypted.buffer);
  108972. var decrypted = new Uint8Array(encrypted.byteLength);
  108973. var i2 = 0;
  108974. this.asyncStream_ = new AsyncStream();
  108975. this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i2, i2 + step), key, initVector, decrypted));
  108976. for (i2 = step; i2 < encrypted32.length; i2 += step) {
  108977. initVector = new Uint32Array([ntoh(encrypted32[i2 - 4]), ntoh(encrypted32[i2 - 3]), ntoh(encrypted32[i2 - 2]), ntoh(encrypted32[i2 - 1])]);
  108978. this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i2, i2 + step), key, initVector, decrypted));
  108979. }
  108980. this.asyncStream_.push(function() {
  108981. done(null, unpad(decrypted));
  108982. });
  108983. }
  108984. var _proto = Decrypter3.prototype;
  108985. _proto.decryptChunk_ = function decryptChunk_(encrypted, key, initVector, decrypted) {
  108986. return function() {
  108987. var bytes = decrypt3(encrypted, key, initVector);
  108988. decrypted.set(bytes, encrypted.byteOffset);
  108989. };
  108990. };
  108991. createClass(Decrypter3, null, [{
  108992. key: "STEP",
  108993. get: function get7() {
  108994. return 32e3;
  108995. }
  108996. }]);
  108997. return Decrypter3;
  108998. }();
  108999. var win2;
  109000. if (typeof window !== "undefined") {
  109001. win2 = window;
  109002. } else if (typeof commonjsGlobal2 !== "undefined") {
  109003. win2 = commonjsGlobal2;
  109004. } else if (typeof self !== "undefined") {
  109005. win2 = self;
  109006. } else {
  109007. win2 = {};
  109008. }
  109009. var window_12 = win2;
  109010. var isArrayBufferView4 = function isArrayBufferView5(obj) {
  109011. if (ArrayBuffer.isView === "function") {
  109012. return ArrayBuffer.isView(obj);
  109013. }
  109014. return obj && obj.buffer instanceof ArrayBuffer;
  109015. };
  109016. var BigInt2 = window_12.BigInt || Number;
  109017. [BigInt2("0x1"), BigInt2("0x100"), BigInt2("0x10000"), BigInt2("0x1000000"), BigInt2("0x100000000"), BigInt2("0x10000000000"), BigInt2("0x1000000000000"), BigInt2("0x100000000000000"), BigInt2("0x10000000000000000")];
  109018. var createTransferableMessage3 = function createTransferableMessage4(message) {
  109019. var transferable = {};
  109020. Object.keys(message).forEach(function(key) {
  109021. var value = message[key];
  109022. if (isArrayBufferView4(value)) {
  109023. transferable[key] = {
  109024. bytes: value.buffer,
  109025. byteOffset: value.byteOffset,
  109026. byteLength: value.byteLength
  109027. };
  109028. } else {
  109029. transferable[key] = value;
  109030. }
  109031. });
  109032. return transferable;
  109033. };
  109034. self.onmessage = function(event2) {
  109035. var data = event2.data;
  109036. var encrypted = new Uint8Array(data.encrypted.bytes, data.encrypted.byteOffset, data.encrypted.byteLength);
  109037. var key = new Uint32Array(data.key.bytes, data.key.byteOffset, data.key.byteLength / 4);
  109038. var iv = new Uint32Array(data.iv.bytes, data.iv.byteOffset, data.iv.byteLength / 4);
  109039. new Decrypter2(encrypted, key, iv, function(err, bytes) {
  109040. self.postMessage(createTransferableMessage3({
  109041. source: data.source,
  109042. decrypted: bytes
  109043. }), [bytes.buffer]);
  109044. });
  109045. };
  109046. }));
  109047. var Decrypter = factory(workerCode);
  109048. var audioTrackKind_ = function audioTrackKind_2(properties) {
  109049. var kind = properties["default"] ? "main" : "alternative";
  109050. if (properties.characteristics && properties.characteristics.indexOf("public.accessibility.describes-video") >= 0) {
  109051. kind = "main-desc";
  109052. }
  109053. return kind;
  109054. };
  109055. var stopLoaders = function stopLoaders2(segmentLoader, mediaType) {
  109056. segmentLoader.abort();
  109057. segmentLoader.pause();
  109058. if (mediaType && mediaType.activePlaylistLoader) {
  109059. mediaType.activePlaylistLoader.pause();
  109060. mediaType.activePlaylistLoader = null;
  109061. }
  109062. };
  109063. var startLoaders = function startLoaders2(playlistLoader, mediaType) {
  109064. mediaType.activePlaylistLoader = playlistLoader;
  109065. playlistLoader.load();
  109066. };
  109067. var onGroupChanged = function onGroupChanged2(type2, settings) {
  109068. return function() {
  109069. var _settings$segmentLoad = settings.segmentLoaders, segmentLoader = _settings$segmentLoad[type2], mainSegmentLoader = _settings$segmentLoad.main, mediaType = settings.mediaTypes[type2];
  109070. var activeTrack2 = mediaType.activeTrack();
  109071. var activeGroup3 = mediaType.getActiveGroup();
  109072. var previousActiveLoader = mediaType.activePlaylistLoader;
  109073. var lastGroup = mediaType.lastGroup_;
  109074. if (activeGroup3 && lastGroup && activeGroup3.id === lastGroup.id) {
  109075. return;
  109076. }
  109077. mediaType.lastGroup_ = activeGroup3;
  109078. mediaType.lastTrack_ = activeTrack2;
  109079. stopLoaders(segmentLoader, mediaType);
  109080. if (!activeGroup3 || activeGroup3.isMasterPlaylist) {
  109081. return;
  109082. }
  109083. if (!activeGroup3.playlistLoader) {
  109084. if (previousActiveLoader) {
  109085. mainSegmentLoader.resetEverything();
  109086. }
  109087. return;
  109088. }
  109089. segmentLoader.resyncLoader();
  109090. startLoaders(activeGroup3.playlistLoader, mediaType);
  109091. };
  109092. };
  109093. var onGroupChanging = function onGroupChanging2(type2, settings) {
  109094. return function() {
  109095. var segmentLoader = settings.segmentLoaders[type2], mediaType = settings.mediaTypes[type2];
  109096. mediaType.lastGroup_ = null;
  109097. segmentLoader.abort();
  109098. segmentLoader.pause();
  109099. };
  109100. };
  109101. var onTrackChanged = function onTrackChanged2(type2, settings) {
  109102. return function() {
  109103. var masterPlaylistLoader = settings.masterPlaylistLoader, _settings$segmentLoad2 = settings.segmentLoaders, segmentLoader = _settings$segmentLoad2[type2], mainSegmentLoader = _settings$segmentLoad2.main, mediaType = settings.mediaTypes[type2];
  109104. var activeTrack2 = mediaType.activeTrack();
  109105. var activeGroup3 = mediaType.getActiveGroup();
  109106. var previousActiveLoader = mediaType.activePlaylistLoader;
  109107. var lastTrack = mediaType.lastTrack_;
  109108. if (lastTrack && activeTrack2 && lastTrack.id === activeTrack2.id) {
  109109. return;
  109110. }
  109111. mediaType.lastGroup_ = activeGroup3;
  109112. mediaType.lastTrack_ = activeTrack2;
  109113. stopLoaders(segmentLoader, mediaType);
  109114. if (!activeGroup3) {
  109115. return;
  109116. }
  109117. if (activeGroup3.isMasterPlaylist) {
  109118. if (!activeTrack2 || !lastTrack || activeTrack2.id === lastTrack.id) {
  109119. return;
  109120. }
  109121. var mpc = settings.vhs.masterPlaylistController_;
  109122. var newPlaylist = mpc.selectPlaylist();
  109123. if (mpc.media() === newPlaylist) {
  109124. return;
  109125. }
  109126. mediaType.logger_("track change. Switching master audio from " + lastTrack.id + " to " + activeTrack2.id);
  109127. masterPlaylistLoader.pause();
  109128. mainSegmentLoader.resetEverything();
  109129. mpc.fastQualityChange_(newPlaylist);
  109130. return;
  109131. }
  109132. if (type2 === "AUDIO") {
  109133. if (!activeGroup3.playlistLoader) {
  109134. mainSegmentLoader.setAudio(true);
  109135. mainSegmentLoader.resetEverything();
  109136. return;
  109137. }
  109138. segmentLoader.setAudio(true);
  109139. mainSegmentLoader.setAudio(false);
  109140. }
  109141. if (previousActiveLoader === activeGroup3.playlistLoader) {
  109142. startLoaders(activeGroup3.playlistLoader, mediaType);
  109143. return;
  109144. }
  109145. if (segmentLoader.track) {
  109146. segmentLoader.track(activeTrack2);
  109147. }
  109148. segmentLoader.resetEverything();
  109149. startLoaders(activeGroup3.playlistLoader, mediaType);
  109150. };
  109151. };
  109152. var onError = {
  109153. AUDIO: function AUDIO(type2, settings) {
  109154. return function() {
  109155. var segmentLoader = settings.segmentLoaders[type2], mediaType = settings.mediaTypes[type2], blacklistCurrentPlaylist = settings.blacklistCurrentPlaylist;
  109156. stopLoaders(segmentLoader, mediaType);
  109157. var activeTrack2 = mediaType.activeTrack();
  109158. var activeGroup3 = mediaType.activeGroup();
  109159. var id = (activeGroup3.filter(function(group) {
  109160. return group["default"];
  109161. })[0] || activeGroup3[0]).id;
  109162. var defaultTrack = mediaType.tracks[id];
  109163. if (activeTrack2 === defaultTrack) {
  109164. blacklistCurrentPlaylist({
  109165. message: "Problem encountered loading the default audio track."
  109166. });
  109167. return;
  109168. }
  109169. videojs.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");
  109170. for (var trackId in mediaType.tracks) {
  109171. mediaType.tracks[trackId].enabled = mediaType.tracks[trackId] === defaultTrack;
  109172. }
  109173. mediaType.onTrackChanged();
  109174. };
  109175. },
  109176. SUBTITLES: function SUBTITLES(type2, settings) {
  109177. return function() {
  109178. var segmentLoader = settings.segmentLoaders[type2], mediaType = settings.mediaTypes[type2];
  109179. videojs.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");
  109180. stopLoaders(segmentLoader, mediaType);
  109181. var track = mediaType.activeTrack();
  109182. if (track) {
  109183. track.mode = "disabled";
  109184. }
  109185. mediaType.onTrackChanged();
  109186. };
  109187. }
  109188. };
  109189. var setupListeners = {
  109190. AUDIO: function AUDIO2(type2, playlistLoader, settings) {
  109191. if (!playlistLoader) {
  109192. return;
  109193. }
  109194. var tech = settings.tech, requestOptions = settings.requestOptions, segmentLoader = settings.segmentLoaders[type2];
  109195. playlistLoader.on("loadedmetadata", function() {
  109196. var media = playlistLoader.media();
  109197. segmentLoader.playlist(media, requestOptions);
  109198. if (!tech.paused() || media.endList && tech.preload() !== "none") {
  109199. segmentLoader.load();
  109200. }
  109201. });
  109202. playlistLoader.on("loadedplaylist", function() {
  109203. segmentLoader.playlist(playlistLoader.media(), requestOptions);
  109204. if (!tech.paused()) {
  109205. segmentLoader.load();
  109206. }
  109207. });
  109208. playlistLoader.on("error", onError[type2](type2, settings));
  109209. },
  109210. SUBTITLES: function SUBTITLES2(type2, playlistLoader, settings) {
  109211. var tech = settings.tech, requestOptions = settings.requestOptions, segmentLoader = settings.segmentLoaders[type2], mediaType = settings.mediaTypes[type2];
  109212. playlistLoader.on("loadedmetadata", function() {
  109213. var media = playlistLoader.media();
  109214. segmentLoader.playlist(media, requestOptions);
  109215. segmentLoader.track(mediaType.activeTrack());
  109216. if (!tech.paused() || media.endList && tech.preload() !== "none") {
  109217. segmentLoader.load();
  109218. }
  109219. });
  109220. playlistLoader.on("loadedplaylist", function() {
  109221. segmentLoader.playlist(playlistLoader.media(), requestOptions);
  109222. if (!tech.paused()) {
  109223. segmentLoader.load();
  109224. }
  109225. });
  109226. playlistLoader.on("error", onError[type2](type2, settings));
  109227. }
  109228. };
  109229. var initialize = {
  109230. "AUDIO": function AUDIO3(type2, settings) {
  109231. var vhs = settings.vhs, sourceType = settings.sourceType, segmentLoader = settings.segmentLoaders[type2], requestOptions = settings.requestOptions, mediaGroups = settings.master.mediaGroups, _settings$mediaTypes$ = settings.mediaTypes[type2], groups = _settings$mediaTypes$.groups, tracks = _settings$mediaTypes$.tracks, logger_ = _settings$mediaTypes$.logger_, masterPlaylistLoader = settings.masterPlaylistLoader;
  109232. var audioOnlyMaster = isAudioOnly(masterPlaylistLoader.master);
  109233. if (!mediaGroups[type2] || Object.keys(mediaGroups[type2]).length === 0) {
  109234. mediaGroups[type2] = {
  109235. main: {
  109236. "default": {
  109237. "default": true
  109238. }
  109239. }
  109240. };
  109241. if (audioOnlyMaster) {
  109242. mediaGroups[type2].main["default"].playlists = masterPlaylistLoader.master.playlists;
  109243. }
  109244. }
  109245. for (var groupId in mediaGroups[type2]) {
  109246. if (!groups[groupId]) {
  109247. groups[groupId] = [];
  109248. }
  109249. for (var variantLabel in mediaGroups[type2][groupId]) {
  109250. var properties = mediaGroups[type2][groupId][variantLabel];
  109251. var playlistLoader = void 0;
  109252. if (audioOnlyMaster) {
  109253. logger_("AUDIO group '" + groupId + "' label '" + variantLabel + "' is a master playlist");
  109254. properties.isMasterPlaylist = true;
  109255. playlistLoader = null;
  109256. } else if (sourceType === "vhs-json" && properties.playlists) {
  109257. playlistLoader = new PlaylistLoader(properties.playlists[0], vhs, requestOptions);
  109258. } else if (properties.resolvedUri) {
  109259. playlistLoader = new PlaylistLoader(properties.resolvedUri, vhs, requestOptions);
  109260. } else if (properties.playlists && sourceType === "dash") {
  109261. playlistLoader = new DashPlaylistLoader(properties.playlists[0], vhs, requestOptions, masterPlaylistLoader);
  109262. } else {
  109263. playlistLoader = null;
  109264. }
  109265. properties = videojs.mergeOptions({
  109266. id: variantLabel,
  109267. playlistLoader
  109268. }, properties);
  109269. setupListeners[type2](type2, properties.playlistLoader, settings);
  109270. groups[groupId].push(properties);
  109271. if (typeof tracks[variantLabel] === "undefined") {
  109272. var track = new videojs.AudioTrack({
  109273. id: variantLabel,
  109274. kind: audioTrackKind_(properties),
  109275. enabled: false,
  109276. language: properties.language,
  109277. "default": properties["default"],
  109278. label: variantLabel
  109279. });
  109280. tracks[variantLabel] = track;
  109281. }
  109282. }
  109283. }
  109284. segmentLoader.on("error", onError[type2](type2, settings));
  109285. },
  109286. "SUBTITLES": function SUBTITLES3(type2, settings) {
  109287. var tech = settings.tech, vhs = settings.vhs, sourceType = settings.sourceType, segmentLoader = settings.segmentLoaders[type2], requestOptions = settings.requestOptions, mediaGroups = settings.master.mediaGroups, _settings$mediaTypes$2 = settings.mediaTypes[type2], groups = _settings$mediaTypes$2.groups, tracks = _settings$mediaTypes$2.tracks, masterPlaylistLoader = settings.masterPlaylistLoader;
  109288. for (var groupId in mediaGroups[type2]) {
  109289. if (!groups[groupId]) {
  109290. groups[groupId] = [];
  109291. }
  109292. for (var variantLabel in mediaGroups[type2][groupId]) {
  109293. if (mediaGroups[type2][groupId][variantLabel].forced) {
  109294. continue;
  109295. }
  109296. var properties = mediaGroups[type2][groupId][variantLabel];
  109297. var playlistLoader = void 0;
  109298. if (sourceType === "hls") {
  109299. playlistLoader = new PlaylistLoader(properties.resolvedUri, vhs, requestOptions);
  109300. } else if (sourceType === "dash") {
  109301. var playlists = properties.playlists.filter(function(p) {
  109302. return p.excludeUntil !== Infinity;
  109303. });
  109304. if (!playlists.length) {
  109305. return;
  109306. }
  109307. playlistLoader = new DashPlaylistLoader(properties.playlists[0], vhs, requestOptions, masterPlaylistLoader);
  109308. } else if (sourceType === "vhs-json") {
  109309. playlistLoader = new PlaylistLoader(
  109310. properties.playlists ? properties.playlists[0] : properties.resolvedUri,
  109311. vhs,
  109312. requestOptions
  109313. );
  109314. }
  109315. properties = videojs.mergeOptions({
  109316. id: variantLabel,
  109317. playlistLoader
  109318. }, properties);
  109319. setupListeners[type2](type2, properties.playlistLoader, settings);
  109320. groups[groupId].push(properties);
  109321. if (typeof tracks[variantLabel] === "undefined") {
  109322. var track = tech.addRemoteTextTrack({
  109323. id: variantLabel,
  109324. kind: "subtitles",
  109325. "default": properties["default"] && properties.autoselect,
  109326. language: properties.language,
  109327. label: variantLabel
  109328. }, false).track;
  109329. tracks[variantLabel] = track;
  109330. }
  109331. }
  109332. }
  109333. segmentLoader.on("error", onError[type2](type2, settings));
  109334. },
  109335. "CLOSED-CAPTIONS": function CLOSEDCAPTIONS(type2, settings) {
  109336. var tech = settings.tech, mediaGroups = settings.master.mediaGroups, _settings$mediaTypes$3 = settings.mediaTypes[type2], groups = _settings$mediaTypes$3.groups, tracks = _settings$mediaTypes$3.tracks;
  109337. for (var groupId in mediaGroups[type2]) {
  109338. if (!groups[groupId]) {
  109339. groups[groupId] = [];
  109340. }
  109341. for (var variantLabel in mediaGroups[type2][groupId]) {
  109342. var properties = mediaGroups[type2][groupId][variantLabel];
  109343. if (!/^(?:CC|SERVICE)/.test(properties.instreamId)) {
  109344. continue;
  109345. }
  109346. var captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {};
  109347. var newProps = {
  109348. label: variantLabel,
  109349. language: properties.language,
  109350. instreamId: properties.instreamId,
  109351. "default": properties["default"] && properties.autoselect
  109352. };
  109353. if (captionServices[newProps.instreamId]) {
  109354. newProps = videojs.mergeOptions(newProps, captionServices[newProps.instreamId]);
  109355. }
  109356. if (newProps["default"] === void 0) {
  109357. delete newProps["default"];
  109358. }
  109359. groups[groupId].push(videojs.mergeOptions({
  109360. id: variantLabel
  109361. }, properties));
  109362. if (typeof tracks[variantLabel] === "undefined") {
  109363. var track = tech.addRemoteTextTrack({
  109364. id: newProps.instreamId,
  109365. kind: "captions",
  109366. "default": newProps["default"],
  109367. language: newProps.language,
  109368. label: newProps.label
  109369. }, false).track;
  109370. tracks[variantLabel] = track;
  109371. }
  109372. }
  109373. }
  109374. }
  109375. };
  109376. var groupMatch = function groupMatch2(list, media) {
  109377. for (var i2 = 0; i2 < list.length; i2++) {
  109378. if (playlistMatch(media, list[i2])) {
  109379. return true;
  109380. }
  109381. if (list[i2].playlists && groupMatch2(list[i2].playlists, media)) {
  109382. return true;
  109383. }
  109384. }
  109385. return false;
  109386. };
  109387. var activeGroup = function activeGroup2(type2, settings) {
  109388. return function(track) {
  109389. var masterPlaylistLoader = settings.masterPlaylistLoader, groups = settings.mediaTypes[type2].groups;
  109390. var media = masterPlaylistLoader.media();
  109391. if (!media) {
  109392. return null;
  109393. }
  109394. var variants = null;
  109395. if (media.attributes[type2]) {
  109396. variants = groups[media.attributes[type2]];
  109397. }
  109398. var groupKeys = Object.keys(groups);
  109399. if (!variants) {
  109400. if (type2 === "AUDIO" && groupKeys.length > 1 && isAudioOnly(settings.master)) {
  109401. for (var i2 = 0; i2 < groupKeys.length; i2++) {
  109402. var groupPropertyList = groups[groupKeys[i2]];
  109403. if (groupMatch(groupPropertyList, media)) {
  109404. variants = groupPropertyList;
  109405. break;
  109406. }
  109407. }
  109408. } else if (groups.main) {
  109409. variants = groups.main;
  109410. } else if (groupKeys.length === 1) {
  109411. variants = groups[groupKeys[0]];
  109412. }
  109413. }
  109414. if (typeof track === "undefined") {
  109415. return variants;
  109416. }
  109417. if (track === null || !variants) {
  109418. return null;
  109419. }
  109420. return variants.filter(function(props) {
  109421. return props.id === track.id;
  109422. })[0] || null;
  109423. };
  109424. };
  109425. var activeTrack = {
  109426. AUDIO: function AUDIO4(type2, settings) {
  109427. return function() {
  109428. var tracks = settings.mediaTypes[type2].tracks;
  109429. for (var id in tracks) {
  109430. if (tracks[id].enabled) {
  109431. return tracks[id];
  109432. }
  109433. }
  109434. return null;
  109435. };
  109436. },
  109437. SUBTITLES: function SUBTITLES4(type2, settings) {
  109438. return function() {
  109439. var tracks = settings.mediaTypes[type2].tracks;
  109440. for (var id in tracks) {
  109441. if (tracks[id].mode === "showing" || tracks[id].mode === "hidden") {
  109442. return tracks[id];
  109443. }
  109444. }
  109445. return null;
  109446. };
  109447. }
  109448. };
  109449. var getActiveGroup = function getActiveGroup2(type2, _ref) {
  109450. var mediaTypes2 = _ref.mediaTypes;
  109451. return function() {
  109452. var activeTrack_ = mediaTypes2[type2].activeTrack();
  109453. if (!activeTrack_) {
  109454. return null;
  109455. }
  109456. return mediaTypes2[type2].activeGroup(activeTrack_);
  109457. };
  109458. };
  109459. var setupMediaGroups = function setupMediaGroups2(settings) {
  109460. ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach(function(type2) {
  109461. initialize[type2](type2, settings);
  109462. });
  109463. var mediaTypes2 = settings.mediaTypes, masterPlaylistLoader = settings.masterPlaylistLoader, tech = settings.tech, vhs = settings.vhs, _settings$segmentLoad3 = settings.segmentLoaders, audioSegmentLoader = _settings$segmentLoad3["AUDIO"], mainSegmentLoader = _settings$segmentLoad3.main;
  109464. ["AUDIO", "SUBTITLES"].forEach(function(type2) {
  109465. mediaTypes2[type2].activeGroup = activeGroup(type2, settings);
  109466. mediaTypes2[type2].activeTrack = activeTrack[type2](type2, settings);
  109467. mediaTypes2[type2].onGroupChanged = onGroupChanged(type2, settings);
  109468. mediaTypes2[type2].onGroupChanging = onGroupChanging(type2, settings);
  109469. mediaTypes2[type2].onTrackChanged = onTrackChanged(type2, settings);
  109470. mediaTypes2[type2].getActiveGroup = getActiveGroup(type2, settings);
  109471. });
  109472. var audioGroup = mediaTypes2.AUDIO.activeGroup();
  109473. if (audioGroup) {
  109474. var groupId = (audioGroup.filter(function(group) {
  109475. return group["default"];
  109476. })[0] || audioGroup[0]).id;
  109477. mediaTypes2.AUDIO.tracks[groupId].enabled = true;
  109478. mediaTypes2.AUDIO.onGroupChanged();
  109479. mediaTypes2.AUDIO.onTrackChanged();
  109480. var activeAudioGroup = mediaTypes2.AUDIO.getActiveGroup();
  109481. if (!activeAudioGroup.playlistLoader) {
  109482. mainSegmentLoader.setAudio(true);
  109483. } else {
  109484. mainSegmentLoader.setAudio(false);
  109485. audioSegmentLoader.setAudio(true);
  109486. }
  109487. }
  109488. masterPlaylistLoader.on("mediachange", function() {
  109489. ["AUDIO", "SUBTITLES"].forEach(function(type2) {
  109490. return mediaTypes2[type2].onGroupChanged();
  109491. });
  109492. });
  109493. masterPlaylistLoader.on("mediachanging", function() {
  109494. ["AUDIO", "SUBTITLES"].forEach(function(type2) {
  109495. return mediaTypes2[type2].onGroupChanging();
  109496. });
  109497. });
  109498. var onAudioTrackChanged = function onAudioTrackChanged2() {
  109499. mediaTypes2.AUDIO.onTrackChanged();
  109500. tech.trigger({
  109501. type: "usage",
  109502. name: "vhs-audio-change"
  109503. });
  109504. tech.trigger({
  109505. type: "usage",
  109506. name: "hls-audio-change"
  109507. });
  109508. };
  109509. tech.audioTracks().addEventListener("change", onAudioTrackChanged);
  109510. tech.remoteTextTracks().addEventListener("change", mediaTypes2.SUBTITLES.onTrackChanged);
  109511. vhs.on("dispose", function() {
  109512. tech.audioTracks().removeEventListener("change", onAudioTrackChanged);
  109513. tech.remoteTextTracks().removeEventListener("change", mediaTypes2.SUBTITLES.onTrackChanged);
  109514. });
  109515. tech.clearTracks("audio");
  109516. for (var id in mediaTypes2.AUDIO.tracks) {
  109517. tech.audioTracks().addTrack(mediaTypes2.AUDIO.tracks[id]);
  109518. }
  109519. };
  109520. var createMediaTypes = function createMediaTypes2() {
  109521. var mediaTypes2 = {};
  109522. ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach(function(type2) {
  109523. mediaTypes2[type2] = {
  109524. groups: {},
  109525. tracks: {},
  109526. activePlaylistLoader: null,
  109527. activeGroup: noop,
  109528. activeTrack: noop,
  109529. getActiveGroup: noop,
  109530. onGroupChanged: noop,
  109531. onTrackChanged: noop,
  109532. lastTrack_: null,
  109533. logger_: logger("MediaGroups[" + type2 + "]")
  109534. };
  109535. });
  109536. return mediaTypes2;
  109537. };
  109538. var ABORT_EARLY_BLACKLIST_SECONDS = 60 * 2;
  109539. var Vhs$1;
  109540. var loaderStats = ["mediaRequests", "mediaRequestsAborted", "mediaRequestsTimedout", "mediaRequestsErrored", "mediaTransferDuration", "mediaBytesTransferred", "mediaAppends"];
  109541. var sumLoaderStat = function sumLoaderStat2(stat) {
  109542. return this.audioSegmentLoader_[stat] + this.mainSegmentLoader_[stat];
  109543. };
  109544. var shouldSwitchToMedia = function shouldSwitchToMedia2(_ref) {
  109545. var currentPlaylist = _ref.currentPlaylist, buffered = _ref.buffered, currentTime = _ref.currentTime, nextPlaylist = _ref.nextPlaylist, bufferLowWaterLine = _ref.bufferLowWaterLine, bufferHighWaterLine = _ref.bufferHighWaterLine, duration5 = _ref.duration, experimentalBufferBasedABR = _ref.experimentalBufferBasedABR, log2 = _ref.log;
  109546. if (!nextPlaylist) {
  109547. videojs.log.warn("We received no playlist to switch to. Please check your stream.");
  109548. return false;
  109549. }
  109550. var sharedLogLine = "allowing switch " + (currentPlaylist && currentPlaylist.id || "null") + " -> " + nextPlaylist.id;
  109551. if (!currentPlaylist) {
  109552. log2(sharedLogLine + " as current playlist is not set");
  109553. return true;
  109554. }
  109555. if (nextPlaylist.id === currentPlaylist.id) {
  109556. return false;
  109557. }
  109558. var isBuffered = Boolean(findRange(buffered, currentTime).length);
  109559. if (!currentPlaylist.endList) {
  109560. if (!isBuffered && typeof currentPlaylist.partTargetDuration === "number") {
  109561. log2("not " + sharedLogLine + " as current playlist is live llhls, but currentTime isn't in buffered.");
  109562. return false;
  109563. }
  109564. log2(sharedLogLine + " as current playlist is live");
  109565. return true;
  109566. }
  109567. var forwardBuffer = timeAheadOf(buffered, currentTime);
  109568. var maxBufferLowWaterLine = experimentalBufferBasedABR ? Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE : Config.MAX_BUFFER_LOW_WATER_LINE;
  109569. if (duration5 < maxBufferLowWaterLine) {
  109570. log2(sharedLogLine + " as duration < max low water line (" + duration5 + " < " + maxBufferLowWaterLine + ")");
  109571. return true;
  109572. }
  109573. var nextBandwidth = nextPlaylist.attributes.BANDWIDTH;
  109574. var currBandwidth = currentPlaylist.attributes.BANDWIDTH;
  109575. if (nextBandwidth < currBandwidth && (!experimentalBufferBasedABR || forwardBuffer < bufferHighWaterLine)) {
  109576. var logLine = sharedLogLine + " as next bandwidth < current bandwidth (" + nextBandwidth + " < " + currBandwidth + ")";
  109577. if (experimentalBufferBasedABR) {
  109578. logLine += " and forwardBuffer < bufferHighWaterLine (" + forwardBuffer + " < " + bufferHighWaterLine + ")";
  109579. }
  109580. log2(logLine);
  109581. return true;
  109582. }
  109583. if ((!experimentalBufferBasedABR || nextBandwidth > currBandwidth) && forwardBuffer >= bufferLowWaterLine) {
  109584. var _logLine = sharedLogLine + " as forwardBuffer >= bufferLowWaterLine (" + forwardBuffer + " >= " + bufferLowWaterLine + ")";
  109585. if (experimentalBufferBasedABR) {
  109586. _logLine += " and next bandwidth > current bandwidth (" + nextBandwidth + " > " + currBandwidth + ")";
  109587. }
  109588. log2(_logLine);
  109589. return true;
  109590. }
  109591. log2("not " + sharedLogLine + " as no switching criteria met");
  109592. return false;
  109593. };
  109594. var MasterPlaylistController = /* @__PURE__ */ function(_videojs$EventTarget) {
  109595. _inheritsLoose(MasterPlaylistController2, _videojs$EventTarget);
  109596. function MasterPlaylistController2(options2) {
  109597. var _this;
  109598. _this = _videojs$EventTarget.call(this) || this;
  109599. var src = options2.src, handleManifestRedirects = options2.handleManifestRedirects, withCredentials = options2.withCredentials, tech = options2.tech, bandwidth2 = options2.bandwidth, externVhs = options2.externVhs, useCueTags = options2.useCueTags, blacklistDuration = options2.blacklistDuration, enableLowInitialPlaylist = options2.enableLowInitialPlaylist, sourceType = options2.sourceType, cacheEncryptionKeys = options2.cacheEncryptionKeys, experimentalBufferBasedABR = options2.experimentalBufferBasedABR, experimentalLeastPixelDiffSelector = options2.experimentalLeastPixelDiffSelector, captionServices = options2.captionServices;
  109600. if (!src) {
  109601. throw new Error("A non-empty playlist URL or JSON manifest string is required");
  109602. }
  109603. var maxPlaylistRetries = options2.maxPlaylistRetries;
  109604. if (maxPlaylistRetries === null || typeof maxPlaylistRetries === "undefined") {
  109605. maxPlaylistRetries = Infinity;
  109606. }
  109607. Vhs$1 = externVhs;
  109608. _this.experimentalBufferBasedABR = Boolean(experimentalBufferBasedABR);
  109609. _this.experimentalLeastPixelDiffSelector = Boolean(experimentalLeastPixelDiffSelector);
  109610. _this.withCredentials = withCredentials;
  109611. _this.tech_ = tech;
  109612. _this.vhs_ = tech.vhs;
  109613. _this.sourceType_ = sourceType;
  109614. _this.useCueTags_ = useCueTags;
  109615. _this.blacklistDuration = blacklistDuration;
  109616. _this.maxPlaylistRetries = maxPlaylistRetries;
  109617. _this.enableLowInitialPlaylist = enableLowInitialPlaylist;
  109618. if (_this.useCueTags_) {
  109619. _this.cueTagsTrack_ = _this.tech_.addTextTrack("metadata", "ad-cues");
  109620. _this.cueTagsTrack_.inBandMetadataTrackDispatchType = "";
  109621. }
  109622. _this.requestOptions_ = {
  109623. withCredentials,
  109624. handleManifestRedirects,
  109625. maxPlaylistRetries,
  109626. timeout: null
  109627. };
  109628. _this.on("error", _this.pauseLoading);
  109629. _this.mediaTypes_ = createMediaTypes();
  109630. _this.mediaSource = new window_1.MediaSource();
  109631. _this.handleDurationChange_ = _this.handleDurationChange_.bind(_assertThisInitialized(_this));
  109632. _this.handleSourceOpen_ = _this.handleSourceOpen_.bind(_assertThisInitialized(_this));
  109633. _this.handleSourceEnded_ = _this.handleSourceEnded_.bind(_assertThisInitialized(_this));
  109634. _this.mediaSource.addEventListener("durationchange", _this.handleDurationChange_);
  109635. _this.mediaSource.addEventListener("sourceopen", _this.handleSourceOpen_);
  109636. _this.mediaSource.addEventListener("sourceended", _this.handleSourceEnded_);
  109637. _this.seekable_ = videojs.createTimeRanges();
  109638. _this.hasPlayed_ = false;
  109639. _this.syncController_ = new SyncController(options2);
  109640. _this.segmentMetadataTrack_ = tech.addRemoteTextTrack({
  109641. kind: "metadata",
  109642. label: "segment-metadata"
  109643. }, false).track;
  109644. _this.decrypter_ = new Decrypter();
  109645. _this.sourceUpdater_ = new SourceUpdater(_this.mediaSource);
  109646. _this.inbandTextTracks_ = {};
  109647. _this.timelineChangeController_ = new TimelineChangeController();
  109648. var segmentLoaderSettings = {
  109649. vhs: _this.vhs_,
  109650. parse708captions: options2.parse708captions,
  109651. useDtsForTimestampOffset: options2.useDtsForTimestampOffset,
  109652. captionServices,
  109653. mediaSource: _this.mediaSource,
  109654. currentTime: _this.tech_.currentTime.bind(_this.tech_),
  109655. seekable: function seekable3() {
  109656. return _this.seekable();
  109657. },
  109658. seeking: function seeking() {
  109659. return _this.tech_.seeking();
  109660. },
  109661. duration: function duration5() {
  109662. return _this.duration();
  109663. },
  109664. hasPlayed: function hasPlayed() {
  109665. return _this.hasPlayed_;
  109666. },
  109667. goalBufferLength: function goalBufferLength() {
  109668. return _this.goalBufferLength();
  109669. },
  109670. bandwidth: bandwidth2,
  109671. syncController: _this.syncController_,
  109672. decrypter: _this.decrypter_,
  109673. sourceType: _this.sourceType_,
  109674. inbandTextTracks: _this.inbandTextTracks_,
  109675. cacheEncryptionKeys,
  109676. sourceUpdater: _this.sourceUpdater_,
  109677. timelineChangeController: _this.timelineChangeController_,
  109678. experimentalExactManifestTimings: options2.experimentalExactManifestTimings
  109679. };
  109680. _this.masterPlaylistLoader_ = _this.sourceType_ === "dash" ? new DashPlaylistLoader(src, _this.vhs_, _this.requestOptions_) : new PlaylistLoader(src, _this.vhs_, _this.requestOptions_);
  109681. _this.setupMasterPlaylistLoaderListeners_();
  109682. _this.mainSegmentLoader_ = new SegmentLoader(videojs.mergeOptions(segmentLoaderSettings, {
  109683. segmentMetadataTrack: _this.segmentMetadataTrack_,
  109684. loaderType: "main"
  109685. }), options2);
  109686. _this.audioSegmentLoader_ = new SegmentLoader(videojs.mergeOptions(segmentLoaderSettings, {
  109687. loaderType: "audio"
  109688. }), options2);
  109689. _this.subtitleSegmentLoader_ = new VTTSegmentLoader(videojs.mergeOptions(segmentLoaderSettings, {
  109690. loaderType: "vtt",
  109691. featuresNativeTextTracks: _this.tech_.featuresNativeTextTracks,
  109692. loadVttJs: function loadVttJs() {
  109693. return new Promise(function(resolve2, reject2) {
  109694. function onLoad() {
  109695. tech.off("vttjserror", onError2);
  109696. resolve2();
  109697. }
  109698. function onError2() {
  109699. tech.off("vttjsloaded", onLoad);
  109700. reject2();
  109701. }
  109702. tech.one("vttjsloaded", onLoad);
  109703. tech.one("vttjserror", onError2);
  109704. tech.addWebVttScript_();
  109705. });
  109706. }
  109707. }), options2);
  109708. _this.setupSegmentLoaderListeners_();
  109709. if (_this.experimentalBufferBasedABR) {
  109710. _this.masterPlaylistLoader_.one("loadedplaylist", function() {
  109711. return _this.startABRTimer_();
  109712. });
  109713. _this.tech_.on("pause", function() {
  109714. return _this.stopABRTimer_();
  109715. });
  109716. _this.tech_.on("play", function() {
  109717. return _this.startABRTimer_();
  109718. });
  109719. }
  109720. loaderStats.forEach(function(stat) {
  109721. _this[stat + "_"] = sumLoaderStat.bind(_assertThisInitialized(_this), stat);
  109722. });
  109723. _this.logger_ = logger("MPC");
  109724. _this.triggeredFmp4Usage = false;
  109725. if (_this.tech_.preload() === "none") {
  109726. _this.loadOnPlay_ = function() {
  109727. _this.loadOnPlay_ = null;
  109728. _this.masterPlaylistLoader_.load();
  109729. };
  109730. _this.tech_.one("play", _this.loadOnPlay_);
  109731. } else {
  109732. _this.masterPlaylistLoader_.load();
  109733. }
  109734. _this.timeToLoadedData__ = -1;
  109735. _this.mainAppendsToLoadedData__ = -1;
  109736. _this.audioAppendsToLoadedData__ = -1;
  109737. var event2 = _this.tech_.preload() === "none" ? "play" : "loadstart";
  109738. _this.tech_.one(event2, function() {
  109739. var timeToLoadedDataStart = Date.now();
  109740. _this.tech_.one("loadeddata", function() {
  109741. _this.timeToLoadedData__ = Date.now() - timeToLoadedDataStart;
  109742. _this.mainAppendsToLoadedData__ = _this.mainSegmentLoader_.mediaAppends;
  109743. _this.audioAppendsToLoadedData__ = _this.audioSegmentLoader_.mediaAppends;
  109744. });
  109745. });
  109746. return _this;
  109747. }
  109748. var _proto = MasterPlaylistController2.prototype;
  109749. _proto.mainAppendsToLoadedData_ = function mainAppendsToLoadedData_() {
  109750. return this.mainAppendsToLoadedData__;
  109751. };
  109752. _proto.audioAppendsToLoadedData_ = function audioAppendsToLoadedData_() {
  109753. return this.audioAppendsToLoadedData__;
  109754. };
  109755. _proto.appendsToLoadedData_ = function appendsToLoadedData_() {
  109756. var main = this.mainAppendsToLoadedData_();
  109757. var audio = this.audioAppendsToLoadedData_();
  109758. if (main === -1 || audio === -1) {
  109759. return -1;
  109760. }
  109761. return main + audio;
  109762. };
  109763. _proto.timeToLoadedData_ = function timeToLoadedData_() {
  109764. return this.timeToLoadedData__;
  109765. };
  109766. _proto.checkABR_ = function checkABR_(reason) {
  109767. if (reason === void 0) {
  109768. reason = "abr";
  109769. }
  109770. var nextPlaylist = this.selectPlaylist();
  109771. if (nextPlaylist && this.shouldSwitchToMedia_(nextPlaylist)) {
  109772. this.switchMedia_(nextPlaylist, reason);
  109773. }
  109774. };
  109775. _proto.switchMedia_ = function switchMedia_(playlist, cause, delay) {
  109776. var oldMedia = this.media();
  109777. var oldId = oldMedia && (oldMedia.id || oldMedia.uri);
  109778. var newId = playlist.id || playlist.uri;
  109779. if (oldId && oldId !== newId) {
  109780. this.logger_("switch media " + oldId + " -> " + newId + " from " + cause);
  109781. this.tech_.trigger({
  109782. type: "usage",
  109783. name: "vhs-rendition-change-" + cause
  109784. });
  109785. }
  109786. this.masterPlaylistLoader_.media(playlist, delay);
  109787. };
  109788. _proto.startABRTimer_ = function startABRTimer_() {
  109789. var _this2 = this;
  109790. this.stopABRTimer_();
  109791. this.abrTimer_ = window_1.setInterval(function() {
  109792. return _this2.checkABR_();
  109793. }, 250);
  109794. };
  109795. _proto.stopABRTimer_ = function stopABRTimer_() {
  109796. if (this.tech_.scrubbing && this.tech_.scrubbing()) {
  109797. return;
  109798. }
  109799. window_1.clearInterval(this.abrTimer_);
  109800. this.abrTimer_ = null;
  109801. };
  109802. _proto.getAudioTrackPlaylists_ = function getAudioTrackPlaylists_() {
  109803. var master = this.master();
  109804. var defaultPlaylists = master && master.playlists || [];
  109805. if (!master || !master.mediaGroups || !master.mediaGroups.AUDIO) {
  109806. return defaultPlaylists;
  109807. }
  109808. var AUDIO5 = master.mediaGroups.AUDIO;
  109809. var groupKeys = Object.keys(AUDIO5);
  109810. var track;
  109811. if (Object.keys(this.mediaTypes_.AUDIO.groups).length) {
  109812. track = this.mediaTypes_.AUDIO.activeTrack();
  109813. } else {
  109814. var defaultGroup = AUDIO5.main || groupKeys.length && AUDIO5[groupKeys[0]];
  109815. for (var label2 in defaultGroup) {
  109816. if (defaultGroup[label2]["default"]) {
  109817. track = {
  109818. label: label2
  109819. };
  109820. break;
  109821. }
  109822. }
  109823. }
  109824. if (!track) {
  109825. return defaultPlaylists;
  109826. }
  109827. var playlists = [];
  109828. for (var group in AUDIO5) {
  109829. if (AUDIO5[group][track.label]) {
  109830. var properties = AUDIO5[group][track.label];
  109831. if (properties.playlists && properties.playlists.length) {
  109832. playlists.push.apply(playlists, properties.playlists);
  109833. } else if (properties.uri) {
  109834. playlists.push(properties);
  109835. } else if (master.playlists.length) {
  109836. for (var i2 = 0; i2 < master.playlists.length; i2++) {
  109837. var playlist = master.playlists[i2];
  109838. if (playlist.attributes && playlist.attributes.AUDIO && playlist.attributes.AUDIO === group) {
  109839. playlists.push(playlist);
  109840. }
  109841. }
  109842. }
  109843. }
  109844. }
  109845. if (!playlists.length) {
  109846. return defaultPlaylists;
  109847. }
  109848. return playlists;
  109849. };
  109850. _proto.setupMasterPlaylistLoaderListeners_ = function setupMasterPlaylistLoaderListeners_() {
  109851. var _this3 = this;
  109852. this.masterPlaylistLoader_.on("loadedmetadata", function() {
  109853. var media = _this3.masterPlaylistLoader_.media();
  109854. var requestTimeout = media.targetDuration * 1.5 * 1e3;
  109855. if (isLowestEnabledRendition(_this3.masterPlaylistLoader_.master, _this3.masterPlaylistLoader_.media())) {
  109856. _this3.requestOptions_.timeout = 0;
  109857. } else {
  109858. _this3.requestOptions_.timeout = requestTimeout;
  109859. }
  109860. if (media.endList && _this3.tech_.preload() !== "none") {
  109861. _this3.mainSegmentLoader_.playlist(media, _this3.requestOptions_);
  109862. _this3.mainSegmentLoader_.load();
  109863. }
  109864. setupMediaGroups({
  109865. sourceType: _this3.sourceType_,
  109866. segmentLoaders: {
  109867. AUDIO: _this3.audioSegmentLoader_,
  109868. SUBTITLES: _this3.subtitleSegmentLoader_,
  109869. main: _this3.mainSegmentLoader_
  109870. },
  109871. tech: _this3.tech_,
  109872. requestOptions: _this3.requestOptions_,
  109873. masterPlaylistLoader: _this3.masterPlaylistLoader_,
  109874. vhs: _this3.vhs_,
  109875. master: _this3.master(),
  109876. mediaTypes: _this3.mediaTypes_,
  109877. blacklistCurrentPlaylist: _this3.blacklistCurrentPlaylist.bind(_this3)
  109878. });
  109879. _this3.triggerPresenceUsage_(_this3.master(), media);
  109880. _this3.setupFirstPlay();
  109881. if (!_this3.mediaTypes_.AUDIO.activePlaylistLoader || _this3.mediaTypes_.AUDIO.activePlaylistLoader.media()) {
  109882. _this3.trigger("selectedinitialmedia");
  109883. } else {
  109884. _this3.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata", function() {
  109885. _this3.trigger("selectedinitialmedia");
  109886. });
  109887. }
  109888. });
  109889. this.masterPlaylistLoader_.on("loadedplaylist", function() {
  109890. if (_this3.loadOnPlay_) {
  109891. _this3.tech_.off("play", _this3.loadOnPlay_);
  109892. }
  109893. var updatedPlaylist = _this3.masterPlaylistLoader_.media();
  109894. if (!updatedPlaylist) {
  109895. _this3.excludeUnsupportedVariants_();
  109896. var selectedMedia;
  109897. if (_this3.enableLowInitialPlaylist) {
  109898. selectedMedia = _this3.selectInitialPlaylist();
  109899. }
  109900. if (!selectedMedia) {
  109901. selectedMedia = _this3.selectPlaylist();
  109902. }
  109903. if (!selectedMedia || !_this3.shouldSwitchToMedia_(selectedMedia)) {
  109904. return;
  109905. }
  109906. _this3.initialMedia_ = selectedMedia;
  109907. _this3.switchMedia_(_this3.initialMedia_, "initial");
  109908. var haveJsonSource = _this3.sourceType_ === "vhs-json" && _this3.initialMedia_.segments;
  109909. if (!haveJsonSource) {
  109910. return;
  109911. }
  109912. updatedPlaylist = _this3.initialMedia_;
  109913. }
  109914. _this3.handleUpdatedMediaPlaylist(updatedPlaylist);
  109915. });
  109916. this.masterPlaylistLoader_.on("error", function() {
  109917. _this3.blacklistCurrentPlaylist(_this3.masterPlaylistLoader_.error);
  109918. });
  109919. this.masterPlaylistLoader_.on("mediachanging", function() {
  109920. _this3.mainSegmentLoader_.abort();
  109921. _this3.mainSegmentLoader_.pause();
  109922. });
  109923. this.masterPlaylistLoader_.on("mediachange", function() {
  109924. var media = _this3.masterPlaylistLoader_.media();
  109925. var requestTimeout = media.targetDuration * 1.5 * 1e3;
  109926. if (isLowestEnabledRendition(_this3.masterPlaylistLoader_.master, _this3.masterPlaylistLoader_.media())) {
  109927. _this3.requestOptions_.timeout = 0;
  109928. } else {
  109929. _this3.requestOptions_.timeout = requestTimeout;
  109930. }
  109931. _this3.masterPlaylistLoader_.load();
  109932. _this3.mainSegmentLoader_.playlist(media, _this3.requestOptions_);
  109933. _this3.mainSegmentLoader_.load();
  109934. _this3.tech_.trigger({
  109935. type: "mediachange",
  109936. bubbles: true
  109937. });
  109938. });
  109939. this.masterPlaylistLoader_.on("playlistunchanged", function() {
  109940. var updatedPlaylist = _this3.masterPlaylistLoader_.media();
  109941. if (updatedPlaylist.lastExcludeReason_ === "playlist-unchanged") {
  109942. return;
  109943. }
  109944. var playlistOutdated = _this3.stuckAtPlaylistEnd_(updatedPlaylist);
  109945. if (playlistOutdated) {
  109946. _this3.blacklistCurrentPlaylist({
  109947. message: "Playlist no longer updating.",
  109948. reason: "playlist-unchanged"
  109949. });
  109950. _this3.tech_.trigger("playliststuck");
  109951. }
  109952. });
  109953. this.masterPlaylistLoader_.on("renditiondisabled", function() {
  109954. _this3.tech_.trigger({
  109955. type: "usage",
  109956. name: "vhs-rendition-disabled"
  109957. });
  109958. _this3.tech_.trigger({
  109959. type: "usage",
  109960. name: "hls-rendition-disabled"
  109961. });
  109962. });
  109963. this.masterPlaylistLoader_.on("renditionenabled", function() {
  109964. _this3.tech_.trigger({
  109965. type: "usage",
  109966. name: "vhs-rendition-enabled"
  109967. });
  109968. _this3.tech_.trigger({
  109969. type: "usage",
  109970. name: "hls-rendition-enabled"
  109971. });
  109972. });
  109973. };
  109974. _proto.handleUpdatedMediaPlaylist = function handleUpdatedMediaPlaylist(updatedPlaylist) {
  109975. if (this.useCueTags_) {
  109976. this.updateAdCues_(updatedPlaylist);
  109977. }
  109978. this.mainSegmentLoader_.playlist(updatedPlaylist, this.requestOptions_);
  109979. this.updateDuration(!updatedPlaylist.endList);
  109980. if (!this.tech_.paused()) {
  109981. this.mainSegmentLoader_.load();
  109982. if (this.audioSegmentLoader_) {
  109983. this.audioSegmentLoader_.load();
  109984. }
  109985. }
  109986. };
  109987. _proto.triggerPresenceUsage_ = function triggerPresenceUsage_(master, media) {
  109988. var mediaGroups = master.mediaGroups || {};
  109989. var defaultDemuxed = true;
  109990. var audioGroupKeys = Object.keys(mediaGroups.AUDIO);
  109991. for (var mediaGroup in mediaGroups.AUDIO) {
  109992. for (var label2 in mediaGroups.AUDIO[mediaGroup]) {
  109993. var properties = mediaGroups.AUDIO[mediaGroup][label2];
  109994. if (!properties.uri) {
  109995. defaultDemuxed = false;
  109996. }
  109997. }
  109998. }
  109999. if (defaultDemuxed) {
  110000. this.tech_.trigger({
  110001. type: "usage",
  110002. name: "vhs-demuxed"
  110003. });
  110004. this.tech_.trigger({
  110005. type: "usage",
  110006. name: "hls-demuxed"
  110007. });
  110008. }
  110009. if (Object.keys(mediaGroups.SUBTITLES).length) {
  110010. this.tech_.trigger({
  110011. type: "usage",
  110012. name: "vhs-webvtt"
  110013. });
  110014. this.tech_.trigger({
  110015. type: "usage",
  110016. name: "hls-webvtt"
  110017. });
  110018. }
  110019. if (Vhs$1.Playlist.isAes(media)) {
  110020. this.tech_.trigger({
  110021. type: "usage",
  110022. name: "vhs-aes"
  110023. });
  110024. this.tech_.trigger({
  110025. type: "usage",
  110026. name: "hls-aes"
  110027. });
  110028. }
  110029. if (audioGroupKeys.length && Object.keys(mediaGroups.AUDIO[audioGroupKeys[0]]).length > 1) {
  110030. this.tech_.trigger({
  110031. type: "usage",
  110032. name: "vhs-alternate-audio"
  110033. });
  110034. this.tech_.trigger({
  110035. type: "usage",
  110036. name: "hls-alternate-audio"
  110037. });
  110038. }
  110039. if (this.useCueTags_) {
  110040. this.tech_.trigger({
  110041. type: "usage",
  110042. name: "vhs-playlist-cue-tags"
  110043. });
  110044. this.tech_.trigger({
  110045. type: "usage",
  110046. name: "hls-playlist-cue-tags"
  110047. });
  110048. }
  110049. };
  110050. _proto.shouldSwitchToMedia_ = function shouldSwitchToMedia_(nextPlaylist) {
  110051. var currentPlaylist = this.masterPlaylistLoader_.media() || this.masterPlaylistLoader_.pendingMedia_;
  110052. var currentTime = this.tech_.currentTime();
  110053. var bufferLowWaterLine = this.bufferLowWaterLine();
  110054. var bufferHighWaterLine = this.bufferHighWaterLine();
  110055. var buffered = this.tech_.buffered();
  110056. return shouldSwitchToMedia({
  110057. buffered,
  110058. currentTime,
  110059. currentPlaylist,
  110060. nextPlaylist,
  110061. bufferLowWaterLine,
  110062. bufferHighWaterLine,
  110063. duration: this.duration(),
  110064. experimentalBufferBasedABR: this.experimentalBufferBasedABR,
  110065. log: this.logger_
  110066. });
  110067. };
  110068. _proto.setupSegmentLoaderListeners_ = function setupSegmentLoaderListeners_() {
  110069. var _this4 = this;
  110070. this.mainSegmentLoader_.on("bandwidthupdate", function() {
  110071. _this4.checkABR_("bandwidthupdate");
  110072. _this4.tech_.trigger("bandwidthupdate");
  110073. });
  110074. this.mainSegmentLoader_.on("timeout", function() {
  110075. if (_this4.experimentalBufferBasedABR) {
  110076. _this4.mainSegmentLoader_.load();
  110077. }
  110078. });
  110079. if (!this.experimentalBufferBasedABR) {
  110080. this.mainSegmentLoader_.on("progress", function() {
  110081. _this4.trigger("progress");
  110082. });
  110083. }
  110084. this.mainSegmentLoader_.on("error", function() {
  110085. _this4.blacklistCurrentPlaylist(_this4.mainSegmentLoader_.error());
  110086. });
  110087. this.mainSegmentLoader_.on("appenderror", function() {
  110088. _this4.error = _this4.mainSegmentLoader_.error_;
  110089. _this4.trigger("error");
  110090. });
  110091. this.mainSegmentLoader_.on("syncinfoupdate", function() {
  110092. _this4.onSyncInfoUpdate_();
  110093. });
  110094. this.mainSegmentLoader_.on("timestampoffset", function() {
  110095. _this4.tech_.trigger({
  110096. type: "usage",
  110097. name: "vhs-timestamp-offset"
  110098. });
  110099. _this4.tech_.trigger({
  110100. type: "usage",
  110101. name: "hls-timestamp-offset"
  110102. });
  110103. });
  110104. this.audioSegmentLoader_.on("syncinfoupdate", function() {
  110105. _this4.onSyncInfoUpdate_();
  110106. });
  110107. this.audioSegmentLoader_.on("appenderror", function() {
  110108. _this4.error = _this4.audioSegmentLoader_.error_;
  110109. _this4.trigger("error");
  110110. });
  110111. this.mainSegmentLoader_.on("ended", function() {
  110112. _this4.logger_("main segment loader ended");
  110113. _this4.onEndOfStream();
  110114. });
  110115. this.mainSegmentLoader_.on("earlyabort", function(event2) {
  110116. if (_this4.experimentalBufferBasedABR) {
  110117. return;
  110118. }
  110119. _this4.delegateLoaders_("all", ["abort"]);
  110120. _this4.blacklistCurrentPlaylist({
  110121. message: "Aborted early because there isn't enough bandwidth to complete the request without rebuffering."
  110122. }, ABORT_EARLY_BLACKLIST_SECONDS);
  110123. });
  110124. var updateCodecs = function updateCodecs2() {
  110125. if (!_this4.sourceUpdater_.hasCreatedSourceBuffers()) {
  110126. return _this4.tryToCreateSourceBuffers_();
  110127. }
  110128. var codecs = _this4.getCodecsOrExclude_();
  110129. if (!codecs) {
  110130. return;
  110131. }
  110132. _this4.sourceUpdater_.addOrChangeSourceBuffers(codecs);
  110133. };
  110134. this.mainSegmentLoader_.on("trackinfo", updateCodecs);
  110135. this.audioSegmentLoader_.on("trackinfo", updateCodecs);
  110136. this.mainSegmentLoader_.on("fmp4", function() {
  110137. if (!_this4.triggeredFmp4Usage) {
  110138. _this4.tech_.trigger({
  110139. type: "usage",
  110140. name: "vhs-fmp4"
  110141. });
  110142. _this4.tech_.trigger({
  110143. type: "usage",
  110144. name: "hls-fmp4"
  110145. });
  110146. _this4.triggeredFmp4Usage = true;
  110147. }
  110148. });
  110149. this.audioSegmentLoader_.on("fmp4", function() {
  110150. if (!_this4.triggeredFmp4Usage) {
  110151. _this4.tech_.trigger({
  110152. type: "usage",
  110153. name: "vhs-fmp4"
  110154. });
  110155. _this4.tech_.trigger({
  110156. type: "usage",
  110157. name: "hls-fmp4"
  110158. });
  110159. _this4.triggeredFmp4Usage = true;
  110160. }
  110161. });
  110162. this.audioSegmentLoader_.on("ended", function() {
  110163. _this4.logger_("audioSegmentLoader ended");
  110164. _this4.onEndOfStream();
  110165. });
  110166. };
  110167. _proto.mediaSecondsLoaded_ = function mediaSecondsLoaded_() {
  110168. return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded + this.mainSegmentLoader_.mediaSecondsLoaded);
  110169. };
  110170. _proto.load = function load() {
  110171. this.mainSegmentLoader_.load();
  110172. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  110173. this.audioSegmentLoader_.load();
  110174. }
  110175. if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {
  110176. this.subtitleSegmentLoader_.load();
  110177. }
  110178. };
  110179. _proto.smoothQualityChange_ = function smoothQualityChange_(media) {
  110180. if (media === void 0) {
  110181. media = this.selectPlaylist();
  110182. }
  110183. this.fastQualityChange_(media);
  110184. };
  110185. _proto.fastQualityChange_ = function fastQualityChange_(media) {
  110186. var _this5 = this;
  110187. if (media === void 0) {
  110188. media = this.selectPlaylist();
  110189. }
  110190. if (media === this.masterPlaylistLoader_.media()) {
  110191. this.logger_("skipping fastQualityChange because new media is same as old");
  110192. return;
  110193. }
  110194. this.switchMedia_(media, "fast-quality");
  110195. this.mainSegmentLoader_.resetEverything(function() {
  110196. if (videojs.browser.IE_VERSION || videojs.browser.IS_EDGE) {
  110197. _this5.tech_.setCurrentTime(_this5.tech_.currentTime() + 0.04);
  110198. } else {
  110199. _this5.tech_.setCurrentTime(_this5.tech_.currentTime());
  110200. }
  110201. });
  110202. };
  110203. _proto.play = function play() {
  110204. if (this.setupFirstPlay()) {
  110205. return;
  110206. }
  110207. if (this.tech_.ended()) {
  110208. this.tech_.setCurrentTime(0);
  110209. }
  110210. if (this.hasPlayed_) {
  110211. this.load();
  110212. }
  110213. var seekable3 = this.tech_.seekable();
  110214. if (this.tech_.duration() === Infinity) {
  110215. if (this.tech_.currentTime() < seekable3.start(0)) {
  110216. return this.tech_.setCurrentTime(seekable3.end(seekable3.length - 1));
  110217. }
  110218. }
  110219. };
  110220. _proto.setupFirstPlay = function setupFirstPlay() {
  110221. var _this6 = this;
  110222. var media = this.masterPlaylistLoader_.media();
  110223. if (!media || this.tech_.paused() || this.hasPlayed_) {
  110224. return false;
  110225. }
  110226. if (!media.endList) {
  110227. var seekable3 = this.seekable();
  110228. if (!seekable3.length) {
  110229. return false;
  110230. }
  110231. if (videojs.browser.IE_VERSION && this.tech_.readyState() === 0) {
  110232. this.tech_.one("loadedmetadata", function() {
  110233. _this6.trigger("firstplay");
  110234. _this6.tech_.setCurrentTime(seekable3.end(0));
  110235. _this6.hasPlayed_ = true;
  110236. });
  110237. return false;
  110238. }
  110239. this.trigger("firstplay");
  110240. this.tech_.setCurrentTime(seekable3.end(0));
  110241. }
  110242. this.hasPlayed_ = true;
  110243. this.load();
  110244. return true;
  110245. };
  110246. _proto.handleSourceOpen_ = function handleSourceOpen_() {
  110247. this.tryToCreateSourceBuffers_();
  110248. if (this.tech_.autoplay()) {
  110249. var playPromise = this.tech_.play();
  110250. if (typeof playPromise !== "undefined" && typeof playPromise.then === "function") {
  110251. playPromise.then(null, function(e) {
  110252. });
  110253. }
  110254. }
  110255. this.trigger("sourceopen");
  110256. };
  110257. _proto.handleSourceEnded_ = function handleSourceEnded_() {
  110258. if (!this.inbandTextTracks_.metadataTrack_) {
  110259. return;
  110260. }
  110261. var cues = this.inbandTextTracks_.metadataTrack_.cues;
  110262. if (!cues || !cues.length) {
  110263. return;
  110264. }
  110265. var duration5 = this.duration();
  110266. cues[cues.length - 1].endTime = isNaN(duration5) || Math.abs(duration5) === Infinity ? Number.MAX_VALUE : duration5;
  110267. };
  110268. _proto.handleDurationChange_ = function handleDurationChange_() {
  110269. this.tech_.trigger("durationchange");
  110270. };
  110271. _proto.onEndOfStream = function onEndOfStream() {
  110272. var isEndOfStream = this.mainSegmentLoader_.ended_;
  110273. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  110274. var mainMediaInfo = this.mainSegmentLoader_.getCurrentMediaInfo_();
  110275. if (!mainMediaInfo || mainMediaInfo.hasVideo) {
  110276. isEndOfStream = isEndOfStream && this.audioSegmentLoader_.ended_;
  110277. } else {
  110278. isEndOfStream = this.audioSegmentLoader_.ended_;
  110279. }
  110280. }
  110281. if (!isEndOfStream) {
  110282. return;
  110283. }
  110284. this.stopABRTimer_();
  110285. this.sourceUpdater_.endOfStream();
  110286. };
  110287. _proto.stuckAtPlaylistEnd_ = function stuckAtPlaylistEnd_(playlist) {
  110288. var seekable3 = this.seekable();
  110289. if (!seekable3.length) {
  110290. return false;
  110291. }
  110292. var expired = this.syncController_.getExpiredTime(playlist, this.duration());
  110293. if (expired === null) {
  110294. return false;
  110295. }
  110296. var absolutePlaylistEnd = Vhs$1.Playlist.playlistEnd(playlist, expired);
  110297. var currentTime = this.tech_.currentTime();
  110298. var buffered = this.tech_.buffered();
  110299. if (!buffered.length) {
  110300. return absolutePlaylistEnd - currentTime <= SAFE_TIME_DELTA;
  110301. }
  110302. var bufferedEnd = buffered.end(buffered.length - 1);
  110303. return bufferedEnd - currentTime <= SAFE_TIME_DELTA && absolutePlaylistEnd - bufferedEnd <= SAFE_TIME_DELTA;
  110304. };
  110305. _proto.blacklistCurrentPlaylist = function blacklistCurrentPlaylist(error, blacklistDuration) {
  110306. if (error === void 0) {
  110307. error = {};
  110308. }
  110309. var currentPlaylist = error.playlist || this.masterPlaylistLoader_.media();
  110310. blacklistDuration = blacklistDuration || error.blacklistDuration || this.blacklistDuration;
  110311. if (!currentPlaylist) {
  110312. this.error = error;
  110313. if (this.mediaSource.readyState !== "open") {
  110314. this.trigger("error");
  110315. } else {
  110316. this.sourceUpdater_.endOfStream("network");
  110317. }
  110318. return;
  110319. }
  110320. currentPlaylist.playlistErrors_++;
  110321. var playlists = this.masterPlaylistLoader_.master.playlists;
  110322. var enabledPlaylists = playlists.filter(isEnabled);
  110323. var isFinalRendition = enabledPlaylists.length === 1 && enabledPlaylists[0] === currentPlaylist;
  110324. if (playlists.length === 1 && blacklistDuration !== Infinity) {
  110325. videojs.log.warn("Problem encountered with playlist " + currentPlaylist.id + ". Trying again since it is the only playlist.");
  110326. this.tech_.trigger("retryplaylist");
  110327. return this.masterPlaylistLoader_.load(isFinalRendition);
  110328. }
  110329. if (isFinalRendition) {
  110330. var reincluded = false;
  110331. playlists.forEach(function(playlist) {
  110332. if (playlist === currentPlaylist) {
  110333. return;
  110334. }
  110335. var excludeUntil2 = playlist.excludeUntil;
  110336. if (typeof excludeUntil2 !== "undefined" && excludeUntil2 !== Infinity) {
  110337. reincluded = true;
  110338. delete playlist.excludeUntil;
  110339. }
  110340. });
  110341. if (reincluded) {
  110342. videojs.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded.");
  110343. this.tech_.trigger("retryplaylist");
  110344. }
  110345. }
  110346. var excludeUntil;
  110347. if (currentPlaylist.playlistErrors_ > this.maxPlaylistRetries) {
  110348. excludeUntil = Infinity;
  110349. } else {
  110350. excludeUntil = Date.now() + blacklistDuration * 1e3;
  110351. }
  110352. currentPlaylist.excludeUntil = excludeUntil;
  110353. if (error.reason) {
  110354. currentPlaylist.lastExcludeReason_ = error.reason;
  110355. }
  110356. this.tech_.trigger("blacklistplaylist");
  110357. this.tech_.trigger({
  110358. type: "usage",
  110359. name: "vhs-rendition-blacklisted"
  110360. });
  110361. this.tech_.trigger({
  110362. type: "usage",
  110363. name: "hls-rendition-blacklisted"
  110364. });
  110365. var nextPlaylist = this.selectPlaylist();
  110366. if (!nextPlaylist) {
  110367. this.error = "Playback cannot continue. No available working or supported playlists.";
  110368. this.trigger("error");
  110369. return;
  110370. }
  110371. var logFn2 = error.internal ? this.logger_ : videojs.log.warn;
  110372. var errorMessage = error.message ? " " + error.message : "";
  110373. logFn2((error.internal ? "Internal problem" : "Problem") + " encountered with playlist " + currentPlaylist.id + "." + (errorMessage + " Switching to playlist " + nextPlaylist.id + "."));
  110374. if (nextPlaylist.attributes.AUDIO !== currentPlaylist.attributes.AUDIO) {
  110375. this.delegateLoaders_("audio", ["abort", "pause"]);
  110376. }
  110377. if (nextPlaylist.attributes.SUBTITLES !== currentPlaylist.attributes.SUBTITLES) {
  110378. this.delegateLoaders_("subtitle", ["abort", "pause"]);
  110379. }
  110380. this.delegateLoaders_("main", ["abort", "pause"]);
  110381. var delayDuration = nextPlaylist.targetDuration / 2 * 1e3 || 5 * 1e3;
  110382. var shouldDelay = typeof nextPlaylist.lastRequest === "number" && Date.now() - nextPlaylist.lastRequest <= delayDuration;
  110383. return this.switchMedia_(nextPlaylist, "exclude", isFinalRendition || shouldDelay);
  110384. };
  110385. _proto.pauseLoading = function pauseLoading() {
  110386. this.delegateLoaders_("all", ["abort", "pause"]);
  110387. this.stopABRTimer_();
  110388. };
  110389. _proto.delegateLoaders_ = function delegateLoaders_(filter, fnNames) {
  110390. var _this7 = this;
  110391. var loaders = [];
  110392. var dontFilterPlaylist = filter === "all";
  110393. if (dontFilterPlaylist || filter === "main") {
  110394. loaders.push(this.masterPlaylistLoader_);
  110395. }
  110396. var mediaTypes2 = [];
  110397. if (dontFilterPlaylist || filter === "audio") {
  110398. mediaTypes2.push("AUDIO");
  110399. }
  110400. if (dontFilterPlaylist || filter === "subtitle") {
  110401. mediaTypes2.push("CLOSED-CAPTIONS");
  110402. mediaTypes2.push("SUBTITLES");
  110403. }
  110404. mediaTypes2.forEach(function(mediaType) {
  110405. var loader = _this7.mediaTypes_[mediaType] && _this7.mediaTypes_[mediaType].activePlaylistLoader;
  110406. if (loader) {
  110407. loaders.push(loader);
  110408. }
  110409. });
  110410. ["main", "audio", "subtitle"].forEach(function(name) {
  110411. var loader = _this7[name + "SegmentLoader_"];
  110412. if (loader && (filter === name || filter === "all")) {
  110413. loaders.push(loader);
  110414. }
  110415. });
  110416. loaders.forEach(function(loader) {
  110417. return fnNames.forEach(function(fnName) {
  110418. if (typeof loader[fnName] === "function") {
  110419. loader[fnName]();
  110420. }
  110421. });
  110422. });
  110423. };
  110424. _proto.setCurrentTime = function setCurrentTime(currentTime) {
  110425. var buffered = findRange(this.tech_.buffered(), currentTime);
  110426. if (!(this.masterPlaylistLoader_ && this.masterPlaylistLoader_.media())) {
  110427. return 0;
  110428. }
  110429. if (!this.masterPlaylistLoader_.media().segments) {
  110430. return 0;
  110431. }
  110432. if (buffered && buffered.length) {
  110433. return currentTime;
  110434. }
  110435. this.mainSegmentLoader_.resetEverything();
  110436. this.mainSegmentLoader_.abort();
  110437. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  110438. this.audioSegmentLoader_.resetEverything();
  110439. this.audioSegmentLoader_.abort();
  110440. }
  110441. if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {
  110442. this.subtitleSegmentLoader_.resetEverything();
  110443. this.subtitleSegmentLoader_.abort();
  110444. }
  110445. this.load();
  110446. };
  110447. _proto.duration = function duration5() {
  110448. if (!this.masterPlaylistLoader_) {
  110449. return 0;
  110450. }
  110451. var media = this.masterPlaylistLoader_.media();
  110452. if (!media) {
  110453. return 0;
  110454. }
  110455. if (!media.endList) {
  110456. return Infinity;
  110457. }
  110458. if (this.mediaSource) {
  110459. return this.mediaSource.duration;
  110460. }
  110461. return Vhs$1.Playlist.duration(media);
  110462. };
  110463. _proto.seekable = function seekable3() {
  110464. return this.seekable_;
  110465. };
  110466. _proto.onSyncInfoUpdate_ = function onSyncInfoUpdate_() {
  110467. var audioSeekable;
  110468. if (!this.masterPlaylistLoader_) {
  110469. return;
  110470. }
  110471. var media = this.masterPlaylistLoader_.media();
  110472. if (!media) {
  110473. return;
  110474. }
  110475. var expired = this.syncController_.getExpiredTime(media, this.duration());
  110476. if (expired === null) {
  110477. return;
  110478. }
  110479. var master = this.masterPlaylistLoader_.master;
  110480. var mainSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(master, media));
  110481. if (mainSeekable.length === 0) {
  110482. return;
  110483. }
  110484. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  110485. media = this.mediaTypes_.AUDIO.activePlaylistLoader.media();
  110486. expired = this.syncController_.getExpiredTime(media, this.duration());
  110487. if (expired === null) {
  110488. return;
  110489. }
  110490. audioSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(master, media));
  110491. if (audioSeekable.length === 0) {
  110492. return;
  110493. }
  110494. }
  110495. var oldEnd;
  110496. var oldStart;
  110497. if (this.seekable_ && this.seekable_.length) {
  110498. oldEnd = this.seekable_.end(0);
  110499. oldStart = this.seekable_.start(0);
  110500. }
  110501. if (!audioSeekable) {
  110502. this.seekable_ = mainSeekable;
  110503. } else if (audioSeekable.start(0) > mainSeekable.end(0) || mainSeekable.start(0) > audioSeekable.end(0)) {
  110504. this.seekable_ = mainSeekable;
  110505. } else {
  110506. this.seekable_ = videojs.createTimeRanges([[audioSeekable.start(0) > mainSeekable.start(0) ? audioSeekable.start(0) : mainSeekable.start(0), audioSeekable.end(0) < mainSeekable.end(0) ? audioSeekable.end(0) : mainSeekable.end(0)]]);
  110507. }
  110508. if (this.seekable_ && this.seekable_.length) {
  110509. if (this.seekable_.end(0) === oldEnd && this.seekable_.start(0) === oldStart) {
  110510. return;
  110511. }
  110512. }
  110513. this.logger_("seekable updated [" + printableRange(this.seekable_) + "]");
  110514. this.tech_.trigger("seekablechanged");
  110515. };
  110516. _proto.updateDuration = function updateDuration(isLive) {
  110517. if (this.updateDuration_) {
  110518. this.mediaSource.removeEventListener("sourceopen", this.updateDuration_);
  110519. this.updateDuration_ = null;
  110520. }
  110521. if (this.mediaSource.readyState !== "open") {
  110522. this.updateDuration_ = this.updateDuration.bind(this, isLive);
  110523. this.mediaSource.addEventListener("sourceopen", this.updateDuration_);
  110524. return;
  110525. }
  110526. if (isLive) {
  110527. var seekable3 = this.seekable();
  110528. if (!seekable3.length) {
  110529. return;
  110530. }
  110531. if (isNaN(this.mediaSource.duration) || this.mediaSource.duration < seekable3.end(seekable3.length - 1)) {
  110532. this.sourceUpdater_.setDuration(seekable3.end(seekable3.length - 1));
  110533. }
  110534. return;
  110535. }
  110536. var buffered = this.tech_.buffered();
  110537. var duration5 = Vhs$1.Playlist.duration(this.masterPlaylistLoader_.media());
  110538. if (buffered.length > 0) {
  110539. duration5 = Math.max(duration5, buffered.end(buffered.length - 1));
  110540. }
  110541. if (this.mediaSource.duration !== duration5) {
  110542. this.sourceUpdater_.setDuration(duration5);
  110543. }
  110544. };
  110545. _proto.dispose = function dispose() {
  110546. var _this8 = this;
  110547. this.trigger("dispose");
  110548. this.decrypter_.terminate();
  110549. this.masterPlaylistLoader_.dispose();
  110550. this.mainSegmentLoader_.dispose();
  110551. if (this.loadOnPlay_) {
  110552. this.tech_.off("play", this.loadOnPlay_);
  110553. }
  110554. ["AUDIO", "SUBTITLES"].forEach(function(type2) {
  110555. var groups = _this8.mediaTypes_[type2].groups;
  110556. for (var id in groups) {
  110557. groups[id].forEach(function(group) {
  110558. if (group.playlistLoader) {
  110559. group.playlistLoader.dispose();
  110560. }
  110561. });
  110562. }
  110563. });
  110564. this.audioSegmentLoader_.dispose();
  110565. this.subtitleSegmentLoader_.dispose();
  110566. this.sourceUpdater_.dispose();
  110567. this.timelineChangeController_.dispose();
  110568. this.stopABRTimer_();
  110569. if (this.updateDuration_) {
  110570. this.mediaSource.removeEventListener("sourceopen", this.updateDuration_);
  110571. }
  110572. this.mediaSource.removeEventListener("durationchange", this.handleDurationChange_);
  110573. this.mediaSource.removeEventListener("sourceopen", this.handleSourceOpen_);
  110574. this.mediaSource.removeEventListener("sourceended", this.handleSourceEnded_);
  110575. this.off();
  110576. };
  110577. _proto.master = function master() {
  110578. return this.masterPlaylistLoader_.master;
  110579. };
  110580. _proto.media = function media() {
  110581. return this.masterPlaylistLoader_.media() || this.initialMedia_;
  110582. };
  110583. _proto.areMediaTypesKnown_ = function areMediaTypesKnown_() {
  110584. var usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader;
  110585. var hasMainMediaInfo = !!this.mainSegmentLoader_.getCurrentMediaInfo_();
  110586. var hasAudioMediaInfo = !usingAudioLoader ? true : !!this.audioSegmentLoader_.getCurrentMediaInfo_();
  110587. if (!hasMainMediaInfo || !hasAudioMediaInfo) {
  110588. return false;
  110589. }
  110590. return true;
  110591. };
  110592. _proto.getCodecsOrExclude_ = function getCodecsOrExclude_() {
  110593. var _this9 = this;
  110594. var media = {
  110595. main: this.mainSegmentLoader_.getCurrentMediaInfo_() || {},
  110596. audio: this.audioSegmentLoader_.getCurrentMediaInfo_() || {}
  110597. };
  110598. var playlist = this.mainSegmentLoader_.getPendingSegmentPlaylist() || this.media();
  110599. media.video = media.main;
  110600. var playlistCodecs = codecsForPlaylist(this.master(), playlist);
  110601. var codecs = {};
  110602. var usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader;
  110603. if (media.main.hasVideo) {
  110604. codecs.video = playlistCodecs.video || media.main.videoCodec || DEFAULT_VIDEO_CODEC;
  110605. }
  110606. if (media.main.isMuxed) {
  110607. codecs.video += "," + (playlistCodecs.audio || media.main.audioCodec || DEFAULT_AUDIO_CODEC);
  110608. }
  110609. if (media.main.hasAudio && !media.main.isMuxed || media.audio.hasAudio || usingAudioLoader) {
  110610. codecs.audio = playlistCodecs.audio || media.main.audioCodec || media.audio.audioCodec || DEFAULT_AUDIO_CODEC;
  110611. media.audio.isFmp4 = media.main.hasAudio && !media.main.isMuxed ? media.main.isFmp4 : media.audio.isFmp4;
  110612. }
  110613. if (!codecs.audio && !codecs.video) {
  110614. this.blacklistCurrentPlaylist({
  110615. playlist,
  110616. message: "Could not determine codecs for playlist.",
  110617. blacklistDuration: Infinity
  110618. });
  110619. return;
  110620. }
  110621. var supportFunction = function supportFunction2(isFmp4, codec) {
  110622. return isFmp4 ? browserSupportsCodec2(codec) : muxerSupportsCodec2(codec);
  110623. };
  110624. var unsupportedCodecs = {};
  110625. var unsupportedAudio;
  110626. ["video", "audio"].forEach(function(type2) {
  110627. if (codecs.hasOwnProperty(type2) && !supportFunction(media[type2].isFmp4, codecs[type2])) {
  110628. var supporter = media[type2].isFmp4 ? "browser" : "muxer";
  110629. unsupportedCodecs[supporter] = unsupportedCodecs[supporter] || [];
  110630. unsupportedCodecs[supporter].push(codecs[type2]);
  110631. if (type2 === "audio") {
  110632. unsupportedAudio = supporter;
  110633. }
  110634. }
  110635. });
  110636. if (usingAudioLoader && unsupportedAudio && playlist.attributes.AUDIO) {
  110637. var audioGroup = playlist.attributes.AUDIO;
  110638. this.master().playlists.forEach(function(variant) {
  110639. var variantAudioGroup = variant.attributes && variant.attributes.AUDIO;
  110640. if (variantAudioGroup === audioGroup && variant !== playlist) {
  110641. variant.excludeUntil = Infinity;
  110642. }
  110643. });
  110644. this.logger_("excluding audio group " + audioGroup + " as " + unsupportedAudio + ' does not support codec(s): "' + codecs.audio + '"');
  110645. }
  110646. if (Object.keys(unsupportedCodecs).length) {
  110647. var message = Object.keys(unsupportedCodecs).reduce(function(acc, supporter) {
  110648. if (acc) {
  110649. acc += ", ";
  110650. }
  110651. acc += supporter + ' does not support codec(s): "' + unsupportedCodecs[supporter].join(",") + '"';
  110652. return acc;
  110653. }, "") + ".";
  110654. this.blacklistCurrentPlaylist({
  110655. playlist,
  110656. internal: true,
  110657. message,
  110658. blacklistDuration: Infinity
  110659. });
  110660. return;
  110661. }
  110662. if (this.sourceUpdater_.hasCreatedSourceBuffers() && !this.sourceUpdater_.canChangeType()) {
  110663. var switchMessages = [];
  110664. ["video", "audio"].forEach(function(type2) {
  110665. var newCodec = (parseCodecs2(_this9.sourceUpdater_.codecs[type2] || "")[0] || {}).type;
  110666. var oldCodec = (parseCodecs2(codecs[type2] || "")[0] || {}).type;
  110667. if (newCodec && oldCodec && newCodec.toLowerCase() !== oldCodec.toLowerCase()) {
  110668. switchMessages.push('"' + _this9.sourceUpdater_.codecs[type2] + '" -> "' + codecs[type2] + '"');
  110669. }
  110670. });
  110671. if (switchMessages.length) {
  110672. this.blacklistCurrentPlaylist({
  110673. playlist,
  110674. message: "Codec switching not supported: " + switchMessages.join(", ") + ".",
  110675. blacklistDuration: Infinity,
  110676. internal: true
  110677. });
  110678. return;
  110679. }
  110680. }
  110681. return codecs;
  110682. };
  110683. _proto.tryToCreateSourceBuffers_ = function tryToCreateSourceBuffers_() {
  110684. if (this.mediaSource.readyState !== "open" || this.sourceUpdater_.hasCreatedSourceBuffers()) {
  110685. return;
  110686. }
  110687. if (!this.areMediaTypesKnown_()) {
  110688. return;
  110689. }
  110690. var codecs = this.getCodecsOrExclude_();
  110691. if (!codecs) {
  110692. return;
  110693. }
  110694. this.sourceUpdater_.createSourceBuffers(codecs);
  110695. var codecString = [codecs.video, codecs.audio].filter(Boolean).join(",");
  110696. this.excludeIncompatibleVariants_(codecString);
  110697. };
  110698. _proto.excludeUnsupportedVariants_ = function excludeUnsupportedVariants_() {
  110699. var _this10 = this;
  110700. var playlists = this.master().playlists;
  110701. var ids = [];
  110702. Object.keys(playlists).forEach(function(key) {
  110703. var variant = playlists[key];
  110704. if (ids.indexOf(variant.id) !== -1) {
  110705. return;
  110706. }
  110707. ids.push(variant.id);
  110708. var codecs = codecsForPlaylist(_this10.master, variant);
  110709. var unsupported = [];
  110710. if (codecs.audio && !muxerSupportsCodec2(codecs.audio) && !browserSupportsCodec2(codecs.audio)) {
  110711. unsupported.push("audio codec " + codecs.audio);
  110712. }
  110713. if (codecs.video && !muxerSupportsCodec2(codecs.video) && !browserSupportsCodec2(codecs.video)) {
  110714. unsupported.push("video codec " + codecs.video);
  110715. }
  110716. if (codecs.text && codecs.text === "stpp.ttml.im1t") {
  110717. unsupported.push("text codec " + codecs.text);
  110718. }
  110719. if (unsupported.length) {
  110720. variant.excludeUntil = Infinity;
  110721. _this10.logger_("excluding " + variant.id + " for unsupported: " + unsupported.join(", "));
  110722. }
  110723. });
  110724. };
  110725. _proto.excludeIncompatibleVariants_ = function excludeIncompatibleVariants_(codecString) {
  110726. var _this11 = this;
  110727. var ids = [];
  110728. var playlists = this.master().playlists;
  110729. var codecs = unwrapCodecList(parseCodecs2(codecString));
  110730. var codecCount_ = codecCount(codecs);
  110731. var videoDetails = codecs.video && parseCodecs2(codecs.video)[0] || null;
  110732. var audioDetails = codecs.audio && parseCodecs2(codecs.audio)[0] || null;
  110733. Object.keys(playlists).forEach(function(key) {
  110734. var variant = playlists[key];
  110735. if (ids.indexOf(variant.id) !== -1 || variant.excludeUntil === Infinity) {
  110736. return;
  110737. }
  110738. ids.push(variant.id);
  110739. var blacklistReasons = [];
  110740. var variantCodecs = codecsForPlaylist(_this11.masterPlaylistLoader_.master, variant);
  110741. var variantCodecCount = codecCount(variantCodecs);
  110742. if (!variantCodecs.audio && !variantCodecs.video) {
  110743. return;
  110744. }
  110745. if (variantCodecCount !== codecCount_) {
  110746. blacklistReasons.push('codec count "' + variantCodecCount + '" !== "' + codecCount_ + '"');
  110747. }
  110748. if (!_this11.sourceUpdater_.canChangeType()) {
  110749. var variantVideoDetails = variantCodecs.video && parseCodecs2(variantCodecs.video)[0] || null;
  110750. var variantAudioDetails = variantCodecs.audio && parseCodecs2(variantCodecs.audio)[0] || null;
  110751. if (variantVideoDetails && videoDetails && variantVideoDetails.type.toLowerCase() !== videoDetails.type.toLowerCase()) {
  110752. blacklistReasons.push('video codec "' + variantVideoDetails.type + '" !== "' + videoDetails.type + '"');
  110753. }
  110754. if (variantAudioDetails && audioDetails && variantAudioDetails.type.toLowerCase() !== audioDetails.type.toLowerCase()) {
  110755. blacklistReasons.push('audio codec "' + variantAudioDetails.type + '" !== "' + audioDetails.type + '"');
  110756. }
  110757. }
  110758. if (blacklistReasons.length) {
  110759. variant.excludeUntil = Infinity;
  110760. _this11.logger_("blacklisting " + variant.id + ": " + blacklistReasons.join(" && "));
  110761. }
  110762. });
  110763. };
  110764. _proto.updateAdCues_ = function updateAdCues_(media) {
  110765. var offset = 0;
  110766. var seekable3 = this.seekable();
  110767. if (seekable3.length) {
  110768. offset = seekable3.start(0);
  110769. }
  110770. updateAdCues(media, this.cueTagsTrack_, offset);
  110771. };
  110772. _proto.goalBufferLength = function goalBufferLength() {
  110773. var currentTime = this.tech_.currentTime();
  110774. var initial = Config.GOAL_BUFFER_LENGTH;
  110775. var rate = Config.GOAL_BUFFER_LENGTH_RATE;
  110776. var max2 = Math.max(initial, Config.MAX_GOAL_BUFFER_LENGTH);
  110777. return Math.min(initial + currentTime * rate, max2);
  110778. };
  110779. _proto.bufferLowWaterLine = function bufferLowWaterLine() {
  110780. var currentTime = this.tech_.currentTime();
  110781. var initial = Config.BUFFER_LOW_WATER_LINE;
  110782. var rate = Config.BUFFER_LOW_WATER_LINE_RATE;
  110783. var max2 = Math.max(initial, Config.MAX_BUFFER_LOW_WATER_LINE);
  110784. var newMax = Math.max(initial, Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);
  110785. return Math.min(initial + currentTime * rate, this.experimentalBufferBasedABR ? newMax : max2);
  110786. };
  110787. _proto.bufferHighWaterLine = function bufferHighWaterLine() {
  110788. return Config.BUFFER_HIGH_WATER_LINE;
  110789. };
  110790. return MasterPlaylistController2;
  110791. }(videojs.EventTarget);
  110792. var enableFunction = function enableFunction2(loader, playlistID, changePlaylistFn) {
  110793. return function(enable) {
  110794. var playlist = loader.master.playlists[playlistID];
  110795. var incompatible = isIncompatible(playlist);
  110796. var currentlyEnabled = isEnabled(playlist);
  110797. if (typeof enable === "undefined") {
  110798. return currentlyEnabled;
  110799. }
  110800. if (enable) {
  110801. delete playlist.disabled;
  110802. } else {
  110803. playlist.disabled = true;
  110804. }
  110805. if (enable !== currentlyEnabled && !incompatible) {
  110806. changePlaylistFn();
  110807. if (enable) {
  110808. loader.trigger("renditionenabled");
  110809. } else {
  110810. loader.trigger("renditiondisabled");
  110811. }
  110812. }
  110813. return enable;
  110814. };
  110815. };
  110816. var Representation = function Representation2(vhsHandler, playlist, id) {
  110817. var mpc = vhsHandler.masterPlaylistController_, smoothQualityChange = vhsHandler.options_.smoothQualityChange;
  110818. var changeType2 = smoothQualityChange ? "smooth" : "fast";
  110819. var qualityChangeFunction = mpc[changeType2 + "QualityChange_"].bind(mpc);
  110820. if (playlist.attributes) {
  110821. var resolution = playlist.attributes.RESOLUTION;
  110822. this.width = resolution && resolution.width;
  110823. this.height = resolution && resolution.height;
  110824. this.bandwidth = playlist.attributes.BANDWIDTH;
  110825. this.frameRate = playlist.attributes["FRAME-RATE"];
  110826. }
  110827. this.codecs = codecsForPlaylist(mpc.master(), playlist);
  110828. this.playlist = playlist;
  110829. this.id = id;
  110830. this.enabled = enableFunction(vhsHandler.playlists, playlist.id, qualityChangeFunction);
  110831. };
  110832. var renditionSelectionMixin = function renditionSelectionMixin2(vhsHandler) {
  110833. vhsHandler.representations = function() {
  110834. var master = vhsHandler.masterPlaylistController_.master();
  110835. var playlists = isAudioOnly(master) ? vhsHandler.masterPlaylistController_.getAudioTrackPlaylists_() : master.playlists;
  110836. if (!playlists) {
  110837. return [];
  110838. }
  110839. return playlists.filter(function(media) {
  110840. return !isIncompatible(media);
  110841. }).map(function(e, i2) {
  110842. return new Representation(vhsHandler, e, e.id);
  110843. });
  110844. };
  110845. };
  110846. var timerCancelEvents = ["seeking", "seeked", "pause", "playing", "error"];
  110847. var PlaybackWatcher = /* @__PURE__ */ function() {
  110848. function PlaybackWatcher2(options2) {
  110849. var _this = this;
  110850. this.masterPlaylistController_ = options2.masterPlaylistController;
  110851. this.tech_ = options2.tech;
  110852. this.seekable = options2.seekable;
  110853. this.allowSeeksWithinUnsafeLiveWindow = options2.allowSeeksWithinUnsafeLiveWindow;
  110854. this.liveRangeSafeTimeDelta = options2.liveRangeSafeTimeDelta;
  110855. this.media = options2.media;
  110856. this.consecutiveUpdates = 0;
  110857. this.lastRecordedTime = null;
  110858. this.timer_ = null;
  110859. this.checkCurrentTimeTimeout_ = null;
  110860. this.logger_ = logger("PlaybackWatcher");
  110861. this.logger_("initialize");
  110862. var playHandler = function playHandler2() {
  110863. return _this.monitorCurrentTime_();
  110864. };
  110865. var canPlayHandler = function canPlayHandler2() {
  110866. return _this.monitorCurrentTime_();
  110867. };
  110868. var waitingHandler = function waitingHandler2() {
  110869. return _this.techWaiting_();
  110870. };
  110871. var cancelTimerHandler = function cancelTimerHandler2() {
  110872. return _this.cancelTimer_();
  110873. };
  110874. var mpc = this.masterPlaylistController_;
  110875. var loaderTypes = ["main", "subtitle", "audio"];
  110876. var loaderChecks = {};
  110877. loaderTypes.forEach(function(type2) {
  110878. loaderChecks[type2] = {
  110879. reset: function reset3() {
  110880. return _this.resetSegmentDownloads_(type2);
  110881. },
  110882. updateend: function updateend() {
  110883. return _this.checkSegmentDownloads_(type2);
  110884. }
  110885. };
  110886. mpc[type2 + "SegmentLoader_"].on("appendsdone", loaderChecks[type2].updateend);
  110887. mpc[type2 + "SegmentLoader_"].on("playlistupdate", loaderChecks[type2].reset);
  110888. _this.tech_.on(["seeked", "seeking"], loaderChecks[type2].reset);
  110889. });
  110890. var setSeekingHandlers = function setSeekingHandlers2(fn2) {
  110891. ["main", "audio"].forEach(function(type2) {
  110892. mpc[type2 + "SegmentLoader_"][fn2]("appended", _this.seekingAppendCheck_);
  110893. });
  110894. };
  110895. this.seekingAppendCheck_ = function() {
  110896. if (_this.fixesBadSeeks_()) {
  110897. _this.consecutiveUpdates = 0;
  110898. _this.lastRecordedTime = _this.tech_.currentTime();
  110899. setSeekingHandlers("off");
  110900. }
  110901. };
  110902. this.clearSeekingAppendCheck_ = function() {
  110903. return setSeekingHandlers("off");
  110904. };
  110905. this.watchForBadSeeking_ = function() {
  110906. _this.clearSeekingAppendCheck_();
  110907. setSeekingHandlers("on");
  110908. };
  110909. this.tech_.on("seeked", this.clearSeekingAppendCheck_);
  110910. this.tech_.on("seeking", this.watchForBadSeeking_);
  110911. this.tech_.on("waiting", waitingHandler);
  110912. this.tech_.on(timerCancelEvents, cancelTimerHandler);
  110913. this.tech_.on("canplay", canPlayHandler);
  110914. this.tech_.one("play", playHandler);
  110915. this.dispose = function() {
  110916. _this.clearSeekingAppendCheck_();
  110917. _this.logger_("dispose");
  110918. _this.tech_.off("waiting", waitingHandler);
  110919. _this.tech_.off(timerCancelEvents, cancelTimerHandler);
  110920. _this.tech_.off("canplay", canPlayHandler);
  110921. _this.tech_.off("play", playHandler);
  110922. _this.tech_.off("seeking", _this.watchForBadSeeking_);
  110923. _this.tech_.off("seeked", _this.clearSeekingAppendCheck_);
  110924. loaderTypes.forEach(function(type2) {
  110925. mpc[type2 + "SegmentLoader_"].off("appendsdone", loaderChecks[type2].updateend);
  110926. mpc[type2 + "SegmentLoader_"].off("playlistupdate", loaderChecks[type2].reset);
  110927. _this.tech_.off(["seeked", "seeking"], loaderChecks[type2].reset);
  110928. });
  110929. if (_this.checkCurrentTimeTimeout_) {
  110930. window_1.clearTimeout(_this.checkCurrentTimeTimeout_);
  110931. }
  110932. _this.cancelTimer_();
  110933. };
  110934. }
  110935. var _proto = PlaybackWatcher2.prototype;
  110936. _proto.monitorCurrentTime_ = function monitorCurrentTime_() {
  110937. this.checkCurrentTime_();
  110938. if (this.checkCurrentTimeTimeout_) {
  110939. window_1.clearTimeout(this.checkCurrentTimeTimeout_);
  110940. }
  110941. this.checkCurrentTimeTimeout_ = window_1.setTimeout(this.monitorCurrentTime_.bind(this), 250);
  110942. };
  110943. _proto.resetSegmentDownloads_ = function resetSegmentDownloads_(type2) {
  110944. var loader = this.masterPlaylistController_[type2 + "SegmentLoader_"];
  110945. if (this[type2 + "StalledDownloads_"] > 0) {
  110946. this.logger_("resetting possible stalled download count for " + type2 + " loader");
  110947. }
  110948. this[type2 + "StalledDownloads_"] = 0;
  110949. this[type2 + "Buffered_"] = loader.buffered_();
  110950. };
  110951. _proto.checkSegmentDownloads_ = function checkSegmentDownloads_(type2) {
  110952. var mpc = this.masterPlaylistController_;
  110953. var loader = mpc[type2 + "SegmentLoader_"];
  110954. var buffered = loader.buffered_();
  110955. var isBufferedDifferent = isRangeDifferent(this[type2 + "Buffered_"], buffered);
  110956. this[type2 + "Buffered_"] = buffered;
  110957. if (isBufferedDifferent) {
  110958. this.resetSegmentDownloads_(type2);
  110959. return;
  110960. }
  110961. this[type2 + "StalledDownloads_"]++;
  110962. this.logger_("found #" + this[type2 + "StalledDownloads_"] + " " + type2 + " appends that did not increase buffer (possible stalled download)", {
  110963. playlistId: loader.playlist_ && loader.playlist_.id,
  110964. buffered: timeRangesToArray(buffered)
  110965. });
  110966. if (this[type2 + "StalledDownloads_"] < 10) {
  110967. return;
  110968. }
  110969. this.logger_(type2 + " loader stalled download exclusion");
  110970. this.resetSegmentDownloads_(type2);
  110971. this.tech_.trigger({
  110972. type: "usage",
  110973. name: "vhs-" + type2 + "-download-exclusion"
  110974. });
  110975. if (type2 === "subtitle") {
  110976. return;
  110977. }
  110978. mpc.blacklistCurrentPlaylist({
  110979. message: "Excessive " + type2 + " segment downloading detected."
  110980. }, Infinity);
  110981. };
  110982. _proto.checkCurrentTime_ = function checkCurrentTime_() {
  110983. if (this.tech_.paused() || this.tech_.seeking()) {
  110984. return;
  110985. }
  110986. var currentTime = this.tech_.currentTime();
  110987. var buffered = this.tech_.buffered();
  110988. if (this.lastRecordedTime === currentTime && (!buffered.length || currentTime + SAFE_TIME_DELTA >= buffered.end(buffered.length - 1))) {
  110989. return this.techWaiting_();
  110990. }
  110991. if (this.consecutiveUpdates >= 5 && currentTime === this.lastRecordedTime) {
  110992. this.consecutiveUpdates++;
  110993. this.waiting_();
  110994. } else if (currentTime === this.lastRecordedTime) {
  110995. this.consecutiveUpdates++;
  110996. } else {
  110997. this.consecutiveUpdates = 0;
  110998. this.lastRecordedTime = currentTime;
  110999. }
  111000. };
  111001. _proto.cancelTimer_ = function cancelTimer_() {
  111002. this.consecutiveUpdates = 0;
  111003. if (this.timer_) {
  111004. this.logger_("cancelTimer_");
  111005. clearTimeout(this.timer_);
  111006. }
  111007. this.timer_ = null;
  111008. };
  111009. _proto.fixesBadSeeks_ = function fixesBadSeeks_() {
  111010. var seeking = this.tech_.seeking();
  111011. if (!seeking) {
  111012. return false;
  111013. }
  111014. var seekable3 = this.seekable();
  111015. var currentTime = this.tech_.currentTime();
  111016. var isAfterSeekableRange = this.afterSeekableWindow_(seekable3, currentTime, this.media(), this.allowSeeksWithinUnsafeLiveWindow);
  111017. var seekTo;
  111018. if (isAfterSeekableRange) {
  111019. var seekableEnd = seekable3.end(seekable3.length - 1);
  111020. seekTo = seekableEnd;
  111021. }
  111022. if (this.beforeSeekableWindow_(seekable3, currentTime)) {
  111023. var seekableStart = seekable3.start(0);
  111024. seekTo = seekableStart + (seekableStart === seekable3.end(0) ? 0 : SAFE_TIME_DELTA);
  111025. }
  111026. if (typeof seekTo !== "undefined") {
  111027. this.logger_("Trying to seek outside of seekable at time " + currentTime + " with " + ("seekable range " + printableRange(seekable3) + ". Seeking to ") + (seekTo + "."));
  111028. this.tech_.setCurrentTime(seekTo);
  111029. return true;
  111030. }
  111031. var sourceUpdater = this.masterPlaylistController_.sourceUpdater_;
  111032. var buffered = this.tech_.buffered();
  111033. var audioBuffered = sourceUpdater.audioBuffer ? sourceUpdater.audioBuffered() : null;
  111034. var videoBuffered = sourceUpdater.videoBuffer ? sourceUpdater.videoBuffered() : null;
  111035. var media = this.media();
  111036. var minAppendedDuration = media.partTargetDuration ? media.partTargetDuration : (media.targetDuration - TIME_FUDGE_FACTOR) * 2;
  111037. var bufferedToCheck = [audioBuffered, videoBuffered];
  111038. for (var i2 = 0; i2 < bufferedToCheck.length; i2++) {
  111039. if (!bufferedToCheck[i2]) {
  111040. continue;
  111041. }
  111042. var timeAhead = timeAheadOf(bufferedToCheck[i2], currentTime);
  111043. if (timeAhead < minAppendedDuration) {
  111044. return false;
  111045. }
  111046. }
  111047. var nextRange = findNextRange(buffered, currentTime);
  111048. if (nextRange.length === 0) {
  111049. return false;
  111050. }
  111051. seekTo = nextRange.start(0) + SAFE_TIME_DELTA;
  111052. this.logger_("Buffered region starts (" + nextRange.start(0) + ") " + (" just beyond seek point (" + currentTime + "). Seeking to " + seekTo + "."));
  111053. this.tech_.setCurrentTime(seekTo);
  111054. return true;
  111055. };
  111056. _proto.waiting_ = function waiting_() {
  111057. if (this.techWaiting_()) {
  111058. return;
  111059. }
  111060. var currentTime = this.tech_.currentTime();
  111061. var buffered = this.tech_.buffered();
  111062. var currentRange = findRange(buffered, currentTime);
  111063. if (currentRange.length && currentTime + 3 <= currentRange.end(0)) {
  111064. this.cancelTimer_();
  111065. this.tech_.setCurrentTime(currentTime);
  111066. this.logger_("Stopped at " + currentTime + " while inside a buffered region " + ("[" + currentRange.start(0) + " -> " + currentRange.end(0) + "]. Attempting to resume ") + "playback by seeking to the current time.");
  111067. this.tech_.trigger({
  111068. type: "usage",
  111069. name: "vhs-unknown-waiting"
  111070. });
  111071. this.tech_.trigger({
  111072. type: "usage",
  111073. name: "hls-unknown-waiting"
  111074. });
  111075. return;
  111076. }
  111077. };
  111078. _proto.techWaiting_ = function techWaiting_() {
  111079. var seekable3 = this.seekable();
  111080. var currentTime = this.tech_.currentTime();
  111081. if (this.tech_.seeking() || this.timer_ !== null) {
  111082. return true;
  111083. }
  111084. if (this.beforeSeekableWindow_(seekable3, currentTime)) {
  111085. var livePoint = seekable3.end(seekable3.length - 1);
  111086. this.logger_("Fell out of live window at time " + currentTime + ". Seeking to " + ("live point (seekable end) " + livePoint));
  111087. this.cancelTimer_();
  111088. this.tech_.setCurrentTime(livePoint);
  111089. this.tech_.trigger({
  111090. type: "usage",
  111091. name: "vhs-live-resync"
  111092. });
  111093. this.tech_.trigger({
  111094. type: "usage",
  111095. name: "hls-live-resync"
  111096. });
  111097. return true;
  111098. }
  111099. var sourceUpdater = this.tech_.vhs.masterPlaylistController_.sourceUpdater_;
  111100. var buffered = this.tech_.buffered();
  111101. var videoUnderflow = this.videoUnderflow_({
  111102. audioBuffered: sourceUpdater.audioBuffered(),
  111103. videoBuffered: sourceUpdater.videoBuffered(),
  111104. currentTime
  111105. });
  111106. if (videoUnderflow) {
  111107. this.cancelTimer_();
  111108. this.tech_.setCurrentTime(currentTime);
  111109. this.tech_.trigger({
  111110. type: "usage",
  111111. name: "vhs-video-underflow"
  111112. });
  111113. this.tech_.trigger({
  111114. type: "usage",
  111115. name: "hls-video-underflow"
  111116. });
  111117. return true;
  111118. }
  111119. var nextRange = findNextRange(buffered, currentTime);
  111120. if (nextRange.length > 0) {
  111121. var difference = nextRange.start(0) - currentTime;
  111122. this.logger_("Stopped at " + currentTime + ", setting timer for " + difference + ", seeking " + ("to " + nextRange.start(0)));
  111123. this.cancelTimer_();
  111124. this.timer_ = setTimeout(this.skipTheGap_.bind(this), difference * 1e3, currentTime);
  111125. return true;
  111126. }
  111127. return false;
  111128. };
  111129. _proto.afterSeekableWindow_ = function afterSeekableWindow_(seekable3, currentTime, playlist, allowSeeksWithinUnsafeLiveWindow) {
  111130. if (allowSeeksWithinUnsafeLiveWindow === void 0) {
  111131. allowSeeksWithinUnsafeLiveWindow = false;
  111132. }
  111133. if (!seekable3.length) {
  111134. return false;
  111135. }
  111136. var allowedEnd = seekable3.end(seekable3.length - 1) + SAFE_TIME_DELTA;
  111137. var isLive = !playlist.endList;
  111138. if (isLive && allowSeeksWithinUnsafeLiveWindow) {
  111139. allowedEnd = seekable3.end(seekable3.length - 1) + playlist.targetDuration * 3;
  111140. }
  111141. if (currentTime > allowedEnd) {
  111142. return true;
  111143. }
  111144. return false;
  111145. };
  111146. _proto.beforeSeekableWindow_ = function beforeSeekableWindow_(seekable3, currentTime) {
  111147. if (seekable3.length && seekable3.start(0) > 0 && currentTime < seekable3.start(0) - this.liveRangeSafeTimeDelta) {
  111148. return true;
  111149. }
  111150. return false;
  111151. };
  111152. _proto.videoUnderflow_ = function videoUnderflow_(_ref) {
  111153. var videoBuffered = _ref.videoBuffered, audioBuffered = _ref.audioBuffered, currentTime = _ref.currentTime;
  111154. if (!videoBuffered) {
  111155. return;
  111156. }
  111157. var gap;
  111158. if (videoBuffered.length && audioBuffered.length) {
  111159. var lastVideoRange = findRange(videoBuffered, currentTime - 3);
  111160. var videoRange = findRange(videoBuffered, currentTime);
  111161. var audioRange = findRange(audioBuffered, currentTime);
  111162. if (audioRange.length && !videoRange.length && lastVideoRange.length) {
  111163. gap = {
  111164. start: lastVideoRange.end(0),
  111165. end: audioRange.end(0)
  111166. };
  111167. }
  111168. } else {
  111169. var nextRange = findNextRange(videoBuffered, currentTime);
  111170. if (!nextRange.length) {
  111171. gap = this.gapFromVideoUnderflow_(videoBuffered, currentTime);
  111172. }
  111173. }
  111174. if (gap) {
  111175. this.logger_("Encountered a gap in video from " + gap.start + " to " + gap.end + ". " + ("Seeking to current time " + currentTime));
  111176. return true;
  111177. }
  111178. return false;
  111179. };
  111180. _proto.skipTheGap_ = function skipTheGap_(scheduledCurrentTime) {
  111181. var buffered = this.tech_.buffered();
  111182. var currentTime = this.tech_.currentTime();
  111183. var nextRange = findNextRange(buffered, currentTime);
  111184. this.cancelTimer_();
  111185. if (nextRange.length === 0 || currentTime !== scheduledCurrentTime) {
  111186. return;
  111187. }
  111188. this.logger_("skipTheGap_:", "currentTime:", currentTime, "scheduled currentTime:", scheduledCurrentTime, "nextRange start:", nextRange.start(0));
  111189. this.tech_.setCurrentTime(nextRange.start(0) + TIME_FUDGE_FACTOR);
  111190. this.tech_.trigger({
  111191. type: "usage",
  111192. name: "vhs-gap-skip"
  111193. });
  111194. this.tech_.trigger({
  111195. type: "usage",
  111196. name: "hls-gap-skip"
  111197. });
  111198. };
  111199. _proto.gapFromVideoUnderflow_ = function gapFromVideoUnderflow_(buffered, currentTime) {
  111200. var gaps = findGaps(buffered);
  111201. for (var i2 = 0; i2 < gaps.length; i2++) {
  111202. var start2 = gaps.start(i2);
  111203. var end = gaps.end(i2);
  111204. if (currentTime - start2 < 4 && currentTime - start2 > 2) {
  111205. return {
  111206. start: start2,
  111207. end
  111208. };
  111209. }
  111210. }
  111211. return null;
  111212. };
  111213. return PlaybackWatcher2;
  111214. }();
  111215. var defaultOptions = {
  111216. errorInterval: 30,
  111217. getSource: function getSource(next) {
  111218. var tech = this.tech({
  111219. IWillNotUseThisInPlugins: true
  111220. });
  111221. var sourceObj = tech.currentSource_ || this.currentSource();
  111222. return next(sourceObj);
  111223. }
  111224. };
  111225. var initPlugin = function initPlugin2(player, options2) {
  111226. var lastCalled = 0;
  111227. var seekTo = 0;
  111228. var localOptions = videojs.mergeOptions(defaultOptions, options2);
  111229. player.ready(function() {
  111230. player.trigger({
  111231. type: "usage",
  111232. name: "vhs-error-reload-initialized"
  111233. });
  111234. player.trigger({
  111235. type: "usage",
  111236. name: "hls-error-reload-initialized"
  111237. });
  111238. });
  111239. var loadedMetadataHandler = function loadedMetadataHandler2() {
  111240. if (seekTo) {
  111241. player.currentTime(seekTo);
  111242. }
  111243. };
  111244. var setSource2 = function setSource3(sourceObj) {
  111245. if (sourceObj === null || sourceObj === void 0) {
  111246. return;
  111247. }
  111248. seekTo = player.duration() !== Infinity && player.currentTime() || 0;
  111249. player.one("loadedmetadata", loadedMetadataHandler);
  111250. player.src(sourceObj);
  111251. player.trigger({
  111252. type: "usage",
  111253. name: "vhs-error-reload"
  111254. });
  111255. player.trigger({
  111256. type: "usage",
  111257. name: "hls-error-reload"
  111258. });
  111259. player.play();
  111260. };
  111261. var errorHandler = function errorHandler2() {
  111262. if (Date.now() - lastCalled < localOptions.errorInterval * 1e3) {
  111263. player.trigger({
  111264. type: "usage",
  111265. name: "vhs-error-reload-canceled"
  111266. });
  111267. player.trigger({
  111268. type: "usage",
  111269. name: "hls-error-reload-canceled"
  111270. });
  111271. return;
  111272. }
  111273. if (!localOptions.getSource || typeof localOptions.getSource !== "function") {
  111274. videojs.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");
  111275. return;
  111276. }
  111277. lastCalled = Date.now();
  111278. return localOptions.getSource.call(player, setSource2);
  111279. };
  111280. var cleanupEvents = function cleanupEvents2() {
  111281. player.off("loadedmetadata", loadedMetadataHandler);
  111282. player.off("error", errorHandler);
  111283. player.off("dispose", cleanupEvents2);
  111284. };
  111285. var reinitPlugin = function reinitPlugin2(newOptions) {
  111286. cleanupEvents();
  111287. initPlugin2(player, newOptions);
  111288. };
  111289. player.on("error", errorHandler);
  111290. player.on("dispose", cleanupEvents);
  111291. player.reloadSourceOnError = reinitPlugin;
  111292. };
  111293. var reloadSourceOnError = function reloadSourceOnError2(options2) {
  111294. initPlugin(this, options2);
  111295. };
  111296. var version$4 = "2.16.2";
  111297. var version$3 = "6.0.1";
  111298. var version$2 = "0.22.1";
  111299. var version$1$1 = "4.8.0";
  111300. var version$6 = "3.1.3";
  111301. var Vhs = {
  111302. PlaylistLoader,
  111303. Playlist,
  111304. utils,
  111305. STANDARD_PLAYLIST_SELECTOR: lastBandwidthSelector,
  111306. INITIAL_PLAYLIST_SELECTOR: lowestBitrateCompatibleVariantSelector,
  111307. lastBandwidthSelector,
  111308. movingAverageBandwidthSelector,
  111309. comparePlaylistBandwidth,
  111310. comparePlaylistResolution,
  111311. xhr: xhrFactory()
  111312. };
  111313. Object.keys(Config).forEach(function(prop) {
  111314. Object.defineProperty(Vhs, prop, {
  111315. get: function get7() {
  111316. videojs.log.warn("using Vhs." + prop + " is UNSAFE be sure you know what you are doing");
  111317. return Config[prop];
  111318. },
  111319. set: function set4(value) {
  111320. videojs.log.warn("using Vhs." + prop + " is UNSAFE be sure you know what you are doing");
  111321. if (typeof value !== "number" || value < 0) {
  111322. videojs.log.warn("value of Vhs." + prop + " must be greater than or equal to 0");
  111323. return;
  111324. }
  111325. Config[prop] = value;
  111326. }
  111327. });
  111328. });
  111329. var LOCAL_STORAGE_KEY = "videojs-vhs";
  111330. var handleVhsMediaChange = function handleVhsMediaChange2(qualityLevels2, playlistLoader) {
  111331. var newPlaylist = playlistLoader.media();
  111332. var selectedIndex = -1;
  111333. for (var i2 = 0; i2 < qualityLevels2.length; i2++) {
  111334. if (qualityLevels2[i2].id === newPlaylist.id) {
  111335. selectedIndex = i2;
  111336. break;
  111337. }
  111338. }
  111339. qualityLevels2.selectedIndex_ = selectedIndex;
  111340. qualityLevels2.trigger({
  111341. selectedIndex,
  111342. type: "change"
  111343. });
  111344. };
  111345. var handleVhsLoadedMetadata = function handleVhsLoadedMetadata2(qualityLevels2, vhs) {
  111346. vhs.representations().forEach(function(rep2) {
  111347. qualityLevels2.addQualityLevel(rep2);
  111348. });
  111349. handleVhsMediaChange(qualityLevels2, vhs.playlists);
  111350. };
  111351. Vhs.canPlaySource = function() {
  111352. return videojs.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.");
  111353. };
  111354. var emeKeySystems = function emeKeySystems2(keySystemOptions, mainPlaylist, audioPlaylist) {
  111355. if (!keySystemOptions) {
  111356. return keySystemOptions;
  111357. }
  111358. var codecs = {};
  111359. if (mainPlaylist && mainPlaylist.attributes && mainPlaylist.attributes.CODECS) {
  111360. codecs = unwrapCodecList(parseCodecs2(mainPlaylist.attributes.CODECS));
  111361. }
  111362. if (audioPlaylist && audioPlaylist.attributes && audioPlaylist.attributes.CODECS) {
  111363. codecs.audio = audioPlaylist.attributes.CODECS;
  111364. }
  111365. var videoContentType = getMimeForCodec2(codecs.video);
  111366. var audioContentType = getMimeForCodec2(codecs.audio);
  111367. var keySystemContentTypes = {};
  111368. for (var keySystem in keySystemOptions) {
  111369. keySystemContentTypes[keySystem] = {};
  111370. if (audioContentType) {
  111371. keySystemContentTypes[keySystem].audioContentType = audioContentType;
  111372. }
  111373. if (videoContentType) {
  111374. keySystemContentTypes[keySystem].videoContentType = videoContentType;
  111375. }
  111376. if (mainPlaylist.contentProtection && mainPlaylist.contentProtection[keySystem] && mainPlaylist.contentProtection[keySystem].pssh) {
  111377. keySystemContentTypes[keySystem].pssh = mainPlaylist.contentProtection[keySystem].pssh;
  111378. }
  111379. if (typeof keySystemOptions[keySystem] === "string") {
  111380. keySystemContentTypes[keySystem].url = keySystemOptions[keySystem];
  111381. }
  111382. }
  111383. return videojs.mergeOptions(keySystemOptions, keySystemContentTypes);
  111384. };
  111385. var getAllPsshKeySystemsOptions = function getAllPsshKeySystemsOptions2(playlists, keySystems) {
  111386. return playlists.reduce(function(keySystemsArr, playlist) {
  111387. if (!playlist.contentProtection) {
  111388. return keySystemsArr;
  111389. }
  111390. var keySystemsOptions = keySystems.reduce(function(keySystemsObj, keySystem) {
  111391. var keySystemOptions = playlist.contentProtection[keySystem];
  111392. if (keySystemOptions && keySystemOptions.pssh) {
  111393. keySystemsObj[keySystem] = {
  111394. pssh: keySystemOptions.pssh
  111395. };
  111396. }
  111397. return keySystemsObj;
  111398. }, {});
  111399. if (Object.keys(keySystemsOptions).length) {
  111400. keySystemsArr.push(keySystemsOptions);
  111401. }
  111402. return keySystemsArr;
  111403. }, []);
  111404. };
  111405. var waitForKeySessionCreation = function waitForKeySessionCreation2(_ref) {
  111406. var player = _ref.player, sourceKeySystems = _ref.sourceKeySystems, audioMedia = _ref.audioMedia, mainPlaylists = _ref.mainPlaylists;
  111407. if (!player.eme.initializeMediaKeys) {
  111408. return Promise.resolve();
  111409. }
  111410. var playlists = audioMedia ? mainPlaylists.concat([audioMedia]) : mainPlaylists;
  111411. var keySystemsOptionsArr = getAllPsshKeySystemsOptions(playlists, Object.keys(sourceKeySystems));
  111412. var initializationFinishedPromises = [];
  111413. var keySessionCreatedPromises = [];
  111414. keySystemsOptionsArr.forEach(function(keySystemsOptions) {
  111415. keySessionCreatedPromises.push(new Promise(function(resolve2, reject2) {
  111416. player.tech_.one("keysessioncreated", resolve2);
  111417. }));
  111418. initializationFinishedPromises.push(new Promise(function(resolve2, reject2) {
  111419. player.eme.initializeMediaKeys({
  111420. keySystems: keySystemsOptions
  111421. }, function(err) {
  111422. if (err) {
  111423. reject2(err);
  111424. return;
  111425. }
  111426. resolve2();
  111427. });
  111428. }));
  111429. });
  111430. return Promise.race([
  111431. Promise.all(initializationFinishedPromises),
  111432. Promise.race(keySessionCreatedPromises)
  111433. ]);
  111434. };
  111435. var setupEmeOptions = function setupEmeOptions2(_ref2) {
  111436. var player = _ref2.player, sourceKeySystems = _ref2.sourceKeySystems, media = _ref2.media, audioMedia = _ref2.audioMedia;
  111437. var sourceOptions = emeKeySystems(sourceKeySystems, media, audioMedia);
  111438. if (!sourceOptions) {
  111439. return false;
  111440. }
  111441. player.currentSource().keySystems = sourceOptions;
  111442. if (sourceOptions && !player.eme) {
  111443. videojs.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin");
  111444. return false;
  111445. }
  111446. return true;
  111447. };
  111448. var getVhsLocalStorage = function getVhsLocalStorage2() {
  111449. if (!window_1.localStorage) {
  111450. return null;
  111451. }
  111452. var storedObject = window_1.localStorage.getItem(LOCAL_STORAGE_KEY);
  111453. if (!storedObject) {
  111454. return null;
  111455. }
  111456. try {
  111457. return JSON.parse(storedObject);
  111458. } catch (e) {
  111459. return null;
  111460. }
  111461. };
  111462. var updateVhsLocalStorage = function updateVhsLocalStorage2(options2) {
  111463. if (!window_1.localStorage) {
  111464. return false;
  111465. }
  111466. var objectToStore = getVhsLocalStorage();
  111467. objectToStore = objectToStore ? videojs.mergeOptions(objectToStore, options2) : options2;
  111468. try {
  111469. window_1.localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(objectToStore));
  111470. } catch (e) {
  111471. return false;
  111472. }
  111473. return objectToStore;
  111474. };
  111475. var expandDataUri = function expandDataUri2(dataUri) {
  111476. if (dataUri.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,") === 0) {
  111477. return JSON.parse(dataUri.substring(dataUri.indexOf(",") + 1));
  111478. }
  111479. return dataUri;
  111480. };
  111481. Vhs.supportsNativeHls = function() {
  111482. if (!document_1 || !document_1.createElement) {
  111483. return false;
  111484. }
  111485. var video = document_1.createElement("video");
  111486. if (!videojs.getTech("Html5").isSupported()) {
  111487. return false;
  111488. }
  111489. var canPlay = [
  111490. "application/vnd.apple.mpegurl",
  111491. "audio/mpegurl",
  111492. "audio/x-mpegurl",
  111493. "application/x-mpegurl",
  111494. "video/x-mpegurl",
  111495. "video/mpegurl",
  111496. "application/mpegurl"
  111497. ];
  111498. return canPlay.some(function(canItPlay) {
  111499. return /maybe|probably/i.test(video.canPlayType(canItPlay));
  111500. });
  111501. }();
  111502. Vhs.supportsNativeDash = function() {
  111503. if (!document_1 || !document_1.createElement || !videojs.getTech("Html5").isSupported()) {
  111504. return false;
  111505. }
  111506. return /maybe|probably/i.test(document_1.createElement("video").canPlayType("application/dash+xml"));
  111507. }();
  111508. Vhs.supportsTypeNatively = function(type2) {
  111509. if (type2 === "hls") {
  111510. return Vhs.supportsNativeHls;
  111511. }
  111512. if (type2 === "dash") {
  111513. return Vhs.supportsNativeDash;
  111514. }
  111515. return false;
  111516. };
  111517. Vhs.isSupported = function() {
  111518. return videojs.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.");
  111519. };
  111520. var Component = videojs.getComponent("Component");
  111521. var VhsHandler = /* @__PURE__ */ function(_Component) {
  111522. _inheritsLoose(VhsHandler2, _Component);
  111523. function VhsHandler2(source, tech, options2) {
  111524. var _this;
  111525. _this = _Component.call(this, tech, videojs.mergeOptions(options2.hls, options2.vhs)) || this;
  111526. if (options2.hls && Object.keys(options2.hls).length) {
  111527. videojs.log.warn("Using hls options is deprecated. Please rename `hls` to `vhs` in your options object.");
  111528. }
  111529. if (typeof options2.initialBandwidth === "number") {
  111530. _this.options_.bandwidth = options2.initialBandwidth;
  111531. }
  111532. _this.logger_ = logger("VhsHandler");
  111533. if (tech.options_ && tech.options_.playerId) {
  111534. var _player = videojs(tech.options_.playerId);
  111535. if (!_player.hasOwnProperty("hls")) {
  111536. Object.defineProperty(_player, "hls", {
  111537. get: function get7() {
  111538. videojs.log.warn("player.hls is deprecated. Use player.tech().vhs instead.");
  111539. tech.trigger({
  111540. type: "usage",
  111541. name: "hls-player-access"
  111542. });
  111543. return _assertThisInitialized(_this);
  111544. },
  111545. configurable: true
  111546. });
  111547. }
  111548. if (!_player.hasOwnProperty("vhs")) {
  111549. Object.defineProperty(_player, "vhs", {
  111550. get: function get7() {
  111551. videojs.log.warn("player.vhs is deprecated. Use player.tech().vhs instead.");
  111552. tech.trigger({
  111553. type: "usage",
  111554. name: "vhs-player-access"
  111555. });
  111556. return _assertThisInitialized(_this);
  111557. },
  111558. configurable: true
  111559. });
  111560. }
  111561. if (!_player.hasOwnProperty("dash")) {
  111562. Object.defineProperty(_player, "dash", {
  111563. get: function get7() {
  111564. videojs.log.warn("player.dash is deprecated. Use player.tech().vhs instead.");
  111565. return _assertThisInitialized(_this);
  111566. },
  111567. configurable: true
  111568. });
  111569. }
  111570. _this.player_ = _player;
  111571. }
  111572. _this.tech_ = tech;
  111573. _this.source_ = source;
  111574. _this.stats = {};
  111575. _this.ignoreNextSeekingEvent_ = false;
  111576. _this.setOptions_();
  111577. if (_this.options_.overrideNative && tech.overrideNativeAudioTracks && tech.overrideNativeVideoTracks) {
  111578. tech.overrideNativeAudioTracks(true);
  111579. tech.overrideNativeVideoTracks(true);
  111580. } else if (_this.options_.overrideNative && (tech.featuresNativeVideoTracks || tech.featuresNativeAudioTracks)) {
  111581. throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");
  111582. }
  111583. _this.on(document_1, ["fullscreenchange", "webkitfullscreenchange", "mozfullscreenchange", "MSFullscreenChange"], function(event2) {
  111584. var fullscreenElement = document_1.fullscreenElement || document_1.webkitFullscreenElement || document_1.mozFullScreenElement || document_1.msFullscreenElement;
  111585. if (fullscreenElement && fullscreenElement.contains(_this.tech_.el())) {
  111586. _this.masterPlaylistController_.fastQualityChange_();
  111587. } else {
  111588. _this.masterPlaylistController_.checkABR_();
  111589. }
  111590. });
  111591. _this.on(_this.tech_, "seeking", function() {
  111592. if (this.ignoreNextSeekingEvent_) {
  111593. this.ignoreNextSeekingEvent_ = false;
  111594. return;
  111595. }
  111596. this.setCurrentTime(this.tech_.currentTime());
  111597. });
  111598. _this.on(_this.tech_, "error", function() {
  111599. if (this.tech_.error() && this.masterPlaylistController_) {
  111600. this.masterPlaylistController_.pauseLoading();
  111601. }
  111602. });
  111603. _this.on(_this.tech_, "play", _this.play);
  111604. return _this;
  111605. }
  111606. var _proto = VhsHandler2.prototype;
  111607. _proto.setOptions_ = function setOptions_() {
  111608. var _this2 = this;
  111609. this.options_.withCredentials = this.options_.withCredentials || false;
  111610. this.options_.handleManifestRedirects = this.options_.handleManifestRedirects === false ? false : true;
  111611. this.options_.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions === false ? false : true;
  111612. this.options_.useDevicePixelRatio = this.options_.useDevicePixelRatio || false;
  111613. this.options_.smoothQualityChange = this.options_.smoothQualityChange || false;
  111614. this.options_.useBandwidthFromLocalStorage = typeof this.source_.useBandwidthFromLocalStorage !== "undefined" ? this.source_.useBandwidthFromLocalStorage : this.options_.useBandwidthFromLocalStorage || false;
  111615. this.options_.useNetworkInformationApi = this.options_.useNetworkInformationApi || false;
  111616. this.options_.useDtsForTimestampOffset = this.options_.useDtsForTimestampOffset || false;
  111617. this.options_.customTagParsers = this.options_.customTagParsers || [];
  111618. this.options_.customTagMappers = this.options_.customTagMappers || [];
  111619. this.options_.cacheEncryptionKeys = this.options_.cacheEncryptionKeys || false;
  111620. if (typeof this.options_.blacklistDuration !== "number") {
  111621. this.options_.blacklistDuration = 5 * 60;
  111622. }
  111623. if (typeof this.options_.bandwidth !== "number") {
  111624. if (this.options_.useBandwidthFromLocalStorage) {
  111625. var storedObject = getVhsLocalStorage();
  111626. if (storedObject && storedObject.bandwidth) {
  111627. this.options_.bandwidth = storedObject.bandwidth;
  111628. this.tech_.trigger({
  111629. type: "usage",
  111630. name: "vhs-bandwidth-from-local-storage"
  111631. });
  111632. this.tech_.trigger({
  111633. type: "usage",
  111634. name: "hls-bandwidth-from-local-storage"
  111635. });
  111636. }
  111637. if (storedObject && storedObject.throughput) {
  111638. this.options_.throughput = storedObject.throughput;
  111639. this.tech_.trigger({
  111640. type: "usage",
  111641. name: "vhs-throughput-from-local-storage"
  111642. });
  111643. this.tech_.trigger({
  111644. type: "usage",
  111645. name: "hls-throughput-from-local-storage"
  111646. });
  111647. }
  111648. }
  111649. }
  111650. if (typeof this.options_.bandwidth !== "number") {
  111651. this.options_.bandwidth = Config.INITIAL_BANDWIDTH;
  111652. }
  111653. this.options_.enableLowInitialPlaylist = this.options_.enableLowInitialPlaylist && this.options_.bandwidth === Config.INITIAL_BANDWIDTH;
  111654. ["withCredentials", "useDevicePixelRatio", "limitRenditionByPlayerDimensions", "bandwidth", "smoothQualityChange", "customTagParsers", "customTagMappers", "handleManifestRedirects", "cacheEncryptionKeys", "playlistSelector", "initialPlaylistSelector", "experimentalBufferBasedABR", "liveRangeSafeTimeDelta", "experimentalLLHLS", "useNetworkInformationApi", "useDtsForTimestampOffset", "experimentalExactManifestTimings", "experimentalLeastPixelDiffSelector"].forEach(function(option) {
  111655. if (typeof _this2.source_[option] !== "undefined") {
  111656. _this2.options_[option] = _this2.source_[option];
  111657. }
  111658. });
  111659. this.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions;
  111660. this.useDevicePixelRatio = this.options_.useDevicePixelRatio;
  111661. };
  111662. _proto.src = function src(_src, type2) {
  111663. var _this3 = this;
  111664. if (!_src) {
  111665. return;
  111666. }
  111667. this.setOptions_();
  111668. this.options_.src = expandDataUri(this.source_.src);
  111669. this.options_.tech = this.tech_;
  111670. this.options_.externVhs = Vhs;
  111671. this.options_.sourceType = simpleTypeFromSourceType2(type2);
  111672. this.options_.seekTo = function(time) {
  111673. _this3.tech_.setCurrentTime(time);
  111674. };
  111675. if (this.options_.smoothQualityChange) {
  111676. videojs.log.warn("smoothQualityChange is deprecated and will be removed in the next major version");
  111677. }
  111678. this.masterPlaylistController_ = new MasterPlaylistController(this.options_);
  111679. var playbackWatcherOptions = videojs.mergeOptions({
  111680. liveRangeSafeTimeDelta: SAFE_TIME_DELTA
  111681. }, this.options_, {
  111682. seekable: function seekable3() {
  111683. return _this3.seekable();
  111684. },
  111685. media: function media() {
  111686. return _this3.masterPlaylistController_.media();
  111687. },
  111688. masterPlaylistController: this.masterPlaylistController_
  111689. });
  111690. this.playbackWatcher_ = new PlaybackWatcher(playbackWatcherOptions);
  111691. this.masterPlaylistController_.on("error", function() {
  111692. var player = videojs.players[_this3.tech_.options_.playerId];
  111693. var error = _this3.masterPlaylistController_.error;
  111694. if (typeof error === "object" && !error.code) {
  111695. error.code = 3;
  111696. } else if (typeof error === "string") {
  111697. error = {
  111698. message: error,
  111699. code: 3
  111700. };
  111701. }
  111702. player.error(error);
  111703. });
  111704. var defaultSelector = this.options_.experimentalBufferBasedABR ? Vhs.movingAverageBandwidthSelector(0.55) : Vhs.STANDARD_PLAYLIST_SELECTOR;
  111705. this.masterPlaylistController_.selectPlaylist = this.selectPlaylist ? this.selectPlaylist.bind(this) : defaultSelector.bind(this);
  111706. this.masterPlaylistController_.selectInitialPlaylist = Vhs.INITIAL_PLAYLIST_SELECTOR.bind(this);
  111707. this.playlists = this.masterPlaylistController_.masterPlaylistLoader_;
  111708. this.mediaSource = this.masterPlaylistController_.mediaSource;
  111709. Object.defineProperties(this, {
  111710. selectPlaylist: {
  111711. get: function get7() {
  111712. return this.masterPlaylistController_.selectPlaylist;
  111713. },
  111714. set: function set4(selectPlaylist) {
  111715. this.masterPlaylistController_.selectPlaylist = selectPlaylist.bind(this);
  111716. }
  111717. },
  111718. throughput: {
  111719. get: function get7() {
  111720. return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate;
  111721. },
  111722. set: function set4(throughput) {
  111723. this.masterPlaylistController_.mainSegmentLoader_.throughput.rate = throughput;
  111724. this.masterPlaylistController_.mainSegmentLoader_.throughput.count = 1;
  111725. }
  111726. },
  111727. bandwidth: {
  111728. get: function get7() {
  111729. var playerBandwidthEst = this.masterPlaylistController_.mainSegmentLoader_.bandwidth;
  111730. var networkInformation = window_1.navigator.connection || window_1.navigator.mozConnection || window_1.navigator.webkitConnection;
  111731. var tenMbpsAsBitsPerSecond = 1e7;
  111732. if (this.options_.useNetworkInformationApi && networkInformation) {
  111733. var networkInfoBandwidthEstBitsPerSec = networkInformation.downlink * 1e3 * 1e3;
  111734. if (networkInfoBandwidthEstBitsPerSec >= tenMbpsAsBitsPerSecond && playerBandwidthEst >= tenMbpsAsBitsPerSecond) {
  111735. playerBandwidthEst = Math.max(playerBandwidthEst, networkInfoBandwidthEstBitsPerSec);
  111736. } else {
  111737. playerBandwidthEst = networkInfoBandwidthEstBitsPerSec;
  111738. }
  111739. }
  111740. return playerBandwidthEst;
  111741. },
  111742. set: function set4(bandwidth2) {
  111743. this.masterPlaylistController_.mainSegmentLoader_.bandwidth = bandwidth2;
  111744. this.masterPlaylistController_.mainSegmentLoader_.throughput = {
  111745. rate: 0,
  111746. count: 0
  111747. };
  111748. }
  111749. },
  111750. systemBandwidth: {
  111751. get: function get7() {
  111752. var invBandwidth = 1 / (this.bandwidth || 1);
  111753. var invThroughput;
  111754. if (this.throughput > 0) {
  111755. invThroughput = 1 / this.throughput;
  111756. } else {
  111757. invThroughput = 0;
  111758. }
  111759. var systemBitrate = Math.floor(1 / (invBandwidth + invThroughput));
  111760. return systemBitrate;
  111761. },
  111762. set: function set4() {
  111763. videojs.log.error('The "systemBandwidth" property is read-only');
  111764. }
  111765. }
  111766. });
  111767. if (this.options_.bandwidth) {
  111768. this.bandwidth = this.options_.bandwidth;
  111769. }
  111770. if (this.options_.throughput) {
  111771. this.throughput = this.options_.throughput;
  111772. }
  111773. Object.defineProperties(this.stats, {
  111774. bandwidth: {
  111775. get: function get7() {
  111776. return _this3.bandwidth || 0;
  111777. },
  111778. enumerable: true
  111779. },
  111780. mediaRequests: {
  111781. get: function get7() {
  111782. return _this3.masterPlaylistController_.mediaRequests_() || 0;
  111783. },
  111784. enumerable: true
  111785. },
  111786. mediaRequestsAborted: {
  111787. get: function get7() {
  111788. return _this3.masterPlaylistController_.mediaRequestsAborted_() || 0;
  111789. },
  111790. enumerable: true
  111791. },
  111792. mediaRequestsTimedout: {
  111793. get: function get7() {
  111794. return _this3.masterPlaylistController_.mediaRequestsTimedout_() || 0;
  111795. },
  111796. enumerable: true
  111797. },
  111798. mediaRequestsErrored: {
  111799. get: function get7() {
  111800. return _this3.masterPlaylistController_.mediaRequestsErrored_() || 0;
  111801. },
  111802. enumerable: true
  111803. },
  111804. mediaTransferDuration: {
  111805. get: function get7() {
  111806. return _this3.masterPlaylistController_.mediaTransferDuration_() || 0;
  111807. },
  111808. enumerable: true
  111809. },
  111810. mediaBytesTransferred: {
  111811. get: function get7() {
  111812. return _this3.masterPlaylistController_.mediaBytesTransferred_() || 0;
  111813. },
  111814. enumerable: true
  111815. },
  111816. mediaSecondsLoaded: {
  111817. get: function get7() {
  111818. return _this3.masterPlaylistController_.mediaSecondsLoaded_() || 0;
  111819. },
  111820. enumerable: true
  111821. },
  111822. mediaAppends: {
  111823. get: function get7() {
  111824. return _this3.masterPlaylistController_.mediaAppends_() || 0;
  111825. },
  111826. enumerable: true
  111827. },
  111828. mainAppendsToLoadedData: {
  111829. get: function get7() {
  111830. return _this3.masterPlaylistController_.mainAppendsToLoadedData_() || 0;
  111831. },
  111832. enumerable: true
  111833. },
  111834. audioAppendsToLoadedData: {
  111835. get: function get7() {
  111836. return _this3.masterPlaylistController_.audioAppendsToLoadedData_() || 0;
  111837. },
  111838. enumerable: true
  111839. },
  111840. appendsToLoadedData: {
  111841. get: function get7() {
  111842. return _this3.masterPlaylistController_.appendsToLoadedData_() || 0;
  111843. },
  111844. enumerable: true
  111845. },
  111846. timeToLoadedData: {
  111847. get: function get7() {
  111848. return _this3.masterPlaylistController_.timeToLoadedData_() || 0;
  111849. },
  111850. enumerable: true
  111851. },
  111852. buffered: {
  111853. get: function get7() {
  111854. return timeRangesToArray(_this3.tech_.buffered());
  111855. },
  111856. enumerable: true
  111857. },
  111858. currentTime: {
  111859. get: function get7() {
  111860. return _this3.tech_.currentTime();
  111861. },
  111862. enumerable: true
  111863. },
  111864. currentSource: {
  111865. get: function get7() {
  111866. return _this3.tech_.currentSource_;
  111867. },
  111868. enumerable: true
  111869. },
  111870. currentTech: {
  111871. get: function get7() {
  111872. return _this3.tech_.name_;
  111873. },
  111874. enumerable: true
  111875. },
  111876. duration: {
  111877. get: function get7() {
  111878. return _this3.tech_.duration();
  111879. },
  111880. enumerable: true
  111881. },
  111882. master: {
  111883. get: function get7() {
  111884. return _this3.playlists.master;
  111885. },
  111886. enumerable: true
  111887. },
  111888. playerDimensions: {
  111889. get: function get7() {
  111890. return _this3.tech_.currentDimensions();
  111891. },
  111892. enumerable: true
  111893. },
  111894. seekable: {
  111895. get: function get7() {
  111896. return timeRangesToArray(_this3.tech_.seekable());
  111897. },
  111898. enumerable: true
  111899. },
  111900. timestamp: {
  111901. get: function get7() {
  111902. return Date.now();
  111903. },
  111904. enumerable: true
  111905. },
  111906. videoPlaybackQuality: {
  111907. get: function get7() {
  111908. return _this3.tech_.getVideoPlaybackQuality();
  111909. },
  111910. enumerable: true
  111911. }
  111912. });
  111913. this.tech_.one("canplay", this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_));
  111914. this.tech_.on("bandwidthupdate", function() {
  111915. if (_this3.options_.useBandwidthFromLocalStorage) {
  111916. updateVhsLocalStorage({
  111917. bandwidth: _this3.bandwidth,
  111918. throughput: Math.round(_this3.throughput)
  111919. });
  111920. }
  111921. });
  111922. this.masterPlaylistController_.on("selectedinitialmedia", function() {
  111923. renditionSelectionMixin(_this3);
  111924. });
  111925. this.masterPlaylistController_.sourceUpdater_.on("createdsourcebuffers", function() {
  111926. _this3.setupEme_();
  111927. });
  111928. this.on(this.masterPlaylistController_, "progress", function() {
  111929. this.tech_.trigger("progress");
  111930. });
  111931. this.on(this.masterPlaylistController_, "firstplay", function() {
  111932. this.ignoreNextSeekingEvent_ = true;
  111933. });
  111934. this.setupQualityLevels_();
  111935. if (!this.tech_.el()) {
  111936. return;
  111937. }
  111938. this.mediaSourceUrl_ = window_1.URL.createObjectURL(this.masterPlaylistController_.mediaSource);
  111939. this.tech_.src(this.mediaSourceUrl_);
  111940. };
  111941. _proto.createKeySessions_ = function createKeySessions_() {
  111942. var _this4 = this;
  111943. var audioPlaylistLoader = this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;
  111944. this.logger_("waiting for EME key session creation");
  111945. waitForKeySessionCreation({
  111946. player: this.player_,
  111947. sourceKeySystems: this.source_.keySystems,
  111948. audioMedia: audioPlaylistLoader && audioPlaylistLoader.media(),
  111949. mainPlaylists: this.playlists.master.playlists
  111950. }).then(function() {
  111951. _this4.logger_("created EME key session");
  111952. _this4.masterPlaylistController_.sourceUpdater_.initializedEme();
  111953. })["catch"](function(err) {
  111954. _this4.logger_("error while creating EME key session", err);
  111955. _this4.player_.error({
  111956. message: "Failed to initialize media keys for EME",
  111957. code: 3
  111958. });
  111959. });
  111960. };
  111961. _proto.handleWaitingForKey_ = function handleWaitingForKey_() {
  111962. this.logger_("waitingforkey fired, attempting to create any new key sessions");
  111963. this.createKeySessions_();
  111964. };
  111965. _proto.setupEme_ = function setupEme_() {
  111966. var _this5 = this;
  111967. var audioPlaylistLoader = this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;
  111968. var didSetupEmeOptions = setupEmeOptions({
  111969. player: this.player_,
  111970. sourceKeySystems: this.source_.keySystems,
  111971. media: this.playlists.media(),
  111972. audioMedia: audioPlaylistLoader && audioPlaylistLoader.media()
  111973. });
  111974. this.player_.tech_.on("keystatuschange", function(e) {
  111975. if (e.status !== "output-restricted") {
  111976. return;
  111977. }
  111978. var masterPlaylist = _this5.masterPlaylistController_.master();
  111979. if (!masterPlaylist || !masterPlaylist.playlists) {
  111980. return;
  111981. }
  111982. var excludedHDPlaylists = [];
  111983. masterPlaylist.playlists.forEach(function(playlist) {
  111984. if (playlist && playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height >= 720) {
  111985. if (!playlist.excludeUntil || playlist.excludeUntil < Infinity) {
  111986. playlist.excludeUntil = Infinity;
  111987. excludedHDPlaylists.push(playlist);
  111988. }
  111989. }
  111990. });
  111991. if (excludedHDPlaylists.length) {
  111992. var _videojs$log;
  111993. (_videojs$log = videojs.log).warn.apply(_videojs$log, ['DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.'].concat(excludedHDPlaylists));
  111994. _this5.masterPlaylistController_.fastQualityChange_();
  111995. }
  111996. });
  111997. this.handleWaitingForKey_ = this.handleWaitingForKey_.bind(this);
  111998. this.player_.tech_.on("waitingforkey", this.handleWaitingForKey_);
  111999. if (videojs.browser.IE_VERSION === 11 || !didSetupEmeOptions) {
  112000. this.masterPlaylistController_.sourceUpdater_.initializedEme();
  112001. return;
  112002. }
  112003. this.createKeySessions_();
  112004. };
  112005. _proto.setupQualityLevels_ = function setupQualityLevels_() {
  112006. var _this6 = this;
  112007. var player = videojs.players[this.tech_.options_.playerId];
  112008. if (!player || !player.qualityLevels || this.qualityLevels_) {
  112009. return;
  112010. }
  112011. this.qualityLevels_ = player.qualityLevels();
  112012. this.masterPlaylistController_.on("selectedinitialmedia", function() {
  112013. handleVhsLoadedMetadata(_this6.qualityLevels_, _this6);
  112014. });
  112015. this.playlists.on("mediachange", function() {
  112016. handleVhsMediaChange(_this6.qualityLevels_, _this6.playlists);
  112017. });
  112018. };
  112019. VhsHandler2.version = function version$52() {
  112020. return {
  112021. "@videojs/http-streaming": version$4,
  112022. "mux.js": version$3,
  112023. "mpd-parser": version$2,
  112024. "m3u8-parser": version$1$1,
  112025. "aes-decrypter": version$6
  112026. };
  112027. };
  112028. _proto.version = function version2() {
  112029. return this.constructor.version();
  112030. };
  112031. _proto.canChangeType = function canChangeType() {
  112032. return SourceUpdater.canChangeType();
  112033. };
  112034. _proto.play = function play() {
  112035. this.masterPlaylistController_.play();
  112036. };
  112037. _proto.setCurrentTime = function setCurrentTime(currentTime) {
  112038. this.masterPlaylistController_.setCurrentTime(currentTime);
  112039. };
  112040. _proto.duration = function duration5() {
  112041. return this.masterPlaylistController_.duration();
  112042. };
  112043. _proto.seekable = function seekable3() {
  112044. return this.masterPlaylistController_.seekable();
  112045. };
  112046. _proto.dispose = function dispose() {
  112047. if (this.playbackWatcher_) {
  112048. this.playbackWatcher_.dispose();
  112049. }
  112050. if (this.masterPlaylistController_) {
  112051. this.masterPlaylistController_.dispose();
  112052. }
  112053. if (this.qualityLevels_) {
  112054. this.qualityLevels_.dispose();
  112055. }
  112056. if (this.player_) {
  112057. delete this.player_.vhs;
  112058. delete this.player_.dash;
  112059. delete this.player_.hls;
  112060. }
  112061. if (this.tech_ && this.tech_.vhs) {
  112062. delete this.tech_.vhs;
  112063. }
  112064. if (this.tech_) {
  112065. delete this.tech_.hls;
  112066. }
  112067. if (this.mediaSourceUrl_ && window_1.URL.revokeObjectURL) {
  112068. window_1.URL.revokeObjectURL(this.mediaSourceUrl_);
  112069. this.mediaSourceUrl_ = null;
  112070. }
  112071. if (this.tech_) {
  112072. this.tech_.off("waitingforkey", this.handleWaitingForKey_);
  112073. }
  112074. _Component.prototype.dispose.call(this);
  112075. };
  112076. _proto.convertToProgramTime = function convertToProgramTime(time, callback2) {
  112077. return getProgramTime({
  112078. playlist: this.masterPlaylistController_.media(),
  112079. time,
  112080. callback: callback2
  112081. });
  112082. };
  112083. _proto.seekToProgramTime = function seekToProgramTime$12(programTime, callback2, pauseAfterSeek, retryCount) {
  112084. if (pauseAfterSeek === void 0) {
  112085. pauseAfterSeek = true;
  112086. }
  112087. if (retryCount === void 0) {
  112088. retryCount = 2;
  112089. }
  112090. return seekToProgramTime({
  112091. programTime,
  112092. playlist: this.masterPlaylistController_.media(),
  112093. retryCount,
  112094. pauseAfterSeek,
  112095. seekTo: this.options_.seekTo,
  112096. tech: this.options_.tech,
  112097. callback: callback2
  112098. });
  112099. };
  112100. return VhsHandler2;
  112101. }(Component);
  112102. var VhsSourceHandler = {
  112103. name: "videojs-http-streaming",
  112104. VERSION: version$4,
  112105. canHandleSource: function canHandleSource(srcObj, options2) {
  112106. if (options2 === void 0) {
  112107. options2 = {};
  112108. }
  112109. var localOptions = videojs.mergeOptions(videojs.options, options2);
  112110. return VhsSourceHandler.canPlayType(srcObj.type, localOptions);
  112111. },
  112112. handleSource: function handleSource(source, tech, options2) {
  112113. if (options2 === void 0) {
  112114. options2 = {};
  112115. }
  112116. var localOptions = videojs.mergeOptions(videojs.options, options2);
  112117. tech.vhs = new VhsHandler(source, tech, localOptions);
  112118. if (!videojs.hasOwnProperty("hls")) {
  112119. Object.defineProperty(tech, "hls", {
  112120. get: function get7() {
  112121. videojs.log.warn("player.tech().hls is deprecated. Use player.tech().vhs instead.");
  112122. return tech.vhs;
  112123. },
  112124. configurable: true
  112125. });
  112126. }
  112127. tech.vhs.xhr = xhrFactory();
  112128. tech.vhs.src(source.src, source.type);
  112129. return tech.vhs;
  112130. },
  112131. canPlayType: function canPlayType2(type2, options2) {
  112132. var simpleType = simpleTypeFromSourceType2(type2);
  112133. if (!simpleType) {
  112134. return "";
  112135. }
  112136. var overrideNative = VhsSourceHandler.getOverrideNative(options2);
  112137. var supportsTypeNatively = Vhs.supportsTypeNatively(simpleType);
  112138. var canUseMsePlayback = !supportsTypeNatively || overrideNative;
  112139. return canUseMsePlayback ? "maybe" : "";
  112140. },
  112141. getOverrideNative: function getOverrideNative(options2) {
  112142. if (options2 === void 0) {
  112143. options2 = {};
  112144. }
  112145. var _options = options2, _options$vhs = _options.vhs, vhs = _options$vhs === void 0 ? {} : _options$vhs, _options$hls = _options.hls, hls = _options$hls === void 0 ? {} : _options$hls;
  112146. var defaultOverrideNative = !(videojs.browser.IS_ANY_SAFARI || videojs.browser.IS_IOS);
  112147. var _vhs$overrideNative = vhs.overrideNative, overrideNative = _vhs$overrideNative === void 0 ? defaultOverrideNative : _vhs$overrideNative;
  112148. var _hls$overrideNative = hls.overrideNative, legacyOverrideNative = _hls$overrideNative === void 0 ? false : _hls$overrideNative;
  112149. return legacyOverrideNative || overrideNative;
  112150. }
  112151. };
  112152. var supportsNativeMediaSources = function supportsNativeMediaSources2() {
  112153. return browserSupportsCodec2("avc1.4d400d,mp4a.40.2");
  112154. };
  112155. if (supportsNativeMediaSources()) {
  112156. videojs.getTech("Html5").registerSourceHandler(VhsSourceHandler, 0);
  112157. }
  112158. videojs.VhsHandler = VhsHandler;
  112159. Object.defineProperty(videojs, "HlsHandler", {
  112160. get: function get4() {
  112161. videojs.log.warn("videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead.");
  112162. return VhsHandler;
  112163. },
  112164. configurable: true
  112165. });
  112166. videojs.VhsSourceHandler = VhsSourceHandler;
  112167. Object.defineProperty(videojs, "HlsSourceHandler", {
  112168. get: function get5() {
  112169. videojs.log.warn("videojs.HlsSourceHandler is deprecated. Use videojs.VhsSourceHandler instead.");
  112170. return VhsSourceHandler;
  112171. },
  112172. configurable: true
  112173. });
  112174. videojs.Vhs = Vhs;
  112175. Object.defineProperty(videojs, "Hls", {
  112176. get: function get6() {
  112177. videojs.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead.");
  112178. return Vhs;
  112179. },
  112180. configurable: true
  112181. });
  112182. if (!videojs.use) {
  112183. videojs.registerComponent("Hls", Vhs);
  112184. videojs.registerComponent("Vhs", Vhs);
  112185. }
  112186. videojs.options.vhs = videojs.options.vhs || {};
  112187. videojs.options.hls = videojs.options.hls || {};
  112188. if (!videojs.getPlugin || !videojs.getPlugin("reloadSourceOnError")) {
  112189. var registerPlugin = videojs.registerPlugin || videojs.plugin;
  112190. registerPlugin("reloadSourceOnError", reloadSourceOnError);
  112191. }
  112192. const version = "5.4.2";
  112193. var version$1 = "2.2.1";
  112194. function FlashRtmpDecorator(Flash2) {
  112195. Flash2.streamingFormats = {
  112196. "rtmp/mp4": "MP4",
  112197. "rtmp/flv": "FLV"
  112198. };
  112199. Flash2.streamFromParts = function(connection, stream) {
  112200. return connection + "&" + stream;
  112201. };
  112202. Flash2.streamToParts = function(src) {
  112203. var parts = {
  112204. connection: "",
  112205. stream: ""
  112206. };
  112207. if (!src) {
  112208. return parts;
  112209. }
  112210. var connEnd = src.search(/&(?![\w-]+=)/);
  112211. var streamBegin = void 0;
  112212. if (connEnd !== -1) {
  112213. streamBegin = connEnd + 1;
  112214. } else {
  112215. connEnd = streamBegin = src.lastIndexOf("/") + 1;
  112216. if (connEnd === 0) {
  112217. connEnd = streamBegin = src.length;
  112218. }
  112219. }
  112220. parts.connection = src.substring(0, connEnd);
  112221. parts.stream = src.substring(streamBegin, src.length);
  112222. return parts;
  112223. };
  112224. Flash2.isStreamingType = function(srcType) {
  112225. return srcType in Flash2.streamingFormats;
  112226. };
  112227. Flash2.RTMP_RE = /^rtmp[set]?:\/\//i;
  112228. Flash2.isStreamingSrc = function(src) {
  112229. return Flash2.RTMP_RE.test(src);
  112230. };
  112231. Flash2.rtmpSourceHandler = {};
  112232. Flash2.rtmpSourceHandler.canPlayType = function(type2) {
  112233. if (Flash2.isStreamingType(type2)) {
  112234. return "maybe";
  112235. }
  112236. return "";
  112237. };
  112238. Flash2.rtmpSourceHandler.canHandleSource = function(source, options2) {
  112239. var can = Flash2.rtmpSourceHandler.canPlayType(source.type);
  112240. if (can) {
  112241. return can;
  112242. }
  112243. if (Flash2.isStreamingSrc(source.src)) {
  112244. return "maybe";
  112245. }
  112246. return "";
  112247. };
  112248. Flash2.rtmpSourceHandler.handleSource = function(source, tech, options2) {
  112249. var srcParts = Flash2.streamToParts(source.src);
  112250. tech.setRtmpConnection(srcParts.connection);
  112251. tech.setRtmpStream(srcParts.stream);
  112252. };
  112253. Flash2.registerSourceHandler(Flash2.rtmpSourceHandler);
  112254. return Flash2;
  112255. }
  112256. var classCallCheck = function(instance, Constructor) {
  112257. if (!(instance instanceof Constructor)) {
  112258. throw new TypeError("Cannot call a class as a function");
  112259. }
  112260. };
  112261. var inherits = function(subClass, superClass) {
  112262. if (typeof superClass !== "function" && superClass !== null) {
  112263. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  112264. }
  112265. subClass.prototype = Object.create(superClass && superClass.prototype, {
  112266. constructor: {
  112267. value: subClass,
  112268. enumerable: false,
  112269. writable: true,
  112270. configurable: true
  112271. }
  112272. });
  112273. if (superClass)
  112274. Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  112275. };
  112276. var possibleConstructorReturn = function(self2, call) {
  112277. if (!self2) {
  112278. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  112279. }
  112280. return call && (typeof call === "object" || typeof call === "function") ? call : self2;
  112281. };
  112282. var Tech = videojs.getComponent("Tech");
  112283. var Dom = videojs.dom;
  112284. var Url = videojs.url;
  112285. var createTimeRange = videojs.createTimeRange;
  112286. var mergeOptions$1 = videojs.mergeOptions;
  112287. var navigator$1 = window_1 && window_1.navigator || {};
  112288. var Flash = function(_Tech) {
  112289. inherits(Flash2, _Tech);
  112290. function Flash2(options2, ready) {
  112291. classCallCheck(this, Flash2);
  112292. var _this = possibleConstructorReturn(this, _Tech.call(this, options2, ready));
  112293. if (options2.source) {
  112294. _this.ready(function() {
  112295. this.setSource(options2.source);
  112296. }, true);
  112297. }
  112298. if (options2.startTime) {
  112299. _this.ready(function() {
  112300. this.load();
  112301. this.play();
  112302. this.currentTime(options2.startTime);
  112303. }, true);
  112304. }
  112305. window_1.videojs = window_1.videojs || {};
  112306. window_1.videojs.Flash = window_1.videojs.Flash || {};
  112307. window_1.videojs.Flash.onReady = Flash2.onReady;
  112308. window_1.videojs.Flash.onEvent = Flash2.onEvent;
  112309. window_1.videojs.Flash.onError = Flash2.onError;
  112310. _this.on("seeked", function() {
  112311. this.lastSeekTarget_ = void 0;
  112312. });
  112313. return _this;
  112314. }
  112315. Flash2.prototype.createEl = function createEl2() {
  112316. var options2 = this.options_;
  112317. if (!options2.swf) {
  112318. options2.swf = "https://vjs.zencdn.net/swf/" + version + "/video-js.swf";
  112319. }
  112320. var objId = options2.techId;
  112321. var flashVars = mergeOptions$1({
  112322. readyFunction: "videojs.Flash.onReady",
  112323. eventProxyFunction: "videojs.Flash.onEvent",
  112324. errorEventProxyFunction: "videojs.Flash.onError",
  112325. autoplay: options2.autoplay,
  112326. preload: options2.preload,
  112327. loop: options2.loop,
  112328. muted: options2.muted
  112329. }, options2.flashVars);
  112330. var params = mergeOptions$1({
  112331. wmode: "opaque",
  112332. bgcolor: "#000000"
  112333. }, options2.params);
  112334. var attributes = mergeOptions$1({
  112335. id: objId,
  112336. name: objId,
  112337. "class": "vjs-tech"
  112338. }, options2.attributes);
  112339. this.el_ = Flash2.embed(options2.swf, flashVars, params, attributes);
  112340. this.el_.tech = this;
  112341. return this.el_;
  112342. };
  112343. Flash2.prototype.play = function play() {
  112344. if (this.ended()) {
  112345. this.setCurrentTime(0);
  112346. }
  112347. this.el_.vjs_play();
  112348. };
  112349. Flash2.prototype.pause = function pause() {
  112350. this.el_.vjs_pause();
  112351. };
  112352. Flash2.prototype.src = function src(_src) {
  112353. if (_src === void 0) {
  112354. return this.currentSrc();
  112355. }
  112356. return this.setSrc(_src);
  112357. };
  112358. Flash2.prototype.setSrc = function setSrc(src) {
  112359. var _this2 = this;
  112360. src = Url.getAbsoluteURL(src);
  112361. this.el_.vjs_src(src);
  112362. if (this.autoplay()) {
  112363. this.setTimeout(function() {
  112364. return _this2.play();
  112365. }, 0);
  112366. }
  112367. };
  112368. Flash2.prototype.seeking = function seeking() {
  112369. return this.lastSeekTarget_ !== void 0;
  112370. };
  112371. Flash2.prototype.setCurrentTime = function setCurrentTime(time) {
  112372. var seekable3 = this.seekable();
  112373. if (seekable3.length) {
  112374. time = time > seekable3.start(0) ? time : seekable3.start(0);
  112375. time = time < seekable3.end(seekable3.length - 1) ? time : seekable3.end(seekable3.length - 1);
  112376. this.lastSeekTarget_ = time;
  112377. this.trigger("seeking");
  112378. this.el_.vjs_setProperty("currentTime", time);
  112379. _Tech.prototype.setCurrentTime.call(this);
  112380. }
  112381. };
  112382. Flash2.prototype.currentTime = function currentTime() {
  112383. if (this.seeking()) {
  112384. return this.lastSeekTarget_ || 0;
  112385. }
  112386. return this.el_.vjs_getProperty("currentTime");
  112387. };
  112388. Flash2.prototype.currentSrc = function currentSrc() {
  112389. if (this.currentSource_) {
  112390. return this.currentSource_.src;
  112391. }
  112392. return this.el_.vjs_getProperty("currentSrc");
  112393. };
  112394. Flash2.prototype.duration = function duration5() {
  112395. if (this.readyState() === 0) {
  112396. return NaN;
  112397. }
  112398. var duration6 = this.el_.vjs_getProperty("duration");
  112399. return duration6 >= 0 ? duration6 : Infinity;
  112400. };
  112401. Flash2.prototype.load = function load() {
  112402. this.el_.vjs_load();
  112403. };
  112404. Flash2.prototype.poster = function poster() {
  112405. this.el_.vjs_getProperty("poster");
  112406. };
  112407. Flash2.prototype.setPoster = function setPoster() {
  112408. };
  112409. Flash2.prototype.seekable = function seekable3() {
  112410. var duration5 = this.duration();
  112411. if (duration5 === 0) {
  112412. return createTimeRange();
  112413. }
  112414. return createTimeRange(0, duration5);
  112415. };
  112416. Flash2.prototype.buffered = function buffered() {
  112417. var ranges = this.el_.vjs_getProperty("buffered");
  112418. if (ranges.length === 0) {
  112419. return createTimeRange();
  112420. }
  112421. return createTimeRange(ranges[0][0], ranges[0][1]);
  112422. };
  112423. Flash2.prototype.supportsFullScreen = function supportsFullScreen() {
  112424. return false;
  112425. };
  112426. Flash2.prototype.enterFullScreen = function enterFullScreen() {
  112427. return false;
  112428. };
  112429. Flash2.prototype.getVideoPlaybackQuality = function getVideoPlaybackQuality() {
  112430. var videoPlaybackQuality = this.el_.vjs_getProperty("getVideoPlaybackQuality");
  112431. if (window_1.performance && typeof window_1.performance.now === "function") {
  112432. videoPlaybackQuality.creationTime = window_1.performance.now();
  112433. } else if (window_1.performance && window_1.performance.timing && typeof window_1.performance.timing.navigationStart === "number") {
  112434. videoPlaybackQuality.creationTime = window_1.Date.now() - window_1.performance.timing.navigationStart;
  112435. }
  112436. return videoPlaybackQuality;
  112437. };
  112438. return Flash2;
  112439. }(Tech);
  112440. var _readWrite = ["rtmpConnection", "rtmpStream", "preload", "defaultPlaybackRate", "playbackRate", "autoplay", "loop", "controls", "volume", "muted", "defaultMuted"];
  112441. var _readOnly = ["networkState", "readyState", "initialTime", "startOffsetTime", "paused", "ended", "videoWidth", "videoHeight"];
  112442. var _api = Flash.prototype;
  112443. function _createSetter(attr) {
  112444. var attrUpper = attr.charAt(0).toUpperCase() + attr.slice(1);
  112445. _api["set" + attrUpper] = function(val) {
  112446. return this.el_.vjs_setProperty(attr, val);
  112447. };
  112448. }
  112449. function _createGetter(attr) {
  112450. _api[attr] = function() {
  112451. return this.el_.vjs_getProperty(attr);
  112452. };
  112453. }
  112454. for (var i$1 = 0; i$1 < _readWrite.length; i$1++) {
  112455. _createGetter(_readWrite[i$1]);
  112456. _createSetter(_readWrite[i$1]);
  112457. }
  112458. for (var _i = 0; _i < _readOnly.length; _i++) {
  112459. _createGetter(_readOnly[_i]);
  112460. }
  112461. Flash.isSupported = function() {
  112462. if (videojs.browser.IS_CHROME && (!videojs.browser.IS_ANDROID || !videojs.browser.IS_IOS) || videojs.browser.IS_SAFARI && !videojs.browser.IS_IOS || videojs.browser.IS_EDGE) {
  112463. return true;
  112464. }
  112465. return Flash.version()[0] >= 10;
  112466. };
  112467. Tech.withSourceHandlers(Flash);
  112468. Flash.nativeSourceHandler = {};
  112469. Flash.nativeSourceHandler.canPlayType = function(type2) {
  112470. if (type2 in Flash.formats) {
  112471. return "maybe";
  112472. }
  112473. return "";
  112474. };
  112475. Flash.nativeSourceHandler.canHandleSource = function(source, options2) {
  112476. var type2 = void 0;
  112477. function guessMimeType(src) {
  112478. var ext = Url.getFileExtension(src);
  112479. if (ext) {
  112480. return "video/" + ext;
  112481. }
  112482. return "";
  112483. }
  112484. if (!source.type) {
  112485. type2 = guessMimeType(source.src);
  112486. } else {
  112487. type2 = source.type.replace(/;.*/, "").toLowerCase();
  112488. }
  112489. return Flash.nativeSourceHandler.canPlayType(type2);
  112490. };
  112491. Flash.nativeSourceHandler.handleSource = function(source, tech, options2) {
  112492. tech.setSrc(source.src);
  112493. };
  112494. Flash.nativeSourceHandler.dispose = function() {
  112495. };
  112496. Flash.registerSourceHandler(Flash.nativeSourceHandler);
  112497. Flash.formats = {
  112498. "video/flv": "FLV",
  112499. "video/x-flv": "FLV",
  112500. "video/mp4": "MP4",
  112501. "video/m4v": "MP4"
  112502. };
  112503. Flash.onReady = function(currSwf) {
  112504. var el = Dom.$("#" + currSwf);
  112505. var tech = el && el.tech;
  112506. if (tech && tech.el()) {
  112507. Flash.checkReady(tech);
  112508. }
  112509. };
  112510. Flash.checkReady = function(tech) {
  112511. if (!tech.el()) {
  112512. return;
  112513. }
  112514. if (tech.el().vjs_getProperty) {
  112515. tech.triggerReady();
  112516. } else {
  112517. this.setTimeout(function() {
  112518. Flash.checkReady(tech);
  112519. }, 50);
  112520. }
  112521. };
  112522. Flash.onEvent = function(swfID, eventName) {
  112523. var tech = Dom.$("#" + swfID).tech;
  112524. var args = Array.prototype.slice.call(arguments, 2);
  112525. tech.setTimeout(function() {
  112526. tech.trigger(eventName, args);
  112527. }, 1);
  112528. };
  112529. Flash.onError = function(swfID, err) {
  112530. var tech = Dom.$("#" + swfID).tech;
  112531. if (err === "srcnotfound") {
  112532. return tech.error(4);
  112533. }
  112534. if (typeof err === "string") {
  112535. tech.error("FLASH: " + err);
  112536. } else {
  112537. err.origin = "flash";
  112538. tech.error(err);
  112539. }
  112540. };
  112541. Flash.version = function() {
  112542. var version$$1 = "0,0,0";
  112543. try {
  112544. version$$1 = new window_1.ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
  112545. } catch (e) {
  112546. try {
  112547. if (navigator$1.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
  112548. version$$1 = (navigator$1.plugins["Shockwave Flash 2.0"] || navigator$1.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
  112549. }
  112550. } catch (err) {
  112551. }
  112552. }
  112553. return version$$1.split(",");
  112554. };
  112555. Flash.embed = function(swf, flashVars, params, attributes) {
  112556. var code = Flash.getEmbedCode(swf, flashVars, params, attributes);
  112557. var obj = Dom.createEl("div", { innerHTML: code }).childNodes[0];
  112558. return obj;
  112559. };
  112560. Flash.getEmbedCode = function(swf, flashVars, params, attributes) {
  112561. var objTag = '<object type="application/x-shockwave-flash" ';
  112562. var flashVarsString = "";
  112563. var paramsString = "";
  112564. var attrsString = "";
  112565. if (flashVars) {
  112566. Object.getOwnPropertyNames(flashVars).forEach(function(key) {
  112567. flashVarsString += key + "=" + flashVars[key] + "&amp;";
  112568. });
  112569. }
  112570. params = mergeOptions$1({
  112571. movie: swf,
  112572. flashvars: flashVarsString,
  112573. allowScriptAccess: "always",
  112574. allowNetworking: "all"
  112575. }, params);
  112576. Object.getOwnPropertyNames(params).forEach(function(key) {
  112577. paramsString += '<param name="' + key + '" value="' + params[key] + '" />';
  112578. });
  112579. attributes = mergeOptions$1({
  112580. data: swf,
  112581. width: "100%",
  112582. height: "100%"
  112583. }, attributes);
  112584. Object.getOwnPropertyNames(attributes).forEach(function(key) {
  112585. attrsString += key + '="' + attributes[key] + '" ';
  112586. });
  112587. return "" + objTag + attrsString + ">" + paramsString + "</object>";
  112588. };
  112589. FlashRtmpDecorator(Flash);
  112590. if (Tech.getTech("Flash")) {
  112591. videojs.log.warn("Not using videojs-flash as it appears to already be registered");
  112592. videojs.log.warn("videojs-flash should only be used with video.js@6 and above");
  112593. } else {
  112594. videojs.registerTech("Flash", Flash);
  112595. }
  112596. Flash.VERSION = version$1;
  112597. var flv = { exports: {} };
  112598. (function(module2, exports2) {
  112599. (function webpackUniversalModuleDefinition(root2, factory3) {
  112600. module2.exports = factory3();
  112601. })(self, function() {
  112602. return function() {
  112603. var __webpack_modules__ = {
  112604. "./node_modules/es6-promise/dist/es6-promise.js": function(module3, __unused_webpack_exports, __webpack_require__2) {
  112605. /*!
  112606. * @overview es6-promise - a tiny implementation of Promises/A+.
  112607. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  112608. * @license Licensed under MIT license
  112609. * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
  112610. * @version v4.2.8+1e68dce6
  112611. */
  112612. (function(global2, factory3) {
  112613. module3.exports = factory3();
  112614. })(this, function() {
  112615. function objectOrFunction(x) {
  112616. var type2 = typeof x;
  112617. return x !== null && (type2 === "object" || type2 === "function");
  112618. }
  112619. function isFunction2(x) {
  112620. return typeof x === "function";
  112621. }
  112622. var _isArray = void 0;
  112623. if (Array.isArray) {
  112624. _isArray = Array.isArray;
  112625. } else {
  112626. _isArray = function(x) {
  112627. return Object.prototype.toString.call(x) === "[object Array]";
  112628. };
  112629. }
  112630. var isArray2 = _isArray;
  112631. var len = 0;
  112632. var vertxNext = void 0;
  112633. var customSchedulerFn = void 0;
  112634. var asap = function asap2(callback2, arg) {
  112635. queue[len] = callback2;
  112636. queue[len + 1] = arg;
  112637. len += 2;
  112638. if (len === 2) {
  112639. if (customSchedulerFn) {
  112640. customSchedulerFn(flush);
  112641. } else {
  112642. scheduleFlush();
  112643. }
  112644. }
  112645. };
  112646. function setScheduler(scheduleFn) {
  112647. customSchedulerFn = scheduleFn;
  112648. }
  112649. function setAsap(asapFn) {
  112650. asap = asapFn;
  112651. }
  112652. var browserWindow = typeof window !== "undefined" ? window : void 0;
  112653. var browserGlobal = browserWindow || {};
  112654. var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
  112655. var isNode = typeof self === "undefined" && typeof process !== "undefined" && {}.toString.call(process) === "[object process]";
  112656. var isWorker = typeof Uint8ClampedArray !== "undefined" && typeof importScripts !== "undefined" && typeof MessageChannel !== "undefined";
  112657. function useNextTick() {
  112658. return function() {
  112659. return process.nextTick(flush);
  112660. };
  112661. }
  112662. function useVertxTimer() {
  112663. if (typeof vertxNext !== "undefined") {
  112664. return function() {
  112665. vertxNext(flush);
  112666. };
  112667. }
  112668. return useSetTimeout();
  112669. }
  112670. function useMutationObserver() {
  112671. var iterations = 0;
  112672. var observer = new BrowserMutationObserver(flush);
  112673. var node = document.createTextNode("");
  112674. observer.observe(node, { characterData: true });
  112675. return function() {
  112676. node.data = iterations = ++iterations % 2;
  112677. };
  112678. }
  112679. function useMessageChannel() {
  112680. var channel = new MessageChannel();
  112681. channel.port1.onmessage = flush;
  112682. return function() {
  112683. return channel.port2.postMessage(0);
  112684. };
  112685. }
  112686. function useSetTimeout() {
  112687. var globalSetTimeout = setTimeout;
  112688. return function() {
  112689. return globalSetTimeout(flush, 1);
  112690. };
  112691. }
  112692. var queue = new Array(1e3);
  112693. function flush() {
  112694. for (var i2 = 0; i2 < len; i2 += 2) {
  112695. var callback2 = queue[i2];
  112696. var arg = queue[i2 + 1];
  112697. callback2(arg);
  112698. queue[i2] = void 0;
  112699. queue[i2 + 1] = void 0;
  112700. }
  112701. len = 0;
  112702. }
  112703. function attemptVertx() {
  112704. try {
  112705. var vertx = Function("return this")().require("vertx");
  112706. vertxNext = vertx.runOnLoop || vertx.runOnContext;
  112707. return useVertxTimer();
  112708. } catch (e) {
  112709. return useSetTimeout();
  112710. }
  112711. }
  112712. var scheduleFlush = void 0;
  112713. if (isNode) {
  112714. scheduleFlush = useNextTick();
  112715. } else if (BrowserMutationObserver) {
  112716. scheduleFlush = useMutationObserver();
  112717. } else if (isWorker) {
  112718. scheduleFlush = useMessageChannel();
  112719. } else if (browserWindow === void 0 && true) {
  112720. scheduleFlush = attemptVertx();
  112721. } else {
  112722. scheduleFlush = useSetTimeout();
  112723. }
  112724. function then(onFulfillment, onRejection) {
  112725. var parent = this;
  112726. var child = new this.constructor(noop2);
  112727. if (child[PROMISE_ID] === void 0) {
  112728. makePromise(child);
  112729. }
  112730. var _state = parent._state;
  112731. if (_state) {
  112732. var callback2 = arguments[_state - 1];
  112733. asap(function() {
  112734. return invokeCallback(_state, child, callback2, parent._result);
  112735. });
  112736. } else {
  112737. subscribe(parent, child, onFulfillment, onRejection);
  112738. }
  112739. return child;
  112740. }
  112741. function resolve$1(object) {
  112742. var Constructor = this;
  112743. if (object && typeof object === "object" && object.constructor === Constructor) {
  112744. return object;
  112745. }
  112746. var promise = new Constructor(noop2);
  112747. resolve2(promise, object);
  112748. return promise;
  112749. }
  112750. var PROMISE_ID = Math.random().toString(36).substring(2);
  112751. function noop2() {
  112752. }
  112753. var PENDING = void 0;
  112754. var FULFILLED = 1;
  112755. var REJECTED = 2;
  112756. function selfFulfillment() {
  112757. return new TypeError("You cannot resolve a promise with itself");
  112758. }
  112759. function cannotReturnOwn() {
  112760. return new TypeError("A promises callback cannot return that same promise.");
  112761. }
  112762. function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
  112763. try {
  112764. then$$1.call(value, fulfillmentHandler, rejectionHandler);
  112765. } catch (e) {
  112766. return e;
  112767. }
  112768. }
  112769. function handleForeignThenable(promise, thenable, then$$1) {
  112770. asap(function(promise2) {
  112771. var sealed = false;
  112772. var error = tryThen(then$$1, thenable, function(value) {
  112773. if (sealed) {
  112774. return;
  112775. }
  112776. sealed = true;
  112777. if (thenable !== value) {
  112778. resolve2(promise2, value);
  112779. } else {
  112780. fulfill(promise2, value);
  112781. }
  112782. }, function(reason) {
  112783. if (sealed) {
  112784. return;
  112785. }
  112786. sealed = true;
  112787. reject2(promise2, reason);
  112788. }, "Settle: " + (promise2._label || " unknown promise"));
  112789. if (!sealed && error) {
  112790. sealed = true;
  112791. reject2(promise2, error);
  112792. }
  112793. }, promise);
  112794. }
  112795. function handleOwnThenable(promise, thenable) {
  112796. if (thenable._state === FULFILLED) {
  112797. fulfill(promise, thenable._result);
  112798. } else if (thenable._state === REJECTED) {
  112799. reject2(promise, thenable._result);
  112800. } else {
  112801. subscribe(thenable, void 0, function(value) {
  112802. return resolve2(promise, value);
  112803. }, function(reason) {
  112804. return reject2(promise, reason);
  112805. });
  112806. }
  112807. }
  112808. function handleMaybeThenable(promise, maybeThenable, then$$1) {
  112809. if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {
  112810. handleOwnThenable(promise, maybeThenable);
  112811. } else {
  112812. if (then$$1 === void 0) {
  112813. fulfill(promise, maybeThenable);
  112814. } else if (isFunction2(then$$1)) {
  112815. handleForeignThenable(promise, maybeThenable, then$$1);
  112816. } else {
  112817. fulfill(promise, maybeThenable);
  112818. }
  112819. }
  112820. }
  112821. function resolve2(promise, value) {
  112822. if (promise === value) {
  112823. reject2(promise, selfFulfillment());
  112824. } else if (objectOrFunction(value)) {
  112825. var then$$1 = void 0;
  112826. try {
  112827. then$$1 = value.then;
  112828. } catch (error) {
  112829. reject2(promise, error);
  112830. return;
  112831. }
  112832. handleMaybeThenable(promise, value, then$$1);
  112833. } else {
  112834. fulfill(promise, value);
  112835. }
  112836. }
  112837. function publishRejection(promise) {
  112838. if (promise._onerror) {
  112839. promise._onerror(promise._result);
  112840. }
  112841. publish(promise);
  112842. }
  112843. function fulfill(promise, value) {
  112844. if (promise._state !== PENDING) {
  112845. return;
  112846. }
  112847. promise._result = value;
  112848. promise._state = FULFILLED;
  112849. if (promise._subscribers.length !== 0) {
  112850. asap(publish, promise);
  112851. }
  112852. }
  112853. function reject2(promise, reason) {
  112854. if (promise._state !== PENDING) {
  112855. return;
  112856. }
  112857. promise._state = REJECTED;
  112858. promise._result = reason;
  112859. asap(publishRejection, promise);
  112860. }
  112861. function subscribe(parent, child, onFulfillment, onRejection) {
  112862. var _subscribers = parent._subscribers;
  112863. var length = _subscribers.length;
  112864. parent._onerror = null;
  112865. _subscribers[length] = child;
  112866. _subscribers[length + FULFILLED] = onFulfillment;
  112867. _subscribers[length + REJECTED] = onRejection;
  112868. if (length === 0 && parent._state) {
  112869. asap(publish, parent);
  112870. }
  112871. }
  112872. function publish(promise) {
  112873. var subscribers = promise._subscribers;
  112874. var settled = promise._state;
  112875. if (subscribers.length === 0) {
  112876. return;
  112877. }
  112878. var child = void 0, callback2 = void 0, detail = promise._result;
  112879. for (var i2 = 0; i2 < subscribers.length; i2 += 3) {
  112880. child = subscribers[i2];
  112881. callback2 = subscribers[i2 + settled];
  112882. if (child) {
  112883. invokeCallback(settled, child, callback2, detail);
  112884. } else {
  112885. callback2(detail);
  112886. }
  112887. }
  112888. promise._subscribers.length = 0;
  112889. }
  112890. function invokeCallback(settled, promise, callback2, detail) {
  112891. var hasCallback = isFunction2(callback2), value = void 0, error = void 0, succeeded = true;
  112892. if (hasCallback) {
  112893. try {
  112894. value = callback2(detail);
  112895. } catch (e) {
  112896. succeeded = false;
  112897. error = e;
  112898. }
  112899. if (promise === value) {
  112900. reject2(promise, cannotReturnOwn());
  112901. return;
  112902. }
  112903. } else {
  112904. value = detail;
  112905. }
  112906. if (promise._state !== PENDING)
  112907. ;
  112908. else if (hasCallback && succeeded) {
  112909. resolve2(promise, value);
  112910. } else if (succeeded === false) {
  112911. reject2(promise, error);
  112912. } else if (settled === FULFILLED) {
  112913. fulfill(promise, value);
  112914. } else if (settled === REJECTED) {
  112915. reject2(promise, value);
  112916. }
  112917. }
  112918. function initializePromise(promise, resolver) {
  112919. try {
  112920. resolver(function resolvePromise(value) {
  112921. resolve2(promise, value);
  112922. }, function rejectPromise(reason) {
  112923. reject2(promise, reason);
  112924. });
  112925. } catch (e) {
  112926. reject2(promise, e);
  112927. }
  112928. }
  112929. var id = 0;
  112930. function nextId() {
  112931. return id++;
  112932. }
  112933. function makePromise(promise) {
  112934. promise[PROMISE_ID] = id++;
  112935. promise._state = void 0;
  112936. promise._result = void 0;
  112937. promise._subscribers = [];
  112938. }
  112939. function validationError() {
  112940. return new Error("Array Methods must be provided an Array");
  112941. }
  112942. var Enumerator = function() {
  112943. function Enumerator2(Constructor, input) {
  112944. this._instanceConstructor = Constructor;
  112945. this.promise = new Constructor(noop2);
  112946. if (!this.promise[PROMISE_ID]) {
  112947. makePromise(this.promise);
  112948. }
  112949. if (isArray2(input)) {
  112950. this.length = input.length;
  112951. this._remaining = input.length;
  112952. this._result = new Array(this.length);
  112953. if (this.length === 0) {
  112954. fulfill(this.promise, this._result);
  112955. } else {
  112956. this.length = this.length || 0;
  112957. this._enumerate(input);
  112958. if (this._remaining === 0) {
  112959. fulfill(this.promise, this._result);
  112960. }
  112961. }
  112962. } else {
  112963. reject2(this.promise, validationError());
  112964. }
  112965. }
  112966. Enumerator2.prototype._enumerate = function _enumerate(input) {
  112967. for (var i2 = 0; this._state === PENDING && i2 < input.length; i2++) {
  112968. this._eachEntry(input[i2], i2);
  112969. }
  112970. };
  112971. Enumerator2.prototype._eachEntry = function _eachEntry(entry, i2) {
  112972. var c = this._instanceConstructor;
  112973. var resolve$$1 = c.resolve;
  112974. if (resolve$$1 === resolve$1) {
  112975. var _then = void 0;
  112976. var error = void 0;
  112977. var didError = false;
  112978. try {
  112979. _then = entry.then;
  112980. } catch (e) {
  112981. didError = true;
  112982. error = e;
  112983. }
  112984. if (_then === then && entry._state !== PENDING) {
  112985. this._settledAt(entry._state, i2, entry._result);
  112986. } else if (typeof _then !== "function") {
  112987. this._remaining--;
  112988. this._result[i2] = entry;
  112989. } else if (c === Promise$12) {
  112990. var promise = new c(noop2);
  112991. if (didError) {
  112992. reject2(promise, error);
  112993. } else {
  112994. handleMaybeThenable(promise, entry, _then);
  112995. }
  112996. this._willSettleAt(promise, i2);
  112997. } else {
  112998. this._willSettleAt(new c(function(resolve$$12) {
  112999. return resolve$$12(entry);
  113000. }), i2);
  113001. }
  113002. } else {
  113003. this._willSettleAt(resolve$$1(entry), i2);
  113004. }
  113005. };
  113006. Enumerator2.prototype._settledAt = function _settledAt(state, i2, value) {
  113007. var promise = this.promise;
  113008. if (promise._state === PENDING) {
  113009. this._remaining--;
  113010. if (state === REJECTED) {
  113011. reject2(promise, value);
  113012. } else {
  113013. this._result[i2] = value;
  113014. }
  113015. }
  113016. if (this._remaining === 0) {
  113017. fulfill(promise, this._result);
  113018. }
  113019. };
  113020. Enumerator2.prototype._willSettleAt = function _willSettleAt(promise, i2) {
  113021. var enumerator = this;
  113022. subscribe(promise, void 0, function(value) {
  113023. return enumerator._settledAt(FULFILLED, i2, value);
  113024. }, function(reason) {
  113025. return enumerator._settledAt(REJECTED, i2, reason);
  113026. });
  113027. };
  113028. return Enumerator2;
  113029. }();
  113030. function all(entries) {
  113031. return new Enumerator(this, entries).promise;
  113032. }
  113033. function race(entries) {
  113034. var Constructor = this;
  113035. if (!isArray2(entries)) {
  113036. return new Constructor(function(_, reject3) {
  113037. return reject3(new TypeError("You must pass an array to race."));
  113038. });
  113039. } else {
  113040. return new Constructor(function(resolve3, reject3) {
  113041. var length = entries.length;
  113042. for (var i2 = 0; i2 < length; i2++) {
  113043. Constructor.resolve(entries[i2]).then(resolve3, reject3);
  113044. }
  113045. });
  113046. }
  113047. }
  113048. function reject$1(reason) {
  113049. var Constructor = this;
  113050. var promise = new Constructor(noop2);
  113051. reject2(promise, reason);
  113052. return promise;
  113053. }
  113054. function needsResolver() {
  113055. throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");
  113056. }
  113057. function needsNew() {
  113058. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  113059. }
  113060. var Promise$12 = function() {
  113061. function Promise2(resolver) {
  113062. this[PROMISE_ID] = nextId();
  113063. this._result = this._state = void 0;
  113064. this._subscribers = [];
  113065. if (noop2 !== resolver) {
  113066. typeof resolver !== "function" && needsResolver();
  113067. this instanceof Promise2 ? initializePromise(this, resolver) : needsNew();
  113068. }
  113069. }
  113070. Promise2.prototype.catch = function _catch(onRejection) {
  113071. return this.then(null, onRejection);
  113072. };
  113073. Promise2.prototype.finally = function _finally(callback2) {
  113074. var promise = this;
  113075. var constructor = promise.constructor;
  113076. if (isFunction2(callback2)) {
  113077. return promise.then(function(value) {
  113078. return constructor.resolve(callback2()).then(function() {
  113079. return value;
  113080. });
  113081. }, function(reason) {
  113082. return constructor.resolve(callback2()).then(function() {
  113083. throw reason;
  113084. });
  113085. });
  113086. }
  113087. return promise.then(callback2, callback2);
  113088. };
  113089. return Promise2;
  113090. }();
  113091. Promise$12.prototype.then = then;
  113092. Promise$12.all = all;
  113093. Promise$12.race = race;
  113094. Promise$12.resolve = resolve$1;
  113095. Promise$12.reject = reject$1;
  113096. Promise$12._setScheduler = setScheduler;
  113097. Promise$12._setAsap = setAsap;
  113098. Promise$12._asap = asap;
  113099. function polyfill() {
  113100. var local = void 0;
  113101. if (typeof __webpack_require__2.g !== "undefined") {
  113102. local = __webpack_require__2.g;
  113103. } else if (typeof self !== "undefined") {
  113104. local = self;
  113105. } else {
  113106. try {
  113107. local = Function("return this")();
  113108. } catch (e) {
  113109. throw new Error("polyfill failed because global object is unavailable in this environment");
  113110. }
  113111. }
  113112. var P2 = local.Promise;
  113113. if (P2) {
  113114. var promiseToString = null;
  113115. try {
  113116. promiseToString = Object.prototype.toString.call(P2.resolve());
  113117. } catch (e) {
  113118. }
  113119. if (promiseToString === "[object Promise]" && !P2.cast) {
  113120. return;
  113121. }
  113122. }
  113123. local.Promise = Promise$12;
  113124. }
  113125. Promise$12.polyfill = polyfill;
  113126. Promise$12.Promise = Promise$12;
  113127. return Promise$12;
  113128. });
  113129. },
  113130. "./node_modules/events/events.js": function(module3) {
  113131. var R2 = typeof Reflect === "object" ? Reflect : null;
  113132. var ReflectApply = R2 && typeof R2.apply === "function" ? R2.apply : function ReflectApply2(target, receiver, args) {
  113133. return Function.prototype.apply.call(target, receiver, args);
  113134. };
  113135. var ReflectOwnKeys;
  113136. if (R2 && typeof R2.ownKeys === "function") {
  113137. ReflectOwnKeys = R2.ownKeys;
  113138. } else if (Object.getOwnPropertySymbols) {
  113139. ReflectOwnKeys = function ReflectOwnKeys2(target) {
  113140. return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target));
  113141. };
  113142. } else {
  113143. ReflectOwnKeys = function ReflectOwnKeys2(target) {
  113144. return Object.getOwnPropertyNames(target);
  113145. };
  113146. }
  113147. function ProcessEmitWarning(warning) {
  113148. if (console && console.warn)
  113149. console.warn(warning);
  113150. }
  113151. var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value) {
  113152. return value !== value;
  113153. };
  113154. function EventEmitter() {
  113155. EventEmitter.init.call(this);
  113156. }
  113157. module3.exports = EventEmitter;
  113158. module3.exports.once = once;
  113159. EventEmitter.EventEmitter = EventEmitter;
  113160. EventEmitter.prototype._events = void 0;
  113161. EventEmitter.prototype._eventsCount = 0;
  113162. EventEmitter.prototype._maxListeners = void 0;
  113163. var defaultMaxListeners = 10;
  113164. function checkListener(listener) {
  113165. if (typeof listener !== "function") {
  113166. throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
  113167. }
  113168. }
  113169. Object.defineProperty(EventEmitter, "defaultMaxListeners", {
  113170. enumerable: true,
  113171. get: function() {
  113172. return defaultMaxListeners;
  113173. },
  113174. set: function(arg) {
  113175. if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) {
  113176. throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + ".");
  113177. }
  113178. defaultMaxListeners = arg;
  113179. }
  113180. });
  113181. EventEmitter.init = function() {
  113182. if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) {
  113183. this._events = /* @__PURE__ */ Object.create(null);
  113184. this._eventsCount = 0;
  113185. }
  113186. this._maxListeners = this._maxListeners || void 0;
  113187. };
  113188. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
  113189. if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) {
  113190. throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + ".");
  113191. }
  113192. this._maxListeners = n;
  113193. return this;
  113194. };
  113195. function _getMaxListeners(that) {
  113196. if (that._maxListeners === void 0)
  113197. return EventEmitter.defaultMaxListeners;
  113198. return that._maxListeners;
  113199. }
  113200. EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
  113201. return _getMaxListeners(this);
  113202. };
  113203. EventEmitter.prototype.emit = function emit(type2) {
  113204. var args = [];
  113205. for (var i2 = 1; i2 < arguments.length; i2++)
  113206. args.push(arguments[i2]);
  113207. var doError = type2 === "error";
  113208. var events = this._events;
  113209. if (events !== void 0)
  113210. doError = doError && events.error === void 0;
  113211. else if (!doError)
  113212. return false;
  113213. if (doError) {
  113214. var er;
  113215. if (args.length > 0)
  113216. er = args[0];
  113217. if (er instanceof Error) {
  113218. throw er;
  113219. }
  113220. var err = new Error("Unhandled error." + (er ? " (" + er.message + ")" : ""));
  113221. err.context = er;
  113222. throw err;
  113223. }
  113224. var handler = events[type2];
  113225. if (handler === void 0)
  113226. return false;
  113227. if (typeof handler === "function") {
  113228. ReflectApply(handler, this, args);
  113229. } else {
  113230. var len = handler.length;
  113231. var listeners = arrayClone(handler, len);
  113232. for (var i2 = 0; i2 < len; ++i2)
  113233. ReflectApply(listeners[i2], this, args);
  113234. }
  113235. return true;
  113236. };
  113237. function _addListener(target, type2, listener, prepend) {
  113238. var m;
  113239. var events;
  113240. var existing;
  113241. checkListener(listener);
  113242. events = target._events;
  113243. if (events === void 0) {
  113244. events = target._events = /* @__PURE__ */ Object.create(null);
  113245. target._eventsCount = 0;
  113246. } else {
  113247. if (events.newListener !== void 0) {
  113248. target.emit("newListener", type2, listener.listener ? listener.listener : listener);
  113249. events = target._events;
  113250. }
  113251. existing = events[type2];
  113252. }
  113253. if (existing === void 0) {
  113254. existing = events[type2] = listener;
  113255. ++target._eventsCount;
  113256. } else {
  113257. if (typeof existing === "function") {
  113258. existing = events[type2] = prepend ? [listener, existing] : [existing, listener];
  113259. } else if (prepend) {
  113260. existing.unshift(listener);
  113261. } else {
  113262. existing.push(listener);
  113263. }
  113264. m = _getMaxListeners(target);
  113265. if (m > 0 && existing.length > m && !existing.warned) {
  113266. existing.warned = true;
  113267. var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type2) + " listeners added. Use emitter.setMaxListeners() to increase limit");
  113268. w.name = "MaxListenersExceededWarning";
  113269. w.emitter = target;
  113270. w.type = type2;
  113271. w.count = existing.length;
  113272. ProcessEmitWarning(w);
  113273. }
  113274. }
  113275. return target;
  113276. }
  113277. EventEmitter.prototype.addListener = function addListener(type2, listener) {
  113278. return _addListener(this, type2, listener, false);
  113279. };
  113280. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  113281. EventEmitter.prototype.prependListener = function prependListener(type2, listener) {
  113282. return _addListener(this, type2, listener, true);
  113283. };
  113284. function onceWrapper() {
  113285. if (!this.fired) {
  113286. this.target.removeListener(this.type, this.wrapFn);
  113287. this.fired = true;
  113288. if (arguments.length === 0)
  113289. return this.listener.call(this.target);
  113290. return this.listener.apply(this.target, arguments);
  113291. }
  113292. }
  113293. function _onceWrap(target, type2, listener) {
  113294. var state = { fired: false, wrapFn: void 0, target, type: type2, listener };
  113295. var wrapped = onceWrapper.bind(state);
  113296. wrapped.listener = listener;
  113297. state.wrapFn = wrapped;
  113298. return wrapped;
  113299. }
  113300. EventEmitter.prototype.once = function once2(type2, listener) {
  113301. checkListener(listener);
  113302. this.on(type2, _onceWrap(this, type2, listener));
  113303. return this;
  113304. };
  113305. EventEmitter.prototype.prependOnceListener = function prependOnceListener(type2, listener) {
  113306. checkListener(listener);
  113307. this.prependListener(type2, _onceWrap(this, type2, listener));
  113308. return this;
  113309. };
  113310. EventEmitter.prototype.removeListener = function removeListener(type2, listener) {
  113311. var list, events, position2, i2, originalListener;
  113312. checkListener(listener);
  113313. events = this._events;
  113314. if (events === void 0)
  113315. return this;
  113316. list = events[type2];
  113317. if (list === void 0)
  113318. return this;
  113319. if (list === listener || list.listener === listener) {
  113320. if (--this._eventsCount === 0)
  113321. this._events = /* @__PURE__ */ Object.create(null);
  113322. else {
  113323. delete events[type2];
  113324. if (events.removeListener)
  113325. this.emit("removeListener", type2, list.listener || listener);
  113326. }
  113327. } else if (typeof list !== "function") {
  113328. position2 = -1;
  113329. for (i2 = list.length - 1; i2 >= 0; i2--) {
  113330. if (list[i2] === listener || list[i2].listener === listener) {
  113331. originalListener = list[i2].listener;
  113332. position2 = i2;
  113333. break;
  113334. }
  113335. }
  113336. if (position2 < 0)
  113337. return this;
  113338. if (position2 === 0)
  113339. list.shift();
  113340. else {
  113341. spliceOne(list, position2);
  113342. }
  113343. if (list.length === 1)
  113344. events[type2] = list[0];
  113345. if (events.removeListener !== void 0)
  113346. this.emit("removeListener", type2, originalListener || listener);
  113347. }
  113348. return this;
  113349. };
  113350. EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
  113351. EventEmitter.prototype.removeAllListeners = function removeAllListeners(type2) {
  113352. var listeners, events, i2;
  113353. events = this._events;
  113354. if (events === void 0)
  113355. return this;
  113356. if (events.removeListener === void 0) {
  113357. if (arguments.length === 0) {
  113358. this._events = /* @__PURE__ */ Object.create(null);
  113359. this._eventsCount = 0;
  113360. } else if (events[type2] !== void 0) {
  113361. if (--this._eventsCount === 0)
  113362. this._events = /* @__PURE__ */ Object.create(null);
  113363. else
  113364. delete events[type2];
  113365. }
  113366. return this;
  113367. }
  113368. if (arguments.length === 0) {
  113369. var keys3 = Object.keys(events);
  113370. var key;
  113371. for (i2 = 0; i2 < keys3.length; ++i2) {
  113372. key = keys3[i2];
  113373. if (key === "removeListener")
  113374. continue;
  113375. this.removeAllListeners(key);
  113376. }
  113377. this.removeAllListeners("removeListener");
  113378. this._events = /* @__PURE__ */ Object.create(null);
  113379. this._eventsCount = 0;
  113380. return this;
  113381. }
  113382. listeners = events[type2];
  113383. if (typeof listeners === "function") {
  113384. this.removeListener(type2, listeners);
  113385. } else if (listeners !== void 0) {
  113386. for (i2 = listeners.length - 1; i2 >= 0; i2--) {
  113387. this.removeListener(type2, listeners[i2]);
  113388. }
  113389. }
  113390. return this;
  113391. };
  113392. function _listeners(target, type2, unwrap) {
  113393. var events = target._events;
  113394. if (events === void 0)
  113395. return [];
  113396. var evlistener = events[type2];
  113397. if (evlistener === void 0)
  113398. return [];
  113399. if (typeof evlistener === "function")
  113400. return unwrap ? [evlistener.listener || evlistener] : [evlistener];
  113401. return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
  113402. }
  113403. EventEmitter.prototype.listeners = function listeners(type2) {
  113404. return _listeners(this, type2, true);
  113405. };
  113406. EventEmitter.prototype.rawListeners = function rawListeners(type2) {
  113407. return _listeners(this, type2, false);
  113408. };
  113409. EventEmitter.listenerCount = function(emitter, type2) {
  113410. if (typeof emitter.listenerCount === "function") {
  113411. return emitter.listenerCount(type2);
  113412. } else {
  113413. return listenerCount.call(emitter, type2);
  113414. }
  113415. };
  113416. EventEmitter.prototype.listenerCount = listenerCount;
  113417. function listenerCount(type2) {
  113418. var events = this._events;
  113419. if (events !== void 0) {
  113420. var evlistener = events[type2];
  113421. if (typeof evlistener === "function") {
  113422. return 1;
  113423. } else if (evlistener !== void 0) {
  113424. return evlistener.length;
  113425. }
  113426. }
  113427. return 0;
  113428. }
  113429. EventEmitter.prototype.eventNames = function eventNames() {
  113430. return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
  113431. };
  113432. function arrayClone(arr, n) {
  113433. var copy2 = new Array(n);
  113434. for (var i2 = 0; i2 < n; ++i2)
  113435. copy2[i2] = arr[i2];
  113436. return copy2;
  113437. }
  113438. function spliceOne(list, index2) {
  113439. for (; index2 + 1 < list.length; index2++)
  113440. list[index2] = list[index2 + 1];
  113441. list.pop();
  113442. }
  113443. function unwrapListeners(arr) {
  113444. var ret = new Array(arr.length);
  113445. for (var i2 = 0; i2 < ret.length; ++i2) {
  113446. ret[i2] = arr[i2].listener || arr[i2];
  113447. }
  113448. return ret;
  113449. }
  113450. function once(emitter, name) {
  113451. return new Promise(function(resolve2, reject2) {
  113452. function errorListener(err) {
  113453. emitter.removeListener(name, resolver);
  113454. reject2(err);
  113455. }
  113456. function resolver() {
  113457. if (typeof emitter.removeListener === "function") {
  113458. emitter.removeListener("error", errorListener);
  113459. }
  113460. resolve2([].slice.call(arguments));
  113461. }
  113462. eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
  113463. if (name !== "error") {
  113464. addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
  113465. }
  113466. });
  113467. }
  113468. function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
  113469. if (typeof emitter.on === "function") {
  113470. eventTargetAgnosticAddListener(emitter, "error", handler, flags);
  113471. }
  113472. }
  113473. function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
  113474. if (typeof emitter.on === "function") {
  113475. if (flags.once) {
  113476. emitter.once(name, listener);
  113477. } else {
  113478. emitter.on(name, listener);
  113479. }
  113480. } else if (typeof emitter.addEventListener === "function") {
  113481. emitter.addEventListener(name, function wrapListener(arg) {
  113482. if (flags.once) {
  113483. emitter.removeEventListener(name, wrapListener);
  113484. }
  113485. listener(arg);
  113486. });
  113487. } else {
  113488. throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
  113489. }
  113490. }
  113491. },
  113492. "./node_modules/webworkify-webpack/index.js": function(module3, __unused_webpack_exports, __webpack_require__2) {
  113493. function webpackBootstrapFunc(modules) {
  113494. var installedModules = {};
  113495. function __nested_webpack_require_164__(moduleId) {
  113496. if (installedModules[moduleId])
  113497. return installedModules[moduleId].exports;
  113498. var module4 = installedModules[moduleId] = {
  113499. i: moduleId,
  113500. l: false,
  113501. exports: {}
  113502. };
  113503. modules[moduleId].call(module4.exports, module4, module4.exports, __nested_webpack_require_164__);
  113504. module4.l = true;
  113505. return module4.exports;
  113506. }
  113507. __nested_webpack_require_164__.m = modules;
  113508. __nested_webpack_require_164__.c = installedModules;
  113509. __nested_webpack_require_164__.i = function(value) {
  113510. return value;
  113511. };
  113512. __nested_webpack_require_164__.d = function(exports3, name, getter) {
  113513. if (!__nested_webpack_require_164__.o(exports3, name)) {
  113514. Object.defineProperty(exports3, name, {
  113515. configurable: false,
  113516. enumerable: true,
  113517. get: getter
  113518. });
  113519. }
  113520. };
  113521. __nested_webpack_require_164__.r = function(exports3) {
  113522. Object.defineProperty(exports3, "__esModule", { value: true });
  113523. };
  113524. __nested_webpack_require_164__.n = function(module4) {
  113525. var getter = module4 && module4.__esModule ? function getDefault() {
  113526. return module4["default"];
  113527. } : function getModuleExports() {
  113528. return module4;
  113529. };
  113530. __nested_webpack_require_164__.d(getter, "a", getter);
  113531. return getter;
  113532. };
  113533. __nested_webpack_require_164__.o = function(object, property) {
  113534. return Object.prototype.hasOwnProperty.call(object, property);
  113535. };
  113536. __nested_webpack_require_164__.p = "/";
  113537. __nested_webpack_require_164__.oe = function(err) {
  113538. console.error(err);
  113539. throw err;
  113540. };
  113541. var f = __nested_webpack_require_164__(__nested_webpack_require_164__.s = ENTRY_MODULE);
  113542. return f.default || f;
  113543. }
  113544. var moduleNameReqExp = "[\\.|\\-|\\+|\\w|/|@]+";
  113545. var dependencyRegExp = "\\(\\s*(/\\*.*?\\*/)?\\s*.*?(" + moduleNameReqExp + ").*?\\)";
  113546. function quoteRegExp(str) {
  113547. return (str + "").replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
  113548. }
  113549. function isNumeric(n) {
  113550. return !isNaN(1 * n);
  113551. }
  113552. function getModuleDependencies(sources, module4, queueName) {
  113553. var retval = {};
  113554. retval[queueName] = [];
  113555. var fnString = module4.toString();
  113556. var wrapperSignature = fnString.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);
  113557. if (!wrapperSignature)
  113558. return retval;
  113559. var webpackRequireName = wrapperSignature[1];
  113560. var re = new RegExp("(\\\\n|\\W)" + quoteRegExp(webpackRequireName) + dependencyRegExp, "g");
  113561. var match;
  113562. while (match = re.exec(fnString)) {
  113563. if (match[3] === "dll-reference")
  113564. continue;
  113565. retval[queueName].push(match[3]);
  113566. }
  113567. re = new RegExp("\\(" + quoteRegExp(webpackRequireName) + '\\("(dll-reference\\s(' + moduleNameReqExp + '))"\\)\\)' + dependencyRegExp, "g");
  113568. while (match = re.exec(fnString)) {
  113569. if (!sources[match[2]]) {
  113570. retval[queueName].push(match[1]);
  113571. sources[match[2]] = __webpack_require__2(match[1]).m;
  113572. }
  113573. retval[match[2]] = retval[match[2]] || [];
  113574. retval[match[2]].push(match[4]);
  113575. }
  113576. var keys3 = Object.keys(retval);
  113577. for (var i2 = 0; i2 < keys3.length; i2++) {
  113578. for (var j = 0; j < retval[keys3[i2]].length; j++) {
  113579. if (isNumeric(retval[keys3[i2]][j])) {
  113580. retval[keys3[i2]][j] = 1 * retval[keys3[i2]][j];
  113581. }
  113582. }
  113583. }
  113584. return retval;
  113585. }
  113586. function hasValuesInQueues(queues) {
  113587. var keys3 = Object.keys(queues);
  113588. return keys3.reduce(function(hasValues, key) {
  113589. return hasValues || queues[key].length > 0;
  113590. }, false);
  113591. }
  113592. function getRequiredModules(sources, moduleId) {
  113593. var modulesQueue = {
  113594. main: [moduleId]
  113595. };
  113596. var requiredModules = {
  113597. main: []
  113598. };
  113599. var seenModules = {
  113600. main: {}
  113601. };
  113602. while (hasValuesInQueues(modulesQueue)) {
  113603. var queues = Object.keys(modulesQueue);
  113604. for (var i2 = 0; i2 < queues.length; i2++) {
  113605. var queueName = queues[i2];
  113606. var queue = modulesQueue[queueName];
  113607. var moduleToCheck = queue.pop();
  113608. seenModules[queueName] = seenModules[queueName] || {};
  113609. if (seenModules[queueName][moduleToCheck] || !sources[queueName][moduleToCheck])
  113610. continue;
  113611. seenModules[queueName][moduleToCheck] = true;
  113612. requiredModules[queueName] = requiredModules[queueName] || [];
  113613. requiredModules[queueName].push(moduleToCheck);
  113614. var newModules = getModuleDependencies(sources, sources[queueName][moduleToCheck], queueName);
  113615. var newModulesKeys = Object.keys(newModules);
  113616. for (var j = 0; j < newModulesKeys.length; j++) {
  113617. modulesQueue[newModulesKeys[j]] = modulesQueue[newModulesKeys[j]] || [];
  113618. modulesQueue[newModulesKeys[j]] = modulesQueue[newModulesKeys[j]].concat(newModules[newModulesKeys[j]]);
  113619. }
  113620. }
  113621. }
  113622. return requiredModules;
  113623. }
  113624. module3.exports = function(moduleId, options2) {
  113625. options2 = options2 || {};
  113626. var sources = {
  113627. main: __webpack_require__2.m
  113628. };
  113629. var requiredModules = options2.all ? { main: Object.keys(sources.main) } : getRequiredModules(sources, moduleId);
  113630. var src = "";
  113631. Object.keys(requiredModules).filter(function(m) {
  113632. return m !== "main";
  113633. }).forEach(function(module4) {
  113634. var entryModule = 0;
  113635. while (requiredModules[module4][entryModule]) {
  113636. entryModule++;
  113637. }
  113638. requiredModules[module4].push(entryModule);
  113639. sources[module4][entryModule] = "(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })";
  113640. src = src + "var " + module4 + " = (" + webpackBootstrapFunc.toString().replace("ENTRY_MODULE", JSON.stringify(entryModule)) + ")({" + requiredModules[module4].map(function(id) {
  113641. return "" + JSON.stringify(id) + ": " + sources[module4][id].toString();
  113642. }).join(",") + "});\n";
  113643. });
  113644. src = src + "new ((" + webpackBootstrapFunc.toString().replace("ENTRY_MODULE", JSON.stringify(moduleId)) + ")({" + requiredModules.main.map(function(id) {
  113645. return "" + JSON.stringify(id) + ": " + sources.main[id].toString();
  113646. }).join(",") + "}))(self);";
  113647. var blob = new window.Blob([src], { type: "text/javascript" });
  113648. if (options2.bare) {
  113649. return blob;
  113650. }
  113651. var URL2 = window.URL || window.webkitURL || window.mozURL || window.msURL;
  113652. var workerUrl = URL2.createObjectURL(blob);
  113653. var worker = new window.Worker(workerUrl);
  113654. worker.objectURL = workerUrl;
  113655. return worker;
  113656. };
  113657. },
  113658. "./src/config.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  113659. __webpack_require__2.r(__webpack_exports__2);
  113660. __webpack_require__2.d(__webpack_exports__2, {
  113661. "defaultConfig": function() {
  113662. return defaultConfig;
  113663. },
  113664. "createDefaultConfig": function() {
  113665. return createDefaultConfig;
  113666. }
  113667. });
  113668. var defaultConfig = {
  113669. enableWorker: false,
  113670. enableStashBuffer: true,
  113671. stashInitialSize: void 0,
  113672. isLive: false,
  113673. lazyLoad: true,
  113674. lazyLoadMaxDuration: 3 * 60,
  113675. lazyLoadRecoverDuration: 30,
  113676. deferLoadAfterSourceOpen: true,
  113677. autoCleanupMaxBackwardDuration: 3 * 60,
  113678. autoCleanupMinBackwardDuration: 2 * 60,
  113679. statisticsInfoReportInterval: 600,
  113680. fixAudioTimestampGap: true,
  113681. accurateSeek: false,
  113682. seekType: "range",
  113683. seekParamStart: "bstart",
  113684. seekParamEnd: "bend",
  113685. rangeLoadZeroStart: false,
  113686. customSeekHandler: void 0,
  113687. reuseRedirectedURL: false,
  113688. headers: void 0,
  113689. customLoader: void 0
  113690. };
  113691. function createDefaultConfig() {
  113692. return Object.assign({}, defaultConfig);
  113693. }
  113694. },
  113695. "./src/core/features.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  113696. __webpack_require__2.r(__webpack_exports__2);
  113697. var _io_io_controller_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/io/io-controller.js");
  113698. var _config_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/config.js");
  113699. var Features = function() {
  113700. function Features2() {
  113701. }
  113702. Features2.supportMSEH264Playback = function() {
  113703. return window.MediaSource && window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"');
  113704. };
  113705. Features2.supportNetworkStreamIO = function() {
  113706. var ioctl = new _io_io_controller_js__WEBPACK_IMPORTED_MODULE_0__.default({}, (0, _config_js__WEBPACK_IMPORTED_MODULE_1__.createDefaultConfig)());
  113707. var loaderType = ioctl.loaderType;
  113708. ioctl.destroy();
  113709. return loaderType == "fetch-stream-loader" || loaderType == "xhr-moz-chunked-loader";
  113710. };
  113711. Features2.getNetworkLoaderTypeName = function() {
  113712. var ioctl = new _io_io_controller_js__WEBPACK_IMPORTED_MODULE_0__.default({}, (0, _config_js__WEBPACK_IMPORTED_MODULE_1__.createDefaultConfig)());
  113713. var loaderType = ioctl.loaderType;
  113714. ioctl.destroy();
  113715. return loaderType;
  113716. };
  113717. Features2.supportNativeMediaPlayback = function(mimeType) {
  113718. if (Features2.videoElement == void 0) {
  113719. Features2.videoElement = window.document.createElement("video");
  113720. }
  113721. var canPlay = Features2.videoElement.canPlayType(mimeType);
  113722. return canPlay === "probably" || canPlay == "maybe";
  113723. };
  113724. Features2.getFeatureList = function() {
  113725. var features = {
  113726. mseFlvPlayback: false,
  113727. mseLiveFlvPlayback: false,
  113728. networkStreamIO: false,
  113729. networkLoaderName: "",
  113730. nativeMP4H264Playback: false,
  113731. nativeWebmVP8Playback: false,
  113732. nativeWebmVP9Playback: false
  113733. };
  113734. features.mseFlvPlayback = Features2.supportMSEH264Playback();
  113735. features.networkStreamIO = Features2.supportNetworkStreamIO();
  113736. features.networkLoaderName = Features2.getNetworkLoaderTypeName();
  113737. features.mseLiveFlvPlayback = features.mseFlvPlayback && features.networkStreamIO;
  113738. features.nativeMP4H264Playback = Features2.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"');
  113739. features.nativeWebmVP8Playback = Features2.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"');
  113740. features.nativeWebmVP9Playback = Features2.supportNativeMediaPlayback('video/webm; codecs="vp9"');
  113741. return features;
  113742. };
  113743. return Features2;
  113744. }();
  113745. __webpack_exports__2["default"] = Features;
  113746. },
  113747. "./src/core/media-info.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  113748. __webpack_require__2.r(__webpack_exports__2);
  113749. var MediaInfo = function() {
  113750. function MediaInfo2() {
  113751. this.mimeType = null;
  113752. this.duration = null;
  113753. this.hasAudio = null;
  113754. this.hasVideo = null;
  113755. this.audioCodec = null;
  113756. this.videoCodec = null;
  113757. this.audioDataRate = null;
  113758. this.videoDataRate = null;
  113759. this.audioSampleRate = null;
  113760. this.audioChannelCount = null;
  113761. this.width = null;
  113762. this.height = null;
  113763. this.fps = null;
  113764. this.profile = null;
  113765. this.level = null;
  113766. this.refFrames = null;
  113767. this.chromaFormat = null;
  113768. this.sarNum = null;
  113769. this.sarDen = null;
  113770. this.metadata = null;
  113771. this.segments = null;
  113772. this.segmentCount = null;
  113773. this.hasKeyframesIndex = null;
  113774. this.keyframesIndex = null;
  113775. }
  113776. MediaInfo2.prototype.isComplete = function() {
  113777. var audioInfoComplete = this.hasAudio === false || this.hasAudio === true && this.audioCodec != null && this.audioSampleRate != null && this.audioChannelCount != null;
  113778. var videoInfoComplete = this.hasVideo === false || this.hasVideo === true && this.videoCodec != null && this.width != null && this.height != null && this.fps != null && this.profile != null && this.level != null && this.refFrames != null && this.chromaFormat != null && this.sarNum != null && this.sarDen != null;
  113779. return this.mimeType != null && this.duration != null && this.metadata != null && this.hasKeyframesIndex != null && audioInfoComplete && videoInfoComplete;
  113780. };
  113781. MediaInfo2.prototype.isSeekable = function() {
  113782. return this.hasKeyframesIndex === true;
  113783. };
  113784. MediaInfo2.prototype.getNearestKeyframe = function(milliseconds) {
  113785. if (this.keyframesIndex == null) {
  113786. return null;
  113787. }
  113788. var table = this.keyframesIndex;
  113789. var keyframeIdx = this._search(table.times, milliseconds);
  113790. return {
  113791. index: keyframeIdx,
  113792. milliseconds: table.times[keyframeIdx],
  113793. fileposition: table.filepositions[keyframeIdx]
  113794. };
  113795. };
  113796. MediaInfo2.prototype._search = function(list, value) {
  113797. var idx = 0;
  113798. var last = list.length - 1;
  113799. var mid = 0;
  113800. var lbound = 0;
  113801. var ubound = last;
  113802. if (value < list[0]) {
  113803. idx = 0;
  113804. lbound = ubound + 1;
  113805. }
  113806. while (lbound <= ubound) {
  113807. mid = lbound + Math.floor((ubound - lbound) / 2);
  113808. if (mid === last || value >= list[mid] && value < list[mid + 1]) {
  113809. idx = mid;
  113810. break;
  113811. } else if (list[mid] < value) {
  113812. lbound = mid + 1;
  113813. } else {
  113814. ubound = mid - 1;
  113815. }
  113816. }
  113817. return idx;
  113818. };
  113819. return MediaInfo2;
  113820. }();
  113821. __webpack_exports__2["default"] = MediaInfo;
  113822. },
  113823. "./src/core/media-segment-info.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  113824. __webpack_require__2.r(__webpack_exports__2);
  113825. __webpack_require__2.d(__webpack_exports__2, {
  113826. "SampleInfo": function() {
  113827. return SampleInfo;
  113828. },
  113829. "MediaSegmentInfo": function() {
  113830. return MediaSegmentInfo;
  113831. },
  113832. "IDRSampleList": function() {
  113833. return IDRSampleList;
  113834. },
  113835. "MediaSegmentInfoList": function() {
  113836. return MediaSegmentInfoList;
  113837. }
  113838. });
  113839. var SampleInfo = function() {
  113840. function SampleInfo2(dts, pts, duration5, originalDts, isSync) {
  113841. this.dts = dts;
  113842. this.pts = pts;
  113843. this.duration = duration5;
  113844. this.originalDts = originalDts;
  113845. this.isSyncPoint = isSync;
  113846. this.fileposition = null;
  113847. }
  113848. return SampleInfo2;
  113849. }();
  113850. var MediaSegmentInfo = function() {
  113851. function MediaSegmentInfo2() {
  113852. this.beginDts = 0;
  113853. this.endDts = 0;
  113854. this.beginPts = 0;
  113855. this.endPts = 0;
  113856. this.originalBeginDts = 0;
  113857. this.originalEndDts = 0;
  113858. this.syncPoints = [];
  113859. this.firstSample = null;
  113860. this.lastSample = null;
  113861. }
  113862. MediaSegmentInfo2.prototype.appendSyncPoint = function(sampleInfo) {
  113863. sampleInfo.isSyncPoint = true;
  113864. this.syncPoints.push(sampleInfo);
  113865. };
  113866. return MediaSegmentInfo2;
  113867. }();
  113868. var IDRSampleList = function() {
  113869. function IDRSampleList2() {
  113870. this._list = [];
  113871. }
  113872. IDRSampleList2.prototype.clear = function() {
  113873. this._list = [];
  113874. };
  113875. IDRSampleList2.prototype.appendArray = function(syncPoints) {
  113876. var list = this._list;
  113877. if (syncPoints.length === 0) {
  113878. return;
  113879. }
  113880. if (list.length > 0 && syncPoints[0].originalDts < list[list.length - 1].originalDts) {
  113881. this.clear();
  113882. }
  113883. Array.prototype.push.apply(list, syncPoints);
  113884. };
  113885. IDRSampleList2.prototype.getLastSyncPointBeforeDts = function(dts) {
  113886. if (this._list.length == 0) {
  113887. return null;
  113888. }
  113889. var list = this._list;
  113890. var idx = 0;
  113891. var last = list.length - 1;
  113892. var mid = 0;
  113893. var lbound = 0;
  113894. var ubound = last;
  113895. if (dts < list[0].dts) {
  113896. idx = 0;
  113897. lbound = ubound + 1;
  113898. }
  113899. while (lbound <= ubound) {
  113900. mid = lbound + Math.floor((ubound - lbound) / 2);
  113901. if (mid === last || dts >= list[mid].dts && dts < list[mid + 1].dts) {
  113902. idx = mid;
  113903. break;
  113904. } else if (list[mid].dts < dts) {
  113905. lbound = mid + 1;
  113906. } else {
  113907. ubound = mid - 1;
  113908. }
  113909. }
  113910. return this._list[idx];
  113911. };
  113912. return IDRSampleList2;
  113913. }();
  113914. var MediaSegmentInfoList = function() {
  113915. function MediaSegmentInfoList2(type2) {
  113916. this._type = type2;
  113917. this._list = [];
  113918. this._lastAppendLocation = -1;
  113919. }
  113920. Object.defineProperty(MediaSegmentInfoList2.prototype, "type", {
  113921. get: function() {
  113922. return this._type;
  113923. },
  113924. enumerable: false,
  113925. configurable: true
  113926. });
  113927. Object.defineProperty(MediaSegmentInfoList2.prototype, "length", {
  113928. get: function() {
  113929. return this._list.length;
  113930. },
  113931. enumerable: false,
  113932. configurable: true
  113933. });
  113934. MediaSegmentInfoList2.prototype.isEmpty = function() {
  113935. return this._list.length === 0;
  113936. };
  113937. MediaSegmentInfoList2.prototype.clear = function() {
  113938. this._list = [];
  113939. this._lastAppendLocation = -1;
  113940. };
  113941. MediaSegmentInfoList2.prototype._searchNearestSegmentBefore = function(originalBeginDts) {
  113942. var list = this._list;
  113943. if (list.length === 0) {
  113944. return -2;
  113945. }
  113946. var last = list.length - 1;
  113947. var mid = 0;
  113948. var lbound = 0;
  113949. var ubound = last;
  113950. var idx = 0;
  113951. if (originalBeginDts < list[0].originalBeginDts) {
  113952. idx = -1;
  113953. return idx;
  113954. }
  113955. while (lbound <= ubound) {
  113956. mid = lbound + Math.floor((ubound - lbound) / 2);
  113957. if (mid === last || originalBeginDts > list[mid].lastSample.originalDts && originalBeginDts < list[mid + 1].originalBeginDts) {
  113958. idx = mid;
  113959. break;
  113960. } else if (list[mid].originalBeginDts < originalBeginDts) {
  113961. lbound = mid + 1;
  113962. } else {
  113963. ubound = mid - 1;
  113964. }
  113965. }
  113966. return idx;
  113967. };
  113968. MediaSegmentInfoList2.prototype._searchNearestSegmentAfter = function(originalBeginDts) {
  113969. return this._searchNearestSegmentBefore(originalBeginDts) + 1;
  113970. };
  113971. MediaSegmentInfoList2.prototype.append = function(mediaSegmentInfo) {
  113972. var list = this._list;
  113973. var msi = mediaSegmentInfo;
  113974. var lastAppendIdx = this._lastAppendLocation;
  113975. var insertIdx = 0;
  113976. if (lastAppendIdx !== -1 && lastAppendIdx < list.length && msi.originalBeginDts >= list[lastAppendIdx].lastSample.originalDts && (lastAppendIdx === list.length - 1 || lastAppendIdx < list.length - 1 && msi.originalBeginDts < list[lastAppendIdx + 1].originalBeginDts)) {
  113977. insertIdx = lastAppendIdx + 1;
  113978. } else {
  113979. if (list.length > 0) {
  113980. insertIdx = this._searchNearestSegmentBefore(msi.originalBeginDts) + 1;
  113981. }
  113982. }
  113983. this._lastAppendLocation = insertIdx;
  113984. this._list.splice(insertIdx, 0, msi);
  113985. };
  113986. MediaSegmentInfoList2.prototype.getLastSegmentBefore = function(originalBeginDts) {
  113987. var idx = this._searchNearestSegmentBefore(originalBeginDts);
  113988. if (idx >= 0) {
  113989. return this._list[idx];
  113990. } else {
  113991. return null;
  113992. }
  113993. };
  113994. MediaSegmentInfoList2.prototype.getLastSampleBefore = function(originalBeginDts) {
  113995. var segment = this.getLastSegmentBefore(originalBeginDts);
  113996. if (segment != null) {
  113997. return segment.lastSample;
  113998. } else {
  113999. return null;
  114000. }
  114001. };
  114002. MediaSegmentInfoList2.prototype.getLastSyncPointBefore = function(originalBeginDts) {
  114003. var segmentIdx = this._searchNearestSegmentBefore(originalBeginDts);
  114004. var syncPoints = this._list[segmentIdx].syncPoints;
  114005. while (syncPoints.length === 0 && segmentIdx > 0) {
  114006. segmentIdx--;
  114007. syncPoints = this._list[segmentIdx].syncPoints;
  114008. }
  114009. if (syncPoints.length > 0) {
  114010. return syncPoints[syncPoints.length - 1];
  114011. } else {
  114012. return null;
  114013. }
  114014. };
  114015. return MediaSegmentInfoList2;
  114016. }();
  114017. },
  114018. "./src/core/mse-controller.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  114019. __webpack_require__2.r(__webpack_exports__2);
  114020. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  114021. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  114022. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/logger.js");
  114023. var _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/browser.js");
  114024. var _mse_events_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/core/mse-events.js");
  114025. var _media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/core/media-segment-info.js");
  114026. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/utils/exception.js");
  114027. var MSEController = function() {
  114028. function MSEController2(config) {
  114029. this.TAG = "MSEController";
  114030. this._config = config;
  114031. this._emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  114032. if (this._config.isLive && this._config.autoCleanupSourceBuffer == void 0) {
  114033. this._config.autoCleanupSourceBuffer = true;
  114034. }
  114035. this.e = {
  114036. onSourceOpen: this._onSourceOpen.bind(this),
  114037. onSourceEnded: this._onSourceEnded.bind(this),
  114038. onSourceClose: this._onSourceClose.bind(this),
  114039. onSourceBufferError: this._onSourceBufferError.bind(this),
  114040. onSourceBufferUpdateEnd: this._onSourceBufferUpdateEnd.bind(this)
  114041. };
  114042. this._mediaSource = null;
  114043. this._mediaSourceObjectURL = null;
  114044. this._mediaElement = null;
  114045. this._isBufferFull = false;
  114046. this._hasPendingEos = false;
  114047. this._requireSetMediaDuration = false;
  114048. this._pendingMediaDuration = 0;
  114049. this._pendingSourceBufferInit = [];
  114050. this._mimeTypes = {
  114051. video: null,
  114052. audio: null
  114053. };
  114054. this._sourceBuffers = {
  114055. video: null,
  114056. audio: null
  114057. };
  114058. this._lastInitSegments = {
  114059. video: null,
  114060. audio: null
  114061. };
  114062. this._pendingSegments = {
  114063. video: [],
  114064. audio: []
  114065. };
  114066. this._pendingRemoveRanges = {
  114067. video: [],
  114068. audio: []
  114069. };
  114070. this._idrList = new _media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.IDRSampleList();
  114071. }
  114072. MSEController2.prototype.destroy = function() {
  114073. if (this._mediaElement || this._mediaSource) {
  114074. this.detachMediaElement();
  114075. }
  114076. this.e = null;
  114077. this._emitter.removeAllListeners();
  114078. this._emitter = null;
  114079. };
  114080. MSEController2.prototype.on = function(event2, listener) {
  114081. this._emitter.addListener(event2, listener);
  114082. };
  114083. MSEController2.prototype.off = function(event2, listener) {
  114084. this._emitter.removeListener(event2, listener);
  114085. };
  114086. MSEController2.prototype.attachMediaElement = function(mediaElement) {
  114087. if (this._mediaSource) {
  114088. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__.IllegalStateException("MediaSource has been attached to an HTMLMediaElement!");
  114089. }
  114090. var ms = this._mediaSource = new window.MediaSource();
  114091. ms.addEventListener("sourceopen", this.e.onSourceOpen);
  114092. ms.addEventListener("sourceended", this.e.onSourceEnded);
  114093. ms.addEventListener("sourceclose", this.e.onSourceClose);
  114094. this._mediaElement = mediaElement;
  114095. this._mediaSourceObjectURL = window.URL.createObjectURL(this._mediaSource);
  114096. mediaElement.src = this._mediaSourceObjectURL;
  114097. };
  114098. MSEController2.prototype.detachMediaElement = function() {
  114099. if (this._mediaSource) {
  114100. var ms = this._mediaSource;
  114101. for (var type2 in this._sourceBuffers) {
  114102. var ps = this._pendingSegments[type2];
  114103. ps.splice(0, ps.length);
  114104. this._pendingSegments[type2] = null;
  114105. this._pendingRemoveRanges[type2] = null;
  114106. this._lastInitSegments[type2] = null;
  114107. var sb = this._sourceBuffers[type2];
  114108. if (sb) {
  114109. if (ms.readyState !== "closed") {
  114110. try {
  114111. ms.removeSourceBuffer(sb);
  114112. } catch (error) {
  114113. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, error.message);
  114114. }
  114115. sb.removeEventListener("error", this.e.onSourceBufferError);
  114116. sb.removeEventListener("updateend", this.e.onSourceBufferUpdateEnd);
  114117. }
  114118. this._mimeTypes[type2] = null;
  114119. this._sourceBuffers[type2] = null;
  114120. }
  114121. }
  114122. if (ms.readyState === "open") {
  114123. try {
  114124. ms.endOfStream();
  114125. } catch (error) {
  114126. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, error.message);
  114127. }
  114128. }
  114129. ms.removeEventListener("sourceopen", this.e.onSourceOpen);
  114130. ms.removeEventListener("sourceended", this.e.onSourceEnded);
  114131. ms.removeEventListener("sourceclose", this.e.onSourceClose);
  114132. this._pendingSourceBufferInit = [];
  114133. this._isBufferFull = false;
  114134. this._idrList.clear();
  114135. this._mediaSource = null;
  114136. }
  114137. if (this._mediaElement) {
  114138. this._mediaElement.src = "";
  114139. this._mediaElement.removeAttribute("src");
  114140. this._mediaElement = null;
  114141. }
  114142. if (this._mediaSourceObjectURL) {
  114143. window.URL.revokeObjectURL(this._mediaSourceObjectURL);
  114144. this._mediaSourceObjectURL = null;
  114145. }
  114146. };
  114147. MSEController2.prototype.appendInitSegment = function(initSegment, deferred) {
  114148. if (!this._mediaSource || this._mediaSource.readyState !== "open") {
  114149. this._pendingSourceBufferInit.push(initSegment);
  114150. this._pendingSegments[initSegment.type].push(initSegment);
  114151. return;
  114152. }
  114153. var is = initSegment;
  114154. var mimeType = "" + is.container;
  114155. if (is.codec && is.codec.length > 0) {
  114156. mimeType += ";codecs=" + is.codec;
  114157. }
  114158. var firstInitSegment = false;
  114159. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "Received Initialization Segment, mimeType: " + mimeType);
  114160. this._lastInitSegments[is.type] = is;
  114161. if (mimeType !== this._mimeTypes[is.type]) {
  114162. if (!this._mimeTypes[is.type]) {
  114163. firstInitSegment = true;
  114164. try {
  114165. var sb = this._sourceBuffers[is.type] = this._mediaSource.addSourceBuffer(mimeType);
  114166. sb.addEventListener("error", this.e.onSourceBufferError);
  114167. sb.addEventListener("updateend", this.e.onSourceBufferUpdateEnd);
  114168. } catch (error) {
  114169. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, error.message);
  114170. this._emitter.emit(_mse_events_js__WEBPACK_IMPORTED_MODULE_3__.default.ERROR, { code: error.code, msg: error.message });
  114171. return;
  114172. }
  114173. } else {
  114174. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "Notice: " + is.type + " mimeType changed, origin: " + this._mimeTypes[is.type] + ", target: " + mimeType);
  114175. }
  114176. this._mimeTypes[is.type] = mimeType;
  114177. }
  114178. if (!deferred) {
  114179. this._pendingSegments[is.type].push(is);
  114180. }
  114181. if (!firstInitSegment) {
  114182. if (this._sourceBuffers[is.type] && !this._sourceBuffers[is.type].updating) {
  114183. this._doAppendSegments();
  114184. }
  114185. }
  114186. if (_utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari && is.container === "audio/mpeg" && is.mediaDuration > 0) {
  114187. this._requireSetMediaDuration = true;
  114188. this._pendingMediaDuration = is.mediaDuration / 1e3;
  114189. this._updateMediaSourceDuration();
  114190. }
  114191. };
  114192. MSEController2.prototype.appendMediaSegment = function(mediaSegment) {
  114193. var ms = mediaSegment;
  114194. this._pendingSegments[ms.type].push(ms);
  114195. if (this._config.autoCleanupSourceBuffer && this._needCleanupSourceBuffer()) {
  114196. this._doCleanupSourceBuffer();
  114197. }
  114198. var sb = this._sourceBuffers[ms.type];
  114199. if (sb && !sb.updating && !this._hasPendingRemoveRanges()) {
  114200. this._doAppendSegments();
  114201. }
  114202. };
  114203. MSEController2.prototype.seek = function(seconds) {
  114204. for (var type2 in this._sourceBuffers) {
  114205. if (!this._sourceBuffers[type2]) {
  114206. continue;
  114207. }
  114208. var sb = this._sourceBuffers[type2];
  114209. if (this._mediaSource.readyState === "open") {
  114210. try {
  114211. sb.abort();
  114212. } catch (error) {
  114213. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, error.message);
  114214. }
  114215. }
  114216. this._idrList.clear();
  114217. var ps = this._pendingSegments[type2];
  114218. ps.splice(0, ps.length);
  114219. if (this._mediaSource.readyState === "closed") {
  114220. continue;
  114221. }
  114222. for (var i2 = 0; i2 < sb.buffered.length; i2++) {
  114223. var start2 = sb.buffered.start(i2);
  114224. var end = sb.buffered.end(i2);
  114225. this._pendingRemoveRanges[type2].push({ start: start2, end });
  114226. }
  114227. if (!sb.updating) {
  114228. this._doRemoveRanges();
  114229. }
  114230. if (_utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari) {
  114231. var lastInitSegment = this._lastInitSegments[type2];
  114232. if (lastInitSegment) {
  114233. this._pendingSegments[type2].push(lastInitSegment);
  114234. if (!sb.updating) {
  114235. this._doAppendSegments();
  114236. }
  114237. }
  114238. }
  114239. }
  114240. };
  114241. MSEController2.prototype.endOfStream = function() {
  114242. var ms = this._mediaSource;
  114243. var sb = this._sourceBuffers;
  114244. if (!ms || ms.readyState !== "open") {
  114245. if (ms && ms.readyState === "closed" && this._hasPendingSegments()) {
  114246. this._hasPendingEos = true;
  114247. }
  114248. return;
  114249. }
  114250. if (sb.video && sb.video.updating || sb.audio && sb.audio.updating) {
  114251. this._hasPendingEos = true;
  114252. } else {
  114253. this._hasPendingEos = false;
  114254. ms.endOfStream();
  114255. }
  114256. };
  114257. MSEController2.prototype.getNearestKeyframe = function(dts) {
  114258. return this._idrList.getLastSyncPointBeforeDts(dts);
  114259. };
  114260. MSEController2.prototype._needCleanupSourceBuffer = function() {
  114261. if (!this._config.autoCleanupSourceBuffer) {
  114262. return false;
  114263. }
  114264. var currentTime = this._mediaElement.currentTime;
  114265. for (var type2 in this._sourceBuffers) {
  114266. var sb = this._sourceBuffers[type2];
  114267. if (sb) {
  114268. var buffered = sb.buffered;
  114269. if (buffered.length >= 1) {
  114270. if (currentTime - buffered.start(0) >= this._config.autoCleanupMaxBackwardDuration) {
  114271. return true;
  114272. }
  114273. }
  114274. }
  114275. }
  114276. return false;
  114277. };
  114278. MSEController2.prototype._doCleanupSourceBuffer = function() {
  114279. var currentTime = this._mediaElement.currentTime;
  114280. for (var type2 in this._sourceBuffers) {
  114281. var sb = this._sourceBuffers[type2];
  114282. if (sb) {
  114283. var buffered = sb.buffered;
  114284. var doRemove = false;
  114285. for (var i2 = 0; i2 < buffered.length; i2++) {
  114286. var start2 = buffered.start(i2);
  114287. var end = buffered.end(i2);
  114288. if (start2 <= currentTime && currentTime < end + 3) {
  114289. if (currentTime - start2 >= this._config.autoCleanupMaxBackwardDuration) {
  114290. doRemove = true;
  114291. var removeEnd = currentTime - this._config.autoCleanupMinBackwardDuration;
  114292. this._pendingRemoveRanges[type2].push({ start: start2, end: removeEnd });
  114293. }
  114294. } else if (end < currentTime) {
  114295. doRemove = true;
  114296. this._pendingRemoveRanges[type2].push({ start: start2, end });
  114297. }
  114298. }
  114299. if (doRemove && !sb.updating) {
  114300. this._doRemoveRanges();
  114301. }
  114302. }
  114303. }
  114304. };
  114305. MSEController2.prototype._updateMediaSourceDuration = function() {
  114306. var sb = this._sourceBuffers;
  114307. if (this._mediaElement.readyState === 0 || this._mediaSource.readyState !== "open") {
  114308. return;
  114309. }
  114310. if (sb.video && sb.video.updating || sb.audio && sb.audio.updating) {
  114311. return;
  114312. }
  114313. var current = this._mediaSource.duration;
  114314. var target = this._pendingMediaDuration;
  114315. if (target > 0 && (isNaN(current) || target > current)) {
  114316. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "Update MediaSource duration from " + current + " to " + target);
  114317. this._mediaSource.duration = target;
  114318. }
  114319. this._requireSetMediaDuration = false;
  114320. this._pendingMediaDuration = 0;
  114321. };
  114322. MSEController2.prototype._doRemoveRanges = function() {
  114323. for (var type2 in this._pendingRemoveRanges) {
  114324. if (!this._sourceBuffers[type2] || this._sourceBuffers[type2].updating) {
  114325. continue;
  114326. }
  114327. var sb = this._sourceBuffers[type2];
  114328. var ranges = this._pendingRemoveRanges[type2];
  114329. while (ranges.length && !sb.updating) {
  114330. var range3 = ranges.shift();
  114331. sb.remove(range3.start, range3.end);
  114332. }
  114333. }
  114334. };
  114335. MSEController2.prototype._doAppendSegments = function() {
  114336. var pendingSegments = this._pendingSegments;
  114337. for (var type2 in pendingSegments) {
  114338. if (!this._sourceBuffers[type2] || this._sourceBuffers[type2].updating) {
  114339. continue;
  114340. }
  114341. if (pendingSegments[type2].length > 0) {
  114342. var segment = pendingSegments[type2].shift();
  114343. if (segment.timestampOffset) {
  114344. var currentOffset = this._sourceBuffers[type2].timestampOffset;
  114345. var targetOffset = segment.timestampOffset / 1e3;
  114346. var delta = Math.abs(currentOffset - targetOffset);
  114347. if (delta > 0.1) {
  114348. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "Update MPEG audio timestampOffset from " + currentOffset + " to " + targetOffset);
  114349. this._sourceBuffers[type2].timestampOffset = targetOffset;
  114350. }
  114351. delete segment.timestampOffset;
  114352. }
  114353. if (!segment.data || segment.data.byteLength === 0) {
  114354. continue;
  114355. }
  114356. try {
  114357. this._sourceBuffers[type2].appendBuffer(segment.data);
  114358. this._isBufferFull = false;
  114359. if (type2 === "video" && segment.hasOwnProperty("info")) {
  114360. this._idrList.appendArray(segment.info.syncPoints);
  114361. }
  114362. } catch (error) {
  114363. this._pendingSegments[type2].unshift(segment);
  114364. if (error.code === 22) {
  114365. if (!this._isBufferFull) {
  114366. this._emitter.emit(_mse_events_js__WEBPACK_IMPORTED_MODULE_3__.default.BUFFER_FULL);
  114367. }
  114368. this._isBufferFull = true;
  114369. } else {
  114370. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, error.message);
  114371. this._emitter.emit(_mse_events_js__WEBPACK_IMPORTED_MODULE_3__.default.ERROR, { code: error.code, msg: error.message });
  114372. }
  114373. }
  114374. }
  114375. }
  114376. };
  114377. MSEController2.prototype._onSourceOpen = function() {
  114378. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "MediaSource onSourceOpen");
  114379. this._mediaSource.removeEventListener("sourceopen", this.e.onSourceOpen);
  114380. if (this._pendingSourceBufferInit.length > 0) {
  114381. var pendings = this._pendingSourceBufferInit;
  114382. while (pendings.length) {
  114383. var segment = pendings.shift();
  114384. this.appendInitSegment(segment, true);
  114385. }
  114386. }
  114387. if (this._hasPendingSegments()) {
  114388. this._doAppendSegments();
  114389. }
  114390. this._emitter.emit(_mse_events_js__WEBPACK_IMPORTED_MODULE_3__.default.SOURCE_OPEN);
  114391. };
  114392. MSEController2.prototype._onSourceEnded = function() {
  114393. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "MediaSource onSourceEnded");
  114394. };
  114395. MSEController2.prototype._onSourceClose = function() {
  114396. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "MediaSource onSourceClose");
  114397. if (this._mediaSource && this.e != null) {
  114398. this._mediaSource.removeEventListener("sourceopen", this.e.onSourceOpen);
  114399. this._mediaSource.removeEventListener("sourceended", this.e.onSourceEnded);
  114400. this._mediaSource.removeEventListener("sourceclose", this.e.onSourceClose);
  114401. }
  114402. };
  114403. MSEController2.prototype._hasPendingSegments = function() {
  114404. var ps = this._pendingSegments;
  114405. return ps.video.length > 0 || ps.audio.length > 0;
  114406. };
  114407. MSEController2.prototype._hasPendingRemoveRanges = function() {
  114408. var prr = this._pendingRemoveRanges;
  114409. return prr.video.length > 0 || prr.audio.length > 0;
  114410. };
  114411. MSEController2.prototype._onSourceBufferUpdateEnd = function() {
  114412. if (this._requireSetMediaDuration) {
  114413. this._updateMediaSourceDuration();
  114414. } else if (this._hasPendingRemoveRanges()) {
  114415. this._doRemoveRanges();
  114416. } else if (this._hasPendingSegments()) {
  114417. this._doAppendSegments();
  114418. } else if (this._hasPendingEos) {
  114419. this.endOfStream();
  114420. }
  114421. this._emitter.emit(_mse_events_js__WEBPACK_IMPORTED_MODULE_3__.default.UPDATE_END);
  114422. };
  114423. MSEController2.prototype._onSourceBufferError = function(e) {
  114424. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, "SourceBuffer Error: " + e);
  114425. };
  114426. return MSEController2;
  114427. }();
  114428. __webpack_exports__2["default"] = MSEController;
  114429. },
  114430. "./src/core/mse-events.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  114431. __webpack_require__2.r(__webpack_exports__2);
  114432. var MSEEvents = {
  114433. ERROR: "error",
  114434. SOURCE_OPEN: "source_open",
  114435. UPDATE_END: "update_end",
  114436. BUFFER_FULL: "buffer_full"
  114437. };
  114438. __webpack_exports__2["default"] = MSEEvents;
  114439. },
  114440. "./src/core/transmuxer.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  114441. __webpack_require__2.r(__webpack_exports__2);
  114442. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  114443. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  114444. var webworkify_webpack__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./node_modules/webworkify-webpack/index.js");
  114445. var webworkify_webpack__WEBPACK_IMPORTED_MODULE_1___default = /* @__PURE__ */ __webpack_require__2.n(webworkify_webpack__WEBPACK_IMPORTED_MODULE_1__);
  114446. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/logger.js");
  114447. var _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/utils/logging-control.js");
  114448. var _transmuxing_controller_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/core/transmuxing-controller.js");
  114449. var _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/core/transmuxing-events.js");
  114450. var _media_info_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__2("./src/core/media-info.js");
  114451. var Transmuxer = function() {
  114452. function Transmuxer2(mediaDataSource, config) {
  114453. this.TAG = "Transmuxer";
  114454. this._emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  114455. if (config.enableWorker && typeof Worker !== "undefined") {
  114456. try {
  114457. this._worker = webworkify_webpack__WEBPACK_IMPORTED_MODULE_1___default()("./src/core/transmuxing-worker.js");
  114458. this._workerDestroying = false;
  114459. this._worker.addEventListener("message", this._onWorkerMessage.bind(this));
  114460. this._worker.postMessage({ cmd: "init", param: [mediaDataSource, config] });
  114461. this.e = {
  114462. onLoggingConfigChanged: this._onLoggingConfigChanged.bind(this)
  114463. };
  114464. _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_3__.default.registerListener(this.e.onLoggingConfigChanged);
  114465. this._worker.postMessage({ cmd: "logging_config", param: _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_3__.default.getConfig() });
  114466. } catch (error) {
  114467. _utils_logger_js__WEBPACK_IMPORTED_MODULE_2__.default.e(this.TAG, "Error while initialize transmuxing worker, fallback to inline transmuxing");
  114468. this._worker = null;
  114469. this._controller = new _transmuxing_controller_js__WEBPACK_IMPORTED_MODULE_4__.default(mediaDataSource, config);
  114470. }
  114471. } else {
  114472. this._controller = new _transmuxing_controller_js__WEBPACK_IMPORTED_MODULE_4__.default(mediaDataSource, config);
  114473. }
  114474. if (this._controller) {
  114475. var ctl = this._controller;
  114476. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.IO_ERROR, this._onIOError.bind(this));
  114477. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.DEMUX_ERROR, this._onDemuxError.bind(this));
  114478. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.INIT_SEGMENT, this._onInitSegment.bind(this));
  114479. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_SEGMENT, this._onMediaSegment.bind(this));
  114480. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.LOADING_COMPLETE, this._onLoadingComplete.bind(this));
  114481. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOVERED_EARLY_EOF, this._onRecoveredEarlyEof.bind(this));
  114482. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_INFO, this._onMediaInfo.bind(this));
  114483. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.METADATA_ARRIVED, this._onMetaDataArrived.bind(this));
  114484. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.SCRIPTDATA_ARRIVED, this._onScriptDataArrived.bind(this));
  114485. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.STATISTICS_INFO, this._onStatisticsInfo.bind(this));
  114486. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOMMEND_SEEKPOINT, this._onRecommendSeekpoint.bind(this));
  114487. }
  114488. }
  114489. Transmuxer2.prototype.destroy = function() {
  114490. if (this._worker) {
  114491. if (!this._workerDestroying) {
  114492. this._workerDestroying = true;
  114493. this._worker.postMessage({ cmd: "destroy" });
  114494. _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_3__.default.removeListener(this.e.onLoggingConfigChanged);
  114495. this.e = null;
  114496. }
  114497. } else {
  114498. this._controller.destroy();
  114499. this._controller = null;
  114500. }
  114501. this._emitter.removeAllListeners();
  114502. this._emitter = null;
  114503. };
  114504. Transmuxer2.prototype.on = function(event2, listener) {
  114505. this._emitter.addListener(event2, listener);
  114506. };
  114507. Transmuxer2.prototype.off = function(event2, listener) {
  114508. this._emitter.removeListener(event2, listener);
  114509. };
  114510. Transmuxer2.prototype.hasWorker = function() {
  114511. return this._worker != null;
  114512. };
  114513. Transmuxer2.prototype.open = function() {
  114514. if (this._worker) {
  114515. this._worker.postMessage({ cmd: "start" });
  114516. } else {
  114517. this._controller.start();
  114518. }
  114519. };
  114520. Transmuxer2.prototype.close = function() {
  114521. if (this._worker) {
  114522. this._worker.postMessage({ cmd: "stop" });
  114523. } else {
  114524. this._controller.stop();
  114525. }
  114526. };
  114527. Transmuxer2.prototype.seek = function(milliseconds) {
  114528. if (this._worker) {
  114529. this._worker.postMessage({ cmd: "seek", param: milliseconds });
  114530. } else {
  114531. this._controller.seek(milliseconds);
  114532. }
  114533. };
  114534. Transmuxer2.prototype.pause = function() {
  114535. if (this._worker) {
  114536. this._worker.postMessage({ cmd: "pause" });
  114537. } else {
  114538. this._controller.pause();
  114539. }
  114540. };
  114541. Transmuxer2.prototype.resume = function() {
  114542. if (this._worker) {
  114543. this._worker.postMessage({ cmd: "resume" });
  114544. } else {
  114545. this._controller.resume();
  114546. }
  114547. };
  114548. Transmuxer2.prototype._onInitSegment = function(type2, initSegment) {
  114549. var _this = this;
  114550. Promise.resolve().then(function() {
  114551. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.INIT_SEGMENT, type2, initSegment);
  114552. });
  114553. };
  114554. Transmuxer2.prototype._onMediaSegment = function(type2, mediaSegment) {
  114555. var _this = this;
  114556. Promise.resolve().then(function() {
  114557. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_SEGMENT, type2, mediaSegment);
  114558. });
  114559. };
  114560. Transmuxer2.prototype._onLoadingComplete = function() {
  114561. var _this = this;
  114562. Promise.resolve().then(function() {
  114563. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.LOADING_COMPLETE);
  114564. });
  114565. };
  114566. Transmuxer2.prototype._onRecoveredEarlyEof = function() {
  114567. var _this = this;
  114568. Promise.resolve().then(function() {
  114569. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOVERED_EARLY_EOF);
  114570. });
  114571. };
  114572. Transmuxer2.prototype._onMediaInfo = function(mediaInfo) {
  114573. var _this = this;
  114574. Promise.resolve().then(function() {
  114575. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_INFO, mediaInfo);
  114576. });
  114577. };
  114578. Transmuxer2.prototype._onMetaDataArrived = function(metadata) {
  114579. var _this = this;
  114580. Promise.resolve().then(function() {
  114581. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.METADATA_ARRIVED, metadata);
  114582. });
  114583. };
  114584. Transmuxer2.prototype._onScriptDataArrived = function(data) {
  114585. var _this = this;
  114586. Promise.resolve().then(function() {
  114587. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.SCRIPTDATA_ARRIVED, data);
  114588. });
  114589. };
  114590. Transmuxer2.prototype._onStatisticsInfo = function(statisticsInfo) {
  114591. var _this = this;
  114592. Promise.resolve().then(function() {
  114593. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.STATISTICS_INFO, statisticsInfo);
  114594. });
  114595. };
  114596. Transmuxer2.prototype._onIOError = function(type2, info) {
  114597. var _this = this;
  114598. Promise.resolve().then(function() {
  114599. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.IO_ERROR, type2, info);
  114600. });
  114601. };
  114602. Transmuxer2.prototype._onDemuxError = function(type2, info) {
  114603. var _this = this;
  114604. Promise.resolve().then(function() {
  114605. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.DEMUX_ERROR, type2, info);
  114606. });
  114607. };
  114608. Transmuxer2.prototype._onRecommendSeekpoint = function(milliseconds) {
  114609. var _this = this;
  114610. Promise.resolve().then(function() {
  114611. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOMMEND_SEEKPOINT, milliseconds);
  114612. });
  114613. };
  114614. Transmuxer2.prototype._onLoggingConfigChanged = function(config) {
  114615. if (this._worker) {
  114616. this._worker.postMessage({ cmd: "logging_config", param: config });
  114617. }
  114618. };
  114619. Transmuxer2.prototype._onWorkerMessage = function(e) {
  114620. var message = e.data;
  114621. var data = message.data;
  114622. if (message.msg === "destroyed" || this._workerDestroying) {
  114623. this._workerDestroying = false;
  114624. this._worker.terminate();
  114625. this._worker = null;
  114626. return;
  114627. }
  114628. switch (message.msg) {
  114629. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.INIT_SEGMENT:
  114630. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_SEGMENT:
  114631. this._emitter.emit(message.msg, data.type, data.data);
  114632. break;
  114633. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.LOADING_COMPLETE:
  114634. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOVERED_EARLY_EOF:
  114635. this._emitter.emit(message.msg);
  114636. break;
  114637. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_INFO:
  114638. Object.setPrototypeOf(data, _media_info_js__WEBPACK_IMPORTED_MODULE_6__.default.prototype);
  114639. this._emitter.emit(message.msg, data);
  114640. break;
  114641. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.METADATA_ARRIVED:
  114642. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.SCRIPTDATA_ARRIVED:
  114643. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.STATISTICS_INFO:
  114644. this._emitter.emit(message.msg, data);
  114645. break;
  114646. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.IO_ERROR:
  114647. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.DEMUX_ERROR:
  114648. this._emitter.emit(message.msg, data.type, data.info);
  114649. break;
  114650. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOMMEND_SEEKPOINT:
  114651. this._emitter.emit(message.msg, data);
  114652. break;
  114653. case "logcat_callback":
  114654. _utils_logger_js__WEBPACK_IMPORTED_MODULE_2__.default.emitter.emit("log", data.type, data.logcat);
  114655. break;
  114656. }
  114657. };
  114658. return Transmuxer2;
  114659. }();
  114660. __webpack_exports__2["default"] = Transmuxer;
  114661. },
  114662. "./src/core/transmuxing-controller.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  114663. __webpack_require__2.r(__webpack_exports__2);
  114664. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  114665. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  114666. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/logger.js");
  114667. var _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/browser.js");
  114668. var _media_info_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/core/media-info.js");
  114669. var _demux_flv_demuxer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/demux/flv-demuxer.js");
  114670. var _remux_mp4_remuxer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/remux/mp4-remuxer.js");
  114671. var _demux_demux_errors_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__2("./src/demux/demux-errors.js");
  114672. var _io_io_controller_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__2("./src/io/io-controller.js");
  114673. var _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__2("./src/core/transmuxing-events.js");
  114674. var TransmuxingController = function() {
  114675. function TransmuxingController2(mediaDataSource, config) {
  114676. this.TAG = "TransmuxingController";
  114677. this._emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  114678. this._config = config;
  114679. if (!mediaDataSource.segments) {
  114680. mediaDataSource.segments = [{
  114681. duration: mediaDataSource.duration,
  114682. filesize: mediaDataSource.filesize,
  114683. url: mediaDataSource.url
  114684. }];
  114685. }
  114686. if (typeof mediaDataSource.cors !== "boolean") {
  114687. mediaDataSource.cors = true;
  114688. }
  114689. if (typeof mediaDataSource.withCredentials !== "boolean") {
  114690. mediaDataSource.withCredentials = false;
  114691. }
  114692. this._mediaDataSource = mediaDataSource;
  114693. this._currentSegmentIndex = 0;
  114694. var totalDuration = 0;
  114695. this._mediaDataSource.segments.forEach(function(segment) {
  114696. segment.timestampBase = totalDuration;
  114697. totalDuration += segment.duration;
  114698. segment.cors = mediaDataSource.cors;
  114699. segment.withCredentials = mediaDataSource.withCredentials;
  114700. if (config.referrerPolicy) {
  114701. segment.referrerPolicy = config.referrerPolicy;
  114702. }
  114703. });
  114704. if (!isNaN(totalDuration) && this._mediaDataSource.duration !== totalDuration) {
  114705. this._mediaDataSource.duration = totalDuration;
  114706. }
  114707. this._mediaInfo = null;
  114708. this._demuxer = null;
  114709. this._remuxer = null;
  114710. this._ioctl = null;
  114711. this._pendingSeekTime = null;
  114712. this._pendingResolveSeekPoint = null;
  114713. this._statisticsReporter = null;
  114714. }
  114715. TransmuxingController2.prototype.destroy = function() {
  114716. this._mediaInfo = null;
  114717. this._mediaDataSource = null;
  114718. if (this._statisticsReporter) {
  114719. this._disableStatisticsReporter();
  114720. }
  114721. if (this._ioctl) {
  114722. this._ioctl.destroy();
  114723. this._ioctl = null;
  114724. }
  114725. if (this._demuxer) {
  114726. this._demuxer.destroy();
  114727. this._demuxer = null;
  114728. }
  114729. if (this._remuxer) {
  114730. this._remuxer.destroy();
  114731. this._remuxer = null;
  114732. }
  114733. this._emitter.removeAllListeners();
  114734. this._emitter = null;
  114735. };
  114736. TransmuxingController2.prototype.on = function(event2, listener) {
  114737. this._emitter.addListener(event2, listener);
  114738. };
  114739. TransmuxingController2.prototype.off = function(event2, listener) {
  114740. this._emitter.removeListener(event2, listener);
  114741. };
  114742. TransmuxingController2.prototype.start = function() {
  114743. this._loadSegment(0);
  114744. this._enableStatisticsReporter();
  114745. };
  114746. TransmuxingController2.prototype._loadSegment = function(segmentIndex, optionalFrom) {
  114747. this._currentSegmentIndex = segmentIndex;
  114748. var dataSource = this._mediaDataSource.segments[segmentIndex];
  114749. var ioctl = this._ioctl = new _io_io_controller_js__WEBPACK_IMPORTED_MODULE_7__.default(dataSource, this._config, segmentIndex);
  114750. ioctl.onError = this._onIOException.bind(this);
  114751. ioctl.onSeeked = this._onIOSeeked.bind(this);
  114752. ioctl.onComplete = this._onIOComplete.bind(this);
  114753. ioctl.onRedirect = this._onIORedirect.bind(this);
  114754. ioctl.onRecoveredEarlyEof = this._onIORecoveredEarlyEof.bind(this);
  114755. if (optionalFrom) {
  114756. this._demuxer.bindDataSource(this._ioctl);
  114757. } else {
  114758. ioctl.onDataArrival = this._onInitChunkArrival.bind(this);
  114759. }
  114760. ioctl.open(optionalFrom);
  114761. };
  114762. TransmuxingController2.prototype.stop = function() {
  114763. this._internalAbort();
  114764. this._disableStatisticsReporter();
  114765. };
  114766. TransmuxingController2.prototype._internalAbort = function() {
  114767. if (this._ioctl) {
  114768. this._ioctl.destroy();
  114769. this._ioctl = null;
  114770. }
  114771. };
  114772. TransmuxingController2.prototype.pause = function() {
  114773. if (this._ioctl && this._ioctl.isWorking()) {
  114774. this._ioctl.pause();
  114775. this._disableStatisticsReporter();
  114776. }
  114777. };
  114778. TransmuxingController2.prototype.resume = function() {
  114779. if (this._ioctl && this._ioctl.isPaused()) {
  114780. this._ioctl.resume();
  114781. this._enableStatisticsReporter();
  114782. }
  114783. };
  114784. TransmuxingController2.prototype.seek = function(milliseconds) {
  114785. if (this._mediaInfo == null || !this._mediaInfo.isSeekable()) {
  114786. return;
  114787. }
  114788. var targetSegmentIndex = this._searchSegmentIndexContains(milliseconds);
  114789. if (targetSegmentIndex === this._currentSegmentIndex) {
  114790. var segmentInfo = this._mediaInfo.segments[targetSegmentIndex];
  114791. if (segmentInfo == void 0) {
  114792. this._pendingSeekTime = milliseconds;
  114793. } else {
  114794. var keyframe = segmentInfo.getNearestKeyframe(milliseconds);
  114795. this._remuxer.seek(keyframe.milliseconds);
  114796. this._ioctl.seek(keyframe.fileposition);
  114797. this._pendingResolveSeekPoint = keyframe.milliseconds;
  114798. }
  114799. } else {
  114800. var targetSegmentInfo = this._mediaInfo.segments[targetSegmentIndex];
  114801. if (targetSegmentInfo == void 0) {
  114802. this._pendingSeekTime = milliseconds;
  114803. this._internalAbort();
  114804. this._remuxer.seek();
  114805. this._remuxer.insertDiscontinuity();
  114806. this._loadSegment(targetSegmentIndex);
  114807. } else {
  114808. var keyframe = targetSegmentInfo.getNearestKeyframe(milliseconds);
  114809. this._internalAbort();
  114810. this._remuxer.seek(milliseconds);
  114811. this._remuxer.insertDiscontinuity();
  114812. this._demuxer.resetMediaInfo();
  114813. this._demuxer.timestampBase = this._mediaDataSource.segments[targetSegmentIndex].timestampBase;
  114814. this._loadSegment(targetSegmentIndex, keyframe.fileposition);
  114815. this._pendingResolveSeekPoint = keyframe.milliseconds;
  114816. this._reportSegmentMediaInfo(targetSegmentIndex);
  114817. }
  114818. }
  114819. this._enableStatisticsReporter();
  114820. };
  114821. TransmuxingController2.prototype._searchSegmentIndexContains = function(milliseconds) {
  114822. var segments = this._mediaDataSource.segments;
  114823. var idx = segments.length - 1;
  114824. for (var i2 = 0; i2 < segments.length; i2++) {
  114825. if (milliseconds < segments[i2].timestampBase) {
  114826. idx = i2 - 1;
  114827. break;
  114828. }
  114829. }
  114830. return idx;
  114831. };
  114832. TransmuxingController2.prototype._onInitChunkArrival = function(data, byteStart) {
  114833. var _this = this;
  114834. var probeData = null;
  114835. var consumed = 0;
  114836. if (byteStart > 0) {
  114837. this._demuxer.bindDataSource(this._ioctl);
  114838. this._demuxer.timestampBase = this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase;
  114839. consumed = this._demuxer.parseChunks(data, byteStart);
  114840. } else if ((probeData = _demux_flv_demuxer_js__WEBPACK_IMPORTED_MODULE_4__.default.probe(data)).match) {
  114841. this._demuxer = new _demux_flv_demuxer_js__WEBPACK_IMPORTED_MODULE_4__.default(probeData, this._config);
  114842. if (!this._remuxer) {
  114843. this._remuxer = new _remux_mp4_remuxer_js__WEBPACK_IMPORTED_MODULE_5__.default(this._config);
  114844. }
  114845. var mds = this._mediaDataSource;
  114846. if (mds.duration != void 0 && !isNaN(mds.duration)) {
  114847. this._demuxer.overridedDuration = mds.duration;
  114848. }
  114849. if (typeof mds.hasAudio === "boolean") {
  114850. this._demuxer.overridedHasAudio = mds.hasAudio;
  114851. }
  114852. if (typeof mds.hasVideo === "boolean") {
  114853. this._demuxer.overridedHasVideo = mds.hasVideo;
  114854. }
  114855. this._demuxer.timestampBase = mds.segments[this._currentSegmentIndex].timestampBase;
  114856. this._demuxer.onError = this._onDemuxException.bind(this);
  114857. this._demuxer.onMediaInfo = this._onMediaInfo.bind(this);
  114858. this._demuxer.onMetaDataArrived = this._onMetaDataArrived.bind(this);
  114859. this._demuxer.onScriptDataArrived = this._onScriptDataArrived.bind(this);
  114860. this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl));
  114861. this._remuxer.onInitSegment = this._onRemuxerInitSegmentArrival.bind(this);
  114862. this._remuxer.onMediaSegment = this._onRemuxerMediaSegmentArrival.bind(this);
  114863. consumed = this._demuxer.parseChunks(data, byteStart);
  114864. } else {
  114865. probeData = null;
  114866. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, "Non-FLV, Unsupported media type!");
  114867. Promise.resolve().then(function() {
  114868. _this._internalAbort();
  114869. });
  114870. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.DEMUX_ERROR, _demux_demux_errors_js__WEBPACK_IMPORTED_MODULE_6__.default.FORMAT_UNSUPPORTED, "Non-FLV, Unsupported media type");
  114871. consumed = 0;
  114872. }
  114873. return consumed;
  114874. };
  114875. TransmuxingController2.prototype._onMediaInfo = function(mediaInfo) {
  114876. var _this = this;
  114877. if (this._mediaInfo == null) {
  114878. this._mediaInfo = Object.assign({}, mediaInfo);
  114879. this._mediaInfo.keyframesIndex = null;
  114880. this._mediaInfo.segments = [];
  114881. this._mediaInfo.segmentCount = this._mediaDataSource.segments.length;
  114882. Object.setPrototypeOf(this._mediaInfo, _media_info_js__WEBPACK_IMPORTED_MODULE_3__.default.prototype);
  114883. }
  114884. var segmentInfo = Object.assign({}, mediaInfo);
  114885. Object.setPrototypeOf(segmentInfo, _media_info_js__WEBPACK_IMPORTED_MODULE_3__.default.prototype);
  114886. this._mediaInfo.segments[this._currentSegmentIndex] = segmentInfo;
  114887. this._reportSegmentMediaInfo(this._currentSegmentIndex);
  114888. if (this._pendingSeekTime != null) {
  114889. Promise.resolve().then(function() {
  114890. var target = _this._pendingSeekTime;
  114891. _this._pendingSeekTime = null;
  114892. _this.seek(target);
  114893. });
  114894. }
  114895. };
  114896. TransmuxingController2.prototype._onMetaDataArrived = function(metadata) {
  114897. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.METADATA_ARRIVED, metadata);
  114898. };
  114899. TransmuxingController2.prototype._onScriptDataArrived = function(data) {
  114900. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.SCRIPTDATA_ARRIVED, data);
  114901. };
  114902. TransmuxingController2.prototype._onIOSeeked = function() {
  114903. this._remuxer.insertDiscontinuity();
  114904. };
  114905. TransmuxingController2.prototype._onIOComplete = function(extraData) {
  114906. var segmentIndex = extraData;
  114907. var nextSegmentIndex = segmentIndex + 1;
  114908. if (nextSegmentIndex < this._mediaDataSource.segments.length) {
  114909. this._internalAbort();
  114910. this._remuxer.flushStashedSamples();
  114911. this._loadSegment(nextSegmentIndex);
  114912. } else {
  114913. this._remuxer.flushStashedSamples();
  114914. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.LOADING_COMPLETE);
  114915. this._disableStatisticsReporter();
  114916. }
  114917. };
  114918. TransmuxingController2.prototype._onIORedirect = function(redirectedURL) {
  114919. var segmentIndex = this._ioctl.extraData;
  114920. this._mediaDataSource.segments[segmentIndex].redirectedURL = redirectedURL;
  114921. };
  114922. TransmuxingController2.prototype._onIORecoveredEarlyEof = function() {
  114923. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.RECOVERED_EARLY_EOF);
  114924. };
  114925. TransmuxingController2.prototype._onIOException = function(type2, info) {
  114926. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, "IOException: type = " + type2 + ", code = " + info.code + ", msg = " + info.msg);
  114927. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.IO_ERROR, type2, info);
  114928. this._disableStatisticsReporter();
  114929. };
  114930. TransmuxingController2.prototype._onDemuxException = function(type2, info) {
  114931. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, "DemuxException: type = " + type2 + ", info = " + info);
  114932. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.DEMUX_ERROR, type2, info);
  114933. };
  114934. TransmuxingController2.prototype._onRemuxerInitSegmentArrival = function(type2, initSegment) {
  114935. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.INIT_SEGMENT, type2, initSegment);
  114936. };
  114937. TransmuxingController2.prototype._onRemuxerMediaSegmentArrival = function(type2, mediaSegment) {
  114938. if (this._pendingSeekTime != null) {
  114939. return;
  114940. }
  114941. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.MEDIA_SEGMENT, type2, mediaSegment);
  114942. if (this._pendingResolveSeekPoint != null && type2 === "video") {
  114943. var syncPoints = mediaSegment.info.syncPoints;
  114944. var seekpoint = this._pendingResolveSeekPoint;
  114945. this._pendingResolveSeekPoint = null;
  114946. if (_utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari && syncPoints.length > 0 && syncPoints[0].originalDts === seekpoint) {
  114947. seekpoint = syncPoints[0].pts;
  114948. }
  114949. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.RECOMMEND_SEEKPOINT, seekpoint);
  114950. }
  114951. };
  114952. TransmuxingController2.prototype._enableStatisticsReporter = function() {
  114953. if (this._statisticsReporter == null) {
  114954. this._statisticsReporter = self.setInterval(this._reportStatisticsInfo.bind(this), this._config.statisticsInfoReportInterval);
  114955. }
  114956. };
  114957. TransmuxingController2.prototype._disableStatisticsReporter = function() {
  114958. if (this._statisticsReporter) {
  114959. self.clearInterval(this._statisticsReporter);
  114960. this._statisticsReporter = null;
  114961. }
  114962. };
  114963. TransmuxingController2.prototype._reportSegmentMediaInfo = function(segmentIndex) {
  114964. var segmentInfo = this._mediaInfo.segments[segmentIndex];
  114965. var exportInfo = Object.assign({}, segmentInfo);
  114966. exportInfo.duration = this._mediaInfo.duration;
  114967. exportInfo.segmentCount = this._mediaInfo.segmentCount;
  114968. delete exportInfo.segments;
  114969. delete exportInfo.keyframesIndex;
  114970. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.MEDIA_INFO, exportInfo);
  114971. };
  114972. TransmuxingController2.prototype._reportStatisticsInfo = function() {
  114973. var info = {};
  114974. info.url = this._ioctl.currentURL;
  114975. info.hasRedirect = this._ioctl.hasRedirect;
  114976. if (info.hasRedirect) {
  114977. info.redirectedURL = this._ioctl.currentRedirectedURL;
  114978. }
  114979. info.speed = this._ioctl.currentSpeed;
  114980. info.loaderType = this._ioctl.loaderType;
  114981. info.currentSegmentIndex = this._currentSegmentIndex;
  114982. info.totalSegmentCount = this._mediaDataSource.segments.length;
  114983. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.STATISTICS_INFO, info);
  114984. };
  114985. return TransmuxingController2;
  114986. }();
  114987. __webpack_exports__2["default"] = TransmuxingController;
  114988. },
  114989. "./src/core/transmuxing-events.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  114990. __webpack_require__2.r(__webpack_exports__2);
  114991. var TransmuxingEvents = {
  114992. IO_ERROR: "io_error",
  114993. DEMUX_ERROR: "demux_error",
  114994. INIT_SEGMENT: "init_segment",
  114995. MEDIA_SEGMENT: "media_segment",
  114996. LOADING_COMPLETE: "loading_complete",
  114997. RECOVERED_EARLY_EOF: "recovered_early_eof",
  114998. MEDIA_INFO: "media_info",
  114999. METADATA_ARRIVED: "metadata_arrived",
  115000. SCRIPTDATA_ARRIVED: "scriptdata_arrived",
  115001. STATISTICS_INFO: "statistics_info",
  115002. RECOMMEND_SEEKPOINT: "recommend_seekpoint"
  115003. };
  115004. __webpack_exports__2["default"] = TransmuxingEvents;
  115005. },
  115006. "./src/core/transmuxing-worker.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  115007. __webpack_require__2.r(__webpack_exports__2);
  115008. var _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logging-control.js");
  115009. var _utils_polyfill_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/polyfill.js");
  115010. var _transmuxing_controller_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/core/transmuxing-controller.js");
  115011. var _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/core/transmuxing-events.js");
  115012. var TransmuxingWorker = function(self2) {
  115013. var controller = null;
  115014. var logcatListener = onLogcatCallback.bind(this);
  115015. _utils_polyfill_js__WEBPACK_IMPORTED_MODULE_1__.default.install();
  115016. self2.addEventListener("message", function(e) {
  115017. switch (e.data.cmd) {
  115018. case "init":
  115019. controller = new _transmuxing_controller_js__WEBPACK_IMPORTED_MODULE_2__.default(e.data.param[0], e.data.param[1]);
  115020. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.IO_ERROR, onIOError.bind(this));
  115021. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.DEMUX_ERROR, onDemuxError.bind(this));
  115022. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.INIT_SEGMENT, onInitSegment.bind(this));
  115023. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_SEGMENT, onMediaSegment.bind(this));
  115024. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.LOADING_COMPLETE, onLoadingComplete.bind(this));
  115025. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.RECOVERED_EARLY_EOF, onRecoveredEarlyEof.bind(this));
  115026. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_INFO, onMediaInfo.bind(this));
  115027. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.METADATA_ARRIVED, onMetaDataArrived.bind(this));
  115028. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.SCRIPTDATA_ARRIVED, onScriptDataArrived.bind(this));
  115029. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.STATISTICS_INFO, onStatisticsInfo.bind(this));
  115030. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.RECOMMEND_SEEKPOINT, onRecommendSeekpoint.bind(this));
  115031. break;
  115032. case "destroy":
  115033. if (controller) {
  115034. controller.destroy();
  115035. controller = null;
  115036. }
  115037. self2.postMessage({ msg: "destroyed" });
  115038. break;
  115039. case "start":
  115040. controller.start();
  115041. break;
  115042. case "stop":
  115043. controller.stop();
  115044. break;
  115045. case "seek":
  115046. controller.seek(e.data.param);
  115047. break;
  115048. case "pause":
  115049. controller.pause();
  115050. break;
  115051. case "resume":
  115052. controller.resume();
  115053. break;
  115054. case "logging_config": {
  115055. var config = e.data.param;
  115056. _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_0__.default.applyConfig(config);
  115057. if (config.enableCallback === true) {
  115058. _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_0__.default.addLogListener(logcatListener);
  115059. } else {
  115060. _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_0__.default.removeLogListener(logcatListener);
  115061. }
  115062. break;
  115063. }
  115064. }
  115065. });
  115066. function onInitSegment(type2, initSegment) {
  115067. var obj = {
  115068. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.INIT_SEGMENT,
  115069. data: {
  115070. type: type2,
  115071. data: initSegment
  115072. }
  115073. };
  115074. self2.postMessage(obj, [initSegment.data]);
  115075. }
  115076. function onMediaSegment(type2, mediaSegment) {
  115077. var obj = {
  115078. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_SEGMENT,
  115079. data: {
  115080. type: type2,
  115081. data: mediaSegment
  115082. }
  115083. };
  115084. self2.postMessage(obj, [mediaSegment.data]);
  115085. }
  115086. function onLoadingComplete() {
  115087. var obj = {
  115088. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.LOADING_COMPLETE
  115089. };
  115090. self2.postMessage(obj);
  115091. }
  115092. function onRecoveredEarlyEof() {
  115093. var obj = {
  115094. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.RECOVERED_EARLY_EOF
  115095. };
  115096. self2.postMessage(obj);
  115097. }
  115098. function onMediaInfo(mediaInfo) {
  115099. var obj = {
  115100. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_INFO,
  115101. data: mediaInfo
  115102. };
  115103. self2.postMessage(obj);
  115104. }
  115105. function onMetaDataArrived(metadata) {
  115106. var obj = {
  115107. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.METADATA_ARRIVED,
  115108. data: metadata
  115109. };
  115110. self2.postMessage(obj);
  115111. }
  115112. function onScriptDataArrived(data) {
  115113. var obj = {
  115114. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.SCRIPTDATA_ARRIVED,
  115115. data
  115116. };
  115117. self2.postMessage(obj);
  115118. }
  115119. function onStatisticsInfo(statInfo) {
  115120. var obj = {
  115121. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.STATISTICS_INFO,
  115122. data: statInfo
  115123. };
  115124. self2.postMessage(obj);
  115125. }
  115126. function onIOError(type2, info) {
  115127. self2.postMessage({
  115128. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.IO_ERROR,
  115129. data: {
  115130. type: type2,
  115131. info
  115132. }
  115133. });
  115134. }
  115135. function onDemuxError(type2, info) {
  115136. self2.postMessage({
  115137. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.DEMUX_ERROR,
  115138. data: {
  115139. type: type2,
  115140. info
  115141. }
  115142. });
  115143. }
  115144. function onRecommendSeekpoint(milliseconds) {
  115145. self2.postMessage({
  115146. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.RECOMMEND_SEEKPOINT,
  115147. data: milliseconds
  115148. });
  115149. }
  115150. function onLogcatCallback(type2, str) {
  115151. self2.postMessage({
  115152. msg: "logcat_callback",
  115153. data: {
  115154. type: type2,
  115155. logcat: str
  115156. }
  115157. });
  115158. }
  115159. };
  115160. __webpack_exports__2["default"] = TransmuxingWorker;
  115161. },
  115162. "./src/demux/amf-parser.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  115163. __webpack_require__2.r(__webpack_exports__2);
  115164. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logger.js");
  115165. var _utils_utf8_conv_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/utf8-conv.js");
  115166. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/exception.js");
  115167. var le = function() {
  115168. var buf = new ArrayBuffer(2);
  115169. new DataView(buf).setInt16(0, 256, true);
  115170. return new Int16Array(buf)[0] === 256;
  115171. }();
  115172. var AMF = function() {
  115173. function AMF2() {
  115174. }
  115175. AMF2.parseScriptData = function(arrayBuffer, dataOffset, dataSize) {
  115176. var data = {};
  115177. try {
  115178. var name_1 = AMF2.parseValue(arrayBuffer, dataOffset, dataSize);
  115179. var value = AMF2.parseValue(arrayBuffer, dataOffset + name_1.size, dataSize - name_1.size);
  115180. data[name_1.data] = value.data;
  115181. } catch (e) {
  115182. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.e("AMF", e.toString());
  115183. }
  115184. return data;
  115185. };
  115186. AMF2.parseObject = function(arrayBuffer, dataOffset, dataSize) {
  115187. if (dataSize < 3) {
  115188. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.IllegalStateException("Data not enough when parse ScriptDataObject");
  115189. }
  115190. var name = AMF2.parseString(arrayBuffer, dataOffset, dataSize);
  115191. var value = AMF2.parseValue(arrayBuffer, dataOffset + name.size, dataSize - name.size);
  115192. var isObjectEnd = value.objectEnd;
  115193. return {
  115194. data: {
  115195. name: name.data,
  115196. value: value.data
  115197. },
  115198. size: name.size + value.size,
  115199. objectEnd: isObjectEnd
  115200. };
  115201. };
  115202. AMF2.parseVariable = function(arrayBuffer, dataOffset, dataSize) {
  115203. return AMF2.parseObject(arrayBuffer, dataOffset, dataSize);
  115204. };
  115205. AMF2.parseString = function(arrayBuffer, dataOffset, dataSize) {
  115206. if (dataSize < 2) {
  115207. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.IllegalStateException("Data not enough when parse String");
  115208. }
  115209. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  115210. var length = v.getUint16(0, !le);
  115211. var str;
  115212. if (length > 0) {
  115213. str = (0, _utils_utf8_conv_js__WEBPACK_IMPORTED_MODULE_1__.default)(new Uint8Array(arrayBuffer, dataOffset + 2, length));
  115214. } else {
  115215. str = "";
  115216. }
  115217. return {
  115218. data: str,
  115219. size: 2 + length
  115220. };
  115221. };
  115222. AMF2.parseLongString = function(arrayBuffer, dataOffset, dataSize) {
  115223. if (dataSize < 4) {
  115224. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.IllegalStateException("Data not enough when parse LongString");
  115225. }
  115226. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  115227. var length = v.getUint32(0, !le);
  115228. var str;
  115229. if (length > 0) {
  115230. str = (0, _utils_utf8_conv_js__WEBPACK_IMPORTED_MODULE_1__.default)(new Uint8Array(arrayBuffer, dataOffset + 4, length));
  115231. } else {
  115232. str = "";
  115233. }
  115234. return {
  115235. data: str,
  115236. size: 4 + length
  115237. };
  115238. };
  115239. AMF2.parseDate = function(arrayBuffer, dataOffset, dataSize) {
  115240. if (dataSize < 10) {
  115241. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.IllegalStateException("Data size invalid when parse Date");
  115242. }
  115243. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  115244. var timestamp = v.getFloat64(0, !le);
  115245. var localTimeOffset = v.getInt16(8, !le);
  115246. timestamp += localTimeOffset * 60 * 1e3;
  115247. return {
  115248. data: new Date(timestamp),
  115249. size: 8 + 2
  115250. };
  115251. };
  115252. AMF2.parseValue = function(arrayBuffer, dataOffset, dataSize) {
  115253. if (dataSize < 1) {
  115254. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.IllegalStateException("Data not enough when parse Value");
  115255. }
  115256. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  115257. var offset = 1;
  115258. var type2 = v.getUint8(0);
  115259. var value;
  115260. var objectEnd = false;
  115261. try {
  115262. switch (type2) {
  115263. case 0:
  115264. value = v.getFloat64(1, !le);
  115265. offset += 8;
  115266. break;
  115267. case 1: {
  115268. var b = v.getUint8(1);
  115269. value = b ? true : false;
  115270. offset += 1;
  115271. break;
  115272. }
  115273. case 2: {
  115274. var amfstr = AMF2.parseString(arrayBuffer, dataOffset + 1, dataSize - 1);
  115275. value = amfstr.data;
  115276. offset += amfstr.size;
  115277. break;
  115278. }
  115279. case 3: {
  115280. value = {};
  115281. var terminal = 0;
  115282. if ((v.getUint32(dataSize - 4, !le) & 16777215) === 9) {
  115283. terminal = 3;
  115284. }
  115285. while (offset < dataSize - 4) {
  115286. var amfobj = AMF2.parseObject(arrayBuffer, dataOffset + offset, dataSize - offset - terminal);
  115287. if (amfobj.objectEnd)
  115288. break;
  115289. value[amfobj.data.name] = amfobj.data.value;
  115290. offset += amfobj.size;
  115291. }
  115292. if (offset <= dataSize - 3) {
  115293. var marker = v.getUint32(offset - 1, !le) & 16777215;
  115294. if (marker === 9) {
  115295. offset += 3;
  115296. }
  115297. }
  115298. break;
  115299. }
  115300. case 8: {
  115301. value = {};
  115302. offset += 4;
  115303. var terminal = 0;
  115304. if ((v.getUint32(dataSize - 4, !le) & 16777215) === 9) {
  115305. terminal = 3;
  115306. }
  115307. while (offset < dataSize - 8) {
  115308. var amfvar = AMF2.parseVariable(arrayBuffer, dataOffset + offset, dataSize - offset - terminal);
  115309. if (amfvar.objectEnd)
  115310. break;
  115311. value[amfvar.data.name] = amfvar.data.value;
  115312. offset += amfvar.size;
  115313. }
  115314. if (offset <= dataSize - 3) {
  115315. var marker = v.getUint32(offset - 1, !le) & 16777215;
  115316. if (marker === 9) {
  115317. offset += 3;
  115318. }
  115319. }
  115320. break;
  115321. }
  115322. case 9:
  115323. value = void 0;
  115324. offset = 1;
  115325. objectEnd = true;
  115326. break;
  115327. case 10: {
  115328. value = [];
  115329. var strictArrayLength = v.getUint32(1, !le);
  115330. offset += 4;
  115331. for (var i2 = 0; i2 < strictArrayLength; i2++) {
  115332. var val = AMF2.parseValue(arrayBuffer, dataOffset + offset, dataSize - offset);
  115333. value.push(val.data);
  115334. offset += val.size;
  115335. }
  115336. break;
  115337. }
  115338. case 11: {
  115339. var date = AMF2.parseDate(arrayBuffer, dataOffset + 1, dataSize - 1);
  115340. value = date.data;
  115341. offset += date.size;
  115342. break;
  115343. }
  115344. case 12: {
  115345. var amfLongStr = AMF2.parseString(arrayBuffer, dataOffset + 1, dataSize - 1);
  115346. value = amfLongStr.data;
  115347. offset += amfLongStr.size;
  115348. break;
  115349. }
  115350. default:
  115351. offset = dataSize;
  115352. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w("AMF", "Unsupported AMF value type " + type2);
  115353. }
  115354. } catch (e) {
  115355. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.e("AMF", e.toString());
  115356. }
  115357. return {
  115358. data: value,
  115359. size: offset,
  115360. objectEnd
  115361. };
  115362. };
  115363. return AMF2;
  115364. }();
  115365. __webpack_exports__2["default"] = AMF;
  115366. },
  115367. "./src/demux/demux-errors.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  115368. __webpack_require__2.r(__webpack_exports__2);
  115369. var DemuxErrors = {
  115370. OK: "OK",
  115371. FORMAT_ERROR: "FormatError",
  115372. FORMAT_UNSUPPORTED: "FormatUnsupported",
  115373. CODEC_UNSUPPORTED: "CodecUnsupported"
  115374. };
  115375. __webpack_exports__2["default"] = DemuxErrors;
  115376. },
  115377. "./src/demux/exp-golomb.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  115378. __webpack_require__2.r(__webpack_exports__2);
  115379. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/exception.js");
  115380. var ExpGolomb = function() {
  115381. function ExpGolomb2(uint8array) {
  115382. this.TAG = "ExpGolomb";
  115383. this._buffer = uint8array;
  115384. this._buffer_index = 0;
  115385. this._total_bytes = uint8array.byteLength;
  115386. this._total_bits = uint8array.byteLength * 8;
  115387. this._current_word = 0;
  115388. this._current_word_bits_left = 0;
  115389. }
  115390. ExpGolomb2.prototype.destroy = function() {
  115391. this._buffer = null;
  115392. };
  115393. ExpGolomb2.prototype._fillCurrentWord = function() {
  115394. var buffer_bytes_left = this._total_bytes - this._buffer_index;
  115395. if (buffer_bytes_left <= 0)
  115396. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_0__.IllegalStateException("ExpGolomb: _fillCurrentWord() but no bytes available");
  115397. var bytes_read = Math.min(4, buffer_bytes_left);
  115398. var word = new Uint8Array(4);
  115399. word.set(this._buffer.subarray(this._buffer_index, this._buffer_index + bytes_read));
  115400. this._current_word = new DataView(word.buffer).getUint32(0, false);
  115401. this._buffer_index += bytes_read;
  115402. this._current_word_bits_left = bytes_read * 8;
  115403. };
  115404. ExpGolomb2.prototype.readBits = function(bits) {
  115405. if (bits > 32)
  115406. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_0__.InvalidArgumentException("ExpGolomb: readBits() bits exceeded max 32bits!");
  115407. if (bits <= this._current_word_bits_left) {
  115408. var result_1 = this._current_word >>> 32 - bits;
  115409. this._current_word <<= bits;
  115410. this._current_word_bits_left -= bits;
  115411. return result_1;
  115412. }
  115413. var result = this._current_word_bits_left ? this._current_word : 0;
  115414. result = result >>> 32 - this._current_word_bits_left;
  115415. var bits_need_left = bits - this._current_word_bits_left;
  115416. this._fillCurrentWord();
  115417. var bits_read_next = Math.min(bits_need_left, this._current_word_bits_left);
  115418. var result2 = this._current_word >>> 32 - bits_read_next;
  115419. this._current_word <<= bits_read_next;
  115420. this._current_word_bits_left -= bits_read_next;
  115421. result = result << bits_read_next | result2;
  115422. return result;
  115423. };
  115424. ExpGolomb2.prototype.readBool = function() {
  115425. return this.readBits(1) === 1;
  115426. };
  115427. ExpGolomb2.prototype.readByte = function() {
  115428. return this.readBits(8);
  115429. };
  115430. ExpGolomb2.prototype._skipLeadingZero = function() {
  115431. var zero_count;
  115432. for (zero_count = 0; zero_count < this._current_word_bits_left; zero_count++) {
  115433. if (0 !== (this._current_word & 2147483648 >>> zero_count)) {
  115434. this._current_word <<= zero_count;
  115435. this._current_word_bits_left -= zero_count;
  115436. return zero_count;
  115437. }
  115438. }
  115439. this._fillCurrentWord();
  115440. return zero_count + this._skipLeadingZero();
  115441. };
  115442. ExpGolomb2.prototype.readUEG = function() {
  115443. var leading_zeros = this._skipLeadingZero();
  115444. return this.readBits(leading_zeros + 1) - 1;
  115445. };
  115446. ExpGolomb2.prototype.readSEG = function() {
  115447. var value = this.readUEG();
  115448. if (value & 1) {
  115449. return value + 1 >>> 1;
  115450. } else {
  115451. return -1 * (value >>> 1);
  115452. }
  115453. };
  115454. return ExpGolomb2;
  115455. }();
  115456. __webpack_exports__2["default"] = ExpGolomb;
  115457. },
  115458. "./src/demux/flv-demuxer.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  115459. __webpack_require__2.r(__webpack_exports__2);
  115460. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logger.js");
  115461. var _amf_parser_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/demux/amf-parser.js");
  115462. var _sps_parser_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/demux/sps-parser.js");
  115463. var _demux_errors_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/demux/demux-errors.js");
  115464. var _core_media_info_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/core/media-info.js");
  115465. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/utils/exception.js");
  115466. function ReadBig32(array, index2) {
  115467. return array[index2] << 24 | array[index2 + 1] << 16 | array[index2 + 2] << 8 | array[index2 + 3];
  115468. }
  115469. var FLVDemuxer = function() {
  115470. function FLVDemuxer2(probeData, config) {
  115471. this.TAG = "FLVDemuxer";
  115472. this._config = config;
  115473. this._onError = null;
  115474. this._onMediaInfo = null;
  115475. this._onMetaDataArrived = null;
  115476. this._onScriptDataArrived = null;
  115477. this._onTrackMetadata = null;
  115478. this._onDataAvailable = null;
  115479. this._dataOffset = probeData.dataOffset;
  115480. this._firstParse = true;
  115481. this._dispatch = false;
  115482. this._hasAudio = probeData.hasAudioTrack;
  115483. this._hasVideo = probeData.hasVideoTrack;
  115484. this._hasAudioFlagOverrided = false;
  115485. this._hasVideoFlagOverrided = false;
  115486. this._audioInitialMetadataDispatched = false;
  115487. this._videoInitialMetadataDispatched = false;
  115488. this._mediaInfo = new _core_media_info_js__WEBPACK_IMPORTED_MODULE_4__.default();
  115489. this._mediaInfo.hasAudio = this._hasAudio;
  115490. this._mediaInfo.hasVideo = this._hasVideo;
  115491. this._metadata = null;
  115492. this._audioMetadata = null;
  115493. this._videoMetadata = null;
  115494. this._naluLengthSize = 4;
  115495. this._timestampBase = 0;
  115496. this._timescale = 1e3;
  115497. this._duration = 0;
  115498. this._durationOverrided = false;
  115499. this._referenceFrameRate = {
  115500. fixed: true,
  115501. fps: 23.976,
  115502. fps_num: 23976,
  115503. fps_den: 1e3
  115504. };
  115505. this._flvSoundRateTable = [5500, 11025, 22050, 44100, 48e3];
  115506. this._mpegSamplingRates = [
  115507. 96e3,
  115508. 88200,
  115509. 64e3,
  115510. 48e3,
  115511. 44100,
  115512. 32e3,
  115513. 24e3,
  115514. 22050,
  115515. 16e3,
  115516. 12e3,
  115517. 11025,
  115518. 8e3,
  115519. 7350
  115520. ];
  115521. this._mpegAudioV10SampleRateTable = [44100, 48e3, 32e3, 0];
  115522. this._mpegAudioV20SampleRateTable = [22050, 24e3, 16e3, 0];
  115523. this._mpegAudioV25SampleRateTable = [11025, 12e3, 8e3, 0];
  115524. this._mpegAudioL1BitRateTable = [0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, -1];
  115525. this._mpegAudioL2BitRateTable = [0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, -1];
  115526. this._mpegAudioL3BitRateTable = [0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1];
  115527. this._videoTrack = { type: "video", id: 1, sequenceNumber: 0, samples: [], length: 0 };
  115528. this._audioTrack = { type: "audio", id: 2, sequenceNumber: 0, samples: [], length: 0 };
  115529. this._littleEndian = function() {
  115530. var buf = new ArrayBuffer(2);
  115531. new DataView(buf).setInt16(0, 256, true);
  115532. return new Int16Array(buf)[0] === 256;
  115533. }();
  115534. }
  115535. FLVDemuxer2.prototype.destroy = function() {
  115536. this._mediaInfo = null;
  115537. this._metadata = null;
  115538. this._audioMetadata = null;
  115539. this._videoMetadata = null;
  115540. this._videoTrack = null;
  115541. this._audioTrack = null;
  115542. this._onError = null;
  115543. this._onMediaInfo = null;
  115544. this._onMetaDataArrived = null;
  115545. this._onScriptDataArrived = null;
  115546. this._onTrackMetadata = null;
  115547. this._onDataAvailable = null;
  115548. };
  115549. FLVDemuxer2.probe = function(buffer) {
  115550. var data = new Uint8Array(buffer);
  115551. var mismatch = { match: false };
  115552. if (data[0] !== 70 || data[1] !== 76 || data[2] !== 86 || data[3] !== 1) {
  115553. return mismatch;
  115554. }
  115555. var hasAudio = (data[4] & 4) >>> 2 !== 0;
  115556. var hasVideo = (data[4] & 1) !== 0;
  115557. var offset = ReadBig32(data, 5);
  115558. if (offset < 9) {
  115559. return mismatch;
  115560. }
  115561. return {
  115562. match: true,
  115563. consumed: offset,
  115564. dataOffset: offset,
  115565. hasAudioTrack: hasAudio,
  115566. hasVideoTrack: hasVideo
  115567. };
  115568. };
  115569. FLVDemuxer2.prototype.bindDataSource = function(loader) {
  115570. loader.onDataArrival = this.parseChunks.bind(this);
  115571. return this;
  115572. };
  115573. Object.defineProperty(FLVDemuxer2.prototype, "onTrackMetadata", {
  115574. get: function() {
  115575. return this._onTrackMetadata;
  115576. },
  115577. set: function(callback2) {
  115578. this._onTrackMetadata = callback2;
  115579. },
  115580. enumerable: false,
  115581. configurable: true
  115582. });
  115583. Object.defineProperty(FLVDemuxer2.prototype, "onMediaInfo", {
  115584. get: function() {
  115585. return this._onMediaInfo;
  115586. },
  115587. set: function(callback2) {
  115588. this._onMediaInfo = callback2;
  115589. },
  115590. enumerable: false,
  115591. configurable: true
  115592. });
  115593. Object.defineProperty(FLVDemuxer2.prototype, "onMetaDataArrived", {
  115594. get: function() {
  115595. return this._onMetaDataArrived;
  115596. },
  115597. set: function(callback2) {
  115598. this._onMetaDataArrived = callback2;
  115599. },
  115600. enumerable: false,
  115601. configurable: true
  115602. });
  115603. Object.defineProperty(FLVDemuxer2.prototype, "onScriptDataArrived", {
  115604. get: function() {
  115605. return this._onScriptDataArrived;
  115606. },
  115607. set: function(callback2) {
  115608. this._onScriptDataArrived = callback2;
  115609. },
  115610. enumerable: false,
  115611. configurable: true
  115612. });
  115613. Object.defineProperty(FLVDemuxer2.prototype, "onError", {
  115614. get: function() {
  115615. return this._onError;
  115616. },
  115617. set: function(callback2) {
  115618. this._onError = callback2;
  115619. },
  115620. enumerable: false,
  115621. configurable: true
  115622. });
  115623. Object.defineProperty(FLVDemuxer2.prototype, "onDataAvailable", {
  115624. get: function() {
  115625. return this._onDataAvailable;
  115626. },
  115627. set: function(callback2) {
  115628. this._onDataAvailable = callback2;
  115629. },
  115630. enumerable: false,
  115631. configurable: true
  115632. });
  115633. Object.defineProperty(FLVDemuxer2.prototype, "timestampBase", {
  115634. get: function() {
  115635. return this._timestampBase;
  115636. },
  115637. set: function(base2) {
  115638. this._timestampBase = base2;
  115639. },
  115640. enumerable: false,
  115641. configurable: true
  115642. });
  115643. Object.defineProperty(FLVDemuxer2.prototype, "overridedDuration", {
  115644. get: function() {
  115645. return this._duration;
  115646. },
  115647. set: function(duration5) {
  115648. this._durationOverrided = true;
  115649. this._duration = duration5;
  115650. this._mediaInfo.duration = duration5;
  115651. },
  115652. enumerable: false,
  115653. configurable: true
  115654. });
  115655. Object.defineProperty(FLVDemuxer2.prototype, "overridedHasAudio", {
  115656. set: function(hasAudio) {
  115657. this._hasAudioFlagOverrided = true;
  115658. this._hasAudio = hasAudio;
  115659. this._mediaInfo.hasAudio = hasAudio;
  115660. },
  115661. enumerable: false,
  115662. configurable: true
  115663. });
  115664. Object.defineProperty(FLVDemuxer2.prototype, "overridedHasVideo", {
  115665. set: function(hasVideo) {
  115666. this._hasVideoFlagOverrided = true;
  115667. this._hasVideo = hasVideo;
  115668. this._mediaInfo.hasVideo = hasVideo;
  115669. },
  115670. enumerable: false,
  115671. configurable: true
  115672. });
  115673. FLVDemuxer2.prototype.resetMediaInfo = function() {
  115674. this._mediaInfo = new _core_media_info_js__WEBPACK_IMPORTED_MODULE_4__.default();
  115675. };
  115676. FLVDemuxer2.prototype._isInitialMetadataDispatched = function() {
  115677. if (this._hasAudio && this._hasVideo) {
  115678. return this._audioInitialMetadataDispatched && this._videoInitialMetadataDispatched;
  115679. }
  115680. if (this._hasAudio && !this._hasVideo) {
  115681. return this._audioInitialMetadataDispatched;
  115682. }
  115683. if (!this._hasAudio && this._hasVideo) {
  115684. return this._videoInitialMetadataDispatched;
  115685. }
  115686. return false;
  115687. };
  115688. FLVDemuxer2.prototype.parseChunks = function(chunk, byteStart) {
  115689. if (!this._onError || !this._onMediaInfo || !this._onTrackMetadata || !this._onDataAvailable) {
  115690. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__.IllegalStateException("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");
  115691. }
  115692. var offset = 0;
  115693. var le = this._littleEndian;
  115694. if (byteStart === 0) {
  115695. if (chunk.byteLength > 13) {
  115696. var probeData = FLVDemuxer2.probe(chunk);
  115697. offset = probeData.dataOffset;
  115698. } else {
  115699. return 0;
  115700. }
  115701. }
  115702. if (this._firstParse) {
  115703. this._firstParse = false;
  115704. if (byteStart + offset !== this._dataOffset) {
  115705. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "First time parsing but chunk byteStart invalid!");
  115706. }
  115707. var v = new DataView(chunk, offset);
  115708. var prevTagSize0 = v.getUint32(0, !le);
  115709. if (prevTagSize0 !== 0) {
  115710. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "PrevTagSize0 !== 0 !!!");
  115711. }
  115712. offset += 4;
  115713. }
  115714. while (offset < chunk.byteLength) {
  115715. this._dispatch = true;
  115716. var v = new DataView(chunk, offset);
  115717. if (offset + 11 + 4 > chunk.byteLength) {
  115718. break;
  115719. }
  115720. var tagType = v.getUint8(0);
  115721. var dataSize = v.getUint32(0, !le) & 16777215;
  115722. if (offset + 11 + dataSize + 4 > chunk.byteLength) {
  115723. break;
  115724. }
  115725. if (tagType !== 8 && tagType !== 9 && tagType !== 18) {
  115726. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Unsupported tag type " + tagType + ", skipped");
  115727. offset += 11 + dataSize + 4;
  115728. continue;
  115729. }
  115730. var ts22 = v.getUint8(4);
  115731. var ts1 = v.getUint8(5);
  115732. var ts0 = v.getUint8(6);
  115733. var ts3 = v.getUint8(7);
  115734. var timestamp = ts0 | ts1 << 8 | ts22 << 16 | ts3 << 24;
  115735. var streamId = v.getUint32(7, !le) & 16777215;
  115736. if (streamId !== 0) {
  115737. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Meet tag which has StreamID != 0!");
  115738. }
  115739. var dataOffset = offset + 11;
  115740. switch (tagType) {
  115741. case 8:
  115742. this._parseAudioData(chunk, dataOffset, dataSize, timestamp);
  115743. break;
  115744. case 9:
  115745. this._parseVideoData(chunk, dataOffset, dataSize, timestamp, byteStart + offset);
  115746. break;
  115747. case 18:
  115748. this._parseScriptData(chunk, dataOffset, dataSize);
  115749. break;
  115750. }
  115751. var prevTagSize = v.getUint32(11 + dataSize, !le);
  115752. if (prevTagSize !== 11 + dataSize) {
  115753. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Invalid PrevTagSize " + prevTagSize);
  115754. }
  115755. offset += 11 + dataSize + 4;
  115756. }
  115757. if (this._isInitialMetadataDispatched()) {
  115758. if (this._dispatch && (this._audioTrack.length || this._videoTrack.length)) {
  115759. this._onDataAvailable(this._audioTrack, this._videoTrack);
  115760. }
  115761. }
  115762. return offset;
  115763. };
  115764. FLVDemuxer2.prototype._parseScriptData = function(arrayBuffer, dataOffset, dataSize) {
  115765. var scriptData = _amf_parser_js__WEBPACK_IMPORTED_MODULE_1__.default.parseScriptData(arrayBuffer, dataOffset, dataSize);
  115766. if (scriptData.hasOwnProperty("onMetaData")) {
  115767. if (scriptData.onMetaData == null || typeof scriptData.onMetaData !== "object") {
  115768. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Invalid onMetaData structure!");
  115769. return;
  115770. }
  115771. if (this._metadata) {
  115772. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Found another onMetaData tag!");
  115773. }
  115774. this._metadata = scriptData;
  115775. var onMetaData = this._metadata.onMetaData;
  115776. if (this._onMetaDataArrived) {
  115777. this._onMetaDataArrived(Object.assign({}, onMetaData));
  115778. }
  115779. if (typeof onMetaData.hasAudio === "boolean") {
  115780. if (this._hasAudioFlagOverrided === false) {
  115781. this._hasAudio = onMetaData.hasAudio;
  115782. this._mediaInfo.hasAudio = this._hasAudio;
  115783. }
  115784. }
  115785. if (typeof onMetaData.hasVideo === "boolean") {
  115786. if (this._hasVideoFlagOverrided === false) {
  115787. this._hasVideo = onMetaData.hasVideo;
  115788. this._mediaInfo.hasVideo = this._hasVideo;
  115789. }
  115790. }
  115791. if (typeof onMetaData.audiodatarate === "number") {
  115792. this._mediaInfo.audioDataRate = onMetaData.audiodatarate;
  115793. }
  115794. if (typeof onMetaData.videodatarate === "number") {
  115795. this._mediaInfo.videoDataRate = onMetaData.videodatarate;
  115796. }
  115797. if (typeof onMetaData.width === "number") {
  115798. this._mediaInfo.width = onMetaData.width;
  115799. }
  115800. if (typeof onMetaData.height === "number") {
  115801. this._mediaInfo.height = onMetaData.height;
  115802. }
  115803. if (typeof onMetaData.duration === "number") {
  115804. if (!this._durationOverrided) {
  115805. var duration5 = Math.floor(onMetaData.duration * this._timescale);
  115806. this._duration = duration5;
  115807. this._mediaInfo.duration = duration5;
  115808. }
  115809. } else {
  115810. this._mediaInfo.duration = 0;
  115811. }
  115812. if (typeof onMetaData.framerate === "number") {
  115813. var fps_num = Math.floor(onMetaData.framerate * 1e3);
  115814. if (fps_num > 0) {
  115815. var fps = fps_num / 1e3;
  115816. this._referenceFrameRate.fixed = true;
  115817. this._referenceFrameRate.fps = fps;
  115818. this._referenceFrameRate.fps_num = fps_num;
  115819. this._referenceFrameRate.fps_den = 1e3;
  115820. this._mediaInfo.fps = fps;
  115821. }
  115822. }
  115823. if (typeof onMetaData.keyframes === "object") {
  115824. this._mediaInfo.hasKeyframesIndex = true;
  115825. var keyframes = onMetaData.keyframes;
  115826. this._mediaInfo.keyframesIndex = this._parseKeyframesIndex(keyframes);
  115827. onMetaData.keyframes = null;
  115828. } else {
  115829. this._mediaInfo.hasKeyframesIndex = false;
  115830. }
  115831. this._dispatch = false;
  115832. this._mediaInfo.metadata = onMetaData;
  115833. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.v(this.TAG, "Parsed onMetaData");
  115834. if (this._mediaInfo.isComplete()) {
  115835. this._onMediaInfo(this._mediaInfo);
  115836. }
  115837. }
  115838. if (Object.keys(scriptData).length > 0) {
  115839. if (this._onScriptDataArrived) {
  115840. this._onScriptDataArrived(Object.assign({}, scriptData));
  115841. }
  115842. }
  115843. };
  115844. FLVDemuxer2.prototype._parseKeyframesIndex = function(keyframes) {
  115845. var times = [];
  115846. var filepositions = [];
  115847. for (var i2 = 1; i2 < keyframes.times.length; i2++) {
  115848. var time = this._timestampBase + Math.floor(keyframes.times[i2] * 1e3);
  115849. times.push(time);
  115850. filepositions.push(keyframes.filepositions[i2]);
  115851. }
  115852. return {
  115853. times,
  115854. filepositions
  115855. };
  115856. };
  115857. FLVDemuxer2.prototype._parseAudioData = function(arrayBuffer, dataOffset, dataSize, tagTimestamp) {
  115858. if (dataSize <= 1) {
  115859. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Invalid audio packet, missing SoundData payload!");
  115860. return;
  115861. }
  115862. if (this._hasAudioFlagOverrided === true && this._hasAudio === false) {
  115863. return;
  115864. }
  115865. this._littleEndian;
  115866. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  115867. var soundSpec = v.getUint8(0);
  115868. var soundFormat = soundSpec >>> 4;
  115869. if (soundFormat !== 2 && soundFormat !== 10) {
  115870. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.CODEC_UNSUPPORTED, "Flv: Unsupported audio codec idx: " + soundFormat);
  115871. return;
  115872. }
  115873. var soundRate = 0;
  115874. var soundRateIndex = (soundSpec & 12) >>> 2;
  115875. if (soundRateIndex >= 0 && soundRateIndex <= 4) {
  115876. soundRate = this._flvSoundRateTable[soundRateIndex];
  115877. } else {
  115878. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: Invalid audio sample rate idx: " + soundRateIndex);
  115879. return;
  115880. }
  115881. var soundType = soundSpec & 1;
  115882. var meta2 = this._audioMetadata;
  115883. var track = this._audioTrack;
  115884. if (!meta2) {
  115885. if (this._hasAudio === false && this._hasAudioFlagOverrided === false) {
  115886. this._hasAudio = true;
  115887. this._mediaInfo.hasAudio = true;
  115888. }
  115889. meta2 = this._audioMetadata = {};
  115890. meta2.type = "audio";
  115891. meta2.id = track.id;
  115892. meta2.timescale = this._timescale;
  115893. meta2.duration = this._duration;
  115894. meta2.audioSampleRate = soundRate;
  115895. meta2.channelCount = soundType === 0 ? 1 : 2;
  115896. }
  115897. if (soundFormat === 10) {
  115898. var aacData = this._parseAACAudioData(arrayBuffer, dataOffset + 1, dataSize - 1);
  115899. if (aacData == void 0) {
  115900. return;
  115901. }
  115902. if (aacData.packetType === 0) {
  115903. if (meta2.config) {
  115904. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Found another AudioSpecificConfig!");
  115905. }
  115906. var misc = aacData.data;
  115907. meta2.audioSampleRate = misc.samplingRate;
  115908. meta2.channelCount = misc.channelCount;
  115909. meta2.codec = misc.codec;
  115910. meta2.originalCodec = misc.originalCodec;
  115911. meta2.config = misc.config;
  115912. meta2.refSampleDuration = 1024 / meta2.audioSampleRate * meta2.timescale;
  115913. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.v(this.TAG, "Parsed AudioSpecificConfig");
  115914. if (this._isInitialMetadataDispatched()) {
  115915. if (this._dispatch && (this._audioTrack.length || this._videoTrack.length)) {
  115916. this._onDataAvailable(this._audioTrack, this._videoTrack);
  115917. }
  115918. } else {
  115919. this._audioInitialMetadataDispatched = true;
  115920. }
  115921. this._dispatch = false;
  115922. this._onTrackMetadata("audio", meta2);
  115923. var mi = this._mediaInfo;
  115924. mi.audioCodec = meta2.originalCodec;
  115925. mi.audioSampleRate = meta2.audioSampleRate;
  115926. mi.audioChannelCount = meta2.channelCount;
  115927. if (mi.hasVideo) {
  115928. if (mi.videoCodec != null) {
  115929. mi.mimeType = 'video/x-flv; codecs="' + mi.videoCodec + "," + mi.audioCodec + '"';
  115930. }
  115931. } else {
  115932. mi.mimeType = 'video/x-flv; codecs="' + mi.audioCodec + '"';
  115933. }
  115934. if (mi.isComplete()) {
  115935. this._onMediaInfo(mi);
  115936. }
  115937. } else if (aacData.packetType === 1) {
  115938. var dts = this._timestampBase + tagTimestamp;
  115939. var aacSample = { unit: aacData.data, length: aacData.data.byteLength, dts, pts: dts };
  115940. track.samples.push(aacSample);
  115941. track.length += aacData.data.length;
  115942. } else {
  115943. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.e(this.TAG, "Flv: Unsupported AAC data type " + aacData.packetType);
  115944. }
  115945. } else if (soundFormat === 2) {
  115946. if (!meta2.codec) {
  115947. var misc = this._parseMP3AudioData(arrayBuffer, dataOffset + 1, dataSize - 1, true);
  115948. if (misc == void 0) {
  115949. return;
  115950. }
  115951. meta2.audioSampleRate = misc.samplingRate;
  115952. meta2.channelCount = misc.channelCount;
  115953. meta2.codec = misc.codec;
  115954. meta2.originalCodec = misc.originalCodec;
  115955. meta2.refSampleDuration = 1152 / meta2.audioSampleRate * meta2.timescale;
  115956. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.v(this.TAG, "Parsed MPEG Audio Frame Header");
  115957. this._audioInitialMetadataDispatched = true;
  115958. this._onTrackMetadata("audio", meta2);
  115959. var mi = this._mediaInfo;
  115960. mi.audioCodec = meta2.codec;
  115961. mi.audioSampleRate = meta2.audioSampleRate;
  115962. mi.audioChannelCount = meta2.channelCount;
  115963. mi.audioDataRate = misc.bitRate;
  115964. if (mi.hasVideo) {
  115965. if (mi.videoCodec != null) {
  115966. mi.mimeType = 'video/x-flv; codecs="' + mi.videoCodec + "," + mi.audioCodec + '"';
  115967. }
  115968. } else {
  115969. mi.mimeType = 'video/x-flv; codecs="' + mi.audioCodec + '"';
  115970. }
  115971. if (mi.isComplete()) {
  115972. this._onMediaInfo(mi);
  115973. }
  115974. }
  115975. var data = this._parseMP3AudioData(arrayBuffer, dataOffset + 1, dataSize - 1, false);
  115976. if (data == void 0) {
  115977. return;
  115978. }
  115979. var dts = this._timestampBase + tagTimestamp;
  115980. var mp3Sample = { unit: data, length: data.byteLength, dts, pts: dts };
  115981. track.samples.push(mp3Sample);
  115982. track.length += data.length;
  115983. }
  115984. };
  115985. FLVDemuxer2.prototype._parseAACAudioData = function(arrayBuffer, dataOffset, dataSize) {
  115986. if (dataSize <= 1) {
  115987. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Invalid AAC packet, missing AACPacketType or/and Data!");
  115988. return;
  115989. }
  115990. var result = {};
  115991. var array = new Uint8Array(arrayBuffer, dataOffset, dataSize);
  115992. result.packetType = array[0];
  115993. if (array[0] === 0) {
  115994. result.data = this._parseAACAudioSpecificConfig(arrayBuffer, dataOffset + 1, dataSize - 1);
  115995. } else {
  115996. result.data = array.subarray(1);
  115997. }
  115998. return result;
  115999. };
  116000. FLVDemuxer2.prototype._parseAACAudioSpecificConfig = function(arrayBuffer, dataOffset, dataSize) {
  116001. var array = new Uint8Array(arrayBuffer, dataOffset, dataSize);
  116002. var config = null;
  116003. var audioObjectType = 0;
  116004. var originalAudioObjectType = 0;
  116005. var samplingIndex = 0;
  116006. var extensionSamplingIndex = null;
  116007. audioObjectType = originalAudioObjectType = array[0] >>> 3;
  116008. samplingIndex = (array[0] & 7) << 1 | array[1] >>> 7;
  116009. if (samplingIndex < 0 || samplingIndex >= this._mpegSamplingRates.length) {
  116010. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: AAC invalid sampling frequency index!");
  116011. return;
  116012. }
  116013. var samplingFrequence = this._mpegSamplingRates[samplingIndex];
  116014. var channelConfig = (array[1] & 120) >>> 3;
  116015. if (channelConfig < 0 || channelConfig >= 8) {
  116016. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: AAC invalid channel configuration");
  116017. return;
  116018. }
  116019. if (audioObjectType === 5) {
  116020. extensionSamplingIndex = (array[1] & 7) << 1 | array[2] >>> 7;
  116021. (array[2] & 124) >>> 2;
  116022. }
  116023. var userAgent = self.navigator.userAgent.toLowerCase();
  116024. if (userAgent.indexOf("firefox") !== -1) {
  116025. if (samplingIndex >= 6) {
  116026. audioObjectType = 5;
  116027. config = new Array(4);
  116028. extensionSamplingIndex = samplingIndex - 3;
  116029. } else {
  116030. audioObjectType = 2;
  116031. config = new Array(2);
  116032. extensionSamplingIndex = samplingIndex;
  116033. }
  116034. } else if (userAgent.indexOf("android") !== -1) {
  116035. audioObjectType = 2;
  116036. config = new Array(2);
  116037. extensionSamplingIndex = samplingIndex;
  116038. } else {
  116039. audioObjectType = 5;
  116040. extensionSamplingIndex = samplingIndex;
  116041. config = new Array(4);
  116042. if (samplingIndex >= 6) {
  116043. extensionSamplingIndex = samplingIndex - 3;
  116044. } else if (channelConfig === 1) {
  116045. audioObjectType = 2;
  116046. config = new Array(2);
  116047. extensionSamplingIndex = samplingIndex;
  116048. }
  116049. }
  116050. config[0] = audioObjectType << 3;
  116051. config[0] |= (samplingIndex & 15) >>> 1;
  116052. config[1] = (samplingIndex & 15) << 7;
  116053. config[1] |= (channelConfig & 15) << 3;
  116054. if (audioObjectType === 5) {
  116055. config[1] |= (extensionSamplingIndex & 15) >>> 1;
  116056. config[2] = (extensionSamplingIndex & 1) << 7;
  116057. config[2] |= 2 << 2;
  116058. config[3] = 0;
  116059. }
  116060. return {
  116061. config,
  116062. samplingRate: samplingFrequence,
  116063. channelCount: channelConfig,
  116064. codec: "mp4a.40." + audioObjectType,
  116065. originalCodec: "mp4a.40." + originalAudioObjectType
  116066. };
  116067. };
  116068. FLVDemuxer2.prototype._parseMP3AudioData = function(arrayBuffer, dataOffset, dataSize, requestHeader) {
  116069. if (dataSize < 4) {
  116070. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Invalid MP3 packet, header missing!");
  116071. return;
  116072. }
  116073. this._littleEndian;
  116074. var array = new Uint8Array(arrayBuffer, dataOffset, dataSize);
  116075. var result = null;
  116076. if (requestHeader) {
  116077. if (array[0] !== 255) {
  116078. return;
  116079. }
  116080. var ver = array[1] >>> 3 & 3;
  116081. var layer = (array[1] & 6) >> 1;
  116082. var bitrate_index = (array[2] & 240) >>> 4;
  116083. var sampling_freq_index = (array[2] & 12) >>> 2;
  116084. var channel_mode = array[3] >>> 6 & 3;
  116085. var channel_count = channel_mode !== 3 ? 2 : 1;
  116086. var sample_rate = 0;
  116087. var bit_rate = 0;
  116088. var codec = "mp3";
  116089. switch (ver) {
  116090. case 0:
  116091. sample_rate = this._mpegAudioV25SampleRateTable[sampling_freq_index];
  116092. break;
  116093. case 2:
  116094. sample_rate = this._mpegAudioV20SampleRateTable[sampling_freq_index];
  116095. break;
  116096. case 3:
  116097. sample_rate = this._mpegAudioV10SampleRateTable[sampling_freq_index];
  116098. break;
  116099. }
  116100. switch (layer) {
  116101. case 1:
  116102. if (bitrate_index < this._mpegAudioL3BitRateTable.length) {
  116103. bit_rate = this._mpegAudioL3BitRateTable[bitrate_index];
  116104. }
  116105. break;
  116106. case 2:
  116107. if (bitrate_index < this._mpegAudioL2BitRateTable.length) {
  116108. bit_rate = this._mpegAudioL2BitRateTable[bitrate_index];
  116109. }
  116110. break;
  116111. case 3:
  116112. if (bitrate_index < this._mpegAudioL1BitRateTable.length) {
  116113. bit_rate = this._mpegAudioL1BitRateTable[bitrate_index];
  116114. }
  116115. break;
  116116. }
  116117. result = {
  116118. bitRate: bit_rate,
  116119. samplingRate: sample_rate,
  116120. channelCount: channel_count,
  116121. codec,
  116122. originalCodec: codec
  116123. };
  116124. } else {
  116125. result = array;
  116126. }
  116127. return result;
  116128. };
  116129. FLVDemuxer2.prototype._parseVideoData = function(arrayBuffer, dataOffset, dataSize, tagTimestamp, tagPosition) {
  116130. if (dataSize <= 1) {
  116131. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Invalid video packet, missing VideoData payload!");
  116132. return;
  116133. }
  116134. if (this._hasVideoFlagOverrided === true && this._hasVideo === false) {
  116135. return;
  116136. }
  116137. var spec = new Uint8Array(arrayBuffer, dataOffset, dataSize)[0];
  116138. var frameType = (spec & 240) >>> 4;
  116139. var codecId = spec & 15;
  116140. if (codecId !== 7) {
  116141. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.CODEC_UNSUPPORTED, "Flv: Unsupported codec in video frame: " + codecId);
  116142. return;
  116143. }
  116144. this._parseAVCVideoPacket(arrayBuffer, dataOffset + 1, dataSize - 1, tagTimestamp, tagPosition, frameType);
  116145. };
  116146. FLVDemuxer2.prototype._parseAVCVideoPacket = function(arrayBuffer, dataOffset, dataSize, tagTimestamp, tagPosition, frameType) {
  116147. if (dataSize < 4) {
  116148. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");
  116149. return;
  116150. }
  116151. var le = this._littleEndian;
  116152. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  116153. var packetType = v.getUint8(0);
  116154. var cts_unsigned = v.getUint32(0, !le) & 16777215;
  116155. var cts = cts_unsigned << 8 >> 8;
  116156. if (packetType === 0) {
  116157. this._parseAVCDecoderConfigurationRecord(arrayBuffer, dataOffset + 4, dataSize - 4);
  116158. } else if (packetType === 1) {
  116159. this._parseAVCVideoData(arrayBuffer, dataOffset + 4, dataSize - 4, tagTimestamp, tagPosition, frameType, cts);
  116160. } else if (packetType === 2)
  116161. ;
  116162. else {
  116163. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: Invalid video packet type " + packetType);
  116164. return;
  116165. }
  116166. };
  116167. FLVDemuxer2.prototype._parseAVCDecoderConfigurationRecord = function(arrayBuffer, dataOffset, dataSize) {
  116168. if (dataSize < 7) {
  116169. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");
  116170. return;
  116171. }
  116172. var meta2 = this._videoMetadata;
  116173. var track = this._videoTrack;
  116174. var le = this._littleEndian;
  116175. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  116176. if (!meta2) {
  116177. if (this._hasVideo === false && this._hasVideoFlagOverrided === false) {
  116178. this._hasVideo = true;
  116179. this._mediaInfo.hasVideo = true;
  116180. }
  116181. meta2 = this._videoMetadata = {};
  116182. meta2.type = "video";
  116183. meta2.id = track.id;
  116184. meta2.timescale = this._timescale;
  116185. meta2.duration = this._duration;
  116186. } else {
  116187. if (typeof meta2.avcc !== "undefined") {
  116188. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Found another AVCDecoderConfigurationRecord!");
  116189. }
  116190. }
  116191. var version2 = v.getUint8(0);
  116192. var avcProfile = v.getUint8(1);
  116193. v.getUint8(2);
  116194. v.getUint8(3);
  116195. if (version2 !== 1 || avcProfile === 0) {
  116196. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: Invalid AVCDecoderConfigurationRecord");
  116197. return;
  116198. }
  116199. this._naluLengthSize = (v.getUint8(4) & 3) + 1;
  116200. if (this._naluLengthSize !== 3 && this._naluLengthSize !== 4) {
  116201. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: Strange NaluLengthSizeMinusOne: " + (this._naluLengthSize - 1));
  116202. return;
  116203. }
  116204. var spsCount = v.getUint8(5) & 31;
  116205. if (spsCount === 0) {
  116206. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: Invalid AVCDecoderConfigurationRecord: No SPS");
  116207. return;
  116208. } else if (spsCount > 1) {
  116209. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Strange AVCDecoderConfigurationRecord: SPS Count = " + spsCount);
  116210. }
  116211. var offset = 6;
  116212. for (var i2 = 0; i2 < spsCount; i2++) {
  116213. var len = v.getUint16(offset, !le);
  116214. offset += 2;
  116215. if (len === 0) {
  116216. continue;
  116217. }
  116218. var sps = new Uint8Array(arrayBuffer, dataOffset + offset, len);
  116219. offset += len;
  116220. var config = _sps_parser_js__WEBPACK_IMPORTED_MODULE_2__.default.parseSPS(sps);
  116221. if (i2 !== 0) {
  116222. continue;
  116223. }
  116224. meta2.codecWidth = config.codec_size.width;
  116225. meta2.codecHeight = config.codec_size.height;
  116226. meta2.presentWidth = config.present_size.width;
  116227. meta2.presentHeight = config.present_size.height;
  116228. meta2.profile = config.profile_string;
  116229. meta2.level = config.level_string;
  116230. meta2.bitDepth = config.bit_depth;
  116231. meta2.chromaFormat = config.chroma_format;
  116232. meta2.sarRatio = config.sar_ratio;
  116233. meta2.frameRate = config.frame_rate;
  116234. if (config.frame_rate.fixed === false || config.frame_rate.fps_num === 0 || config.frame_rate.fps_den === 0) {
  116235. meta2.frameRate = this._referenceFrameRate;
  116236. }
  116237. var fps_den = meta2.frameRate.fps_den;
  116238. var fps_num = meta2.frameRate.fps_num;
  116239. meta2.refSampleDuration = meta2.timescale * (fps_den / fps_num);
  116240. var codecArray = sps.subarray(1, 4);
  116241. var codecString = "avc1.";
  116242. for (var j = 0; j < 3; j++) {
  116243. var h2 = codecArray[j].toString(16);
  116244. if (h2.length < 2) {
  116245. h2 = "0" + h2;
  116246. }
  116247. codecString += h2;
  116248. }
  116249. meta2.codec = codecString;
  116250. var mi = this._mediaInfo;
  116251. mi.width = meta2.codecWidth;
  116252. mi.height = meta2.codecHeight;
  116253. mi.fps = meta2.frameRate.fps;
  116254. mi.profile = meta2.profile;
  116255. mi.level = meta2.level;
  116256. mi.refFrames = config.ref_frames;
  116257. mi.chromaFormat = config.chroma_format_string;
  116258. mi.sarNum = meta2.sarRatio.width;
  116259. mi.sarDen = meta2.sarRatio.height;
  116260. mi.videoCodec = codecString;
  116261. if (mi.hasAudio) {
  116262. if (mi.audioCodec != null) {
  116263. mi.mimeType = 'video/x-flv; codecs="' + mi.videoCodec + "," + mi.audioCodec + '"';
  116264. }
  116265. } else {
  116266. mi.mimeType = 'video/x-flv; codecs="' + mi.videoCodec + '"';
  116267. }
  116268. if (mi.isComplete()) {
  116269. this._onMediaInfo(mi);
  116270. }
  116271. }
  116272. var ppsCount = v.getUint8(offset);
  116273. if (ppsCount === 0) {
  116274. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: Invalid AVCDecoderConfigurationRecord: No PPS");
  116275. return;
  116276. } else if (ppsCount > 1) {
  116277. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Strange AVCDecoderConfigurationRecord: PPS Count = " + ppsCount);
  116278. }
  116279. offset++;
  116280. for (var i2 = 0; i2 < ppsCount; i2++) {
  116281. var len = v.getUint16(offset, !le);
  116282. offset += 2;
  116283. if (len === 0) {
  116284. continue;
  116285. }
  116286. offset += len;
  116287. }
  116288. meta2.avcc = new Uint8Array(dataSize);
  116289. meta2.avcc.set(new Uint8Array(arrayBuffer, dataOffset, dataSize), 0);
  116290. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.v(this.TAG, "Parsed AVCDecoderConfigurationRecord");
  116291. if (this._isInitialMetadataDispatched()) {
  116292. if (this._dispatch && (this._audioTrack.length || this._videoTrack.length)) {
  116293. this._onDataAvailable(this._audioTrack, this._videoTrack);
  116294. }
  116295. } else {
  116296. this._videoInitialMetadataDispatched = true;
  116297. }
  116298. this._dispatch = false;
  116299. this._onTrackMetadata("video", meta2);
  116300. };
  116301. FLVDemuxer2.prototype._parseAVCVideoData = function(arrayBuffer, dataOffset, dataSize, tagTimestamp, tagPosition, frameType, cts) {
  116302. var le = this._littleEndian;
  116303. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  116304. var units = [], length = 0;
  116305. var offset = 0;
  116306. var lengthSize = this._naluLengthSize;
  116307. var dts = this._timestampBase + tagTimestamp;
  116308. var keyframe = frameType === 1;
  116309. while (offset < dataSize) {
  116310. if (offset + 4 >= dataSize) {
  116311. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Malformed Nalu near timestamp " + dts + ", offset = " + offset + ", dataSize = " + dataSize);
  116312. break;
  116313. }
  116314. var naluSize = v.getUint32(offset, !le);
  116315. if (lengthSize === 3) {
  116316. naluSize >>>= 8;
  116317. }
  116318. if (naluSize > dataSize - lengthSize) {
  116319. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Malformed Nalus near timestamp " + dts + ", NaluSize > DataSize!");
  116320. return;
  116321. }
  116322. var unitType = v.getUint8(offset + lengthSize) & 31;
  116323. if (unitType === 5) {
  116324. keyframe = true;
  116325. }
  116326. var data = new Uint8Array(arrayBuffer, dataOffset + offset, lengthSize + naluSize);
  116327. var unit = { type: unitType, data };
  116328. units.push(unit);
  116329. length += data.byteLength;
  116330. offset += lengthSize + naluSize;
  116331. }
  116332. if (units.length) {
  116333. var track = this._videoTrack;
  116334. var avcSample = {
  116335. units,
  116336. length,
  116337. isKeyframe: keyframe,
  116338. dts,
  116339. cts,
  116340. pts: dts + cts
  116341. };
  116342. if (keyframe) {
  116343. avcSample.fileposition = tagPosition;
  116344. }
  116345. track.samples.push(avcSample);
  116346. track.length += length;
  116347. }
  116348. };
  116349. return FLVDemuxer2;
  116350. }();
  116351. __webpack_exports__2["default"] = FLVDemuxer;
  116352. },
  116353. "./src/demux/sps-parser.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  116354. __webpack_require__2.r(__webpack_exports__2);
  116355. var _exp_golomb_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/demux/exp-golomb.js");
  116356. var SPSParser = function() {
  116357. function SPSParser2() {
  116358. }
  116359. SPSParser2._ebsp2rbsp = function(uint8array) {
  116360. var src = uint8array;
  116361. var src_length = src.byteLength;
  116362. var dst = new Uint8Array(src_length);
  116363. var dst_idx = 0;
  116364. for (var i2 = 0; i2 < src_length; i2++) {
  116365. if (i2 >= 2) {
  116366. if (src[i2] === 3 && src[i2 - 1] === 0 && src[i2 - 2] === 0) {
  116367. continue;
  116368. }
  116369. }
  116370. dst[dst_idx] = src[i2];
  116371. dst_idx++;
  116372. }
  116373. return new Uint8Array(dst.buffer, 0, dst_idx);
  116374. };
  116375. SPSParser2.parseSPS = function(uint8array) {
  116376. var rbsp = SPSParser2._ebsp2rbsp(uint8array);
  116377. var gb = new _exp_golomb_js__WEBPACK_IMPORTED_MODULE_0__.default(rbsp);
  116378. gb.readByte();
  116379. var profile_idc = gb.readByte();
  116380. gb.readByte();
  116381. var level_idc = gb.readByte();
  116382. gb.readUEG();
  116383. var profile_string = SPSParser2.getProfileString(profile_idc);
  116384. var level_string = SPSParser2.getLevelString(level_idc);
  116385. var chroma_format_idc = 1;
  116386. var chroma_format = 420;
  116387. var chroma_format_table = [0, 420, 422, 444];
  116388. var bit_depth = 8;
  116389. if (profile_idc === 100 || profile_idc === 110 || profile_idc === 122 || profile_idc === 244 || profile_idc === 44 || profile_idc === 83 || profile_idc === 86 || profile_idc === 118 || profile_idc === 128 || profile_idc === 138 || profile_idc === 144) {
  116390. chroma_format_idc = gb.readUEG();
  116391. if (chroma_format_idc === 3) {
  116392. gb.readBits(1);
  116393. }
  116394. if (chroma_format_idc <= 3) {
  116395. chroma_format = chroma_format_table[chroma_format_idc];
  116396. }
  116397. bit_depth = gb.readUEG() + 8;
  116398. gb.readUEG();
  116399. gb.readBits(1);
  116400. if (gb.readBool()) {
  116401. var scaling_list_count = chroma_format_idc !== 3 ? 8 : 12;
  116402. for (var i2 = 0; i2 < scaling_list_count; i2++) {
  116403. if (gb.readBool()) {
  116404. if (i2 < 6) {
  116405. SPSParser2._skipScalingList(gb, 16);
  116406. } else {
  116407. SPSParser2._skipScalingList(gb, 64);
  116408. }
  116409. }
  116410. }
  116411. }
  116412. }
  116413. gb.readUEG();
  116414. var pic_order_cnt_type = gb.readUEG();
  116415. if (pic_order_cnt_type === 0) {
  116416. gb.readUEG();
  116417. } else if (pic_order_cnt_type === 1) {
  116418. gb.readBits(1);
  116419. gb.readSEG();
  116420. gb.readSEG();
  116421. var num_ref_frames_in_pic_order_cnt_cycle = gb.readUEG();
  116422. for (var i2 = 0; i2 < num_ref_frames_in_pic_order_cnt_cycle; i2++) {
  116423. gb.readSEG();
  116424. }
  116425. }
  116426. var ref_frames = gb.readUEG();
  116427. gb.readBits(1);
  116428. var pic_width_in_mbs_minus1 = gb.readUEG();
  116429. var pic_height_in_map_units_minus1 = gb.readUEG();
  116430. var frame_mbs_only_flag = gb.readBits(1);
  116431. if (frame_mbs_only_flag === 0) {
  116432. gb.readBits(1);
  116433. }
  116434. gb.readBits(1);
  116435. var frame_crop_left_offset = 0;
  116436. var frame_crop_right_offset = 0;
  116437. var frame_crop_top_offset = 0;
  116438. var frame_crop_bottom_offset = 0;
  116439. var frame_cropping_flag = gb.readBool();
  116440. if (frame_cropping_flag) {
  116441. frame_crop_left_offset = gb.readUEG();
  116442. frame_crop_right_offset = gb.readUEG();
  116443. frame_crop_top_offset = gb.readUEG();
  116444. frame_crop_bottom_offset = gb.readUEG();
  116445. }
  116446. var sar_width = 1, sar_height = 1;
  116447. var fps = 0, fps_fixed = true, fps_num = 0, fps_den = 0;
  116448. var vui_parameters_present_flag = gb.readBool();
  116449. if (vui_parameters_present_flag) {
  116450. if (gb.readBool()) {
  116451. var aspect_ratio_idc = gb.readByte();
  116452. var sar_w_table = [1, 12, 10, 16, 40, 24, 20, 32, 80, 18, 15, 64, 160, 4, 3, 2];
  116453. var sar_h_table = [1, 11, 11, 11, 33, 11, 11, 11, 33, 11, 11, 33, 99, 3, 2, 1];
  116454. if (aspect_ratio_idc > 0 && aspect_ratio_idc < 16) {
  116455. sar_width = sar_w_table[aspect_ratio_idc - 1];
  116456. sar_height = sar_h_table[aspect_ratio_idc - 1];
  116457. } else if (aspect_ratio_idc === 255) {
  116458. sar_width = gb.readByte() << 8 | gb.readByte();
  116459. sar_height = gb.readByte() << 8 | gb.readByte();
  116460. }
  116461. }
  116462. if (gb.readBool()) {
  116463. gb.readBool();
  116464. }
  116465. if (gb.readBool()) {
  116466. gb.readBits(4);
  116467. if (gb.readBool()) {
  116468. gb.readBits(24);
  116469. }
  116470. }
  116471. if (gb.readBool()) {
  116472. gb.readUEG();
  116473. gb.readUEG();
  116474. }
  116475. if (gb.readBool()) {
  116476. var num_units_in_tick = gb.readBits(32);
  116477. var time_scale = gb.readBits(32);
  116478. fps_fixed = gb.readBool();
  116479. fps_num = time_scale;
  116480. fps_den = num_units_in_tick * 2;
  116481. fps = fps_num / fps_den;
  116482. }
  116483. }
  116484. var sarScale = 1;
  116485. if (sar_width !== 1 || sar_height !== 1) {
  116486. sarScale = sar_width / sar_height;
  116487. }
  116488. var crop_unit_x = 0, crop_unit_y = 0;
  116489. if (chroma_format_idc === 0) {
  116490. crop_unit_x = 1;
  116491. crop_unit_y = 2 - frame_mbs_only_flag;
  116492. } else {
  116493. var sub_wc = chroma_format_idc === 3 ? 1 : 2;
  116494. var sub_hc = chroma_format_idc === 1 ? 2 : 1;
  116495. crop_unit_x = sub_wc;
  116496. crop_unit_y = sub_hc * (2 - frame_mbs_only_flag);
  116497. }
  116498. var codec_width = (pic_width_in_mbs_minus1 + 1) * 16;
  116499. var codec_height = (2 - frame_mbs_only_flag) * ((pic_height_in_map_units_minus1 + 1) * 16);
  116500. codec_width -= (frame_crop_left_offset + frame_crop_right_offset) * crop_unit_x;
  116501. codec_height -= (frame_crop_top_offset + frame_crop_bottom_offset) * crop_unit_y;
  116502. var present_width = Math.ceil(codec_width * sarScale);
  116503. gb.destroy();
  116504. gb = null;
  116505. return {
  116506. profile_string,
  116507. level_string,
  116508. bit_depth,
  116509. ref_frames,
  116510. chroma_format,
  116511. chroma_format_string: SPSParser2.getChromaFormatString(chroma_format),
  116512. frame_rate: {
  116513. fixed: fps_fixed,
  116514. fps,
  116515. fps_den,
  116516. fps_num
  116517. },
  116518. sar_ratio: {
  116519. width: sar_width,
  116520. height: sar_height
  116521. },
  116522. codec_size: {
  116523. width: codec_width,
  116524. height: codec_height
  116525. },
  116526. present_size: {
  116527. width: present_width,
  116528. height: codec_height
  116529. }
  116530. };
  116531. };
  116532. SPSParser2._skipScalingList = function(gb, count) {
  116533. var last_scale = 8, next_scale = 8;
  116534. var delta_scale = 0;
  116535. for (var i2 = 0; i2 < count; i2++) {
  116536. if (next_scale !== 0) {
  116537. delta_scale = gb.readSEG();
  116538. next_scale = (last_scale + delta_scale + 256) % 256;
  116539. }
  116540. last_scale = next_scale === 0 ? last_scale : next_scale;
  116541. }
  116542. };
  116543. SPSParser2.getProfileString = function(profile_idc) {
  116544. switch (profile_idc) {
  116545. case 66:
  116546. return "Baseline";
  116547. case 77:
  116548. return "Main";
  116549. case 88:
  116550. return "Extended";
  116551. case 100:
  116552. return "High";
  116553. case 110:
  116554. return "High10";
  116555. case 122:
  116556. return "High422";
  116557. case 244:
  116558. return "High444";
  116559. default:
  116560. return "Unknown";
  116561. }
  116562. };
  116563. SPSParser2.getLevelString = function(level_idc) {
  116564. return (level_idc / 10).toFixed(1);
  116565. };
  116566. SPSParser2.getChromaFormatString = function(chroma) {
  116567. switch (chroma) {
  116568. case 420:
  116569. return "4:2:0";
  116570. case 422:
  116571. return "4:2:2";
  116572. case 444:
  116573. return "4:4:4";
  116574. default:
  116575. return "Unknown";
  116576. }
  116577. };
  116578. return SPSParser2;
  116579. }();
  116580. __webpack_exports__2["default"] = SPSParser;
  116581. },
  116582. "./src/flv.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  116583. __webpack_require__2.r(__webpack_exports__2);
  116584. var _utils_polyfill_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/polyfill.js");
  116585. var _core_features_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/core/features.js");
  116586. var _io_loader_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/io/loader.js");
  116587. var _player_flv_player_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/player/flv-player.js");
  116588. var _player_native_player_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/player/native-player.js");
  116589. var _player_player_events_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/player/player-events.js");
  116590. var _player_player_errors_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__2("./src/player/player-errors.js");
  116591. var _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__2("./src/utils/logging-control.js");
  116592. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__2("./src/utils/exception.js");
  116593. _utils_polyfill_js__WEBPACK_IMPORTED_MODULE_0__.default.install();
  116594. function createPlayer(mediaDataSource, optionalConfig) {
  116595. var mds = mediaDataSource;
  116596. if (mds == null || typeof mds !== "object") {
  116597. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_8__.InvalidArgumentException("MediaDataSource must be an javascript object!");
  116598. }
  116599. if (!mds.hasOwnProperty("type")) {
  116600. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_8__.InvalidArgumentException("MediaDataSource must has type field to indicate video file type!");
  116601. }
  116602. switch (mds.type) {
  116603. case "flv":
  116604. return new _player_flv_player_js__WEBPACK_IMPORTED_MODULE_3__.default(mds, optionalConfig);
  116605. default:
  116606. return new _player_native_player_js__WEBPACK_IMPORTED_MODULE_4__.default(mds, optionalConfig);
  116607. }
  116608. }
  116609. function isSupported() {
  116610. return _core_features_js__WEBPACK_IMPORTED_MODULE_1__.default.supportMSEH264Playback();
  116611. }
  116612. function getFeatureList() {
  116613. return _core_features_js__WEBPACK_IMPORTED_MODULE_1__.default.getFeatureList();
  116614. }
  116615. var flvjs2 = {};
  116616. flvjs2.createPlayer = createPlayer;
  116617. flvjs2.isSupported = isSupported;
  116618. flvjs2.getFeatureList = getFeatureList;
  116619. flvjs2.BaseLoader = _io_loader_js__WEBPACK_IMPORTED_MODULE_2__.BaseLoader;
  116620. flvjs2.LoaderStatus = _io_loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus;
  116621. flvjs2.LoaderErrors = _io_loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors;
  116622. flvjs2.Events = _player_player_events_js__WEBPACK_IMPORTED_MODULE_5__.default;
  116623. flvjs2.ErrorTypes = _player_player_errors_js__WEBPACK_IMPORTED_MODULE_6__.ErrorTypes;
  116624. flvjs2.ErrorDetails = _player_player_errors_js__WEBPACK_IMPORTED_MODULE_6__.ErrorDetails;
  116625. flvjs2.FlvPlayer = _player_flv_player_js__WEBPACK_IMPORTED_MODULE_3__.default;
  116626. flvjs2.NativePlayer = _player_native_player_js__WEBPACK_IMPORTED_MODULE_4__.default;
  116627. flvjs2.LoggingControl = _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_7__.default;
  116628. Object.defineProperty(flvjs2, "version", {
  116629. enumerable: true,
  116630. get: function() {
  116631. return "1.6.2";
  116632. }
  116633. });
  116634. __webpack_exports__2["default"] = flvjs2;
  116635. },
  116636. "./src/index.js": function(module3, __unused_webpack_exports, __webpack_require__2) {
  116637. module3.exports = __webpack_require__2("./src/flv.js").default;
  116638. },
  116639. "./src/io/fetch-stream-loader.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  116640. __webpack_require__2.r(__webpack_exports__2);
  116641. var _utils_browser_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/browser.js");
  116642. var _loader_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/io/loader.js");
  116643. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/exception.js");
  116644. var __extends = function() {
  116645. var extendStatics = function(d2, b) {
  116646. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b2) {
  116647. d3.__proto__ = b2;
  116648. } || function(d3, b2) {
  116649. for (var p in b2)
  116650. if (Object.prototype.hasOwnProperty.call(b2, p))
  116651. d3[p] = b2[p];
  116652. };
  116653. return extendStatics(d2, b);
  116654. };
  116655. return function(d2, b) {
  116656. if (typeof b !== "function" && b !== null)
  116657. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  116658. extendStatics(d2, b);
  116659. function __() {
  116660. this.constructor = d2;
  116661. }
  116662. d2.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  116663. };
  116664. }();
  116665. var FetchStreamLoader = function(_super) {
  116666. __extends(FetchStreamLoader2, _super);
  116667. function FetchStreamLoader2(seekHandler, config) {
  116668. var _this = _super.call(this, "fetch-stream-loader") || this;
  116669. _this.TAG = "FetchStreamLoader";
  116670. _this._seekHandler = seekHandler;
  116671. _this._config = config;
  116672. _this._needStash = true;
  116673. _this._requestAbort = false;
  116674. _this._contentLength = null;
  116675. _this._receivedLength = 0;
  116676. return _this;
  116677. }
  116678. FetchStreamLoader2.isSupported = function() {
  116679. try {
  116680. var isWorkWellEdge = _utils_browser_js__WEBPACK_IMPORTED_MODULE_0__.default.msedge && _utils_browser_js__WEBPACK_IMPORTED_MODULE_0__.default.version.minor >= 15048;
  116681. var browserNotBlacklisted = _utils_browser_js__WEBPACK_IMPORTED_MODULE_0__.default.msedge ? isWorkWellEdge : true;
  116682. return self.fetch && self.ReadableStream && browserNotBlacklisted;
  116683. } catch (e) {
  116684. return false;
  116685. }
  116686. };
  116687. FetchStreamLoader2.prototype.destroy = function() {
  116688. if (this.isWorking()) {
  116689. this.abort();
  116690. }
  116691. _super.prototype.destroy.call(this);
  116692. };
  116693. FetchStreamLoader2.prototype.open = function(dataSource, range3) {
  116694. var _this = this;
  116695. this._dataSource = dataSource;
  116696. this._range = range3;
  116697. var sourceURL = dataSource.url;
  116698. if (this._config.reuseRedirectedURL && dataSource.redirectedURL != void 0) {
  116699. sourceURL = dataSource.redirectedURL;
  116700. }
  116701. var seekConfig = this._seekHandler.getConfig(sourceURL, range3);
  116702. var headers = new self.Headers();
  116703. if (typeof seekConfig.headers === "object") {
  116704. var configHeaders = seekConfig.headers;
  116705. for (var key in configHeaders) {
  116706. if (configHeaders.hasOwnProperty(key)) {
  116707. headers.append(key, configHeaders[key]);
  116708. }
  116709. }
  116710. }
  116711. var params = {
  116712. method: "GET",
  116713. headers,
  116714. mode: "cors",
  116715. cache: "default",
  116716. referrerPolicy: "no-referrer-when-downgrade"
  116717. };
  116718. if (typeof this._config.headers === "object") {
  116719. for (var key in this._config.headers) {
  116720. headers.append(key, this._config.headers[key]);
  116721. }
  116722. }
  116723. if (dataSource.cors === false) {
  116724. params.mode = "same-origin";
  116725. }
  116726. if (dataSource.withCredentials) {
  116727. params.credentials = "include";
  116728. }
  116729. if (dataSource.referrerPolicy) {
  116730. params.referrerPolicy = dataSource.referrerPolicy;
  116731. }
  116732. if (self.AbortController) {
  116733. this._abortController = new self.AbortController();
  116734. params.signal = this._abortController.signal;
  116735. }
  116736. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kConnecting;
  116737. self.fetch(seekConfig.url, params).then(function(res) {
  116738. if (_this._requestAbort) {
  116739. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kIdle;
  116740. res.body.cancel();
  116741. return;
  116742. }
  116743. if (res.ok && (res.status >= 200 && res.status <= 299)) {
  116744. if (res.url !== seekConfig.url) {
  116745. if (_this._onURLRedirect) {
  116746. var redirectedURL = _this._seekHandler.removeURLParameters(res.url);
  116747. _this._onURLRedirect(redirectedURL);
  116748. }
  116749. }
  116750. var lengthHeader = res.headers.get("Content-Length");
  116751. if (lengthHeader != null) {
  116752. _this._contentLength = parseInt(lengthHeader);
  116753. if (_this._contentLength !== 0) {
  116754. if (_this._onContentLengthKnown) {
  116755. _this._onContentLengthKnown(_this._contentLength);
  116756. }
  116757. }
  116758. }
  116759. return _this._pump.call(_this, res.body.getReader());
  116760. } else {
  116761. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError;
  116762. if (_this._onError) {
  116763. _this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.HTTP_STATUS_CODE_INVALID, { code: res.status, msg: res.statusText });
  116764. } else {
  116765. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.RuntimeException("FetchStreamLoader: Http code invalid, " + res.status + " " + res.statusText);
  116766. }
  116767. }
  116768. }).catch(function(e) {
  116769. if (_this._abortController && _this._abortController.signal.aborted) {
  116770. return;
  116771. }
  116772. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError;
  116773. if (_this._onError) {
  116774. _this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.EXCEPTION, { code: -1, msg: e.message });
  116775. } else {
  116776. throw e;
  116777. }
  116778. });
  116779. };
  116780. FetchStreamLoader2.prototype.abort = function() {
  116781. this._requestAbort = true;
  116782. if (this._status !== _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kBuffering || !_utils_browser_js__WEBPACK_IMPORTED_MODULE_0__.default.chrome) {
  116783. if (this._abortController) {
  116784. try {
  116785. this._abortController.abort();
  116786. } catch (e) {
  116787. }
  116788. }
  116789. }
  116790. };
  116791. FetchStreamLoader2.prototype._pump = function(reader) {
  116792. var _this = this;
  116793. return reader.read().then(function(result) {
  116794. if (result.done) {
  116795. if (_this._contentLength !== null && _this._receivedLength < _this._contentLength) {
  116796. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError;
  116797. var type2 = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.EARLY_EOF;
  116798. var info = { code: -1, msg: "Fetch stream meet Early-EOF" };
  116799. if (_this._onError) {
  116800. _this._onError(type2, info);
  116801. } else {
  116802. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.RuntimeException(info.msg);
  116803. }
  116804. } else {
  116805. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kComplete;
  116806. if (_this._onComplete) {
  116807. _this._onComplete(_this._range.from, _this._range.from + _this._receivedLength - 1);
  116808. }
  116809. }
  116810. } else {
  116811. if (_this._abortController && _this._abortController.signal.aborted) {
  116812. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kComplete;
  116813. return;
  116814. } else if (_this._requestAbort === true) {
  116815. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kComplete;
  116816. return reader.cancel();
  116817. }
  116818. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kBuffering;
  116819. var chunk = result.value.buffer;
  116820. var byteStart = _this._range.from + _this._receivedLength;
  116821. _this._receivedLength += chunk.byteLength;
  116822. if (_this._onDataArrival) {
  116823. _this._onDataArrival(chunk, byteStart, _this._receivedLength);
  116824. }
  116825. _this._pump(reader);
  116826. }
  116827. }).catch(function(e) {
  116828. if (_this._abortController && _this._abortController.signal.aborted) {
  116829. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kComplete;
  116830. return;
  116831. }
  116832. if (e.code === 11 && _utils_browser_js__WEBPACK_IMPORTED_MODULE_0__.default.msedge) {
  116833. return;
  116834. }
  116835. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError;
  116836. var type2 = 0;
  116837. var info = null;
  116838. if ((e.code === 19 || e.message === "network error") && (_this._contentLength === null || _this._contentLength !== null && _this._receivedLength < _this._contentLength)) {
  116839. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.EARLY_EOF;
  116840. info = { code: e.code, msg: "Fetch stream meet Early-EOF" };
  116841. } else {
  116842. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.EXCEPTION;
  116843. info = { code: e.code, msg: e.message };
  116844. }
  116845. if (_this._onError) {
  116846. _this._onError(type2, info);
  116847. } else {
  116848. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.RuntimeException(info.msg);
  116849. }
  116850. });
  116851. };
  116852. return FetchStreamLoader2;
  116853. }(_loader_js__WEBPACK_IMPORTED_MODULE_1__.BaseLoader);
  116854. __webpack_exports__2["default"] = FetchStreamLoader;
  116855. },
  116856. "./src/io/io-controller.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  116857. __webpack_require__2.r(__webpack_exports__2);
  116858. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logger.js");
  116859. var _speed_sampler_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/io/speed-sampler.js");
  116860. var _loader_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/io/loader.js");
  116861. var _fetch_stream_loader_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/io/fetch-stream-loader.js");
  116862. var _xhr_moz_chunked_loader_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/io/xhr-moz-chunked-loader.js");
  116863. var _xhr_range_loader_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/io/xhr-range-loader.js");
  116864. var _websocket_loader_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__2("./src/io/websocket-loader.js");
  116865. var _range_seek_handler_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__2("./src/io/range-seek-handler.js");
  116866. var _param_seek_handler_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__2("./src/io/param-seek-handler.js");
  116867. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__2("./src/utils/exception.js");
  116868. var IOController = function() {
  116869. function IOController2(dataSource, config, extraData) {
  116870. this.TAG = "IOController";
  116871. this._config = config;
  116872. this._extraData = extraData;
  116873. this._stashInitialSize = 1024 * 384;
  116874. if (config.stashInitialSize != void 0 && config.stashInitialSize > 0) {
  116875. this._stashInitialSize = config.stashInitialSize;
  116876. }
  116877. this._stashUsed = 0;
  116878. this._stashSize = this._stashInitialSize;
  116879. this._bufferSize = 1024 * 1024 * 3;
  116880. this._stashBuffer = new ArrayBuffer(this._bufferSize);
  116881. this._stashByteStart = 0;
  116882. this._enableStash = true;
  116883. if (config.enableStashBuffer === false) {
  116884. this._enableStash = false;
  116885. }
  116886. this._loader = null;
  116887. this._loaderClass = null;
  116888. this._seekHandler = null;
  116889. this._dataSource = dataSource;
  116890. this._isWebSocketURL = /wss?:\/\/(.+?)/.test(dataSource.url);
  116891. this._refTotalLength = dataSource.filesize ? dataSource.filesize : null;
  116892. this._totalLength = this._refTotalLength;
  116893. this._fullRequestFlag = false;
  116894. this._currentRange = null;
  116895. this._redirectedURL = null;
  116896. this._speedNormalized = 0;
  116897. this._speedSampler = new _speed_sampler_js__WEBPACK_IMPORTED_MODULE_1__.default();
  116898. this._speedNormalizeList = [64, 128, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096];
  116899. this._isEarlyEofReconnecting = false;
  116900. this._paused = false;
  116901. this._resumeFrom = 0;
  116902. this._onDataArrival = null;
  116903. this._onSeeked = null;
  116904. this._onError = null;
  116905. this._onComplete = null;
  116906. this._onRedirect = null;
  116907. this._onRecoveredEarlyEof = null;
  116908. this._selectSeekHandler();
  116909. this._selectLoader();
  116910. this._createLoader();
  116911. }
  116912. IOController2.prototype.destroy = function() {
  116913. if (this._loader.isWorking()) {
  116914. this._loader.abort();
  116915. }
  116916. this._loader.destroy();
  116917. this._loader = null;
  116918. this._loaderClass = null;
  116919. this._dataSource = null;
  116920. this._stashBuffer = null;
  116921. this._stashUsed = this._stashSize = this._bufferSize = this._stashByteStart = 0;
  116922. this._currentRange = null;
  116923. this._speedSampler = null;
  116924. this._isEarlyEofReconnecting = false;
  116925. this._onDataArrival = null;
  116926. this._onSeeked = null;
  116927. this._onError = null;
  116928. this._onComplete = null;
  116929. this._onRedirect = null;
  116930. this._onRecoveredEarlyEof = null;
  116931. this._extraData = null;
  116932. };
  116933. IOController2.prototype.isWorking = function() {
  116934. return this._loader && this._loader.isWorking() && !this._paused;
  116935. };
  116936. IOController2.prototype.isPaused = function() {
  116937. return this._paused;
  116938. };
  116939. Object.defineProperty(IOController2.prototype, "status", {
  116940. get: function() {
  116941. return this._loader.status;
  116942. },
  116943. enumerable: false,
  116944. configurable: true
  116945. });
  116946. Object.defineProperty(IOController2.prototype, "extraData", {
  116947. get: function() {
  116948. return this._extraData;
  116949. },
  116950. set: function(data) {
  116951. this._extraData = data;
  116952. },
  116953. enumerable: false,
  116954. configurable: true
  116955. });
  116956. Object.defineProperty(IOController2.prototype, "onDataArrival", {
  116957. get: function() {
  116958. return this._onDataArrival;
  116959. },
  116960. set: function(callback2) {
  116961. this._onDataArrival = callback2;
  116962. },
  116963. enumerable: false,
  116964. configurable: true
  116965. });
  116966. Object.defineProperty(IOController2.prototype, "onSeeked", {
  116967. get: function() {
  116968. return this._onSeeked;
  116969. },
  116970. set: function(callback2) {
  116971. this._onSeeked = callback2;
  116972. },
  116973. enumerable: false,
  116974. configurable: true
  116975. });
  116976. Object.defineProperty(IOController2.prototype, "onError", {
  116977. get: function() {
  116978. return this._onError;
  116979. },
  116980. set: function(callback2) {
  116981. this._onError = callback2;
  116982. },
  116983. enumerable: false,
  116984. configurable: true
  116985. });
  116986. Object.defineProperty(IOController2.prototype, "onComplete", {
  116987. get: function() {
  116988. return this._onComplete;
  116989. },
  116990. set: function(callback2) {
  116991. this._onComplete = callback2;
  116992. },
  116993. enumerable: false,
  116994. configurable: true
  116995. });
  116996. Object.defineProperty(IOController2.prototype, "onRedirect", {
  116997. get: function() {
  116998. return this._onRedirect;
  116999. },
  117000. set: function(callback2) {
  117001. this._onRedirect = callback2;
  117002. },
  117003. enumerable: false,
  117004. configurable: true
  117005. });
  117006. Object.defineProperty(IOController2.prototype, "onRecoveredEarlyEof", {
  117007. get: function() {
  117008. return this._onRecoveredEarlyEof;
  117009. },
  117010. set: function(callback2) {
  117011. this._onRecoveredEarlyEof = callback2;
  117012. },
  117013. enumerable: false,
  117014. configurable: true
  117015. });
  117016. Object.defineProperty(IOController2.prototype, "currentURL", {
  117017. get: function() {
  117018. return this._dataSource.url;
  117019. },
  117020. enumerable: false,
  117021. configurable: true
  117022. });
  117023. Object.defineProperty(IOController2.prototype, "hasRedirect", {
  117024. get: function() {
  117025. return this._redirectedURL != null || this._dataSource.redirectedURL != void 0;
  117026. },
  117027. enumerable: false,
  117028. configurable: true
  117029. });
  117030. Object.defineProperty(IOController2.prototype, "currentRedirectedURL", {
  117031. get: function() {
  117032. return this._redirectedURL || this._dataSource.redirectedURL;
  117033. },
  117034. enumerable: false,
  117035. configurable: true
  117036. });
  117037. Object.defineProperty(IOController2.prototype, "currentSpeed", {
  117038. get: function() {
  117039. if (this._loaderClass === _xhr_range_loader_js__WEBPACK_IMPORTED_MODULE_5__.default) {
  117040. return this._loader.currentSpeed;
  117041. }
  117042. return this._speedSampler.lastSecondKBps;
  117043. },
  117044. enumerable: false,
  117045. configurable: true
  117046. });
  117047. Object.defineProperty(IOController2.prototype, "loaderType", {
  117048. get: function() {
  117049. return this._loader.type;
  117050. },
  117051. enumerable: false,
  117052. configurable: true
  117053. });
  117054. IOController2.prototype._selectSeekHandler = function() {
  117055. var config = this._config;
  117056. if (config.seekType === "range") {
  117057. this._seekHandler = new _range_seek_handler_js__WEBPACK_IMPORTED_MODULE_7__.default(this._config.rangeLoadZeroStart);
  117058. } else if (config.seekType === "param") {
  117059. var paramStart = config.seekParamStart || "bstart";
  117060. var paramEnd = config.seekParamEnd || "bend";
  117061. this._seekHandler = new _param_seek_handler_js__WEBPACK_IMPORTED_MODULE_8__.default(paramStart, paramEnd);
  117062. } else if (config.seekType === "custom") {
  117063. if (typeof config.customSeekHandler !== "function") {
  117064. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__.InvalidArgumentException("Custom seekType specified in config but invalid customSeekHandler!");
  117065. }
  117066. this._seekHandler = new config.customSeekHandler();
  117067. } else {
  117068. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__.InvalidArgumentException("Invalid seekType in config: " + config.seekType);
  117069. }
  117070. };
  117071. IOController2.prototype._selectLoader = function() {
  117072. if (this._config.customLoader != null) {
  117073. this._loaderClass = this._config.customLoader;
  117074. } else if (this._isWebSocketURL) {
  117075. this._loaderClass = _websocket_loader_js__WEBPACK_IMPORTED_MODULE_6__.default;
  117076. } else if (_fetch_stream_loader_js__WEBPACK_IMPORTED_MODULE_3__.default.isSupported()) {
  117077. this._loaderClass = _fetch_stream_loader_js__WEBPACK_IMPORTED_MODULE_3__.default;
  117078. } else if (_xhr_moz_chunked_loader_js__WEBPACK_IMPORTED_MODULE_4__.default.isSupported()) {
  117079. this._loaderClass = _xhr_moz_chunked_loader_js__WEBPACK_IMPORTED_MODULE_4__.default;
  117080. } else if (_xhr_range_loader_js__WEBPACK_IMPORTED_MODULE_5__.default.isSupported()) {
  117081. this._loaderClass = _xhr_range_loader_js__WEBPACK_IMPORTED_MODULE_5__.default;
  117082. } else {
  117083. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__.RuntimeException("Your browser doesn't support xhr with arraybuffer responseType!");
  117084. }
  117085. };
  117086. IOController2.prototype._createLoader = function() {
  117087. this._loader = new this._loaderClass(this._seekHandler, this._config);
  117088. if (this._loader.needStashBuffer === false) {
  117089. this._enableStash = false;
  117090. }
  117091. this._loader.onContentLengthKnown = this._onContentLengthKnown.bind(this);
  117092. this._loader.onURLRedirect = this._onURLRedirect.bind(this);
  117093. this._loader.onDataArrival = this._onLoaderChunkArrival.bind(this);
  117094. this._loader.onComplete = this._onLoaderComplete.bind(this);
  117095. this._loader.onError = this._onLoaderError.bind(this);
  117096. };
  117097. IOController2.prototype.open = function(optionalFrom) {
  117098. this._currentRange = { from: 0, to: -1 };
  117099. if (optionalFrom) {
  117100. this._currentRange.from = optionalFrom;
  117101. }
  117102. this._speedSampler.reset();
  117103. if (!optionalFrom) {
  117104. this._fullRequestFlag = true;
  117105. }
  117106. this._loader.open(this._dataSource, Object.assign({}, this._currentRange));
  117107. };
  117108. IOController2.prototype.abort = function() {
  117109. this._loader.abort();
  117110. if (this._paused) {
  117111. this._paused = false;
  117112. this._resumeFrom = 0;
  117113. }
  117114. };
  117115. IOController2.prototype.pause = function() {
  117116. if (this.isWorking()) {
  117117. this._loader.abort();
  117118. if (this._stashUsed !== 0) {
  117119. this._resumeFrom = this._stashByteStart;
  117120. this._currentRange.to = this._stashByteStart - 1;
  117121. } else {
  117122. this._resumeFrom = this._currentRange.to + 1;
  117123. }
  117124. this._stashUsed = 0;
  117125. this._stashByteStart = 0;
  117126. this._paused = true;
  117127. }
  117128. };
  117129. IOController2.prototype.resume = function() {
  117130. if (this._paused) {
  117131. this._paused = false;
  117132. var bytes = this._resumeFrom;
  117133. this._resumeFrom = 0;
  117134. this._internalSeek(bytes, true);
  117135. }
  117136. };
  117137. IOController2.prototype.seek = function(bytes) {
  117138. this._paused = false;
  117139. this._stashUsed = 0;
  117140. this._stashByteStart = 0;
  117141. this._internalSeek(bytes, true);
  117142. };
  117143. IOController2.prototype._internalSeek = function(bytes, dropUnconsumed) {
  117144. if (this._loader.isWorking()) {
  117145. this._loader.abort();
  117146. }
  117147. this._flushStashBuffer(dropUnconsumed);
  117148. this._loader.destroy();
  117149. this._loader = null;
  117150. var requestRange = { from: bytes, to: -1 };
  117151. this._currentRange = { from: requestRange.from, to: -1 };
  117152. this._speedSampler.reset();
  117153. this._stashSize = this._stashInitialSize;
  117154. this._createLoader();
  117155. this._loader.open(this._dataSource, requestRange);
  117156. if (this._onSeeked) {
  117157. this._onSeeked();
  117158. }
  117159. };
  117160. IOController2.prototype.updateUrl = function(url) {
  117161. if (!url || typeof url !== "string" || url.length === 0) {
  117162. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__.InvalidArgumentException("Url must be a non-empty string!");
  117163. }
  117164. this._dataSource.url = url;
  117165. };
  117166. IOController2.prototype._expandBuffer = function(expectedBytes) {
  117167. var bufferNewSize = this._stashSize;
  117168. while (bufferNewSize + 1024 * 1024 * 1 < expectedBytes) {
  117169. bufferNewSize *= 2;
  117170. }
  117171. bufferNewSize += 1024 * 1024 * 1;
  117172. if (bufferNewSize === this._bufferSize) {
  117173. return;
  117174. }
  117175. var newBuffer = new ArrayBuffer(bufferNewSize);
  117176. if (this._stashUsed > 0) {
  117177. var stashOldArray = new Uint8Array(this._stashBuffer, 0, this._stashUsed);
  117178. var stashNewArray = new Uint8Array(newBuffer, 0, bufferNewSize);
  117179. stashNewArray.set(stashOldArray, 0);
  117180. }
  117181. this._stashBuffer = newBuffer;
  117182. this._bufferSize = bufferNewSize;
  117183. };
  117184. IOController2.prototype._normalizeSpeed = function(input) {
  117185. var list = this._speedNormalizeList;
  117186. var last = list.length - 1;
  117187. var mid = 0;
  117188. var lbound = 0;
  117189. var ubound = last;
  117190. if (input < list[0]) {
  117191. return list[0];
  117192. }
  117193. while (lbound <= ubound) {
  117194. mid = lbound + Math.floor((ubound - lbound) / 2);
  117195. if (mid === last || input >= list[mid] && input < list[mid + 1]) {
  117196. return list[mid];
  117197. } else if (list[mid] < input) {
  117198. lbound = mid + 1;
  117199. } else {
  117200. ubound = mid - 1;
  117201. }
  117202. }
  117203. };
  117204. IOController2.prototype._adjustStashSize = function(normalized) {
  117205. var stashSizeKB = 0;
  117206. if (this._config.isLive) {
  117207. stashSizeKB = normalized;
  117208. } else {
  117209. if (normalized < 512) {
  117210. stashSizeKB = normalized;
  117211. } else if (normalized >= 512 && normalized <= 1024) {
  117212. stashSizeKB = Math.floor(normalized * 1.5);
  117213. } else {
  117214. stashSizeKB = normalized * 2;
  117215. }
  117216. }
  117217. if (stashSizeKB > 8192) {
  117218. stashSizeKB = 8192;
  117219. }
  117220. var bufferSize = stashSizeKB * 1024 + 1024 * 1024 * 1;
  117221. if (this._bufferSize < bufferSize) {
  117222. this._expandBuffer(bufferSize);
  117223. }
  117224. this._stashSize = stashSizeKB * 1024;
  117225. };
  117226. IOController2.prototype._dispatchChunks = function(chunks, byteStart) {
  117227. this._currentRange.to = byteStart + chunks.byteLength - 1;
  117228. return this._onDataArrival(chunks, byteStart);
  117229. };
  117230. IOController2.prototype._onURLRedirect = function(redirectedURL) {
  117231. this._redirectedURL = redirectedURL;
  117232. if (this._onRedirect) {
  117233. this._onRedirect(redirectedURL);
  117234. }
  117235. };
  117236. IOController2.prototype._onContentLengthKnown = function(contentLength) {
  117237. if (contentLength && this._fullRequestFlag) {
  117238. this._totalLength = contentLength;
  117239. this._fullRequestFlag = false;
  117240. }
  117241. };
  117242. IOController2.prototype._onLoaderChunkArrival = function(chunk, byteStart, receivedLength) {
  117243. if (!this._onDataArrival) {
  117244. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__.IllegalStateException("IOController: No existing consumer (onDataArrival) callback!");
  117245. }
  117246. if (this._paused) {
  117247. return;
  117248. }
  117249. if (this._isEarlyEofReconnecting) {
  117250. this._isEarlyEofReconnecting = false;
  117251. if (this._onRecoveredEarlyEof) {
  117252. this._onRecoveredEarlyEof();
  117253. }
  117254. }
  117255. this._speedSampler.addBytes(chunk.byteLength);
  117256. var KBps = this._speedSampler.lastSecondKBps;
  117257. if (KBps !== 0) {
  117258. var normalized = this._normalizeSpeed(KBps);
  117259. if (this._speedNormalized !== normalized) {
  117260. this._speedNormalized = normalized;
  117261. this._adjustStashSize(normalized);
  117262. }
  117263. }
  117264. if (!this._enableStash) {
  117265. if (this._stashUsed === 0) {
  117266. var consumed = this._dispatchChunks(chunk, byteStart);
  117267. if (consumed < chunk.byteLength) {
  117268. var remain = chunk.byteLength - consumed;
  117269. if (remain > this._bufferSize) {
  117270. this._expandBuffer(remain);
  117271. }
  117272. var stashArray = new Uint8Array(this._stashBuffer, 0, this._bufferSize);
  117273. stashArray.set(new Uint8Array(chunk, consumed), 0);
  117274. this._stashUsed += remain;
  117275. this._stashByteStart = byteStart + consumed;
  117276. }
  117277. } else {
  117278. if (this._stashUsed + chunk.byteLength > this._bufferSize) {
  117279. this._expandBuffer(this._stashUsed + chunk.byteLength);
  117280. }
  117281. var stashArray = new Uint8Array(this._stashBuffer, 0, this._bufferSize);
  117282. stashArray.set(new Uint8Array(chunk), this._stashUsed);
  117283. this._stashUsed += chunk.byteLength;
  117284. var consumed = this._dispatchChunks(this._stashBuffer.slice(0, this._stashUsed), this._stashByteStart);
  117285. if (consumed < this._stashUsed && consumed > 0) {
  117286. var remainArray = new Uint8Array(this._stashBuffer, consumed);
  117287. stashArray.set(remainArray, 0);
  117288. }
  117289. this._stashUsed -= consumed;
  117290. this._stashByteStart += consumed;
  117291. }
  117292. } else {
  117293. if (this._stashUsed === 0 && this._stashByteStart === 0) {
  117294. this._stashByteStart = byteStart;
  117295. }
  117296. if (this._stashUsed + chunk.byteLength <= this._stashSize) {
  117297. var stashArray = new Uint8Array(this._stashBuffer, 0, this._stashSize);
  117298. stashArray.set(new Uint8Array(chunk), this._stashUsed);
  117299. this._stashUsed += chunk.byteLength;
  117300. } else {
  117301. var stashArray = new Uint8Array(this._stashBuffer, 0, this._bufferSize);
  117302. if (this._stashUsed > 0) {
  117303. var buffer = this._stashBuffer.slice(0, this._stashUsed);
  117304. var consumed = this._dispatchChunks(buffer, this._stashByteStart);
  117305. if (consumed < buffer.byteLength) {
  117306. if (consumed > 0) {
  117307. var remainArray = new Uint8Array(buffer, consumed);
  117308. stashArray.set(remainArray, 0);
  117309. this._stashUsed = remainArray.byteLength;
  117310. this._stashByteStart += consumed;
  117311. }
  117312. } else {
  117313. this._stashUsed = 0;
  117314. this._stashByteStart += consumed;
  117315. }
  117316. if (this._stashUsed + chunk.byteLength > this._bufferSize) {
  117317. this._expandBuffer(this._stashUsed + chunk.byteLength);
  117318. stashArray = new Uint8Array(this._stashBuffer, 0, this._bufferSize);
  117319. }
  117320. stashArray.set(new Uint8Array(chunk), this._stashUsed);
  117321. this._stashUsed += chunk.byteLength;
  117322. } else {
  117323. var consumed = this._dispatchChunks(chunk, byteStart);
  117324. if (consumed < chunk.byteLength) {
  117325. var remain = chunk.byteLength - consumed;
  117326. if (remain > this._bufferSize) {
  117327. this._expandBuffer(remain);
  117328. stashArray = new Uint8Array(this._stashBuffer, 0, this._bufferSize);
  117329. }
  117330. stashArray.set(new Uint8Array(chunk, consumed), 0);
  117331. this._stashUsed += remain;
  117332. this._stashByteStart = byteStart + consumed;
  117333. }
  117334. }
  117335. }
  117336. }
  117337. };
  117338. IOController2.prototype._flushStashBuffer = function(dropUnconsumed) {
  117339. if (this._stashUsed > 0) {
  117340. var buffer = this._stashBuffer.slice(0, this._stashUsed);
  117341. var consumed = this._dispatchChunks(buffer, this._stashByteStart);
  117342. var remain = buffer.byteLength - consumed;
  117343. if (consumed < buffer.byteLength) {
  117344. if (dropUnconsumed) {
  117345. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, remain + " bytes unconsumed data remain when flush buffer, dropped");
  117346. } else {
  117347. if (consumed > 0) {
  117348. var stashArray = new Uint8Array(this._stashBuffer, 0, this._bufferSize);
  117349. var remainArray = new Uint8Array(buffer, consumed);
  117350. stashArray.set(remainArray, 0);
  117351. this._stashUsed = remainArray.byteLength;
  117352. this._stashByteStart += consumed;
  117353. }
  117354. return 0;
  117355. }
  117356. }
  117357. this._stashUsed = 0;
  117358. this._stashByteStart = 0;
  117359. return remain;
  117360. }
  117361. return 0;
  117362. };
  117363. IOController2.prototype._onLoaderComplete = function(from3, to) {
  117364. this._flushStashBuffer(true);
  117365. if (this._onComplete) {
  117366. this._onComplete(this._extraData);
  117367. }
  117368. };
  117369. IOController2.prototype._onLoaderError = function(type2, data) {
  117370. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.e(this.TAG, "Loader error, code = " + data.code + ", msg = " + data.msg);
  117371. this._flushStashBuffer(false);
  117372. if (this._isEarlyEofReconnecting) {
  117373. this._isEarlyEofReconnecting = false;
  117374. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.UNRECOVERABLE_EARLY_EOF;
  117375. }
  117376. switch (type2) {
  117377. case _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.EARLY_EOF: {
  117378. if (!this._config.isLive) {
  117379. if (this._totalLength) {
  117380. var nextFrom = this._currentRange.to + 1;
  117381. if (nextFrom < this._totalLength) {
  117382. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Connection lost, trying reconnect...");
  117383. this._isEarlyEofReconnecting = true;
  117384. this._internalSeek(nextFrom, false);
  117385. }
  117386. return;
  117387. }
  117388. }
  117389. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.UNRECOVERABLE_EARLY_EOF;
  117390. break;
  117391. }
  117392. case _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.UNRECOVERABLE_EARLY_EOF:
  117393. case _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.CONNECTING_TIMEOUT:
  117394. case _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.HTTP_STATUS_CODE_INVALID:
  117395. case _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.EXCEPTION:
  117396. break;
  117397. }
  117398. if (this._onError) {
  117399. this._onError(type2, data);
  117400. } else {
  117401. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__.RuntimeException("IOException: " + data.msg);
  117402. }
  117403. };
  117404. return IOController2;
  117405. }();
  117406. __webpack_exports__2["default"] = IOController;
  117407. },
  117408. "./src/io/loader.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  117409. __webpack_require__2.r(__webpack_exports__2);
  117410. __webpack_require__2.d(__webpack_exports__2, {
  117411. "LoaderStatus": function() {
  117412. return LoaderStatus;
  117413. },
  117414. "LoaderErrors": function() {
  117415. return LoaderErrors;
  117416. },
  117417. "BaseLoader": function() {
  117418. return BaseLoader;
  117419. }
  117420. });
  117421. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/exception.js");
  117422. var LoaderStatus = {
  117423. kIdle: 0,
  117424. kConnecting: 1,
  117425. kBuffering: 2,
  117426. kError: 3,
  117427. kComplete: 4
  117428. };
  117429. var LoaderErrors = {
  117430. OK: "OK",
  117431. EXCEPTION: "Exception",
  117432. HTTP_STATUS_CODE_INVALID: "HttpStatusCodeInvalid",
  117433. CONNECTING_TIMEOUT: "ConnectingTimeout",
  117434. EARLY_EOF: "EarlyEof",
  117435. UNRECOVERABLE_EARLY_EOF: "UnrecoverableEarlyEof"
  117436. };
  117437. var BaseLoader = function() {
  117438. function BaseLoader2(typeName) {
  117439. this._type = typeName || "undefined";
  117440. this._status = LoaderStatus.kIdle;
  117441. this._needStash = false;
  117442. this._onContentLengthKnown = null;
  117443. this._onURLRedirect = null;
  117444. this._onDataArrival = null;
  117445. this._onError = null;
  117446. this._onComplete = null;
  117447. }
  117448. BaseLoader2.prototype.destroy = function() {
  117449. this._status = LoaderStatus.kIdle;
  117450. this._onContentLengthKnown = null;
  117451. this._onURLRedirect = null;
  117452. this._onDataArrival = null;
  117453. this._onError = null;
  117454. this._onComplete = null;
  117455. };
  117456. BaseLoader2.prototype.isWorking = function() {
  117457. return this._status === LoaderStatus.kConnecting || this._status === LoaderStatus.kBuffering;
  117458. };
  117459. Object.defineProperty(BaseLoader2.prototype, "type", {
  117460. get: function() {
  117461. return this._type;
  117462. },
  117463. enumerable: false,
  117464. configurable: true
  117465. });
  117466. Object.defineProperty(BaseLoader2.prototype, "status", {
  117467. get: function() {
  117468. return this._status;
  117469. },
  117470. enumerable: false,
  117471. configurable: true
  117472. });
  117473. Object.defineProperty(BaseLoader2.prototype, "needStashBuffer", {
  117474. get: function() {
  117475. return this._needStash;
  117476. },
  117477. enumerable: false,
  117478. configurable: true
  117479. });
  117480. Object.defineProperty(BaseLoader2.prototype, "onContentLengthKnown", {
  117481. get: function() {
  117482. return this._onContentLengthKnown;
  117483. },
  117484. set: function(callback2) {
  117485. this._onContentLengthKnown = callback2;
  117486. },
  117487. enumerable: false,
  117488. configurable: true
  117489. });
  117490. Object.defineProperty(BaseLoader2.prototype, "onURLRedirect", {
  117491. get: function() {
  117492. return this._onURLRedirect;
  117493. },
  117494. set: function(callback2) {
  117495. this._onURLRedirect = callback2;
  117496. },
  117497. enumerable: false,
  117498. configurable: true
  117499. });
  117500. Object.defineProperty(BaseLoader2.prototype, "onDataArrival", {
  117501. get: function() {
  117502. return this._onDataArrival;
  117503. },
  117504. set: function(callback2) {
  117505. this._onDataArrival = callback2;
  117506. },
  117507. enumerable: false,
  117508. configurable: true
  117509. });
  117510. Object.defineProperty(BaseLoader2.prototype, "onError", {
  117511. get: function() {
  117512. return this._onError;
  117513. },
  117514. set: function(callback2) {
  117515. this._onError = callback2;
  117516. },
  117517. enumerable: false,
  117518. configurable: true
  117519. });
  117520. Object.defineProperty(BaseLoader2.prototype, "onComplete", {
  117521. get: function() {
  117522. return this._onComplete;
  117523. },
  117524. set: function(callback2) {
  117525. this._onComplete = callback2;
  117526. },
  117527. enumerable: false,
  117528. configurable: true
  117529. });
  117530. BaseLoader2.prototype.open = function(dataSource, range3) {
  117531. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_0__.NotImplementedException("Unimplemented abstract function!");
  117532. };
  117533. BaseLoader2.prototype.abort = function() {
  117534. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_0__.NotImplementedException("Unimplemented abstract function!");
  117535. };
  117536. return BaseLoader2;
  117537. }();
  117538. },
  117539. "./src/io/param-seek-handler.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  117540. __webpack_require__2.r(__webpack_exports__2);
  117541. var ParamSeekHandler = function() {
  117542. function ParamSeekHandler2(paramStart, paramEnd) {
  117543. this._startName = paramStart;
  117544. this._endName = paramEnd;
  117545. }
  117546. ParamSeekHandler2.prototype.getConfig = function(baseUrl, range3) {
  117547. var url = baseUrl;
  117548. if (range3.from !== 0 || range3.to !== -1) {
  117549. var needAnd = true;
  117550. if (url.indexOf("?") === -1) {
  117551. url += "?";
  117552. needAnd = false;
  117553. }
  117554. if (needAnd) {
  117555. url += "&";
  117556. }
  117557. url += this._startName + "=" + range3.from.toString();
  117558. if (range3.to !== -1) {
  117559. url += "&" + this._endName + "=" + range3.to.toString();
  117560. }
  117561. }
  117562. return {
  117563. url,
  117564. headers: {}
  117565. };
  117566. };
  117567. ParamSeekHandler2.prototype.removeURLParameters = function(seekedURL) {
  117568. var baseURL = seekedURL.split("?")[0];
  117569. var params = void 0;
  117570. var queryIndex = seekedURL.indexOf("?");
  117571. if (queryIndex !== -1) {
  117572. params = seekedURL.substring(queryIndex + 1);
  117573. }
  117574. var resultParams = "";
  117575. if (params != void 0 && params.length > 0) {
  117576. var pairs = params.split("&");
  117577. for (var i2 = 0; i2 < pairs.length; i2++) {
  117578. var pair = pairs[i2].split("=");
  117579. var requireAnd = i2 > 0;
  117580. if (pair[0] !== this._startName && pair[0] !== this._endName) {
  117581. if (requireAnd) {
  117582. resultParams += "&";
  117583. }
  117584. resultParams += pairs[i2];
  117585. }
  117586. }
  117587. }
  117588. return resultParams.length === 0 ? baseURL : baseURL + "?" + resultParams;
  117589. };
  117590. return ParamSeekHandler2;
  117591. }();
  117592. __webpack_exports__2["default"] = ParamSeekHandler;
  117593. },
  117594. "./src/io/range-seek-handler.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  117595. __webpack_require__2.r(__webpack_exports__2);
  117596. var RangeSeekHandler = function() {
  117597. function RangeSeekHandler2(zeroStart) {
  117598. this._zeroStart = zeroStart || false;
  117599. }
  117600. RangeSeekHandler2.prototype.getConfig = function(url, range3) {
  117601. var headers = {};
  117602. if (range3.from !== 0 || range3.to !== -1) {
  117603. var param = void 0;
  117604. if (range3.to !== -1) {
  117605. param = "bytes=" + range3.from.toString() + "-" + range3.to.toString();
  117606. } else {
  117607. param = "bytes=" + range3.from.toString() + "-";
  117608. }
  117609. headers["Range"] = param;
  117610. } else if (this._zeroStart) {
  117611. headers["Range"] = "bytes=0-";
  117612. }
  117613. return {
  117614. url,
  117615. headers
  117616. };
  117617. };
  117618. RangeSeekHandler2.prototype.removeURLParameters = function(seekedURL) {
  117619. return seekedURL;
  117620. };
  117621. return RangeSeekHandler2;
  117622. }();
  117623. __webpack_exports__2["default"] = RangeSeekHandler;
  117624. },
  117625. "./src/io/speed-sampler.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  117626. __webpack_require__2.r(__webpack_exports__2);
  117627. var SpeedSampler = function() {
  117628. function SpeedSampler2() {
  117629. this._firstCheckpoint = 0;
  117630. this._lastCheckpoint = 0;
  117631. this._intervalBytes = 0;
  117632. this._totalBytes = 0;
  117633. this._lastSecondBytes = 0;
  117634. if (self.performance && self.performance.now) {
  117635. this._now = self.performance.now.bind(self.performance);
  117636. } else {
  117637. this._now = Date.now;
  117638. }
  117639. }
  117640. SpeedSampler2.prototype.reset = function() {
  117641. this._firstCheckpoint = this._lastCheckpoint = 0;
  117642. this._totalBytes = this._intervalBytes = 0;
  117643. this._lastSecondBytes = 0;
  117644. };
  117645. SpeedSampler2.prototype.addBytes = function(bytes) {
  117646. if (this._firstCheckpoint === 0) {
  117647. this._firstCheckpoint = this._now();
  117648. this._lastCheckpoint = this._firstCheckpoint;
  117649. this._intervalBytes += bytes;
  117650. this._totalBytes += bytes;
  117651. } else if (this._now() - this._lastCheckpoint < 1e3) {
  117652. this._intervalBytes += bytes;
  117653. this._totalBytes += bytes;
  117654. } else {
  117655. this._lastSecondBytes = this._intervalBytes;
  117656. this._intervalBytes = bytes;
  117657. this._totalBytes += bytes;
  117658. this._lastCheckpoint = this._now();
  117659. }
  117660. };
  117661. Object.defineProperty(SpeedSampler2.prototype, "currentKBps", {
  117662. get: function() {
  117663. this.addBytes(0);
  117664. var durationSeconds = (this._now() - this._lastCheckpoint) / 1e3;
  117665. if (durationSeconds == 0)
  117666. durationSeconds = 1;
  117667. return this._intervalBytes / durationSeconds / 1024;
  117668. },
  117669. enumerable: false,
  117670. configurable: true
  117671. });
  117672. Object.defineProperty(SpeedSampler2.prototype, "lastSecondKBps", {
  117673. get: function() {
  117674. this.addBytes(0);
  117675. if (this._lastSecondBytes !== 0) {
  117676. return this._lastSecondBytes / 1024;
  117677. } else {
  117678. if (this._now() - this._lastCheckpoint >= 500) {
  117679. return this.currentKBps;
  117680. } else {
  117681. return 0;
  117682. }
  117683. }
  117684. },
  117685. enumerable: false,
  117686. configurable: true
  117687. });
  117688. Object.defineProperty(SpeedSampler2.prototype, "averageKBps", {
  117689. get: function() {
  117690. var durationSeconds = (this._now() - this._firstCheckpoint) / 1e3;
  117691. return this._totalBytes / durationSeconds / 1024;
  117692. },
  117693. enumerable: false,
  117694. configurable: true
  117695. });
  117696. return SpeedSampler2;
  117697. }();
  117698. __webpack_exports__2["default"] = SpeedSampler;
  117699. },
  117700. "./src/io/websocket-loader.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  117701. __webpack_require__2.r(__webpack_exports__2);
  117702. var _loader_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/io/loader.js");
  117703. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/exception.js");
  117704. var __extends = function() {
  117705. var extendStatics = function(d2, b) {
  117706. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b2) {
  117707. d3.__proto__ = b2;
  117708. } || function(d3, b2) {
  117709. for (var p in b2)
  117710. if (Object.prototype.hasOwnProperty.call(b2, p))
  117711. d3[p] = b2[p];
  117712. };
  117713. return extendStatics(d2, b);
  117714. };
  117715. return function(d2, b) {
  117716. if (typeof b !== "function" && b !== null)
  117717. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  117718. extendStatics(d2, b);
  117719. function __() {
  117720. this.constructor = d2;
  117721. }
  117722. d2.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  117723. };
  117724. }();
  117725. var WebSocketLoader = function(_super) {
  117726. __extends(WebSocketLoader2, _super);
  117727. function WebSocketLoader2() {
  117728. var _this = _super.call(this, "websocket-loader") || this;
  117729. _this.TAG = "WebSocketLoader";
  117730. _this._needStash = true;
  117731. _this._ws = null;
  117732. _this._requestAbort = false;
  117733. _this._receivedLength = 0;
  117734. return _this;
  117735. }
  117736. WebSocketLoader2.isSupported = function() {
  117737. try {
  117738. return typeof self.WebSocket !== "undefined";
  117739. } catch (e) {
  117740. return false;
  117741. }
  117742. };
  117743. WebSocketLoader2.prototype.destroy = function() {
  117744. if (this._ws) {
  117745. this.abort();
  117746. }
  117747. _super.prototype.destroy.call(this);
  117748. };
  117749. WebSocketLoader2.prototype.open = function(dataSource) {
  117750. try {
  117751. var ws = this._ws = new self.WebSocket(dataSource.url);
  117752. ws.binaryType = "arraybuffer";
  117753. ws.onopen = this._onWebSocketOpen.bind(this);
  117754. ws.onclose = this._onWebSocketClose.bind(this);
  117755. ws.onmessage = this._onWebSocketMessage.bind(this);
  117756. ws.onerror = this._onWebSocketError.bind(this);
  117757. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kConnecting;
  117758. } catch (e) {
  117759. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kError;
  117760. var info = { code: e.code, msg: e.message };
  117761. if (this._onError) {
  117762. this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.EXCEPTION, info);
  117763. } else {
  117764. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_1__.RuntimeException(info.msg);
  117765. }
  117766. }
  117767. };
  117768. WebSocketLoader2.prototype.abort = function() {
  117769. var ws = this._ws;
  117770. if (ws && (ws.readyState === 0 || ws.readyState === 1)) {
  117771. this._requestAbort = true;
  117772. ws.close();
  117773. }
  117774. this._ws = null;
  117775. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kComplete;
  117776. };
  117777. WebSocketLoader2.prototype._onWebSocketOpen = function(e) {
  117778. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kBuffering;
  117779. };
  117780. WebSocketLoader2.prototype._onWebSocketClose = function(e) {
  117781. if (this._requestAbort === true) {
  117782. this._requestAbort = false;
  117783. return;
  117784. }
  117785. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kComplete;
  117786. if (this._onComplete) {
  117787. this._onComplete(0, this._receivedLength - 1);
  117788. }
  117789. };
  117790. WebSocketLoader2.prototype._onWebSocketMessage = function(e) {
  117791. var _this = this;
  117792. if (e.data instanceof ArrayBuffer) {
  117793. this._dispatchArrayBuffer(e.data);
  117794. } else if (e.data instanceof Blob) {
  117795. var reader_1 = new FileReader();
  117796. reader_1.onload = function() {
  117797. _this._dispatchArrayBuffer(reader_1.result);
  117798. };
  117799. reader_1.readAsArrayBuffer(e.data);
  117800. } else {
  117801. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kError;
  117802. var info = { code: -1, msg: "Unsupported WebSocket message type: " + e.data.constructor.name };
  117803. if (this._onError) {
  117804. this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.EXCEPTION, info);
  117805. } else {
  117806. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_1__.RuntimeException(info.msg);
  117807. }
  117808. }
  117809. };
  117810. WebSocketLoader2.prototype._dispatchArrayBuffer = function(arraybuffer) {
  117811. var chunk = arraybuffer;
  117812. var byteStart = this._receivedLength;
  117813. this._receivedLength += chunk.byteLength;
  117814. if (this._onDataArrival) {
  117815. this._onDataArrival(chunk, byteStart, this._receivedLength);
  117816. }
  117817. };
  117818. WebSocketLoader2.prototype._onWebSocketError = function(e) {
  117819. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kError;
  117820. var info = {
  117821. code: e.code,
  117822. msg: e.message
  117823. };
  117824. if (this._onError) {
  117825. this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.EXCEPTION, info);
  117826. } else {
  117827. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_1__.RuntimeException(info.msg);
  117828. }
  117829. };
  117830. return WebSocketLoader2;
  117831. }(_loader_js__WEBPACK_IMPORTED_MODULE_0__.BaseLoader);
  117832. __webpack_exports__2["default"] = WebSocketLoader;
  117833. },
  117834. "./src/io/xhr-moz-chunked-loader.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  117835. __webpack_require__2.r(__webpack_exports__2);
  117836. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logger.js");
  117837. var _loader_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/io/loader.js");
  117838. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/exception.js");
  117839. var __extends = function() {
  117840. var extendStatics = function(d2, b) {
  117841. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b2) {
  117842. d3.__proto__ = b2;
  117843. } || function(d3, b2) {
  117844. for (var p in b2)
  117845. if (Object.prototype.hasOwnProperty.call(b2, p))
  117846. d3[p] = b2[p];
  117847. };
  117848. return extendStatics(d2, b);
  117849. };
  117850. return function(d2, b) {
  117851. if (typeof b !== "function" && b !== null)
  117852. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  117853. extendStatics(d2, b);
  117854. function __() {
  117855. this.constructor = d2;
  117856. }
  117857. d2.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  117858. };
  117859. }();
  117860. var MozChunkedLoader = function(_super) {
  117861. __extends(MozChunkedLoader2, _super);
  117862. function MozChunkedLoader2(seekHandler, config) {
  117863. var _this = _super.call(this, "xhr-moz-chunked-loader") || this;
  117864. _this.TAG = "MozChunkedLoader";
  117865. _this._seekHandler = seekHandler;
  117866. _this._config = config;
  117867. _this._needStash = true;
  117868. _this._xhr = null;
  117869. _this._requestAbort = false;
  117870. _this._contentLength = null;
  117871. _this._receivedLength = 0;
  117872. return _this;
  117873. }
  117874. MozChunkedLoader2.isSupported = function() {
  117875. try {
  117876. var xhr = new XMLHttpRequest();
  117877. xhr.open("GET", "https://example.com", true);
  117878. xhr.responseType = "moz-chunked-arraybuffer";
  117879. return xhr.responseType === "moz-chunked-arraybuffer";
  117880. } catch (e) {
  117881. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w("MozChunkedLoader", e.message);
  117882. return false;
  117883. }
  117884. };
  117885. MozChunkedLoader2.prototype.destroy = function() {
  117886. if (this.isWorking()) {
  117887. this.abort();
  117888. }
  117889. if (this._xhr) {
  117890. this._xhr.onreadystatechange = null;
  117891. this._xhr.onprogress = null;
  117892. this._xhr.onloadend = null;
  117893. this._xhr.onerror = null;
  117894. this._xhr = null;
  117895. }
  117896. _super.prototype.destroy.call(this);
  117897. };
  117898. MozChunkedLoader2.prototype.open = function(dataSource, range3) {
  117899. this._dataSource = dataSource;
  117900. this._range = range3;
  117901. var sourceURL = dataSource.url;
  117902. if (this._config.reuseRedirectedURL && dataSource.redirectedURL != void 0) {
  117903. sourceURL = dataSource.redirectedURL;
  117904. }
  117905. var seekConfig = this._seekHandler.getConfig(sourceURL, range3);
  117906. this._requestURL = seekConfig.url;
  117907. var xhr = this._xhr = new XMLHttpRequest();
  117908. xhr.open("GET", seekConfig.url, true);
  117909. xhr.responseType = "moz-chunked-arraybuffer";
  117910. xhr.onreadystatechange = this._onReadyStateChange.bind(this);
  117911. xhr.onprogress = this._onProgress.bind(this);
  117912. xhr.onloadend = this._onLoadEnd.bind(this);
  117913. xhr.onerror = this._onXhrError.bind(this);
  117914. if (dataSource.withCredentials) {
  117915. xhr.withCredentials = true;
  117916. }
  117917. if (typeof seekConfig.headers === "object") {
  117918. var headers = seekConfig.headers;
  117919. for (var key in headers) {
  117920. if (headers.hasOwnProperty(key)) {
  117921. xhr.setRequestHeader(key, headers[key]);
  117922. }
  117923. }
  117924. }
  117925. if (typeof this._config.headers === "object") {
  117926. var headers = this._config.headers;
  117927. for (var key in headers) {
  117928. if (headers.hasOwnProperty(key)) {
  117929. xhr.setRequestHeader(key, headers[key]);
  117930. }
  117931. }
  117932. }
  117933. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kConnecting;
  117934. xhr.send();
  117935. };
  117936. MozChunkedLoader2.prototype.abort = function() {
  117937. this._requestAbort = true;
  117938. if (this._xhr) {
  117939. this._xhr.abort();
  117940. }
  117941. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kComplete;
  117942. };
  117943. MozChunkedLoader2.prototype._onReadyStateChange = function(e) {
  117944. var xhr = e.target;
  117945. if (xhr.readyState === 2) {
  117946. if (xhr.responseURL != void 0 && xhr.responseURL !== this._requestURL) {
  117947. if (this._onURLRedirect) {
  117948. var redirectedURL = this._seekHandler.removeURLParameters(xhr.responseURL);
  117949. this._onURLRedirect(redirectedURL);
  117950. }
  117951. }
  117952. if (xhr.status !== 0 && (xhr.status < 200 || xhr.status > 299)) {
  117953. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError;
  117954. if (this._onError) {
  117955. this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.HTTP_STATUS_CODE_INVALID, { code: xhr.status, msg: xhr.statusText });
  117956. } else {
  117957. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.RuntimeException("MozChunkedLoader: Http code invalid, " + xhr.status + " " + xhr.statusText);
  117958. }
  117959. } else {
  117960. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kBuffering;
  117961. }
  117962. }
  117963. };
  117964. MozChunkedLoader2.prototype._onProgress = function(e) {
  117965. if (this._status === _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError) {
  117966. return;
  117967. }
  117968. if (this._contentLength === null) {
  117969. if (e.total !== null && e.total !== 0) {
  117970. this._contentLength = e.total;
  117971. if (this._onContentLengthKnown) {
  117972. this._onContentLengthKnown(this._contentLength);
  117973. }
  117974. }
  117975. }
  117976. var chunk = e.target.response;
  117977. var byteStart = this._range.from + this._receivedLength;
  117978. this._receivedLength += chunk.byteLength;
  117979. if (this._onDataArrival) {
  117980. this._onDataArrival(chunk, byteStart, this._receivedLength);
  117981. }
  117982. };
  117983. MozChunkedLoader2.prototype._onLoadEnd = function(e) {
  117984. if (this._requestAbort === true) {
  117985. this._requestAbort = false;
  117986. return;
  117987. } else if (this._status === _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError) {
  117988. return;
  117989. }
  117990. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kComplete;
  117991. if (this._onComplete) {
  117992. this._onComplete(this._range.from, this._range.from + this._receivedLength - 1);
  117993. }
  117994. };
  117995. MozChunkedLoader2.prototype._onXhrError = function(e) {
  117996. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError;
  117997. var type2 = 0;
  117998. var info = null;
  117999. if (this._contentLength && e.loaded < this._contentLength) {
  118000. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.EARLY_EOF;
  118001. info = { code: -1, msg: "Moz-Chunked stream meet Early-Eof" };
  118002. } else {
  118003. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.EXCEPTION;
  118004. info = { code: -1, msg: e.constructor.name + " " + e.type };
  118005. }
  118006. if (this._onError) {
  118007. this._onError(type2, info);
  118008. } else {
  118009. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.RuntimeException(info.msg);
  118010. }
  118011. };
  118012. return MozChunkedLoader2;
  118013. }(_loader_js__WEBPACK_IMPORTED_MODULE_1__.BaseLoader);
  118014. __webpack_exports__2["default"] = MozChunkedLoader;
  118015. },
  118016. "./src/io/xhr-range-loader.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  118017. __webpack_require__2.r(__webpack_exports__2);
  118018. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logger.js");
  118019. var _speed_sampler_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/io/speed-sampler.js");
  118020. var _loader_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/io/loader.js");
  118021. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/utils/exception.js");
  118022. var __extends = function() {
  118023. var extendStatics = function(d2, b) {
  118024. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b2) {
  118025. d3.__proto__ = b2;
  118026. } || function(d3, b2) {
  118027. for (var p in b2)
  118028. if (Object.prototype.hasOwnProperty.call(b2, p))
  118029. d3[p] = b2[p];
  118030. };
  118031. return extendStatics(d2, b);
  118032. };
  118033. return function(d2, b) {
  118034. if (typeof b !== "function" && b !== null)
  118035. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  118036. extendStatics(d2, b);
  118037. function __() {
  118038. this.constructor = d2;
  118039. }
  118040. d2.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  118041. };
  118042. }();
  118043. var RangeLoader = function(_super) {
  118044. __extends(RangeLoader2, _super);
  118045. function RangeLoader2(seekHandler, config) {
  118046. var _this = _super.call(this, "xhr-range-loader") || this;
  118047. _this.TAG = "RangeLoader";
  118048. _this._seekHandler = seekHandler;
  118049. _this._config = config;
  118050. _this._needStash = false;
  118051. _this._chunkSizeKBList = [
  118052. 128,
  118053. 256,
  118054. 384,
  118055. 512,
  118056. 768,
  118057. 1024,
  118058. 1536,
  118059. 2048,
  118060. 3072,
  118061. 4096,
  118062. 5120,
  118063. 6144,
  118064. 7168,
  118065. 8192
  118066. ];
  118067. _this._currentChunkSizeKB = 384;
  118068. _this._currentSpeedNormalized = 0;
  118069. _this._zeroSpeedChunkCount = 0;
  118070. _this._xhr = null;
  118071. _this._speedSampler = new _speed_sampler_js__WEBPACK_IMPORTED_MODULE_1__.default();
  118072. _this._requestAbort = false;
  118073. _this._waitForTotalLength = false;
  118074. _this._totalLengthReceived = false;
  118075. _this._currentRequestURL = null;
  118076. _this._currentRedirectedURL = null;
  118077. _this._currentRequestRange = null;
  118078. _this._totalLength = null;
  118079. _this._contentLength = null;
  118080. _this._receivedLength = 0;
  118081. _this._lastTimeLoaded = 0;
  118082. return _this;
  118083. }
  118084. RangeLoader2.isSupported = function() {
  118085. try {
  118086. var xhr = new XMLHttpRequest();
  118087. xhr.open("GET", "https://example.com", true);
  118088. xhr.responseType = "arraybuffer";
  118089. return xhr.responseType === "arraybuffer";
  118090. } catch (e) {
  118091. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w("RangeLoader", e.message);
  118092. return false;
  118093. }
  118094. };
  118095. RangeLoader2.prototype.destroy = function() {
  118096. if (this.isWorking()) {
  118097. this.abort();
  118098. }
  118099. if (this._xhr) {
  118100. this._xhr.onreadystatechange = null;
  118101. this._xhr.onprogress = null;
  118102. this._xhr.onload = null;
  118103. this._xhr.onerror = null;
  118104. this._xhr = null;
  118105. }
  118106. _super.prototype.destroy.call(this);
  118107. };
  118108. Object.defineProperty(RangeLoader2.prototype, "currentSpeed", {
  118109. get: function() {
  118110. return this._speedSampler.lastSecondKBps;
  118111. },
  118112. enumerable: false,
  118113. configurable: true
  118114. });
  118115. RangeLoader2.prototype.open = function(dataSource, range3) {
  118116. this._dataSource = dataSource;
  118117. this._range = range3;
  118118. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kConnecting;
  118119. var useRefTotalLength = false;
  118120. if (this._dataSource.filesize != void 0 && this._dataSource.filesize !== 0) {
  118121. useRefTotalLength = true;
  118122. this._totalLength = this._dataSource.filesize;
  118123. }
  118124. if (!this._totalLengthReceived && !useRefTotalLength) {
  118125. this._waitForTotalLength = true;
  118126. this._internalOpen(this._dataSource, { from: 0, to: -1 });
  118127. } else {
  118128. this._openSubRange();
  118129. }
  118130. };
  118131. RangeLoader2.prototype._openSubRange = function() {
  118132. var chunkSize = this._currentChunkSizeKB * 1024;
  118133. var from3 = this._range.from + this._receivedLength;
  118134. var to = from3 + chunkSize;
  118135. if (this._contentLength != null) {
  118136. if (to - this._range.from >= this._contentLength) {
  118137. to = this._range.from + this._contentLength - 1;
  118138. }
  118139. }
  118140. this._currentRequestRange = { from: from3, to };
  118141. this._internalOpen(this._dataSource, this._currentRequestRange);
  118142. };
  118143. RangeLoader2.prototype._internalOpen = function(dataSource, range3) {
  118144. this._lastTimeLoaded = 0;
  118145. var sourceURL = dataSource.url;
  118146. if (this._config.reuseRedirectedURL) {
  118147. if (this._currentRedirectedURL != void 0) {
  118148. sourceURL = this._currentRedirectedURL;
  118149. } else if (dataSource.redirectedURL != void 0) {
  118150. sourceURL = dataSource.redirectedURL;
  118151. }
  118152. }
  118153. var seekConfig = this._seekHandler.getConfig(sourceURL, range3);
  118154. this._currentRequestURL = seekConfig.url;
  118155. var xhr = this._xhr = new XMLHttpRequest();
  118156. xhr.open("GET", seekConfig.url, true);
  118157. xhr.responseType = "arraybuffer";
  118158. xhr.onreadystatechange = this._onReadyStateChange.bind(this);
  118159. xhr.onprogress = this._onProgress.bind(this);
  118160. xhr.onload = this._onLoad.bind(this);
  118161. xhr.onerror = this._onXhrError.bind(this);
  118162. if (dataSource.withCredentials) {
  118163. xhr.withCredentials = true;
  118164. }
  118165. if (typeof seekConfig.headers === "object") {
  118166. var headers = seekConfig.headers;
  118167. for (var key in headers) {
  118168. if (headers.hasOwnProperty(key)) {
  118169. xhr.setRequestHeader(key, headers[key]);
  118170. }
  118171. }
  118172. }
  118173. if (typeof this._config.headers === "object") {
  118174. var headers = this._config.headers;
  118175. for (var key in headers) {
  118176. if (headers.hasOwnProperty(key)) {
  118177. xhr.setRequestHeader(key, headers[key]);
  118178. }
  118179. }
  118180. }
  118181. xhr.send();
  118182. };
  118183. RangeLoader2.prototype.abort = function() {
  118184. this._requestAbort = true;
  118185. this._internalAbort();
  118186. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kComplete;
  118187. };
  118188. RangeLoader2.prototype._internalAbort = function() {
  118189. if (this._xhr) {
  118190. this._xhr.onreadystatechange = null;
  118191. this._xhr.onprogress = null;
  118192. this._xhr.onload = null;
  118193. this._xhr.onerror = null;
  118194. this._xhr.abort();
  118195. this._xhr = null;
  118196. }
  118197. };
  118198. RangeLoader2.prototype._onReadyStateChange = function(e) {
  118199. var xhr = e.target;
  118200. if (xhr.readyState === 2) {
  118201. if (xhr.responseURL != void 0) {
  118202. var redirectedURL = this._seekHandler.removeURLParameters(xhr.responseURL);
  118203. if (xhr.responseURL !== this._currentRequestURL && redirectedURL !== this._currentRedirectedURL) {
  118204. this._currentRedirectedURL = redirectedURL;
  118205. if (this._onURLRedirect) {
  118206. this._onURLRedirect(redirectedURL);
  118207. }
  118208. }
  118209. }
  118210. if (xhr.status >= 200 && xhr.status <= 299) {
  118211. if (this._waitForTotalLength) {
  118212. return;
  118213. }
  118214. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kBuffering;
  118215. } else {
  118216. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kError;
  118217. if (this._onError) {
  118218. this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.HTTP_STATUS_CODE_INVALID, { code: xhr.status, msg: xhr.statusText });
  118219. } else {
  118220. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__.RuntimeException("RangeLoader: Http code invalid, " + xhr.status + " " + xhr.statusText);
  118221. }
  118222. }
  118223. }
  118224. };
  118225. RangeLoader2.prototype._onProgress = function(e) {
  118226. if (this._status === _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kError) {
  118227. return;
  118228. }
  118229. if (this._contentLength === null) {
  118230. var openNextRange = false;
  118231. if (this._waitForTotalLength) {
  118232. this._waitForTotalLength = false;
  118233. this._totalLengthReceived = true;
  118234. openNextRange = true;
  118235. var total = e.total;
  118236. this._internalAbort();
  118237. if (total != null & total !== 0) {
  118238. this._totalLength = total;
  118239. }
  118240. }
  118241. if (this._range.to === -1) {
  118242. this._contentLength = this._totalLength - this._range.from;
  118243. } else {
  118244. this._contentLength = this._range.to - this._range.from + 1;
  118245. }
  118246. if (openNextRange) {
  118247. this._openSubRange();
  118248. return;
  118249. }
  118250. if (this._onContentLengthKnown) {
  118251. this._onContentLengthKnown(this._contentLength);
  118252. }
  118253. }
  118254. var delta = e.loaded - this._lastTimeLoaded;
  118255. this._lastTimeLoaded = e.loaded;
  118256. this._speedSampler.addBytes(delta);
  118257. };
  118258. RangeLoader2.prototype._normalizeSpeed = function(input) {
  118259. var list = this._chunkSizeKBList;
  118260. var last = list.length - 1;
  118261. var mid = 0;
  118262. var lbound = 0;
  118263. var ubound = last;
  118264. if (input < list[0]) {
  118265. return list[0];
  118266. }
  118267. while (lbound <= ubound) {
  118268. mid = lbound + Math.floor((ubound - lbound) / 2);
  118269. if (mid === last || input >= list[mid] && input < list[mid + 1]) {
  118270. return list[mid];
  118271. } else if (list[mid] < input) {
  118272. lbound = mid + 1;
  118273. } else {
  118274. ubound = mid - 1;
  118275. }
  118276. }
  118277. };
  118278. RangeLoader2.prototype._onLoad = function(e) {
  118279. if (this._status === _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kError) {
  118280. return;
  118281. }
  118282. if (this._waitForTotalLength) {
  118283. this._waitForTotalLength = false;
  118284. return;
  118285. }
  118286. this._lastTimeLoaded = 0;
  118287. var KBps = this._speedSampler.lastSecondKBps;
  118288. if (KBps === 0) {
  118289. this._zeroSpeedChunkCount++;
  118290. if (this._zeroSpeedChunkCount >= 3) {
  118291. KBps = this._speedSampler.currentKBps;
  118292. }
  118293. }
  118294. if (KBps !== 0) {
  118295. var normalized = this._normalizeSpeed(KBps);
  118296. if (this._currentSpeedNormalized !== normalized) {
  118297. this._currentSpeedNormalized = normalized;
  118298. this._currentChunkSizeKB = normalized;
  118299. }
  118300. }
  118301. var chunk = e.target.response;
  118302. var byteStart = this._range.from + this._receivedLength;
  118303. this._receivedLength += chunk.byteLength;
  118304. var reportComplete = false;
  118305. if (this._contentLength != null && this._receivedLength < this._contentLength) {
  118306. this._openSubRange();
  118307. } else {
  118308. reportComplete = true;
  118309. }
  118310. if (this._onDataArrival) {
  118311. this._onDataArrival(chunk, byteStart, this._receivedLength);
  118312. }
  118313. if (reportComplete) {
  118314. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kComplete;
  118315. if (this._onComplete) {
  118316. this._onComplete(this._range.from, this._range.from + this._receivedLength - 1);
  118317. }
  118318. }
  118319. };
  118320. RangeLoader2.prototype._onXhrError = function(e) {
  118321. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kError;
  118322. var type2 = 0;
  118323. var info = null;
  118324. if (this._contentLength && this._receivedLength > 0 && this._receivedLength < this._contentLength) {
  118325. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.EARLY_EOF;
  118326. info = { code: -1, msg: "RangeLoader meet Early-Eof" };
  118327. } else {
  118328. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.EXCEPTION;
  118329. info = { code: -1, msg: e.constructor.name + " " + e.type };
  118330. }
  118331. if (this._onError) {
  118332. this._onError(type2, info);
  118333. } else {
  118334. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__.RuntimeException(info.msg);
  118335. }
  118336. };
  118337. return RangeLoader2;
  118338. }(_loader_js__WEBPACK_IMPORTED_MODULE_2__.BaseLoader);
  118339. __webpack_exports__2["default"] = RangeLoader;
  118340. },
  118341. "./src/player/flv-player.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  118342. __webpack_require__2.r(__webpack_exports__2);
  118343. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  118344. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  118345. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/logger.js");
  118346. var _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/browser.js");
  118347. var _player_events_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/player/player-events.js");
  118348. var _core_transmuxer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/core/transmuxer.js");
  118349. var _core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/core/transmuxing-events.js");
  118350. var _core_mse_controller_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__2("./src/core/mse-controller.js");
  118351. var _core_mse_events_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__2("./src/core/mse-events.js");
  118352. var _player_errors_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__2("./src/player/player-errors.js");
  118353. var _config_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__2("./src/config.js");
  118354. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__2("./src/utils/exception.js");
  118355. var FlvPlayer = function() {
  118356. function FlvPlayer2(mediaDataSource, config) {
  118357. this.TAG = "FlvPlayer";
  118358. this._type = "FlvPlayer";
  118359. this._emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  118360. this._config = (0, _config_js__WEBPACK_IMPORTED_MODULE_9__.createDefaultConfig)();
  118361. if (typeof config === "object") {
  118362. Object.assign(this._config, config);
  118363. }
  118364. if (mediaDataSource.type.toLowerCase() !== "flv") {
  118365. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_10__.InvalidArgumentException("FlvPlayer requires an flv MediaDataSource input!");
  118366. }
  118367. if (mediaDataSource.isLive === true) {
  118368. this._config.isLive = true;
  118369. }
  118370. this.e = {
  118371. onvLoadedMetadata: this._onvLoadedMetadata.bind(this),
  118372. onvSeeking: this._onvSeeking.bind(this),
  118373. onvCanPlay: this._onvCanPlay.bind(this),
  118374. onvStalled: this._onvStalled.bind(this),
  118375. onvProgress: this._onvProgress.bind(this)
  118376. };
  118377. if (self.performance && self.performance.now) {
  118378. this._now = self.performance.now.bind(self.performance);
  118379. } else {
  118380. this._now = Date.now;
  118381. }
  118382. this._pendingSeekTime = null;
  118383. this._requestSetTime = false;
  118384. this._seekpointRecord = null;
  118385. this._progressChecker = null;
  118386. this._mediaDataSource = mediaDataSource;
  118387. this._mediaElement = null;
  118388. this._msectl = null;
  118389. this._transmuxer = null;
  118390. this._mseSourceOpened = false;
  118391. this._hasPendingLoad = false;
  118392. this._receivedCanPlay = false;
  118393. this._mediaInfo = null;
  118394. this._statisticsInfo = null;
  118395. var chromeNeedIDRFix = _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.chrome && (_utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.version.major < 50 || _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.version.major === 50 && _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.version.build < 2661);
  118396. this._alwaysSeekKeyframe = chromeNeedIDRFix || _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.msedge || _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.msie ? true : false;
  118397. if (this._alwaysSeekKeyframe) {
  118398. this._config.accurateSeek = false;
  118399. }
  118400. }
  118401. FlvPlayer2.prototype.destroy = function() {
  118402. if (this._progressChecker != null) {
  118403. window.clearInterval(this._progressChecker);
  118404. this._progressChecker = null;
  118405. }
  118406. if (this._transmuxer) {
  118407. this.unload();
  118408. }
  118409. if (this._mediaElement) {
  118410. this.detachMediaElement();
  118411. }
  118412. this.e = null;
  118413. this._mediaDataSource = null;
  118414. this._emitter.removeAllListeners();
  118415. this._emitter = null;
  118416. };
  118417. FlvPlayer2.prototype.on = function(event2, listener) {
  118418. var _this = this;
  118419. if (event2 === _player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_INFO) {
  118420. if (this._mediaInfo != null) {
  118421. Promise.resolve().then(function() {
  118422. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_INFO, _this.mediaInfo);
  118423. });
  118424. }
  118425. } else if (event2 === _player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.STATISTICS_INFO) {
  118426. if (this._statisticsInfo != null) {
  118427. Promise.resolve().then(function() {
  118428. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.STATISTICS_INFO, _this.statisticsInfo);
  118429. });
  118430. }
  118431. }
  118432. this._emitter.addListener(event2, listener);
  118433. };
  118434. FlvPlayer2.prototype.off = function(event2, listener) {
  118435. this._emitter.removeListener(event2, listener);
  118436. };
  118437. FlvPlayer2.prototype.attachMediaElement = function(mediaElement) {
  118438. var _this = this;
  118439. this._mediaElement = mediaElement;
  118440. mediaElement.addEventListener("loadedmetadata", this.e.onvLoadedMetadata);
  118441. mediaElement.addEventListener("seeking", this.e.onvSeeking);
  118442. mediaElement.addEventListener("canplay", this.e.onvCanPlay);
  118443. mediaElement.addEventListener("stalled", this.e.onvStalled);
  118444. mediaElement.addEventListener("progress", this.e.onvProgress);
  118445. this._msectl = new _core_mse_controller_js__WEBPACK_IMPORTED_MODULE_6__.default(this._config);
  118446. this._msectl.on(_core_mse_events_js__WEBPACK_IMPORTED_MODULE_7__.default.UPDATE_END, this._onmseUpdateEnd.bind(this));
  118447. this._msectl.on(_core_mse_events_js__WEBPACK_IMPORTED_MODULE_7__.default.BUFFER_FULL, this._onmseBufferFull.bind(this));
  118448. this._msectl.on(_core_mse_events_js__WEBPACK_IMPORTED_MODULE_7__.default.SOURCE_OPEN, function() {
  118449. _this._mseSourceOpened = true;
  118450. if (_this._hasPendingLoad) {
  118451. _this._hasPendingLoad = false;
  118452. _this.load();
  118453. }
  118454. });
  118455. this._msectl.on(_core_mse_events_js__WEBPACK_IMPORTED_MODULE_7__.default.ERROR, function(info) {
  118456. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.ERROR, _player_errors_js__WEBPACK_IMPORTED_MODULE_8__.ErrorTypes.MEDIA_ERROR, _player_errors_js__WEBPACK_IMPORTED_MODULE_8__.ErrorDetails.MEDIA_MSE_ERROR, info);
  118457. });
  118458. this._msectl.attachMediaElement(mediaElement);
  118459. if (this._pendingSeekTime != null) {
  118460. try {
  118461. mediaElement.currentTime = this._pendingSeekTime;
  118462. this._pendingSeekTime = null;
  118463. } catch (e) {
  118464. }
  118465. }
  118466. };
  118467. FlvPlayer2.prototype.detachMediaElement = function() {
  118468. if (this._mediaElement) {
  118469. this._msectl.detachMediaElement();
  118470. this._mediaElement.removeEventListener("loadedmetadata", this.e.onvLoadedMetadata);
  118471. this._mediaElement.removeEventListener("seeking", this.e.onvSeeking);
  118472. this._mediaElement.removeEventListener("canplay", this.e.onvCanPlay);
  118473. this._mediaElement.removeEventListener("stalled", this.e.onvStalled);
  118474. this._mediaElement.removeEventListener("progress", this.e.onvProgress);
  118475. this._mediaElement = null;
  118476. }
  118477. if (this._msectl) {
  118478. this._msectl.destroy();
  118479. this._msectl = null;
  118480. }
  118481. };
  118482. FlvPlayer2.prototype.load = function() {
  118483. var _this = this;
  118484. if (!this._mediaElement) {
  118485. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_10__.IllegalStateException("HTMLMediaElement must be attached before load()!");
  118486. }
  118487. if (this._transmuxer) {
  118488. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_10__.IllegalStateException("FlvPlayer.load() has been called, please call unload() first!");
  118489. }
  118490. if (this._hasPendingLoad) {
  118491. return;
  118492. }
  118493. if (this._config.deferLoadAfterSourceOpen && this._mseSourceOpened === false) {
  118494. this._hasPendingLoad = true;
  118495. return;
  118496. }
  118497. if (this._mediaElement.readyState > 0) {
  118498. this._requestSetTime = true;
  118499. this._mediaElement.currentTime = 0;
  118500. }
  118501. this._transmuxer = new _core_transmuxer_js__WEBPACK_IMPORTED_MODULE_4__.default(this._mediaDataSource, this._config);
  118502. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.INIT_SEGMENT, function(type2, is) {
  118503. _this._msectl.appendInitSegment(is);
  118504. });
  118505. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_SEGMENT, function(type2, ms) {
  118506. _this._msectl.appendMediaSegment(ms);
  118507. if (_this._config.lazyLoad && !_this._config.isLive) {
  118508. var currentTime = _this._mediaElement.currentTime;
  118509. if (ms.info.endDts >= (currentTime + _this._config.lazyLoadMaxDuration) * 1e3) {
  118510. if (_this._progressChecker == null) {
  118511. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(_this.TAG, "Maximum buffering duration exceeded, suspend transmuxing task");
  118512. _this._suspendTransmuxer();
  118513. }
  118514. }
  118515. }
  118516. });
  118517. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.LOADING_COMPLETE, function() {
  118518. _this._msectl.endOfStream();
  118519. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.LOADING_COMPLETE);
  118520. });
  118521. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOVERED_EARLY_EOF, function() {
  118522. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.RECOVERED_EARLY_EOF);
  118523. });
  118524. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.IO_ERROR, function(detail, info) {
  118525. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.ERROR, _player_errors_js__WEBPACK_IMPORTED_MODULE_8__.ErrorTypes.NETWORK_ERROR, detail, info);
  118526. });
  118527. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.DEMUX_ERROR, function(detail, info) {
  118528. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.ERROR, _player_errors_js__WEBPACK_IMPORTED_MODULE_8__.ErrorTypes.MEDIA_ERROR, detail, { code: -1, msg: info });
  118529. });
  118530. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_INFO, function(mediaInfo) {
  118531. _this._mediaInfo = mediaInfo;
  118532. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_INFO, Object.assign({}, mediaInfo));
  118533. });
  118534. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.METADATA_ARRIVED, function(metadata) {
  118535. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.METADATA_ARRIVED, metadata);
  118536. });
  118537. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.SCRIPTDATA_ARRIVED, function(data) {
  118538. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.SCRIPTDATA_ARRIVED, data);
  118539. });
  118540. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.STATISTICS_INFO, function(statInfo) {
  118541. _this._statisticsInfo = _this._fillStatisticsInfo(statInfo);
  118542. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.STATISTICS_INFO, Object.assign({}, _this._statisticsInfo));
  118543. });
  118544. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOMMEND_SEEKPOINT, function(milliseconds) {
  118545. if (_this._mediaElement && !_this._config.accurateSeek) {
  118546. _this._requestSetTime = true;
  118547. _this._mediaElement.currentTime = milliseconds / 1e3;
  118548. }
  118549. });
  118550. this._transmuxer.open();
  118551. };
  118552. FlvPlayer2.prototype.unload = function() {
  118553. if (this._mediaElement) {
  118554. this._mediaElement.pause();
  118555. }
  118556. if (this._msectl) {
  118557. this._msectl.seek(0);
  118558. }
  118559. if (this._transmuxer) {
  118560. this._transmuxer.close();
  118561. this._transmuxer.destroy();
  118562. this._transmuxer = null;
  118563. }
  118564. };
  118565. FlvPlayer2.prototype.play = function() {
  118566. return this._mediaElement.play();
  118567. };
  118568. FlvPlayer2.prototype.pause = function() {
  118569. this._mediaElement.pause();
  118570. };
  118571. Object.defineProperty(FlvPlayer2.prototype, "type", {
  118572. get: function() {
  118573. return this._type;
  118574. },
  118575. enumerable: false,
  118576. configurable: true
  118577. });
  118578. Object.defineProperty(FlvPlayer2.prototype, "buffered", {
  118579. get: function() {
  118580. return this._mediaElement.buffered;
  118581. },
  118582. enumerable: false,
  118583. configurable: true
  118584. });
  118585. Object.defineProperty(FlvPlayer2.prototype, "duration", {
  118586. get: function() {
  118587. return this._mediaElement.duration;
  118588. },
  118589. enumerable: false,
  118590. configurable: true
  118591. });
  118592. Object.defineProperty(FlvPlayer2.prototype, "volume", {
  118593. get: function() {
  118594. return this._mediaElement.volume;
  118595. },
  118596. set: function(value) {
  118597. this._mediaElement.volume = value;
  118598. },
  118599. enumerable: false,
  118600. configurable: true
  118601. });
  118602. Object.defineProperty(FlvPlayer2.prototype, "muted", {
  118603. get: function() {
  118604. return this._mediaElement.muted;
  118605. },
  118606. set: function(muted) {
  118607. this._mediaElement.muted = muted;
  118608. },
  118609. enumerable: false,
  118610. configurable: true
  118611. });
  118612. Object.defineProperty(FlvPlayer2.prototype, "currentTime", {
  118613. get: function() {
  118614. if (this._mediaElement) {
  118615. return this._mediaElement.currentTime;
  118616. }
  118617. return 0;
  118618. },
  118619. set: function(seconds) {
  118620. if (this._mediaElement) {
  118621. this._internalSeek(seconds);
  118622. } else {
  118623. this._pendingSeekTime = seconds;
  118624. }
  118625. },
  118626. enumerable: false,
  118627. configurable: true
  118628. });
  118629. Object.defineProperty(FlvPlayer2.prototype, "mediaInfo", {
  118630. get: function() {
  118631. return Object.assign({}, this._mediaInfo);
  118632. },
  118633. enumerable: false,
  118634. configurable: true
  118635. });
  118636. Object.defineProperty(FlvPlayer2.prototype, "statisticsInfo", {
  118637. get: function() {
  118638. if (this._statisticsInfo == null) {
  118639. this._statisticsInfo = {};
  118640. }
  118641. this._statisticsInfo = this._fillStatisticsInfo(this._statisticsInfo);
  118642. return Object.assign({}, this._statisticsInfo);
  118643. },
  118644. enumerable: false,
  118645. configurable: true
  118646. });
  118647. FlvPlayer2.prototype._fillStatisticsInfo = function(statInfo) {
  118648. statInfo.playerType = this._type;
  118649. if (!(this._mediaElement instanceof HTMLVideoElement)) {
  118650. return statInfo;
  118651. }
  118652. var hasQualityInfo = true;
  118653. var decoded = 0;
  118654. var dropped = 0;
  118655. if (this._mediaElement.getVideoPlaybackQuality) {
  118656. var quality = this._mediaElement.getVideoPlaybackQuality();
  118657. decoded = quality.totalVideoFrames;
  118658. dropped = quality.droppedVideoFrames;
  118659. } else if (this._mediaElement.webkitDecodedFrameCount != void 0) {
  118660. decoded = this._mediaElement.webkitDecodedFrameCount;
  118661. dropped = this._mediaElement.webkitDroppedFrameCount;
  118662. } else {
  118663. hasQualityInfo = false;
  118664. }
  118665. if (hasQualityInfo) {
  118666. statInfo.decodedFrames = decoded;
  118667. statInfo.droppedFrames = dropped;
  118668. }
  118669. return statInfo;
  118670. };
  118671. FlvPlayer2.prototype._onmseUpdateEnd = function() {
  118672. if (!this._config.lazyLoad || this._config.isLive) {
  118673. return;
  118674. }
  118675. var buffered = this._mediaElement.buffered;
  118676. var currentTime = this._mediaElement.currentTime;
  118677. var currentRangeEnd = 0;
  118678. for (var i2 = 0; i2 < buffered.length; i2++) {
  118679. var start2 = buffered.start(i2);
  118680. var end = buffered.end(i2);
  118681. if (start2 <= currentTime && currentTime < end) {
  118682. currentRangeEnd = end;
  118683. break;
  118684. }
  118685. }
  118686. if (currentRangeEnd >= currentTime + this._config.lazyLoadMaxDuration && this._progressChecker == null) {
  118687. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "Maximum buffering duration exceeded, suspend transmuxing task");
  118688. this._suspendTransmuxer();
  118689. }
  118690. };
  118691. FlvPlayer2.prototype._onmseBufferFull = function() {
  118692. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "MSE SourceBuffer is full, suspend transmuxing task");
  118693. if (this._progressChecker == null) {
  118694. this._suspendTransmuxer();
  118695. }
  118696. };
  118697. FlvPlayer2.prototype._suspendTransmuxer = function() {
  118698. if (this._transmuxer) {
  118699. this._transmuxer.pause();
  118700. if (this._progressChecker == null) {
  118701. this._progressChecker = window.setInterval(this._checkProgressAndResume.bind(this), 1e3);
  118702. }
  118703. }
  118704. };
  118705. FlvPlayer2.prototype._checkProgressAndResume = function() {
  118706. var currentTime = this._mediaElement.currentTime;
  118707. var buffered = this._mediaElement.buffered;
  118708. var needResume = false;
  118709. for (var i2 = 0; i2 < buffered.length; i2++) {
  118710. var from3 = buffered.start(i2);
  118711. var to = buffered.end(i2);
  118712. if (currentTime >= from3 && currentTime < to) {
  118713. if (currentTime >= to - this._config.lazyLoadRecoverDuration) {
  118714. needResume = true;
  118715. }
  118716. break;
  118717. }
  118718. }
  118719. if (needResume) {
  118720. window.clearInterval(this._progressChecker);
  118721. this._progressChecker = null;
  118722. if (needResume) {
  118723. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "Continue loading from paused position");
  118724. this._transmuxer.resume();
  118725. }
  118726. }
  118727. };
  118728. FlvPlayer2.prototype._isTimepointBuffered = function(seconds) {
  118729. var buffered = this._mediaElement.buffered;
  118730. for (var i2 = 0; i2 < buffered.length; i2++) {
  118731. var from3 = buffered.start(i2);
  118732. var to = buffered.end(i2);
  118733. if (seconds >= from3 && seconds < to) {
  118734. return true;
  118735. }
  118736. }
  118737. return false;
  118738. };
  118739. FlvPlayer2.prototype._internalSeek = function(seconds) {
  118740. var directSeek = this._isTimepointBuffered(seconds);
  118741. var directSeekBegin = false;
  118742. var directSeekBeginTime = 0;
  118743. if (seconds < 1 && this._mediaElement.buffered.length > 0) {
  118744. var videoBeginTime = this._mediaElement.buffered.start(0);
  118745. if (videoBeginTime < 1 && seconds < videoBeginTime || _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari) {
  118746. directSeekBegin = true;
  118747. directSeekBeginTime = _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari ? 0.1 : videoBeginTime;
  118748. }
  118749. }
  118750. if (directSeekBegin) {
  118751. this._requestSetTime = true;
  118752. this._mediaElement.currentTime = directSeekBeginTime;
  118753. } else if (directSeek) {
  118754. if (!this._alwaysSeekKeyframe) {
  118755. this._requestSetTime = true;
  118756. this._mediaElement.currentTime = seconds;
  118757. } else {
  118758. var idr = this._msectl.getNearestKeyframe(Math.floor(seconds * 1e3));
  118759. this._requestSetTime = true;
  118760. if (idr != null) {
  118761. this._mediaElement.currentTime = idr.dts / 1e3;
  118762. } else {
  118763. this._mediaElement.currentTime = seconds;
  118764. }
  118765. }
  118766. if (this._progressChecker != null) {
  118767. this._checkProgressAndResume();
  118768. }
  118769. } else {
  118770. if (this._progressChecker != null) {
  118771. window.clearInterval(this._progressChecker);
  118772. this._progressChecker = null;
  118773. }
  118774. this._msectl.seek(seconds);
  118775. this._transmuxer.seek(Math.floor(seconds * 1e3));
  118776. if (this._config.accurateSeek) {
  118777. this._requestSetTime = true;
  118778. this._mediaElement.currentTime = seconds;
  118779. }
  118780. }
  118781. };
  118782. FlvPlayer2.prototype._checkAndApplyUnbufferedSeekpoint = function() {
  118783. if (this._seekpointRecord) {
  118784. if (this._seekpointRecord.recordTime <= this._now() - 100) {
  118785. var target = this._mediaElement.currentTime;
  118786. this._seekpointRecord = null;
  118787. if (!this._isTimepointBuffered(target)) {
  118788. if (this._progressChecker != null) {
  118789. window.clearTimeout(this._progressChecker);
  118790. this._progressChecker = null;
  118791. }
  118792. this._msectl.seek(target);
  118793. this._transmuxer.seek(Math.floor(target * 1e3));
  118794. if (this._config.accurateSeek) {
  118795. this._requestSetTime = true;
  118796. this._mediaElement.currentTime = target;
  118797. }
  118798. }
  118799. } else {
  118800. window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this), 50);
  118801. }
  118802. }
  118803. };
  118804. FlvPlayer2.prototype._checkAndResumeStuckPlayback = function(stalled) {
  118805. var media = this._mediaElement;
  118806. if (stalled || !this._receivedCanPlay || media.readyState < 2) {
  118807. var buffered = media.buffered;
  118808. if (buffered.length > 0 && media.currentTime < buffered.start(0)) {
  118809. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.w(this.TAG, "Playback seems stuck at " + media.currentTime + ", seek to " + buffered.start(0));
  118810. this._requestSetTime = true;
  118811. this._mediaElement.currentTime = buffered.start(0);
  118812. this._mediaElement.removeEventListener("progress", this.e.onvProgress);
  118813. }
  118814. } else {
  118815. this._mediaElement.removeEventListener("progress", this.e.onvProgress);
  118816. }
  118817. };
  118818. FlvPlayer2.prototype._onvLoadedMetadata = function(e) {
  118819. if (this._pendingSeekTime != null) {
  118820. this._mediaElement.currentTime = this._pendingSeekTime;
  118821. this._pendingSeekTime = null;
  118822. }
  118823. };
  118824. FlvPlayer2.prototype._onvSeeking = function(e) {
  118825. var target = this._mediaElement.currentTime;
  118826. var buffered = this._mediaElement.buffered;
  118827. if (this._requestSetTime) {
  118828. this._requestSetTime = false;
  118829. return;
  118830. }
  118831. if (target < 1 && buffered.length > 0) {
  118832. var videoBeginTime = buffered.start(0);
  118833. if (videoBeginTime < 1 && target < videoBeginTime || _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari) {
  118834. this._requestSetTime = true;
  118835. this._mediaElement.currentTime = _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari ? 0.1 : videoBeginTime;
  118836. return;
  118837. }
  118838. }
  118839. if (this._isTimepointBuffered(target)) {
  118840. if (this._alwaysSeekKeyframe) {
  118841. var idr = this._msectl.getNearestKeyframe(Math.floor(target * 1e3));
  118842. if (idr != null) {
  118843. this._requestSetTime = true;
  118844. this._mediaElement.currentTime = idr.dts / 1e3;
  118845. }
  118846. }
  118847. if (this._progressChecker != null) {
  118848. this._checkProgressAndResume();
  118849. }
  118850. return;
  118851. }
  118852. this._seekpointRecord = {
  118853. seekPoint: target,
  118854. recordTime: this._now()
  118855. };
  118856. window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this), 50);
  118857. };
  118858. FlvPlayer2.prototype._onvCanPlay = function(e) {
  118859. this._receivedCanPlay = true;
  118860. this._mediaElement.removeEventListener("canplay", this.e.onvCanPlay);
  118861. };
  118862. FlvPlayer2.prototype._onvStalled = function(e) {
  118863. this._checkAndResumeStuckPlayback(true);
  118864. };
  118865. FlvPlayer2.prototype._onvProgress = function(e) {
  118866. this._checkAndResumeStuckPlayback();
  118867. };
  118868. return FlvPlayer2;
  118869. }();
  118870. __webpack_exports__2["default"] = FlvPlayer;
  118871. },
  118872. "./src/player/native-player.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  118873. __webpack_require__2.r(__webpack_exports__2);
  118874. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  118875. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  118876. var _player_events_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/player/player-events.js");
  118877. var _config_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/config.js");
  118878. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/utils/exception.js");
  118879. var NativePlayer = function() {
  118880. function NativePlayer2(mediaDataSource, config) {
  118881. this.TAG = "NativePlayer";
  118882. this._type = "NativePlayer";
  118883. this._emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  118884. this._config = (0, _config_js__WEBPACK_IMPORTED_MODULE_2__.createDefaultConfig)();
  118885. if (typeof config === "object") {
  118886. Object.assign(this._config, config);
  118887. }
  118888. if (mediaDataSource.type.toLowerCase() === "flv") {
  118889. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__.InvalidArgumentException("NativePlayer does't support flv MediaDataSource input!");
  118890. }
  118891. if (mediaDataSource.hasOwnProperty("segments")) {
  118892. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__.InvalidArgumentException("NativePlayer(" + mediaDataSource.type + ") doesn't support multipart playback!");
  118893. }
  118894. this.e = {
  118895. onvLoadedMetadata: this._onvLoadedMetadata.bind(this)
  118896. };
  118897. this._pendingSeekTime = null;
  118898. this._statisticsReporter = null;
  118899. this._mediaDataSource = mediaDataSource;
  118900. this._mediaElement = null;
  118901. }
  118902. NativePlayer2.prototype.destroy = function() {
  118903. if (this._mediaElement) {
  118904. this.unload();
  118905. this.detachMediaElement();
  118906. }
  118907. this.e = null;
  118908. this._mediaDataSource = null;
  118909. this._emitter.removeAllListeners();
  118910. this._emitter = null;
  118911. };
  118912. NativePlayer2.prototype.on = function(event2, listener) {
  118913. var _this = this;
  118914. if (event2 === _player_events_js__WEBPACK_IMPORTED_MODULE_1__.default.MEDIA_INFO) {
  118915. if (this._mediaElement != null && this._mediaElement.readyState !== 0) {
  118916. Promise.resolve().then(function() {
  118917. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_1__.default.MEDIA_INFO, _this.mediaInfo);
  118918. });
  118919. }
  118920. } else if (event2 === _player_events_js__WEBPACK_IMPORTED_MODULE_1__.default.STATISTICS_INFO) {
  118921. if (this._mediaElement != null && this._mediaElement.readyState !== 0) {
  118922. Promise.resolve().then(function() {
  118923. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_1__.default.STATISTICS_INFO, _this.statisticsInfo);
  118924. });
  118925. }
  118926. }
  118927. this._emitter.addListener(event2, listener);
  118928. };
  118929. NativePlayer2.prototype.off = function(event2, listener) {
  118930. this._emitter.removeListener(event2, listener);
  118931. };
  118932. NativePlayer2.prototype.attachMediaElement = function(mediaElement) {
  118933. this._mediaElement = mediaElement;
  118934. mediaElement.addEventListener("loadedmetadata", this.e.onvLoadedMetadata);
  118935. if (this._pendingSeekTime != null) {
  118936. try {
  118937. mediaElement.currentTime = this._pendingSeekTime;
  118938. this._pendingSeekTime = null;
  118939. } catch (e) {
  118940. }
  118941. }
  118942. };
  118943. NativePlayer2.prototype.detachMediaElement = function() {
  118944. if (this._mediaElement) {
  118945. this._mediaElement.src = "";
  118946. this._mediaElement.removeAttribute("src");
  118947. this._mediaElement.removeEventListener("loadedmetadata", this.e.onvLoadedMetadata);
  118948. this._mediaElement = null;
  118949. }
  118950. if (this._statisticsReporter != null) {
  118951. window.clearInterval(this._statisticsReporter);
  118952. this._statisticsReporter = null;
  118953. }
  118954. };
  118955. NativePlayer2.prototype.load = function() {
  118956. if (!this._mediaElement) {
  118957. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__.IllegalStateException("HTMLMediaElement must be attached before load()!");
  118958. }
  118959. this._mediaElement.src = this._mediaDataSource.url;
  118960. if (this._mediaElement.readyState > 0) {
  118961. this._mediaElement.currentTime = 0;
  118962. }
  118963. this._mediaElement.preload = "auto";
  118964. this._mediaElement.load();
  118965. this._statisticsReporter = window.setInterval(this._reportStatisticsInfo.bind(this), this._config.statisticsInfoReportInterval);
  118966. };
  118967. NativePlayer2.prototype.unload = function() {
  118968. if (this._mediaElement) {
  118969. this._mediaElement.src = "";
  118970. this._mediaElement.removeAttribute("src");
  118971. }
  118972. if (this._statisticsReporter != null) {
  118973. window.clearInterval(this._statisticsReporter);
  118974. this._statisticsReporter = null;
  118975. }
  118976. };
  118977. NativePlayer2.prototype.play = function() {
  118978. return this._mediaElement.play();
  118979. };
  118980. NativePlayer2.prototype.pause = function() {
  118981. this._mediaElement.pause();
  118982. };
  118983. Object.defineProperty(NativePlayer2.prototype, "type", {
  118984. get: function() {
  118985. return this._type;
  118986. },
  118987. enumerable: false,
  118988. configurable: true
  118989. });
  118990. Object.defineProperty(NativePlayer2.prototype, "buffered", {
  118991. get: function() {
  118992. return this._mediaElement.buffered;
  118993. },
  118994. enumerable: false,
  118995. configurable: true
  118996. });
  118997. Object.defineProperty(NativePlayer2.prototype, "duration", {
  118998. get: function() {
  118999. return this._mediaElement.duration;
  119000. },
  119001. enumerable: false,
  119002. configurable: true
  119003. });
  119004. Object.defineProperty(NativePlayer2.prototype, "volume", {
  119005. get: function() {
  119006. return this._mediaElement.volume;
  119007. },
  119008. set: function(value) {
  119009. this._mediaElement.volume = value;
  119010. },
  119011. enumerable: false,
  119012. configurable: true
  119013. });
  119014. Object.defineProperty(NativePlayer2.prototype, "muted", {
  119015. get: function() {
  119016. return this._mediaElement.muted;
  119017. },
  119018. set: function(muted) {
  119019. this._mediaElement.muted = muted;
  119020. },
  119021. enumerable: false,
  119022. configurable: true
  119023. });
  119024. Object.defineProperty(NativePlayer2.prototype, "currentTime", {
  119025. get: function() {
  119026. if (this._mediaElement) {
  119027. return this._mediaElement.currentTime;
  119028. }
  119029. return 0;
  119030. },
  119031. set: function(seconds) {
  119032. if (this._mediaElement) {
  119033. this._mediaElement.currentTime = seconds;
  119034. } else {
  119035. this._pendingSeekTime = seconds;
  119036. }
  119037. },
  119038. enumerable: false,
  119039. configurable: true
  119040. });
  119041. Object.defineProperty(NativePlayer2.prototype, "mediaInfo", {
  119042. get: function() {
  119043. var mediaPrefix = this._mediaElement instanceof HTMLAudioElement ? "audio/" : "video/";
  119044. var info = {
  119045. mimeType: mediaPrefix + this._mediaDataSource.type
  119046. };
  119047. if (this._mediaElement) {
  119048. info.duration = Math.floor(this._mediaElement.duration * 1e3);
  119049. if (this._mediaElement instanceof HTMLVideoElement) {
  119050. info.width = this._mediaElement.videoWidth;
  119051. info.height = this._mediaElement.videoHeight;
  119052. }
  119053. }
  119054. return info;
  119055. },
  119056. enumerable: false,
  119057. configurable: true
  119058. });
  119059. Object.defineProperty(NativePlayer2.prototype, "statisticsInfo", {
  119060. get: function() {
  119061. var info = {
  119062. playerType: this._type,
  119063. url: this._mediaDataSource.url
  119064. };
  119065. if (!(this._mediaElement instanceof HTMLVideoElement)) {
  119066. return info;
  119067. }
  119068. var hasQualityInfo = true;
  119069. var decoded = 0;
  119070. var dropped = 0;
  119071. if (this._mediaElement.getVideoPlaybackQuality) {
  119072. var quality = this._mediaElement.getVideoPlaybackQuality();
  119073. decoded = quality.totalVideoFrames;
  119074. dropped = quality.droppedVideoFrames;
  119075. } else if (this._mediaElement.webkitDecodedFrameCount != void 0) {
  119076. decoded = this._mediaElement.webkitDecodedFrameCount;
  119077. dropped = this._mediaElement.webkitDroppedFrameCount;
  119078. } else {
  119079. hasQualityInfo = false;
  119080. }
  119081. if (hasQualityInfo) {
  119082. info.decodedFrames = decoded;
  119083. info.droppedFrames = dropped;
  119084. }
  119085. return info;
  119086. },
  119087. enumerable: false,
  119088. configurable: true
  119089. });
  119090. NativePlayer2.prototype._onvLoadedMetadata = function(e) {
  119091. if (this._pendingSeekTime != null) {
  119092. this._mediaElement.currentTime = this._pendingSeekTime;
  119093. this._pendingSeekTime = null;
  119094. }
  119095. this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_1__.default.MEDIA_INFO, this.mediaInfo);
  119096. };
  119097. NativePlayer2.prototype._reportStatisticsInfo = function() {
  119098. this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_1__.default.STATISTICS_INFO, this.statisticsInfo);
  119099. };
  119100. return NativePlayer2;
  119101. }();
  119102. __webpack_exports__2["default"] = NativePlayer;
  119103. },
  119104. "./src/player/player-errors.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  119105. __webpack_require__2.r(__webpack_exports__2);
  119106. __webpack_require__2.d(__webpack_exports__2, {
  119107. "ErrorTypes": function() {
  119108. return ErrorTypes;
  119109. },
  119110. "ErrorDetails": function() {
  119111. return ErrorDetails;
  119112. }
  119113. });
  119114. var _io_loader_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/io/loader.js");
  119115. var _demux_demux_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/demux/demux-errors.js");
  119116. var ErrorTypes = {
  119117. NETWORK_ERROR: "NetworkError",
  119118. MEDIA_ERROR: "MediaError",
  119119. OTHER_ERROR: "OtherError"
  119120. };
  119121. var ErrorDetails = {
  119122. NETWORK_EXCEPTION: _io_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.EXCEPTION,
  119123. NETWORK_STATUS_CODE_INVALID: _io_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.HTTP_STATUS_CODE_INVALID,
  119124. NETWORK_TIMEOUT: _io_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.CONNECTING_TIMEOUT,
  119125. NETWORK_UNRECOVERABLE_EARLY_EOF: _io_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.UNRECOVERABLE_EARLY_EOF,
  119126. MEDIA_MSE_ERROR: "MediaMSEError",
  119127. MEDIA_FORMAT_ERROR: _demux_demux_errors_js__WEBPACK_IMPORTED_MODULE_1__.default.FORMAT_ERROR,
  119128. MEDIA_FORMAT_UNSUPPORTED: _demux_demux_errors_js__WEBPACK_IMPORTED_MODULE_1__.default.FORMAT_UNSUPPORTED,
  119129. MEDIA_CODEC_UNSUPPORTED: _demux_demux_errors_js__WEBPACK_IMPORTED_MODULE_1__.default.CODEC_UNSUPPORTED
  119130. };
  119131. },
  119132. "./src/player/player-events.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  119133. __webpack_require__2.r(__webpack_exports__2);
  119134. var PlayerEvents = {
  119135. ERROR: "error",
  119136. LOADING_COMPLETE: "loading_complete",
  119137. RECOVERED_EARLY_EOF: "recovered_early_eof",
  119138. MEDIA_INFO: "media_info",
  119139. METADATA_ARRIVED: "metadata_arrived",
  119140. SCRIPTDATA_ARRIVED: "scriptdata_arrived",
  119141. STATISTICS_INFO: "statistics_info"
  119142. };
  119143. __webpack_exports__2["default"] = PlayerEvents;
  119144. },
  119145. "./src/remux/aac-silent.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  119146. __webpack_require__2.r(__webpack_exports__2);
  119147. var AAC = function() {
  119148. function AAC2() {
  119149. }
  119150. AAC2.getSilentFrame = function(codec, channelCount) {
  119151. if (codec === "mp4a.40.2") {
  119152. if (channelCount === 1) {
  119153. return new Uint8Array([0, 200, 0, 128, 35, 128]);
  119154. } else if (channelCount === 2) {
  119155. return new Uint8Array([33, 0, 73, 144, 2, 25, 0, 35, 128]);
  119156. } else if (channelCount === 3) {
  119157. return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 142]);
  119158. } else if (channelCount === 4) {
  119159. return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 128, 44, 128, 8, 2, 56]);
  119160. } else if (channelCount === 5) {
  119161. return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 56]);
  119162. } else if (channelCount === 6) {
  119163. return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 0, 178, 0, 32, 8, 224]);
  119164. }
  119165. } else {
  119166. if (channelCount === 1) {
  119167. return new Uint8Array([1, 64, 34, 128, 163, 78, 230, 128, 186, 8, 0, 0, 0, 28, 6, 241, 193, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94]);
  119168. } else if (channelCount === 2) {
  119169. return new Uint8Array([1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0, 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94]);
  119170. } else if (channelCount === 3) {
  119171. return new Uint8Array([1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0, 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94]);
  119172. }
  119173. }
  119174. return null;
  119175. };
  119176. return AAC2;
  119177. }();
  119178. __webpack_exports__2["default"] = AAC;
  119179. },
  119180. "./src/remux/mp4-generator.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  119181. __webpack_require__2.r(__webpack_exports__2);
  119182. var MP4 = function() {
  119183. function MP42() {
  119184. }
  119185. MP42.init = function() {
  119186. MP42.types = {
  119187. avc1: [],
  119188. avcC: [],
  119189. btrt: [],
  119190. dinf: [],
  119191. dref: [],
  119192. esds: [],
  119193. ftyp: [],
  119194. hdlr: [],
  119195. mdat: [],
  119196. mdhd: [],
  119197. mdia: [],
  119198. mfhd: [],
  119199. minf: [],
  119200. moof: [],
  119201. moov: [],
  119202. mp4a: [],
  119203. mvex: [],
  119204. mvhd: [],
  119205. sdtp: [],
  119206. stbl: [],
  119207. stco: [],
  119208. stsc: [],
  119209. stsd: [],
  119210. stsz: [],
  119211. stts: [],
  119212. tfdt: [],
  119213. tfhd: [],
  119214. traf: [],
  119215. trak: [],
  119216. trun: [],
  119217. trex: [],
  119218. tkhd: [],
  119219. vmhd: [],
  119220. smhd: [],
  119221. ".mp3": []
  119222. };
  119223. for (var name_1 in MP42.types) {
  119224. if (MP42.types.hasOwnProperty(name_1)) {
  119225. MP42.types[name_1] = [
  119226. name_1.charCodeAt(0),
  119227. name_1.charCodeAt(1),
  119228. name_1.charCodeAt(2),
  119229. name_1.charCodeAt(3)
  119230. ];
  119231. }
  119232. }
  119233. var constants = MP42.constants = {};
  119234. constants.FTYP = new Uint8Array([
  119235. 105,
  119236. 115,
  119237. 111,
  119238. 109,
  119239. 0,
  119240. 0,
  119241. 0,
  119242. 1,
  119243. 105,
  119244. 115,
  119245. 111,
  119246. 109,
  119247. 97,
  119248. 118,
  119249. 99,
  119250. 49
  119251. ]);
  119252. constants.STSD_PREFIX = new Uint8Array([
  119253. 0,
  119254. 0,
  119255. 0,
  119256. 0,
  119257. 0,
  119258. 0,
  119259. 0,
  119260. 1
  119261. ]);
  119262. constants.STTS = new Uint8Array([
  119263. 0,
  119264. 0,
  119265. 0,
  119266. 0,
  119267. 0,
  119268. 0,
  119269. 0,
  119270. 0
  119271. ]);
  119272. constants.STSC = constants.STCO = constants.STTS;
  119273. constants.STSZ = new Uint8Array([
  119274. 0,
  119275. 0,
  119276. 0,
  119277. 0,
  119278. 0,
  119279. 0,
  119280. 0,
  119281. 0,
  119282. 0,
  119283. 0,
  119284. 0,
  119285. 0
  119286. ]);
  119287. constants.HDLR_VIDEO = new Uint8Array([
  119288. 0,
  119289. 0,
  119290. 0,
  119291. 0,
  119292. 0,
  119293. 0,
  119294. 0,
  119295. 0,
  119296. 118,
  119297. 105,
  119298. 100,
  119299. 101,
  119300. 0,
  119301. 0,
  119302. 0,
  119303. 0,
  119304. 0,
  119305. 0,
  119306. 0,
  119307. 0,
  119308. 0,
  119309. 0,
  119310. 0,
  119311. 0,
  119312. 86,
  119313. 105,
  119314. 100,
  119315. 101,
  119316. 111,
  119317. 72,
  119318. 97,
  119319. 110,
  119320. 100,
  119321. 108,
  119322. 101,
  119323. 114,
  119324. 0
  119325. ]);
  119326. constants.HDLR_AUDIO = new Uint8Array([
  119327. 0,
  119328. 0,
  119329. 0,
  119330. 0,
  119331. 0,
  119332. 0,
  119333. 0,
  119334. 0,
  119335. 115,
  119336. 111,
  119337. 117,
  119338. 110,
  119339. 0,
  119340. 0,
  119341. 0,
  119342. 0,
  119343. 0,
  119344. 0,
  119345. 0,
  119346. 0,
  119347. 0,
  119348. 0,
  119349. 0,
  119350. 0,
  119351. 83,
  119352. 111,
  119353. 117,
  119354. 110,
  119355. 100,
  119356. 72,
  119357. 97,
  119358. 110,
  119359. 100,
  119360. 108,
  119361. 101,
  119362. 114,
  119363. 0
  119364. ]);
  119365. constants.DREF = new Uint8Array([
  119366. 0,
  119367. 0,
  119368. 0,
  119369. 0,
  119370. 0,
  119371. 0,
  119372. 0,
  119373. 1,
  119374. 0,
  119375. 0,
  119376. 0,
  119377. 12,
  119378. 117,
  119379. 114,
  119380. 108,
  119381. 32,
  119382. 0,
  119383. 0,
  119384. 0,
  119385. 1
  119386. ]);
  119387. constants.SMHD = new Uint8Array([
  119388. 0,
  119389. 0,
  119390. 0,
  119391. 0,
  119392. 0,
  119393. 0,
  119394. 0,
  119395. 0
  119396. ]);
  119397. constants.VMHD = new Uint8Array([
  119398. 0,
  119399. 0,
  119400. 0,
  119401. 1,
  119402. 0,
  119403. 0,
  119404. 0,
  119405. 0,
  119406. 0,
  119407. 0,
  119408. 0,
  119409. 0
  119410. ]);
  119411. };
  119412. MP42.box = function(type2) {
  119413. var size = 8;
  119414. var result = null;
  119415. var datas = Array.prototype.slice.call(arguments, 1);
  119416. var arrayCount = datas.length;
  119417. for (var i2 = 0; i2 < arrayCount; i2++) {
  119418. size += datas[i2].byteLength;
  119419. }
  119420. result = new Uint8Array(size);
  119421. result[0] = size >>> 24 & 255;
  119422. result[1] = size >>> 16 & 255;
  119423. result[2] = size >>> 8 & 255;
  119424. result[3] = size & 255;
  119425. result.set(type2, 4);
  119426. var offset = 8;
  119427. for (var i2 = 0; i2 < arrayCount; i2++) {
  119428. result.set(datas[i2], offset);
  119429. offset += datas[i2].byteLength;
  119430. }
  119431. return result;
  119432. };
  119433. MP42.generateInitSegment = function(meta2) {
  119434. var ftyp = MP42.box(MP42.types.ftyp, MP42.constants.FTYP);
  119435. var moov = MP42.moov(meta2);
  119436. var result = new Uint8Array(ftyp.byteLength + moov.byteLength);
  119437. result.set(ftyp, 0);
  119438. result.set(moov, ftyp.byteLength);
  119439. return result;
  119440. };
  119441. MP42.moov = function(meta2) {
  119442. var mvhd = MP42.mvhd(meta2.timescale, meta2.duration);
  119443. var trak = MP42.trak(meta2);
  119444. var mvex = MP42.mvex(meta2);
  119445. return MP42.box(MP42.types.moov, mvhd, trak, mvex);
  119446. };
  119447. MP42.mvhd = function(timescale2, duration5) {
  119448. return MP42.box(MP42.types.mvhd, new Uint8Array([
  119449. 0,
  119450. 0,
  119451. 0,
  119452. 0,
  119453. 0,
  119454. 0,
  119455. 0,
  119456. 0,
  119457. 0,
  119458. 0,
  119459. 0,
  119460. 0,
  119461. timescale2 >>> 24 & 255,
  119462. timescale2 >>> 16 & 255,
  119463. timescale2 >>> 8 & 255,
  119464. timescale2 & 255,
  119465. duration5 >>> 24 & 255,
  119466. duration5 >>> 16 & 255,
  119467. duration5 >>> 8 & 255,
  119468. duration5 & 255,
  119469. 0,
  119470. 1,
  119471. 0,
  119472. 0,
  119473. 1,
  119474. 0,
  119475. 0,
  119476. 0,
  119477. 0,
  119478. 0,
  119479. 0,
  119480. 0,
  119481. 0,
  119482. 0,
  119483. 0,
  119484. 0,
  119485. 0,
  119486. 1,
  119487. 0,
  119488. 0,
  119489. 0,
  119490. 0,
  119491. 0,
  119492. 0,
  119493. 0,
  119494. 0,
  119495. 0,
  119496. 0,
  119497. 0,
  119498. 0,
  119499. 0,
  119500. 0,
  119501. 0,
  119502. 1,
  119503. 0,
  119504. 0,
  119505. 0,
  119506. 0,
  119507. 0,
  119508. 0,
  119509. 0,
  119510. 0,
  119511. 0,
  119512. 0,
  119513. 0,
  119514. 0,
  119515. 0,
  119516. 0,
  119517. 64,
  119518. 0,
  119519. 0,
  119520. 0,
  119521. 0,
  119522. 0,
  119523. 0,
  119524. 0,
  119525. 0,
  119526. 0,
  119527. 0,
  119528. 0,
  119529. 0,
  119530. 0,
  119531. 0,
  119532. 0,
  119533. 0,
  119534. 0,
  119535. 0,
  119536. 0,
  119537. 0,
  119538. 0,
  119539. 0,
  119540. 0,
  119541. 0,
  119542. 0,
  119543. 0,
  119544. 0,
  119545. 255,
  119546. 255,
  119547. 255,
  119548. 255
  119549. ]));
  119550. };
  119551. MP42.trak = function(meta2) {
  119552. return MP42.box(MP42.types.trak, MP42.tkhd(meta2), MP42.mdia(meta2));
  119553. };
  119554. MP42.tkhd = function(meta2) {
  119555. var trackId = meta2.id, duration5 = meta2.duration;
  119556. var width2 = meta2.presentWidth, height2 = meta2.presentHeight;
  119557. return MP42.box(MP42.types.tkhd, new Uint8Array([
  119558. 0,
  119559. 0,
  119560. 0,
  119561. 7,
  119562. 0,
  119563. 0,
  119564. 0,
  119565. 0,
  119566. 0,
  119567. 0,
  119568. 0,
  119569. 0,
  119570. trackId >>> 24 & 255,
  119571. trackId >>> 16 & 255,
  119572. trackId >>> 8 & 255,
  119573. trackId & 255,
  119574. 0,
  119575. 0,
  119576. 0,
  119577. 0,
  119578. duration5 >>> 24 & 255,
  119579. duration5 >>> 16 & 255,
  119580. duration5 >>> 8 & 255,
  119581. duration5 & 255,
  119582. 0,
  119583. 0,
  119584. 0,
  119585. 0,
  119586. 0,
  119587. 0,
  119588. 0,
  119589. 0,
  119590. 0,
  119591. 0,
  119592. 0,
  119593. 0,
  119594. 0,
  119595. 0,
  119596. 0,
  119597. 0,
  119598. 0,
  119599. 1,
  119600. 0,
  119601. 0,
  119602. 0,
  119603. 0,
  119604. 0,
  119605. 0,
  119606. 0,
  119607. 0,
  119608. 0,
  119609. 0,
  119610. 0,
  119611. 0,
  119612. 0,
  119613. 0,
  119614. 0,
  119615. 1,
  119616. 0,
  119617. 0,
  119618. 0,
  119619. 0,
  119620. 0,
  119621. 0,
  119622. 0,
  119623. 0,
  119624. 0,
  119625. 0,
  119626. 0,
  119627. 0,
  119628. 0,
  119629. 0,
  119630. 64,
  119631. 0,
  119632. 0,
  119633. 0,
  119634. width2 >>> 8 & 255,
  119635. width2 & 255,
  119636. 0,
  119637. 0,
  119638. height2 >>> 8 & 255,
  119639. height2 & 255,
  119640. 0,
  119641. 0
  119642. ]));
  119643. };
  119644. MP42.mdia = function(meta2) {
  119645. return MP42.box(MP42.types.mdia, MP42.mdhd(meta2), MP42.hdlr(meta2), MP42.minf(meta2));
  119646. };
  119647. MP42.mdhd = function(meta2) {
  119648. var timescale2 = meta2.timescale;
  119649. var duration5 = meta2.duration;
  119650. return MP42.box(MP42.types.mdhd, new Uint8Array([
  119651. 0,
  119652. 0,
  119653. 0,
  119654. 0,
  119655. 0,
  119656. 0,
  119657. 0,
  119658. 0,
  119659. 0,
  119660. 0,
  119661. 0,
  119662. 0,
  119663. timescale2 >>> 24 & 255,
  119664. timescale2 >>> 16 & 255,
  119665. timescale2 >>> 8 & 255,
  119666. timescale2 & 255,
  119667. duration5 >>> 24 & 255,
  119668. duration5 >>> 16 & 255,
  119669. duration5 >>> 8 & 255,
  119670. duration5 & 255,
  119671. 85,
  119672. 196,
  119673. 0,
  119674. 0
  119675. ]));
  119676. };
  119677. MP42.hdlr = function(meta2) {
  119678. var data = null;
  119679. if (meta2.type === "audio") {
  119680. data = MP42.constants.HDLR_AUDIO;
  119681. } else {
  119682. data = MP42.constants.HDLR_VIDEO;
  119683. }
  119684. return MP42.box(MP42.types.hdlr, data);
  119685. };
  119686. MP42.minf = function(meta2) {
  119687. var xmhd = null;
  119688. if (meta2.type === "audio") {
  119689. xmhd = MP42.box(MP42.types.smhd, MP42.constants.SMHD);
  119690. } else {
  119691. xmhd = MP42.box(MP42.types.vmhd, MP42.constants.VMHD);
  119692. }
  119693. return MP42.box(MP42.types.minf, xmhd, MP42.dinf(), MP42.stbl(meta2));
  119694. };
  119695. MP42.dinf = function() {
  119696. var result = MP42.box(MP42.types.dinf, MP42.box(MP42.types.dref, MP42.constants.DREF));
  119697. return result;
  119698. };
  119699. MP42.stbl = function(meta2) {
  119700. var result = MP42.box(
  119701. MP42.types.stbl,
  119702. MP42.stsd(meta2),
  119703. MP42.box(MP42.types.stts, MP42.constants.STTS),
  119704. MP42.box(MP42.types.stsc, MP42.constants.STSC),
  119705. MP42.box(MP42.types.stsz, MP42.constants.STSZ),
  119706. MP42.box(MP42.types.stco, MP42.constants.STCO)
  119707. );
  119708. return result;
  119709. };
  119710. MP42.stsd = function(meta2) {
  119711. if (meta2.type === "audio") {
  119712. if (meta2.codec === "mp3") {
  119713. return MP42.box(MP42.types.stsd, MP42.constants.STSD_PREFIX, MP42.mp3(meta2));
  119714. }
  119715. return MP42.box(MP42.types.stsd, MP42.constants.STSD_PREFIX, MP42.mp4a(meta2));
  119716. } else {
  119717. return MP42.box(MP42.types.stsd, MP42.constants.STSD_PREFIX, MP42.avc1(meta2));
  119718. }
  119719. };
  119720. MP42.mp3 = function(meta2) {
  119721. var channelCount = meta2.channelCount;
  119722. var sampleRate = meta2.audioSampleRate;
  119723. var data = new Uint8Array([
  119724. 0,
  119725. 0,
  119726. 0,
  119727. 0,
  119728. 0,
  119729. 0,
  119730. 0,
  119731. 1,
  119732. 0,
  119733. 0,
  119734. 0,
  119735. 0,
  119736. 0,
  119737. 0,
  119738. 0,
  119739. 0,
  119740. 0,
  119741. channelCount,
  119742. 0,
  119743. 16,
  119744. 0,
  119745. 0,
  119746. 0,
  119747. 0,
  119748. sampleRate >>> 8 & 255,
  119749. sampleRate & 255,
  119750. 0,
  119751. 0
  119752. ]);
  119753. return MP42.box(MP42.types[".mp3"], data);
  119754. };
  119755. MP42.mp4a = function(meta2) {
  119756. var channelCount = meta2.channelCount;
  119757. var sampleRate = meta2.audioSampleRate;
  119758. var data = new Uint8Array([
  119759. 0,
  119760. 0,
  119761. 0,
  119762. 0,
  119763. 0,
  119764. 0,
  119765. 0,
  119766. 1,
  119767. 0,
  119768. 0,
  119769. 0,
  119770. 0,
  119771. 0,
  119772. 0,
  119773. 0,
  119774. 0,
  119775. 0,
  119776. channelCount,
  119777. 0,
  119778. 16,
  119779. 0,
  119780. 0,
  119781. 0,
  119782. 0,
  119783. sampleRate >>> 8 & 255,
  119784. sampleRate & 255,
  119785. 0,
  119786. 0
  119787. ]);
  119788. return MP42.box(MP42.types.mp4a, data, MP42.esds(meta2));
  119789. };
  119790. MP42.esds = function(meta2) {
  119791. var config = meta2.config || [];
  119792. var configSize = config.length;
  119793. var data = new Uint8Array([
  119794. 0,
  119795. 0,
  119796. 0,
  119797. 0,
  119798. 3,
  119799. 23 + configSize,
  119800. 0,
  119801. 1,
  119802. 0,
  119803. 4,
  119804. 15 + configSize,
  119805. 64,
  119806. 21,
  119807. 0,
  119808. 0,
  119809. 0,
  119810. 0,
  119811. 0,
  119812. 0,
  119813. 0,
  119814. 0,
  119815. 0,
  119816. 0,
  119817. 0,
  119818. 5
  119819. ].concat([
  119820. configSize
  119821. ]).concat(config).concat([
  119822. 6,
  119823. 1,
  119824. 2
  119825. ]));
  119826. return MP42.box(MP42.types.esds, data);
  119827. };
  119828. MP42.avc1 = function(meta2) {
  119829. var avcc = meta2.avcc;
  119830. var width2 = meta2.codecWidth, height2 = meta2.codecHeight;
  119831. var data = new Uint8Array([
  119832. 0,
  119833. 0,
  119834. 0,
  119835. 0,
  119836. 0,
  119837. 0,
  119838. 0,
  119839. 1,
  119840. 0,
  119841. 0,
  119842. 0,
  119843. 0,
  119844. 0,
  119845. 0,
  119846. 0,
  119847. 0,
  119848. 0,
  119849. 0,
  119850. 0,
  119851. 0,
  119852. 0,
  119853. 0,
  119854. 0,
  119855. 0,
  119856. width2 >>> 8 & 255,
  119857. width2 & 255,
  119858. height2 >>> 8 & 255,
  119859. height2 & 255,
  119860. 0,
  119861. 72,
  119862. 0,
  119863. 0,
  119864. 0,
  119865. 72,
  119866. 0,
  119867. 0,
  119868. 0,
  119869. 0,
  119870. 0,
  119871. 0,
  119872. 0,
  119873. 1,
  119874. 10,
  119875. 120,
  119876. 113,
  119877. 113,
  119878. 47,
  119879. 102,
  119880. 108,
  119881. 118,
  119882. 46,
  119883. 106,
  119884. 115,
  119885. 0,
  119886. 0,
  119887. 0,
  119888. 0,
  119889. 0,
  119890. 0,
  119891. 0,
  119892. 0,
  119893. 0,
  119894. 0,
  119895. 0,
  119896. 0,
  119897. 0,
  119898. 0,
  119899. 0,
  119900. 0,
  119901. 0,
  119902. 0,
  119903. 0,
  119904. 0,
  119905. 0,
  119906. 0,
  119907. 24,
  119908. 255,
  119909. 255
  119910. ]);
  119911. return MP42.box(MP42.types.avc1, data, MP42.box(MP42.types.avcC, avcc));
  119912. };
  119913. MP42.mvex = function(meta2) {
  119914. return MP42.box(MP42.types.mvex, MP42.trex(meta2));
  119915. };
  119916. MP42.trex = function(meta2) {
  119917. var trackId = meta2.id;
  119918. var data = new Uint8Array([
  119919. 0,
  119920. 0,
  119921. 0,
  119922. 0,
  119923. trackId >>> 24 & 255,
  119924. trackId >>> 16 & 255,
  119925. trackId >>> 8 & 255,
  119926. trackId & 255,
  119927. 0,
  119928. 0,
  119929. 0,
  119930. 1,
  119931. 0,
  119932. 0,
  119933. 0,
  119934. 0,
  119935. 0,
  119936. 0,
  119937. 0,
  119938. 0,
  119939. 0,
  119940. 1,
  119941. 0,
  119942. 1
  119943. ]);
  119944. return MP42.box(MP42.types.trex, data);
  119945. };
  119946. MP42.moof = function(track, baseMediaDecodeTime) {
  119947. return MP42.box(MP42.types.moof, MP42.mfhd(track.sequenceNumber), MP42.traf(track, baseMediaDecodeTime));
  119948. };
  119949. MP42.mfhd = function(sequenceNumber) {
  119950. var data = new Uint8Array([
  119951. 0,
  119952. 0,
  119953. 0,
  119954. 0,
  119955. sequenceNumber >>> 24 & 255,
  119956. sequenceNumber >>> 16 & 255,
  119957. sequenceNumber >>> 8 & 255,
  119958. sequenceNumber & 255
  119959. ]);
  119960. return MP42.box(MP42.types.mfhd, data);
  119961. };
  119962. MP42.traf = function(track, baseMediaDecodeTime) {
  119963. var trackId = track.id;
  119964. var tfhd = MP42.box(MP42.types.tfhd, new Uint8Array([
  119965. 0,
  119966. 0,
  119967. 0,
  119968. 0,
  119969. trackId >>> 24 & 255,
  119970. trackId >>> 16 & 255,
  119971. trackId >>> 8 & 255,
  119972. trackId & 255
  119973. ]));
  119974. var tfdt = MP42.box(MP42.types.tfdt, new Uint8Array([
  119975. 0,
  119976. 0,
  119977. 0,
  119978. 0,
  119979. baseMediaDecodeTime >>> 24 & 255,
  119980. baseMediaDecodeTime >>> 16 & 255,
  119981. baseMediaDecodeTime >>> 8 & 255,
  119982. baseMediaDecodeTime & 255
  119983. ]));
  119984. var sdtp = MP42.sdtp(track);
  119985. var trun = MP42.trun(track, sdtp.byteLength + 16 + 16 + 8 + 16 + 8 + 8);
  119986. return MP42.box(MP42.types.traf, tfhd, tfdt, trun, sdtp);
  119987. };
  119988. MP42.sdtp = function(track) {
  119989. var samples = track.samples || [];
  119990. var sampleCount = samples.length;
  119991. var data = new Uint8Array(4 + sampleCount);
  119992. for (var i2 = 0; i2 < sampleCount; i2++) {
  119993. var flags = samples[i2].flags;
  119994. data[i2 + 4] = flags.isLeading << 6 | flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy;
  119995. }
  119996. return MP42.box(MP42.types.sdtp, data);
  119997. };
  119998. MP42.trun = function(track, offset) {
  119999. var samples = track.samples || [];
  120000. var sampleCount = samples.length;
  120001. var dataSize = 12 + 16 * sampleCount;
  120002. var data = new Uint8Array(dataSize);
  120003. offset += 8 + dataSize;
  120004. data.set([
  120005. 0,
  120006. 0,
  120007. 15,
  120008. 1,
  120009. sampleCount >>> 24 & 255,
  120010. sampleCount >>> 16 & 255,
  120011. sampleCount >>> 8 & 255,
  120012. sampleCount & 255,
  120013. offset >>> 24 & 255,
  120014. offset >>> 16 & 255,
  120015. offset >>> 8 & 255,
  120016. offset & 255
  120017. ], 0);
  120018. for (var i2 = 0; i2 < sampleCount; i2++) {
  120019. var duration5 = samples[i2].duration;
  120020. var size = samples[i2].size;
  120021. var flags = samples[i2].flags;
  120022. var cts = samples[i2].cts;
  120023. data.set([
  120024. duration5 >>> 24 & 255,
  120025. duration5 >>> 16 & 255,
  120026. duration5 >>> 8 & 255,
  120027. duration5 & 255,
  120028. size >>> 24 & 255,
  120029. size >>> 16 & 255,
  120030. size >>> 8 & 255,
  120031. size & 255,
  120032. flags.isLeading << 2 | flags.dependsOn,
  120033. flags.isDependedOn << 6 | flags.hasRedundancy << 4 | flags.isNonSync,
  120034. 0,
  120035. 0,
  120036. cts >>> 24 & 255,
  120037. cts >>> 16 & 255,
  120038. cts >>> 8 & 255,
  120039. cts & 255
  120040. ], 12 + 16 * i2);
  120041. }
  120042. return MP42.box(MP42.types.trun, data);
  120043. };
  120044. MP42.mdat = function(data) {
  120045. return MP42.box(MP42.types.mdat, data);
  120046. };
  120047. return MP42;
  120048. }();
  120049. MP4.init();
  120050. __webpack_exports__2["default"] = MP4;
  120051. },
  120052. "./src/remux/mp4-remuxer.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  120053. __webpack_require__2.r(__webpack_exports__2);
  120054. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logger.js");
  120055. var _mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/remux/mp4-generator.js");
  120056. var _aac_silent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/remux/aac-silent.js");
  120057. var _utils_browser_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/utils/browser.js");
  120058. var _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/core/media-segment-info.js");
  120059. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/utils/exception.js");
  120060. var MP4Remuxer = function() {
  120061. function MP4Remuxer2(config) {
  120062. this.TAG = "MP4Remuxer";
  120063. this._config = config;
  120064. this._isLive = config.isLive === true ? true : false;
  120065. this._dtsBase = -1;
  120066. this._dtsBaseInited = false;
  120067. this._audioDtsBase = Infinity;
  120068. this._videoDtsBase = Infinity;
  120069. this._audioNextDts = void 0;
  120070. this._videoNextDts = void 0;
  120071. this._audioStashedLastSample = null;
  120072. this._videoStashedLastSample = null;
  120073. this._audioMeta = null;
  120074. this._videoMeta = null;
  120075. this._audioSegmentInfoList = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.MediaSegmentInfoList("audio");
  120076. this._videoSegmentInfoList = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.MediaSegmentInfoList("video");
  120077. this._onInitSegment = null;
  120078. this._onMediaSegment = null;
  120079. this._forceFirstIDR = _utils_browser_js__WEBPACK_IMPORTED_MODULE_3__.default.chrome && (_utils_browser_js__WEBPACK_IMPORTED_MODULE_3__.default.version.major < 50 || _utils_browser_js__WEBPACK_IMPORTED_MODULE_3__.default.version.major === 50 && _utils_browser_js__WEBPACK_IMPORTED_MODULE_3__.default.version.build < 2661) ? true : false;
  120080. this._fillSilentAfterSeek = _utils_browser_js__WEBPACK_IMPORTED_MODULE_3__.default.msedge || _utils_browser_js__WEBPACK_IMPORTED_MODULE_3__.default.msie;
  120081. this._mp3UseMpegAudio = !_utils_browser_js__WEBPACK_IMPORTED_MODULE_3__.default.firefox;
  120082. this._fillAudioTimestampGap = this._config.fixAudioTimestampGap;
  120083. }
  120084. MP4Remuxer2.prototype.destroy = function() {
  120085. this._dtsBase = -1;
  120086. this._dtsBaseInited = false;
  120087. this._audioMeta = null;
  120088. this._videoMeta = null;
  120089. this._audioSegmentInfoList.clear();
  120090. this._audioSegmentInfoList = null;
  120091. this._videoSegmentInfoList.clear();
  120092. this._videoSegmentInfoList = null;
  120093. this._onInitSegment = null;
  120094. this._onMediaSegment = null;
  120095. };
  120096. MP4Remuxer2.prototype.bindDataSource = function(producer) {
  120097. producer.onDataAvailable = this.remux.bind(this);
  120098. producer.onTrackMetadata = this._onTrackMetadataReceived.bind(this);
  120099. return this;
  120100. };
  120101. Object.defineProperty(MP4Remuxer2.prototype, "onInitSegment", {
  120102. get: function() {
  120103. return this._onInitSegment;
  120104. },
  120105. set: function(callback2) {
  120106. this._onInitSegment = callback2;
  120107. },
  120108. enumerable: false,
  120109. configurable: true
  120110. });
  120111. Object.defineProperty(MP4Remuxer2.prototype, "onMediaSegment", {
  120112. get: function() {
  120113. return this._onMediaSegment;
  120114. },
  120115. set: function(callback2) {
  120116. this._onMediaSegment = callback2;
  120117. },
  120118. enumerable: false,
  120119. configurable: true
  120120. });
  120121. MP4Remuxer2.prototype.insertDiscontinuity = function() {
  120122. this._audioNextDts = this._videoNextDts = void 0;
  120123. };
  120124. MP4Remuxer2.prototype.seek = function(originalDts) {
  120125. this._audioStashedLastSample = null;
  120126. this._videoStashedLastSample = null;
  120127. this._videoSegmentInfoList.clear();
  120128. this._audioSegmentInfoList.clear();
  120129. };
  120130. MP4Remuxer2.prototype.remux = function(audioTrack, videoTrack) {
  120131. if (!this._onMediaSegment) {
  120132. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__.IllegalStateException("MP4Remuxer: onMediaSegment callback must be specificed!");
  120133. }
  120134. if (!this._dtsBaseInited) {
  120135. this._calculateDtsBase(audioTrack, videoTrack);
  120136. }
  120137. this._remuxVideo(videoTrack);
  120138. this._remuxAudio(audioTrack);
  120139. };
  120140. MP4Remuxer2.prototype._onTrackMetadataReceived = function(type2, metadata) {
  120141. var metabox = null;
  120142. var container = "mp4";
  120143. var codec = metadata.codec;
  120144. if (type2 === "audio") {
  120145. this._audioMeta = metadata;
  120146. if (metadata.codec === "mp3" && this._mp3UseMpegAudio) {
  120147. container = "mpeg";
  120148. codec = "";
  120149. metabox = new Uint8Array();
  120150. } else {
  120151. metabox = _mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__.default.generateInitSegment(metadata);
  120152. }
  120153. } else if (type2 === "video") {
  120154. this._videoMeta = metadata;
  120155. metabox = _mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__.default.generateInitSegment(metadata);
  120156. } else {
  120157. return;
  120158. }
  120159. if (!this._onInitSegment) {
  120160. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__.IllegalStateException("MP4Remuxer: onInitSegment callback must be specified!");
  120161. }
  120162. this._onInitSegment(type2, {
  120163. type: type2,
  120164. data: metabox.buffer,
  120165. codec,
  120166. container: type2 + "/" + container,
  120167. mediaDuration: metadata.duration
  120168. });
  120169. };
  120170. MP4Remuxer2.prototype._calculateDtsBase = function(audioTrack, videoTrack) {
  120171. if (this._dtsBaseInited) {
  120172. return;
  120173. }
  120174. if (audioTrack.samples && audioTrack.samples.length) {
  120175. this._audioDtsBase = audioTrack.samples[0].dts;
  120176. }
  120177. if (videoTrack.samples && videoTrack.samples.length) {
  120178. this._videoDtsBase = videoTrack.samples[0].dts;
  120179. }
  120180. this._dtsBase = Math.min(this._audioDtsBase, this._videoDtsBase);
  120181. this._dtsBaseInited = true;
  120182. };
  120183. MP4Remuxer2.prototype.flushStashedSamples = function() {
  120184. var videoSample = this._videoStashedLastSample;
  120185. var audioSample = this._audioStashedLastSample;
  120186. var videoTrack = {
  120187. type: "video",
  120188. id: 1,
  120189. sequenceNumber: 0,
  120190. samples: [],
  120191. length: 0
  120192. };
  120193. if (videoSample != null) {
  120194. videoTrack.samples.push(videoSample);
  120195. videoTrack.length = videoSample.length;
  120196. }
  120197. var audioTrack = {
  120198. type: "audio",
  120199. id: 2,
  120200. sequenceNumber: 0,
  120201. samples: [],
  120202. length: 0
  120203. };
  120204. if (audioSample != null) {
  120205. audioTrack.samples.push(audioSample);
  120206. audioTrack.length = audioSample.length;
  120207. }
  120208. this._videoStashedLastSample = null;
  120209. this._audioStashedLastSample = null;
  120210. this._remuxVideo(videoTrack, true);
  120211. this._remuxAudio(audioTrack, true);
  120212. };
  120213. MP4Remuxer2.prototype._remuxAudio = function(audioTrack, force) {
  120214. if (this._audioMeta == null) {
  120215. return;
  120216. }
  120217. var track = audioTrack;
  120218. var samples = track.samples;
  120219. var dtsCorrection = void 0;
  120220. var firstDts = -1, lastDts = -1;
  120221. var refSampleDuration = this._audioMeta.refSampleDuration;
  120222. var mpegRawTrack = this._audioMeta.codec === "mp3" && this._mp3UseMpegAudio;
  120223. var firstSegmentAfterSeek = this._dtsBaseInited && this._audioNextDts === void 0;
  120224. var insertPrefixSilentFrame = false;
  120225. if (!samples || samples.length === 0) {
  120226. return;
  120227. }
  120228. if (samples.length === 1 && !force) {
  120229. return;
  120230. }
  120231. var offset = 0;
  120232. var mdatbox = null;
  120233. var mdatBytes = 0;
  120234. if (mpegRawTrack) {
  120235. offset = 0;
  120236. mdatBytes = track.length;
  120237. } else {
  120238. offset = 8;
  120239. mdatBytes = 8 + track.length;
  120240. }
  120241. var lastSample = null;
  120242. if (samples.length > 1) {
  120243. lastSample = samples.pop();
  120244. mdatBytes -= lastSample.length;
  120245. }
  120246. if (this._audioStashedLastSample != null) {
  120247. var sample = this._audioStashedLastSample;
  120248. this._audioStashedLastSample = null;
  120249. samples.unshift(sample);
  120250. mdatBytes += sample.length;
  120251. }
  120252. if (lastSample != null) {
  120253. this._audioStashedLastSample = lastSample;
  120254. }
  120255. var firstSampleOriginalDts = samples[0].dts - this._dtsBase;
  120256. if (this._audioNextDts) {
  120257. dtsCorrection = firstSampleOriginalDts - this._audioNextDts;
  120258. } else {
  120259. if (this._audioSegmentInfoList.isEmpty()) {
  120260. dtsCorrection = 0;
  120261. if (this._fillSilentAfterSeek && !this._videoSegmentInfoList.isEmpty()) {
  120262. if (this._audioMeta.originalCodec !== "mp3") {
  120263. insertPrefixSilentFrame = true;
  120264. }
  120265. }
  120266. } else {
  120267. var lastSample_1 = this._audioSegmentInfoList.getLastSampleBefore(firstSampleOriginalDts);
  120268. if (lastSample_1 != null) {
  120269. var distance2 = firstSampleOriginalDts - (lastSample_1.originalDts + lastSample_1.duration);
  120270. if (distance2 <= 3) {
  120271. distance2 = 0;
  120272. }
  120273. var expectedDts = lastSample_1.dts + lastSample_1.duration + distance2;
  120274. dtsCorrection = firstSampleOriginalDts - expectedDts;
  120275. } else {
  120276. dtsCorrection = 0;
  120277. }
  120278. }
  120279. }
  120280. if (insertPrefixSilentFrame) {
  120281. var firstSampleDts = firstSampleOriginalDts - dtsCorrection;
  120282. var videoSegment = this._videoSegmentInfoList.getLastSegmentBefore(firstSampleOriginalDts);
  120283. if (videoSegment != null && videoSegment.beginDts < firstSampleDts) {
  120284. var silentUnit = _aac_silent_js__WEBPACK_IMPORTED_MODULE_2__.default.getSilentFrame(this._audioMeta.originalCodec, this._audioMeta.channelCount);
  120285. if (silentUnit) {
  120286. var dts = videoSegment.beginDts;
  120287. var silentFrameDuration = firstSampleDts - videoSegment.beginDts;
  120288. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.v(this.TAG, "InsertPrefixSilentAudio: dts: " + dts + ", duration: " + silentFrameDuration);
  120289. samples.unshift({ unit: silentUnit, dts, pts: dts });
  120290. mdatBytes += silentUnit.byteLength;
  120291. }
  120292. } else {
  120293. insertPrefixSilentFrame = false;
  120294. }
  120295. }
  120296. var mp4Samples = [];
  120297. for (var i2 = 0; i2 < samples.length; i2++) {
  120298. var sample = samples[i2];
  120299. var unit = sample.unit;
  120300. var originalDts = sample.dts - this._dtsBase;
  120301. var dts = originalDts;
  120302. var needFillSilentFrames = false;
  120303. var silentFrames = null;
  120304. var sampleDuration = 0;
  120305. if (originalDts < -1e-3) {
  120306. continue;
  120307. }
  120308. if (this._audioMeta.codec !== "mp3") {
  120309. var curRefDts = originalDts;
  120310. var maxAudioFramesDrift = 3;
  120311. if (this._audioNextDts) {
  120312. curRefDts = this._audioNextDts;
  120313. }
  120314. dtsCorrection = originalDts - curRefDts;
  120315. if (dtsCorrection <= -maxAudioFramesDrift * refSampleDuration) {
  120316. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Dropping 1 audio frame (originalDts: " + originalDts + " ms ,curRefDts: " + curRefDts + " ms) due to dtsCorrection: " + dtsCorrection + " ms overlap.");
  120317. continue;
  120318. } else if (dtsCorrection >= maxAudioFramesDrift * refSampleDuration && this._fillAudioTimestampGap && !_utils_browser_js__WEBPACK_IMPORTED_MODULE_3__.default.safari) {
  120319. needFillSilentFrames = true;
  120320. var frameCount = Math.floor(dtsCorrection / refSampleDuration);
  120321. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\n" + ("originalDts: " + originalDts + " ms, curRefDts: " + curRefDts + " ms, ") + ("dtsCorrection: " + Math.round(dtsCorrection) + " ms, generate: " + frameCount + " frames"));
  120322. dts = Math.floor(curRefDts);
  120323. sampleDuration = Math.floor(curRefDts + refSampleDuration) - dts;
  120324. var silentUnit = _aac_silent_js__WEBPACK_IMPORTED_MODULE_2__.default.getSilentFrame(this._audioMeta.originalCodec, this._audioMeta.channelCount);
  120325. if (silentUnit == null) {
  120326. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Unable to generate silent frame for " + (this._audioMeta.originalCodec + " with " + this._audioMeta.channelCount + " channels, repeat last frame"));
  120327. silentUnit = unit;
  120328. }
  120329. silentFrames = [];
  120330. for (var j = 0; j < frameCount; j++) {
  120331. curRefDts = curRefDts + refSampleDuration;
  120332. var intDts = Math.floor(curRefDts);
  120333. var intDuration = Math.floor(curRefDts + refSampleDuration) - intDts;
  120334. var frame = {
  120335. dts: intDts,
  120336. pts: intDts,
  120337. cts: 0,
  120338. unit: silentUnit,
  120339. size: silentUnit.byteLength,
  120340. duration: intDuration,
  120341. originalDts,
  120342. flags: {
  120343. isLeading: 0,
  120344. dependsOn: 1,
  120345. isDependedOn: 0,
  120346. hasRedundancy: 0
  120347. }
  120348. };
  120349. silentFrames.push(frame);
  120350. mdatBytes += frame.size;
  120351. }
  120352. this._audioNextDts = curRefDts + refSampleDuration;
  120353. } else {
  120354. dts = Math.floor(curRefDts);
  120355. sampleDuration = Math.floor(curRefDts + refSampleDuration) - dts;
  120356. this._audioNextDts = curRefDts + refSampleDuration;
  120357. }
  120358. } else {
  120359. dts = originalDts - dtsCorrection;
  120360. if (i2 !== samples.length - 1) {
  120361. var nextDts = samples[i2 + 1].dts - this._dtsBase - dtsCorrection;
  120362. sampleDuration = nextDts - dts;
  120363. } else {
  120364. if (lastSample != null) {
  120365. var nextDts = lastSample.dts - this._dtsBase - dtsCorrection;
  120366. sampleDuration = nextDts - dts;
  120367. } else if (mp4Samples.length >= 1) {
  120368. sampleDuration = mp4Samples[mp4Samples.length - 1].duration;
  120369. } else {
  120370. sampleDuration = Math.floor(refSampleDuration);
  120371. }
  120372. }
  120373. this._audioNextDts = dts + sampleDuration;
  120374. }
  120375. if (firstDts === -1) {
  120376. firstDts = dts;
  120377. }
  120378. mp4Samples.push({
  120379. dts,
  120380. pts: dts,
  120381. cts: 0,
  120382. unit: sample.unit,
  120383. size: sample.unit.byteLength,
  120384. duration: sampleDuration,
  120385. originalDts,
  120386. flags: {
  120387. isLeading: 0,
  120388. dependsOn: 1,
  120389. isDependedOn: 0,
  120390. hasRedundancy: 0
  120391. }
  120392. });
  120393. if (needFillSilentFrames) {
  120394. mp4Samples.push.apply(mp4Samples, silentFrames);
  120395. }
  120396. }
  120397. if (mp4Samples.length === 0) {
  120398. track.samples = [];
  120399. track.length = 0;
  120400. return;
  120401. }
  120402. if (mpegRawTrack) {
  120403. mdatbox = new Uint8Array(mdatBytes);
  120404. } else {
  120405. mdatbox = new Uint8Array(mdatBytes);
  120406. mdatbox[0] = mdatBytes >>> 24 & 255;
  120407. mdatbox[1] = mdatBytes >>> 16 & 255;
  120408. mdatbox[2] = mdatBytes >>> 8 & 255;
  120409. mdatbox[3] = mdatBytes & 255;
  120410. mdatbox.set(_mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__.default.types.mdat, 4);
  120411. }
  120412. for (var i2 = 0; i2 < mp4Samples.length; i2++) {
  120413. var unit = mp4Samples[i2].unit;
  120414. mdatbox.set(unit, offset);
  120415. offset += unit.byteLength;
  120416. }
  120417. var latest = mp4Samples[mp4Samples.length - 1];
  120418. lastDts = latest.dts + latest.duration;
  120419. var info = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.MediaSegmentInfo();
  120420. info.beginDts = firstDts;
  120421. info.endDts = lastDts;
  120422. info.beginPts = firstDts;
  120423. info.endPts = lastDts;
  120424. info.originalBeginDts = mp4Samples[0].originalDts;
  120425. info.originalEndDts = latest.originalDts + latest.duration;
  120426. info.firstSample = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.SampleInfo(mp4Samples[0].dts, mp4Samples[0].pts, mp4Samples[0].duration, mp4Samples[0].originalDts, false);
  120427. info.lastSample = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.SampleInfo(latest.dts, latest.pts, latest.duration, latest.originalDts, false);
  120428. if (!this._isLive) {
  120429. this._audioSegmentInfoList.append(info);
  120430. }
  120431. track.samples = mp4Samples;
  120432. track.sequenceNumber++;
  120433. var moofbox = null;
  120434. if (mpegRawTrack) {
  120435. moofbox = new Uint8Array();
  120436. } else {
  120437. moofbox = _mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__.default.moof(track, firstDts);
  120438. }
  120439. track.samples = [];
  120440. track.length = 0;
  120441. var segment = {
  120442. type: "audio",
  120443. data: this._mergeBoxes(moofbox, mdatbox).buffer,
  120444. sampleCount: mp4Samples.length,
  120445. info
  120446. };
  120447. if (mpegRawTrack && firstSegmentAfterSeek) {
  120448. segment.timestampOffset = firstDts;
  120449. }
  120450. this._onMediaSegment("audio", segment);
  120451. };
  120452. MP4Remuxer2.prototype._remuxVideo = function(videoTrack, force) {
  120453. if (this._videoMeta == null) {
  120454. return;
  120455. }
  120456. var track = videoTrack;
  120457. var samples = track.samples;
  120458. var dtsCorrection = void 0;
  120459. var firstDts = -1, lastDts = -1;
  120460. var firstPts = -1, lastPts = -1;
  120461. if (!samples || samples.length === 0) {
  120462. return;
  120463. }
  120464. if (samples.length === 1 && !force) {
  120465. return;
  120466. }
  120467. var offset = 8;
  120468. var mdatbox = null;
  120469. var mdatBytes = 8 + videoTrack.length;
  120470. var lastSample = null;
  120471. if (samples.length > 1) {
  120472. lastSample = samples.pop();
  120473. mdatBytes -= lastSample.length;
  120474. }
  120475. if (this._videoStashedLastSample != null) {
  120476. var sample = this._videoStashedLastSample;
  120477. this._videoStashedLastSample = null;
  120478. samples.unshift(sample);
  120479. mdatBytes += sample.length;
  120480. }
  120481. if (lastSample != null) {
  120482. this._videoStashedLastSample = lastSample;
  120483. }
  120484. var firstSampleOriginalDts = samples[0].dts - this._dtsBase;
  120485. if (this._videoNextDts) {
  120486. dtsCorrection = firstSampleOriginalDts - this._videoNextDts;
  120487. } else {
  120488. if (this._videoSegmentInfoList.isEmpty()) {
  120489. dtsCorrection = 0;
  120490. } else {
  120491. var lastSample_2 = this._videoSegmentInfoList.getLastSampleBefore(firstSampleOriginalDts);
  120492. if (lastSample_2 != null) {
  120493. var distance2 = firstSampleOriginalDts - (lastSample_2.originalDts + lastSample_2.duration);
  120494. if (distance2 <= 3) {
  120495. distance2 = 0;
  120496. }
  120497. var expectedDts = lastSample_2.dts + lastSample_2.duration + distance2;
  120498. dtsCorrection = firstSampleOriginalDts - expectedDts;
  120499. } else {
  120500. dtsCorrection = 0;
  120501. }
  120502. }
  120503. }
  120504. var info = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.MediaSegmentInfo();
  120505. var mp4Samples = [];
  120506. for (var i2 = 0; i2 < samples.length; i2++) {
  120507. var sample = samples[i2];
  120508. var originalDts = sample.dts - this._dtsBase;
  120509. var isKeyframe = sample.isKeyframe;
  120510. var dts = originalDts - dtsCorrection;
  120511. var cts = sample.cts;
  120512. var pts = dts + cts;
  120513. if (firstDts === -1) {
  120514. firstDts = dts;
  120515. firstPts = pts;
  120516. }
  120517. var sampleDuration = 0;
  120518. if (i2 !== samples.length - 1) {
  120519. var nextDts = samples[i2 + 1].dts - this._dtsBase - dtsCorrection;
  120520. sampleDuration = nextDts - dts;
  120521. } else {
  120522. if (lastSample != null) {
  120523. var nextDts = lastSample.dts - this._dtsBase - dtsCorrection;
  120524. sampleDuration = nextDts - dts;
  120525. } else if (mp4Samples.length >= 1) {
  120526. sampleDuration = mp4Samples[mp4Samples.length - 1].duration;
  120527. } else {
  120528. sampleDuration = Math.floor(this._videoMeta.refSampleDuration);
  120529. }
  120530. }
  120531. if (isKeyframe) {
  120532. var syncPoint = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.SampleInfo(dts, pts, sampleDuration, sample.dts, true);
  120533. syncPoint.fileposition = sample.fileposition;
  120534. info.appendSyncPoint(syncPoint);
  120535. }
  120536. mp4Samples.push({
  120537. dts,
  120538. pts,
  120539. cts,
  120540. units: sample.units,
  120541. size: sample.length,
  120542. isKeyframe,
  120543. duration: sampleDuration,
  120544. originalDts,
  120545. flags: {
  120546. isLeading: 0,
  120547. dependsOn: isKeyframe ? 2 : 1,
  120548. isDependedOn: isKeyframe ? 1 : 0,
  120549. hasRedundancy: 0,
  120550. isNonSync: isKeyframe ? 0 : 1
  120551. }
  120552. });
  120553. }
  120554. mdatbox = new Uint8Array(mdatBytes);
  120555. mdatbox[0] = mdatBytes >>> 24 & 255;
  120556. mdatbox[1] = mdatBytes >>> 16 & 255;
  120557. mdatbox[2] = mdatBytes >>> 8 & 255;
  120558. mdatbox[3] = mdatBytes & 255;
  120559. mdatbox.set(_mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__.default.types.mdat, 4);
  120560. for (var i2 = 0; i2 < mp4Samples.length; i2++) {
  120561. var units = mp4Samples[i2].units;
  120562. while (units.length) {
  120563. var unit = units.shift();
  120564. var data = unit.data;
  120565. mdatbox.set(data, offset);
  120566. offset += data.byteLength;
  120567. }
  120568. }
  120569. var latest = mp4Samples[mp4Samples.length - 1];
  120570. lastDts = latest.dts + latest.duration;
  120571. lastPts = latest.pts + latest.duration;
  120572. this._videoNextDts = lastDts;
  120573. info.beginDts = firstDts;
  120574. info.endDts = lastDts;
  120575. info.beginPts = firstPts;
  120576. info.endPts = lastPts;
  120577. info.originalBeginDts = mp4Samples[0].originalDts;
  120578. info.originalEndDts = latest.originalDts + latest.duration;
  120579. info.firstSample = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.SampleInfo(mp4Samples[0].dts, mp4Samples[0].pts, mp4Samples[0].duration, mp4Samples[0].originalDts, mp4Samples[0].isKeyframe);
  120580. info.lastSample = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.SampleInfo(latest.dts, latest.pts, latest.duration, latest.originalDts, latest.isKeyframe);
  120581. if (!this._isLive) {
  120582. this._videoSegmentInfoList.append(info);
  120583. }
  120584. track.samples = mp4Samples;
  120585. track.sequenceNumber++;
  120586. if (this._forceFirstIDR) {
  120587. var flags = mp4Samples[0].flags;
  120588. flags.dependsOn = 2;
  120589. flags.isNonSync = 0;
  120590. }
  120591. var moofbox = _mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__.default.moof(track, firstDts);
  120592. track.samples = [];
  120593. track.length = 0;
  120594. this._onMediaSegment("video", {
  120595. type: "video",
  120596. data: this._mergeBoxes(moofbox, mdatbox).buffer,
  120597. sampleCount: mp4Samples.length,
  120598. info
  120599. });
  120600. };
  120601. MP4Remuxer2.prototype._mergeBoxes = function(moof, mdat) {
  120602. var result = new Uint8Array(moof.byteLength + mdat.byteLength);
  120603. result.set(moof, 0);
  120604. result.set(mdat, moof.byteLength);
  120605. return result;
  120606. };
  120607. return MP4Remuxer2;
  120608. }();
  120609. __webpack_exports__2["default"] = MP4Remuxer;
  120610. },
  120611. "./src/utils/browser.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  120612. __webpack_require__2.r(__webpack_exports__2);
  120613. var Browser = {};
  120614. function detect() {
  120615. var ua = self.navigator.userAgent.toLowerCase();
  120616. var match = /(edge)\/([\w.]+)/.exec(ua) || /(opr)[\/]([\w.]+)/.exec(ua) || /(chrome)[ \/]([\w.]+)/.exec(ua) || /(iemobile)[\/]([\w.]+)/.exec(ua) || /(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(ua) || /(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(ua) || /(webkit)[ \/]([\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ua.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec(ua) || ua.indexOf("compatible") < 0 && /(firefox)[ \/]([\w.]+)/.exec(ua) || [];
  120617. var platform_match = /(ipad)/.exec(ua) || /(ipod)/.exec(ua) || /(windows phone)/.exec(ua) || /(iphone)/.exec(ua) || /(kindle)/.exec(ua) || /(android)/.exec(ua) || /(windows)/.exec(ua) || /(mac)/.exec(ua) || /(linux)/.exec(ua) || /(cros)/.exec(ua) || [];
  120618. var matched = {
  120619. browser: match[5] || match[3] || match[1] || "",
  120620. version: match[2] || match[4] || "0",
  120621. majorVersion: match[4] || match[2] || "0",
  120622. platform: platform_match[0] || ""
  120623. };
  120624. var browser2 = {};
  120625. if (matched.browser) {
  120626. browser2[matched.browser] = true;
  120627. var versionArray = matched.majorVersion.split(".");
  120628. browser2.version = {
  120629. major: parseInt(matched.majorVersion, 10),
  120630. string: matched.version
  120631. };
  120632. if (versionArray.length > 1) {
  120633. browser2.version.minor = parseInt(versionArray[1], 10);
  120634. }
  120635. if (versionArray.length > 2) {
  120636. browser2.version.build = parseInt(versionArray[2], 10);
  120637. }
  120638. }
  120639. if (matched.platform) {
  120640. browser2[matched.platform] = true;
  120641. }
  120642. if (browser2.chrome || browser2.opr || browser2.safari) {
  120643. browser2.webkit = true;
  120644. }
  120645. if (browser2.rv || browser2.iemobile) {
  120646. if (browser2.rv) {
  120647. delete browser2.rv;
  120648. }
  120649. var msie = "msie";
  120650. matched.browser = msie;
  120651. browser2[msie] = true;
  120652. }
  120653. if (browser2.edge) {
  120654. delete browser2.edge;
  120655. var msedge = "msedge";
  120656. matched.browser = msedge;
  120657. browser2[msedge] = true;
  120658. }
  120659. if (browser2.opr) {
  120660. var opera = "opera";
  120661. matched.browser = opera;
  120662. browser2[opera] = true;
  120663. }
  120664. if (browser2.safari && browser2.android) {
  120665. var android = "android";
  120666. matched.browser = android;
  120667. browser2[android] = true;
  120668. }
  120669. browser2.name = matched.browser;
  120670. browser2.platform = matched.platform;
  120671. for (var key in Browser) {
  120672. if (Browser.hasOwnProperty(key)) {
  120673. delete Browser[key];
  120674. }
  120675. }
  120676. Object.assign(Browser, browser2);
  120677. }
  120678. detect();
  120679. __webpack_exports__2["default"] = Browser;
  120680. },
  120681. "./src/utils/exception.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  120682. __webpack_require__2.r(__webpack_exports__2);
  120683. __webpack_require__2.d(__webpack_exports__2, {
  120684. "RuntimeException": function() {
  120685. return RuntimeException;
  120686. },
  120687. "IllegalStateException": function() {
  120688. return IllegalStateException;
  120689. },
  120690. "InvalidArgumentException": function() {
  120691. return InvalidArgumentException;
  120692. },
  120693. "NotImplementedException": function() {
  120694. return NotImplementedException;
  120695. }
  120696. });
  120697. var __extends = function() {
  120698. var extendStatics = function(d2, b) {
  120699. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b2) {
  120700. d3.__proto__ = b2;
  120701. } || function(d3, b2) {
  120702. for (var p in b2)
  120703. if (Object.prototype.hasOwnProperty.call(b2, p))
  120704. d3[p] = b2[p];
  120705. };
  120706. return extendStatics(d2, b);
  120707. };
  120708. return function(d2, b) {
  120709. if (typeof b !== "function" && b !== null)
  120710. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  120711. extendStatics(d2, b);
  120712. function __() {
  120713. this.constructor = d2;
  120714. }
  120715. d2.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  120716. };
  120717. }();
  120718. var RuntimeException = function() {
  120719. function RuntimeException2(message) {
  120720. this._message = message;
  120721. }
  120722. Object.defineProperty(RuntimeException2.prototype, "name", {
  120723. get: function() {
  120724. return "RuntimeException";
  120725. },
  120726. enumerable: false,
  120727. configurable: true
  120728. });
  120729. Object.defineProperty(RuntimeException2.prototype, "message", {
  120730. get: function() {
  120731. return this._message;
  120732. },
  120733. enumerable: false,
  120734. configurable: true
  120735. });
  120736. RuntimeException2.prototype.toString = function() {
  120737. return this.name + ": " + this.message;
  120738. };
  120739. return RuntimeException2;
  120740. }();
  120741. var IllegalStateException = function(_super) {
  120742. __extends(IllegalStateException2, _super);
  120743. function IllegalStateException2(message) {
  120744. return _super.call(this, message) || this;
  120745. }
  120746. Object.defineProperty(IllegalStateException2.prototype, "name", {
  120747. get: function() {
  120748. return "IllegalStateException";
  120749. },
  120750. enumerable: false,
  120751. configurable: true
  120752. });
  120753. return IllegalStateException2;
  120754. }(RuntimeException);
  120755. var InvalidArgumentException = function(_super) {
  120756. __extends(InvalidArgumentException2, _super);
  120757. function InvalidArgumentException2(message) {
  120758. return _super.call(this, message) || this;
  120759. }
  120760. Object.defineProperty(InvalidArgumentException2.prototype, "name", {
  120761. get: function() {
  120762. return "InvalidArgumentException";
  120763. },
  120764. enumerable: false,
  120765. configurable: true
  120766. });
  120767. return InvalidArgumentException2;
  120768. }(RuntimeException);
  120769. var NotImplementedException = function(_super) {
  120770. __extends(NotImplementedException2, _super);
  120771. function NotImplementedException2(message) {
  120772. return _super.call(this, message) || this;
  120773. }
  120774. Object.defineProperty(NotImplementedException2.prototype, "name", {
  120775. get: function() {
  120776. return "NotImplementedException";
  120777. },
  120778. enumerable: false,
  120779. configurable: true
  120780. });
  120781. return NotImplementedException2;
  120782. }(RuntimeException);
  120783. },
  120784. "./src/utils/logger.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  120785. __webpack_require__2.r(__webpack_exports__2);
  120786. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  120787. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  120788. var Log = function() {
  120789. function Log2() {
  120790. }
  120791. Log2.e = function(tag, msg) {
  120792. if (!tag || Log2.FORCE_GLOBAL_TAG)
  120793. tag = Log2.GLOBAL_TAG;
  120794. var str = "[" + tag + "] > " + msg;
  120795. if (Log2.ENABLE_CALLBACK) {
  120796. Log2.emitter.emit("log", "error", str);
  120797. }
  120798. if (!Log2.ENABLE_ERROR) {
  120799. return;
  120800. }
  120801. if (console.error) {
  120802. console.error(str);
  120803. } else if (console.warn) {
  120804. console.warn(str);
  120805. } else {
  120806. console.log(str);
  120807. }
  120808. };
  120809. Log2.i = function(tag, msg) {
  120810. if (!tag || Log2.FORCE_GLOBAL_TAG)
  120811. tag = Log2.GLOBAL_TAG;
  120812. var str = "[" + tag + "] > " + msg;
  120813. if (Log2.ENABLE_CALLBACK) {
  120814. Log2.emitter.emit("log", "info", str);
  120815. }
  120816. if (!Log2.ENABLE_INFO) {
  120817. return;
  120818. }
  120819. if (console.info) {
  120820. console.info(str);
  120821. } else {
  120822. console.log(str);
  120823. }
  120824. };
  120825. Log2.w = function(tag, msg) {
  120826. if (!tag || Log2.FORCE_GLOBAL_TAG)
  120827. tag = Log2.GLOBAL_TAG;
  120828. var str = "[" + tag + "] > " + msg;
  120829. if (Log2.ENABLE_CALLBACK) {
  120830. Log2.emitter.emit("log", "warn", str);
  120831. }
  120832. if (!Log2.ENABLE_WARN) {
  120833. return;
  120834. }
  120835. if (console.warn) {
  120836. console.warn(str);
  120837. } else {
  120838. console.log(str);
  120839. }
  120840. };
  120841. Log2.d = function(tag, msg) {
  120842. if (!tag || Log2.FORCE_GLOBAL_TAG)
  120843. tag = Log2.GLOBAL_TAG;
  120844. var str = "[" + tag + "] > " + msg;
  120845. if (Log2.ENABLE_CALLBACK) {
  120846. Log2.emitter.emit("log", "debug", str);
  120847. }
  120848. if (!Log2.ENABLE_DEBUG) {
  120849. return;
  120850. }
  120851. if (console.debug) {
  120852. console.debug(str);
  120853. } else {
  120854. console.log(str);
  120855. }
  120856. };
  120857. Log2.v = function(tag, msg) {
  120858. if (!tag || Log2.FORCE_GLOBAL_TAG)
  120859. tag = Log2.GLOBAL_TAG;
  120860. var str = "[" + tag + "] > " + msg;
  120861. if (Log2.ENABLE_CALLBACK) {
  120862. Log2.emitter.emit("log", "verbose", str);
  120863. }
  120864. if (!Log2.ENABLE_VERBOSE) {
  120865. return;
  120866. }
  120867. console.log(str);
  120868. };
  120869. return Log2;
  120870. }();
  120871. Log.GLOBAL_TAG = "flv.js";
  120872. Log.FORCE_GLOBAL_TAG = false;
  120873. Log.ENABLE_ERROR = true;
  120874. Log.ENABLE_INFO = true;
  120875. Log.ENABLE_WARN = true;
  120876. Log.ENABLE_DEBUG = true;
  120877. Log.ENABLE_VERBOSE = true;
  120878. Log.ENABLE_CALLBACK = false;
  120879. Log.emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  120880. __webpack_exports__2["default"] = Log;
  120881. },
  120882. "./src/utils/logging-control.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  120883. __webpack_require__2.r(__webpack_exports__2);
  120884. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  120885. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  120886. var _logger_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/logger.js");
  120887. var LoggingControl = function() {
  120888. function LoggingControl2() {
  120889. }
  120890. Object.defineProperty(LoggingControl2, "forceGlobalTag", {
  120891. get: function() {
  120892. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.FORCE_GLOBAL_TAG;
  120893. },
  120894. set: function(enable) {
  120895. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.FORCE_GLOBAL_TAG = enable;
  120896. LoggingControl2._notifyChange();
  120897. },
  120898. enumerable: false,
  120899. configurable: true
  120900. });
  120901. Object.defineProperty(LoggingControl2, "globalTag", {
  120902. get: function() {
  120903. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.GLOBAL_TAG;
  120904. },
  120905. set: function(tag) {
  120906. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.GLOBAL_TAG = tag;
  120907. LoggingControl2._notifyChange();
  120908. },
  120909. enumerable: false,
  120910. configurable: true
  120911. });
  120912. Object.defineProperty(LoggingControl2, "enableAll", {
  120913. get: function() {
  120914. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_VERBOSE && _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_DEBUG && _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_INFO && _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_WARN && _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_ERROR;
  120915. },
  120916. set: function(enable) {
  120917. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_VERBOSE = enable;
  120918. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_DEBUG = enable;
  120919. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_INFO = enable;
  120920. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_WARN = enable;
  120921. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_ERROR = enable;
  120922. LoggingControl2._notifyChange();
  120923. },
  120924. enumerable: false,
  120925. configurable: true
  120926. });
  120927. Object.defineProperty(LoggingControl2, "enableDebug", {
  120928. get: function() {
  120929. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_DEBUG;
  120930. },
  120931. set: function(enable) {
  120932. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_DEBUG = enable;
  120933. LoggingControl2._notifyChange();
  120934. },
  120935. enumerable: false,
  120936. configurable: true
  120937. });
  120938. Object.defineProperty(LoggingControl2, "enableVerbose", {
  120939. get: function() {
  120940. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_VERBOSE;
  120941. },
  120942. set: function(enable) {
  120943. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_VERBOSE = enable;
  120944. LoggingControl2._notifyChange();
  120945. },
  120946. enumerable: false,
  120947. configurable: true
  120948. });
  120949. Object.defineProperty(LoggingControl2, "enableInfo", {
  120950. get: function() {
  120951. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_INFO;
  120952. },
  120953. set: function(enable) {
  120954. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_INFO = enable;
  120955. LoggingControl2._notifyChange();
  120956. },
  120957. enumerable: false,
  120958. configurable: true
  120959. });
  120960. Object.defineProperty(LoggingControl2, "enableWarn", {
  120961. get: function() {
  120962. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_WARN;
  120963. },
  120964. set: function(enable) {
  120965. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_WARN = enable;
  120966. LoggingControl2._notifyChange();
  120967. },
  120968. enumerable: false,
  120969. configurable: true
  120970. });
  120971. Object.defineProperty(LoggingControl2, "enableError", {
  120972. get: function() {
  120973. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_ERROR;
  120974. },
  120975. set: function(enable) {
  120976. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_ERROR = enable;
  120977. LoggingControl2._notifyChange();
  120978. },
  120979. enumerable: false,
  120980. configurable: true
  120981. });
  120982. LoggingControl2.getConfig = function() {
  120983. return {
  120984. globalTag: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.GLOBAL_TAG,
  120985. forceGlobalTag: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.FORCE_GLOBAL_TAG,
  120986. enableVerbose: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_VERBOSE,
  120987. enableDebug: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_DEBUG,
  120988. enableInfo: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_INFO,
  120989. enableWarn: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_WARN,
  120990. enableError: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_ERROR,
  120991. enableCallback: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_CALLBACK
  120992. };
  120993. };
  120994. LoggingControl2.applyConfig = function(config) {
  120995. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.GLOBAL_TAG = config.globalTag;
  120996. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.FORCE_GLOBAL_TAG = config.forceGlobalTag;
  120997. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_VERBOSE = config.enableVerbose;
  120998. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_DEBUG = config.enableDebug;
  120999. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_INFO = config.enableInfo;
  121000. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_WARN = config.enableWarn;
  121001. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_ERROR = config.enableError;
  121002. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_CALLBACK = config.enableCallback;
  121003. };
  121004. LoggingControl2._notifyChange = function() {
  121005. var emitter = LoggingControl2.emitter;
  121006. if (emitter.listenerCount("change") > 0) {
  121007. var config = LoggingControl2.getConfig();
  121008. emitter.emit("change", config);
  121009. }
  121010. };
  121011. LoggingControl2.registerListener = function(listener) {
  121012. LoggingControl2.emitter.addListener("change", listener);
  121013. };
  121014. LoggingControl2.removeListener = function(listener) {
  121015. LoggingControl2.emitter.removeListener("change", listener);
  121016. };
  121017. LoggingControl2.addLogListener = function(listener) {
  121018. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.emitter.addListener("log", listener);
  121019. if (_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.emitter.listenerCount("log") > 0) {
  121020. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_CALLBACK = true;
  121021. LoggingControl2._notifyChange();
  121022. }
  121023. };
  121024. LoggingControl2.removeLogListener = function(listener) {
  121025. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.emitter.removeListener("log", listener);
  121026. if (_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.emitter.listenerCount("log") === 0) {
  121027. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_CALLBACK = false;
  121028. LoggingControl2._notifyChange();
  121029. }
  121030. };
  121031. return LoggingControl2;
  121032. }();
  121033. LoggingControl.emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  121034. __webpack_exports__2["default"] = LoggingControl;
  121035. },
  121036. "./src/utils/polyfill.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  121037. __webpack_require__2.r(__webpack_exports__2);
  121038. var Polyfill = function() {
  121039. function Polyfill2() {
  121040. }
  121041. Polyfill2.install = function() {
  121042. Object.setPrototypeOf = Object.setPrototypeOf || function(obj, proto) {
  121043. obj.__proto__ = proto;
  121044. return obj;
  121045. };
  121046. Object.assign = Object.assign || function(target) {
  121047. if (target === void 0 || target === null) {
  121048. throw new TypeError("Cannot convert undefined or null to object");
  121049. }
  121050. var output = Object(target);
  121051. for (var i2 = 1; i2 < arguments.length; i2++) {
  121052. var source = arguments[i2];
  121053. if (source !== void 0 && source !== null) {
  121054. for (var key in source) {
  121055. if (source.hasOwnProperty(key)) {
  121056. output[key] = source[key];
  121057. }
  121058. }
  121059. }
  121060. }
  121061. return output;
  121062. };
  121063. if (typeof self.Promise !== "function") {
  121064. __webpack_require__2("./node_modules/es6-promise/dist/es6-promise.js").polyfill();
  121065. }
  121066. };
  121067. return Polyfill2;
  121068. }();
  121069. Polyfill.install();
  121070. __webpack_exports__2["default"] = Polyfill;
  121071. },
  121072. "./src/utils/utf8-conv.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  121073. __webpack_require__2.r(__webpack_exports__2);
  121074. function checkContinuation(uint8array, start2, checkLength) {
  121075. var array = uint8array;
  121076. if (start2 + checkLength < array.length) {
  121077. while (checkLength--) {
  121078. if ((array[++start2] & 192) !== 128)
  121079. return false;
  121080. }
  121081. return true;
  121082. } else {
  121083. return false;
  121084. }
  121085. }
  121086. function decodeUTF8(uint8array) {
  121087. var out = [];
  121088. var input = uint8array;
  121089. var i2 = 0;
  121090. var length = uint8array.length;
  121091. while (i2 < length) {
  121092. if (input[i2] < 128) {
  121093. out.push(String.fromCharCode(input[i2]));
  121094. ++i2;
  121095. continue;
  121096. } else if (input[i2] < 192)
  121097. ;
  121098. else if (input[i2] < 224) {
  121099. if (checkContinuation(input, i2, 1)) {
  121100. var ucs4 = (input[i2] & 31) << 6 | input[i2 + 1] & 63;
  121101. if (ucs4 >= 128) {
  121102. out.push(String.fromCharCode(ucs4 & 65535));
  121103. i2 += 2;
  121104. continue;
  121105. }
  121106. }
  121107. } else if (input[i2] < 240) {
  121108. if (checkContinuation(input, i2, 2)) {
  121109. var ucs4 = (input[i2] & 15) << 12 | (input[i2 + 1] & 63) << 6 | input[i2 + 2] & 63;
  121110. if (ucs4 >= 2048 && (ucs4 & 63488) !== 55296) {
  121111. out.push(String.fromCharCode(ucs4 & 65535));
  121112. i2 += 3;
  121113. continue;
  121114. }
  121115. }
  121116. } else if (input[i2] < 248) {
  121117. if (checkContinuation(input, i2, 3)) {
  121118. var ucs4 = (input[i2] & 7) << 18 | (input[i2 + 1] & 63) << 12 | (input[i2 + 2] & 63) << 6 | input[i2 + 3] & 63;
  121119. if (ucs4 > 65536 && ucs4 < 1114112) {
  121120. ucs4 -= 65536;
  121121. out.push(String.fromCharCode(ucs4 >>> 10 | 55296));
  121122. out.push(String.fromCharCode(ucs4 & 1023 | 56320));
  121123. i2 += 4;
  121124. continue;
  121125. }
  121126. }
  121127. }
  121128. out.push(String.fromCharCode(65533));
  121129. ++i2;
  121130. }
  121131. return out.join("");
  121132. }
  121133. __webpack_exports__2["default"] = decodeUTF8;
  121134. }
  121135. };
  121136. var __webpack_module_cache__ = {};
  121137. function __webpack_require__(moduleId) {
  121138. var cachedModule = __webpack_module_cache__[moduleId];
  121139. if (cachedModule !== void 0) {
  121140. return cachedModule.exports;
  121141. }
  121142. var module3 = __webpack_module_cache__[moduleId] = {
  121143. exports: {}
  121144. };
  121145. __webpack_modules__[moduleId].call(module3.exports, module3, module3.exports, __webpack_require__);
  121146. return module3.exports;
  121147. }
  121148. __webpack_require__.m = __webpack_modules__;
  121149. !function() {
  121150. __webpack_require__.n = function(module3) {
  121151. var getter = module3 && module3.__esModule ? function() {
  121152. return module3["default"];
  121153. } : function() {
  121154. return module3;
  121155. };
  121156. __webpack_require__.d(getter, { a: getter });
  121157. return getter;
  121158. };
  121159. }();
  121160. !function() {
  121161. __webpack_require__.d = function(exports3, definition) {
  121162. for (var key in definition) {
  121163. if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports3, key)) {
  121164. Object.defineProperty(exports3, key, { enumerable: true, get: definition[key] });
  121165. }
  121166. }
  121167. };
  121168. }();
  121169. !function() {
  121170. __webpack_require__.g = function() {
  121171. if (typeof globalThis === "object")
  121172. return globalThis;
  121173. try {
  121174. return this || new Function("return this")();
  121175. } catch (e) {
  121176. if (typeof window === "object")
  121177. return window;
  121178. }
  121179. }();
  121180. }();
  121181. !function() {
  121182. __webpack_require__.o = function(obj, prop) {
  121183. return Object.prototype.hasOwnProperty.call(obj, prop);
  121184. };
  121185. }();
  121186. !function() {
  121187. __webpack_require__.r = function(exports3) {
  121188. if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
  121189. Object.defineProperty(exports3, Symbol.toStringTag, { value: "Module" });
  121190. }
  121191. Object.defineProperty(exports3, "__esModule", { value: true });
  121192. };
  121193. }();
  121194. var __webpack_exports__ = __webpack_require__("./src/index.js");
  121195. return __webpack_exports__;
  121196. }();
  121197. });
  121198. })(flv);
  121199. var flvjs = /* @__PURE__ */ getDefaultExportFromCjs(flv.exports);
  121200. const Html5 = videojs$2.getTech("Html5");
  121201. const mergeOptions = videojs$2.mergeOptions || videojs$2.util.mergeOptions;
  121202. const defaults = {
  121203. mediaDataSource: {},
  121204. config: {}
  121205. };
  121206. class Flvjs extends Html5 {
  121207. constructor(options2, ready) {
  121208. options2 = mergeOptions(defaults, options2);
  121209. super(options2, ready);
  121210. }
  121211. setSrc(src) {
  121212. if (this.flvPlayer) {
  121213. this.flvPlayer.detachMediaElement();
  121214. this.flvPlayer.destroy();
  121215. }
  121216. const mediaDataSource = this.options_.mediaDataSource;
  121217. const config = this.options_.config;
  121218. mediaDataSource.type = mediaDataSource.type === void 0 ? "flv" : mediaDataSource.type;
  121219. mediaDataSource.url = src;
  121220. this.flvPlayer = flvjs.createPlayer(mediaDataSource, config);
  121221. this.flvPlayer.attachMediaElement(this.el_);
  121222. this.flvPlayer.load();
  121223. }
  121224. dispose() {
  121225. if (this.flvPlayer) {
  121226. this.flvPlayer.detachMediaElement();
  121227. this.flvPlayer.destroy();
  121228. }
  121229. super.dispose();
  121230. }
  121231. }
  121232. Flvjs.isSupported = function() {
  121233. return flvjs && flvjs.isSupported();
  121234. };
  121235. Flvjs.formats = {
  121236. "video/flv": "FLV",
  121237. "video/x-flv": "FLV"
  121238. };
  121239. Flvjs.canPlayType = function(type2) {
  121240. if (Flvjs.isSupported() && type2 in Flvjs.formats) {
  121241. return "maybe";
  121242. }
  121243. return "";
  121244. };
  121245. Flvjs.canPlaySource = function(srcObj, options2) {
  121246. return Flvjs.canPlayType(srcObj.type);
  121247. };
  121248. Flvjs.VERSION = "__VERSION__";
  121249. videojs$2.registerTech("Flvjs", Flvjs);
  121250. var VideoWindow$1 = "";
  121251. class VideoWindow {
  121252. constructor(viewer2, position2, videoInfo, offsetHeight) {
  121253. if (!viewer2)
  121254. throw new Cesium.DeveloperError("no viewer object!");
  121255. if (!position2)
  121256. throw new Cesium.DeveloperError("no position object!");
  121257. this.viewer = viewer2;
  121258. this.position = position2;
  121259. this.offsetHeight = offsetHeight;
  121260. if (position2 instanceof Cesium.Cartesian3) {
  121261. this.position = position2;
  121262. } else {
  121263. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  121264. }
  121265. if (document.getElementsByClassName("popup-video").length > 0) {
  121266. document.getElementsByClassName("popup-video")[0].remove();
  121267. viewer2.entities.remove(viewer2.entities.getById("videoPopupPoint"));
  121268. }
  121269. this.id = "popup_video_" + getGuid();
  121270. this.popupDiv = document.createElement("div");
  121271. this.popupDiv.classList.add("popup-video");
  121272. this.popupDiv.id = this.id;
  121273. this.viewer.container.append(this.popupDiv);
  121274. this.popupDiv.innerHTML = this._createHtml(videoInfo);
  121275. switch (videoInfo.type) {
  121276. case "hls":
  121277. this.videotype = "application/x-mpegURL";
  121278. break;
  121279. case "rtmp":
  121280. this.videotype = "rtmp/flv";
  121281. break;
  121282. case "flv":
  121283. this.videotype = "video/x-flv";
  121284. break;
  121285. case "mp4":
  121286. this.videotype = "video/mp4";
  121287. break;
  121288. }
  121289. this.videoPlayer = videojs$2(document.querySelector("#myvideo"), {
  121290. controls: true,
  121291. autoplay: "muted",
  121292. loop: true,
  121293. muted: false,
  121294. fluid: true,
  121295. aspectRatio: "16:9",
  121296. reload: "auto",
  121297. fullscreen: {
  121298. options: {
  121299. navigationUI: "hide"
  121300. }
  121301. },
  121302. sources: [{
  121303. src: videoInfo.url,
  121304. type: this.videotype
  121305. }]
  121306. }, function onPlayerReady() {
  121307. console.log("onPlayerReady", this);
  121308. });
  121309. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  121310. this.initPoint();
  121311. document.getElementsByClassName("popup-video1-close-button")[0].onclick = () => {
  121312. this.close();
  121313. };
  121314. }
  121315. postRender() {
  121316. this.viewer.scene.canvas.height;
  121317. const windowPosition = new Cesium.Cartesian2();
  121318. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  121319. this.viewer.scene,
  121320. this.position,
  121321. windowPosition
  121322. );
  121323. let elWidth = this.popupDiv.offsetWidth;
  121324. let elHeight = this.popupDiv.offsetHeight;
  121325. if (!!this.offsetHeight) {
  121326. elHeight += this.offsetHeight;
  121327. }
  121328. this.popupDiv.style.left = windowPosition.x - elWidth / 2 + "px";
  121329. this.popupDiv.style.top = windowPosition.y - elHeight + "px";
  121330. const camerPosition = this.viewer.camera.position;
  121331. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  121332. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  121333. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  121334. this.popupDiv.style.display = "block";
  121335. } else {
  121336. this.popupDiv.style.display = "none";
  121337. }
  121338. }
  121339. _createHtml(videoInfo) {
  121340. let html = `
  121341. <div class="popup-video-header">
  121342. ${videoInfo.name}
  121343. <span class="popup-video1-close-button">\xD7</span>
  121344. </div>
  121345. <div class="popup-video-content">
  121346. <video id="myvideo" class="video-js vjs-big-play-centered vjs-fluid" controls preload="auto" width="100%" height="100%"></video>
  121347. </div>
  121348. <div class="popup-video-tip">
  121349. </div>
  121350. `;
  121351. return html;
  121352. }
  121353. initPoint() {
  121354. this.billboard = new Cesium.Entity({
  121355. id: "videoPopupPoint",
  121356. name: "popupPoint",
  121357. position: this.position,
  121358. billboard: {
  121359. image: "jt3dSDK/imgs/point/point.png",
  121360. horizontalOrigin: Cesium.HorizontalOrigin.center,
  121361. verticalOrigin: Cesium.VerticalOrigin.bottom,
  121362. scale: 1,
  121363. pixelOffset: new Cesium.Cartesian2(0, 0),
  121364. disableDepthTestDistance: Number.POSITIVE_INFINITY
  121365. }
  121366. });
  121367. this.viewer.entities.add(this.billboard);
  121368. }
  121369. }
  121370. Object.assign(VideoWindow.prototype, {
  121371. close() {
  121372. this.popupDiv.remove();
  121373. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  121374. this.viewer.entities.remove(this.billboard);
  121375. videojs$2("myvideo").dispose();
  121376. this.videoPlayer.dispose();
  121377. }
  121378. });
  121379. var VideoWindow2$1 = "";
  121380. class VideoWindow2 {
  121381. constructor(viewer2, position2, videoInfo) {
  121382. if (!viewer2)
  121383. throw new Cesium.DeveloperError("no viewer object!");
  121384. if (!position2)
  121385. throw new Cesium.DeveloperError("no position object!");
  121386. this.viewer = viewer2;
  121387. this.position = position2;
  121388. if (position2 instanceof Cesium.Cartesian3) {
  121389. this.position = position2;
  121390. } else {
  121391. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  121392. }
  121393. if (document.getElementsByClassName("popup-video2").length > 0) {
  121394. document.getElementsByClassName("popup-video2")[0].remove();
  121395. }
  121396. this.id = "popup_video_" + getGuid();
  121397. this.popupDiv = document.createElement("div");
  121398. this.popupDiv.classList.add("popup-video2");
  121399. this.popupDiv.id = this.id;
  121400. this.viewer.container.append(this.popupDiv);
  121401. this.popupDiv.innerHTML = this._createHtml(videoInfo);
  121402. switch (videoInfo.type) {
  121403. case "hls":
  121404. this.videotype = "application/x-mpegURL";
  121405. break;
  121406. case "rtmp":
  121407. this.videotype = "rtmp/flv";
  121408. break;
  121409. case "flv":
  121410. this.videotype = "video/x-flv";
  121411. break;
  121412. case "mp4":
  121413. this.videotype = "video/mp4";
  121414. break;
  121415. }
  121416. this.videoPlayer = videojs$2(document.querySelector("#myvideo"), {
  121417. controls: true,
  121418. autoplay: "muted",
  121419. loop: true,
  121420. muted: false,
  121421. fluid: true,
  121422. aspectRatio: "16:9",
  121423. reload: "auto",
  121424. fullscreen: {
  121425. options: {
  121426. navigationUI: "hide"
  121427. }
  121428. },
  121429. sources: [{
  121430. src: videoInfo.url,
  121431. type: this.videotype
  121432. }]
  121433. }, function onPlayerReady() {
  121434. console.log("onPlayerReady", this);
  121435. });
  121436. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  121437. document.getElementsByClassName("popup-video2-close-button")[0].onclick = () => {
  121438. this.close();
  121439. };
  121440. }
  121441. postRender() {
  121442. this.viewer.scene.canvas.height;
  121443. const windowPosition = new Cesium.Cartesian2();
  121444. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  121445. this.viewer.scene,
  121446. this.position,
  121447. windowPosition
  121448. );
  121449. this.popupDiv.style.left = windowPosition.x - this.popupDiv.offsetWidth - 120 + "px";
  121450. this.popupDiv.style.top = windowPosition.y + "px";
  121451. const camerPosition = this.viewer.camera.position;
  121452. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  121453. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  121454. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  121455. this.popupDiv.style.display = "block";
  121456. } else {
  121457. this.popupDiv.style.display = "none";
  121458. }
  121459. }
  121460. _createHtml(videoInfo) {
  121461. let html = `
  121462. <div class="rightLine-1"></div>
  121463. <div class="rightLine-2"></div>
  121464. <div class="rightLine-3"></div>
  121465. <div class="popup-header">
  121466. <span class="popup-title" >${videoInfo.name}</span>
  121467. <span class="popup-video2-close-button" title="\u5173\u95ED" >\xD7</span>
  121468. </div>
  121469. <div class="popup-content">
  121470. <video id="myvideo" class="video-js vjs-big-play-centered vjs-fluid" controls preload="auto" width="100%" height="100%"></video>
  121471. </div>
  121472. `;
  121473. return html;
  121474. }
  121475. }
  121476. Object.assign(VideoWindow2.prototype, {
  121477. close() {
  121478. this.popupDiv.remove();
  121479. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  121480. }
  121481. });
  121482. var VideoWindow3$1 = "";
  121483. class VideoWindow3 {
  121484. constructor(viewer2, position2, videoInfo) {
  121485. if (!viewer2)
  121486. throw new Cesium.DeveloperError("no viewer object!");
  121487. if (!position2)
  121488. throw new Cesium.DeveloperError("no position object!");
  121489. this.viewer = viewer2;
  121490. this.position = position2;
  121491. if (position2 instanceof Cesium.Cartesian3) {
  121492. this.position = position2;
  121493. } else {
  121494. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  121495. }
  121496. if (document.getElementsByClassName("popup-video3").length > 0) {
  121497. document.getElementsByClassName("popup-video3")[0].remove();
  121498. }
  121499. this.id = "popup_video_" + getGuid();
  121500. this.popupDiv = document.createElement("div");
  121501. this.popupDiv.classList.add("popup-video3");
  121502. this.popupDiv.id = this.id;
  121503. this.viewer.container.append(this.popupDiv);
  121504. this.popupDiv.innerHTML = this._createHtml(videoInfo);
  121505. switch (videoInfo.type) {
  121506. case "hls":
  121507. this.videotype = "application/x-mpegURL";
  121508. break;
  121509. case "rtmp":
  121510. this.videotype = "rtmp/flv";
  121511. break;
  121512. case "flv":
  121513. this.videotype = "video/x-flv";
  121514. break;
  121515. case "mp4":
  121516. this.videotype = "video/mp4";
  121517. break;
  121518. }
  121519. this.videoPlayer = videojs$2(document.querySelector("#myvideo"), {
  121520. controls: true,
  121521. autoplay: "muted",
  121522. loop: true,
  121523. muted: false,
  121524. fluid: true,
  121525. aspectRatio: "16:9",
  121526. reload: "auto",
  121527. fullscreen: {
  121528. options: {
  121529. navigationUI: "hide"
  121530. }
  121531. },
  121532. sources: [{
  121533. src: videoInfo.url,
  121534. type: this.videotype
  121535. }]
  121536. }, function onPlayerReady() {
  121537. console.log("onPlayerReady", this);
  121538. });
  121539. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  121540. document.getElementsByClassName("popup-video3-close-button")[0].onclick = () => {
  121541. this.close();
  121542. };
  121543. }
  121544. postRender() {
  121545. this.viewer.scene.canvas.height;
  121546. const windowPosition = new Cesium.Cartesian2();
  121547. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  121548. this.viewer.scene,
  121549. this.position,
  121550. windowPosition
  121551. );
  121552. this.popupDiv.style.left = windowPosition.x + 70 + "px";
  121553. this.popupDiv.style.top = windowPosition.y - this.popupDiv.offsetHeight - 20 + "px";
  121554. const camerPosition = this.viewer.camera.position;
  121555. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  121556. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  121557. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  121558. this.popupDiv.style.display = "block";
  121559. } else {
  121560. this.popupDiv.style.display = "none";
  121561. }
  121562. }
  121563. _createHtml(videoInfo) {
  121564. let html = `
  121565. <div class="leftLine-1"></div>
  121566. <div class="leftLine-2"></div>
  121567. <div class="popup-header">
  121568. <span class="popup-title" >${videoInfo.name}</span>
  121569. <span class="popup-video3-close-button" title="\u5173\u95ED" >\xD7</span>
  121570. </div>
  121571. <div class="popup-content">
  121572. <video id="myvideo" class="video-js vjs-big-play-centered vjs-fluid" controls preload="auto" width="100%" height="100%"></video>
  121573. </div>
  121574. `;
  121575. return html;
  121576. }
  121577. }
  121578. Object.assign(VideoWindow3.prototype, {
  121579. close() {
  121580. this.popupDiv.remove();
  121581. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  121582. }
  121583. });
  121584. var HtmlWindow1 = "";
  121585. class HtmlWindow {
  121586. constructor(viewer2, position2, title, html, offsetHeight) {
  121587. if (!viewer2)
  121588. throw new Cesium.DeveloperError("no viewer object!");
  121589. if (!position2)
  121590. throw new Cesium.DeveloperError("no position object!");
  121591. this.viewer = viewer2;
  121592. this.offsetHeight = offsetHeight;
  121593. if (position2 instanceof Cesium.Cartesian3) {
  121594. this.position = position2;
  121595. } else {
  121596. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  121597. }
  121598. if (document.getElementsByClassName("popup1").length > 0) {
  121599. document.getElementsByClassName("popup1")[0].remove();
  121600. viewer2.entities.remove(viewer2.entities.getById("popupPoint"));
  121601. }
  121602. this.id = "popup_" + getGuid();
  121603. this.popupDiv = document.createElement("div");
  121604. this.popupDiv.classList.add("popup1");
  121605. this.popupDiv.id = this.id;
  121606. this.viewer.container.append(this.popupDiv);
  121607. this.popupDiv.innerHTML = this._createHtml(title, html);
  121608. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  121609. this.initPoint();
  121610. document.getElementsByClassName("popup1-close-button")[0].onclick = () => {
  121611. this.close();
  121612. };
  121613. }
  121614. postRender() {
  121615. this.viewer.scene.canvas.height;
  121616. const windowPosition = new Cesium.Cartesian2();
  121617. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  121618. this.viewer.scene,
  121619. this.position,
  121620. windowPosition
  121621. );
  121622. let elWidth = this.popupDiv.offsetWidth;
  121623. let elHeight = this.popupDiv.offsetHeight;
  121624. if (!!this.offsetHeight) {
  121625. elHeight += this.offsetHeight;
  121626. }
  121627. this.popupDiv.style.left = windowPosition.x - elWidth / 2 + "px";
  121628. this.popupDiv.style.top = windowPosition.y - elHeight + "px";
  121629. const camerPosition = this.viewer.camera.position;
  121630. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  121631. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  121632. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  121633. this.popupDiv.style.display = "block";
  121634. } else {
  121635. this.popupDiv.style.display = "none";
  121636. }
  121637. }
  121638. _createHtml(header, content) {
  121639. let html = `
  121640. <div class="popup-header">
  121641. ${header}
  121642. <span class="popup1-close-button">\xD7</span>
  121643. </div>
  121644. <div class="popup-content">
  121645. ${content}
  121646. </div>
  121647. <div class="popup-tip">
  121648. </div>
  121649. `;
  121650. return html;
  121651. }
  121652. initPoint() {
  121653. this.billboard = this.viewer.entities.add({
  121654. id: "popupPoint",
  121655. name: "popupPoint",
  121656. position: this.position,
  121657. billboard: {
  121658. image: "jt3dSDK/imgs/point/point.png",
  121659. horizontalOrigin: Cesium.HorizontalOrigin.center,
  121660. verticalOrigin: Cesium.VerticalOrigin.bottom,
  121661. scale: 1,
  121662. pixelOffset: new Cesium.Cartesian2(0, 0),
  121663. disableDepthTestDistance: Number.POSITIVE_INFINITY
  121664. }
  121665. });
  121666. }
  121667. }
  121668. Object.assign(HtmlWindow.prototype, {
  121669. close() {
  121670. this.popupDiv.remove();
  121671. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  121672. this.viewer.entities.remove(this.billboard);
  121673. }
  121674. });
  121675. var HtmlWindow2$1 = "";
  121676. class HtmlWindow2 {
  121677. constructor(viewer2, position2, title, html) {
  121678. if (!viewer2)
  121679. throw new Cesium.DeveloperError("no viewer object!");
  121680. if (!position2)
  121681. throw new Cesium.DeveloperError("no position object!");
  121682. this.viewer = viewer2;
  121683. this.position = position2;
  121684. if (position2 instanceof Cesium.Cartesian3) {
  121685. this.position = position2;
  121686. } else {
  121687. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  121688. }
  121689. if (document.getElementsByClassName("popup2").length > 0) {
  121690. document.getElementsByClassName("popup2")[0].remove();
  121691. }
  121692. this.id = "popup_" + getGuid();
  121693. this.popupDiv = document.createElement("div");
  121694. this.popupDiv.classList.add("popup2");
  121695. this.popupDiv.id = this.id;
  121696. this.viewer.container.append(this.popupDiv);
  121697. this.popupDiv.innerHTML = this._createHtml(title, html);
  121698. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  121699. document.getElementsByClassName("popup2-close-button")[0].onclick = () => {
  121700. this.close();
  121701. };
  121702. }
  121703. postRender() {
  121704. this.viewer.scene.canvas.height;
  121705. const windowPosition = new Cesium.Cartesian2();
  121706. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  121707. this.viewer.scene,
  121708. this.position,
  121709. windowPosition
  121710. );
  121711. this.popupDiv.style.left = windowPosition.x - this.popupDiv.offsetWidth - 120 + "px";
  121712. this.popupDiv.style.top = windowPosition.y + "px";
  121713. const camerPosition = this.viewer.camera.position;
  121714. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  121715. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  121716. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  121717. this.popupDiv.style.display = "block";
  121718. } else {
  121719. this.popupDiv.style.display = "none";
  121720. }
  121721. }
  121722. _createHtml(title, content) {
  121723. let html = `
  121724. <div class="rightLine-1"></div>
  121725. <div class="rightLine-2"></div>
  121726. <div class="rightLine-3"></div>
  121727. <div class="popup-header">
  121728. <span class="popup-title" >${title}</span>
  121729. <span class="popup2-close-button" title="\u5173\u95ED" >\xD7</span>
  121730. </div>
  121731. <div class="popup-content">
  121732. ${content}
  121733. </div>
  121734. `;
  121735. return html;
  121736. }
  121737. }
  121738. Object.assign(HtmlWindow2.prototype, {
  121739. close() {
  121740. this.popupDiv.remove();
  121741. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  121742. }
  121743. });
  121744. var HtmlWindow3$1 = "";
  121745. class HtmlWindow3 {
  121746. constructor(viewer2, position2, title, html) {
  121747. if (!viewer2)
  121748. throw new Cesium.DeveloperError("no viewer object!");
  121749. if (!position2)
  121750. throw new Cesium.DeveloperError("no position object!");
  121751. this.viewer = viewer2;
  121752. this.position = position2;
  121753. if (position2 instanceof Cesium.Cartesian3) {
  121754. this.position = position2;
  121755. } else {
  121756. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  121757. }
  121758. if (document.getElementsByClassName("popup3").length > 0) {
  121759. document.getElementsByClassName("popup3")[0].remove();
  121760. }
  121761. this.id = "popup_" + getGuid();
  121762. this.popupDiv = document.createElement("div");
  121763. this.popupDiv.classList.add("popup3");
  121764. this.popupDiv.id = this.id;
  121765. this.viewer.container.append(this.popupDiv);
  121766. this.popupDiv.innerHTML = this._createHtml(title, html);
  121767. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  121768. document.getElementsByClassName("popup3-close-button")[0].onclick = () => {
  121769. this.close();
  121770. };
  121771. }
  121772. postRender() {
  121773. this.viewer.scene.canvas.height;
  121774. const windowPosition = new Cesium.Cartesian2();
  121775. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  121776. this.viewer.scene,
  121777. this.position,
  121778. windowPosition
  121779. );
  121780. this.popupDiv.style.left = windowPosition.x + 70 + "px";
  121781. this.popupDiv.style.top = windowPosition.y - this.popupDiv.offsetHeight - 20 + "px";
  121782. const camerPosition = this.viewer.camera.position;
  121783. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  121784. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  121785. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  121786. this.popupDiv.style.display = "block";
  121787. } else {
  121788. this.popupDiv.style.display = "none";
  121789. }
  121790. }
  121791. _createHtml(title, content) {
  121792. let html = `
  121793. <div class="leftLine-1"></div>
  121794. <div class="leftLine-2"></div>
  121795. <div class="popup-header">
  121796. <span class="popup-title" >${title}</span>
  121797. <span class="popup3-close-button" title="\u5173\u95ED" >\xD7</span>
  121798. </div>
  121799. <div class="popup-content">
  121800. ${content}
  121801. </div>
  121802. `;
  121803. return html;
  121804. }
  121805. }
  121806. Object.assign(HtmlWindow3.prototype, {
  121807. close() {
  121808. this.popupDiv.remove();
  121809. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  121810. }
  121811. });
  121812. let PopupWindow = {
  121813. MultiFieldAdaptWindow,
  121814. VideoWindow,
  121815. VideoWindow2,
  121816. VideoWindow3,
  121817. HtmlWindow,
  121818. HtmlWindow2,
  121819. HtmlWindow3
  121820. };
  121821. class AroundPoint {
  121822. constructor(viewer2, amount, position2) {
  121823. this._viewer = viewer2;
  121824. this._amount = amount;
  121825. this._position = position2;
  121826. this._range = this._viewer.camera.positionCartographic.height;
  121827. }
  121828. _bindEvent() {
  121829. let _self = this;
  121830. this._viewer.clock.onTick.addEventListener(this._aroundPoint, this);
  121831. var handler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  121832. handler.setInputAction(function(click) {
  121833. _self.stop();
  121834. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  121835. }
  121836. _unbindEvent() {
  121837. this._viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
  121838. this._viewer.clock.onTick.removeEventListener(this._aroundPoint, this);
  121839. }
  121840. start() {
  121841. this._viewer.clock.shouldAnimate = true;
  121842. this._unbindEvent();
  121843. this._bindEvent();
  121844. return this;
  121845. }
  121846. stop() {
  121847. this._unbindEvent();
  121848. return this;
  121849. }
  121850. _aroundPoint() {
  121851. let heading = this._viewer.camera.heading;
  121852. let pitch = this._viewer.camera.pitch;
  121853. let range3 = this._range;
  121854. heading += Cesium.Math.toRadians(this._amount);
  121855. if (heading >= Math.PI * 2 || heading <= -Math.PI * 2) {
  121856. heading = 0;
  121857. }
  121858. this._viewer.camera.lookAt(
  121859. this._position,
  121860. new Cesium.HeadingPitchRange(
  121861. heading,
  121862. pitch,
  121863. range3
  121864. )
  121865. );
  121866. }
  121867. }
  121868. class AroundView {
  121869. constructor(viewer2, amount) {
  121870. this._viewer = viewer2;
  121871. this._amount = amount;
  121872. }
  121873. _bindEvent() {
  121874. let _self = this;
  121875. this._viewer.clock.onTick.addEventListener(this._aroundView, this);
  121876. var handler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  121877. handler.setInputAction(function(click) {
  121878. _self.stop();
  121879. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  121880. }
  121881. _unbindEvent() {
  121882. this._viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
  121883. this._viewer.clock.onTick.removeEventListener(this._aroundView, this);
  121884. }
  121885. start() {
  121886. this._viewer.clock.shouldAnimate = true;
  121887. this._unbindEvent();
  121888. this._bindEvent();
  121889. return this;
  121890. }
  121891. stop() {
  121892. this._unbindEvent();
  121893. return this;
  121894. }
  121895. _aroundView() {
  121896. let heading = this._viewer.camera.heading;
  121897. let pitch = this._viewer.camera.pitch;
  121898. let roll = this._viewer.camera.roll;
  121899. heading += Cesium.Math.toRadians(this._amount);
  121900. if (heading >= Math.PI * 2 || heading <= -Math.PI * 2) {
  121901. heading = 0;
  121902. }
  121903. this._viewer.camera.setView({
  121904. orientation: {
  121905. heading,
  121906. pitch,
  121907. roll
  121908. }
  121909. });
  121910. }
  121911. }
  121912. export { AroundPoint, AroundView, CircleObject, CommonTools, CoordTransform, CrImageServerLayer, DrawMilitaryPlot, DrawPoint, DrawTools, LocateUtil, PointObject, PolygonObject, PolylineObject, PopupWindow, CreateRemindertip as ReminderTip, Roaming, RuntimeEnvironment, SceneControl, SceneEffects, SketchViewModel, SpatialAnalysis, StatusBar, TerrainAnalysis, TrackRoam, WallObject, common, jtMap3d, LoadMapData as layer };